[MPlayer-dev-eng] [PATCH] demux_lavf.c: handling stream->start_pos != 0

Zuxy Meng zuxy.meng at gmail.com
Wed Feb 28 06:41:31 CET 2007


Hi,

lavf's url_seek assumes that a stream starts at position 0, while this
isn't always the case for mplayer. This patch takes start_pos into
consideration.

-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
-------------- next part --------------
Index: libmpdemux/demux_lavf.c
===================================================================
--- libmpdemux/demux_lavf.c	???????? 22373??
+++ libmpdemux/demux_lavf.c	????????????
@@ -134,7 +134,9 @@
         pos +=stream_tell(stream);
     else if(whence == SEEK_END)
         pos += stream->end_pos;
-    else if(whence != SEEK_SET)
+    else if(whence == SEEK_SET)
+        pos += stream->start_pos;
+    else
         return -1;
 
     if(pos<stream->end_pos && stream->eof)
@@ -142,7 +144,7 @@
     if(stream_seek(stream, pos)==0)
         return -1;
 
-    return pos;
+    return pos - stream->start_pos;
 }
 
 static int mp_close(URLContext *h){


More information about the MPlayer-dev-eng mailing list