summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-04 23:59:27 +0200
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-05-07 10:47:07 +0900
commitb38766133bb09e87b2016f3100e5856b9554a003 (patch)
tree966f90a57d3047d2c61f359825127139021a83d0
parent604daa861fa6cda1b118a20e06269b1a4a6c3f21 (diff)
downloadmpv-b38766133bb09e87b2016f3100e5856b9554a003.tar.bz2
mpv-b38766133bb09e87b2016f3100e5856b9554a003.tar.xz
ao_coreaudio: support padded channel layouts
If for example the audio settings are set to 5.1 output, but the hardware does 8 channels natively (HDMI), the reported channel layout will have 2 dummy channels. To avoid falling back to stereo, we have to write audio in this format to the device. (cherry picked from commit 4d8a7e03944155bf07ba9a775cf9554bb1c76f0f)
-rw-r--r--audio/out/ao_coreaudio.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c
index 8716fcc75d..65f7a070fd 100644
--- a/audio/out/ao_coreaudio.c
+++ b/audio/out/ao_coreaudio.c
@@ -78,7 +78,6 @@ static OSStatus render_cb_lpcm(void *ctx, AudioUnitRenderActionFlags *aflags,
int64_t end = mp_time_us();
end += p->hw_latency_us + ca_get_latency(ts) + ca_frames_to_us(ao, frames);
-
ao_read_data(ao, &buf.mData, frames, end);
return noErr;
}
@@ -445,7 +444,7 @@ static const int speaker_map[][2] = {
{ kAudioChannelLabel_HeadphonesLeft, MP_SPEAKER_ID_DL },
{ kAudioChannelLabel_HeadphonesRight, MP_SPEAKER_ID_DR },
- { kAudioChannelLabel_Unknown, MP_SPEAKER_ID_UNKNOWN0 },
+ { kAudioChannelLabel_Unknown, MP_SPEAKER_ID_NA0 },
{ 0, -1 },
};
@@ -543,9 +542,14 @@ bool ca_layout_to_mp_chmap(struct ao *ao, AudioChannelLayout *layout,
return false;
}
+ int next_na = MP_SPEAKER_ID_NA0;
for (int n = 0; n < l->mNumberChannelDescriptions; n++) {
AudioChannelLabel label = l->mChannelDescriptions[n].mChannelLabel;
uint8_t speaker = ca_label_to_mp_speaker_id(label);
+ if (speaker == MP_SPEAKER_ID_NA0 && next_na < MP_SPEAKER_ID_NA_LAST)
+ {
+ speaker = next_na++;
+ }
if (speaker < 0) {
MP_VERBOSE(ao, "channel label=%u unusable to build channel "
"bitmap, skipping layout\n", (unsigned) label);