[MPlayer-cvslog] r32818 - in trunk: mplayer.c stream/cache2.c stream/cache2.h

reimar subversion at mplayerhq.hu
Wed Jan 26 22:48:15 CET 2011


Author: reimar
Date: Wed Jan 26 22:48:15 2011
New Revision: 32818

Log:
Convert cache_fill_status into a function so we always get the latest state,
not whatever it was after the last read.

Modified:
   trunk/mplayer.c
   trunk/stream/cache2.c
   trunk/stream/cache2.h

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Wed Jan 26 22:24:49 2011	(r32817)
+++ trunk/mplayer.c	Wed Jan 26 22:48:15 2011	(r32818)
@@ -1280,7 +1280,7 @@ static void print_status(float a_pos, fl
 #ifdef CONFIG_STREAM_CACHE
   // cache stats
   if (stream_cache_size > 0)
-    saddf(line, &pos, width, "%d%% ", cache_fill_status);
+    saddf(line, &pos, width, "%d%% ", cache_fill_status(mpctx->stream));
 #endif
 
   // other

Modified: trunk/stream/cache2.c
==============================================================================
--- trunk/stream/cache2.c	Wed Jan 26 22:24:49 2011	(r32817)
+++ trunk/stream/cache2.c	Wed Jan 26 22:48:15 2011	(r32818)
@@ -96,8 +96,6 @@ typedef struct {
 
 static int min_fill=0;
 
-int cache_fill_status=0;
-
 static void cache_wakeup(stream_t *s)
 {
 #if FORKED_CACHE
@@ -162,7 +160,6 @@ static int cache_read(cache_vars_t *s, u
     total+=len;
 
   }
-  cache_fill_status=(s->max_filepos-s->read_filepos)/(s->buffer_size / 100);
   return total;
 }
 
@@ -513,6 +510,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;

Modified: trunk/stream/cache2.h
==============================================================================
--- trunk/stream/cache2.h	Wed Jan 26 22:24:49 2011	(r32817)
+++ trunk/stream/cache2.h	Wed Jan 26 22:48:15 2011	(r32818)
@@ -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 */


More information about the MPlayer-cvslog mailing list