From ba3dab46397aa2f65f7678bce88d7bf08fdb6514 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 26 Jan 2011 21:48:15 +0000 Subject: terminal output: show cache fill changes in "PAUSED" message Convert cache_fill_status into a function so we always get the latest state, not whatever it was after the last read. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32818 b3059339-0415-0410-9bf9-f77b7e298cf2 Update PAUSED status line with cache fill status if it changed. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32819 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cache2.c | 11 ++++++++--- stream/cache2.h | 3 +-- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'stream') diff --git a/stream/cache2.c b/stream/cache2.c index 9e87670752..9e4bea35b4 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -95,8 +95,6 @@ typedef struct { static int min_fill=0; -int cache_fill_status=0; - static void cache_wakeup(stream_t *s) { #if FORKED_CACHE @@ -161,7 +159,6 @@ static int cache_read(cache_vars_t *s, unsigned char *buf, int size) total+=len; } - cache_fill_status=(s->max_filepos-s->read_filepos)/(s->buffer_size / 100); return total; } @@ -511,6 +508,14 @@ int cache_stream_fill_buffer(stream_t *s){ } +int cache_fill_status(stream_t *s) { + cache_vars_t *cv; + if (!s || !s->cache_data) + return -1; + cv = s->cache_data; + return (cv->max_filepos-cv->read_filepos)/(cv->buffer_size / 100); +} + int cache_stream_seek_long(stream_t *stream,off_t pos){ cache_vars_t* s; off_t newpos; diff --git a/stream/cache2.h b/stream/cache2.h index 2e6a4e0dbb..9c98193f0c 100644 --- a/stream/cache2.h +++ b/stream/cache2.h @@ -21,9 +21,8 @@ #include "stream.h" -extern int cache_fill_status; - void cache_uninit(stream_t *s); int cache_do_control(stream_t *stream, int cmd, void *arg); +int cache_fill_status(stream_t *s); #endif /* MPLAYER_CACHE2_H */ -- cgit v1.2.3