summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-09-01 13:04:45 +0200
committerAnton Kindestam <antonki@kth.se>2018-12-06 10:30:41 +0100
commit4dfaa373846e79f1bc34b50426c1584b948c0eb6 (patch)
tree145bc5c7d1ae9e23efc431f29234e29c148de5e4 /player
parentb1ba7de34dd5685a082454817f23509d1c28e4aa (diff)
downloadmpv-4dfaa373846e79f1bc34b50426c1584b948c0eb6.tar.bz2
mpv-4dfaa373846e79f1bc34b50426c1584b948c0eb6.tar.xz
demux, stream: readd cache-speed in some other form
it's more like an input speed rather than a cache speed, but who cares.
Diffstat (limited to 'player')
-rw-r--r--player/command.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 30629eae54..4d0fbefc34 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1559,6 +1559,26 @@ static int mp_property_playback_abort(void *ctx, struct m_property *prop,
return m_property_flag_ro(action, arg, !mpctx->playing || mpctx->stop_play);
}
+static int mp_property_cache_speed(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ if (!mpctx->demuxer)
+ return M_PROPERTY_UNAVAILABLE;
+
+ struct demux_ctrl_reader_state s;
+ if (demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_READER_STATE, &s) < 1)
+ return M_PROPERTY_UNAVAILABLE;
+
+ uint64_t val = s.bytes_per_second;
+
+ if (action == M_PROPERTY_PRINT) {
+ *(char **)arg = talloc_strdup_append(format_file_size(val), "/s");
+ return M_PROPERTY_OK;
+ }
+ return m_property_int64_ro(action, arg, val);
+}
+
static int mp_property_demuxer_cache_duration(void *ctx, struct m_property *prop,
int action, void *arg)
{
@@ -3771,6 +3791,7 @@ static const struct m_property mp_properties_base[] = {
{"eof-reached", mp_property_eof_reached},
{"seeking", mp_property_seeking},
{"playback-abort", mp_property_playback_abort},
+ {"cache-speed", mp_property_cache_speed},
{"demuxer-cache-duration", mp_property_demuxer_cache_duration},
{"demuxer-cache-time", mp_property_demuxer_cache_time},
{"demuxer-cache-idle", mp_property_demuxer_cache_idle},