docs/: add a gdp image
[platform/upstream/gstreamer.git] / docs / manual / intro-motivation.xml
1 <chapter id="chapter-motivation">
2   <title>Motivation &amp; Goals</title>
3   <para> 
4     Linux has historically lagged behind other operating systems in the
5     multimedia arena. Microsoft's <trademark>Windows</trademark> and
6     Apple's <trademark>MacOS</trademark> both have strong support for
7     multimedia devices, multimedia content creation, playback, and
8     realtime processing. Linux, on the other hand, has a poorly integrated
9     collection of multimedia utilities and applications available, which
10     can hardly compete with the professional level of software available
11     for MS Windows and MacOS.
12   </para>
13   <para> 
14     GStreamer was designed to provide a solution to the current Linux media
15     problems.
16   </para>
17
18   <sect1 id="section-motivation-problems">
19     <title>Current problems</title>
20     <para> 
21       We describe the typical problems in today's media handling on Linux.
22     </para>
23     <sect2 id="section-motivation-duplicate">
24       <title>Multitude of duplicate code</title>
25       <para> 
26         The Linux user who wishes to hear a sound file must hunt through
27         their collection of sound file players in order to play the tens
28         of sound file formats in wide use today. Most of these players
29         basically reimplement the same code over and over again.
30       </para>
31       <para>
32         The Linux developer who wishes to embed a video clip in their
33         application must use crude hacks to run an external video player.
34         There is no library available that a developer can use to create
35         a custom media player.
36       </para>
37     </sect2>
38
39     <sect2 id="section-motivation-goal">
40       <title>'One goal' media players/libraries</title>
41       <para>
42         Your typical MPEG player was designed to play MPEG video and audio.
43         Most of these players have implemented a complete infrastructure
44         focused on achieving their only goal: playback. No provisions were
45         made to add filters or special effects to the video or audio data.
46       </para> 
47       <para>
48         If you want to convert an MPEG-2 video stream into an AVI file,
49         your best option would be to take all of the MPEG-2 decoding
50         algorithms out of the player and duplicate them into your own
51         AVI encoder. These algorithms cannot easily be shared across
52         applications.
53       </para> 
54       <para>
55         Attempts have been made to create libraries for handling various
56         media types. Because they focus on a very specific media type
57         (avifile, libmpeg2, ...), significant work is needed to integrate
58         them due to a lack of a common API. &GStreamer; allows you to
59         wrap these libraries with a common API, which significantly
60         simplifies integration and reuse.
61       </para> 
62     </sect2>
63   
64     <sect2 id="section-motivation-plugin">
65       <title>Non unified plugin mechanisms</title>
66       <para> 
67         Your typical media player might have a plugin for different media
68         types. Two media players will typically implement their own plugin
69         mechanism so that the codecs cannot be easily exchanged. The plugin
70         system of the typical media player is also very tailored to the
71         specific needs of the application.
72       </para> 
73       <para> 
74         The lack of a unified plugin mechanism also seriously hinders the 
75         creation of binary only codecs. No company is willing to port their
76         code to all the different plugin mechanisms.
77       </para> 
78       <para> 
79         While &GStreamer; also uses it own plugin system it offers a very rich
80         framework for the plugin developer and ensures the plugin can be used
81         in a wide range of applications, transparently interacting with other
82         plugins. The framework that &GStreamer; provides for the plugins is
83         flexible enough to host even the most demanding plugins.
84       </para> 
85     </sect2>
86
87     <sect2 id="section-motivation-experience">
88       <title>Poor user experience</title>
89       <para>
90         Because of the problems mentioned above, application authors have
91         so far often been urged to spend a considerable amount of time in
92         writing their own backends, plugin mechanisms and so on. The result
93         has often been, unfortunately, that both the backend as well as the
94         user interface were only half-finished. Demotivated, the application
95         authors would start rewriting the whole thing and complete the circle.
96         This leads to a <emphasis>poor end user experience</emphasis>.
97       </para>
98     </sect2>
99
100     <sect2 id="section-motivation-network">
101       <title>Provision for network transparency</title>
102       <para> 
103         No infrastructure is present to allow network transparent media
104         handling. A distributed MPEG encoder will typically duplicate the
105         same encoder algorithms found in a non-distributed encoder.
106       </para> 
107       <para> 
108         No provisions have been made for use by and use of technologies such 
109         as the <ulink url="http://gnome.org/" type="http">GNOME</ulink>
110         desktop platform. Because the wheel is re-invented all the time,
111         it's hard to properly integrate multimedia into the bigger whole of
112         user's environment.
113       </para> 
114       <para> 
115         The &GStreamer; core does not use network transparent technologies
116         at the lowest level as it only adds overhead for the local case. 
117         That said, it shouldn't be hard to create a wrapper around the
118         core components. There are tcp plugins now that implement a
119         &GStreamer; Data Protocol that allows pipelines to be split over
120         TCP. These are located in the gst-plugins module directory gst/tcp.
121       </para> 
122     </sect2>
123
124     <sect2 id="section-motivation-catchup">
125       <title>Catch up with the <trademark>Windows</trademark> world</title>
126       <para> 
127         We need solid media handling if we want to see Linux succeed on
128         the desktop.
129       </para> 
130       <para> 
131         We must clear the road for commercially backed codecs and multimedia 
132         applications so that Linux can become an option for doing multimedia.
133       </para> 
134     </sect2>
135   </sect1>
136
137   <sect1 id="section-goals-design">
138     <title>The design goals</title>
139     <para> 
140       We describe what we try to achieve with &GStreamer;.
141     </para>
142     <sect2 id="section-goals-clean">
143       <title>Clean and powerful</title>
144       <para>
145         &GStreamer; wants to provide a clean interface to:
146       </para>
147       <itemizedlist>
148         <listitem>
149           <para>
150             The application programmer who wants to build a media pipeline. 
151             The programmer can use an extensive set of powerful tools to create
152             media pipelines without writing a single line of code. Performing 
153             complex media manipulations becomes very easy.
154           </para>
155         </listitem>
156         <listitem>
157           <para>
158             The plugin programmer. Plugin programmers are provided a clean and
159             simple API to create self-contained plugins. An extensive debugging
160             and tracing mechanism has been integrated. GStreamer also comes with
161             an extensive set of real-life plugins that serve as examples too.
162           </para>
163         </listitem>
164       </itemizedlist>
165
166     </sect2>
167     <sect2 id="section-goals-object">
168       <title>Object oriented</title>
169       <para>
170         &GStreamer; adheres to the GLib 2.0 object model. A programmer
171         familiar with GLib 2.0 or older versions of GTK+ will be
172         comfortable with &GStreamer;.
173       </para>
174       <para>
175         &GStreamer; uses the mechanism of signals and object properties. 
176       </para> 
177       <para>
178         All objects can be queried at runtime for their various properties and
179         capabilities.
180       </para> 
181       <para>
182         &GStreamer; intends to be similar in programming methodology to GTK+.
183         This applies to the object model, ownership of objects, reference
184         counting, ...
185       </para> 
186     </sect2>
187   
188     <sect2 id="section-goals-extensible">
189       <title>Extensible</title>
190       <para> 
191         All &GStreamer; Objects can be extended using the GObject
192         inheritance methods.
193       </para> 
194       <para> 
195         All plugins are loaded dynamically and can be extended and upgraded
196         independently.
197       </para> 
198     </sect2>
199
200     <sect2 id="section-goals-binary">
201       <title>Allow binary only plugins</title>
202       <para>
203         Plugins are shared libraries that are loaded at runtime. Since all
204         the properties of the plugin can be set using the GObject properties,
205         there is no need (and in fact no way) to have any header files
206         installed for the plugins.
207       </para>
208       <para> 
209         Special care has been taken to make plugins completely self-contained. 
210         All relevant aspects of plugins can be queried at run-time.
211       </para> 
212     </sect2>
213
214     <sect2 id="section-goals-performance">
215       <title>High performance</title>
216       <para> 
217         High performance is obtained by:
218       </para> 
219       <itemizedlist>
220         <listitem>
221           <para>
222             using GLib's <function>g_mem_chunk</function> and fast
223             non-blocking allocation algorithms where possible to
224             minimize dynamic memory allocation.
225           </para>
226         </listitem>
227         <listitem>
228           <para>
229             extremely light-weight links between plugins. Data can travel
230             the pipeline with minimal overhead. Data passing between
231             plugins only involves a pointer dereference in a typical
232             pipeline.
233           </para>
234         </listitem>
235         <listitem>
236           <para>
237             providing a mechanism to directly work on the target memory.
238             A plugin can for example directly write to the X server's
239             shared memory space. Buffers can also point to arbitrary
240             memory, such as a sound card's internal hardware buffer.
241           </para>
242         </listitem>
243         <listitem>
244           <para>
245             refcounting and copy on write minimize usage of memcpy.
246             Sub-buffers efficiently split buffers into manageable pieces.
247           </para>
248         </listitem>
249         <listitem>
250           <para>
251             the use of cothreads to minimize the threading overhead.
252             Cothreads are a simple and fast user-space method for
253             switching between subtasks. Cothreads were measured to
254             consume as little as 600 cpu cycles.
255           </para>
256         </listitem>
257         <listitem>
258           <para>
259             allowing hardware acceleration by using specialized plugins.
260           </para>
261         </listitem>
262         <listitem>
263           <para>
264             using a plugin registry with the specifications of the plugins so 
265             that the plugin loading can be delayed until the plugin is actually
266             used.
267           </para>
268         </listitem>
269         <listitem>
270           <para>
271             all critical data passing is free of locks and mutexes.
272           </para>
273         </listitem>
274       </itemizedlist>
275     </sect2>
276
277     <sect2 id="section-goals-separation">
278       <title>Clean core/plugins separation</title>
279       <para>
280         The core of &GStreamer; is essentially media-agnostic. It only knows
281         about bytes and blocks, and only contains basic elements.
282         The core of &GStreamer; is functional enough to even implement
283         low-level system tools, like cp.
284       </para>
285       <para>
286         All of the media handling functionality is provided by plugins
287         external to the core. These tell the core how to handle specific
288         types of media.
289       </para>
290     </sect2>
291
292     <sect2 id="section-goals-testbed">
293       <title>Provide a framework for codec experimentation</title>
294       <para>
295         &GStreamer; also wants to be an easy framework where codec
296         developers can experiment with different algorithms, speeding up
297         the development of open and free multimedia codecs like <ulink
298         url="http://www.xiph.org/ogg/index.html" type="http">Theora and
299         Vorbis</ulink>.
300       </para>
301     </sect2>
302
303   </sect1>
304 </chapter>