summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_coreaudio_chmap.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-10-21 18:57:03 +0200
committerwm4 <wm4@nowhere>2015-10-21 18:57:03 +0200
commitd93a9be656ed4e3e5b953b0de3e40584e8ec8eba (patch)
tree8f39f7401347a8cb1982cbc3c799881076206a0e /audio/out/ao_coreaudio_chmap.c
parentdda16ee1fbe681ad747210aaea7727a3378c9af2 (diff)
downloadmpv-d93a9be656ed4e3e5b953b0de3e40584e8ec8eba.tar.bz2
mpv-d93a9be656ed4e3e5b953b0de3e40584e8ec8eba.tar.xz
ao_coreaudio: do not accept unknown channel layouts
Coreaudio gives us a channel map with all entries set to kAudioChannelLabel_Unknown. This is translated to a mpv channel map with all channels set to NA, which has special meaning: it's an "unknown" channel map, which acts as wildcard and can be converted from/to any channel layout. Not really what we want. I've got this with USB audio, playing stereo. The multichannel layout consisted of 2 unknown channels, while the stereo channel map was stereo (as expected). Note that channel maps with _some_ NA entries are not affected by this, and must still work.
Diffstat (limited to 'audio/out/ao_coreaudio_chmap.c')
-rw-r--r--audio/out/ao_coreaudio_chmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/audio/out/ao_coreaudio_chmap.c b/audio/out/ao_coreaudio_chmap.c
index 0405338828..a034a01668 100644
--- a/audio/out/ao_coreaudio_chmap.c
+++ b/audio/out/ao_coreaudio_chmap.c
@@ -164,7 +164,7 @@ static bool ca_layout_to_mp_chmap(struct ao *ao, AudioChannelLayout *layout,
}
talloc_free(talloc_ctx);
- return chmap->num > 0;
+ return mp_chmap_is_valid(chmap) && !mp_chmap_is_unknown(chmap);
coreaudio_error:
MP_VERBOSE(ao, "converted input channel layout (failed):\n");
ca_log_layout(ao, MSGL_V, layout);