summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-11-10 16:43:09 +0100
committerwm4 <wm4@nowhere>2017-11-10 16:43:18 +0100
commit8e50dc1b4dda5d15ddf0b1cc28b907356b956512 (patch)
tree1a4b752cebef99ef578cf38e585dedb651b676dd
parent1b0dc7d169cc7ef3ef20727781b1e8fee5ca159f (diff)
downloadmpv-8e50dc1b4dda5d15ddf0b1cc28b907356b956512.tar.bz2
mpv-8e50dc1b4dda5d15ddf0b1cc28b907356b956512.tar.xz
demux: export demuxer cache sizes in bytes
Plus sort of document them, together with the already existing undocumented fields. (This is mostly for debugging, so use is discouraged.)
-rw-r--r--DOCS/man/input.rst21
-rw-r--r--demux/demux.c2
-rw-r--r--demux/demux.h2
-rw-r--r--player/command.c2
4 files changed, 27 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 2b3e2a3795..75cb9526c6 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1285,6 +1285,27 @@ Property list
"start" MPV_FORMAT_DOUBLE
"end" MPV_FORMAT_DOUBLE
+ Other fields (might be changed or removed in the future):
+
+ ``eof``
+ True if the reader thread has hit the end of the file.
+
+ ``underrun``
+ True if the reader thread could not satisfy a decoder's request for a
+ new packet.
+
+ ``idle``
+ True if the thread is currently not reading.
+
+ ``total-bytes``
+ Sum of packet bytes (plus some overhead estimation) of the entire packet
+ queue, including cached seekable ranges.
+
+ ``fw-bytes``
+ Sum of packet bytes (plus some overhead estimation) of the readahead
+ packet queue (packets between current decoder reader positions and
+ demuxer position).
+
``demuxer-via-network``
Returns ``yes`` if the stream demuxed via the main demuxer is most likely
played via network. What constitutes "network" is not always clear, might
diff --git a/demux/demux.c b/demux/demux.c
index b66ed9abbb..342eb7fb56 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -2639,6 +2639,8 @@ static int cached_demux_control(struct demux_internal *in, int cmd, void *arg)
.ts_reader = MP_NOPTS_VALUE,
.ts_end = MP_NOPTS_VALUE,
.ts_duration = -1,
+ .total_bytes = in->total_bytes,
+ .fw_bytes = in->fw_bytes,
};
bool any_packets = false;
for (int n = 0; n < in->num_streams; n++) {
diff --git a/demux/demux.h b/demux/demux.h
index 95e0f77c7c..9224ca3a98 100644
--- a/demux/demux.h
+++ b/demux/demux.h
@@ -51,6 +51,8 @@ struct demux_ctrl_reader_state {
double ts_duration;
double ts_reader; // approx. timerstamp of decoder position
double ts_end; // approx. timestamp of end of buffered range
+ int64_t total_bytes;
+ int64_t fw_bytes;
// Positions that can be seeked to without incurring the latency of a low
// level seek.
int num_seek_ranges;
diff --git a/player/command.c b/player/command.c
index c95f7e6054..807b2614a7 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1755,6 +1755,8 @@ static int mp_property_demuxer_cache_state(void *ctx, struct m_property *prop,
node_map_add_flag(r, "eof", s.eof);
node_map_add_flag(r, "underrun", s.underrun);
node_map_add_flag(r, "idle", s.idle);
+ node_map_add_int64(r, "total-bytes", s.total_bytes);
+ node_map_add_int64(r, "fw-bytes", s.fw_bytes);
return M_PROPERTY_OK;
}