[gst-devel] Using gst_object_unref

Tim-Philipp Müller t.i.m at zen.co.uk
Thu Sep 23 17:36:14 CEST 2010


On Thu, 2010-09-23 at 20:46 +0530, liJin wrote:

>    I just confused about the "Hello World " example in the gstreamer
> manual.  I can see a pipeline and some elements are created in code.
> In the end the  pipeline is unrefed , using the method
> gst_object_unref(pipeline). What what about the elements we
> created...?  Its there and the reference count of the elements doesn't
> seems decremented....
> 
> In chapter 5.2 . its says we need to use gst-object_unref  for
> elements also

if you use

  gst_bin_add (bin_or_pipeline, element);

then the bin/pipeline will take ownership of the element (if it is a
newly-created element) and will take care of freeing it when the
pipeline is freed. Also see

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html#GstObject.description


 Cheers
  -Tim





More information about the gstreamer-devel mailing list