[vlc-devel] [PATCH 2/2] faad: fix Ambisonics AAC order 1 streams

Adrien Maglo magsoft at videolan.org
Mon May 14 16:55:01 CEST 2018


Reorder properly the audio channels.
---
 modules/codec/faad.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/modules/codec/faad.c b/modules/codec/faad.c
index b31d329d3b..e3c9e0405f 100644
--- a/modules/codec/faad.c
+++ b/modules/codec/faad.c
@@ -529,12 +529,23 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
                 }
                 else pi_faad_channels_positions[i] = 0;
             }
+        }
+        else if (p_dec->fmt_out.audio.channel_type == AUDIO_CHANNEL_TYPE_AMBISONICS
+            && frame.channels == 4)
+        {
+            pi_faad_channels_positions[0] = AOUT_CHAN_REARCENTER;
+            pi_faad_channels_positions[1] = AOUT_CHAN_LEFT;
+            pi_faad_channels_positions[2] = AOUT_CHAN_RIGHT;
+            pi_faad_channels_positions[3] = AOUT_CHAN_CENTER;
+            p_dec->fmt_out.audio.i_physical_channels =
+                AOUT_CHAN_CENTER | AOUT_CHAN_LEFT
+                | AOUT_CHAN_RIGHT | AOUT_CHAN_REARCENTER;
+        }
 
-            b_reorder = aout_CheckChannelReorder( pi_faad_channels_positions, NULL,
-                p_dec->fmt_out.audio.i_physical_channels, pi_neworder_table );
+        b_reorder = aout_CheckChannelReorder( pi_faad_channels_positions, NULL,
+            p_dec->fmt_out.audio.i_physical_channels, pi_neworder_table );
 
-            p_dec->fmt_out.audio.i_channels = vlc_popcount(p_dec->fmt_out.audio.i_physical_channels);
-        }
+        p_dec->fmt_out.audio.i_channels = vlc_popcount(p_dec->fmt_out.audio.i_physical_channels);
 
         if( !decoder_UpdateAudioFormat( p_dec ) && p_dec->fmt_out.audio.i_channels > 0 )
             p_out = decoder_NewAudioBuffer( p_dec, frame.samples / p_dec->fmt_out.audio.i_channels );
-- 
2.14.1



More information about the vlc-devel mailing list