1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
commit c5827387fd9a9c2986992b64382e6dad86f1eb6c
Author: Uros Vampl <mobile.leecher@gmail.com>
Date: Sun Jul 10 12:50:58 2016 +0200
audio: show an osd bar when changing ao-volume
also, make the osd msg prettier
diff --git a/player/command.c b/player/command.c
index 3bca64b..b44e12a 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 },
|