[FFmpeg-devel] update data_offset field in format context

Michael Niedermayer michaelni
Thu Nov 6 15:16:14 CET 2008

On Wed, Nov 05, 2008 at 05:03:28PM +0200, Yoav Steinberg wrote:
> Hi,
> 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).

This is not a proper solution to the problem, it also adds a obscure and
more importantly completely undocumented behavior to index entries.

For a proper solution (aka anything that might be accepted into svn)
the first step is a full explanation of what is wrong, basically, if
it cannot be reproduced exactly its not a full explanation.
second would be the question if its easier to fix the affected demuxers
or to change the core to guess the offset. Either way all demuxers must
be looked at, in the first case to find&fix them in the second to ensure
the core change works with all.

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081106/9ae13eb3/attachment.pgp>

More information about the ffmpeg-devel mailing list