1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-17 13:17:13 +00:00

ao_alsa: hack back mono output

The ALSA API is inconsistent and doesn't report support. Just requesting
1 channel actually works. Whatever.
This commit is contained in:
wm4 2015-05-25 22:10:25 +02:00
parent 446a10020f
commit 302901ddaf

View File

@ -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);
}