ivameta_quark not found on buffers

I have a plugin that performs object detection and attaches IvaMeta information to the gstreamer buffers.
Next, I would like to parse this data in another plugin in the gstreamer chain. Following your plugin example “dsexample_plugin” I try to do something like this:

// Standard way of iterating through buffer metadata
while ((gst_meta = gst_buffer_iterate_meta(inbuf, &state)) != NULL) {
	// Check if this metadata is of IvaMeta type
	if (!gst_meta_api_type_has_tag(gst_meta->info->api, _ivameta_quark))
		continue;

	...

However, the condition in the if appears to always fail.

On the other hand, if I try to access the metadata as follows, it does work.

ivameta = gst_buffer_get_iva_meta(inbuf);
if (ivameta != NULL) {
	std::cout << "Found IvaMeta. Yay :)" << std::endl;
} else {
	std::cout << "No IvaMeta :(" << std::endl;
	continue;
}

I am using DeepStream 1.5 on Jetson TX2 and metadata was attached using gst_buffer_add_iva_meta(GstBuffer*, void*). Any idea why the standard iteration over the metadata does not work? Do I somehow need to manually add this “quark” tag after the call to gst_buffer_add_iva_meta?

Hi Beerend,

Has you initialized _ivameta_quark variable and initialized state variable to NULL?

Thanks
wayne zhu

I’m just following the dsexample code so the variable is declared globally:

static GQuark _ivameta_quark = 0;

and is assigned in …_init:

if (!_ivameta_quark)
    _ivameta_quark = g_quark_from_static_string("ivameta");

And yes I also kept the part with:

// NOTE: Initializing state to NULL is essential
gpointer state = NULL;

I am launching a pipeline via gst-launch-1.0, not as a compiled application.
So I am attaching metadata using gst_buffer_add_iva_meta and the nvosd block is picking up on it as it is correctly drawing the boxes and text labels.

Maybe I need to “register” this tag somehow?

Update: suddenly it appears to be working after all. No idea what changed though.
Can you perhaps comment a bit on how attaching and retrieving metadata works and what these “quarks” are?

Hi Beerend,
I think quarks is pure concept of Gstreamer, you can google it.

thanks
wayne zhu