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

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


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

chorus_fangler: setup filter_t only when successful

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

 modules/audio_filter/chorus_flanger.c |   24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/modules/audio_filter/chorus_flanger.c b/modules/audio_filter/chorus_flanger.c
index b2f802f..c84b43f 100644
--- a/modules/audio_filter/chorus_flanger.c
+++ b/modules/audio_filter/chorus_flanger.c
@@ -112,25 +112,7 @@ static inline float small_value()
 static int Open( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t*)p_this;
-    filter_sys_t *p_sys;
-
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
-    {
-        msg_Err( p_filter, "input and output formats are not similar" );
-        return VLC_EGENERIC;
-    }
-
-    if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 ||
-        p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
-    {
-        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" );
-    }
-
-    p_filter->pf_audio_filter = DoWork;
-
-    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_ENOMEM;
 
@@ -209,6 +191,10 @@ static int Open( vlc_object_t *p_this )
     }
     p_sys->i_sampleRate = p_filter->fmt_in.audio.i_rate;
 
+    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;
+
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list