changeset 3600:3094e7b6a15b

pre-cache fixed
author arpi
date Wed, 19 Dec 2001 02:16:43 +0000
parents 2141db140d84
children 5c3d0fe444fb
files libmpdemux/cache2.c libmpdemux/stream.h
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/cache2.c	Wed Dec 19 01:59:25 2001 +0000
+++ b/libmpdemux/cache2.c	Wed Dec 19 02:16:43 2001 +0000
@@ -194,9 +194,8 @@
   exit(0);
 }
 
-void stream_enable_cache(stream_t *stream,int size,float prefill_init,float prefill){
+void stream_enable_cache(stream_t *stream,int size,int min,int prefill){
   int ss=(stream->type==STREAMTYPE_VCD)?VCD_SECTOR_DATA:STREAM_BUFFER_SIZE;
-  int min=prefill_init*size;
   cache_vars_t* s=cache_init(size,ss);
   stream->cache_data=s;
   s->stream=stream; // callback
@@ -204,9 +203,11 @@
   
   if((stream->cache_pid=fork())){
     // wait until cache is filled at least prefill_init %
+    printf("CACHE_PRE_INIT: %d [%d] %d  pre:%d  eof:%d  \n",
+	s->min_filepos,s->read_filepos,s->max_filepos,min,s->eof);
     while(s->read_filepos<s->min_filepos || s->max_filepos-s->read_filepos<min){
 	mp_msg(MSGT_CACHE,MSGL_STATUS,"\rCache fill: %5.2f%% (%d bytes)    ",
-	    (float)(s->max_filepos-s->read_filepos)/(float)(s->buffer_size),
+	    100.0*(float)(s->max_filepos-s->read_filepos)/(float)(s->buffer_size),
 	    s->max_filepos-s->read_filepos
 	);
 	if(s->eof) break; // file is smaller than prefill size
--- a/libmpdemux/stream.h	Wed Dec 19 01:59:25 2001 +0000
+++ b/libmpdemux/stream.h	Wed Dec 19 02:16:43 2001 +0000
@@ -42,7 +42,7 @@
 } stream_t;
 
 #ifdef USE_STREAM_CACHE
-void stream_enable_cache(stream_t *stream,int size,float prefill_init,float prefill);
+void stream_enable_cache(stream_t *stream,int size,int min,int prefill);
 #else
 // no cache
 #define cache_stream_fill_buffer(x) stream_fill_buffer(x)