summaryrefslogtreecommitdiffstats
path: root/player/osd.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-27 22:42:28 +0200
committerwm4 <wm4@nowhere>2014-08-27 23:12:47 +0200
commitc7208319d3406fa5f3980a1155ae9b854ab7a232 (patch)
tree2ff4900ba4c394e74f68f3152eefc26028c056b1 /player/osd.c
parentdad90f616da5665e6e27a516f78c2a5fa66162c2 (diff)
downloadmpv-c7208319d3406fa5f3980a1155ae9b854ab7a232.tar.bz2
mpv-c7208319d3406fa5f3980a1155ae9b854ab7a232.tar.xz
player: better cache status on status line
The cache percentage was useless. It showed how much of the total stream cache was in use, but since the cache size is something huge and unrelated to the bitrate or network speed, the information content of the percentage was rather low. Replace this with printing the duration of the demuxer-cached data, and the size of the stream cache in KB. I'm not completely sure about the formatting; suggestions are welcome. Note that it's not easy to know how much playback time the stream cache covers, so it's always in bytes.
Diffstat (limited to 'player/osd.c')
-rw-r--r--player/osd.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/player/osd.c b/player/osd.c
index b7fb841485..08bf28dd85 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -37,6 +37,7 @@
#include "osdep/timer.h"
#include "demux/demux.h"
+#include "stream/stream.h"
#include "sub/osd.h"
#include "video/out/vo.h"
@@ -232,9 +233,23 @@ static void print_status(struct MPContext *mpctx)
}
}
- float cache = mp_get_cache_percent(mpctx);
- if (cache >= 0)
- saddf(&line, " Cache: %.2f%%", cache);
+ if (mpctx->demuxer) {
+ int64_t fill = -1;
+ demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_CACHE_FILL, &fill);
+ if (fill >= 0) {
+ saddf(&line, " Cache: ");
+
+ struct demux_ctrl_reader_state s = {.ts_duration = -1};
+ demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_READER_STATE, &s);
+
+ if (s.ts_duration < 0) {
+ saddf(&line, "???");
+ } else {
+ saddf(&line, "%2ds", (int)s.ts_duration);
+ }
+ saddf(&line, "+%lldKB", (long long)(fill / 1024));
+ }
+ }
if (opts->term_osd_bar) {
saddf(&line, "\n");