summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-10-26 15:54:45 +0100
committerwm4 <wm4@nowhere>2015-10-26 15:54:45 +0100
commitc971fefd41f530e7974dd262c22e3b0915f1756a (patch)
treeb91ba3e728bcadd9940e9d7b116d6aaa411a2e34 /audio
parent9ed289ef90224c5076af1427ced994eef6e3c9fe (diff)
downloadmpv-c971fefd41f530e7974dd262c22e3b0915f1756a.tar.bz2
mpv-c971fefd41f530e7974dd262c22e3b0915f1756a.tar.xz
ao_coreaudio_chmap: allow stereo as fallback; avoid mono fallback
If no channel layouts were determined (which can actually happen with some "strange" devices), the selection code was falling back to mono, because mono is always added as a fallback. This doesn't seem quite right. Allow a fallback to stereo too, if no channel layout could be retrieved at all. So we always assume that mono and stereo work, if no other layouts are available. (I still don't know what the CoreAudio stereo layout is supposed to do. It could be used to swap left and right channels. It could also be used to pad/move the channels, but I have never seen that. And it can be set to non-stereo channels, which breaks mpv. Whatever.)
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_coreaudio_chmap.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/audio/out/ao_coreaudio_chmap.c b/audio/out/ao_coreaudio_chmap.c
index 94c9179db8..1f299cedc2 100644
--- a/audio/out/ao_coreaudio_chmap.c
+++ b/audio/out/ao_coreaudio_chmap.c
@@ -242,8 +242,6 @@ bool ca_init_chmap(struct ao *ao, AudioDeviceID device)
struct mp_chmap_sel chmap_sel = {.tmp = ta_ctx};
struct mp_chmap chmap = {0};
- mp_chmap_sel_add_map(&chmap_sel, &(struct mp_chmap)MP_CHMAP_INIT_MONO);
-
AudioChannelLayout *ml = ca_query_layout(ao, device, ta_ctx);
if (ml && ca_layout_to_mp_chmap(ao, ml, &chmap))
mp_chmap_sel_add_map(&chmap_sel, &chmap);
@@ -252,6 +250,11 @@ bool ca_init_chmap(struct ao *ao, AudioDeviceID device)
if (sl && ca_layout_to_mp_chmap(ao, sl, &chmap))
mp_chmap_sel_add_map(&chmap_sel, &chmap);
+ if (!chmap_sel.num_chmaps)
+ mp_chmap_sel_add_map(&chmap_sel, &(struct mp_chmap)MP_CHMAP_INIT_STEREO);
+
+ mp_chmap_sel_add_map(&chmap_sel, &(struct mp_chmap)MP_CHMAP_INIT_MONO);
+
if (!ao_chmap_sel_adjust(ao, &chmap_sel, &ao->channels)) {
MP_ERR(ao, "could not select a suitable channel map among the "
"hardware supported ones. Make sure to configure your "