]> git.sesse.net Git - vlc/commitdiff
* Fixed filters which couldn't work with more than 2 channels ;
authorChristophe Massiot <massiot@videolan.org>
Tue, 15 Oct 2002 23:10:54 +0000 (23:10 +0000)
committerChristophe Massiot <massiot@videolan.org>
Tue, 15 Oct 2002 23:10:54 +0000 (23:10 +0000)
* Fixed detection of VCD support under OS X.2.

16 files changed:
configure.ac.in
modules/audio_filter/converter/fixed32tofloat32.c
modules/audio_filter/converter/fixed32tos16.c
modules/audio_filter/converter/float32tos16.c
modules/audio_filter/converter/float32tos8.c
modules/audio_filter/converter/float32tou16.c
modules/audio_filter/converter/float32tou8.c
modules/audio_filter/converter/s16tofloat32.c
modules/audio_filter/converter/s16tofloat32swab.c
modules/audio_filter/resampler/trivial.c
modules/audio_filter/resampler/ugly.c
modules/audio_mixer/float32.c
modules/audio_mixer/trivial.c
modules/codec/lpcm.c
modules/codec/mad/libmad.c
modules/codec/mpeg_audio/decoder.c

index 52aab2106c2aa3dc88c0009780d148d8bef1458a..ac28d973f09b691c4b28b8d7b85f0bffd3c239d0 100644 (file)
@@ -985,7 +985,7 @@ then
 
   if test "x${SYS}" = "xdarwin"
   then
-    # No need to add vcd to PLUGINS, Darwin is already based on FreeBSD
+    PLUGINS="${PLUGINS} vcd"
     LDFLAGS_vcd="${LDFLAGS_vcd} -framework IOKit -framework CoreFoundation"
   fi
 fi
index 4958db74874fbf5e889f0af7c5a7fd3e9446780c..c95fafdc2a90b971397ce8d96b7a8f5d61fd18be 100644 (file)
@@ -2,7 +2,7 @@
  * fixed32float32.c : converter from fixed32 to float32 bits integer
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: fixed32tofloat32.c,v 1.9 2002/09/30 21:32:32 massiot Exp $
+ * $Id: fixed32tofloat32.c,v 1.10 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
  *
@@ -85,7 +85,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     vlc_fixed_t * p_in = (vlc_fixed_t *)p_in_buf->p_buffer;
     float * p_out = (float *)p_out_buf->p_buffer;
 
-    for ( i = p_in_buf->i_nb_samples * p_filter->input.i_channels ; i-- ; )
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ) ; i-- ; )
     {
         *p_out++ = (float)*p_in++ / (float)FIXED32_ONE;
     }
index 2070f248d36dbaf94672a8f4f6a1a050ed7a9da7..2095a51c5a36ce815615d82f24b01b3d30213308 100644 (file)
@@ -2,7 +2,7 @@
  * fixed32tos16.c : converter from fixed32 to signed 16 bits integer
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: fixed32tos16.c,v 1.6 2002/09/30 21:32:32 massiot Exp $
+ * $Id: fixed32tos16.c,v 1.7 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
  *
@@ -199,7 +199,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     s16 sample;
 //    static struct audio_dither dither;
 
