diff options
author | Uoti Urpala <uau@mplayer2.org> | 2012-04-09 21:02:27 +0300 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2012-04-11 03:50:31 +0300 |
commit | 87dad2a4704b2fb0f983d5cb665a065437288d35 (patch) | |
tree | e457d371a271e9fd669b4633d41ec7384ef912c3 /mplayer.c | |
parent | 157a6c1e8343cf0d174e6f9edee441bfefebe578 (diff) | |
download | mpv-87dad2a4704b2fb0f983d5cb665a065437288d35.tar.bz2 mpv-87dad2a4704b2fb0f983d5cb665a065437288d35.tar.xz |
audio: restore volume setting after AO reinit if needed
MPlayer volume control was originally implemented with the assumption
that it controls a system-wide volume setting which keeps its value
even if a process closes and reopens the audio device. However, this
is not actually true for --softvol mode or some audio output APIs that
only consider volume as a per-client setting for software mixing. This
could have annoying results, as the volume would be reset to a default
value if the AO was closed and reopened, for example whem moving to a
new file or crossing ordered chapter boundaries. Add code to set the
previous volume again after audio reinitialization if the current
audio chain is known to behave this way (softvol active or the AO
driver is known to not keep persistent volume externally).
This also avoids an inconsistency with the mute flag. The frontend
assumed the mute status is persistent across file changes, but it
could be similarly lost.
The audio drivers that are assumed to not keep persistent volume are:
coreaudio, dsound, esd, nas, openal, sdl. None of these changes have
been tested. I'm guessing that ESD and NAS do per-connection
non-persistent volume settings.
Partially based on code by wm4.
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1821,10 +1821,10 @@ void reinit_audio_chain(struct MPContext *mpctx) "Couldn't find matching filter/ao format!\n"); goto init_error; } - mpctx->mixer.ao = ao; mpctx->mixer.volstep = volstep; mpctx->mixer.softvol = opts->softvol; mpctx->mixer.softvol_max = opts->softvol_max; + mixer_reinit(&mpctx->mixer, ao); mpctx->syncing_audio = true; return; |