As of SVN r18631 (2009-04-20) A52 encoder of libavcodec outputs a
warning at run-time if channel layout is not specified.
Fix that by setting the channel layout in a52_prepare() when building
against libavcodec revision that supports this.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
rec->avctx->bit_rate = rec->bitrate * 1000;
rec->avctx->sample_rate = io->rate;
rec->avctx->channels = io->channels;
+#if LIBAVCODEC_VERSION_MAJOR > 52 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 3)
+ switch (io->channels) {
+ case 2:
+ rec->avctx->channel_layout = CH_LAYOUT_STEREO;
+ break;
+ case 4:
+ rec->avctx->channel_layout = CH_LAYOUT_QUAD;
+ break;
+ case 6:
+ rec->avctx->channel_layout = CH_LAYOUT_5POINT1;
+ break;
+ default:
+ break;
+ }
+#endif
if (avcodec_open(rec->avctx, rec->codec) < 0)
return -EINVAL;