Doxygen Book
gsttensor_converter.c File Reference

GStreamer plugin to convert media types to tensors (as a filter for other general neural network filters) More...

Include dependency graph for gsttensor_converter.c:

Go to the source code of this file.

Macros

#define TEXT_CAPS_STR   "text/x-raw, format = (string) utf8"
 Caps string for text input. More...
 
#define append_text_caps_template(caps)   gst_caps_append (caps, gst_caps_from_string (TEXT_CAPS_STR))
 
#define OCTET_CAPS_STR   "application/octet-stream"
 Caps string for binary stream. More...
 
#define append_octet_caps_template(caps)   gst_caps_append (caps, gst_caps_from_string (OCTET_CAPS_STR))
 
#define append_flex_tensor_caps_template(caps)   gst_caps_append (caps, gst_caps_from_string (GST_TENSORS_FLEX_CAP_DEFAULT))
 Macro to append template caps for flexible tensor. More...
 
#define DBG   (!self->silent)
 Macro for debug mode. More...
 
#define silent_debug_timestamp(self, buf)
 
#define GST_CAT_DEFAULT   gst_tensor_converter_debug
 
#define STRING_CUSTOM_MODE(self)
 
#define DEFAULT_SET_TIMESTAMP   TRUE
 Flag to set timestamp when received a buffer with invalid timestamp. More...
 
#define DEFAULT_SILENT   TRUE
 Flag to print minimized log. More...
 
#define DEFAULT_FRAMES_PER_TENSOR   1
 Frames in output tensor. More...
 
#define gst_tensor_converter_parent_class   parent_class
 

Enumerations

enum  {
  PROP_0, PROP_INPUT_DIMENSION, PROP_INPUT_TYPE, PROP_FRAMES_PER_TENSOR,
  PROP_SET_TIMESTAMP, PROP_SUBPLUGINS, PROP_SILENT, PROP_MODE
}
 tensor_converter properties More...
 

Functions

 GST_DEBUG_CATEGORY_STATIC (gst_tensor_converter_debug)
 
 G_DEFINE_TYPE (GstTensorConverter, gst_tensor_converter, GST_TYPE_ELEMENT)
 
static void gst_tensor_converter_finalize (GObject *object)
 Function to finalize instance. More...
 
static void gst_tensor_converter_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 Setter for tensor_converter properties. More...
 
static void gst_tensor_converter_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 Getter for tensor_converter properties. More...
 
static gboolean gst_tensor_converter_sink_event (GstPad *pad, GstObject *parent, GstEvent *event)
 This function handles sink event. More...
 
static gboolean gst_tensor_converter_sink_query (GstPad *pad, GstObject *parent, GstQuery *query)
 This function handles sink pad query. More...
 
static gboolean gst_tensor_converter_src_query (GstPad *pad, GstObject *parent, GstQuery *query)
 This function handles src pad query. More...
 
static GstFlowReturn gst_tensor_converter_chain (GstPad *pad, GstObject *parent, GstBuffer *buf)
 Chain function, this function does the actual processing. More...
 
static GstStateChangeReturn gst_tensor_converter_change_state (GstElement *element, GstStateChange transition)
 Called to perform state change. More...
 
static void gst_tensor_converter_reset (GstTensorConverter *self)
 Clear and reset data. More...
 
static GstCaps * gst_tensor_converter_query_caps (GstTensorConverter *self, GstPad *pad, GstCaps *filter)
 Get pad caps for caps negotiation. More...
 
static gboolean gst_tensor_converter_parse_caps (GstTensorConverter *self, const GstCaps *caps)
 Parse caps and set tensors info. More...
 
static void gst_tensor_converter_update_caps (GstTensorConverter *self)
 Update src pad caps from tensors config. More...
 
static const NNStreamerExternalConverterfindExternalConverter (const char *media_type)
 Internal static function to find registered subplugins. More...
 
static void gst_tensor_converter_class_init (GstTensorConverterClass *klass)
 Initialize the tensor_converter's class. More...
 
static void gst_tensor_converter_init (GstTensorConverter *self)
 Initialize tensor_converter element. More...
 
static GstAdapter * gst_tensor_converter_get_adapter (GstTensorConverter *self, GstBuffer *buf)
 Internal function to get adapter. More...
 
static void _gst_tensor_converter_chain_segment (GstTensorConverter *self, gsize frame_size)
 Chain function's private routine. More...
 
