[FFmpeg-devel] [PATCH] Handle ID3v1 tag while decoding mp[123] frames

Clément Bœsch ubitux
Sat Jan 8 00:58:55 CET 2011


On Fri, Jan 07, 2011 at 03:41:18AM +0100, Michael Niedermayer wrote:
> On Fri, Jan 07, 2011 at 02:40:14AM +0100, Cl?ment B?sch wrote:
> > [...]
> >  mpegaudiodec.c |    9 +++++++++
> >  1 file changed, 9 insertions(+)
> > a91239b090f15a3761ab97fe3ff121d4e991cd0c  0001-Handle-ID3v1-tag-while-decoding-mp-123-frames.patch
> > From 6b291325a850f098568afcac915aeed11a2cc219 Mon Sep 17 00:00:00 2001
> > From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <ubitux at gmail.com>
> > Date: Fri, 7 Jan 2011 02:27:25 +0100
> > Subject: [PATCH] Handle ID3v1 tag while decoding mp[123] frames
> > 
> > ---
> >  libavcodec/mpegaudiodec.c |    9 +++++++++
> >  1 files changed, 9 insertions(+), 0 deletions(-)
> > 
> > diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
> > index 769be89..fe84214 100644
> > --- a/libavcodec/mpegaudiodec.c
> > +++ b/libavcodec/mpegaudiodec.c
> > @@ -27,6 +27,7 @@
> >  #include "avcodec.h"
> >  #include "get_bits.h"
> >  #include "dsputil.h"
> > +#include "libavformat/id3v1.h"
> >  
> >  /*
> >   * TODO:
> > @@ -2043,6 +2044,14 @@ static int decode_frame(AVCodecContext * avctx,
> >  
> >      header = AV_RB32(buf);
> >      if(ff_mpa_check_header(header) < 0){
> > +
> > +        if (buf_size == ID3v1_TAG_SIZE
> > +            && buf[0] == 'T' && buf[1] == 'A' && buf[2] == 'G') {
> 
> > +            avpkt->data += ID3v1_TAG_SIZE;
> > +            avpkt->size = 0;
> 
> These 2 look wrong, decoders are not supposed to change them
> 

Ok, this version may be better then.

Btw, I forgot to mentioned in my last mail this also fixed the annoying
"Header missing" error on every mp3 with a id3v1 tag at the end of the
file.

-- 
Cl?ment B.



More information about the ffmpeg-devel mailing list