Commit 580c27be authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

modules:decoders: fill the fmt_out only when everything is OK

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 5f03dad1
......@@ -130,11 +130,6 @@ static int Open( vlc_object_t *p_this )
/* Misc init */
date_Set( &p_sys->date, 0 );
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;
if( p_dec->fmt_in.i_extra > 0 )
{
/* We have a decoder config so init the handle */
......@@ -160,11 +155,16 @@ static int Open( vlc_object_t *p_this )
}
else
{
p_dec->fmt_out.audio.i_physical_channels
= p_dec->fmt_out.audio.i_original_channels
= 0;
/* Will be initalised from first frame */
p_dec->fmt_out.audio.i_rate = 0;
p_dec->fmt_out.audio.i_channels = 0;
}
p_dec->fmt_out.i_codec = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_S16N;
/* Set the faad config */
cfg = NeAACDecGetCurrentConfiguration( p_sys->hfaad );
if( p_dec->fmt_in.audio.i_rate )
......
......@@ -372,8 +372,6 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec->fmt_in.i_codec != VLC_CODEC_MP3 )
return VLC_EGENERIC;
p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
/* Initialize libmpg123 */
if( InitMPG123() != MPG123_OK )
return VLC_EGENERIC;
......@@ -389,6 +387,7 @@ static int OpenDecoder( vlc_object_t *p_this )
if( MPG123Open( p_dec ) )
goto error;
p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
p_dec->fmt_out.audio.i_rate = 0; /* So end_date gets initialized */
p_dec->fmt_out.audio.i_format = p_dec->fmt_out.i_codec;
p_dec->pf_decode = DecodeBlock;
......
......@@ -117,9 +117,6 @@ static int OpenDecoder(vlc_object_t* p_this)
p_sys->b_has_headers = false;
p_sys->i_pts = VLC_TS_INVALID;
/* Set output properties */
p_dec->fmt_out.i_codec = VLC_CODEC_RGBA;
/* Initialize image handler */
p_sys->p_image = image_HandlerCreate(p_dec);
if (p_sys->p_image == NULL) {
......@@ -127,6 +124,9 @@ static int OpenDecoder(vlc_object_t* p_this)
return VLC_ENOMEM;
}
/* Set output properties */
p_dec->fmt_out.i_codec = VLC_CODEC_RGBA;
/* Set callbacks */
p_dec->pf_decode = DecodeVideo;
p_dec->pf_packetize = Packetize;
......
......@@ -233,14 +233,14 @@ static int OpenDecoder( vlc_object_t *p_this )
return VLC_EGENERIC;
}
p_dec->pf_decode = DecodeBlock;
p_dec->fmt_out.i_codec = 0;
/* Allocate the memory needed to store the decoder's structure */
p_dec->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) );
if( p_sys == NULL )
return VLC_ENOMEM;
p_dec->pf_decode = DecodeBlock;
p_dec->fmt_out.i_codec = 0;
/* init of p_sys */
p_sys->i_align = 0;
p_sys->iconv_handle = (vlc_iconv_t)-1;
......
......@@ -164,7 +164,7 @@ static int Open(vlc_object_t *object)
(2 + sys->is_12bit) * (i / b) + 8;
}
es_format_Init(&dec->fmt_out, AUDIO_ES, VLC_CODEC_S16N);
dec->fmt_out.i_codec = VLC_CODEC_S16N;
dec->fmt_out.audio.i_rate = dec->fmt_in.audio.i_rate;
dec->fmt_out.audio.i_channels = 2;
dec->fmt_out.audio.i_physical_channels =
......
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