b2d412077168a7984dadcf697899e3d5ef8cbf15
[platform/upstream/gstreamer.git] / docs / random / omega / eos.old
1 What I propose for EOS condition is th following:  As is stands, EOS is a
2 flag in a buffer.  However, it's also a signal from an element, which is
3 odd. What I propose is that EOS become a pad thing.  Here's how it would
4 work:
5
6 When a source has a final buffer, it marks it as EOS.  It passes this on
7 through the pad, and the pads set a 'pending' EOS state on the way
8 through.  When another push or pull happens, only then does the pad signal
9 EOS.  This means that EOS doesn't happen until the buffer has passed all
10 the way to the end, and a request for another buffer is starting to work
11 its way back.  It gets stopped almost immediately.
12
13 This gets a bit messy in complex cases, haven't thought them all out.
14 Assuming everything is reasonably symmetric, it should work out cleanly.
15 We may have to add the ability to force buffers to pass even post EOS, but
16 that sounds like a hack.
17
18
19
20 Example: DVD
21 ============
22
23
24                                               ------------     |-------|
25                                              -| mpeg2dec |-----|       |
26              ------------------------       / ------------     |       |
27              |                video0|------/ -------------     |       |       -------------
28              |                      |       -| subtitle0 |-----| merge |-------| videosink |
29              |             subtitle0|------/ -------------     |       |       -------------
30 ----------   |                      |        -------------     |       |
31 | dvdsrc |---| mpeg2parse  subtitle1|--------| subtitle1 |-----|       |
32 ----------   |                      |        -------------     |-------|
33              |                audio0|--------\ -----------     |----------|
34              |                      |         -| ac3dec0 |-----|          |
35              |                audio1|-------\  -----------     |          |    -------------
36              ------------------------        \ -----------     | switcher |----| audiosink |
37                                               -| ac3dec1 |-----|          |    -------------
38                                                -----------     |----------|
39
40 When dvdsrc reads its last buffer, it sets EOS on the buffer and passes it.  The pad (probably audio1,
41 since video and audio are interleaved and subtitles don't usually end up at the end of a movie) would
42 set EOS pending, and pass it to mpeg2dec which would pass the EOS to the merge.  Merge would then ask
43 for a buffer from subtitle1, since that's the one we're showing subtitles on right now.  It would then
44 pull from the mpeg2parse.  This would cause a switch back the parser, who's next task is to go and set
45 all the output pads to EOS.  It may have to accomplish this by sending a zero-byte buffer.
46
47 Well, this example isn't actually very good.  I'll go ahead and implement it, and we can see what
48 happens.  The current setup is so lacking that anything is better....