[FFmpeg-devel] [PATCH] id3v2 unsynchronisation support

Alexander Kojevnikov alexander
Sat Jul 24 07:54:18 CEST 2010


Reimar, thanks for reviewing my patch!

On 22 July 2010 03:23, Reimar D?ffinger <Reimar.Doeffinger at gmx.de> wrote:
>> Index: libavformat/id3v2.c
>> ===================================================================
>> --- libavformat/id3v2.c ? ? ? (revision 24278)
>> +++ libavformat/id3v2.c ? ? ? (working copy)
>> @@ -77,13 +77,41 @@
>> ? ? ?return v;
>> ?}
>>
>> -static void read_ttag(AVFormatContext *s, int taglen, const char *key)
>> +static int get_byte_resync (ByteIOContext *s, int prev, int *len)
>> ?{
>> + ? ?int val;
>> +
>> + ? ?if (--*len < 0)
>> + ? ? ? ?return 0;
>> + ? ?val = get_byte (s);
>> + ? ?if (prev == 0xff && !val) {
>> + ? ? ? ?if (--*len < 0)
>> + ? ? ? ? ? ?return 0;
>> + ? ? ? ?val = get_byte (s);
>> + ? ?}
>> + ? ?return val;
>> +}
>
> I think instead a peek_byte function should be added that returns
> the next byte, eliminating the need to keep a state here.

I added peek_byte function (first patch) and updated id3v2.c to use it
(second patch).

> I think there should be some more ways to simplify this,
> it seems too much code for what it does...

Unfortunately I don't see how this chunk can be simplified, it already
looks pretty straightforward to me.

Cheers,
Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-aviobuf-add-peek_byte.patch
Type: text/x-patch
Size: 1370 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100724/e1270f74/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-id3v2-unsynchronisation-support.patch
Type: text/x-patch
Size: 5265 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100724/e1270f74/attachment-0001.bin>



More information about the ffmpeg-devel mailing list