summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-04-03 13:20:21 +0200
committerwm4 <wm4@nowhere>2020-04-03 13:20:21 +0200
commit28edf2d0f0af74e2078cebbeda0441d6f91c9e60 (patch)
tree8982cd5ff3f5edc86db31d47aa02aa732112aee3
parenteeb711f5f3e6222a890ea61b0294a10d8270b85b (diff)
downloadmpv-28edf2d0f0af74e2078cebbeda0441d6f91c9e60.tar.bz2
mpv-28edf2d0f0af74e2078cebbeda0441d6f91c9e60.tar.xz
command: make input speed available as part of cache statge property
That's where it comes from after all. The other property does not have much of a reason to exist anymore, but there's no real reason to remove it either.
-rw-r--r--DOCS/man/input.rst7
-rw-r--r--player/command.c2
2 files changed, 9 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 9bf4701e2f..958b7a4241 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1988,6 +1988,8 @@ Property list
This gives the number bytes per seconds over a 1 second window (using
the type ``MPV_FORMAT_INT64`` for the client API).
+ This is the same as ``demuxer-cache-state/raw-input-rate``.
+
``demuxer-cache-duration``
Approximate duration of video buffered in the demuxer, in seconds. The
guess is very unreliable, and often the property will not be available
@@ -2035,6 +2037,10 @@ Property list
``cache-duration`` is ``demuxer-cache-duration``. Missing if unavailable.
+ ``raw-input-rate`` is the estimated input rate of the network layer (or any
+ other byte-oriented input layer) in bytes per second. May be inaccurate or
+ missing.
+
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:
@@ -2051,6 +2057,7 @@ Property list
"fw-bytes" MPV_FORMAT_INT64
"file-cache-bytes" MPV_FORMAT_INT64
"cache-duration" MPV_FORMAT_DOUBLE
+ "raw-input-rate" MPV_FORMAT_INT64
Other fields (might be changed or removed in the future):
diff --git a/player/command.c b/player/command.c
index bd31708318..e1f755d46c 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1441,6 +1441,8 @@ static int mp_property_demuxer_cache_state(void *ctx, struct m_property *prop,
node_map_add_int64(r, "fw-bytes", s.fw_bytes);
if (s.file_cache_bytes >= 0)
node_map_add_int64(r, "file-cache-bytes", s.file_cache_bytes);
+ if (s.bytes_per_second > 0)
+ node_map_add_int64(r, "raw-input-rate", s.bytes_per_second);
if (s.seeking != MP_NOPTS_VALUE)
node_map_add_double(r, "debug-seeking", s.seeking);
node_map_add_int64(r, "debug-low-level-seeks", s.low_level_seeks);