]> git.sesse.net Git - vlc/commitdiff
Fixed rear center support (and close #1816).
authorLaurent Aimar <fenrir@videolan.org>
Wed, 27 Aug 2008 12:49:41 +0000 (14:49 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 27 Aug 2008 15:56:44 +0000 (17:56 +0200)
It also factorize channel order definitions.
The DTS order for middle channels can be wrong.

include/vlc_aout.h
modules/audio_filter/converter/a52tofloat32.c
modules/audio_filter/converter/dtstofloat32.c
modules/audio_output/directx.c
modules/audio_output/portaudio.c
modules/audio_output/waveout.c
modules/codec/vorbis.c
modules/demux/wav.c
modules/mux/wav.c
src/audio_output/common.c

index 4e05c9fc7c76fa153b35b6c5acf9b77e1186512d..39e1ca1a6b3d6f93687f9b115b9b0006e55af4aa 100644 (file)
@@ -356,6 +356,17 @@ struct aout_instance_t
     aout_output_t           output;
 };
 
+/**
+ * It describes the audio channel order VLC except.
+ */
+static const uint32_t pi_vlc_chan_order_wg4[] =
+{
+    AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
+    AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT,
+    AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER,
+    AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0
+};
+
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
@@ -369,7 +380,13 @@ VLC_EXPORT( mtime_t, aout_DateIncrement, ( audio_date_t *, uint32_t ) );
 
 VLC_EXPORT( aout_buffer_t *, aout_OutputNextBuffer, ( aout_instance_t *, mtime_t, bool ) );
 
-VLC_EXPORT( int, aout_CheckChannelReorder, ( const uint32_t *, const uint32_t *, uint32_t, int, int * ) );
+/**
+ * This function computes the reordering needed to go from pi_chan_order_in to
+ * pi_chan_order_out.
+ * If pi_chan_order_in or pi_chan_order_out is NULL, it will assume that vlc
+ * internal (WG4) order is requested.
+ */
+VLC_EXPORT( int, aout_CheckChannelReorder, ( const uint32_t *pi_chan_order_in, const uint32_t *pi_chan_order_out, uint32_t i_channel_mask, int i_channels, int *pi_chan_table ) );
 VLC_EXPORT( void, aout_ChannelReorder, ( uint8_t *, int, int, const int *, int ) );
 
 VLC_EXPORT( unsigned int, aout_FormatNbChannels, ( const audio_sample_format_t * p_format ) );
index c78633e950e9e14d937581236c4be1a94cd84e89..699ca3f30bcbf60462a13c5e172ed7cd866e2491 100644 (file)
@@ -71,11 +71,7 @@ static block_t *Convert( filter_t *, block_t * );
 /* liba52 channel order */
 static const uint32_t pi_channels_in[] =
 { AOUT_CHAN_LFE, AOUT_CHAN_LEFT, AOUT_CHAN_CENTER, AOUT_CHAN_RIGHT,
-  AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, 0 };
-/* our internal channel order (WG-4 order) */
-static const uint32_t pi_channels_out[] =
-{ AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT, AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
-  AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 };
+  AOUT_CHAN_REARLEFT, AOUT_CHAN_REARCENTER, AOUT_CHAN_REARRIGHT, 0 };
 
 /*****************************************************************************
  * Local structures
@@ -271,7 +267,7 @@ static int Open( vlc_object_t *p_this, filter_sys_t *p_sys,
         return VLC_EGENERIC;
     }
 
-    aout_CheckChannelReorder( pi_channels_in, pi_channels_out,
+    aout_CheckChannelReorder( pi_channels_in, NULL,
                               output.i_physical_channels & AOUT_CHAN_PHYSMASK,
                               p_sys->i_nb_channels,
                               p_sys->pi_chan_table );
index 074c49c36bea1bb4a4e13cdb2a8f0186781caf73..f445768199511f6a94a6257944f5eb39782817ef 100644 (file)
@@ -55,14 +55,13 @@ static int  OpenFilter ( vlc_object_t * );
 static void CloseFilter( vlc_object_t * );
 static block_t *Convert( filter_t *, block_t * );
 
-/* libdca channel order */
+/* libdca channel order
+ * FIXME middle values should be checked */
 static const uint32_t pi_channels_in[] =
