Create  Edit  FrontPage  Index  Search  Changes  History  RSS  Login

tut-gst-bins-ghost-pads

Ghost Pads

You can see from the following figure how a bin has no pads of its own. This is where "ghost pads" come into play.

bin-element-noghost.png

A ghost pad is a pad from some element in the bin that has been promoted to the bin. This way, the bin also has a pad. The bin becomes just another element with a pad and you can then use the bin just like any other element. This is a very important feature for creating custom bins.

bin-element-ghost.png

The above figure is a representation of a ghost pad. The sink pad of element one is now also a pad of the bin.

Ghost pads can actually be added to all Gst::Element objects and not just Gst::Bin objects. Use the following code example to add a ghost pad to a bin:

element = Gst::ElementFactory.make("mad")
bin = Gst::Bin.new

bin.add(element)

bin.add_ghost_pad(element.get_pad("sink"), "sink")

In the above example, the bin now also has a pad: the pad called 'sink' of the given element.

We can now, for example, link the source pad of a filesrc element to the bin with:

filesrc = Gst::ElementFactory.make("filesrc")
filesrc >> bin
Last modified:2004/04/01 21:00:34
Keyword(s):
References:[tut-gst]