Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2013-04-30 01:58:22 +0400
committerNicolas George <nicolas.george@normalesup.org>2013-05-04 16:11:53 +0400
commitcc24afb45cfda95eda91ae8dbdfaa26aa35acc36 (patch)
treec7c313c405db9f7f409ebe3d124b4009b707366f
parentd18341fb1121332056aecc00096159df16d01107 (diff)
lavf: call the new seek API from the old.
If the demuxer implements read_seek2() and not read_seek(), call avformat_seek_file() from av_seek_frame(). Allow to properly seek in formats that only implement the new API from applications that use the old one. Tested with mplayer and a concat script.
-rw-r--r--libavformat/utils.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 71246a9db2..29f4c1de62 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2135,7 +2135,19 @@ static int seek_frame_internal(AVFormatContext *s, int stream_index,
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
{
- int ret = seek_frame_internal(s, stream_index, timestamp, flags);
+ int ret;
+
+ if (s->iformat->read_seek2 && !s->iformat->read_seek) {
+ int64_t min_ts = INT64_MIN, max_ts = INT64_MAX;
+ if ((flags & AVSEEK_FLAG_BACKWARD))
+ max_ts = timestamp;
+ else
+ min_ts = timestamp;
+ return avformat_seek_file(s, stream_index, min_ts, timestamp, max_ts,
+ flags & ~AVSEEK_FLAG_BACKWARD);
+ }
+
+ ret = seek_frame_internal(s, stream_index, timestamp, flags);
if (ret >= 0)
ret = avformat_queue_attached_pictures(s);