ruby-****@sourc*****
ruby-****@sourc*****
2004年 3月 2日 (火) 18:37:57 JST
------------------------- REMOTE_ADDR = 195.207.101.112 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/?tut-gst-pads-caps ------------------------- = Capabilities of a Pad Since the pads play a very important role in how the element is viewed by the outside world, a mechanism is implemented to describe the pad by using capabilities. We will briefly describe what capabilities are, enough for you to get a basic understanding of the concepts. == What Is a Capability A capability is attached to a pad in order to describe what type of media the pad can handle. A capability is named and consists of a MIME type and a set of properties. Below is a dump of the capabilities of the element mad, as shown by (({gst-inspect})). You can see two pads: sink and src. Both pads have capability information attached to them. The sink pad (input pad) is called 'sink' and takes data of MIME type 'audio/mp3'. It also has three properties: layer, bitrate and framed. The source pad (output pad) is called 'src' and outputs data of MIME type 'audio/raw'. It also has four properties: format, depth, rate and channels. Pads: SINK template: 'sink' Availability: Always Capabilities: 'mad_sink': MIME type: 'audio/mp3': SRC template: 'src' Availability: Always Capabilities: 'mad_src': MIME type: 'audio/raw': format: String: int endianness: Integer: 1234 width: Integer: 16 depth: Integer: 16 channels: Integer range: 1 - 2 law: Integer: 0 signed: Boolean: TRUE rate: Integer range: 11025 - 48000 == What Are Properties Properties are used to describe extra information for capabilities. The properties basically consist of a key (a string) and a value. There are different possible value types that can be used: * an integer value (Fixnum, Bignum); * an integer range value (Range); * a boolean value (TrueClass, FalseClass); * a list value (Array); * a float value (Float); * a float range value (Range); * a string value (String). == What Capabilities Are Used for Capabilities describe in great detail the type of media that is handled by the pads. They are mostly used for: * Autoplugging: automatically finding plugins for a set of capabilities; * Compatibility detection: when two pads are linked, GStreamer can verify if the two pads are talking about the same media types. == Getting the Capabilities of a Pad A pad can have a chain of capabilities attached to it. You can get the capabilities chain with Gst::Pad#caps or Gst::Pad#each_caps: pad.each_caps do |caps| puts "Capability name " + caps.name + ", MIME type " + caps.mime end