[FFmpeg-devel] [PATCH] skip padding at the end of id3 tags

Jai Menon jmenon86
Wed Oct 14 04:01:15 CEST 2009


On Tue, Oct 13, 2009 at 10:03:28PM +0200, Michael Niedermayer wrote:
> On Mon, Oct 12, 2009 at 09:27:47PM +0000, Jai Menon wrote:
> > Hi,
> > 
> > I think the recent id3 tag parsing changes led to a regression as in
> > subject. Attached patch fixes this.

[...]

> > diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
> > index 88472e7..b3364f5 100644
> > --- a/libavformat/id3v2.c
> > +++ b/libavformat/id3v2.c
> > @@ -213,7 +213,10 @@ void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
> >  
> >          if (tag[0] == 'T')
> >              read_ttag(s, tlen, tag);
> > -
> > +        else if (!tag[0]) {
> 
> the old code checked all of tag, this checks just the first byte
> why?

Well, after a look at the spec [1], it seems that if a valid frame is
present, then the frame id consists of [A-Z0-9]. So I assumed that a 0
would mean that we have run out of frames to process. I can change it
to the earlier variant if you wish.

[1] http://www.id3.org/id3v2.4.0-structure

-- 
Jai Menon




More information about the ffmpeg-devel mailing list