summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-09-30 08:19:49 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-09-30 08:19:49 +0000
commit1ad332f8a57dd8a0b6c94a512738910e6866ca97 (patch)
treeb4caed3ce8873b66fd8c9aeb984f89404ae8c009 /libmpdemux
parent70cdf76c6a41131b06b9f724298285a935233893 (diff)
downloadmpv-1ad332f8a57dd8a0b6c94a512738910e6866ca97.tar.bz2
mpv-1ad332f8a57dd8a0b6c94a512738910e6866ca97.tar.xz
lavf: if seeking in the desired direction failed, also try in the opposite one,
otherwise we might end up at some random position (where lavf last ended up while trying to build the index). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29741 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_lavf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index 3ac0b6d489..4bff317b9b 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -617,7 +617,10 @@ static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, float audio
} else {
priv->last_pts += rel_seek_secs * AV_TIME_BASE;
}
- av_seek_frame(priv->avfc, -1, priv->last_pts, avsflags);
+ if (av_seek_frame(priv->avfc, -1, priv->last_pts, avsflags) < 0) {
+ avsflags ^= AVSEEK_FLAG_BACKWARD;
+ av_seek_frame(priv->avfc, -1, priv->last_pts, avsflags);
+ }
}
static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)