1 <chapter id="chapter-pads">
4 As we have seen in <xref linkend="chapter-elements"/>, the pads are the element's
5 interface to the outside world.
8 The specific type of media that the element can handle will be exposed by the pads.
9 The description of this media type is done with capabilities(see
10 <xref linkend="section-caps"/>)
14 Pads are either source or sink pads. The terminology is defined from the
15 view of the element itself: elements accept data on their sink pads, and
16 send data out on their source pads. Sink pads are drawn on the left,
17 while source pads are drawn on the right of an element. In general,
18 data flows from left to right in the graph.<footnote>
20 In reality, there is no objection to data flowing from a
21 source pad to the sink pad of an element upstream. Data will, however,
22 always flow from a source pad of one element to the sink pad of
27 <sect1 id="section-pads-type">
28 <title>Types of pad</title>
30 <sect2 id="section-pads-dynamic">
31 <title>Dynamic pads</title>
33 Some elements might not have all of their pads when the element is
35 can happen, for example, with an MPEG system demultiplexer. The
36 demultiplexer will create its pads at runtime when it detects the
37 different elementary streams in the MPEG system stream.
40 Running <application>gst-inspect mpegdemux</application> will show that
41 the element has only one pad: a sink pad called 'sink'. The other pads are
42 "dormant". You can see this in the pad template because there is
43 an 'Exists: Sometimes'
44 property. Depending on the type of MPEG file you play, the pads will
46 will see that this is very important when you are going to create dynamic
47 pipelines later on in this manual.
50 <sect2 id="section-pads-request">
51 <title>Request pads</title>
53 An element can also have request pads. These pads are not created
54 automatically but are only created on demand. This is very useful
55 for multiplexers, aggregators and tee elements.
58 The tee element, for example, has one input pad and a request padtemplate for the
59 output pads. Whenever an element wants to get an output pad from the tee element, it
60 has to request the pad.
66 <sect1 id="section-caps">
67 <title>Capabilities of a pad</title>
69 Since the pads play a very important role in how the element is viewed by the
70 outside world, a mechanism is implemented to describe the data that can
71 flow through the pad by using capabilities.
74 We will briefly describe what capabilities are, enough for you to get a basic understanding
75 of the concepts. You will find more information on how to create capabilities in the
76 Plugin Writer's Guide.
79 <sect2 id="section-pads-caps">
80 <title>Capabilities</title>
82 Capabilities are attached to a pad in order to describe
83 what type of media the pad can handle.
86 Capabilities is shorthand for "capability chain". A capability chain
87 is a chain of one capability or more.
90 The basic entity is a capability, and is defined by a name, a MIME
91 type and a set of properties. A capability can be chained to
92 another capability, which is why we commonly refer to a chain of
93 capability entities as "capabilities".
96 It is important to understand that the term "capabilities" refers
97 to a chain of one capability or more. This will be clearer when
98 you see the structure definition of a <ulink type="http"
99 url="../../gstreamer/html/gstreamer-GstCaps.html"><classname>GstCaps
100 </classname></ulink>element.
105 Below is a dump of the capabilities of the element mad, as shown by
106 <command>gst-inspect</command>.
107 You can see two pads: sink and src. Both pads have capability information attached to them.
110 The sink pad (input pad) is called 'sink' and takes data of MIME type 'audio/mp3'. It also has
111 three properties: layer, bitrate and framed.
114 The source pad (output pad) is called 'src' and outputs data of
115 MIME type 'audio/raw'. It also has four properties: format, depth,
120 SINK template: 'sink'
124 MIME type: 'audio/mp3':
130 MIME type: 'audio/raw':
132 endianness: Integer: 1234
135 channels: Integer range: 1 - 2
137 signed: Boolean: TRUE
138 rate: Integer range: 11025 - 48000
141 <sect2 id="section-pads-props">
142 <title>What are properties ?</title>
144 Properties are used to describe extra information for
145 capabilities. A property consists of a key (a string) and
146 a value. There are different possible value types that can be used:
157 an integer value: the property has this exact value.
162 a boolean value: the property is either TRUE or FALSE.
167 a fourcc value: this is a value that is commonly used to
168 describe an encoding for video,
169 as used for example by the AVI specification.
171 fourcc values consist of four bytes.
172 <ulink url="http://www.fourcc.org" type="http">The FOURCC
173 Definition List</ulink> is the most complete resource
174 on the allowed fourcc values.
180 a float value: the property has this exact floating point value.
198 an integer range value: the property denotes a range of
199 possible integers. For example, the wavparse element has
200 a source pad where the "rate" property can go from 8000 to
206 a float range value: the property denotes a range of possible
207 floating point values.
214 a list value: the property can take any value from a list of
215 basic value types or range types.
221 <sect2 id="section-pads-caps-use">
222 <title>What capabilities are used for</title>
224 Capabilities describe in great detail the type of media that is handled by the pads.
225 They are mostly used for:
230 Autoplugging: automatically finding plugins for a set of capabilities
235 Compatibility detection: when two pads are linked, <application>GStreamer</application>
236 can verify if the two pads are talking about the same media types.
237 The process of linking two pads and checking if they are compatible
238 is called "caps negotiation".