]> git.sesse.net Git - vlc/blobdiff - modules/audio_filter/equalizer.c
Bug fix and change in parse function
[vlc] / modules / audio_filter / equalizer.c
index 43bf73ef3574439fb76de80a13d2a86a36224e68..ad099b15608d51d759d1edb85ea01a9e8a180905 100644 (file)
@@ -91,7 +91,7 @@ vlc_module_end();
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-
+#define EQZ_BANDS_MAX 10
 typedef struct aout_filter_sys_t
 {
     /* Filter static config */
@@ -210,7 +210,7 @@ typedef struct
         float f_alpha;
         float f_beta;
         float f_gamma;
-    } band[0];
+    } band[EQZ_BANDS_MAX];
 
 } eqz_config_t;
 
@@ -253,7 +253,7 @@ typedef struct
     char *psz_name;
     int  i_band;
     float f_preamp;
-    float f_amp[0];
+    float f_amp[EQZ_BANDS_MAX];
 } eqz_preset_t;
 
 static const eqz_preset_t eqz_preset_flat_10b=
@@ -472,6 +472,11 @@ static int EqzInit( aout_filter_t *p_filter, int i_rate )
     /* 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)
+    {
+        msg_Err(p_filter, "No preset selected");
+        return (VLC_EGENERIC);
+    }
     if( ( *(val2.psz_string) &&
         strstr( p_sys->psz_newbands, val2.psz_string ) ) || !*val2.psz_string )
     {
@@ -668,7 +673,7 @@ static int BandsCallback( vlc_object_t *p_this, char const *psz_cmd,
             p_sys->f_amp[i] = EqzConvertdB( f );
 
             if( !*p ) break; /* end of line */
-            p++;
+            p=p_next+1;
         }
     }