[ruby-gnome2-doc-cvs] [Hiki] create - tut-gst-bins-ghost-pads

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2004年 2月 28日 (土) 03:00:42 JST


-------------------------
REMOTE_ADDR = 217.117.55.140
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/?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.

{{image_left("bin-element-noghost.png")}}
{{br}}

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.

{{image_left("bin-element-ghost.png")}}
{{br}}

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





ruby-gnome2-cvs メーリングリストの案内
Back to archive index