summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-20 17:18:50 +0100
committerAlessandro Ghedini <alessandro@ghedini.me>2015-01-14 16:17:59 +0100
commit8ab8fa8960a2ea8642c006cfd10057b93835600b (patch)
tree9b8ea0752d672f8d5230664a7797df1748663030
parent295622bab1ecde244c3e9cc49f4f1a3176103b49 (diff)
downloadmpv-8ab8fa8960a2ea8642c006cfd10057b93835600b.tar.bz2
mpv-8ab8fa8960a2ea8642c006cfd10057b93835600b.tar.xz
ao_alsa: fix setting mono channel map
When setting the ALSA channel map, we never actually set the map we got from ALSA directly, but convert it to mpv's, and then back to ALSA's. mpv and ALSA use different conventions for mono, and there is already an exception for ALSA->mpv, but not mpv->ALSA.
-rw-r--r--audio/out/ao_alsa.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index 93cea1f30b..3958bf8107 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -598,6 +598,10 @@ static int init(struct ao *ao)
for (int c = 0; c < dev_chmap.num; c++)
alsa_chmap->pos[c] = find_alsa_channel(dev_chmap.speaker[c]);
+ // mpv and ALSA use different conventions for mono
+ if (dev_chmap.num == 1 && dev_chmap.speaker[0] == MP_SP(FC))
+ alsa_chmap->pos[0] = SND_CHMAP_MONO;
+
char tmp[128];
if (snd_pcm_chmap_print(alsa_chmap, sizeof(tmp), tmp) > 0)
MP_VERBOSE(ao, "trying to set ALSA channel map: %s\n", tmp);
@@ -635,6 +639,7 @@ static int init(struct ao *ao)
MP_WARN(ao, "Got unknown channel map from ALSA.\n");
}
+ // mpv and ALSA use different conventions for mono
if (ao->channels.num == 1)
ao->channels.speaker[0] = MP_SP(FC);