-{ AOUT_CHAN_CENTER, AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
-  AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_LFE, 0 };
-/* our internal channel order (WG-4 order) */
-static const uint32_t pi_channels_out[] =
-{ AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT, AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
-  AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 };
+{ AOUT_CHAN_LFE, AOUT_CHAN_LEFT, AOUT_CHAN_CENTER, AOUT_CHAN_RIGHT,
+  AOUT_CHAN_REARLEFT, AOUT_CHAN_REARCENTER, AOUT_CHAN_REARRIGHT,
+  AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT,
+  0 };
 
 /*****************************************************************************
  * Local structures
@@ -223,7 +222,7 @@ static int Open( vlc_object_t *p_this, filter_sys_t *p_sys,
         return VLC_EGENERIC;
     }
 
-    aout_CheckChannelReorder( pi_channels_in, pi_channels_out,
+    aout_CheckChannelReorder( pi_channels_in, NULL,
                               output.i_physical_channels & AOUT_CHAN_PHYSMASK,
                               p_sys->i_nb_channels,
                               p_sys->pi_chan_table );
index ff4f312d2252e7c74f8e5981580d1771049fddd3..0b9737ddee227eb9015afc2e69246e11be679fe8 100644 (file)
@@ -184,17 +184,18 @@ struct aout_sys_t
 static const uint32_t pi_channels_src[] =
     { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
       AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT,
-      AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
+      AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER,
       AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 };
 static const uint32_t pi_channels_in[] =
     { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
       SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT,
-      SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT,
+      SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, SPEAKER_BACK_CENTER,
       SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, 0 };
 static const uint32_t pi_channels_out[] =
     { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
       SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY,
       SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT,
+      SPEAKER_BACK_CENTER,
       SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, 0 };
 
 /*****************************************************************************
index ac08b6c10baec715a462c079eec718f4ce51cf1a..3a8764063d76ff4a2d99377b69fa764dc0fd998d 100644 (file)
@@ -77,15 +77,10 @@ struct aout_sys_t
     uint32_t i_channels;
 };
 
-static const uint32_t pi_channels_in[] =
-    { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
-      AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT,
-      AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
-      AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 };
 static const uint32_t pi_channels_out[] =
     { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
       AOUT_CHAN_CENTER, AOUT_CHAN_LFE,
-      AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
+      AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER,
       AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT, 0 };
 
 #ifdef PORTAUDIO_IS_SERIOUSLY_BROKEN
@@ -515,7 +510,7 @@ static int PAOpenStream( aout_instance_t *p_aout )
     p_aout->output.p_sys->i_channels = i_channels;
 
     p_aout->output.p_sys->b_chan_reorder =
-        aout_CheckChannelReorder( pi_channels_in, pi_channels_out,
+        aout_CheckChannelReorder( NULL, pi_channels_out,
                                   i_channel_mask, i_channels,
                                   p_aout->output.p_sys->pi_chan_table );
 
index 8d4bbc71386a47169eb1d59aea5e169ce5553fe1..7b48bf451aa4aeffa2f7eb7212bb677c6c5ba9ac 100644 (file)
@@ -217,17 +217,18 @@ struct aout_sys_t
 static const uint32_t pi_channels_src[] =
     { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
       AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT,
-      AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
+      AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER,
       AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 };
 static const uint32_t pi_channels_in[] =
     { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
       SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT,
-      SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT,
+      SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, SPEAKER_BACK_CENTER,
       SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, 0 };
 static const uint32_t pi_channels_out[] =
     { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
       SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY,
       SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT,
+      SPEAKER_BACK_CENTER,
       SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, 0 };
 
 /*****************************************************************************
index 9bcf02bd574e7977b89ad6b2f1c86ece75c72632..650cd8a51ccee2458437cd2d4c05bb763c7752f5 100644 (file)
@@ -132,11 +132,6 @@ static const uint32_t pi_4channels_in[] =
 static const uint32_t pi_3channels_in[] =
 { AOUT_CHAN_LEFT, AOUT_CHAN_CENTER, AOUT_CHAN_RIGHT, 0 };
 
-/* our internal channel order (WG-4 order) */
-static const uint32_t pi_channels_out[] =
-{ AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT, AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
-  AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 };
-
 /****************************************************************************
  * Local prototypes
  ****************************************************************************/
@@ -736,12 +731,12 @@ static void ConfigureChannelOrder(int *pi_chan_table, int i_channels, uint32_t i
     }
 
     if( b_decode )
