[FFmpeg-devel] [PATCH] avformat/flacdec: support fast-seek
Ching-Yi Chan
chingyichan.tw at gmail.com
Sun Oct 4 07:50:45 CEST 2015
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avformat-flacdec-support-fast-seek.patch
Type: application/octet-stream
Size: 4240 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151004/adf1f159/attachment.obj>
More information about the ffmpeg-devel
mailing list