[Mplayer-cvslog] CVS: main/libmpdemux cache2.c,1.3,1.4

Arpi of Ize arpi at mplayer.dev.hu
Sun Oct 21 20:14:27 CEST 2001


Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv24046

Modified Files:
	cache2.c 
Log Message:
EOF bug fixed

Index: cache2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/cache2.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cache2.c	21 Oct 2001 00:32:47 -0000	1.3
+++ cache2.c	21 Oct 2001 18:14:24 -0000	1.4
@@ -37,6 +37,7 @@
   int min_filepos; // buffer contain only a part of the file, from min-max pos
   int max_filepos;
   int offset;      // filepos <-> bufferpos  offset value (filepos of the buffer's first byte)
+  int eof;
   // commands/locking:
   int cmd_lock;   // 1 if we will seek/reset buffer, 2 if we are ready for cmd
   int fifo_flag;  // 1 if we should use FIFO to notice cache about buffer reads.
@@ -67,6 +68,8 @@
     if(newb<min_fill) min_fill=newb; // statistics...
 
     if(newb<=0){
+	// eof?
+	if(s->eof) break;
 	// waiting for buffer fill...
 	usleep(10000); // 10ms
 	continue;
@@ -134,7 +137,8 @@
   //len=stream_fill_buffer(s->stream);
   //memcpy(&s->buffer[pos],s->stream->buffer,len); // avoid this extra copy!
   // ....
-  stream_read(s->stream,&s->buffer[pos],space); len=space;
+  len=stream_read(s->stream,&s->buffer[pos],space);
+  if(!len) s->eof=1;
   
   s->max_filepos+=len;
   if(pos+len>=s->buffer_size){




More information about the MPlayer-cvslog mailing list