aboutsummaryrefslogtreecommitdiff
path: root/docs/design/part-streams.txt
blob: ebc33d255ddf2239a9d685b3ee43631074a24860 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Streams
-------

  This document describes the objects that are passed from element to
  element in the streaming thread.


Stream objects
~~~~~~~~~~~~~~

The following objects are to be expected in the streaming thread:

 - events
    - SEGMENT           (S)
    - EOS		(EOS)  *
    - TAG               (T)
 - buffers              (B)    *

Objects marked with * need to be synchronised to the clock in sinks
and live sources.


Typical stream
~~~~~~~~~~~~~~

 A typical stream starts with a segment event that marks the
 buffer timestamp range. After that buffers are sent one after the
 other. After the last buffer an EOS marks the end of the stream. No
 more buffers are to be processed after the EOS event.

  +-+ +-++-+     +-+ +---+
  |S| |B||B| ... |B| |EOS|
  +-+ +-++-+     +-+ +---+

  1) SEGMENT, rate, start/stop, time
     - marks valid buffer timestamp range (start, stop)
     - marks stream_time of buffers (time). This is the stream time of buffers
       with a timestamp of NS.start.
     - marks playback rate (rate). This is the required playback rate.
     - marks applied rate (applied_rate). This is the already applied playback
       rate. (See also part-trickmodes.txt)
     - marks running_time of buffers. This is the time used to synchronize
       against the clock.

  2) N buffers
     - displayable buffers are between start/stop of the SEGMENT. Buffers
       outside the segment range should be dropped or clipped.

     - running_time: 
     
         if (NS.rate > 0.0)
           running_time = (B.timestamp - NS.start) / NS.abs_rate + NS.accum
         else
           running_time = (NS.stop - B.timestamp) / NS.abs_rate + NS.accum

        * a monotonically increasing value that can be used to synchronize 
	  against the clock (See also part-synchronisation.txt).

     - stream_time:

         stream_time = (B.timestamp - NS.start) * NS.abs_applied_rate + NS.time

        * current position in stream between 0 and duration.

  3) EOS
     - marks the end of data, nothing is to be expected after EOS, elements
       should refuse more data and return GST_FLOW_EOS. A FLUSH_STOP
       event clears the EOS state of an element.