Hello all, I have a custom plugin that need to send message. 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. 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 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 _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Tue, Apr 2, 2019 at 2:11 AM De Pauw jimmy <[hidden email]> wrote:
Hi, you can set a boxed type into a gvalue and put that into a GstStructure. I couldn't figure out how to do that directly from gst_structure_new (no time to read the source code now) but you can call gst_structure_set_value in the newly created structure and it works. Attached a modification of your snipped that works for me.
-- Thiago Sousa Santos _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel test.c (1K) Download Attachment |
Free forum by Nabble | Edit this page |