static void _gst_tensor_converter_chain_timestamp (GstTensorConverter *self, GstBuffer *inbuf, guint frames_in)
 Chain function's private routine. More...
 
static GstBuffer * _gst_tensor_converter_chain_octet (GstTensorConverter *self, GstBuffer *buf)
 Chain function's private routine to process octet stream. More...
 
static GstBuffer * _gst_tensor_converter_chain_flex_tensor (GstTensorConverter *self, GstBuffer *buf)
 Chain function's private routine to process flex tensor. More...
 
static GstFlowReturn _gst_tensor_converter_chain_push (GstTensorConverter *self, GstBuffer *buf)
 Chain function's private routine to push buffer into src pad. More...
 
static GstFlowReturn _gst_tensor_converter_chain_chunk (GstTensorConverter *self, GstBuffer *inbuf, guint frames_in, guint frames_out, gsize frame_size)
 Chain function's private routine to push multiple buffers. More...
 
static void gst_tensor_converter_get_format_list (GValue *list,...)
 Get supported format list. More...
 
static gboolean gst_tensor_converter_video_stride (GstVideoFormat format, gint width)
 Determine if we need zero-padding. More...
 
static gboolean gst_tensor_converter_parse_video (GstTensorConverter *self, const GstCaps *caps, GstTensorsConfig *config)
 Set the tensors config structure from video info (internal static function) More...
 
static gboolean gst_tensor_converter_parse_audio (GstTensorConverter *self, const GstCaps *caps, GstTensorsConfig *config)
 Set the tensors config structure from audio info (internal static function) More...
 
static gboolean gst_tensor_converter_parse_text (GstTensorConverter *self, GstTensorsConfig *config, const GstStructure *structure)
 Set the tensors config structure from text info (internal static function) More...
 
static gboolean gst_tensor_converter_parse_octet (GstTensorConverter *self, GstTensorsConfig *config, const GstStructure *structure)
 Set the tensors configs structure from octet stream (internal static function) More...
 
static gboolean gst_tensor_converter_parse_tensor (GstTensorConverter *self, GstTensorsConfig *config, const GstStructure *structure)
 Set the tensors configs structure from fliex tensor stream (internal static function) More...
 
static gboolean gst_tensor_converter_parse_custom (GstTensorConverter *self, GstTensorsConfig *config, const GstCaps *caps)
 Set the tensors config structure from caps (internal static function for custom mode) More...
 
static GstCaps * gst_tensor_converter_get_possible_media_caps (GstTensorConverter *self)
 Get possible media-caps from downstream element. More...
 
const NNStreamerExternalConverternnstreamer_converter_find (const char *name)
 Find converter sub-plugin with the name. More...
 
static gboolean nnstreamer_converter_validate (const NNStreamerExternalConverter *converter)
 Validate converter sub-plugin's data. More...
 
int registerExternalConverter (NNStreamerExternalConverter *ex)
 Converter's external subplugins should call this at init. More...
 
void unregisterExternalConverter (const char *name)
 Converter's external subplugins should call this at exit. More...
 
void nnstreamer_converter_set_custom_property_desc (const char *name, const char *prop,...)
 set custom property description for tensor converter sub-plugin More...
 
int nnstreamer_converter_custom_register (const gchar *name, tensor_converter_custom func, void *data)
 Registers a callback for tensor_converter custom condition. More...
 
int nnstreamer_converter_custom_unregister (const gchar *name)
 Unregisters a callback for tensor_converter custom condition. More...
 

Detailed Description

GStreamer plugin to convert media types to tensors (as a filter for other general neural network filters)

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 MyungJoo Ham myung.nosp@m.joo..nosp@m.ham@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m

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.

Date
26 Mar 2018
See also
https://github.com/nnstreamer/nnstreamer
Author
MyungJoo Ham myung.nosp@m.joo..nosp@m.ham@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m
Bug:
No known bugs except for NYI items
Todo:

For flatbuffers, support other/tensors with properties

Subplugins are not tested, yet.

Definition in file gsttensor_converter.c.

Macro Definition Documentation

◆ append_flex_tensor_caps_template

#define append_flex_tensor_caps_template (   caps)    gst_caps_append (caps, gst_caps_from_string (GST_TENSORS_FLEX_CAP_DEFAULT))

Macro to append template caps for flexible tensor.

