[vlc-commits] equalizer: fix crash and allow custom eq-band values without known preset

David Fuhrmann git at videolan.org
Wed Apr 3 14:48:47 CEST 2013


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Wed Apr  3 14:15:38 2013 +0200| [68d7d12287ee8dd379adfb478c2fae8bf93dfa84] | committer: David Fuhrmann

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

close #8307

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

 modules/audio_filter/equalizer.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/modules/audio_filter/equalizer.c b/modules/audio_filter/equalizer.c
index 7e75583..2626395 100644
--- a/modules/audio_filter/equalizer.c
+++ b/modules/audio_filter/equalizer.c
@@ -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-preset", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
 
@@ -372,10 +374,8 @@ static int EqzInit( filter_t *p_filter, int i_rate )
 
     free( val1.psz_string );
 
-    /* Register preset bands (for intf) if : */
-    /* 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 == NULL)
+    /* Exit if we have no preset and no bands value */
+    if (p_sys->psz_newbands == NULL && (!val2.psz_string || !*val2.psz_string))
     {
         msg_Err(p_filter, "No preset selected");
         free( val2.psz_string );
@@ -383,8 +383,11 @@ static int EqzInit( filter_t *p_filter, int i_rate )
         i_ret = VLC_EGENERIC;
         goto error;
     }
-    if( ( *(val2.psz_string) &&
-        strstr( p_sys->psz_newbands, val2.psz_string ) ) || !*val2.psz_string )
+    /* Register preset bands (for intf) if : */
+    /* 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 );
         if( p_sys->f_newpreamp == p_sys->f_gamp )



More information about the vlc-commits mailing list