summaryrefslogtreecommitdiffstats
path: root/player/osd.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-08-31 12:48:36 +0200
committerwm4 <wm4@nowhere>2018-08-31 12:55:22 +0200
commit559a400ac36e75a8d73ba263fd7fa6736df1c2da (patch)
tree5e117d0ddfd279cae346fc334d4c3f9262509fef /player/osd.c
parent5f83b6a5f5939ce39af929f200b1ea236fbe350c (diff)
downloadmpv-559a400ac36e75a8d73ba263fd7fa6736df1c2da.tar.bz2
mpv-559a400ac36e75a8d73ba263fd7fa6736df1c2da.tar.xz
demux, stream: rip out the classic stream cache
The demuxer cache is the only cache now. Might need another change to combat seeking failures in mp4 etc. The only bad thing is the loss of cache-speed, which was sort of nice to have.
Diffstat (limited to 'player/osd.c')
-rw-r--r--player/osd.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/player/osd.c b/player/osd.c
index 9faf6eb6a5..7d24c01619 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -229,27 +229,23 @@ static char *get_term_status_msg(struct MPContext *mpctx)
}
}
- if (mpctx->demuxer) {
- struct stream_cache_info info = {0};
- demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_CACHE_INFO, &info);
- if (info.size > 0 || mpctx->demuxer->is_network) {
- saddf(&line, " Cache: ");
+ if (mpctx->demuxer && demux_is_network_cached(mpctx->demuxer)) {
+ saddf(&line, " Cache: ");
- struct demux_ctrl_reader_state s = {.ts_duration = -1};
- demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_READER_STATE, &s);
+ 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, "???");
+ if (s.ts_duration < 0) {
+ saddf(&line, "???");
+ } else {
+ saddf(&line, "%2ds", (int)s.ts_duration);
+ }
+ int64_t cache_size = s.fw_bytes;
+ if (cache_size > 0) {
+ if (cache_size >= 1024 * 1024) {
+ saddf(&line, "+%lldMB", (long long)(cache_size / 1024 / 1024));
} else {
- saddf(&line, "%2ds", (int)s.ts_duration);
- }
- int64_t cache_size = s.fw_bytes + info.fill;
- if (cache_size > 0) {
- if (cache_size >= 1024 * 1024) {
- saddf(&line, "+%lldMB", (long long)(cache_size / 1024 / 1024));
- } else {
- saddf(&line, "+%lldKB", (long long)(cache_size / 1024));
- }
+ saddf(&line, "+%lldKB", (long long)(cache_size / 1024));
}
}
}