Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU) dGPU
• DeepStream Version 6.3
• JetPack Version (valid for Jetson only) 5.1.2
• TensorRT Version 8.5.3
I am adding a new property num-sources to gst-dsexample.
[ds-example]
enable=1
processing-width=1024
processing-height=1024
full-frame=1
blur-objects=0
unique-id=15
num-sources=6
(1)Added a new element to the struct in gstdsexample.h
struct _GstDsExample
{
//number of sources
gint num_sources;
};
(2)Added a new element to enum in gstdsexample.cpp
enum
{
PROP_0,
PROP_UNIQUE_ID,
PROP_PROCESSING_WIDTH,
PROP_PROCESSING_HEIGHT,
PROP_PROCESS_FULL_FRAME,
PROP_BLUR_OBJECTS,
PROP_GPU_DEVICE_ID,
PROP_NUM_SOURCES
};
(3)Default value is defined
#define DEFAULT_NUM_SOURCES 6
(4)Inside gst_dsexample_class_init
static void
gst_dsexample_class_init (GstDsExampleClass * klass)
{
g_object_class_install_property (gobject_class, PROP_NUM_SOURCES,
g_param_spec_int ("num-sources",
"Num Sources",
"Number of Sources",
1, G_MAXINT, DEFAULT_NUM_SOURCES, (GParamFlags)
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
}
(5)Default value is set
static void
gst_dsexample_init (GstDsExample * dsexample)
{
dsexample->num_sources = DEFAULT_NUM_SOURCES;
}
(6)Set and get new property inside the following functions.
static void
gst_dsexample_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstDsExample *dsexample = GST_DSEXAMPLE (object);
switch (prop_id) {
case PROP_UNIQUE_ID:
dsexample->unique_id = g_value_get_uint (value);
break;
case PROP_PROCESSING_WIDTH:
dsexample->processing_width = g_value_get_int (value);
break;
case PROP_PROCESSING_HEIGHT:
dsexample->processing_height = g_value_get_int (value);
break;
case PROP_PROCESS_FULL_FRAME:
dsexample->process_full_frame = g_value_get_boolean (value);
break;
case PROP_BLUR_OBJECTS:
dsexample->blur_objects = g_value_get_boolean (value);
break;
case PROP_GPU_DEVICE_ID:
dsexample->gpu_id = g_value_get_uint (value);
break;
case PROP_NUM_SOURCES:
g_print("set_property prop_id %d \n",(int)prop_id);
dsexample->num_sources = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/* Function called when a property of the element is requested. Standard
* boilerplate.
*/
static void
gst_dsexample_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstDsExample *dsexample = GST_DSEXAMPLE (object);
switch (prop_id) {
case PROP_UNIQUE_ID:
g_value_set_uint (value, dsexample->unique_id);
break;
case PROP_PROCESSING_WIDTH:
g_value_set_int (value, dsexample->processing_width);
break;
case PROP_PROCESSING_HEIGHT:
g_value_set_int (value, dsexample->processing_height);
break;
case PROP_PROCESS_FULL_FRAME:
g_value_set_boolean (value, dsexample->process_full_frame);
break;
case PROP_BLUR_OBJECTS:
g_value_set_boolean (value, dsexample->blur_objects);
break;
case PROP_GPU_DEVICE_ID:
g_value_set_uint (value, dsexample->gpu_id);
break;
case PROP_NUM_SOURCES:
g_print("get_property prop_id %d \n",(int)prop_id);
g_value_set_int (value, dsexample->num_sources);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
The issues are
(1) I have this warning when I run the app
** WARN: <parse_dsexample:907>: Unknown key 'num-sources' for group [ds-example]
(2) Then case PROP_NUM_SOURCES: is never called inside gst_dsexample_set_property and gst_dsexample_get_property