Doxygen Book
gsttensor_sink.c File Reference

GStreamer plugin to handle tensor stream. More...

#include "gsttensor_sink.h"
Include dependency graph for gsttensor_sink.c:

Go to the source code of this file.

Macros

#define DBG   (!self->silent)
 Macro for debug mode. More...
 
#define silent_debug_timestamp(self, buf)
 
#define GST_CAT_DEFAULT   gst_tensor_sink_debug
 
#define DEFAULT_EMIT_SIGNAL   TRUE
 Flag to emit signals. More...
 
#define DEFAULT_SIGNAL_RATE   0
 New data signals per second. More...
 
#define DEFAULT_SILENT   TRUE
 Flag to print minimized log. More...
 
#define DEFAULT_QOS   TRUE
 Flag for qos event. More...
 
#define DEFAULT_SYNC   FALSE
 Flag to synchronize on the clock (Default FALSE). It may be delayed with tensor_filter element, to invoke neural network model. See GstBaseSink::sync property for more details. More...
 
#define gst_tensor_sink_parent_class   parent_class
 

Enumerations

enum  { SIGNAL_NEW_DATA, SIGNAL_STREAM_START, SIGNAL_EOS, LAST_SIGNAL }
 tensor_sink signals. More...
 
enum  { PROP_0, PROP_SIGNAL_RATE, PROP_EMIT_SIGNAL, PROP_SILENT }
 tensor_sink properties. More...
 

Functions

 GST_DEBUG_CATEGORY_STATIC (gst_tensor_sink_debug)
 
static void gst_tensor_sink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 Setter for tensor_sink properties. More...
 
static void gst_tensor_sink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 Getter for tensor_sink properties. More...
 
static void gst_tensor_sink_finalize (GObject *object)
 Function to finalize instance. More...
 
static gboolean gst_tensor_sink_event (GstBaseSink *sink, GstEvent *event)
 Handle events. More...
 
static gboolean gst_tensor_sink_query (GstBaseSink *sink, GstQuery *query)
 Handle queries. More...
 
static GstFlowReturn gst_tensor_sink_render (GstBaseSink *sink, GstBuffer *buffer)
 Handle buffer. More...
 
static GstFlowReturn gst_tensor_sink_render_list (GstBaseSink *sink, GstBufferList *buffer_list)
 Handle list of buffers. More...
 
static void gst_tensor_sink_render_buffer (GstTensorSink *self, GstBuffer *buffer)
 Handle buffer data. More...
 
static void gst_tensor_sink_set_last_render_time (GstTensorSink *self, GstClockTime now)
 Setter for value last_render_time. More...
 
static GstClockTime gst_tensor_sink_get_last_render_time (GstTensorSink *self)
 Getter for value last_render_time. More...
 
static void gst_tensor_sink_set_signal_rate (GstTensorSink *self, guint rate)
 Setter for value signal_rate. More...
 
static guint gst_tensor_sink_get_signal_rate (GstTensorSink *self)
 Getter for value signal_rate. More...
 
static void gst_tensor_sink_set_emit_signal (GstTensorSink *self, gboolean emit)
 Setter for flag emit_signal. More...
 
static gboolean gst_tensor_sink_get_emit_signal (GstTensorSink *self)
 Getter for flag emit_signal. More...
 
static void gst_tensor_sink_set_silent (GstTensorSink *self, gboolean silent)
 Setter for flag silent. More...
 
static gboolean gst_tensor_sink_get_silent (GstTensorSink *self)
 Getter for flag silent. More...
 
 G_DEFINE_TYPE (GstTensorSink, gst_tensor_sink, GST_TYPE_BASE_SINK)
 
static void gst_tensor_sink_class_init (GstTensorSinkClass *klass)
 Initialize tensor_sink class. More...
 
static void gst_tensor_sink_init (GstTensorSink *self)
 Initialize tensor_sink element. More...
 

Variables

static guint _tensor_sink_signals [LAST_SIGNAL] = { 0 }
 Variable for signal ids. More...
 

Detailed Description

GStreamer plugin to handle tensor stream.

GStreamer Copyright (C) 2005 Thomas Vander Stichele thoma.nosp@m.s@ap.nosp@m.estaa.nosp@m.rt.o.nosp@m.rg Copyright (C) 2005 Ronald S. Bultje rbult.nosp@m.je@r.nosp@m.onald.nosp@m..bit.nosp@m.freak.nosp@m..net Copyright (C) 2018 Samsung Electronics Co., Ltd.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; version 2.1 of the License.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. SECTION:element-tensor_sink

Sink element to handle tensor stream

