From 302901ddaf452903e9ceea7a9928d1ade2cc6b10 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 25 May 2015 22:10:25 +0200 Subject: ao_alsa: hack back mono output The ALSA API is inconsistent and doesn't report support. Just requesting 1 channel actually works. Whatever. --- audio/out/ao_alsa.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'audio/out/ao_alsa.c') 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); } -- cgit v1.2.3