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