diff options
author | wm4 <wm4@nowhere> | 2014-03-07 15:24:32 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-03-09 00:19:31 +0100 |
commit | 41f2b26d11e81095a0d8d370480e0d2459208070 (patch) | |
tree | 1b665e392be25795b8fade6d0487609f73ac90d2 /audio/mixer.c | |
parent | 74b7001500c0901b095986fafe7dca3e5c23c7f2 (diff) | |
download | mpv-41f2b26d11e81095a0d8d370480e0d2459208070.tar.bz2 mpv-41f2b26d11e81095a0d8d370480e0d2459208070.tar.xz |
audio/out: make ao struct opaque
We want to move the AO to its own thread. There's no technical reason
for making the ao struct opaque to do this. But it helps us sleep at
night, because we can control access to shared state better.
Diffstat (limited to 'audio/mixer.c')
-rw-r--r-- | audio/mixer.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/audio/mixer.c b/audio/mixer.c index a9759976a2..34a1722c80 100644 --- a/audio/mixer.c +++ b/audio/mixer.c @@ -210,7 +210,7 @@ void mixer_setbalance(struct mixer *mixer, float val) if (af_control_any_rev(mixer->af, AF_CONTROL_SET_PAN_BALANCE, &val)) return; - if (val == 0 || mixer->ao->channels.num < 2) + if (val == 0) return; if (!(af_pan_balance = af_add(mixer->af, "pan", NULL))) { @@ -243,8 +243,9 @@ static void probe_softvol(struct mixer *mixer) { if (mixer->opts->softvol == SOFTVOL_AUTO) { // No system-wide volume => fine with AO volume control. - mixer->softvol = !(mixer->ao->per_application_mixer || - mixer->ao->no_persistent_volume); + mixer->softvol = + ao_control(mixer->ao, AOCONTROL_HAS_TEMP_VOLUME, 0) != 1 && + ao_control(mixer->ao, AOCONTROL_HAS_PER_APP_VOLUME, 0) != 1; } else { mixer->softvol = mixer->opts->softvol == SOFTVOL_YES; } @@ -275,9 +276,10 @@ static void restore_volume(struct mixer *mixer) int force_mute = -1; const char *prev_driver = mixer->driver; - mixer->driver = mixer->softvol ? "softvol" : ao->driver->name; + mixer->driver = mixer->softvol ? "softvol" : ao_get_name(ao); - bool restore = mixer->softvol || ao->no_persistent_volume; + bool restore + = mixer->softvol || ao_control(ao, AOCONTROL_HAS_TEMP_VOLUME, 0) == 1; // Restore old parameters if volume won't survive reinitialization. // But not if volume scale is possibly different. |