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.
This commit is contained in:
wm4 2014-02-27 00:57:41 +01:00
parent 8a51a6b79c
commit b4fb71634c
1 changed files with 6 additions and 0 deletions

View File

@ -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;