Definition at line 85 of file gsttensor_converter.c.

◆ append_octet_caps_template

#define append_octet_caps_template (   caps)    gst_caps_append (caps, gst_caps_from_string (OCTET_CAPS_STR))

Definition at line 79 of file gsttensor_converter.c.

◆ append_text_caps_template

#define append_text_caps_template (   caps)    gst_caps_append (caps, gst_caps_from_string (TEXT_CAPS_STR))

Definition at line 71 of file gsttensor_converter.c.

◆ DBG

#define DBG   (!self->silent)

Macro for debug mode.

Definition at line 92 of file gsttensor_converter.c.

◆ DEFAULT_FRAMES_PER_TENSOR

#define DEFAULT_FRAMES_PER_TENSOR   1

Frames in output tensor.

Definition at line 142 of file gsttensor_converter.c.

◆ DEFAULT_SET_TIMESTAMP

#define DEFAULT_SET_TIMESTAMP   TRUE

Flag to set timestamp when received a buffer with invalid timestamp.

Definition at line 132 of file gsttensor_converter.c.

◆ DEFAULT_SILENT

#define DEFAULT_SILENT   TRUE

Flag to print minimized log.

Definition at line 137 of file gsttensor_converter.c.

◆ GST_CAT_DEFAULT

#define GST_CAT_DEFAULT   gst_tensor_converter_debug

Definition at line 104 of file gsttensor_converter.c.

◆ gst_tensor_converter_parent_class

#define gst_tensor_converter_parent_class   parent_class

Definition at line 144 of file gsttensor_converter.c.

◆ OCTET_CAPS_STR

#define OCTET_CAPS_STR   "application/octet-stream"

Caps string for binary stream.

Definition at line 77 of file gsttensor_converter.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 95 of file gsttensor_converter.c.

◆ STRING_CUSTOM_MODE

#define STRING_CUSTOM_MODE (   self)
Value:
(((self)->mode == _CONVERTER_MODE_CUSTOM_CODE) ? \
"custom_code (function)" : \
(((self)->mode == _CONVERTER_MODE_CUSTOM_SCRIPT) ? \
"custom_script (py)" : \
"unknown custom mode (internal error!)"))

Definition at line 106 of file gsttensor_converter.c.

◆ TEXT_CAPS_STR

#define TEXT_CAPS_STR   "text/x-raw, format = (string) utf8"

Caps string for text input.

SECTION:element-tensor_converter

A filter that converts media stream to tensor stream for NN frameworks. The output is always in the format of other/tensor or other/tensors.

<refsect2> <title>Example launch line</title> |[ gst-launch-1.0 videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! tensor_converter ! tensor_sink ]| </refsect2>

Definition at line 69 of file gsttensor_converter.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

tensor_converter properties

Todo:
For flatbuffers, support other/tensors.
Enumerator
PROP_0 
PROP_INPUT_DIMENSION 
PROP_INPUT_TYPE 
PROP_FRAMES_PER_TENSOR 
PROP_SET_TIMESTAMP 
PROP_SUBPLUGINS 
PROP_SILENT 
PROP_MODE 

Definition at line 117 of file gsttensor_converter.c.

Function Documentation

◆ _gst_tensor_converter_chain_chunk()

static GstFlowReturn _gst_tensor_converter_chain_chunk ( GstTensorConverter self,
GstBuffer *  inbuf,
guint  frames_in,
guint  frames_out,
gsize  frame_size 
)
static

Chain function's private routine to push multiple buffers.

supposed same duration for incoming buffer

Update timestamp. If frames-in is larger then frames-out, the same timestamp (pts and dts) would be returned.

set timestamp

Definition at line 959 of file gsttensor_converter.c.

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

◆ _gst_tensor_converter_chain_flex_tensor()

static GstBuffer* _gst_tensor_converter_chain_flex_tensor ( GstTensorConverter self,
GstBuffer *  buf 
)
static

Chain function's private routine to process flex tensor.

Definition at line 893 of file gsttensor_converter.c.

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

◆ _gst_tensor_converter_chain_octet()

static GstBuffer* _gst_tensor_converter_chain_octet ( GstTensorConverter self,
GstBuffer *  buf 
)
static

Chain function's private routine to process octet stream.

Definition at line 847 of file gsttensor_converter.c.

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

◆ _gst_tensor_converter_chain_push()

