Imported Upstream version 0.10.36
[profile/ivi/gstreamer.git] / docs / pwg / other-oneton.xml
1 <chapter id="chapter-other-oneton" xreflabel="Writing a Demuxer or Parser">
2   <title>Writing a Demuxer or Parser</title>
3   <para>
4     Demuxers are the 1-to-N elements that need very special care.
5     They are responsible for timestamping raw, unparsed data into
6     elementary video or audio streams, and there are many things that you
7     can optimize or do wrong. Here, several culprits will be mentioned
8     and common solutions will be offered. Parsers are demuxers with only
9     one source pad. Also, they only cut the stream into buffers, they
10     don't touch the data otherwise.
11   </para>
12   <para>
13     As mentioned previously in <xref linkend="chapter-negotiation"/>,
14     demuxers should use fixed caps, since their data type will not change.
15   </para>
16   <para>
17     As discussed in <xref linkend="chapter-scheduling"/>, demuxer elements
18     can be written in multiple ways:
19   </para>
20   <itemizedlist>
21     <listitem>
22       <para>
23         They can be the driving force of the pipeline, by running their own
24         task. This works particularly well for elements that need random
25         access, for example an AVI demuxer.
26       </para>
27     </listitem>
28     <listitem>
29       <para>
30         They can also run in push-based mode, which means that an upstream
31         element drives the pipeline. This works particularly well for streams
32         that may come from network, such as Ogg.
33       </para>
34     </listitem>
35   </itemizedlist>
36   <para>
37     In addition, audio parsers with one output can, in theory, also be written
38     in random access mode. Although simple playback will mostly work if your
39     element only accepts one mode, it may be required to implement multiple
40     modes to work in combination with all sorts of applications, such as
41     editing. Also, performance may become better if you implement multiple
42     modes. See <xref linkend="chapter-scheduling"/> to see how an element
43     can accept multiple scheduling modes.
44   </para>
45 </chapter>