[FFmpeg-devel] update data_offset field in format context

Michael Niedermayer michaelni
Fri Nov 7 20:29:28 CET 2008

On Thu, Nov 06, 2008 at 09:07:23PM +0200, Yoav Steinberg wrote:
> Reimar D?ffinger wrote:
> > On Thu, Nov 06, 2008 at 05:50:46PM +0200, Yoav Steinberg wrote:
> >> In my specific application (using libavformat) I'm interested in using 
> >> the data_offset field to figure out how much of the file is used for 
> >> data and how much is used for "headers".
> > 
> > And oh, I just have to ask: what is "headers"? I find it hard to imagine
> > what the purpose of that should be - it seems more likely that you will
> > end up misleading your users to believe this has anything to do how with
> > how efficient the container is (it does not, also with that method it
> > will say "0" for almost all mov files).
> > 
> The aim is to define general threshold to distinguish valid data from 
> garbage within the file. With the intent of filtering out files that 
> contain real media from files that just seem to contain media or have 
> lots of corrupt packets in them. This is required in my system to try to 
> keep corrupt data to a minimum and prevent user abuse. By using ff's 
> demuxer's I can easily find relations between sizes of packets/streams 
> and the total file size, which gives me a decent indication in many cases.
> I though of utilizing the data_offset to improve calculation results on 
> my test set, which it has except for mov files (until I changed the code).
> >> "rating" system which isn't relevant to our discussion.
> > 
> > IMO if what you are doing makes any sense is very relevant to whether we
> > should try to fix it for your use case.
> > 
> > Greetings,
> > Reimar D?ffinger
> I gather the data_offset field was created to for formats that need it. 
> Other formats (like mov) don't care about it, so there's no "correct" 
> value that should be expected in such formats. It seems it would be a 
> mistake to change the code only for the purpose of my calculations.
> It might however be worth adding a comment near the data_offset 
> definition along the lines of the comment used for the index_entries 
> field explaining when to expect this to contain something relevant.
> Let me know if my understanding is correct,
> Anyway thanks for clearing this up for me.

looking at avformat.h i suspect slightly that data_offset was intended
as a field just for av_seek_frame() and nt supposed to be read by the
user at all

a patch adding a corresponding comment would be welcome

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- 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/20081107/b5d5468d/attachment.pgp>

More information about the ffmpeg-devel mailing list