[ruby-gnome2-doc-cvs] [Hiki] update - tut-gst-bins-add

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2004年 4月 1日 (木) 20:58:59 JST


-------------------------
REMOTE_ADDR = 195.207.101.112
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/en/?tut-gst-bins-add
-------------------------
  = Adding Elements to a Bin
+ {{link("tut-gst-bins-create", nil, "tut-gst", "tut-gst-bins-custom")}}
  
  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)





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