[vlc-commits] WAV: support of 7.1 with 0 channel_map

Thomas Guillem git at videolan.org
Thu Sep 29 15:53:59 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Sep 29 14:52:37 2016 +0200| [277c4076cc5625efd50faaf0de0e8c36dc606276] | committer: Thomas Guillem

WAV: support of 7.1 with 0 channel_map

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

 modules/demux/wav.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/modules/demux/wav.c b/modules/demux/wav.c
index 618956c..4080bae 100644
--- a/modules/demux/wav.c
+++ b/modules/demux/wav.c
@@ -271,11 +271,24 @@ static int Open( vlc_object_t * p_this )
             }
         }
     }
-    else if( GetWLE( &p_wf->wFormatTag ) == WAVE_FORMAT_PCM &&
-             p_sys->fmt.audio.i_channels > 2 && p_sys->fmt.audio.i_channels <= AOUT_CHAN_MAX )
+    if( p_sys->i_channel_mask == 0 && p_sys->fmt.audio.i_channels > 2 )
     {
-        for( int i = 0; i < p_sys->fmt.audio.i_channels; i++ )
-            p_sys->i_channel_mask |= pi_channels_aout[i];
+        /* A dwChannelMask of 0 tells the audio device to render the first
+         * channel to the first port on the device, the second channel to the
+         * second port on the device, and so on. pi_default_channels is
+         * different than pi_channels_aout. Indeed FLC/FRC must be treated a
+         * SL/SR in that case. See "Default Channel Ordering" and "Details
+         * about dwChannelMask" from msdn */
+
+        static const uint32_t pi_default_channels[] = {
+            AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT, AOUT_CHAN_CENTER,
+            AOUT_CHAN_LFE, AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
+            AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT, AOUT_CHAN_REARCENTER };
+
+        for( unsigned i = 0; i < p_sys->fmt.audio.i_channels &&
+             i < (sizeof(pi_default_channels) / sizeof(*pi_default_channels));
+             i++ )
+            p_sys->i_channel_mask |= pi_default_channels[i];
     }
 
     if( p_sys->i_channel_mask )



More information about the vlc-commits mailing list