summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorUros Vampl <mobile.leecher@gmail.com>2016-07-10 12:50:58 +0200
committerwm4 <wm4@nowhere>2016-07-10 19:49:28 +0200
commitc5827387fd9a9c2986992b64382e6dad86f1eb6c (patch)
tree5027a0fb1d16efd18db0a0587e32a6cbf2e6b514 /player/command.c
parente518bf2c72fc862fbe1de1c98313a03fa0db2e98 (diff)
downloadmpv-c5827387fd9a9c2986992b64382e6dad86f1eb6c.tar.bz2
mpv-c5827387fd9a9c2986992b64382e6dad86f1eb6c.tar.xz
audio: show an osd bar when changing ao-volume
also, make the osd msg prettier
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/player/command.c b/player/command.c
index 3bca64bd5e..b44e12ab2d 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1635,8 +1635,20 @@ static int mp_property_ao_volume(void *ctx, struct m_property *prop,
return M_PROPERTY_OK;
}
case M_PROPERTY_GET_TYPE:
- *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_FLOAT};
+ *(struct m_option *)arg = (struct m_option){
+ .type = CONF_TYPE_FLOAT,
+ .flags = M_OPT_RANGE,
+ .min = 0,
+ .max = 100,
+ };
return M_PROPERTY_OK;
+ case M_PROPERTY_PRINT: {
+ ao_control_vol_t vol = {0};
+ if (ao_control(ao, AOCONTROL_GET_VOLUME, &vol) != CONTROL_OK)
+ return M_PROPERTY_UNAVAILABLE;
+ *(char **)arg = talloc_asprintf(NULL, "%.f", (vol.left + vol.right) / 2.0f);
+ return M_PROPERTY_OK;
+ }
}
return M_PROPERTY_NOT_IMPLEMENTED;
}
@@ -4051,7 +4063,11 @@ static const struct property_osd_display {
{ "volume", "Volume",
.msg = "Volume: ${?volume:${volume}% ${?mute==yes:(Muted)}}${!volume:${volume}}",
.osd_progbar = OSD_VOLUME },
+ { "ao-volume", "AO Volume",
+ .msg = "AO Volume: ${?ao-volume:${ao-volume}% ${?ao-mute==yes:(Muted)}}${!ao-volume:${ao-volume}}",
+ .osd_progbar = OSD_VOLUME },
{ "mute", "Mute" },
+ { "ao-mute", "AO Mute" },
{ "audio-delay", "A-V delay" },
{ "audio", "Audio" },
{ "balance", "Balance", .osd_progbar = OSD_BALANCE },