ruby-****@sourc*****
ruby-****@sourc*****
2004年 2月 28日 (土) 02:49:23 JST
------------------------- REMOTE_ADDR = 217.117.55.140 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/?tut-gst-bins-add ------------------------- = Adding Elements to a Bin Elements are added to a bin with the following code sample: element = Gst::ElementFactory.make("mpg123", "decoder") bin = Gst::Bin.new bin.add(element) Bins and threads can be added to other bins too. This allows you to create nested bins. Pipelines shouldn't be added to any other element, though. They are toplevel bins and they are directly linked to the scheduler. To get an element from the bin you can use: element = bin.get_by_name("decoder") A convenient shortcut to Gst::Bin#get_by_name is Gst::Bin#[]: element = bin["decoder"] You can see that the name of the element becomes very handy for retrieving the element from a bin by using the element's name. Gst::Bin#get_by_name will recursively search nested bins. To get a list of elements in a bin, use Gst::Bin#elements or its iterative flavour Gst::Bin#each_element: bin.each_element do |element| puts "element in bin: " + element.name end To remove an element from a bin, use: bin.remove(element) To add many elements to a bin at the same time, just use Gst::Bin#add with many parameters you want: bin.add(element1, element2, element3)