diff options
author | Leonardo Boss <leonardoboss2001@gmail.com> | 2024-02-22 14:14:53 -0300 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2024-02-25 23:57:35 +0000 |
commit | 58ed620c064971535e60778612777750aa5e2f4d (patch) | |
tree | a943bc1cc70f1cd9cdf922639808541a468991a9 /player/command.c | |
parent | 2872e23aea5cca8d30d33b3cea897dd1cfd94d05 (diff) | |
download | mpv-58ed620c064971535e60778612777750aa5e2f4d.tar.bz2 mpv-58ed620c064971535e60778612777750aa5e2f4d.tar.xz |
player: add ao-volume option, to set the system volume at startup
closes #12353
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/player/command.c b/player/command.c index a286dc2d4a..3eecdd3915 100644 --- a/player/command.c +++ b/player/command.c @@ -1669,12 +1669,6 @@ static int mp_property_ao_volume(void *ctx, struct m_property *prop, return M_PROPERTY_NOT_IMPLEMENTED; switch (action) { - case M_PROPERTY_SET: { - float vol = *(float *)arg; - if (ao_control(ao, AOCONTROL_SET_VOLUME, &vol) != CONTROL_OK) - return M_PROPERTY_UNAVAILABLE; - return M_PROPERTY_OK; - } case M_PROPERTY_GET: { if (ao_control(ao, AOCONTROL_GET_VOLUME, arg) != CONTROL_OK) return M_PROPERTY_UNAVAILABLE; @@ -3935,7 +3929,7 @@ static const struct m_property mp_properties_base[] = { {"mixer-active", mp_property_mixer_active}, {"volume", mp_property_volume}, {"volume-gain", mp_property_volume_gain}, - {"ao-volume", mp_property_ao_volume}, + {"current-ao-volume", mp_property_ao_volume}, {"ao-mute", mp_property_ao_mute}, {"audio-delay", mp_property_audio_delay}, {"audio-codec-name", mp_property_audio_codec_name}, @@ -4286,8 +4280,8 @@ static const struct property_osd_display { {"volume-gain", "Volume gain", .msg = "Volume gain: ${?volume-gain:${volume-gain} dB ${?mute==yes:(Muted)}}${!volume-gain:${volume-gain}}", .osd_progbar = OSD_VOLUME, .marker = 0}, - {"ao-volume", "AO Volume", - .msg = "AO Volume: ${?ao-volume:${ao-volume}% ${?ao-mute==yes:(Muted)}}${!ao-volume:${ao-volume}}", + {"current-ao-volume", "AO Volume", + .msg = "AO Volume: ${?current-ao-volume:${current-ao-volume}% ${?ao-mute==yes:(Muted)}}${!current-ao-volume:${currene-ao-volume}}", .osd_progbar = OSD_VOLUME, .marker = 100}, {"mute", "Mute"}, {"ao-mute", "AO Mute"}, @@ -7198,6 +7192,9 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags, mp_wakeup_core(mpctx); } + if (opt_ptr == &opts->ao_volume) + audio_update_ao_volume(mpctx); + if (flags & UPDATE_HWDEC) { struct track *track = mpctx->current_track[0][STREAM_VIDEO]; struct mp_decoder_wrapper *dec = track ? track->dec : NULL; |