[vlc-commits] spatializer: setup filter_t only on success

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


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

spatializer: setup filter_t only on success

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

 modules/audio_filter/spatializer/spatializer.cpp |   21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/modules/audio_filter/spatializer/spatializer.cpp b/modules/audio_filter/spatializer/spatializer.cpp
index dee38c5..5b4bd90 100644
--- a/modules/audio_filter/spatializer/spatializer.cpp
+++ b/modules/audio_filter/spatializer/spatializer.cpp
@@ -134,24 +134,6 @@ static int Open( vlc_object_t *p_this )
     filter_sys_t *p_sys;
     vlc_object_t *p_aout = p_filter->p_parent;
 
-    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" );
-        return VLC_EGENERIC;
-    }
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
-    {
-        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" );
-        return VLC_EGENERIC;
-    }
-
-    p_filter->pf_audio_filter = DoWork;
-
      /* Allocate structure */
     p_sys = p_filter->p_sys = (filter_sys_t*)malloc( sizeof( *p_sys ) );
     if( !p_sys )
@@ -177,6 +159,9 @@ static int Open( vlc_object_t *p_this )
                          callbacks[i].fp_callback, p_sys );
     }
 
+    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