[xcode] Workaround for ffmpeg detecting channel_layout = 0 for AIF

This commit is contained in:
ejurgensen 2020-04-07 20:55:17 +02:00
parent a509152823
commit a0ac66e020
1 changed files with 6 additions and 1 deletions

View File

@ -1241,7 +1241,12 @@ transcode_encode_setup(enum transcode_profile profile, struct media_quality *qua
if (!ctx->settings.channels && ctx->settings.encode_audio)
{
ctx->settings.channels = src_ctx->audio_stream.codec->channels;
ctx->settings.channel_layout = src_ctx->audio_stream.codec->channel_layout;
// For some AIF files, ffmpeg (3.4.6) will not give us a channel_layout (bug in ffmpeg?)
if (src_ctx->audio_stream.codec->channel_layout)
ctx->settings.channel_layout = src_ctx->audio_stream.codec->channel_layout;
else
ctx->settings.channel_layout= av_get_default_channel_layout(ctx->settings.channels);
}
if (ctx->settings.wavheader)