summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-02 22:55:42 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-02 23:02:33 +0100
commitaa86d2d8846155ccdbb6f8824294a548fe42dfc2 (patch)
treeff92465183cf187cf46394b2ecfde05b773b8d10 /libavformat/utils.c
parentfc86f863536b711a443f981d45913172190c8030 (diff)
lavf: move stream==-1 handling from ff_subtitles_queue_seek() to avformat_seek_file()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index c5eb36f105..cbf32638c3 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2086,6 +2086,18 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int
if (s->iformat->read_seek2) {
int ret;
ff_read_frame_flush(s);
+
+ if (stream_index == -1 && s->nb_streams == 1) {
+ AVRational time_base = s->streams[0]->time_base;
+ ts = av_rescale_q(ts, AV_TIME_BASE_Q, time_base);
+ min_ts = av_rescale_rnd(min_ts, time_base.den,
+ time_base.num * (int64_t)AV_TIME_BASE,
+ AV_ROUND_UP);
+ max_ts = av_rescale_rnd(max_ts, time_base.den,
+ time_base.num * (int64_t)AV_TIME_BASE,
+ AV_ROUND_DOWN);
+ }
+
ret = s->iformat->read_seek2(s, stream_index, min_ts, ts, max_ts, flags);
if (ret >= 0)