2000-08-16 21:38:57 +00:00
|
|
|
<chapter id="cha-elements">
|
2003-10-09 12:42:49 +00:00
|
|
|
<title>Elements</title>
|
2000-08-16 21:38:57 +00:00
|
|
|
<para>
|
2001-05-02 23:46:27 +00:00
|
|
|
The most important object in <application>GStreamer</application> for the
|
|
|
|
application programmer is the <classname>GstElement</classname> object.
|
2000-08-16 21:38:57 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<sect1 id="sec-elements-design">
|
2003-10-09 12:42:49 +00:00
|
|
|
<title>What is an element ?</title>
|
2000-08-16 21:38:57 +00:00
|
|
|
<para>
|
2003-10-09 12:42:49 +00:00
|
|
|
An element is the basic building block for the media pipeline.
|
|
|
|
All the different high-level components you are going to use are
|
2002-09-06 15:53:06 +00:00
|
|
|
derived from <classname>GstElement</classname>. This means that a
|
|
|
|
lot of functions you are going to use operate on objects of this class.
|
2000-08-16 21:38:57 +00:00
|
|
|
</para>
|
2002-09-06 15:53:06 +00:00
|
|
|
<para>
|
|
|
|
Elements, from the perspective of GStreamer, are viewed as "black boxes"
|
|
|
|
with a number of different aspects. One of these aspects is the presence
|
2003-10-09 12:42:49 +00:00
|
|
|
of "pads" (see <xref linkend="cha-pads"/>), or link points. This terminology arises from soldering;
|
2002-09-06 15:53:06 +00:00
|
|
|
pads are where wires can be attached.
|
2000-08-16 21:38:57 +00:00
|
|
|
</para>
|
2003-10-09 12:42:49 +00:00
|
|
|
</sect1>
|
2001-01-04 23:35:50 +00:00
|
|
|
|
2003-10-09 12:42:49 +00:00
|
|
|
<sect1 id="sec-elements-types">
|
|
|
|
<title>Types of elements</title>
|
|
|
|
|
2000-08-16 21:38:57 +00:00
|
|
|
<sect2 id="sec-elements-src">
|
2002-04-07 23:32:16 +00:00
|
|
|
<title>Source elements</title>
|
2000-08-16 21:38:57 +00:00
|
|
|
<para>
|
2002-09-06 15:53:06 +00:00
|
|
|
Source elements generate data for use by a pipeline, for example
|
|
|
|
reading from disk or from a sound card.
|
2000-08-16 21:38:57 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2003-10-09 12:42:49 +00:00
|
|
|
<xref linkend="sec-element-srcimg"/> shows how we will visualise
|
|
|
|
a source element.
|
2002-09-14 14:13:34 +00:00
|
|
|
We always draw a source pad to the right of the element.
|
2000-08-16 21:38:57 +00:00
|
|
|
</para>
|
|
|
|
<figure float="1" id="sec-element-srcimg">
|
2001-01-04 23:35:50 +00:00
|
|
|
<title>Visualisation of a source element</title>
|
2001-12-13 15:24:00 +00:00
|
|
|
<mediaobject>
|
|
|
|
<imageobject>
|
2003-10-08 14:34:09 +00:00
|
|
|
<imagedata fileref="images/src-element.ℑ" format="&IMAGE;" />
|
2001-12-13 15:24:00 +00:00
|
|
|
</imageobject>
|
|
|
|
</mediaobject>
|
2000-08-16 21:38:57 +00:00
|
|
|
</figure>
|
|
|
|
<para>
|
2002-09-08 21:17:16 +00:00
|
|
|
Source elements do not accept data, they only generate data. You can
|
2002-09-14 14:13:34 +00:00
|
|
|
see this in the figure because it only has a source pad. A source
|
|
|
|
pad can only generate data.
|
2000-08-16 21:38:57 +00:00
|
|
|
</para>
|
|
|
|
</sect2>
|
2001-01-04 23:35:50 +00:00
|
|
|
|
2000-08-16 21:38:57 +00:00
|
|
|
<sect2 id="sec-elements-filter">
|
2002-04-07 23:32:16 +00:00
|
|
|
<title>Filters and codecs</title>
|
2000-08-16 21:38:57 +00:00
|
|
|
<para>
|
2003-10-09 12:42:49 +00:00
|
|
|
Filter elements have both input and output pads. They operate on
|
2002-09-14 14:13:34 +00:00
|
|
|
data they receive in their sink pads and produce data on their source
|
2002-09-06 15:53:06 +00:00
|
|
|
pads. For example, MPEG decoders and volume filters would fall into
|
|
|
|
this category.
|
2002-04-07 23:32:16 +00:00
|
|
|
</para>
|
2000-08-16 21:38:57 +00:00
|
|
|
<para>
|
2002-09-06 15:53:06 +00:00
|
|
|
Elements are not constrained as to the number of pads they might have;
|
|
|
|
for example, a video mixer might have two input pads (the images of
|
|
|
|
the two different video streams) and one output pad.
|
2002-04-07 23:32:16 +00:00
|
|
|
</para>
|
2000-08-16 21:38:57 +00:00
|
|
|
<figure float="1" id="sec-element-filterimg">
|
2001-01-04 23:35:50 +00:00
|
|
|
<title>Visualisation of a filter element</title>
|
2001-12-13 15:24:00 +00:00
|
|
|
<mediaobject>
|
|
|
|
<imageobject>
|
2003-10-08 14:34:09 +00:00
|
|
|
<imagedata fileref="images/filter-element.ℑ" format="&IMAGE;" />
|
2001-12-13 15:24:00 +00:00
|
|
|
</imageobject>
|
|
|
|
</mediaobject>
|
2000-08-16 21:38:57 +00:00
|
|
|
</figure>
|
|
|
|
<para>
|
2003-10-09 12:42:49 +00:00
|
|
|
<xref linkend="sec-element-filterimg"/> shows how we will visualise
|
|
|
|
a filter element.
|
2002-09-14 14:13:34 +00:00
|
|
|
This element has one sink (input) pad and one source (output) pad.
|
2002-09-06 15:53:06 +00:00
|
|
|
Sink pads are drawn on the left of the element.
|
2000-08-16 21:38:57 +00:00
|
|
|
</para>
|
|
|
|
<figure float="1" id="sec-element-multifilterimg">
|
2001-01-04 23:35:50 +00:00
|
|
|
<title>Visualisation of a filter element with
|
2000-08-16 21:38:57 +00:00
|
|
|
more than one output pad</title>
|
2001-12-13 15:24:00 +00:00
|
|
|
<mediaobject>
|
|
|
|
<imageobject>
|
2003-10-08 14:34:09 +00:00
|
|
|
<imagedata fileref="images/filter-element-multi.ℑ"
|
|
|
|
format="&IMAGE;" />
|
2001-12-13 15:24:00 +00:00
|
|
|
</imageobject>
|
|
|
|
</mediaobject>
|
2000-08-16 21:38:57 +00:00
|
|
|
</figure>
|
|
|
|
<para>
|
2003-10-09 12:42:49 +00:00
|
|
|
<xref linkend="sec-element-filterimg"/> shows the visualisation of a filter element with
|
2002-09-06 15:53:06 +00:00
|
|
|
more than one output pad. An example of such a filter is the AVI
|
2003-10-09 12:42:49 +00:00
|
|
|
demultiplexer. This element will parse the input data and
|
2002-09-06 15:53:06 +00:00
|
|
|
extract the audio and video data. Most of these filters dynamically
|
|
|
|
send out a signal when a new pad is created so that the application
|
2003-01-24 18:08:39 +00:00
|
|
|
programmer can link an arbitrary element to the newly created pad.
|
2002-04-07 23:32:16 +00:00
|
|
|
</para>
|
2000-08-16 21:38:57 +00:00
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 id="sec-elements-sink">
|
2002-04-07 23:32:16 +00:00
|
|
|
<title>Sink elements</title>
|
|
|
|
<para>
|
2003-10-09 12:42:49 +00:00
|
|
|
Sink elements are end points in a media pipeline. They accept
|
2002-09-06 15:53:06 +00:00
|
|
|
data but do not produce anything. Disk writing, soundcard playback,
|
|
|
|
and video output would all be implemented by sink elements.
|
2003-10-09 12:42:49 +00:00
|
|
|
<xref linkend="sec-element-sinkimg"/> shows a sink element.
|
2002-04-07 23:32:16 +00:00
|
|
|
</para>
|
2000-08-16 21:38:57 +00:00
|
|
|
<figure float="1" id="sec-element-sinkimg">
|
2001-01-04 23:35:50 +00:00
|
|
|
<title>Visualisation of a sink element</title>
|
2001-12-13 15:24:00 +00:00
|
|
|
<mediaobject>
|
|
|
|
<imageobject>
|
2003-10-08 14:34:09 +00:00
|
|
|
<imagedata fileref="images/sink-element.ℑ" format="&IMAGE;" />
|
2001-12-13 15:24:00 +00:00
|
|
|
</imageobject>
|
|
|
|
</mediaobject>
|
2000-08-16 21:38:57 +00:00
|
|
|
</figure>
|
|
|
|
</sect2>
|
|
|
|
</sect1>
|
|
|
|
</chapter>
|