summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-03-22 22:29:15 +0100
committerwm4 <wm4@nowhere>2016-03-22 22:29:15 +0100
commitba4569cf702c72fd85e11abeb52ba06e860ed2ea (patch)
tree98600f7e719d92934dcca2392b84ec96cb67864d /player/command.c
parentfd3ae6c561e4e53c994eb802630fef00a2e0a18b (diff)
downloadmpv-ba4569cf702c72fd85e11abeb52ba06e860ed2ea.tar.bz2
mpv-ba4569cf702c72fd85e11abeb52ba06e860ed2ea.tar.xz
command: change "cache-speed" OSD formatting
Also change the property to an int, since using double is questionable and pointless.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/player/command.c b/player/command.c
index 9d8528571a..07b9128cc8 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1437,12 +1437,17 @@ static int mp_property_cache_speed(void *ctx, struct m_property *prop,
if (!mpctx->demuxer)
return M_PROPERTY_UNAVAILABLE;
- double speed = -1;
- demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_CACHE_SPEED, &speed);
- if (speed < 0)
+ double f_speed = -1;
+ demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_CACHE_SPEED, &f_speed);
+ if (f_speed < 0)
return M_PROPERTY_UNAVAILABLE;
+ int64_t speed = llrint(f_speed);
- return m_property_double_ro(action, arg, speed);
+ if (action == M_PROPERTY_PRINT) {
+ *(char **)arg = talloc_strdup_append(format_file_size(speed), "/s");
+ return M_PROPERTY_OK;
+ }
+ return m_property_int64_ro(action, arg, speed);
}
static int mp_property_cache_idle(void *ctx, struct m_property *prop,