static int Open( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
- decoder_sys_t *p_sys = p_dec->p_sys;
+ decoder_sys_t *p_sys;
faacDecConfiguration *cfg;
if( p_dec->fmt_in.i_codec != VLC_CODEC_MP4A )
date_Set( &p_sys->date, 0 );
p_dec->fmt_out.i_cat = AUDIO_ES;
- if (HAVE_FPU)
- p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
- else
- p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
- p_dec->pf_decode_audio = DecodeBlock;
+ p_dec->fmt_out.i_codec = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_S16N;
p_dec->fmt_out.audio.i_physical_channels =
p_dec->fmt_out.audio.i_original_channels = 0;
/* Set the faad config */
cfg = faacDecGetCurrentConfiguration( p_sys->hfaad );
- if (HAVE_FPU)
- cfg->outputFormat = FAAD_FMT_FLOAT;
- else
- cfg->outputFormat = FAAD_FMT_16BIT;
+ cfg->outputFormat = HAVE_FPU ? FAAD_FMT_FLOAT : FAAD_FMT_16BIT;
faacDecSetConfiguration( p_sys->hfaad, cfg );
/* buffer */
p_dec->b_need_packetized = true;
p_sys->b_sbr = p_sys->b_ps = false;
+
+ p_dec->pf_decode_audio = DecodeBlock;
return VLC_SUCCESS;
}
{
msg_Warn( p_dec, "%s", faacDecGetErrorMessage( frame.error ) );
- if( frame.error == 21 )
+ if( frame.error == 21 || frame.error == 12 )
{
/*
- * Once an "Unexpected channel configuration change" error
+ * Once an "Unexpected channel configuration change"
+ * or a "Invalid number of channels" error
* occurs, it will occurs afterwards, and we got no sound.
* Reinitialization of the decoder is required.
*/