@@ -1617,7 +1617,7 @@ static int mp_property_ao_volume(void *ctx, struct m_property *prop,
1617
1617
MPContext * mpctx = ctx ;
1618
1618
struct ao * ao = mpctx -> ao ;
1619
1619
if (!ao )
1620
- return M_PROPERTY_NOT_IMPLEMENTED ;
1620
+ return M_PROPERTY_UNAVAILABLE ;
1621
1621
1622
1622
switch (action ) {
1623
1623
case M_PROPERTY_SET : {
@@ -1660,7 +1660,7 @@ static int mp_property_ao_mute(void *ctx, struct m_property *prop,
1660
1660
MPContext * mpctx = ctx ;
1661
1661
struct ao * ao = mpctx -> ao ;
1662
1662
if (!ao )
1663
- return M_PROPERTY_NOT_IMPLEMENTED ;
1663
+ return M_PROPERTY_UNAVAILABLE ;
1664
1664
1665
1665
switch (action ) {
1666
1666
case M_PROPERTY_SET : {
@@ -1683,6 +1683,25 @@ static int mp_property_ao_mute(void *ctx, struct m_property *prop,
1683
1683
return M_PROPERTY_NOT_IMPLEMENTED ;
1684
1684
}
1685
1685
1686
+ static int mp_property_user_volume (void * ctx , struct m_property * prop ,
1687
+ int action , void * arg )
1688
+ {
1689
+ MPContext * mpctx = ctx ;
1690
+ struct ao * ao = mpctx -> ao ;
1691
+ if (!ao )
1692
+ return M_PROPERTY_UNAVAILABLE ;
1693
+
1694
+ bool softvol ;
1695
+ switch (mpctx -> opts -> softvol ) {
1696
+ case SOFTVOL_NO : softvol = false; break ;
1697
+ case SOFTVOL_YES : softvol = true; break ;
1698
+ default :
1699
+ softvol = ao_control (ao , AOCONTROL_HAS_PER_APP_VOLUME , NULL ) != CONTROL_OK ;
1700
+ }
1701
+
1702
+ return mp_property_do (softvol ? "volume" : "ao-volume" , action , arg , ctx );
1703
+ }
1704
+
1686
1705
static int get_device_entry (int item , int action , void * arg , void * ctx )
1687
1706
{
1688
1707
struct ao_device_list * list = ctx ;
@@ -3702,6 +3721,7 @@ static const struct m_property mp_properties[] = {
3702
3721
{"mute" , mp_property_mute },
3703
3722
{"ao-volume" , mp_property_ao_volume },
3704
3723
{"ao-mute" , mp_property_ao_mute },
3724
+ {"user-volume" , mp_property_user_volume },
3705
3725
{"audio-delay" , mp_property_audio_delay },
3706
3726
{"audio-codec-name" , mp_property_audio_codec_name },
3707
3727
{"audio-codec" , mp_property_audio_codec },
@@ -3888,7 +3908,7 @@ static const char *const *const mp_event_property_change[] = {
3888
3908
"colormatrix-output-range" , "colormatrix-primaries" , "video-aspect" ),
3889
3909
E (MPV_EVENT_AUDIO_RECONFIG , "audio-format" , "audio-codec" , "audio-bitrate" ,
3890
3910
"samplerate" , "channels" , "audio" , "volume" , "mute" , "balance" ,
3891
- "current-ao" , "audio-codec-name" , "audio-params" ,
3911
+ "current-ao" , "audio-codec-name" , "audio-params" , "user-volume" ,
3892
3912
"audio-out-params" , "volume-max" , "mixer-active" ),
3893
3913
E (MPV_EVENT_SEEK , "seeking" , "core-idle" , "eof-reached" ),
3894
3914
E (MPV_EVENT_PLAYBACK_RESTART , "seeking" , "core-idle" , "eof-reached" ),
@@ -4050,11 +4070,14 @@ static const struct property_osd_display {
4050
4070
{ "clock" , "Clock" },
4051
4071
// audio
4052
4072
{ "volume" , "Volume" ,
4053
- .msg = "Volume : ${?volume:${volume}% ${?mute==yes:(Muted)}}${!volume:${volume}}" ,
4073
+ .msg = "Internal volume : ${?volume:${volume}% ${?mute==yes:(Muted)}}${!volume:${volume}}" ,
4054
4074
.osd_progbar = OSD_VOLUME },
4055
4075
{ "ao-volume" , "AO Volume" ,
4056
4076
.msg = "AO Volume: ${?ao-volume:${ao-volume}% ${?ao-mute==yes:(Muted)}}${!ao-volume:${ao-volume}}" ,
4057
4077
.osd_progbar = OSD_VOLUME },
4078
+ { "user-volume" , "Volume" ,
4079
+ .msg = "Volume: ${?user-volume:${user-volume}% ${?mute==yes:(Muted)}}${!user-volume:${user-volume}}" ,
4080
+ .osd_progbar = OSD_VOLUME },
4058
4081
{ "mute" , "Mute" },
4059
4082
{ "ao-mute" , "AO Mute" },
4060
4083
{ "audio-delay" , "A-V delay" },
0 commit comments