14.4. Obligations of each element.

Let us clarify the contract between GStreamer and each element in the pipeline.

14.4.1. Source elements

Source elements (or parsers of formats that provide notion of time, such as MPEG, as explained above) must place a timestamp in each buffer that they deliver. The origin of the time used is arbitrary, but it must match the time delivered in the discontinous event (see below). However, it is expected that the origin is the origin of the media stream.

In order to initialize the element time of the rest of the pipeline, a source element must send a discontinous event before starting to play. In addition, after seeking, a discontinious event must be sent, because the timestamp of the next element does not match the element time of the rest of the pipeline.

14.4.2. Sink elements

If the element is intended to emit samples at a specific time (real time playing), the element should require a clock, and thus implement the method set_clock.

In addition, before playing each sample, if the current element time is less than the timestamp in the sample, it wait until the current time arrives should call gst_element_wait() [1]

Notes

[1]

With some schedulers, gst_element_wait() blocks the pipeline. For instance, if there is one audio sink element and one video sink element, while the audio element is waiting for a sample the video element cannot play other sample. This behaviour is under discussion, and might change in a future release.