summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-21 18:14:24 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-21 18:14:24 +0000
commitd93feb4dc10dee541c1089ce8e989134841757e0 (patch)
tree92b80ab402cfcd0976f862eca220c330d78c5531 /libmpdemux
parent52ad3e1c73ca63a9afc67ffd11e961c5d88724ce (diff)
downloadmpv-d93feb4dc10dee541c1089ce8e989134841757e0.tar.bz2
mpv-d93feb4dc10dee541c1089ce8e989134841757e0.tar.xz
EOF bug fixed
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2349 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/cache2.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libmpdemux/cache2.c b/libmpdemux/cache2.c
index 636aedf335..16f813ef9e 100644
--- a/libmpdemux/cache2.c
+++ b/libmpdemux/cache2.c
@@ -37,6 +37,7 @@ typedef struct {
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 @@ int cache_read(cache_vars_t* s,unsigned char* buf,int size){
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 @@ int cache_fill(cache_vars_t* s){
//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){