[vlc-commits] param_eq: setup filter_t only when successful

Rémi Denis-Courmont git at videolan.org
Tue Nov 6 18:39:29 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov  6 19:37:48 2012 +0200| [51a324b04f5bd52c748643a3ea7fe756162429c8] | committer: Rémi Denis-Courmont

param_eq: setup filter_t only when successful

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

 modules/audio_filter/param_eq.c |   27 +++------------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/modules/audio_filter/param_eq.c b/modules/audio_filter/param_eq.c
index 3ef8e42..c43e3dd 100644
--- a/modules/audio_filter/param_eq.c
+++ b/modules/audio_filter/param_eq.c
@@ -106,36 +106,15 @@ struct filter_sys_t
 static int Open( vlc_object_t *p_this )
 {
     filter_t     *p_filter = (filter_t *)p_this;
-    filter_sys_t *p_sys;
-    bool         b_fit = true;
     unsigned     i_samplerate;
 
-    if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 ||
-        p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
-    {
-        b_fit = false;
-        p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
-        p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
-        msg_Warn( p_filter, "bad input or output format" );
-    }
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
-    {
-        b_fit = false;
-        memcpy( &p_filter->fmt_out.audio, &p_filter->fmt_in.audio,
-                sizeof(audio_sample_format_t) );
-        msg_Warn( p_filter, "input and output formats are not similar" );
-    }
-
-    if ( ! b_fit )
-    {
-        return VLC_EGENERIC;
-    }
-
     /* Allocate structure */
-    p_sys = p_filter->p_sys = malloc( sizeof( *p_sys ) );
+    filter_sys_t *p_sys = p_filter->p_sys = malloc( sizeof( *p_sys ) );
     if( !p_sys )
         return VLC_EGENERIC;
 
+    p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
+    p_filter->fmt_out.audio = p_filter->fmt_in.audio;
     p_filter->pf_audio_filter = DoWork;
 
     p_sys->f_lowf = var_InheritFloat( p_this, "param-eq-lowf");



More information about the vlc-commits mailing list