On Tue, Aug 16, 2005 at 12:20:03PM +0200, david kment wrote:
> i modified the fopen call in the source to open the main archive, find out
where the requested embedded file begins, and set the file pointer to this
offset using fseek().
>
> the video is decoded without problems, but in some cases, the stream end
doesn't seem to be detected correctly.....
> this means i cannot tell my main program that the video playback has
stopped, since the Ogg part continues to load data, but now from the next file
in sequence and so on, until EOF is reported.
Yes, this sort of thing happens a lot. The Ogg layer treats the data
past the end of the valid segment as corruption and just keeps reading
until it finds another Ogg stream or hits EOF. You need to modify the
read command as well to check against your file index and signal EOF
when it hits the end of the virtual file. In the context of splayer,
that's just returning 'zero bytes read' from buffer_data().
The way splayer is written it only decides playback is done when there
are no decoded frames *and* no more data available which could be
decoded, so it keeps pulling on the Ogg layer until it hits EOF.
There is an end-of-stream flag on the last Ogg page you could look for,
but relying on that is not robust. It's also not technically correct for
multiplexed streams. So returning EOF properly past the end of your
virtual file is really the best approach.
> do you know how i can detect if video stream ended in a more reliable way,
and hopefully without hacking the
> Ogg source at all?
All this is just guessing based on what you've told us, but hopefully
is of some help.
HTH,
-r