[vlc-commits] avcodec: do not reorder Ambisonics channels encoded in AAC

Adrien Maglo git at videolan.org
Fri Jan 5 09:47:44 CET 2018


vlc/vlc-3.0 | branch: master | Adrien Maglo <magsoft at videolan.org> | Thu Dec 21 18:18:40 2017 +0100| [f03fc27d9473a7d6493f8bba88510b80ab5036be] | committer: Thomas Guillem

avcodec: do not reorder Ambisonics channels encoded in AAC

Keep the codec order to achieve a correct Ambisonics rendering.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 6ce9f94f020d6a6d56a5a4d34abc1340c942b7a6)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=f03fc27d9473a7d6493f8bba88510b80ab5036be
---

 modules/codec/avcodec/audio.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 6b43627c1e..b9eb7d5856 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -624,6 +624,20 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
         if( i_channels_dst != i_channels_src && b_trust )
             msg_Warn( p_dec, "%d channels are dropped", i_channels_src - i_channels_dst );
 
+        /* Restore the right order of Ambisonic order 1 channels encoded in AAC... */
+        if (p_dec->fmt_out.audio.channel_type == AUDIO_CHANNEL_TYPE_AMBISONICS
+            && p_dec->fmt_in.i_codec == VLC_CODEC_MP4A
+            && i_channels_src == 4)
+        {
+            p_sys->pi_extraction[0] = 2;
+            p_sys->pi_extraction[1] = 0;
+            p_sys->pi_extraction[2] = 1;
+            p_sys->pi_extraction[3] = 3;
+            i_layout_dst = AOUT_CHAN_CENTER | AOUT_CHAN_LEFT
+                    | AOUT_CHAN_RIGHT | AOUT_CHAN_REARCENTER;
+            p_sys->b_extract = true;
+        }
+
         p_dec->fmt_out.audio.i_physical_channels = i_layout_dst;
     }
     else



More information about the vlc-commits mailing list