X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faudio_filter%2Fequalizer.c;h=a05c34a10217b825c40a884eb9388487e3e673b9;hb=1d906a234d7f14b3eb772b94bce3a5c3bbf01d47;hp=dd8aa67966a5574b3ad87e6d3a0b5ff38e50e3f8;hpb=97897eeeb22b1238e56632b16cda1a0375ae7708;p=vlc diff --git a/modules/audio_filter/equalizer.c b/modules/audio_filter/equalizer.c index dd8aa67966..a05c34a102 100644 --- a/modules/audio_filter/equalizer.c +++ b/modules/audio_filter/equalizer.c @@ -24,13 +24,15 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include +#include + +#include +#include #include "vlc_aout.h" @@ -68,8 +70,8 @@ static void Close( vlc_object_t * ); #define PREAMP_LONGTEXT N_("Set the global gain in dB (-20 ... 20)." ) vlc_module_begin(); - set_description( _("Equalizer with 10 bands") ); - set_shortname( _("Equalizer" ) ); + set_description( N_("Equalizer with 10 bands") ); + set_shortname( N_("Equalizer" ) ); set_capability( "audio filter", 0 ); set_category( CAT_AUDIO ); set_subcategory( SUBCAT_AUDIO_AFILTER ); @@ -336,8 +338,10 @@ static int EqzInit( aout_filter_t *p_filter, int i_rate ) } } - var_CreateGetString( p_aout,"equalizer-bands" ); - var_CreateGetString( p_aout, "equalizer-preset" ); + char *psz_tmp = var_CreateGetString( p_aout,"equalizer-bands" ); + free( psz_tmp ); + psz_tmp = var_CreateGetString( p_aout, "equalizer-preset" ); + free( psz_tmp ); p_sys->b_2eqz = var_CreateGetBool( p_aout, "equalizer-2pass" ); @@ -544,29 +548,33 @@ static int BandsCallback( vlc_object_t *p_this, char const *psz_cmd, VLC_UNUSED(p_this); VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); aout_filter_sys_t *p_sys = (aout_filter_sys_t *)p_data; char *psz_bands = newval.psz_string; + char *psz_next; + char *p = psz_bands; + int i; /* Same thing for bands */ - if( *psz_bands ) + for( i = 0; i < p_sys->i_band; i++ ) { - char *p = psz_bands, *p_next; - int i; + float f; - for( i = 0; i < p_sys->i_band; i++ ) - { - /* Read dB -20/20 */ + if( *psz_bands == '\0' ) + break; + + /* Read dB -20/20 */ #ifdef HAVE_STRTOF - float f = strtof( p, &p_next ); + f = strtof( p, &psz_next ); #else - float f = (float) strtod( p, &p_next ); + f = (float)strtod( p, &psz_next ); #endif - if( !p_next || p_next == p ) break; /* strtof() failed */ + if( psz_next == p ) + break; /* no conversion */ - p_sys->f_amp[i] = EqzConvertdB( f ); + p_sys->f_amp[i] = EqzConvertdB( f ); - if( !*p ) break; /* end of line */ - p=p_next+1; - } + if( *psz_next == '\0' ) + break; /* end of line */ + p = &psz_next[1]; } - return VLC_SUCCESS; } +