[MPlayer-cvslog] r29741 - trunk/libmpdemux/demux_lavf.c

reimar subversion at mplayerhq.hu
Wed Sep 30 10:19:49 CEST 2009


Author: reimar
Date: Wed Sep 30 10:19:49 2009
New Revision: 29741

Log:
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).

Modified:
   trunk/libmpdemux/demux_lavf.c

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	Wed Sep 30 09:54:04 2009	(r29740)
+++ trunk/libmpdemux/demux_lavf.c	Wed Sep 30 10:19:49 2009	(r29741)
@@ -617,7 +617,10 @@ static void demux_seek_lavf(demuxer_t *d
     } 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)


More information about the MPlayer-cvslog mailing list