aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2012-04-07 12:01:50 +0200
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2012-04-07 16:35:28 +0200
commit4395c058d261a6b23fbfaff9f55d0cafc329d3b6 (patch)
treedf155e13f1ba2e605fa0fb328c6e55e40152ad0c /libavcodec
parent82ca1f800477c48d2195d5655cf5413d55a4ef6f (diff)
downloadffmpeg-4395c058d261a6b23fbfaff9f55d0cafc329d3b6.tar.gz
dcaenc: Allow encoding without specifying a channel_layout.
It will print a warning, making the behaviour consistent with the AC3 encoder. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dcaenc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index 71106d7e36..d6efd250d5 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -534,11 +534,18 @@ static int encode_init(AVCodecContext *avctx)
{
DCAContext *c = avctx->priv_data;
int i;
+ uint64_t layout = avctx->channel_layout;
c->prim_channels = avctx->channels;
c->lfe_channel = (avctx->channels == 3 || avctx->channels == 6);
- switch (avctx->channel_layout) {
+ if (!layout) {
+ av_log(avctx, AV_LOG_WARNING, "No channel layout specified. The "
+ "encoder will guess the layout, but it "
+ "might be incorrect.\n");
+ layout = av_get_default_channel_layout(avctx->channels);
+ }
+ switch (layout) {
case AV_CH_LAYOUT_STEREO: c->a_mode = 2; c->num_channel = 2; break;
case AV_CH_LAYOUT_5POINT0: c->a_mode = 9; c->num_channel = 9; break;
case AV_CH_LAYOUT_5POINT1: c->a_mode = 9; c->num_channel = 9; break;