Update theme submodule
[platform/upstream/gstreamer.git] / pwg-other-ntoone.md
1 ---
2 title: Writing a N-to-1 Element or Muxer
3 ...
4
5 # Writing a N-to-1 Element or Muxer
6
7 N-to-1 elements have been previously mentioned and discussed in both
8 [Request and Sometimes pads](pwg-advanced-request.md) and in
9 [Different scheduling modes](pwg-scheduling.md). The main noteworthy
10 thing about N-to-1 elements is that each pad is push-based in its own
11 thread, and the N-to-1 element synchronizes those streams by
12 expected-timestamp-based logic. This means it lets all streams wait
13 except for the one that provides the earliest next-expected timestamp.
14 When that stream has passed one buffer, the next
15 earliest-expected-timestamp is calculated, and we start back where we
16 were, until all streams have reached EOS. There is a helper base class,
17 called `GstCollectPads`, that will help you to do this.
18
19 Note, however, that this helper class will only help you with grabbing a
20 buffer from each input and giving you the one with earliest timestamp.
21 If you need anything more difficult, such as "don't-grab-a-new-buffer
22 until a given timestamp" or something like that, you'll need to do this
23 yourself.
24