static GstFlowReturn _gst_tensor_converter_chain_push ( GstTensorConverter self,
GstBuffer *  buf 
)
static

Chain function's private routine to push buffer into src pad.

Definition at line 938 of file gsttensor_converter.c.

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

◆ _gst_tensor_converter_chain_segment()

static void _gst_tensor_converter_chain_segment ( GstTensorConverter self,
gsize  frame_size 
)
static

Chain function's private routine.

This is an internal logic error.

Definition at line 754 of file gsttensor_converter.c.

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

◆ _gst_tensor_converter_chain_timestamp()

static void _gst_tensor_converter_chain_timestamp ( GstTensorConverter self,
GstBuffer *  inbuf,
guint  frames_in 
)
static

Chain function's private routine.

Definition at line 787 of file gsttensor_converter.c.

Here is the caller graph for this function:

◆ findExternalConverter()

static const NNStreamerExternalConverter * findExternalConverter ( const char *  media_type_name)
static

Internal static function to find registered subplugins.

Definition at line 2408 of file gsttensor_converter.c.

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

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( GstTensorConverter  ,
gst_tensor_converter  ,
GST_TYPE_ELEMENT   
)

◆ GST_DEBUG_CATEGORY_STATIC()

GST_DEBUG_CATEGORY_STATIC ( gst_tensor_converter_debug  )

◆ gst_tensor_converter_chain()

static GstFlowReturn gst_tensor_converter_chain ( GstPad *  pad,
GstObject *  parent,
GstBuffer *  buf 
)
static

Chain function, this function does the actual processing.

This is an internal logic error.

Supposed 1 frame in buffer (default). Update frame size for each media type.

type * colorspace * width * height

supposed 1 frame in buffer

Refer: https://gstreamer.freedesktop.org/documentation/design/mediatype-video-raw.html

Internal logic error!

copy timestamps

copy timestamps

Todo:
need rewrite. do not use assert
Todo:
expand mem if given property is larger than mem size. Now compare same size, later we should modify mem block if developer sets different dimension.
Todo:
identify and printout the given input stream caps.

convert format (bytes > time) and push segment event. It will push event if needed (self->need_segment is true).

configures timestamp if required (self->set_timestamp is true)

do nothing, push the incoming buffer

Definition at line 1028 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_change_state()

static GstStateChangeReturn gst_tensor_converter_change_state ( GstElement *  element,
GstStateChange  transition 
)
static

Called to perform state change.

Definition at line 1336 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_class_init()

static void gst_tensor_converter_class_init ( GstTensorConverterClass klass)
static

Initialize the tensor_converter's class.

GstTensorConverter::input-dim:

Input tensor dimension from inner array. Generally this property is used to set tensor configuration for byte-stream (application/octet-stream). When setting this property and input media type is video or audio stream, GstTensorConverter will compare the media info with this. (If it is different, it will be failed.)

GstTensorConverter::input-type:

Type of each element of the input tensor. Generally this property is used to set tensor configuration for byte-stream (application/octet-stream). When setting this property and input media type is video or audio stream, GstTensorConverter will compare the media info with this. (If it is different, it will be failed.)

GstTensorConverter::frames-per-tensor:

The number of frames in outgoing buffer. (buffer is a single tensor instance) GstTensorConverter can push a buffer with multiple media frames.

GstTensorConverter::set-timestamp:

The flag to set timestamp when received a buffer with invalid timestamp.

GstTensorConverter::sub-plugins:

Registrable sub-plugins list of tensor-converter.

GstTensorConverter::silent:

The flag to enable/disable debugging messages.

GstTensorConverter::mode:

Generally this property is used to set tensor converter custom mode.

Definition at line 178 of file gsttensor_converter.c.

Here is the call graph for this function:

◆ gst_tensor_converter_finalize()

static void gst_tensor_converter_finalize ( GObject *  object)
static

Function to finalize instance.

Definition at line 381 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_get_adapter()

static GstAdapter* gst_tensor_converter_get_adapter ( GstTensorConverter self,
GstBuffer *  buf 
)
static

Internal function to get adapter.

Definition at line 706 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_get_format_list()

static void gst_tensor_converter_get_format_list ( GValue *  list,
  ... 
)
static

Get supported format list.

Definition at line 1385 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_get_possible_media_caps()

static GstCaps* gst_tensor_converter_get_possible_media_caps ( GstTensorConverter self)
static

