From b4fb71634cf746cfd9ba19c1260dbc0aee38700e Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 27 Feb 2014 00:57:41 +0100 Subject: command: format volume property as integer for OSD The value range is 0-100, so fractional values don't make much sense. But the underlying data type is probably float to avoid getting "stuck" when doing small volume increments. So step this around and pretend it's an integer just on display. --- player/command.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index feaf4788d2..7712a6e550 100644 --- a/player/command.c +++ b/player/command.c @@ -916,6 +916,12 @@ static int mp_property_volume(m_option_t *prop, int action, void *arg, case M_PROPERTY_GET: mixer_getbothvolume(mpctx->mixer, arg); return M_PROPERTY_OK; + case M_PROPERTY_PRINT: { + float val; + mixer_getbothvolume(mpctx->mixer, &val); + *(char **)arg = talloc_asprintf(NULL, "%i", (int)val); + return M_PROPERTY_OK; + } case M_PROPERTY_SET: if (!mixer_audio_initialized(mpctx->mixer)) return M_PROPERTY_ERROR; -- cgit v1.2.3