summaryrefslogtreecommitdiffstats
path: root/audio/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-25 22:10:25 +0200
committerwm4 <wm4@nowhere>2015-05-25 22:10:35 +0200
commit302901ddaf452903e9ceea7a9928d1ade2cc6b10 (patch)
tree0dc59fd258cfdbbf3f942684c2a45352ec87cf56 /audio/out
parent446a10020f9fd01c51332a1c7cf314e6dacfa65d (diff)
downloadmpv-302901ddaf452903e9ceea7a9928d1ade2cc6b10.tar.bz2
mpv-302901ddaf452903e9ceea7a9928d1ade2cc6b10.tar.xz
ao_alsa: hack back mono output
The ALSA API is inconsistent and doesn't report support. Just requesting 1 channel actually works. Whatever.
Diffstat (limited to 'audio/out')
-rw-r--r--audio/out/ao_alsa.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index fd6ea32ea6..1671373d99 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -482,6 +482,9 @@ static int init_device(struct ao *ao, bool second_try)
struct mp_chmap dev_chmap = ao->channels;
if (AF_FORMAT_IS_IEC61937(ao->format) || p->cfg_ignore_chmap) {
dev_chmap.num = 0; // disable chmap API
+ } else if (dev_chmap.num == 1 && dev_chmap.speaker[0] == MP_SPEAKER_ID_FC) {
+ // As yet another ALSA API inconsistency, mono is not reported correctly.
+ dev_chmap.num = 0;
} else if (query_chmaps(ao, &dev_chmap)) {
ao->channels = dev_chmap;
} else {
@@ -625,8 +628,10 @@ static int init_device(struct ao *ao, bool second_try)
}
// mpv and ALSA use different conventions for mono
- if (ao->channels.num == 1)
+ if (ao->channels.num == 1) {
+ MP_VERBOSE(ao, "assuming we actually got MONO from ALSA.\n");
ao->channels.speaker[0] = MP_SP(FC);
+ }
free(alsa_chmap);
}