mirror of
https://github.com/mpv-player/mpv
synced 2025-03-11 08:37:59 +00:00
mixer: allow accessing volume and mute property on disabled audio
The volume is set as soon as the audio chain is created again. This works only in softvol mode. For system wide volume or otherwise externally user controllable volume, this code is intentionally disabled. It would be extremely weird if changing volume (while audio is not initialized) would do nothing, and then suddenly change it when the audio chain is created. There's another odd corner case: the user-set volume will be thrown away if it's set before the _first_ audio chain initialization. This is because the volume restore logic recognizes a change from nothing to softvol or an AO, and circumventing that would require additional code. Also, we don't even know the start volume before that point. Forcing the volume with --volume will can override the volume set during no-audio mode, depending on the situation.
This commit is contained in:
parent
7623c94ddc
commit
327a779a81
@ -762,10 +762,6 @@ static int mp_property_clock(m_option_t *prop, int action, void *arg,
|
||||
static int mp_property_volume(m_option_t *prop, int action, void *arg,
|
||||
MPContext *mpctx)
|
||||
{
|
||||
|
||||
if (!mpctx->sh_audio)
|
||||
return M_PROPERTY_UNAVAILABLE;
|
||||
|
||||
switch (action) {
|
||||
case M_PROPERTY_GET:
|
||||
mixer_getbothvolume(&mpctx->mixer, arg);
|
||||
@ -789,10 +785,6 @@ static int mp_property_volume(m_option_t *prop, int action, void *arg,
|
||||
static int mp_property_mute(m_option_t *prop, int action, void *arg,
|
||||
MPContext *mpctx)
|
||||
{
|
||||
|
||||
if (!mpctx->sh_audio)
|
||||
return M_PROPERTY_UNAVAILABLE;
|
||||
|
||||
switch (action) {
|
||||
case M_PROPERTY_SET:
|
||||
mixer_setmute(&mpctx->mixer, *(int *) arg);
|
||||
|
Loading…
Reference in New Issue
Block a user