Commit 68d7d122 authored by David Fuhrmann's avatar David Fuhrmann

equalizer: fix crash and allow custom eq-band values without known preset

close #8307
parent 13db37f5
...@@ -352,6 +352,8 @@ static int EqzInit( filter_t *p_filter, int i_rate ) ...@@ -352,6 +352,8 @@ static int EqzInit( filter_t *p_filter, int i_rate )
} }
} }
p_sys->psz_newbands = NULL;
var_Create( p_aout, "equalizer-bands", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_aout, "equalizer-bands", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_aout, "equalizer-preset", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_aout, "equalizer-preset", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
...@@ -372,10 +374,8 @@ static int EqzInit( filter_t *p_filter, int i_rate ) ...@@ -372,10 +374,8 @@ static int EqzInit( filter_t *p_filter, int i_rate )
free( val1.psz_string ); free( val1.psz_string );
/* Register preset bands (for intf) if : */ /* Exit if we have no preset and no bands value */
/* We have no bands info --> the preset info must be given to the intf */ if (p_sys->psz_newbands == NULL && (!val2.psz_string || !*val2.psz_string))
/* or The bands info matches the preset */
if (p_sys->psz_newbands == NULL)
{ {
msg_Err(p_filter, "No preset selected"); msg_Err(p_filter, "No preset selected");
free( val2.psz_string ); free( val2.psz_string );
...@@ -383,8 +383,11 @@ static int EqzInit( filter_t *p_filter, int i_rate ) ...@@ -383,8 +383,11 @@ static int EqzInit( filter_t *p_filter, int i_rate )
i_ret = VLC_EGENERIC; i_ret = VLC_EGENERIC;
goto error; goto error;
} }
if( ( *(val2.psz_string) && /* Register preset bands (for intf) if : */
strstr( p_sys->psz_newbands, val2.psz_string ) ) || !*val2.psz_string ) /* We have no bands info --> the preset info must be given to the intf */
/* or The bands info matches the preset */
if( ( p_sys->psz_newbands && *(val2.psz_string) &&
strstr( p_sys->psz_newbands, val2.psz_string ) ) || !*val2.psz_string )
{ {
var_SetString( p_aout, "equalizer-bands", p_sys->psz_newbands ); var_SetString( p_aout, "equalizer-bands", p_sys->psz_newbands );
if( p_sys->f_newpreamp == p_sys->f_gamp ) if( p_sys->f_newpreamp == p_sys->f_gamp )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment