[FFmpeg-devel] [PATCH] avformat/flacdec: support fast-seek

Michael Niedermayer michaelni at gmx.at
Sun Oct 4 13:33:36 CEST 2015


On Sun, Oct 04, 2015 at 01:50:45PM +0800, Ching-Yi Chan wrote:
> 2015-10-04 7:37 GMT+08:00 Michael Niedermayer <michaelni at gmx.at>:
> 
> > On Sat, Oct 03, 2015 at 01:14:26AM +0800, Ching-Yi Chan wrote:
> >
> > iam not sure changing the format flags is a great idea, i think no
> > other demuxer does that
> > that said, the documentation does not say that only the user can
> > change them so this is more a note that this looks a bit odd not that
> > it is wrong
> >
> > using a context to keep found_seektable state.
> 
> 
> > > +
> > > +    reset_index_position(avio_tell(s->pb), st);
> > >      return 0;
> > >
> > >  fail:
> > > @@ -249,12 +283,33 @@ static av_unused int64_t
> > flac_read_timestamp(AVFormatContext *s, int stream_inde
> > >      return pts;
> > >  }
> > >
> > > +static int flac_seek(AVFormatContext *s, int stream_index, int64_t
> > timestamp, int flags) {
> > > +    int index;
> > > +    int64_t pos;
> > > +    AVIndexEntry e;
> > > +    if (!(s->flags&AVFMT_FLAG_FAST_SEEK)) {
> > > +        return -1;
> > > +    }
> > > +
> > > +    index = av_index_search_timestamp(s->streams[0], timestamp, flags);
> > > +    if(index<0 || index >= s->streams[0]->nb_index_entries)
> > > +        return -1;
> > > +
> > > +    e = s->streams[0]->index_entries[index];
> > > +    pos = avio_seek(s->pb, e.pos, SEEK_SET);
> > > +    if (pos >= 0) {
> >
> > > +        return pos;
> >
> > if pos is larger than INT_MAX the this can overflow and be interpreted
> > as an error by the caller
> >
> >
> > fix it by returning 0

>  flacdec.c |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 59 insertions(+), 1 deletion(-)
> 99622a220e4bf069a4aa9e97836497aba54a8b7c  0001-avformat-flacdec-support-fast-seek.patch
> From f96510987c03418b06b8724b92be83d8bff69c6f Mon Sep 17 00:00:00 2001
> From: "Ching Yi, Chan" <chingyichan.tw at gmail.com>
> Date: Thu, 24 Sep 2015 13:04:40 +0800
> Subject: [PATCH] avformat/flacdec: support fast-seek

applied

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151004/bd8f0fa2/attachment.sig>


More information about the ffmpeg-devel mailing list