diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2009-03-14 15:51:46 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2009-03-14 15:51:46 +0000 |
commit | 32d885926dc6326865cd14bbe3e849f4d47f0db5 (patch) | |
tree | 7913695e9465e0403a72ce3ab506f1adc3c21fd6 | |
parent | c73d39965ec942e335fcbddcfc8a1c6dd6cab9ed (diff) | |
download | ffmpeg-32d885926dc6326865cd14bbe3e849f4d47f0db5.tar.gz |
add avformat_seek_file()
Originally committed as revision 17956 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/utils.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 43de101e39..9f7bc48d5e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1584,6 +1584,28 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f return av_seek_frame_generic(s, stream_index, timestamp, flags); } +int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) +{ + if(min_ts > ts || max_ts < ts) + return -1; + + av_read_frame_flush(s); + + if (s->iformat->read_seek2) + return s->iformat->read_seek2(s, stream_index, min_ts, ts, max_ts, flags); + + if(s->iformat->read_timestamp){ + //try to seek via read_timestamp() + } + + //Fallback to old API if new is not implemented but old is + //Note the old has somewat different sematics + if(s->iformat->read_seek || 1) + return av_seek_frame(s, stream_index, ts, ts - min_ts > (uint64_t)(max_ts - ts) ? AVSEEK_FLAG_BACKWARD : 0); + + // try some generic seek like av_seek_frame_generic() but with new ts semantics +} + /*******************************************************/ /** |