[vlc-commits] normvol: 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:26 2012 +0200| [c9fbe78ae1b0d3ee5eace592041b36092f9476d2] | committer: Rémi Denis-Courmont

normvol: setup filter_t only when successful

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

 modules/audio_filter/normvol.c |   23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/modules/audio_filter/normvol.c b/modules/audio_filter/normvol.c
index 173f58f..5e1f298 100644
--- a/modules/audio_filter/normvol.c
+++ b/modules/audio_filter/normvol.c
@@ -97,25 +97,6 @@ static int Open( vlc_object_t *p_this )
     unsigned i_channels;
     filter_sys_t *p_sys;
 
-    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;
-
     i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio );
 
     p_sys = p_filter->p_sys = malloc( sizeof( *p_sys ) );
@@ -134,6 +115,10 @@ static int Open( vlc_object_t *p_this )
         return VLC_ENOMEM;
     }
 
+    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