[Mplayer-cvslog] CVS: main/libmpdemux demux_lavf.c,1.1,1.2

Michael Niedermayer CVS syncmail at mplayerhq.hu
Sun Apr 11 16:51:12 CEST 2004


CVS change done by Michael Niedermayer CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv2492

Modified Files:
	demux_lavf.c 
Log Message:
libavformat really doesnt like it that the streams get stuck if the end is reached


Index: demux_lavf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_lavf.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- demux_lavf.c	11 Apr 2004 14:26:04 -0000	1.1
+++ demux_lavf.c	11 Apr 2004 14:51:10 -0000	1.2
@@ -34,7 +34,6 @@
 #include "avi.h"
 
 #define PROBE_BUF_SIZE 2048
-//#define IO_BUFFER_SIZE 32768
 
 typedef struct lavf_priv_t{
     AVInputFormat *avif;
@@ -53,9 +52,15 @@
 
 static int mp_read(URLContext *h, unsigned char *buf, int size){
     stream_t *stream = (stream_t*)h->priv_data;
+    int ret;
+
     if(stream_eof(stream)) //needed?
         return -1;
-    return stream_read(stream, buf, size);
+    ret=stream_read(stream, buf, size);
+    if(ret>0)
+        stream->eof=0;
+    mp_msg(MSGT_HEADER,MSGL_DBG2,"%d=mp_read(%p, %p, %d), eof:%d\n", ret, h, buf, size, stream->eof);
+    return ret;
 }
 
 static int mp_write(URLContext *h, unsigned char *buf, int size){
@@ -64,7 +69,8 @@
 
 static offset_t mp_seek(URLContext *h, offset_t pos, int whence){
     stream_t *stream = (stream_t*)h->priv_data;
-mp_msg(MSGT_HEADER,MSGL_DBG2,"file_seek(%p, %d, %d)\n", h, (int)pos, whence);
+    
+    mp_msg(MSGT_HEADER,MSGL_DBG2,"mp_seek(%p, %d, %d)\n", h, (int)pos, whence);
     if(whence == SEEK_CUR)
         pos +=stream_tell(stream);
     else if(whence == SEEK_END)
@@ -74,6 +80,8 @@
 
     if(stream_seek(stream, pos)==0)
         return -1;
+    if(pos==stream->end_pos)
+        stream->eof=0;
     return pos;
 }
 




More information about the MPlayer-cvslog mailing list