Get possible media-caps from downstream element.

Definition at line 1972 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_get_property()

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

Getter for tensor_converter properties.

Definition at line 514 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_init()

static void gst_tensor_converter_init ( GstTensorConverter self)
static

Initialize tensor_converter element.

setup sink pad

setup src pad

init properties

Definition at line 331 of file gsttensor_converter.c.

Here is the call graph for this function:

◆ gst_tensor_converter_parse_audio()

static gboolean gst_tensor_converter_parse_audio ( GstTensorConverter self,
const GstCaps *  caps,
GstTensorsConfig config 
)
static

Set the tensors config structure from audio info (internal static function)

Parameters
selfthis pointer to GstTensorConverter
capscaps for media stream
configtensors config structure to be filled
Note
Change dimension if tensor contains N frames.
Returns
TRUE if supported type

Refer: https://www.tensorflow.org/api_docs/python/tf/summary/audio A 3-D float32 Tensor of shape [batch_size, frames, channels] or a 2-D float32 Tensor of shape [batch_size, frames].

Definition at line 1582 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_parse_caps()

static gboolean gst_tensor_converter_parse_caps ( GstTensorConverter self,
const GstCaps *  caps 
)
static

Parse caps and set tensors info.

dimension index of frames in configured tensors

set the number of frames in dimension

not fully configured. the resulting config is weird.

compare tensor info

Definition at line 2190 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_parse_custom()

static gboolean gst_tensor_converter_parse_custom ( GstTensorConverter self,
GstTensorsConfig config,
const GstCaps *  caps 
)
static

Set the tensors config structure from caps (internal static function for custom mode)

Parameters
selfthis pointer to GstTensorConverter
configtensors config structure to be filled
capsincoming caps
Returns
TRUE if supported type

Definition at line 1889 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_parse_octet()

static gboolean gst_tensor_converter_parse_octet ( GstTensorConverter self,
GstTensorsConfig config,
const GstStructure *  structure 
)
static

Set the tensors configs structure from octet stream (internal static function)

Parameters
selfthis pointer to GstTensorConverter
configtensors config structure to be filled
structurecaps structure
Note
Change tensors dimension and type.
Returns
TRUE if supported type

Failure case when octet-stream has multi tensors and multi frames.

Raw byte-stream (application/octet-stream) We cannot get the exact tensors info from caps. All tensors info should be updated. If output is flexible, dimension should be updated in chain function with buffer size. (data format for tensor: [size])

Definition at line 1741 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_parse_tensor()

static gboolean gst_tensor_converter_parse_tensor ( GstTensorConverter self,
GstTensorsConfig config,
const GstStructure *  structure 
)
static

Set the tensors configs structure from fliex tensor stream (internal static function)

Parameters
selfthis pointer to GstTensorConverter
configtensors config structure to be filled
structurecaps structure
Note
Change tensors dimension and type.
Returns
TRUE if supported type

We cannot get the exact tensors info from caps. All tensors info should be updated in chain function. (data format for tensor: [size])

Definition at line 1834 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_parse_text()

static gboolean gst_tensor_converter_parse_text ( GstTensorConverter self,
GstTensorsConfig config,
const GstStructure *  structure 
)
static

Set the tensors config structure from text info (internal static function)

Parameters
selfthis pointer to GstTensorConverter
configtensors config structure to be filled
structurecaps structure
Note
Change dimension if tensors contains N frames.
Returns
TRUE if supported type

Refer: https://www.tensorflow.org/api_docs/python/tf/summary/text A string-type Tensor

Definition at line 1670 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_parse_video()

static gboolean gst_tensor_converter_parse_video ( GstTensorConverter self,
const GstCaps *  caps,
GstTensorsConfig config 
)
static

Set the tensors config structure from video info (internal static function)

Parameters
selfthis pointer to GstTensorConverter
capscaps for media stream
configtensors config structure to be filled
Note
Change dimension if tensor contains N frames.
Returns
TRUE if supported type

Refer: https://www.tensorflow.org/api_docs/python/tf/summary/image A 4-D uint8 or float32 Tensor of shape [batch_size, height, width, channels] where channels is 1, 3, or 4.

Emit Warning if RSTRIDE = RU4 (3BPP) && Width % 4 > 0

Todo:
Add more conditions!
Todo:
need rewrite.

Definition at line 1444 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_query_caps()

