[FFmpeg-devel] update data_offset field in format context

Yoav Steinberg yoav
Wed Nov 5 16:03:28 CET 2008

I've come across some instances where the data_offset field of 
AVFormatContext isn't updated after opening a file for input 
(av_open_input_file). From the comment in the header it seems that the 
data_offset field should represent the position in the input where the 
header ends and the data begins. In some cases the header parsing done 
during file input seems to run to the end of the input and isn't 
restored to the position where the data begins, yielding an invalid 
data_offset value equal to the file size (specifically this recreates 
when calling av_open_input_file on a mov file).
I've add some code which attempts to provide a more accurate data_offset 
value for such files based on the index_entries table (if one is 
available). This seems to work for me. It'll be cool if this is added to 
the trunk or if someone can explain why not to add this.
(My code is attached).

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fix_data_offset.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081105/c0cdc3dc/attachment.txt>

More information about the ffmpeg-devel mailing list