Writing a N-to-1 Element or Muxer
N-to-1 elements have been previously mentioned and discussed in both
the chapter called Request and Sometimes pads and in
the chapter called How a loopfunc works. The main noteworthy thing
about N-to-1 elements is that they should always,
without any single exception, be _loop ()-based.
Apart from that, there is not much general that you need to know. We
will discuss one special type of N-to-1 elements here, these being
muxers. The first two of these sections apply to N-to-1 elements in
general, though.
As previously mentioned in the chapter called How a loopfunc works,
N-to-1 elements generally try to have one buffer from each sink pad
and then handle the one with the earliest timestamp. There's some
exceptions to this rule, we will come to those later. This only works
if all streams actually continuously provide input. There might be
cases where this is not true, for example subtitles (there might be
no subtitle for a while), overlay images and so forth. For this
purpose, there is a _select () function in
GStreamer. It checks whether input is available on a (list of)
pad(s). In this way, you can skip over the pads that are 'non-
continuous'.
/* Pad selection is currently broken, FIXME some day */
|