-    for ( i = p_in_buf->i_nb_samples * p_filter->input.i_channels ; i-- ; )
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ) ; i-- ; )
     {
         /* Accurate scaling */
 //        p_out = mpg321_s24_to_s16_pcm(16, *p_in++, &dither);
index b4963453c34e80d96de1266e9dceade7042d023b..7cd0eb5da3186eca66c5bc1494e04873f0cc3cee 100644 (file)
@@ -2,7 +2,7 @@
  * float32tos16.c : converter from float32 to signed 16 bits integer
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: float32tos16.c,v 1.10 2002/09/30 21:32:32 massiot Exp $
+ * $Id: float32tos16.c,v 1.11 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -83,7 +83,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     float * p_in = (float *)p_in_buf->p_buffer;
     s16 * p_out = (s16 *)p_out_buf->p_buffer;
 
-    for ( i = p_in_buf->i_nb_samples * p_filter->input.i_channels ; i-- ; )
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
     {
 #if 0
         /* Slow version. */
index ec2943f455c5e91f15f2fcfd8b7bd1419a5aecb3..cf635228dab6e7b9fb8af1019e2b7eaa8f7495d4 100644 (file)
@@ -2,7 +2,7 @@
  * float32tos8.c : converter from float32 to signed 8 bits integer
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: float32tos8.c,v 1.5 2002/09/30 21:32:32 massiot Exp $
+ * $Id: float32tos8.c,v 1.6 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Xavier Maillard <zedek@fxgsproject.org>
  *
@@ -85,7 +85,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     float * p_in = (float *)p_in_buf->p_buffer;
     s8 * p_out = (s8 *)p_out_buf->p_buffer;
 
-    for ( i = 0; i < p_in_buf->i_nb_samples * p_filter->input.i_channels; i++ )
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
     {
         if ( *p_in >= 1.0 ) *p_out = 127;
         else if ( *p_in < -1.0 ) *p_out = -128;
index fab694d3ac4429687170281d5b48e09e83a445e2..cd78a50116b839f26c7315bcdb974aeaa20d8615 100644 (file)
@@ -2,7 +2,7 @@
  * float32tou16.c : converter from float32 to unsigned 16 bits integer
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: float32tou16.c,v 1.5 2002/09/30 21:32:32 massiot Exp $
+ * $Id: float32tou16.c,v 1.6 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Xavier Maillard <zedek@fxgsproject.org>
  *
@@ -85,7 +85,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     float * p_in = (float *)p_in_buf->p_buffer;
     u16 * p_out = (u16 *)p_out_buf->p_buffer;
 
-    for ( i = 0; i < p_in_buf->i_nb_samples * p_filter->input.i_channels; i++ )
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
     {
         if ( *p_in >= 1.0 ) *p_out = 65535;
         else if ( *p_in < -1.0 ) *p_out = 0;
index ff5f74c93b7dca8445d153b74e5c4c16a0b41bbd..477ab130a30fbda38b845e505dbca3e9b3f8b1c4 100644 (file)
@@ -2,7 +2,7 @@
  * float32tou8.c : converter from float32 to unsigned 8 bits integer
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: float32tou8.c,v 1.5 2002/09/30 21:32:32 massiot Exp $
+ * $Id: float32tou8.c,v 1.6 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Xavier Maillard <zedek@fxgsproject.org>
  *
@@ -85,7 +85,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     float * p_in = (float *)p_in_buf->p_buffer;
     u8 * p_out = (u8 *)p_out_buf->p_buffer;
 
-    for ( i = 0; i < p_in_buf->i_nb_samples * p_filter->input.i_channels; i++ )
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
     {
         if ( *p_in >= 1.0 ) *p_out = 255;
         else if ( *p_in < -1.0 ) *p_out = 0;
index aee7485ae74eff45d7bf0b0f2790c53d2ebf2264..ef4a85f27765708a6f3e7bfa4edd33a85ede70de 100644 (file)
@@ -2,7 +2,7 @@
  * s16tofloat32.c : converter from signed 16 bits integer to float32
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: s16tofloat32.c,v 1.3 2002/09/30 21:32:32 massiot Exp $
+ * $Id: s16tofloat32.c,v 1.4 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -81,7 +81,7 @@ static int Create( vlc_object_t *p_this )
 static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
                     aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
 {
-    int i = p_in_buf->i_nb_samples * p_filter->input.i_channels;
+    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
 
     /* We start from the end because b_in_place is true */
     s16 * p_in = (s16 *)p_in_buf->p_buffer + i - 1;
index cbae051c430d4b76c889edf6bc490ba5c703ee8b..cebfbea2bddea9fc928c648fcff6bc91e4c1ddaf 100644 (file)
@@ -3,7 +3,7 @@
  *                      with endianness change
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: s16tofloat32swab.c,v 1.6 2002/09/30 21:32:32 massiot Exp $
+ * $Id: s16tofloat32swab.c,v 1.7 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Henri Fallon <henri@videolan.org>
@@ -95,7 +95,7 @@ static int Create( vlc_object_t *p_this )
 static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
                     aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
 {
-    int i = p_in_buf->i_nb_samples * p_filter->input.i_channels;
+    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
 
     /* We start from the end because b_in_place is true */
     s16 * p_in;
index d90fc8cc5daed51fc3ce6d73bbbc4d3328cd00da..11752df5cd09e55f3e05b91e5e9348cff9f011a8 100644 (file)
@@ -2,7 +2,7 @@
  * trivial.c : trivial resampler (skips samples or pads with zeroes)
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: trivial.c,v 1.6 2002/09/30 21:32:32 massiot Exp $
+ * $Id: trivial.c,v 1.7 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -80,7 +80,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     int i_in_nb = p_in_buf->i_nb_samples;
     int i_out_nb = i_in_nb * p_filter->output.i_rate
                     / p_filter->input.i_rate;
-    int i_frame_bytes = p_filter->input.i_channels * sizeof(s32);
+    int i_frame_bytes = aout_FormatNbChannels( &p_filter->input ) * sizeof(s32);
 
     if ( p_out_buf != p_in_buf )
     {
index 6457f94ecf36d7a774fa69cc2537e5e0c811a4fc..a792af75bf8e8b72a6705e0c1586dfc2873c364f 100644 (file)
@@ -2,7 +2,7 @@
  * ugly.c : ugly resampler (changes pitch)
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: ugly.c,v 1.3 2002/09/30 21:32:32 massiot Exp $
+ * $Id: ugly.c,v 1.4 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -80,25 +80,26 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     s32* p_in = (s32*)p_in_buf->p_buffer;
     s32* p_out = (s32*)p_out_buf->p_buffer;
 
+    int i_nb_channels = aout_FormatNbChannels( &p_filter->input );
     int i_in_nb = p_in_buf->i_nb_samples;
     int i_out_nb = i_in_nb * p_filter->output.i_rate
                     / p_filter->input.i_rate;
-    int i_frame_bytes = p_filter->input.i_channels * sizeof(s32);
+    int i_frame_bytes = i_nb_channels * sizeof(s32);
     int i_out, i_chan, i_remainder = 0;
 
     for( i_out = i_out_nb ; i_out-- ; )
     {
-        for( i_chan = p_filter->input.i_channels ; i_chan ; )
+        for( i_chan = i_nb_channels ; i_chan ; )
         {
             i_chan--;
             p_out[i_chan] = p_in[i_chan];
         }
-        p_out += p_filter->input.i_channels;
+        p_out += i_nb_channels;
 
         i_remainder += p_filter->input.i_rate;
         while( i_remainder >= p_filter->output.i_rate )
         {
-            p_in += p_filter->input.i_channels;
+            p_in += i_nb_channels;
             i_remainder -= p_filter->output.i_rate;
         }
     }
index 154286d5cfe9c4b9f3f0f2c941704eb4a0fdc0c8..1e72e9a1818c6f5eef84d4d507d582255d3f635a 100644 (file)
@@ -2,7 +2,7 @@
  * float32.c : precise float32 audio mixer implementation
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: float32.c,v 1.5 2002/09/30 21:32:32 massiot Exp $
+ * $Id: float32.c,v 1.6 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -112,11 +112,11 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
     int i_nb_inputs = p_aout->i_nb_inputs;
     float f_multiplier = p_aout->mixer.f_multiplier;
     int i_input;
+    int i_nb_channels = aout_FormatNbChannels( &p_aout->mixer.mixer );
 
     for ( i_input = 0; i_input < i_nb_inputs; i_input++ )
     {
-        int i_nb_words = p_buffer->i_nb_samples
-                          * p_aout->mixer.mixer.i_channels;
+        int i_nb_words = p_buffer->i_nb_samples * i_nb_channels;
         aout_input_t * p_input = p_aout->pp_inputs[i_input];
         float * p_out = (float *)p_buffer->p_buffer;
         float * p_in = (float *)p_input->p_first_byte_to_mix;
@@ -128,7 +128,7 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
             ptrdiff_t i_available_words = (
                  (float *)p_input->fifo.p_first->p_buffer - p_in)
                                    + p_input->fifo.p_first->i_nb_samples
-                                   * p_aout->mixer.mixer.i_channels;
+                                   * i_nb_channels;
 
             if ( i_available_words < i_nb_words )
             {
index 0a7f1a96796dc71ccf20be5e599ae3d52c7f6928..809620cd68de2939193fd10b06556993358e707c 100644 (file)
@@ -2,7 +2,7 @@
  * trivial.c : trivial mixer plug-in (1 input, no downmixing)
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: trivial.c,v 1.9 2002/09/30 21:32:32 massiot Exp $
+ * $Id: trivial.c,v 1.10 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -73,8 +73,9 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
 {
     int i = 0;
     aout_input_t * p_input = p_aout->pp_inputs[i];
+    int i_nb_channels = aout_FormatNbChannels( &p_aout->mixer.mixer );
     int i_nb_bytes = p_buffer->i_nb_samples * sizeof(s32)
-                      * p_aout->mixer.mixer.i_channels;
+                      * i_nb_channels;
     byte_t * p_in;
     byte_t * p_out;
 
@@ -93,7 +94,7 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
                                         - p_in)
                                         + p_input->fifo.p_first->i_nb_samples
                                            * sizeof(s32)
-                                           * p_aout->mixer.mixer.i_channels;
+                                           * i_nb_channels;
 
         if ( i_available_bytes < i_nb_bytes )
         {
index 766bde83fb8570156478fd636814fc588c331af2..f021d2a3fc92ffef135c4bda5a6ab80b4ec1b17a 100644 (file)
@@ -2,7 +2,7 @@
  * lpcm.c: lpcm decoder module
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: lpcm.c,v 1.4 2002/09/30 21:32:32 massiot Exp $
+ * $Id: lpcm.c,v 1.5 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Henri Fallon <henri@videolan.org>
@@ -127,7 +127,7 @@ static int RunDecoder( decoder_fifo_t * p_fifo )
     /* FIXME : I suppose the number of channel and sampling rate 
      * are somewhere in the headers */
     p_dec->output_format.i_format = VLC_FOURCC('s','1','6','b');
-    p_dec->output_format.i_channels = 2;
+    p_dec->output_format.i_channels = AOUT_CHAN_STEREO;
     p_dec->output_format.i_rate = 48000;
     
     aout_DateInit( &p_dec->end_date, 48000 );
index 17894e539456616f19d893e85c490ace53b7facf..aac249e148ac1369999e015f9cefbceb56d11d95 100644 (file)
@@ -147,12 +147,14 @@ enum mad_flow libmad_output( void *p_data, struct mad_header const *p_header,
     mad_fixed_t const * p_right = p_pcm->samples[1];
     int                 i_samples = p_pcm->length;
     mad_fixed_t *       p_samples;
+    int                 i_channels = (p_pcm->channels == 2) ? AOUT_CHAN_STEREO :
+                                     AOUT_CHAN_MONO;
 
     /* Creating the audio output fifo. Assume the samplerate and nr of channels
      * from the first decoded frame is right for the entire audio track. */
     if( (p_dec->p_aout_input != NULL) &&
         (p_dec->output_format.i_rate != p_pcm->samplerate
-           || p_dec->output_format.i_channels != p_pcm->channels) )
+           || p_dec->output_format.i_channels != i_channels) )
     {
         /* Parameters changed - this should not happen. */
         aout_DecDelete( p_dec->p_aout, p_dec->p_aout_input );
@@ -163,7 +165,7 @@ enum mad_flow libmad_output( void *p_data, struct mad_header const *p_header,
     if( p_dec->p_aout_input == NULL )
     {
         p_dec->output_format.i_rate = p_pcm->samplerate;
-        p_dec->output_format.i_channels = p_pcm->channels;
+        p_dec->output_format.i_channels = i_channels;
         aout_DateInit( &p_dec->end_date, p_pcm->samplerate );
         p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo,
                                            &p_dec->p_aout,
index b23115e40e8b0de931799ddf2080e4716b6ab216..12e21265118d217b8b1fdd8c281ea1b93258ec17 100644 (file)
@@ -2,7 +2,7 @@
  * decoder.c: MPEG audio decoder thread
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: decoder.c,v 1.5 2002/09/30 21:32:32 massiot Exp $
+ * $Id: decoder.c,v 1.6 2002/10/15 23:10:54 massiot Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Michel Lespinasse <walken@via.ecp.fr>
@@ -166,8 +166,9 @@ static void DecodeThread( adec_thread_t * p_dec )
     if( !adec_SyncFrame( p_dec, &sync_info ) )
     {
         /* Create the output fifo if it doesn't exist yet */
-        if( ( p_dec->p_aout_input == NULL )||
-            ( p_dec->output_format.i_channels != ( sync_info.b_stereo ? 2 : 1 ) )||
+        if( ( p_dec->p_aout_input == NULL ) ||
+            ( p_dec->output_format.i_channels !=
+               ( sync_info.b_stereo ? AOUT_CHAN_STEREO : AOUT_CHAN_MONO ) ) ||
             ( p_dec->output_format.i_rate != sync_info.sample_rate ) )
         {
             if( p_dec->p_aout_input )
@@ -179,7 +180,8 @@ static void DecodeThread( adec_thread_t * p_dec )
 
             /* Set output configuration */
             p_dec->output_format.i_format   = VLC_FOURCC('f','l','3','2');
-            p_dec->output_format.i_channels = ( sync_info.b_stereo ? 2 : 1 );
+            p_dec->output_format.i_channels =
+               ( sync_info.b_stereo ? AOUT_CHAN_STEREO : AOUT_CHAN_MONO );
             p_dec->output_format.i_rate     = sync_info.sample_rate;
             aout_DateInit( &p_dec->end_date, sync_info.sample_rate );
             p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo,