1
mirror of https://github.com/mpv-player/mpv synced 2024-10-18 10:25:02 +02:00

ao_coreaudio_chmap: add more logging

This commit is contained in:
wm4 2015-10-26 15:51:50 +01:00
parent fa510bd00c
commit 81109dcbb6

View File

@ -98,6 +98,9 @@ static AudioChannelLayout *ca_layout_to_custom_layout(struct ao *ao,
AudioChannelLayout *r; AudioChannelLayout *r;
OSStatus err; OSStatus err;
if (tag == kAudioChannelLayoutTag_UseChannelDescriptions)
return l;
if (tag == kAudioChannelLayoutTag_UseChannelBitmap) { if (tag == kAudioChannelLayoutTag_UseChannelBitmap) {
uint32_t psize; uint32_t psize;
err = AudioFormatGetPropertyInfo( err = AudioFormatGetPropertyInfo(
@ -109,7 +112,7 @@ static AudioChannelLayout *ca_layout_to_custom_layout(struct ao *ao,
kAudioFormatProperty_ChannelLayoutForBitmap, kAudioFormatProperty_ChannelLayoutForBitmap,
sizeof(uint32_t), &l->mChannelBitmap, &psize, r); sizeof(uint32_t), &l->mChannelBitmap, &psize, r);
CHECK_CA_ERROR("failed to convert channel bitmap to descriptions (get)"); CHECK_CA_ERROR("failed to convert channel bitmap to descriptions (get)");
} else if (tag != kAudioChannelLayoutTag_UseChannelDescriptions) { } else {
uint32_t psize; uint32_t psize;
err = AudioFormatGetPropertyInfo( err = AudioFormatGetPropertyInfo(
kAudioFormatProperty_ChannelLayoutForTag, kAudioFormatProperty_ChannelLayoutForTag,
@ -120,10 +123,11 @@ static AudioChannelLayout *ca_layout_to_custom_layout(struct ao *ao,
kAudioFormatProperty_ChannelLayoutForTag, kAudioFormatProperty_ChannelLayoutForTag,
sizeof(AudioChannelLayoutTag), &l->mChannelLayoutTag, &psize, r); sizeof(AudioChannelLayoutTag), &l->mChannelLayoutTag, &psize, r);
CHECK_CA_ERROR("failed to convert channel tag to descriptions (get)"); CHECK_CA_ERROR("failed to convert channel tag to descriptions (get)");
} else {
r = l;
} }
MP_VERBOSE(ao, "converted input channel layout:\n");
ca_log_layout(ao, MSGL_V, l);
return r; return r;
coreaudio_error: coreaudio_error:
return NULL; return NULL;
@ -134,16 +138,13 @@ static bool ca_layout_to_mp_chmap(struct ao *ao, AudioChannelLayout *layout,
{ {
void *talloc_ctx = talloc_new(NULL); void *talloc_ctx = talloc_new(NULL);
MP_DBG(ao, "input channel layout:\n"); MP_VERBOSE(ao, "input channel layout:\n");
ca_log_layout(ao, MSGL_DEBUG, layout); ca_log_layout(ao, MSGL_V, layout);
AudioChannelLayout *l = ca_layout_to_custom_layout(ao, talloc_ctx, layout); AudioChannelLayout *l = ca_layout_to_custom_layout(ao, talloc_ctx, layout);
if (!l) if (!l)
goto coreaudio_error; goto coreaudio_error;
MP_VERBOSE(ao, "converted input channel layout:\n");
ca_log_layout(ao, MSGL_V, l);
if (l->mNumberChannelDescriptions > MP_NUM_CHANNELS) { if (l->mNumberChannelDescriptions > MP_NUM_CHANNELS) {
MP_VERBOSE(ao, "layout has too many descriptions (%u, max: %d)\n", MP_VERBOSE(ao, "layout has too many descriptions (%u, max: %d)\n",
(unsigned) l->mNumberChannelDescriptions, MP_NUM_CHANNELS); (unsigned) l->mNumberChannelDescriptions, MP_NUM_CHANNELS);
@ -164,6 +165,7 @@ static bool ca_layout_to_mp_chmap(struct ao *ao, AudioChannelLayout *layout,
} }
talloc_free(talloc_ctx); talloc_free(talloc_ctx);
MP_VERBOSE(ao, "mp chmap: %s\n", mp_chmap_to_str(chmap));
return mp_chmap_is_valid(chmap) && !mp_chmap_is_unknown(chmap); return mp_chmap_is_valid(chmap) && !mp_chmap_is_unknown(chmap);
coreaudio_error: coreaudio_error:
MP_VERBOSE(ao, "converted input channel layout (failed):\n"); MP_VERBOSE(ao, "converted input channel layout (failed):\n");