[FFmpeg-devel] [PATCH] ffmpeg: guess channel layout from number of channels if needed
Mina Nagy Zaki
mnzaki at gmail.com
Fri Aug 19 01:22:36 CEST 2011
Guess channel layout from number of channels instead of setting the encoder's
channel_layout to 0
This breaks a number of acodec-pcm regtests due to wav headers now containing a
channel layout mask instead of 0x0
---
ffmpeg.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/ffmpeg.c b/ffmpeg.c
index 2c66076..e5ee33b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2313,10 +2313,12 @@ static int transcode(AVFormatContext **output_files,
choose_sample_fmt(ost->st, ost->enc);
if (!codec->channels) {
codec->channels = icodec->channels;
- codec->channel_layout = icodec->channel_layout;
+ if (icodec->channel_layout)
+ codec->channel_layout = icodec->channel_layout;
+ else
+ codec->channel_layout =
+ avcodec_guess_channel_layout(codec->channels, 0, NULL);
}
- if (av_get_channel_layout_nb_channels(codec->channel_layout) != codec->channels)
- codec->channel_layout = 0;
ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1;
icodec->request_channels = codec->channels;
ist->decoding_needed = 1;
--
1.7.4.4
More information about the ffmpeg-devel
mailing list