Commit 3fc1801a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

spatializer: setup filter_t only on success

parent cf34a476
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment