Doxygen Book
gsttensor_debug.c File Reference

GStreamer plugin to help debug tensor streams. More...

#include <string.h>
#include <nnstreamer_log.h>
#include <nnstreamer_util.h>
#include "gsttensor_debug.h"
#include "tensor_meta.h"
Include dependency graph for gsttensor_debug.c:

Go to the source code of this file.

Macros

#define DBG   (!self->silent)
 Macro for debug mode. More...
 
#define GST_CAT_DEFAULT   gst_tensor_debug_debug
 
#define CAPS_STRING   GST_TENSORS_CAP_MAKE(GST_TENSOR_FORMAT_ALL)
 
#define C_FLAGS(v)   ((guint) v)
 
#define TENSOR_DEBUG_TYPE_OUTPUT_FLAGS   (tensor_debug_output_flags_get_type())
 
#define DEFAULT_TENSOR_DEBUG_OUTPUT_FLAGS   (TDBG_OUTPUT_CONSOLE_I)
 
#define TENSOR_DEBUG_TYPE_CAPS   (tensor_debug_cap_get_type())
 
#define DEFAULT_TENSOR_DEBUG_CAP   (TDBG_CAP_SHOW_UPDATE_F)
 
#define TENSOR_DEBUG_TYPE_META_FLAGS   (tensor_debug_meta_flags_get_type())
 
#define DEFAULT_TENSOR_DEBUG_META_FLAGS   (TDBG_META_DISABLED)
 
#define DEFAULT_SILENT   TRUE
 Flag to print minimized log. More...
 
#define gst_tensor_debug_parent_class   parent_class
 

Enumerations

enum  {
  PROP_0, PROP_SILENT, PROP_OUTPUT, PROP_CAP,
  PROP_META
}
 tensor_debug properties More...
 

Functions

 GST_DEBUG_CATEGORY_STATIC (gst_tensor_debug_debug)
 
static GType tensor_debug_output_flags_get_type (void)
 Flags for output_mode of GstTensorDebug. More...
 
static GType tensor_debug_cap_get_type (void)
 Enums for cap_mode of GstTensorDebug. More...
 
static GType tensor_debug_meta_flags_get_type (void)
 Flags for meta_mode of GstTensorDebug. More...
 
 G_DEFINE_TYPE (GstTensorDebug, gst_tensor_debug, GST_TYPE_BASE_TRANSFORM)
 
static void gst_tensor_debug_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 Setter for tensor_debug properties. More...
 
static void gst_tensor_debug_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 Getter for tensor_debug properties. More...
 
static void gst_tensor_debug_finalize (GObject *object)
 Function to finalize instance. More...
 
static GstFlowReturn gst_tensor_debug_transform_ip (GstBaseTransform *trans, GstBuffer *buffer)
 in-place transform More...
 
static GstCaps * gst_tensor_debug_fixate_caps (GstBaseTransform *trans, GstPadDirection direction, GstCaps *caps, GstCaps *othercaps)
 fixate caps. required vmethod of GstBaseTransform. More...
 
static gboolean gst_tensor_debug_set_caps (GstBaseTransform *trans, GstCaps *in_caps, GstCaps *out_caps)
 set caps. required vmethod of GstBaseTransform. More...
 
static void gst_tensor_debug_class_init (GstTensorDebugClass *klass)
 Initialize the tensor_debug's class. More...
 
static void gst_tensor_debug_init (GstTensorDebug *self)
 Initialize tensor_debug element. More...
 
static void _gst_tensor_debug_output (GstTensorDebug *self, GstBuffer *buffer)
 The core function that provides debug output based on the contents. More...
 

Variables

static GstStaticPadTemplate sink_factory
 The capabilities of the inputs. More...
 
static GstStaticPadTemplate src_factory
 The capabilities of the outputs. More...
 

Detailed Description

GStreamer plugin to help debug tensor streams.

GStreamer/NNStreamer tensor_debug Copyright (C) 2022 MyungJoo Ham myung.nosp@m.joo..nosp@m.ham@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m

Date
23 Sep 2022
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

Definition in file gsttensor_debug.c.

Macro Definition Documentation

◆ C_FLAGS

#define C_FLAGS (   v)    ((guint) v)

Definition at line 88 of file gsttensor_debug.c.

◆ CAPS_STRING

#define CAPS_STRING   GST_TENSORS_CAP_MAKE(GST_TENSOR_FORMAT_ALL)

This is a new element created after the obsoletion of other/tensor. Use other/tensors if you want to use tensor_debug

Definition at line 58 of file gsttensor_debug.c.

◆ DBG

#define DBG   (!self->silent)

Macro for debug mode.

SECTION:element-tensor_debug

A filter that generates debug messages for developer at the insertion point of the given pipeline. An application writer using an nnstreamer pipeline can use tensor_debug to debug or get profile information in their applications.

Note that this does not support other/tensor, but only supports 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_debug output-method=console-info capability=always ! tensor_sink ]| </refsect2>

Definition at line 48 of file gsttensor_debug.c.

◆ DEFAULT_SILENT

#define DEFAULT_SILENT   TRUE

Flag to print minimized log.

Definition at line 191 of file gsttensor_debug.c.

◆ DEFAULT_TENSOR_DEBUG_CAP

#define DEFAULT_TENSOR_DEBUG_CAP   (TDBG_CAP_SHOW_UPDATE_F)

Definition at line 161 of file gsttensor_debug.c.

◆ DEFAULT_TENSOR_DEBUG_META_FLAGS

#define DEFAULT_TENSOR_DEBUG_META_FLAGS   (TDBG_META_DISABLED)

Definition at line 186 of file gsttensor_debug.c.

◆ DEFAULT_TENSOR_DEBUG_OUTPUT_FLAGS

#define DEFAULT_TENSOR_DEBUG_OUTPUT_FLAGS   (TDBG_OUTPUT_CONSOLE_I)

Definition at line 135 of file gsttensor_debug.c.

◆ GST_CAT_DEFAULT

#define GST_CAT_DEFAULT   gst_tensor_debug_debug

Definition at line 52 of file gsttensor_debug.c.

◆ gst_tensor_debug_parent_class

#define gst_tensor_debug_parent_class   parent_class

Definition at line 193 of file gsttensor_debug.c.

◆ TENSOR_DEBUG_TYPE_CAPS

#define TENSOR_DEBUG_TYPE_CAPS   (tensor_debug_cap_get_type())

Definition at line 137 of file gsttensor_debug.c.

◆ TENSOR_DEBUG_TYPE_META_FLAGS

#define TENSOR_DEBUG_TYPE_META_FLAGS   (tensor_debug_meta_flags_get_type())

Definition at line 163 of file gsttensor_debug.c.

◆ TENSOR_DEBUG_TYPE_OUTPUT_FLAGS

#define TENSOR_DEBUG_TYPE_OUTPUT_FLAGS   (tensor_debug_output_flags_get_type())

Definition at line 90 of file gsttensor_debug.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

tensor_debug properties

Enumerator
PROP_0 
PROP_SILENT 
PROP_OUTPUT 
PROP_CAP 
PROP_META 

Definition at line 79 of file gsttensor_debug.c.

Function Documentation

◆ _gst_tensor_debug_output()

static void _gst_tensor_debug_output ( GstTensorDebug self,
GstBuffer *  buffer 
)
static

The core function that provides debug output based on the contents.

Todo:
NYI: do the debug task

Definition at line 397 of file gsttensor_debug.c.

Here is the caller graph for this function:

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( GstTensorDebug  ,
gst_tensor_debug  ,
GST_TYPE_BASE_TRANSFORM   
)

◆ GST_DEBUG_CATEGORY_STATIC()

