[FFmpeg-devel] [PATCH 2/2] lavf/id3v2: seek back to previous offset if header size is not matched

Michael Niedermayer michaelni at gmx.at
Sun Jan 20 05:01:18 CET 2013


On Sat, Jan 19, 2013 at 03:24:44PM +0100, Matthieu Bouron wrote:
> On Sat, Jan 19, 2013 at 03:22:49PM +0100, Matthieu Bouron wrote:
> > On Sat, Jan 19, 2013 at 02:41:00PM +0100, Michael Niedermayer wrote:
> > > On Sat, Jan 19, 2013 at 01:38:27PM +0100, Matthieu Bouron wrote:
> > > > ---
> > > >  libavformat/id3v2.c | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
> > > > index 98f8f9e..2cab5ac 100644
> > > > --- a/libavformat/id3v2.c
> > > > +++ b/libavformat/id3v2.c
> > > > @@ -788,8 +788,10 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra
> > > >          /* save the current offset in case there's nothing to read/skip */
> > > >          off = avio_tell(s->pb);
> > > >          ret = avio_read(s->pb, buf, ID3v2_HEADER_SIZE);
> > > > -        if (ret != ID3v2_HEADER_SIZE)
> > > > +        if (ret != ID3v2_HEADER_SIZE) {
> > > > +            avio_seek(s->pb, off, SEEK_SET);
> > > >              break;
> > > > +        }
> > > 
> > > the change looks fine but please explain (also in the commit message)
> > > why this change is done
> > > 
> > 
> > New patch attached including commit description.
> > 
> > [...]

>  id3v2.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 1b7d6e7452c55cf9f2bfbcc5879a31150008c6f4  0002-lavf-id3v2-seek-back-to-previous-offset-if-header-si.patch
> From 14f743ce5c4847e78e99d8e60f81b015c999a94c Mon Sep 17 00:00:00 2001
> From: Matthieu Bouron <matthieu.bouron at gmail.com>
> Date: Sat, 19 Jan 2013 13:32:58 +0100
> Subject: [PATCH 2/2] lavf/id3v2: seek back to previous offset if header size
>  is not matched
> 
> Makes ff_id3v2_read reset stream position at the end of ID3 data if the
> header size is not matched (caused by an EOF for example).
> 
> Current behaviour (without the patch):
>     filesize = 400
>     id3 data size = 399
>     file offset after ff_id3v2_read is 400 instead of 399

applied

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130120/40437828/attachment.asc>


More information about the ffmpeg-devel mailing list