Date
15 June 2018
See also
https://github.com/nnstreamer/nnstreamer
Author
Jaeyun Jung jy121.nosp@m.0.ju.nosp@m.ng@sa.nosp@m.msun.nosp@m.g.com
Bug:
No known bugs except for NYI items

Definition in file gsttensor_sink.c.

Macro Definition Documentation

◆ DBG

#define DBG   (!self->silent)

Macro for debug mode.

Definition at line 41 of file gsttensor_sink.c.

◆ DEFAULT_EMIT_SIGNAL

#define DEFAULT_EMIT_SIGNAL   TRUE

Flag to emit signals.

Definition at line 80 of file gsttensor_sink.c.

◆ DEFAULT_QOS

#define DEFAULT_QOS   TRUE

Flag for qos event.

See GstBaseSink::qos property for more details.

Definition at line 97 of file gsttensor_sink.c.

◆ DEFAULT_SIGNAL_RATE

#define DEFAULT_SIGNAL_RATE   0

New data signals per second.

Definition at line 85 of file gsttensor_sink.c.

◆ DEFAULT_SILENT

#define DEFAULT_SILENT   TRUE

Flag to print minimized log.

Definition at line 90 of file gsttensor_sink.c.

◆ DEFAULT_SYNC

#define DEFAULT_SYNC   FALSE

Flag to synchronize on the clock (Default FALSE). It may be delayed with tensor_filter element, to invoke neural network model. See GstBaseSink::sync property for more details.

Definition at line 104 of file gsttensor_sink.c.

◆ GST_CAT_DEFAULT

#define GST_CAT_DEFAULT   gst_tensor_sink_debug

Definition at line 53 of file gsttensor_sink.c.

◆ gst_tensor_sink_parent_class

#define gst_tensor_sink_parent_class   parent_class

Definition at line 140 of file gsttensor_sink.c.

◆ silent_debug_timestamp

