[FFmpeg-devel] [PATCH] dcaenc: Allow encoding without specifying a channel_layout.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Apr 7 12:02:23 CEST 2012


Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
 libavcodec/dcaenc.c       |    5 ++++-
 tests/codec-regression.sh |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index 71106d7..acd0774 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -534,11 +534,14 @@ 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)
+        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;
diff --git a/tests/codec-regression.sh b/tests/codec-regression.sh
index 76059bb..a0667f4 100755
--- a/tests/codec-regression.sh
+++ b/tests/codec-regression.sh
@@ -446,7 +446,7 @@ $tiny_psnr $pcm_dst $pcm_ref 2 4096
 fi
 
 if [ -n "$do_dca" ] ; then
-do_audio_encoding dca.dts "-strict -2 -channel_layout 3 -acodec dca"
+do_audio_encoding dca.dts "-strict -2 -acodec dca"
 do_audio_decoding
 $tiny_psnr $pcm_dst $pcm_ref 2 1920
 fi
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list