blob: 8621d67fc373a97249add40008c3eac27cc8f4a3 [file] [log] [blame] [edit]
OUTDATED
--------
What I propose for EOS condition is th following: As is stands, EOS is a
flag in a buffer. However, it's also a signal from an element, which is
odd. What I propose is that EOS become a pad thing. Here's how it would
work:
When a source has a final buffer, it marks it as EOS. It passes this on
through the pad, and the pads set a 'pending' EOS state on the way
through. When another push or pull happens, only then does the pad signal
EOS. This means that EOS doesn't happen until the buffer has passed all
the way to the end, and a request for another buffer is starting to work
its way back. It gets stopped almost immediately.
This gets a bit messy in complex cases, haven't thought them all out.
Assuming everything is reasonably symmetric, it should work out cleanly.
We may have to add the ability to force buffers to pass even post EOS, but
that sounds like a hack.
Example: DVD
============
------------ |-------|
-| mpeg2dec |-----| |
------------------------ / ------------ | |
| video0|------/ ------------- | | -------------
| | -| subtitle0 |-----| merge |-------| videosink |
| subtitle0|------/ ------------- | | -------------
---------- | | ------------- | |
| dvdsrc |---| mpeg2parse subtitle1|--------| subtitle1 |-----| |
---------- | | ------------- |-------|
| audio0|--------\ ----------- |----------|
| | -| ac3dec0 |-----| |
| audio1|-------\ ----------- | | -------------
------------------------ \ ----------- | switcher |----| audiosink |
-| ac3dec1 |-----| | -------------
----------- |----------|
When dvdsrc reads its last buffer, it sets EOS on the buffer and passes it. The pad (probably audio1,
since video and audio are interleaved and subtitles don't usually end up at the end of a movie) would
set EOS pending, and pass it to mpeg2dec which would pass the EOS to the merge. Merge would then ask
for a buffer from subtitle1, since that's the one we're showing subtitles on right now. It would then
pull from the mpeg2parse. This would cause a switch back the parser, who's next task is to go and set
all the output pads to EOS. It may have to accomplish this by sending a zero-byte buffer.
Well, this example isn't actually very good. I'll go ahead and implement it, and we can see what
happens. The current setup is so lacking that anything is better....