[FFmpeg-cvslog] aacdec: Support native channel layout when requested.

Alex Converse git at videolan.org
Sat Feb 11 01:35:34 CET 2012


ffmpeg | branch: master | Alex Converse <alex.converse at gmail.com> | Thu Feb  2 18:59:15 2012 -0800| [f1ecd0802d5e81f9f8fac482bc0cd5ceb6b7755a] | committer: Alex Converse

aacdec: Support native channel layout when requested.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f1ecd0802d5e81f9f8fac482bc0cd5ceb6b7755a
---

 libavcodec/aacdec.c    |   14 +++++++++-----
 libavcodec/aacdectab.h |   10 +++++-----
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index bef17ab..b3bbc4b 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -416,11 +416,13 @@ static av_cold int output_configure(AACContext *ac,
     }
 
     if (channel_config) {
+        if (avctx->request_channel_layout != AV_CH_LAYOUT_NATIVE)
+            sniff_channel_order(layout_map, tags);
         for (i = 0; i < tags_per_config[channel_config]; i++) {
-            int type    = aac_channel_layout_map[channel_config - 1][i][0];
-            int id      = aac_channel_layout_map[channel_config - 1][i][1];
-            int positon = aac_channel_layout_map[channel_config - 1][i][2];
-            if ((ret = che_configure(ac, positon,
+            int type    = layout_map[i][0];
+            int id      = layout_map[i][1];
+            int position = layout_map[i][2];
+            if ((ret = che_configure(ac, position,
                                      type, id,
                                      &channels)))
                 return ret;
@@ -437,7 +439,9 @@ static av_cold int output_configure(AACContext *ac,
          * channels in the order the PCE declared them.
          */
 
-        uint64_t layout = sniff_channel_order(layout_map, tags);
+        uint64_t layout = 0;
+        if (avctx->request_channel_layout != AV_CH_LAYOUT_NATIVE)
+            layout = sniff_channel_order(layout_map, tags);
         for (i = 0; i < tags; i++) {
             int type =     layout_map[i][0];
             int id =       layout_map[i][1];
diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
index bd09b59..844579f 100644
--- a/libavcodec/aacdectab.h
+++ b/libavcodec/aacdectab.h
@@ -83,11 +83,11 @@ static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 0,
 static const uint8_t aac_channel_layout_map[7][5][3] = {
     { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, },
     { { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
-    { { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, },
-    { { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, },
-    { { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, },
-    { { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_LFE, 0, AAC_CHANNEL_LFE  }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, },
-    { { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_LFE, 0, AAC_CHANNEL_LFE  }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
+    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
+    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, },
+    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, },
+    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE  }, },
+    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE  }, },
 };
 
 static const uint64_t aac_channel_layout[8] = {



More information about the ffmpeg-cvslog mailing list