[ruby-gnome2-doc-cvs] [Hiki] update - tut-gst-link-elements-intro

Back to archive index

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


-------------------------
REMOTE_ADDR = 195.207.101.112
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/en/?tut-gst-link-elements-intro
-------------------------
  = Linking Elements
+ {{link("tut-gst-pads-caps", nil, "tut-gst", "tut-gst-bins-create")}}
  
  You can link the different pads of elements together so that the elements form a chain.
  
  {{image_left("linked-elements.png")}}
  {{br}}
  
  By linking these three elements, we have created a very simple chain. The effect of this will be that the output of the source element (element1) will be used as input for the filter element (element2). The filter element will do something with the data and send the result to the final sink element (element3).
  
  Imagine the above graph as a simple MPEG audio decoder. The source element is a disk source, the filter element is the MPEG decoder and the sink element is your audiocard. We will use this simple graph to construct an MPEG player later in this manual. 
  
  == Making Simple Links
  
  You can link two pads with:
  
    srcpad = element1.get_pad("src")
    sinpad = element2.get_pad("sink")
  
    # link them
    srcpad.link(sinkpad)
  
    ....
  
    # and unlink them
    srcpad.unlink(sinkpad)
  
  A convenient shortcut for single-source, single-sink elements is the Gst::Element#link method:
  
    # link them
    element1.link(element2)
     
    ...
  
    # and unlink them
    element1.unlink(element2)
  
  And an even more convenient shortcut is the Gst::Element#>> operator, which is an alias for Gst::Element#link:
  
    # link them all
    element1 >> element2 >> element3
  
  You can query if a pad is linked with Gst::Pad#linked?.
  
  == Making Filtered Links
  
  You can also force a specific media type on the link by using Gst::Pad#link_filtered and Gst::Element#link_filtered with capabilities.





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