summaryrefslogtreecommitdiffstats
path: root/demux/demux.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 /demux/demux.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 'demux/demux.c')
-rw-r--r--demux/demux.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/demux/demux.c b/demux/demux.c
index c62c0754b8..94b230a6dc 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -1176,6 +1176,7 @@ static int cached_demux_control(struct demux_internal *in, int cmd, void *arg)
.eof = in->last_eof,
.idle = in->idle,
.ts_range = {MP_NOPTS_VALUE, MP_NOPTS_VALUE},
+ .ts_duration = -1,
};
for (int n = 0; n < in->d_user->num_streams; n++) {
struct demux_stream *ds = in->d_user->streams[n]->ds;
@@ -1186,6 +1187,8 @@ static int cached_demux_control(struct demux_internal *in, int cmd, void *arg)
}
}
r->idle = (r->idle && !r->underrun) || r->eof;
+ if (r->ts_range[0] != MP_NOPTS_VALUE && r->ts_range[1] != MP_NOPTS_VALUE)
+ r->ts_duration = r->ts_range[1] - r->ts_range[0];
return DEMUXER_CTRL_OK;
}
}