1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-22 14:52:43 +00:00

player: show demuxer cache buffered amount in bytes in the status line

I don't want to add another field to display stream and demuxer cache
separately, so just add them up. This strangely makes sense, since the
forward buffered stream cache amount consists of data not read by the
demuxer yet. (If the demuxer cache has buffered the full stream, the
forward buffered stream cache amount is 0.)
This commit is contained in:
wm4 2017-12-17 22:11:10 +01:00 committed by Stefano Pigozzi
parent a23a98f648
commit 822b247d10
3 changed files with 13 additions and 6 deletions

View File

@ -1273,6 +1273,9 @@ Property list
buffering amount, while the seek ranges represent the buffered data that
can actually be used for cached seeking.
``fw-bytes`` is the number of bytes of packets buffered in the range
starting from the current decoding position.
When querying the property with the client API using ``MPV_FORMAT_NODE``,
or with Lua ``mp.get_property_native``, this will return a mpv_node with
the following contents:
@ -1284,6 +1287,7 @@ Property list
MPV_FORMAT_NODE_MAP
"start" MPV_FORMAT_DOUBLE
"end" MPV_FORMAT_DOUBLE
"fw-bytes" MPV_FORMAT_INT64
Other fields (might be changed or removed in the future):

View File

@ -683,8 +683,10 @@ listed.
(``drop-frame-count`` property.)
- Cache state, e.g. ``Cache: 2s+134KB``. Visible if the stream cache is enabled.
The first value shows the amount of video buffered in the demuxer in seconds,
the second value shows *additional* data buffered in the stream cache in
kilobytes. (``demuxer-cache-duration`` and ``cache-used`` properties.)
the second value shows the sum of the demuxer forward cache size and the
*additional* data buffered in the stream cache in kilobytes.
(``demuxer-cache-duration``, ``demuxer-cache-state``, ``cache-used``
properties.)
PROTOCOLS

View File

@ -261,11 +261,12 @@ static void term_osd_print_status_lazy(struct MPContext *mpctx)
} else {
saddf(&line, "%2ds", (int)s.ts_duration);
}
if (info.size > 0) {
if (info.fill >= 1024 * 1024) {
saddf(&line, "+%lldMB", (long long)(info.fill / 1024 / 1024));
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)(info.fill / 1024));
saddf(&line, "+%lldKB", (long long)(cache_size / 1024));
}
}
}