summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-19 02:16:43 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-19 02:16:43 +0000
commit365248938e6cb0e5cd70e3566c5c58b07eb4e62b (patch)
treeff02a1ade375d6e894518546e040ed39caaec113
parentfbd38db24f20aa59ca012c6ef30cd936e7c19fc7 (diff)
downloadmpv-365248938e6cb0e5cd70e3566c5c58b07eb4e62b.tar.bz2
mpv-365248938e6cb0e5cd70e3566c5c58b07eb4e62b.tar.xz
pre-cache fixed
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3601 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libmpdemux/cache2.c7
-rw-r--r--libmpdemux/stream.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/libmpdemux/cache2.c b/libmpdemux/cache2.c
index 09170f8073..8e935a6c06 100644
--- a/libmpdemux/cache2.c
+++ b/libmpdemux/cache2.c
@@ -194,9 +194,8 @@ static void exit_sighandler(int x){
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 @@ void stream_enable_cache(stream_t *stream,int size,float prefill_init,float pref
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
diff --git a/libmpdemux/stream.h b/libmpdemux/stream.h
index 3af906337a..184444971b 100644
--- a/libmpdemux/stream.h
+++ b/libmpdemux/stream.h
@@ -42,7 +42,7 @@ typedef struct {
} 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)