Clarification sought over GStreamer Documentation

Ian Davidson id012c3076 at
Sun Dec 16 06:41:04 PST 2012

I have studied section "8.4. Ghost pads" of "GStreamer Application 
Development Manual (1.0.3)" - but I am not sure about the 'mechanics' of 
the code snippet (below)

     #include <gst/gst.h>

     main (int   argc,
           char *argv[])
       GstElement *bin, *sink;
       GstPad *pad;

       /* init */
       gst_init (&argc, &argv);

       /* create element, add to bin */

Absolutely no problems with the code above.

       sink = gst_element_factory_make ("fakesink", "sink");

I understand that the above line is creating a new element of type 
'fakesink', but I am not sure about the quoted "sink" in the 
parameters.  Is that a key word (sink or src)?  Is it the name that is 
to be given to something?  I am reasonably sure that it is not the name 
of the object.

       bin = gst_bin_new ("mybin");
       gst_bin_add (GST_BIN (bin), sink);

       /* add ghostpad */
       pad = gst_element_get_static_pad (sink, "sink");

Again, I assume that the unquoted sink is a reference to 'our GstElement 
called sink.  But again, the quoted "sink" - what is the purpose of that 
parameter?  Is it referring to its relationship to the bin? or to where 
it wants to link on to in "Element1" (in Figure 8.2)?

       gst_element_add_pad (bin, gst_ghost_pad_new ("sink", pad));

I get the feeling that this "sink" is the leftmost sink in the bin of 
Figure 8.2.

       gst_object_unref (GST_OBJECT (pad));

Finally, I assume that once the pad has been used to link the bin's Pad 
to Element1's Pad, it is no longer required and can be freed. Correct?

Is there something I should have read to understand this?

Thank you for reading this far.


Ian Davidson
Facts used in this message may or may not reflect an underlying 
objective reality. Facts are supplied for personal use only.
Recipients quoting supplied information do so at their own risk. Facts 
supplied may vary in whole or part from widely accepted standards.
While painstakingly researched, facts may or may not be indicative of 
actually occurring events or natural phenomena.
The author accepts no responsibility for personal loss or injury 
resulting from memorisation and subsequent use.

More information about the gstreamer-devel mailing list