[FFmpeg-devel] [PATCH] MP3: ID3V2 corrupted => bad offset
Yvan Labadie
ylabadie
Fri Dec 5 13:41:32 CET 2008
Hi,
According to the ID3v2 standard, frame sizes are stored using 32bit
SynchSafe Integer format
(http://www.id3.org/id3v2.4.0-structure?highlight=%28SynchSafe%29).
That's why libavformat/mp3.c uses id3v2_get_size() function.
But I discovered that a lot of mp3 (about a fourth of my mp3s!) use
classic 32bit unsigned integer!!!
So with these mp3s ID3v2 parse fails and then
AVFormatContext->data_offset is invalid!
and having a bad data_offset can be very critical for some applications
(like mine 0:-) ).
For my patch, I use the ID3v2 size extracted from its header to deduce
the offset.
Then after parsing ID3 I seek to this offset and I made another check by
verifying that it corresponds to a mp3 frame sync, and if it doesn't I
look for the first frame sync and made it the offset.
if id3 tag is corrupted, result is :
data_offset is good (so mp3_parse_vbr_tags success)
tag parse still fail but if file doesn't respect standards, we cannot do
a lot...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_mp3.diff
Type: text/x-patch
Size: 1515 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081205/149f319e/attachment.bin>
More information about the ffmpeg-devel
mailing list