Store/Retrieve array of struct in GstStructure

De Pauw jimmy jimmy at dcode.eu
Tue Apr 2 09:11:27 UTC 2019


Hello all,

I have a custom plugin that need to send message.
The data for this message are an array of basic struct with only simple 
numeric types in it.

I can store and retrieve any simple thing in GstStructure without any 
issue but after more than 1 day of searching, i cannot manage to make an 
array work.
Even an array of int does not work at all.

I tried with a small test program :

GArray *garray = g_array_new(FALSE, FALSE, sizeof(cstruct)); cstruct it = {}; it.x =10; it.y =20; cstruct it2 = {}; it.x =30; it.y =40; g_array_append_val(garray, it); g_array_append_val(garray, it2); GstStructure *event_struct = gst_structure_new(
         "teststruct", "testint", G_TYPE_UINT, 1, "testarr", G_TYPE_ARRAY, garray, NULL
); const GValue *arrval = gst_structure_get_value(event_struct, "testarr"); // No idea how to get my array back here GArray *structarr = (GArray *)arrval; cstruct *t = &g_array_index(structarr, cstruct, 0); printf("%u\n", t->y);

The way to get my GArray back is most likely not the right way but i 
haven't found any leads on how to do it.
I also don't know if i can build the GstStructure that way.

I tried using a boxed GValue to store my GArray but it doesn't matter 
how i try to do it, it always segfault on gst_structure_new.

GValueArray is deprecated so i tried to do without it, maybe it's not 
currently possible with gstreamer.

Thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190402/ee38905d/attachment.html>


More information about the gstreamer-devel mailing list