I need to pass two values calculated in a custom-plugin I’ve made and fetch them with a sink pad buffer probe.
Currently I’m modifying the gst-dsdirection plugin and saving a user_meta to frame_meta. The output is the same DsDirectionOutput as in the gst-dsdirection example.
static void
attach_metadata_frame (GstDsDirection * dsdirection, NvDsFrameMeta * frame_meta,
DsDirectionOutput * output)
{
NvDsBatchMeta *batch_meta = frame_meta->base_meta.batch_meta;
// Attach - DsDirection MetaData
NvDsUserMeta *user_meta = nvds_acquire_user_meta_from_pool (batch_meta);
NvDsMetaType user_meta_type = NVDS_DIRECTION_USER_META;
user_meta->user_meta_data = output;
user_meta->base_meta.meta_type = user_meta_type;
user_meta->base_meta.copy_func = copy_ds_direction_meta;
user_meta->base_meta.release_func = release_ds_direction_meta;
nvds_add_user_meta_to_frame (frame_meta, user_meta);
}
In the python application I’m fetching it like this:
batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
l_frame = batch_meta.frame_meta_list
while l_frame is not None:
try:
# Note that l_frame.data needs a cast to pyds.NvDsFrameMeta
# The casting is done by pyds.glist_get_nvds_frame_meta()
# The casting also keeps ownership of the underlying memory
# in the C code, so the Python garbage collector will leave
# it alone.
#frame_meta = pyds.glist_get_nvds_frame_meta(l_frame.data)
frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
except StopIteration:
break
l_user = frame_meta.frame_user_meta_list
print(l_user)
user_meta = pyds.NvDsUserMeta.cast(l_user.data)
print('user_meta:', user_meta)
print('user_meta.user_meta_data:', user_meta.user_meta_data)
print('user_meta.base_meta:', user_meta.base_meta)
The output from this is:
...
<pyds.GList object at 0x7f2d8fc10030>
user_meta: <pyds.NvDsUserMeta object at 0x7f2d8fc10ab0>
user_meta.user_meta_data: <capsule object NULL at 0x7f2d8fc6a300>
user_meta.base_meta: <pyds.NvDsBaseMeta object at 0x7f2d8fc100a0>
...
Any idea how to properly add it to the frame_meta and/or fetch the values with the python bindings? Should I maybe save this as a different object structure?
Thanks