GStreamer Iterator Use

Adam Goodwin adam.goodwin.nz at gmail.com
Thu Aug 1 06:30:30 PDT 2013


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.

*Link:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstIterator.html#gstreamer-GstIterator.description

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?

/*
        g_print("Pipeline contains the following elements:\n");
        GstIterator *it;
        GValue elem = G_VALUE_INIT;
        it = gst_bin_iterate_elements(GST_BIN(pipeline));
        while (gst_iterator_next(it, &elem) == GST_ITERATOR_OK)
        {
            g_print("%s\n",
                gst_element_get_name(g_value_get_object(&elem)));
            g_value_reset(&elem);
        }

        g_value_unset(&elem);
        gst_iterator_free(it);
*/

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.

So if I've made any mistakes it would be great if someone could point them
out.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130802/1263eb20/attachment-0001.html>


More information about the gstreamer-devel mailing list