diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2014-12-16 13:03:43 +0100 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2014-12-16 13:04:29 +0100 |
commit | 4b65bd5086f832228303cd891a6abd231eeea790 (patch) | |
tree | 89e6d42a88083c122df09bae5c54246cd16bf00d /audio | |
parent | a7e48eca6661e7a414041dd0d44983aff8deb582 (diff) |
ao_coreaudio: fix mono/stereo channel mapping
Needed after af3bbb800d since now we use channel mapping all the time.
Fixes #1357
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao_coreaudio.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c index 47ad69b415..7ccc2c212a 100644 --- a/audio/out/ao_coreaudio.c +++ b/audio/out/ao_coreaudio.c @@ -194,12 +194,6 @@ static bool init_chmap(struct ao *ao) talloc_free(layouts); - if (ao->channels.num < 3) { - struct mp_chmap chmap; - mp_chmap_from_channels(&chmap, ao->channels.num); - mp_chmap_sel_add_map(&chmap_sel, &chmap); - } - 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 " @@ -336,7 +330,7 @@ static const int speaker_map[][2] = { { kAudioChannelLabel_HeadphonesLeft, MP_SPEAKER_ID_DL }, { kAudioChannelLabel_HeadphonesRight, MP_SPEAKER_ID_DR }, - { kAudioChannelLabel_Unknown, -1 }, + { kAudioChannelLabel_Unknown, MP_SPEAKER_ID_UNKNOWN0 }, }; static int ca_label_to_mp_speaker_id(AudioChannelLabel label) @@ -426,8 +420,6 @@ bool ca_layout_to_mp_chmap(struct ao *ao, AudioChannelLayout *layout, for (int n = 0; n < layout->mNumberChannelDescriptions; n++) { AudioChannelLabel label = layout->mChannelDescriptions[n].mChannelLabel; uint8_t speaker = ca_label_to_mp_speaker_id(label); - if (label == kAudioChannelLabel_Unknown) - continue; if (speaker < 0) { MP_VERBOSE(ao, "channel label=%u unusable to build channel " "bitmap, skipping layout\n", (unsigned) label); @@ -438,6 +430,12 @@ bool ca_layout_to_mp_chmap(struct ao *ao, AudioChannelLayout *layout, } } + // In OS X systems with unconfigured multichannel, coreaudio reports + // speakers with an unknown channel label. Just assume those are stereo + // and mono + if (mp_chmap_is_unknown(chmap) && chmap->num < 3) + mp_chmap_from_channels(chmap, chmap->num); + return chmap->num > 0; coreaudio_error: ca_log_layout(ao, layout); |