-        aout_CheckChannelReorder( pi_channels_in, pi_channels_out,
+        aout_CheckChannelReorder( pi_channels_in, NULL,
                                   i_channel_mask & AOUT_CHAN_PHYSMASK,
                                   i_channels,
                                   pi_chan_table );
     else
-        aout_CheckChannelReorder( pi_channels_out, pi_channels_in,
+        aout_CheckChannelReorder( NULL, pi_channels_in,
                                   i_channel_mask & AOUT_CHAN_PHYSMASK,
                                   i_channels,
                                   pi_chan_table );
index 8380fab9407b0b42db9059710adc5d3faafaa5ec..3a4fcfefa56f0e8b74195b9ea7a045bcbae36cdf 100644 (file)
@@ -84,18 +84,13 @@ static void FrameInfo_PCM      ( demux_t *, unsigned int *, int * );
 static const uint32_t pi_channels_src[] =
     { WAVE_SPEAKER_FRONT_LEFT, WAVE_SPEAKER_FRONT_RIGHT,
       WAVE_SPEAKER_FRONT_CENTER, WAVE_SPEAKER_LOW_FREQUENCY,
-      WAVE_SPEAKER_BACK_LEFT, WAVE_SPEAKER_BACK_RIGHT,
+      WAVE_SPEAKER_BACK_LEFT, WAVE_SPEAKER_BACK_RIGHT, WAVE_SPEAKER_BACK_CENTER,
       WAVE_SPEAKER_SIDE_LEFT, WAVE_SPEAKER_SIDE_RIGHT, 0 };
 static const uint32_t pi_channels_in[] =
     { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
       AOUT_CHAN_CENTER, AOUT_CHAN_LFE,
-      AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
+      AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER,
       AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT, 0 };
-static const uint32_t pi_channels_out[] =
-    { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
-      AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT,
-      AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
-      AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 };
 
 /*****************************************************************************
  * Open: check file and initializes structures
@@ -210,7 +205,7 @@ static int Open( vlc_object_t * p_this )
                 p_sys->fmt.i_codec == VLC_FOURCC('a','f','l','t') )
 
             p_sys->b_chan_reorder =
-                aout_CheckChannelReorder( pi_channels_in, pi_channels_out,
+                aout_CheckChannelReorder( pi_channels_in, NULL,
                                           p_sys->i_channel_mask,
                                           p_sys->fmt.audio.i_channels,
                                           p_sys->pi_chan_table );
index 2642131e8b1b66cfa9692556a085b69ad8b7d527..e1a505db604af26408ee1d513712c200e5edafa5 100644 (file)
@@ -83,17 +83,18 @@ struct sout_mux_sys_t
 static const uint32_t pi_channels_src[] =
     { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
       AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT,
-      AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
+      AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER,
       AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 };
 static const uint32_t pi_channels_in[] =
     { WAVE_SPEAKER_FRONT_LEFT, WAVE_SPEAKER_FRONT_RIGHT,
       WAVE_SPEAKER_SIDE_LEFT, WAVE_SPEAKER_SIDE_RIGHT,
-      WAVE_SPEAKER_BACK_LEFT, WAVE_SPEAKER_BACK_RIGHT,
+      WAVE_SPEAKER_BACK_LEFT, WAVE_SPEAKER_BACK_RIGHT, WAVE_SPEAKER_BACK_CENTER,
       WAVE_SPEAKER_FRONT_CENTER, WAVE_SPEAKER_LOW_FREQUENCY, 0 };
 static const uint32_t pi_channels_out[] =
     { WAVE_SPEAKER_FRONT_LEFT, WAVE_SPEAKER_FRONT_RIGHT,
       WAVE_SPEAKER_FRONT_CENTER, WAVE_SPEAKER_LOW_FREQUENCY,
       WAVE_SPEAKER_BACK_LEFT, WAVE_SPEAKER_BACK_RIGHT,
+      WAVE_SPEAKER_BACK_CENTER,
       WAVE_SPEAKER_SIDE_LEFT, WAVE_SPEAKER_SIDE_RIGHT, 0 };
 
 /*****************************************************************************
index 41b40ac0cc7cc1fcec928829d755e46b817a2242..a5ea4e4be21e9e941c97e7077423d29d598675da 100644 (file)
@@ -537,7 +537,13 @@ int aout_CheckChannelReorder( const uint32_t *pi_chan_order_in,
     bool b_chan_reorder = false;
     int i, j, k, l;
 
-    if( i_channels > AOUT_CHAN_MAX ) return false;
+    if( i_channels > AOUT_CHAN_MAX )
+        return false;
+
+    if( pi_chan_order_in == NULL )
+        pi_chan_order_in = pi_vlc_chan_order_wg4;
+    if( pi_chan_order_out == NULL )
+        pi_chan_order_out = pi_vlc_chan_order_wg4;
 
     for( i = 0, j = 0; pi_chan_order_in[i]; i++ )
     {