<div dir="ltr"><div><div>Hi, I'm trying to use a GstIterator but I'm not entirely sure if I'm doing it right. I looked at the example in the reference manual* but this is a general example which doesn't answer all of my questions.<br>
<br>*Link: <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstIterator.html#gstreamer-GstIterator.description">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstIterator.html#gstreamer-GstIterator.description</a><br>
<br></div><div>Below is the code I'm using to print the names of all the elements in a pipeline. It seems to work, but I'm not sure how correct it is. Can someone who knows more about this point out if I've made an critical mistakes?<br>
</div><div><br>/*<br>        g_print("Pipeline contains the following elements:\n");<br>        GstIterator *it;<br>        GValue elem = G_VALUE_INIT;<br>        it = gst_bin_iterate_elements(GST_BIN(pipeline));<br>
        while (gst_iterator_next(it, &elem) == GST_ITERATOR_OK)<br>        {<br>            g_print("%s\n",<br>                gst_element_get_name(g_value_get_object(&elem)));<br>            g_value_reset(&elem);<br>
        }<br><br>        g_value_unset(&elem);<br>        gst_iterator_free(it);<br>*/<br><br></div>In particular I'm not sure if I need to do something like "gst_object_unref(GST_OBJECT(g_value_get_object(&elem)));" between the "g_print" and "g_value_reset calls". The manual page I linked seems to suggest this but then again in other GStreamer example applications I've seen no individual elements are unref'd. They seem to all be dealt with using the "gst_object_unref(GST_OBJECT(pipeline));" call at the end of the program.<br>
<br></div>So if I've made any mistakes it would be great if someone could point them out.<br><br>Thanks<br></div>