#define silent_debug_timestamp (   self,
  buf 
)
Value:
do { \
if (DBG) { \
GST_DEBUG_OBJECT (self, "pts = %" GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_PTS (buf))); \
GST_DEBUG_OBJECT (self, "dts = %" GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_DTS (buf))); \
GST_DEBUG_OBJECT (self, "duration = %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (GST_BUFFER_DURATION (buf))); \
} \
} while (0)

Definition at line 44 of file gsttensor_sink.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

tensor_sink signals.

Enumerator
SIGNAL_NEW_DATA 
SIGNAL_STREAM_START 
SIGNAL_EOS 
LAST_SIGNAL 

Definition at line 58 of file gsttensor_sink.c.

◆ anonymous enum

anonymous enum

tensor_sink properties.

Enumerator
PROP_0 
PROP_SIGNAL_RATE 
PROP_EMIT_SIGNAL 
PROP_SILENT 

Definition at line 69 of file gsttensor_sink.c.

Function Documentation

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( GstTensorSink  ,
gst_tensor_sink  ,
GST_TYPE_BASE_SINK   
)

◆ GST_DEBUG_CATEGORY_STATIC()

GST_DEBUG_CATEGORY_STATIC ( gst_tensor_sink_debug  )

◆ gst_tensor_sink_class_init()

static void gst_tensor_sink_class_init ( GstTensorSinkClass klass)
static

Initialize tensor_sink class.

GObject methods

GstTensorSink::signal-rate:

The number of new data signals per second (Default 0 for unlimited, MAX 500) If signal-rate is larger than 0, GstTensorSink calculates the time to emit a signal with this property. If set 0 (default value), all the received buffers will be passed to the application.

Please note that this property does not guarantee the periodic signals. This means if GstTensorSink cannot get the buffers in time, it will pass all the buffers. (working like default 0)

GstTensorSink::emit-signal:

The flag to emit the signals for new data, stream start, and eos.

GstTensorSink::silent:

The flag to enable/disable debugging messages.

GstTensorSink::new-data:

Signal to get the buffer from GstTensorSink.

GstTensorSink::stream-start:

Signal to indicate the start of a new stream. Optional. An application can use this signal to detect the start of a new stream, instead of the message GST_MESSAGE_STREAM_START from pipeline.

GstTensorSink::eos:

Signal to indicate the end-of-stream. Optional. An application can use this signal to detect the EOS (end-of-stream), instead of the message GST_MESSAGE_EOS from pipeline.

pad template

GstBaseSink methods

Definition at line 147 of file gsttensor_sink.c.

Here is the call graph for this function:

◆ gst_tensor_sink_event()

static gboolean gst_tensor_sink_event ( GstBaseSink *  sink,
GstEvent *  event 
)
static

Handle events.

GstBaseSink method implementation

GstBaseSink method implementation.

Definition at line 365 of file gsttensor_sink.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_sink_finalize()

static void gst_tensor_sink_finalize ( GObject *  object)
static

Function to finalize instance.

GObject method implementation.

Definition at line 348 of file gsttensor_sink.c.

Here is the caller graph for this function:

◆ gst_tensor_sink_get_emit_signal()

static gboolean gst_tensor_sink_get_emit_signal ( GstTensorSink self)
static

Getter for flag emit_signal.

Definition at line 610 of file gsttensor_sink.c.

Here is the caller graph for this function:

◆ gst_tensor_sink_get_last_render_time()

static GstClockTime gst_tensor_sink_get_last_render_time ( GstTensorSink self)
static

Getter for value last_render_time.

Definition at line 548 of file gsttensor_sink.c.

Here is the caller graph for this function:

◆ gst_tensor_sink_get_property()

static void gst_tensor_sink_get_property ( GObject *  object,
guint  prop_id,
GValue *  value,
GParamSpec *  pspec 
)
static

Getter for tensor_sink properties.

GObject method implementation.

Definition at line 316 of file gsttensor_sink.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_sink_get_signal_rate()

static guint gst_tensor_sink_get_signal_rate ( GstTensorSink self)
static

Getter for value signal_rate.

Definition at line 579 of file gsttensor_sink.c.

Here is the caller graph for this function:

◆ gst_tensor_sink_get_silent()

static gboolean gst_tensor_sink_get_silent ( GstTensorSink self)
static

Getter for flag silent.

Definition at line 639 of file gsttensor_sink.c.

Here is the caller graph for this function:

◆ gst_tensor_sink_init()

static void gst_tensor_sink_init ( GstTensorSink self)
static

Initialize tensor_sink element.

init properties

enable qos

Definition at line 257 of file gsttensor_sink.c.

◆ gst_tensor_sink_query()

static gboolean gst_tensor_sink_query ( GstBaseSink *  sink,
GstQuery *  query 
)
static

Handle queries.

GstBaseSink method implementation.

tensor sink does not support seeking

Definition at line 406 of file gsttensor_sink.c.

Here is the caller graph for this function:

◆ gst_tensor_sink_render()

static GstFlowReturn gst_tensor_sink_render ( GstBaseSink *  sink,
GstBuffer *  buffer 
)
static

Handle buffer.

GstBaseSink method implementation.

Definition at line 438 of file gsttensor_sink.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_sink_render_buffer()

static void gst_tensor_sink_render_buffer ( GstTensorSink self,
GstBuffer *  buffer 
)
static

Handle buffer data.

internal functions

Returns
None
Parameters
selfpointer to GstTensorSink
bufferpointer to GstBuffer to be handled

time for next signal

send data after render time, or firstly received buffer

send data if signal rate is 0

Definition at line 479 of file gsttensor_sink.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_sink_render_list()

static GstFlowReturn gst_tensor_sink_render_list ( GstBaseSink *  sink,
GstBufferList *  buffer_list 
)
static

Handle list of buffers.

GstBaseSink method implementation.

Definition at line 454 of file gsttensor_sink.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_sink_set_emit_signal()

static void gst_tensor_sink_set_emit_signal ( GstTensorSink self,
gboolean  emit 
)
static

Setter for flag emit_signal.

Definition at line 596 of file gsttensor_sink.c.

Here is the caller graph for this function:

◆ gst_tensor_sink_set_last_render_time()

static void gst_tensor_sink_set_last_render_time ( GstTensorSink self,
GstClockTime  now 
)
static

Setter for value last_render_time.

Definition at line 535 of file gsttensor_sink.c.

Here is the caller graph for this function:

◆ gst_tensor_sink_set_property()

static void gst_tensor_sink_set_property ( GObject *  object,
guint  prop_id,
const GValue *  value,
GParamSpec *  pspec 
)
static

Setter for tensor_sink properties.

GObject method implementation

GObject method implementation.

Definition at line 284 of file gsttensor_sink.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_sink_set_signal_rate()

static void gst_tensor_sink_set_signal_rate ( GstTensorSink self,
guint  rate 
)
static

Setter for value signal_rate.

Definition at line 565 of file gsttensor_sink.c.

Here is the caller graph for this function:

◆ gst_tensor_sink_set_silent()

static void gst_tensor_sink_set_silent ( GstTensorSink self,
gboolean  silent 
)
static

Setter for flag silent.

Definition at line 627 of file gsttensor_sink.c.

Here is the caller graph for this function:

Variable Documentation

◆ _tensor_sink_signals

guint _tensor_sink_signals[LAST_SIGNAL] = { 0 }
static

Variable for signal ids.

Definition at line 109 of file gsttensor_sink.c.

DBG
#define DBG
Macro for debug mode.
Definition: gsttensor_sink.c:41