[vlc-commits] aout: small cleanup

Rémi Denis-Courmont git at videolan.org
Tue May 31 17:36:01 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue May 31 18:02:34 2011 +0300| [33b89791981de596c4b77147b591b775764d4d92] | committer: Rémi Denis-Courmont

aout: small cleanup

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

 src/audio_output/output.c |   55 +++++++++++++++++++++-----------------------
 src/libvlc-module.c       |    4 +-
 2 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 2f4397b..223aec7 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -43,14 +43,11 @@
 int aout_OutputNew( aout_instance_t * p_aout,
                     audio_sample_format_t * p_format )
 {
+    p_aout->output.output = *p_format;
+
     /* Retrieve user defaults. */
     int i_rate = var_InheritInteger( p_aout, "aout-rate" );
-    vlc_value_t val, text;
-    /* kludge to avoid a fpu error when rate is 0... */
-    if( i_rate == 0 ) i_rate = -1;
-
-    memcpy( &p_aout->output.output, p_format, sizeof(audio_sample_format_t) );
-    if ( i_rate != -1 )
+    if ( i_rate != 0 )
         p_aout->output.output.i_rate = i_rate;
     aout_FormatPrepare( &p_aout->output.output );
 
@@ -66,36 +63,34 @@ int aout_OutputNew( aout_instance_t * p_aout,
              (VLC_VAR_INTEGER | VLC_VAR_HASCHOICE) )
     {
         /* The user may have selected a different channels configuration. */
-        var_Get( p_aout, "audio-channels", &val );
-
-        if ( val.i_int == AOUT_VAR_CHAN_RSTEREO )
-        {
-            p_aout->output.output.i_original_channels |=
-                                        AOUT_CHAN_REVERSESTEREO;
-        }
-        else if ( val.i_int == AOUT_VAR_CHAN_STEREO )
-        {
-            p_aout->output.output.i_original_channels =
-                AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
-        }
-        else if ( val.i_int == AOUT_VAR_CHAN_LEFT )
+        switch( var_InheritInteger( p_aout, "audio-channels" ) )
         {
-            p_aout->output.output.i_original_channels = AOUT_CHAN_LEFT;
-        }
-        else if ( val.i_int == AOUT_VAR_CHAN_RIGHT )
-        {
-            p_aout->output.output.i_original_channels = AOUT_CHAN_RIGHT;
-        }
-        else if ( val.i_int == AOUT_VAR_CHAN_DOLBYS )
-        {
-            p_aout->output.output.i_original_channels
-                = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_DOLBYSTEREO;
+            case AOUT_VAR_CHAN_RSTEREO:
+                p_aout->output.output.i_original_channels |=
+                                                       AOUT_CHAN_REVERSESTEREO;
+                break;
+            case AOUT_VAR_CHAN_STEREO:
+                p_aout->output.output.i_original_channels =
+                                              AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
+                break;
+            case AOUT_VAR_CHAN_LEFT:
+                p_aout->output.output.i_original_channels = AOUT_CHAN_LEFT;
+                break;
+            case AOUT_VAR_CHAN_RIGHT:
+                p_aout->output.output.i_original_channels = AOUT_CHAN_RIGHT;
+                break;
+            case AOUT_VAR_CHAN_DOLBYS:
+                p_aout->output.output.i_original_channels =
+                      AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_DOLBYSTEREO;
+                break;
         }
     }
     else if ( p_aout->output.output.i_physical_channels == AOUT_CHAN_CENTER
               && (p_aout->output.output.i_original_channels
                    & AOUT_CHAN_PHYSMASK) == (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) )
     {
+        vlc_value_t val, text;
+
         /* Mono - create the audio-channels variable. */
         var_Create( p_aout, "audio-channels",
                     VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
@@ -122,6 +117,8 @@ int aout_OutputNew( aout_instance_t * p_aout,
                 && (p_aout->output.output.i_original_channels &
                      (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)) )
     {
+        vlc_value_t val, text;
+
         /* Stereo - create the audio-channels variable. */
         var_Create( p_aout, "audio-channels",
                     VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 3756b10..7ea88ba 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -277,7 +277,7 @@ static const char *const ppsz_snap_formats[] =
 #define AOUT_RATE_TEXT N_("Audio output frequency (Hz)")
 #define AOUT_RATE_LONGTEXT N_( \
     "You can force the audio output frequency here. Common values are " \
-    "-1 (default), 48000, 44100, 32000, 22050, 16000, 11025, 8000.")
+    "0 (undefined), 48000, 44100, 32000, 22050, 16000, 11025, 8000.")
 
 #if !defined( __APPLE__ )
 #define AOUT_RESAMP_TEXT N_("High quality audio resampling")
@@ -1600,7 +1600,7 @@ vlc_module_begin ()
     add_integer_with_range( "volume-step", AOUT_VOLUME_STEP, AOUT_VOLUME_MIN,
                             AOUT_VOLUME_MAX, VOLUME_STEP_TEXT,
                             VOLUME_STEP_LONGTEXT, true )
-    add_integer( "aout-rate", -1, AOUT_RATE_TEXT,
+    add_integer( "aout-rate", 0, AOUT_RATE_TEXT,
                  AOUT_RATE_LONGTEXT, true )
 #if HAVE_FPU && !defined( __APPLE__ )
     add_bool( "hq-resampling", 1, AOUT_RESAMP_TEXT,



More information about the vlc-commits mailing list