diff options
author | wm4 <wm4@mplayer2.org> | 2012-01-07 18:06:30 +0100 |
---|---|---|
committer | wm4 <wm4@mplayer2.org> | 2012-01-18 04:21:45 +0100 |
commit | b338b16be7fe902723fc9c5c20f88959264e67d7 (patch) | |
tree | 0fc7f4f90430e1a73a977f1932ea541244115725 /command.c | |
parent | 6afaf948cd80e348c4ff93f44baae362d4423793 (diff) | |
download | mpv-b338b16be7fe902723fc9c5c20f88959264e67d7.tar.bz2 mpv-b338b16be7fe902723fc9c5c20f88959264e67d7.tar.xz |
audio: reset mplayer's mute state when the system mixer volume changes
Before this commit, the mute state was only reset when either mute was
explicitly cleared, or the volume was changed via mplayer controls. If
the volume controls are connected to the system mixer, and the system
mixer volume is changed otherwise (e.g. with alsamixer), the mute
setting was inconsistent.
Avoid this by checking the volume. If the returned volume is not 0, the
mute flag is considered invalid. This relies on system mixers always
returning a volume of 0 when mplayer has set the volume 0.
Possible caveat: if the audio output's volume control don't return a
volume of exactly 0 after 0 was written, enabling mute basically won't
work. It will set the volume to silence, forget the previous volume, and
report that mute is disabled.
Diffstat (limited to 'command.c')
-rw-r--r-- | command.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -763,14 +763,14 @@ static int mp_property_mute(m_option_t *prop, int action, void *arg, if (!arg) return M_PROPERTY_ERROR; mixer_setmuted(&mpctx->mixer, *(int *) arg); - mpctx->user_muted = mpctx->mixer.muted; + mpctx->user_muted = mixer_getmuted(&mpctx->mixer); return M_PROPERTY_OK; case M_PROPERTY_STEP_UP: case M_PROPERTY_STEP_DOWN: if (mpctx->edl_muted) return M_PROPERTY_DISABLED; mixer_mute(&mpctx->mixer); - mpctx->user_muted = mpctx->mixer.muted; + mpctx->user_muted = mixer_getmuted(&mpctx->mixer); return M_PROPERTY_OK; case M_PROPERTY_PRINT: if (!arg) @@ -780,7 +780,8 @@ static int mp_property_mute(m_option_t *prop, int action, void *arg, return M_PROPERTY_OK; } default: - return m_property_flag(prop, action, arg, &mpctx->mixer.muted); + return m_property_flag_ro(prop, action, arg, + mixer_getmuted(&mpctx->mixer)); } } |