[ruby-gnome2-doc-cvs] [Hiki] create - tut-gst-elements-create

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2004年 2月 27日 (金) 19:36:44 JST


-------------------------
REMOTE_ADDR = 195.207.101.112
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/?tut-gst-elements-create
-------------------------
= Creating a Gst::Element

A Gst::Element object is created from a factory. To create an element, you have to get access to a Gst::ElementFactory object using a unique factory name.

The following code example is used to get a factory that can be used to create the 'mad' element, an mp3 decoder. 

  factory = Gst::ElementFactory.find("mad")

Once you have the handle to the element factory, you can create a real element with the following code fragment:

  element = factory.create("decoder")

Gst::ElementFactory#create will use the element factory to create an element with the given name. The name of the element is something you can use later on to look up the element in a Gst::Bin, for example. You can pass nil as the name argument to get a unique, default name (which is the default value for this argument).

A simple shortcut exists for creating an element from a factory. The following example creates an element named "decoder" from the element factory named "mad". This convenience method is most widely used to create an element.

  element = Gst::ElementFactory.make("mad", "decoder")





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