GST_DEBUG_CATEGORY_STATIC ( gst_tensor_debug_debug  )

◆ gst_tensor_debug_class_init()

static void gst_tensor_debug_class_init ( GstTensorDebugClass klass)
static

Initialize the tensor_debug's class.

GstTensorDebug::silent:

The flag to enable/disable debugging messages.

GstTensorDebug::output:

The combination of enums configuring output methods.

Todo:
check the behavior of name and nick (output methods vs output)

GstTensorDebug::cap:

The logging preference of the stream capability (GSTCAP).

GstTensorDebug::meta:

The logging preference of in-stream metadata (GSTMETA).

This won't modify the contents!

call transform_ip although it's passthrough

Note. Without transform_caps and with passthrough_on_same_caps = TRUE, This element is not allowed to touch the contents, but can inspect the contents with transform_ip by setting transform_ip_on_passthrough.

Definition at line 215 of file gsttensor_debug.c.

Here is the call graph for this function:

◆ gst_tensor_debug_finalize()

static void gst_tensor_debug_finalize ( GObject *  object)
static

Function to finalize instance.

Definition at line 327 of file gsttensor_debug.c.

Here is the caller graph for this function:

◆ gst_tensor_debug_fixate_caps()

static GstCaps * gst_tensor_debug_fixate_caps ( GstBaseTransform *  trans,
GstPadDirection  direction,
GstCaps *  caps,
GstCaps *  othercaps 
)
static

fixate caps. required vmethod of GstBaseTransform.

Definition at line 421 of file gsttensor_debug.c.

Here is the caller graph for this function:

◆ gst_tensor_debug_get_property()

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

Getter for tensor_debug properties.

Definition at line 368 of file gsttensor_debug.c.

Here is the caller graph for this function:

◆ gst_tensor_debug_init()

static void gst_tensor_debug_init ( GstTensorDebug self)
static

Initialize tensor_debug element.

init properties

Definition at line 313 of file gsttensor_debug.c.

◆ gst_tensor_debug_set_caps()

static gboolean gst_tensor_debug_set_caps ( GstBaseTransform *  trans,
GstCaps *  incaps,
GstCaps *  outcaps 
)
static

set caps. required vmethod of GstBaseTransform.

Definition at line 435 of file gsttensor_debug.c.

Here is the caller graph for this function:

◆ gst_tensor_debug_set_property()

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

Setter for tensor_debug properties.

Definition at line 336 of file gsttensor_debug.c.

Here is the caller graph for this function:

◆ gst_tensor_debug_transform_ip()

static GstFlowReturn gst_tensor_debug_transform_ip ( GstBaseTransform *  trans,
GstBuffer *  buffer 
)
static

in-place transform

Definition at line 408 of file gsttensor_debug.c.

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

◆ tensor_debug_cap_get_type()

static GType tensor_debug_cap_get_type ( void  )
static

Enums for cap_mode of GstTensorDebug.

Definition at line 142 of file gsttensor_debug.c.

◆ tensor_debug_meta_flags_get_type()

static GType tensor_debug_meta_flags_get_type ( void  )
static

Flags for meta_mode of GstTensorDebug.

Definition at line 168 of file gsttensor_debug.c.

◆ tensor_debug_output_flags_get_type()

static GType tensor_debug_output_flags_get_type ( void  )
static

Flags for output_mode of GstTensorDebug.

Definition at line 95 of file gsttensor_debug.c.

Variable Documentation

◆ sink_factory

GstStaticPadTemplate sink_factory
static
Initial value:
= GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CAPS_STRING))

The capabilities of the inputs.

Definition at line 63 of file gsttensor_debug.c.

◆ src_factory

GstStaticPadTemplate src_factory
static
Initial value:
= GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CAPS_STRING))

The capabilities of the outputs.

Definition at line 71 of file gsttensor_debug.c.

CAPS_STRING
#define CAPS_STRING
Definition: gsttensor_debug.c:58