static GstCaps * gst_tensor_converter_query_caps ( GstTensorConverter self,
GstPad *  pad,
GstCaps *  filter 
)
static

Get pad caps for caps negotiation.

Definition at line 2144 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_reset()

static void gst_tensor_converter_reset ( GstTensorConverter self)
static

Clear and reset data.

Definition at line 1369 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_set_property()

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

Setter for tensor_converter properties.

Todo:
detects framework based on the script extension

Definition at line 406 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_sink_event()

static gboolean gst_tensor_converter_sink_event ( GstPad *  pad,
GstObject *  parent,
GstEvent *  event 
)
static

This function handles sink event.

Definition at line 586 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_sink_query()

static gboolean gst_tensor_converter_sink_query ( GstPad *  pad,
GstObject *  parent,
GstQuery *  query 
)
static

This function handles sink pad query.

Definition at line 654 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_src_query()

static gboolean gst_tensor_converter_src_query ( GstPad *  pad,
GstObject *  parent,
GstQuery *  query 
)
static

This function handles src pad query.

Definition at line 722 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_update_caps()

static void gst_tensor_converter_update_caps ( GstTensorConverter self)
static

Update src pad caps from tensors config.

Definition at line 2333 of file gsttensor_converter.c.

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

◆ gst_tensor_converter_video_stride()

static gboolean gst_tensor_converter_video_stride ( GstVideoFormat  format,
gint  width 
)
static

Determine if we need zero-padding.

Returns
TRUE if we need to add (or remove) stride per row from the stream data.
Todo:
The actual list is much longer, fill them. (read https://gstreamer.freedesktop.org/documentation/design/mediatype-video-raw.html)

Definition at line 1409 of file gsttensor_converter.c.

Here is the caller graph for this function:

◆ nnstreamer_converter_custom_register()

int nnstreamer_converter_custom_register ( const gchar *  name,
tensor_converter_custom  func,
void *  data 
)

Registers a callback for tensor_converter custom condition.

Register the custom callback function.

Returns
0 if success. -ERRNO if error.

Definition at line 2473 of file gsttensor_converter.c.

Here is the call graph for this function:

◆ nnstreamer_converter_custom_unregister()

int nnstreamer_converter_custom_unregister ( const gchar *  name)

Unregisters a callback for tensor_converter custom condition.

Unregister the custom callback function.

Returns
0 if success. -ERRNO if error.

Definition at line 2500 of file gsttensor_converter.c.

Here is the call graph for this function:

◆ nnstreamer_converter_find()

const NNStreamerExternalConverter* nnstreamer_converter_find ( const char *  name)

Find converter sub-plugin with the name.

Parameters
[in]nameThe name of converter sub-plugin.
Returns
NULL if not found or the sub-plugin object has an error.

Definition at line 2360 of file gsttensor_converter.c.

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

◆ nnstreamer_converter_set_custom_property_desc()

void nnstreamer_converter_set_custom_property_desc ( const char *  name,
const char *  prop,
  ... 
)

set custom property description for tensor converter sub-plugin

Definition at line 2457 of file gsttensor_converter.c.

Here is the call graph for this function:

◆ nnstreamer_converter_validate()

static gboolean nnstreamer_converter_validate ( const NNStreamerExternalConverter converter)
static

Validate converter sub-plugin's data.

Definition at line 2369 of file gsttensor_converter.c.

Here is the caller graph for this function:

◆ registerExternalConverter()

int registerExternalConverter ( NNStreamerExternalConverter ex)

Converter's external subplugins should call this at init.

Converter's sub-plugin should call this function to register itself.

Definition at line 2389 of file gsttensor_converter.c.

Here is the call graph for this function:

◆ unregisterExternalConverter()

void unregisterExternalConverter ( const char *  name)

Converter's external subplugins should call this at exit.

Converter's sub-plugin may call this to unregister itself.

Definition at line 2399 of file gsttensor_converter.c.

Here is the call graph for this function:
_CONVERTER_MODE_CUSTOM_SCRIPT
@ _CONVERTER_MODE_CUSTOM_SCRIPT
Definition: gsttensor_converter.h:69
DBG
#define DBG
Macro for debug mode.
Definition: gsttensor_converter.c:92
_CONVERTER_MODE_CUSTOM_CODE
@ _CONVERTER_MODE_CUSTOM_CODE
Definition: gsttensor_converter.h:68