]> git.sesse.net Git - vlc/blobdiff - modules/audio_filter/converter/a52tofloat32.c
* include/configuration.h: added a new flag to the configuration stucture to
[vlc] / modules / audio_filter / converter / a52tofloat32.c
index 85a4b61d714232f6227f4d802a80db66b9486371..3d21801e3fb61fdedb41ce3a591807c4c6f8cdc1 100644 (file)
@@ -4,7 +4,7 @@
  *   (http://liba52.sf.net/).
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: a52tofloat32.c,v 1.11 2003/01/22 09:54:28 massiot Exp $
+ * $Id: a52tofloat32.c,v 1.13 2003/02/20 01:52:45 sigmunau Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -82,8 +82,8 @@ struct aout_filter_sys_t
     "listening room.")
 
 vlc_module_begin();
-    add_category_hint( N_("Miscellaneous"), NULL );
-    add_bool( "a52-dynrng", 1, NULL, DYNRNG_TEXT, DYNRNG_LONGTEXT );
+    add_category_hint( N_("Miscellaneous"), NULL, VLC_FALSE );
+    add_bool( "a52-dynrng", 1, NULL, DYNRNG_TEXT, DYNRNG_LONGTEXT, VLC_FALSE );
     set_description( _("ATSC A/52 aka AC-3 audio decoder module") );
     set_capability( "audio filter", 100 );
     set_callbacks( Create, Destroy );
@@ -278,6 +278,22 @@ static void Duplicate( float * p_out, const float * p_in )
     }
 }
 
+/*****************************************************************************
+ * Exchange: helper function to exchange left & right channels
+ *****************************************************************************/
+static void Exchange( float * p_out, const float * p_in )
+{
+    int i;
+    const float * p_first = p_in + 256;
+    const float * p_second = p_in;
+
+    for ( i = 0; i < 256; i++ )
+    {
+        *p_out++ = *p_first++;
+        *p_out++ = *p_second++;
+    }
+}
+
 /*****************************************************************************
  * DoWork: decode an ATSC A/52 frame.
  *****************************************************************************/
@@ -331,6 +347,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
             Duplicate( (float *)(p_out_buf->p_buffer + i * i_bytes_per_block),
                        p_samples );
         }
+        else if ( p_filter->output.i_original_channels
+                    & AOUT_CHAN_REVERSESTEREO )
+        {
+            Exchange( (float *)(p_out_buf->p_buffer + i * i_bytes_per_block),
+                      p_samples );
+        }
         else
         {
             /* Interleave the *$£%ù samples. */