2004-12-15 07:30:55 +00:00
|
|
|
<chapter id="chapter-motivation">
|
2008-06-27 07:03:05 +00:00
|
|
|
<title>Design principles</title>
|
|
|
|
|
|
|
|
<!--
|
2004-12-15 07:30:55 +00:00
|
|
|
<para>
|
2004-12-15 17:32:49 +00:00
|
|
|
Linux has historically lagged behind other operating systems in the
|
|
|
|
multimedia arena. Microsoft's <trademark>Windows</trademark> and
|
|
|
|
Apple's <trademark>MacOS</trademark> both have strong support for
|
|
|
|
multimedia devices, multimedia content creation, playback, and
|
|
|
|
realtime processing. Linux, on the other hand, has a poorly integrated
|
|
|
|
collection of multimedia utilities and applications available, which
|
|
|
|
can hardly compete with the professional level of software available
|
|
|
|
for MS Windows and MacOS.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
GStreamer was designed to provide a solution to the current Linux media
|
|
|
|
problems.
|
2004-12-15 07:30:55 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<sect1 id="section-motivation-problems">
|
|
|
|
<title>Current problems</title>
|
|
|
|
<para>
|
|
|
|
We describe the typical problems in today's media handling on Linux.
|
|
|
|
</para>
|
|
|
|
<sect2 id="section-motivation-duplicate">
|
|
|
|
<title>Multitude of duplicate code</title>
|
|
|
|
<para>
|
2004-12-15 17:32:49 +00:00
|
|
|
The Linux user who wishes to hear a sound file must hunt through
|
|
|
|
their collection of sound file players in order to play the tens
|
|
|
|
of sound file formats in wide use today. Most of these players
|
|
|
|
basically reimplement the same code over and over again.
|
2004-12-15 07:30:55 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2004-12-15 17:32:49 +00:00
|
|
|
The Linux developer who wishes to embed a video clip in their
|
|
|
|
application must use crude hacks to run an external video player.
|
|
|
|
There is no library available that a developer can use to create
|
|
|
|
a custom media player.
|
2004-12-15 07:30:55 +00:00
|
|
|
</para>
|
2004-12-15 07:45:16 +00:00
|
|
|
</sect2>
|
2004-12-15 17:32:49 +00:00
|
|
|
|
2004-12-15 07:30:55 +00:00
|
|
|
<sect2 id="section-motivation-goal">
|
|
|
|
<title>'One goal' media players/libraries</title>
|
|
|
|
<para>
|
2004-12-15 17:32:49 +00:00
|
|
|
Your typical MPEG player was designed to play MPEG video and audio.
|
|
|
|
Most of these players have implemented a complete infrastructure
|
|
|
|
focused on achieving their only goal: playback. No provisions were
|
|
|
|
made to add filters or special effects to the video or audio data.
|
2004-12-15 07:30:55 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2004-12-15 17:32:49 +00:00
|
|
|
If you want to convert an MPEG-2 video stream into an AVI file,
|
|
|
|
your best option would be to take all of the MPEG-2 decoding
|
|
|
|
algorithms out of the player and duplicate them into your own
|
|
|
|
AVI encoder. These algorithms cannot easily be shared across
|
|
|
|
applications.
|
2004-12-15 07:30:55 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2004-12-15 17:32:49 +00:00
|
|
|
Attempts have been made to create libraries for handling various
|
|
|
|
media types. Because they focus on a very specific media type
|
|
|
|
(avifile, libmpeg2, ...), significant work is needed to integrate
|
|
|
|
them due to a lack of a common API. &GStreamer; allows you to
|
|
|
|
wrap these libraries with a common API, which significantly
|
|
|
|
simplifies integration and reuse.
|
2004-12-15 07:30:55 +00:00
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 id="section-motivation-plugin">
|
|
|
|
<title>Non unified plugin mechanisms</title>
|
|
|
|
<para>
|
|
|
|
Your typical media player might have a plugin for different media
|
|
|
|
types. Two media players will typically implement their own plugin
|
2004-12-15 17:32:49 +00:00
|
|
|
mechanism so that the codecs cannot be easily exchanged. The plugin
|
|
|
|
system of the typical media player is also very tailored to the
|
|
|
|
specific needs of the application.
|
2004-12-15 07:30:55 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The lack of a unified plugin mechanism also seriously hinders the
|
|
|
|
creation of binary only codecs. No company is willing to port their
|
|
|
|
code to all the different plugin mechanisms.
|
|
|
|
</para>
|
|
|
|
<para>
|
2004-12-15 17:32:49 +00:00
|
|
|
While &GStreamer; also uses it own plugin system it offers a very rich
|
2004-12-16 10:53:47 +00:00
|
|
|
framework for the plugin developer and ensures the plugin can be used
|
2004-12-15 07:30:55 +00:00
|
|
|
in a wide range of applications, transparently interacting with other
|
2004-12-15 17:32:49 +00:00
|
|
|
plugins. The framework that &GStreamer; provides for the plugins is
|
2004-12-15 07:30:55 +00:00
|
|
|
flexible enough to host even the most demanding plugins.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
2004-12-15 17:32:49 +00:00
|
|
|
<sect2 id="section-motivation-experience">
|
|
|
|
<title>Poor user experience</title>
|
|
|
|
<para>
|
|
|
|
Because of the problems mentioned above, application authors have
|
|
|
|
so far often been urged to spend a considerable amount of time in
|
|
|
|
writing their own backends, plugin mechanisms and so on. The result
|
|
|
|
has often been, unfortunately, that both the backend as well as the
|
|
|
|
user interface were only half-finished. Demotivated, the application
|
|
|
|
authors would start rewriting the whole thing and complete the circle.
|
|
|
|
This leads to a <emphasis>poor end user experience</emphasis>.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
2004-12-15 07:30:55 +00:00
|
|
|
<sect2 id="section-motivation-network">
|
|
|
|
<title>Provision for network transparency</title>
|
|
|
|
<para>
|
|
|
|
No infrastructure is present to allow network transparent media
|
|
|
|
handling. A distributed MPEG encoder will typically duplicate the
|
|
|
|
same encoder algorithms found in a non-distributed encoder.
|
|
|
|
</para>
|
|
|
|
<para>
|
2006-05-05 14:09:21 +00:00
|
|
|
No provisions have been made for use by and use of technologies such
|
|
|
|
as the <ulink url="http://gnome.org/" type="http">GNOME</ulink>
|
|
|
|
desktop platform. Because the wheel is re-invented all the time,
|
|
|
|
it's hard to properly integrate multimedia into the bigger whole of
|
|
|
|
user's environment.
|
2004-12-15 07:30:55 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2004-12-15 17:32:49 +00:00
|
|
|
The &GStreamer; core does not use network transparent technologies
|
|
|
|
at the lowest level as it only adds overhead for the local case.
|
2004-12-15 07:30:55 +00:00
|
|
|
That said, it shouldn't be hard to create a wrapper around the
|
2004-12-15 17:32:49 +00:00
|
|
|
core components. There are tcp plugins now that implement a
|
2006-06-13 19:24:34 +00:00
|
|
|
&GStreamer; Data Protocol that allows pipelines to be split over
|
2004-12-15 17:32:49 +00:00
|
|
|
TCP. These are located in the gst-plugins module directory gst/tcp.
|
2004-12-15 07:30:55 +00:00
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 id="section-motivation-catchup">
|
|
|
|
<title>Catch up with the <trademark>Windows</trademark> world</title>
|
|
|
|
<para>
|
|
|
|
We need solid media handling if we want to see Linux succeed on
|
|
|
|
the desktop.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
We must clear the road for commercially backed codecs and multimedia
|
|
|
|
applications so that Linux can become an option for doing multimedia.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
</sect1>
|
2004-12-15 17:32:49 +00:00
|
|
|
|
|
|
|
<sect1 id="section-goals-design">
|
|
|
|
<title>The design goals</title>
|
|
|
|
<para>
|
|
|
|
We describe what we try to achieve with &GStreamer;.
|
|
|
|
</para>
|
2008-06-27 07:03:05 +00:00
|
|
|
-->
|
|
|
|
|
|
|
|
<section id="section-goals-clean">
|
2004-12-15 17:32:49 +00:00
|
|
|
<title>Clean and powerful</title>
|
|
|
|
<para>
|
2008-06-27 07:03:05 +00:00
|
|
|
&GStreamer; provides a clean interface to:
|
2004-12-15 17:32:49 +00:00
|
|
|
</para>
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The application programmer who wants to build a media pipeline.
|
|
|
|
The programmer can use an extensive set of powerful tools to create
|
|
|
|
media pipelines without writing a single line of code. Performing
|
|
|
|
complex media manipulations becomes very easy.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The plugin programmer. Plugin programmers are provided a clean and
|
2004-12-16 10:53:47 +00:00
|
|
|
simple API to create self-contained plugins. An extensive debugging
|
2004-12-15 17:32:49 +00:00
|
|
|
and tracing mechanism has been integrated. GStreamer also comes with
|
|
|
|
an extensive set of real-life plugins that serve as examples too.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
|
2008-06-27 07:03:05 +00:00
|
|
|
</section>
|
|
|
|
<section id="section-goals-object">
|
2004-12-15 17:32:49 +00:00
|
|
|
<title>Object oriented</title>
|
|
|
|
<para>
|
2008-06-27 07:03:05 +00:00
|
|
|
&GStreamer; adheres to GObject, the GLib 2.0 object model. A programmer
|
|
|
|
familiar with GLib 2.0 or GTK+ will be
|
2004-12-15 17:32:49 +00:00
|
|
|
comfortable with &GStreamer;.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
&GStreamer; uses the mechanism of signals and object properties.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
All objects can be queried at runtime for their various properties and
|
|
|
|
capabilities.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
&GStreamer; intends to be similar in programming methodology to GTK+.
|
|
|
|
This applies to the object model, ownership of objects, reference
|
2008-06-27 07:03:05 +00:00
|
|
|
counting, etc.
|
2004-12-15 17:32:49 +00:00
|
|
|
</para>
|
2008-06-27 07:03:05 +00:00
|
|
|
</section>
|
2004-12-15 17:32:49 +00:00
|
|
|
|
2008-06-27 07:03:05 +00:00
|
|
|
<section id="section-goals-extensible">
|
2004-12-15 17:32:49 +00:00
|
|
|
<title>Extensible</title>
|
|
|
|
<para>
|
|
|
|
All &GStreamer; Objects can be extended using the GObject
|
|
|
|
inheritance methods.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
All plugins are loaded dynamically and can be extended and upgraded
|
|
|
|
independently.
|
|
|
|
</para>
|
2008-06-27 07:03:05 +00:00
|
|
|
</section>
|
2004-12-15 17:32:49 +00:00
|
|
|
|
2008-06-27 07:03:05 +00:00
|
|
|
<section id="section-goals-binary">
|
|
|
|
<title>Allow binary-only plugins</title>
|
2004-12-15 17:32:49 +00:00
|
|
|
<para>
|
|
|
|
Plugins are shared libraries that are loaded at runtime. Since all
|
|
|
|
the properties of the plugin can be set using the GObject properties,
|
|
|
|
there is no need (and in fact no way) to have any header files
|
|
|
|
installed for the plugins.
|
|
|
|
</para>
|
|
|
|
<para>
|
2004-12-16 10:53:47 +00:00
|
|
|
Special care has been taken to make plugins completely self-contained.
|
2004-12-15 17:32:49 +00:00
|
|
|
All relevant aspects of plugins can be queried at run-time.
|
|
|
|
</para>
|
2008-06-27 07:03:05 +00:00
|
|
|
</section>
|
2004-12-15 17:32:49 +00:00
|
|
|
|
2008-06-27 07:03:05 +00:00
|
|
|
<section id="section-goals-performance">
|
2004-12-15 17:32:49 +00:00
|
|
|
<title>High performance</title>
|
|
|
|
<para>
|
|
|
|
High performance is obtained by:
|
|
|
|
</para>
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2008-09-11 16:56:48 +00:00
|
|
|
using GLib's <classname>GSlice</classname> allocator
|
2004-12-15 17:32:49 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
extremely light-weight links between plugins. Data can travel
|
|
|
|
the pipeline with minimal overhead. Data passing between
|
|
|
|
plugins only involves a pointer dereference in a typical
|
|
|
|
pipeline.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
providing a mechanism to directly work on the target memory.
|
|
|
|
A plugin can for example directly write to the X server's
|
|
|
|
shared memory space. Buffers can also point to arbitrary
|
|
|
|
memory, such as a sound card's internal hardware buffer.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
refcounting and copy on write minimize usage of memcpy.
|
|
|
|
Sub-buffers efficiently split buffers into manageable pieces.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2008-09-11 16:56:48 +00:00
|
|
|
dedicated streaming threads, with scheduling handled by the kernel.
|
2004-12-15 17:32:49 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
allowing hardware acceleration by using specialized plugins.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
using a plugin registry with the specifications of the plugins so
|
|
|
|
that the plugin loading can be delayed until the plugin is actually
|
|
|
|
used.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
2008-06-27 07:03:05 +00:00
|
|
|
</section>
|
2004-12-15 17:32:49 +00:00
|
|
|
|
2008-06-27 07:03:05 +00:00
|
|
|
<section id="section-goals-separation">
|
2004-12-15 17:32:49 +00:00
|
|
|
<title>Clean core/plugins separation</title>
|
|
|
|
<para>
|
|
|
|
The core of &GStreamer; is essentially media-agnostic. It only knows
|
|
|
|
about bytes and blocks, and only contains basic elements.
|
|
|
|
The core of &GStreamer; is functional enough to even implement
|
|
|
|
low-level system tools, like cp.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
All of the media handling functionality is provided by plugins
|
|
|
|
external to the core. These tell the core how to handle specific
|
|
|
|
types of media.
|
|
|
|
</para>
|
2008-06-27 07:03:05 +00:00
|
|
|
</section>
|
2004-12-15 17:32:49 +00:00
|
|
|
|
2008-06-27 07:03:05 +00:00
|
|
|
<section id="section-goals-testbed">
|
2004-12-15 17:32:49 +00:00
|
|
|
<title>Provide a framework for codec experimentation</title>
|
|
|
|
<para>
|
|
|
|
&GStreamer; also wants to be an easy framework where codec
|
|
|
|
developers can experiment with different algorithms, speeding up
|
|
|
|
the development of open and free multimedia codecs like <ulink
|
|
|
|
url="http://www.xiph.org/ogg/index.html" type="http">Theora and
|
|
|
|
Vorbis</ulink>.
|
|
|
|
</para>
|
2008-06-27 07:03:05 +00:00
|
|
|
</section>
|
2004-12-15 17:32:49 +00:00
|
|
|
|
2008-06-27 07:03:05 +00:00
|
|
|
<!--
|
2004-12-15 17:32:49 +00:00
|
|
|
</sect1>
|
2008-06-27 07:03:05 +00:00
|
|
|
-->
|
2004-12-15 07:30:55 +00:00
|
|
|
</chapter>
|