]> git.sesse.net Git - vlc/blobdiff - modules/audio_filter/equalizer.c
input options whitelisting, step 2 (refs #1371)
[vlc] / modules / audio_filter / equalizer.c
index d13ece47ac49c594b652e7231b3c2b135c3a57b5..2d406dcb3d290b6d59a7e5f902310f205abbd8b5 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * equalizer.c:
  *****************************************************************************
- * Copyright (C) 2004 the VideoLAN team
+ * Copyright (C) 2004, 2006 the VideoLAN team
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
 #include <math.h>
 
 #include <vlc/vlc.h>
 
-#include <vlc/aout.h>
-#include "aout_internal.h"
+#include "vlc_aout.h"
 
 #include "equalizer_presets.h"
 /* TODO:
@@ -50,20 +48,24 @@ static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
 #define PRESET_TEXT N_( "Equalizer preset" )
-#define PRESET_LONGTEXT PRESET_TEXT
+#define PRESET_LONGTEXT N_("Preset to use for the equalizer." )
 
 #define BANDS_TEXT N_( "Bands gain")
-#define BANDS_LONGTEXT N_( "Override preset bands gain in dB (-20 ... 20)" )
+#define BANDS_LONGTEXT N_( \
+         "Don't use presets, but manually specified bands. You need to " \
+         "provide 10 values between -20dB and 20dB, separated by spaces, " \
+         "e.g. \"0 2 4 2 0 -2 -4 -2 0\"." )
 
 #define TWOPASS_TEXT N_( "Two pass" )
-#define TWOPASS_LONGTEXT N_( "Filter twice the audio" )
+#define TWOPASS_LONGTEXT N_( "Filter the audio twice. This provides a more "  \
+         "intense effect.")
 
 #define PREAMP_TEXT N_("Global gain" )
-#define PREAMP_LONGTEXT N_("Set the global gain in dB (-20 ... 20)" )
+#define PREAMP_LONGTEXT N_("Set the global gain in dB (-20 ... 20)." )
 
 vlc_module_begin();
-    set_description( _("Equalizer 10 bands") );
-    set_shortname( N_("Equalizer" ) );
+    set_description( _("Equalizer with 10 bands") );
+    set_shortname( _("Equalizer" ) );
     set_capability( "audio filter", 0 );
     set_category( CAT_AUDIO );
     set_subcategory( SUBCAT_AUDIO_AFILTER );
@@ -71,12 +73,16 @@ vlc_module_begin();
     add_string( "equalizer-preset", "flat", NULL, PRESET_TEXT,
                 PRESET_LONGTEXT, VLC_FALSE );
         change_string_list( preset_list, preset_list_text, 0 );
+        change_safe();
     add_string( "equalizer-bands", NULL, NULL, BANDS_TEXT,
                 BANDS_LONGTEXT, VLC_TRUE );
+        change_safe();
     add_bool( "equalizer-2pass", 0, NULL, TWOPASS_TEXT,
               TWOPASS_LONGTEXT, VLC_TRUE );
+        change_safe();
     add_float( "equalizer-preamp", 12.0, NULL, PREAMP_TEXT,
                PREAMP_LONGTEXT, VLC_TRUE );
+        change_safe();
     set_callbacks( Open, Close );
     add_shortcut( "equalizer" );
 vlc_module_end();
@@ -144,7 +150,7 @@ static int Open( vlc_object_t *p_this )
         b_fit = VLC_FALSE;
         p_filter->input.i_format = VLC_FOURCC('f','l','3','2');
         p_filter->output.i_format = VLC_FOURCC('f','l','3','2');
-        msg_Warn( p_filter, "Bad input or output format" );
+        msg_Warn( p_filter, "bad input or output format" );
     }
     if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
     {
@@ -287,7 +293,7 @@ static int EqzInit( aout_filter_t *p_filter, int i_rate )
     else
     {
         /* TODO compute the coeffs on the fly */
-        msg_Err( p_filter, "unsupported rate" );
+        msg_Err( p_filter, "rate not supported" );
         return VLC_EGENERIC;
     }
 
@@ -489,7 +495,7 @@ static int PresetCallback( vlc_object_t *p_this, char const *psz_cmd,
                     div = lldiv( eqz_preset_10b[i]->f_amp[j] * 10000000,
                                  10000000 );
                     sprintf( psz_newbands, "%s "I64Fd".%07u", psz_newbands,
-                                      div.quot, (unsigned int) div.rem );
+                                      (int64_t)div.quot, (unsigned int) div.rem );
                 }
                 if( p_sys->b_first == VLC_FALSE )
                 {