[MPlayer-dev-eng] [PATCH] set AVSEEK_FLAG_BACKWARD correctly in lavf demuxer

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Jan 26 22:45:09 CET 2008


Hello,
currently the condition for adding this flag is that the seek argument
is < 0 and we are not seeking by percent.
I think this makes no sense, and instead the condition should be
(relative seeking && argument < 0).
Do you agree with attached patch?

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/demux_lavf.c
===================================================================
--- libmpdemux/demux_lavf.c	(revision 25868)
+++ libmpdemux/demux_lavf.c	(working copy)
@@ -611,15 +611,16 @@
     int avsflags = 0;
     mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_seek_lavf(%p, %f, %f, %d)\n", demuxer, rel_seek_secs, audio_delay, flags);
 
-    if (flags & 1) // absolute seek
+    if (flags & 1) { // absolute seek
       priv->last_pts = priv->avfc->start_time;
+      if (rel_seek_secs < 0) avsflags = AVSEEK_FLAG_BACKWARD;
+    }
     if (flags & 2) { // percent seek
       if (priv->avfc->duration == 0 || priv->avfc->duration == AV_NOPTS_VALUE)
         return;
       priv->last_pts += rel_seek_secs * priv->avfc->duration;
     } else {
       priv->last_pts += rel_seek_secs * AV_TIME_BASE;
-      if (rel_seek_secs < 0) avsflags = AVSEEK_FLAG_BACKWARD;
     }
     av_seek_frame(priv->avfc, -1, priv->last_pts, avsflags);
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20080126/d5ba1a6c/attachment.pgp>


More information about the MPlayer-dev-eng mailing list