[FFmpeg-devel] [PATCH] Fix Ogg data_offset computation.
Tue Nov 16 18:47:51 CET 2010
Here is a patch that fixes the data_offset computation for Ogg
files that have the first video frame split across several pages.
Here is an example where the code fails.
v - An Ogg page that contains a fragment of a video packet.
(May or may not have continued flag set and has a packet
count of 0)
V - An Ogg page that contains the end of a fragmented packet
as well as other full video packets. (ie Has continued flag
set, granulepos set, & packet count > 0)
A - An Ogg page that contains complete audio packets.
The current code fails to compute data_offset properly if it
encounters a file that starts with a page sequence of
The code fails because it is assuming that the stream that
it receives the first "non-header" packet from indicates the
start of the stream data. In the scenario above this isn't the
case because the first packet decoded is audio, but the
stream data actually starts with video pages.
My patch simply allows data_offset to be reset to a lower
file offset if a file like this is encountered. It selects the
lowest offset across all streams instead of simply selecting
the first stream that outputs a packet.
I checked with some people on the #theora IRC channel to
make sure that this is a valid Ogg page sequence. They
claimed that it was. I've encountered this sequence
in a file generated by recordMyDesktop.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 522 bytes
Desc: not available
More information about the ffmpeg-devel