]> git.sesse.net Git - vlc/blobdiff - modules/audio_filter/equalizer.c
* modules/demux/real.c: improved cook support. We now try to send audio subpackets...
[vlc] / modules / audio_filter / equalizer.c
index 7d84289e8c1d3d8db69b5ac1f5fb6f7c919e2efd..e0cb1155a89d73f637cb9044bad271f7e047be2b 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * equalizer.c:
  *****************************************************************************
- * Copyright (C) 2004 VideoLAN
+ * Copyright (C) 2004 the VideoLAN team
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
@@ -63,15 +63,19 @@ static void Close( vlc_object_t * );
 
 vlc_module_begin();
     set_description( _("Equalizer 10 bands") );
+    set_shortname( N_("Equalizer" ) );
     set_capability( "audio filter", 0 );
+    set_category( CAT_AUDIO );
+    set_subcategory( SUBCAT_AUDIO_AFILTER );
+
     add_string( "equalizer-preset", "flat", NULL, PRESET_TEXT,
-                PRESET_LONGTEXT, VLC_TRUE );
+                PRESET_LONGTEXT, VLC_FALSE );
         change_string_list( preset_list, preset_list_text, 0 );
     add_string( "equalizer-bands", NULL, NULL, BANDS_TEXT,
                 BANDS_LONGTEXT, VLC_TRUE );
     add_bool( "equalizer-2pass", 0, NULL, TWOPASS_TEXT,
               TWOPASS_LONGTEXT, VLC_TRUE );
-    add_float( "equalizer-preamp", 0.0, NULL, PREAMP_TEXT,
+    add_float( "equalizer-preamp", 12.0, NULL, PREAMP_TEXT,
                PREAMP_LONGTEXT, VLC_TRUE );
     set_callbacks( Open, Close );
     add_shortcut( "equalizer" );
@@ -132,16 +136,26 @@ static int Open( vlc_object_t *p_this )
 {
     aout_filter_t     *p_filter = (aout_filter_t *)p_this;
     aout_filter_sys_t *p_sys;
+    vlc_bool_t         b_fit = VLC_TRUE;
 
     if( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' ) ||
         p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
     {
+        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" );
-        return VLC_EGENERIC;
     }
     if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
     {
+        b_fit = VLC_FALSE;
+        memcpy( &p_filter->output, &p_filter->input,
+                sizeof(audio_sample_format_t) );
         msg_Warn( p_filter, "input and output formats are not similar" );
+    }
+
+    if ( ! b_fit )
+    {
         return VLC_EGENERIC;
     }
 
@@ -345,7 +359,8 @@ static int EqzInit( aout_filter_t *p_filter, int i_rate )
         strstr( p_sys->psz_newbands, val2.psz_string ) ) || !*val2.psz_string )
     {
         var_SetString( p_aout, "equalizer-bands", p_sys->psz_newbands );
-        var_SetFloat( p_aout, "equalizer-preamp", p_sys->f_newpreamp );
+        if( p_sys->f_newpreamp == p_sys->f_gamp )
+            var_SetFloat( p_aout, "equalizer-preamp", p_sys->f_newpreamp );
     }
 
     /* Add our own callbacks */