[FFmpeg-devel] [PATCH] fixes in mpeg audio parsing
Yoav Steinberg
yoav
Thu Nov 13 08:29:36 CET 2008
Michael Niedermayer wrote:
> On Wed, Nov 12, 2008 at 07:02:55PM +0200, Yoav Steinberg wrote:
>> Hi,
>> Attached are patches witch make some improvements for mp3 parsing.
>> skip_vbrtag_and_id3v1.patch:
>
>> - When file contains ID3v1 tag at the end don't attempt to read it as part
>> of a packet. In some cases there are mp3 files where the ID3v1 tag was
>> stuck forcefully at the end of the file inside the last frame boundary. In
>> those cases the patch eliminates attempts to parse/decode the ID3 tag.
>> - If we find a VBR tag at the beginning of the file don't attempt to parse
>> it as a valid frame.
>
> These are 2 seperate things which must be in seperate patches.
Here is a single patch for avoiding parsing of VBR tag information frames.
>
>> @@ -439,8 +446,14 @@
>> }
>>
>> if(frames < 0)
>> + {
>> + url_fseek(s->pb, base, SEEK_SET);
>> return;
>> + }
>
> the brace placement is inconsistant relative to the existing
oops, fixed.
>
>
>>
>> + /* Skip the vbr tag frame */
>> + url_fseek(s->pb, base + vbrtag_size, SEEK_SET);
>> +
>> spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */
>> st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate},
>> st->time_base);
>
>> @@ -452,7 +465,6 @@
>> AVStream *st;
>> uint8_t buf[ID3v1_TAG_SIZE];
>> int len, ret, filesize;
>> - int64_t off;
>>
>> st = av_new_stream(s, 0);
>> if (!st)
>> @@ -492,9 +504,7 @@
>> url_fseek(s->pb, 0, SEEK_SET);
>> }
>>
>> - off = url_ftell(s->pb);
>> - mp3_parse_vbr_tags(s, st, off);
>> - url_fseek(s->pb, off, SEEK_SET);
>> + mp3_parse_vbr_tags(s, st, url_ftell(s->pb));
>
> url_ftell() can be called in mp3_parse_vbr_tags()
Removed base param from mp3_parse_vbr_tags, now url_ftell is called from
within.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: skip_vbrtag_parse.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081113/71c3d710/attachment.asc>
More information about the ffmpeg-devel
mailing list