vlc | branch: master | Steve Lhomme <[email protected]> | Mon Jul 10 16:07:41 2017 +0200| [580c27bed283d9840b873e760fbe438dd161e41a] | committer: Jean-Baptiste Kempf
modules:decoders: fill the fmt_out only when everything is OK Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=580c27bed283d9840b873e760fbe438dd161e41a --- modules/codec/faad.c | 10 +++++----- modules/codec/mpg123.c | 3 +-- modules/codec/oggspots.c | 6 +++--- modules/codec/subsdec.c | 6 +++--- modules/codec/uleaddvaudio.c | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/codec/faad.c b/modules/codec/faad.c index db0e29d158..8237168c5b 100644 --- a/modules/codec/faad.c +++ b/modules/codec/faad.c @@ -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 ) diff --git a/modules/codec/mpg123.c b/modules/codec/mpg123.c index 4ab9d6cd5f..a0ef536911 100644 --- a/modules/codec/mpg123.c +++ b/modules/codec/mpg123.c @@ -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; diff --git a/modules/codec/oggspots.c b/modules/codec/oggspots.c index c6601ba1ae..4683b4c9b9 100644 --- a/modules/codec/oggspots.c +++ b/modules/codec/oggspots.c @@ -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; diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c index 27537b507c..864de27d9d 100644 --- a/modules/codec/subsdec.c +++ b/modules/codec/subsdec.c @@ -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; diff --git a/modules/codec/uleaddvaudio.c b/modules/codec/uleaddvaudio.c index b6bff684e9..665fd124eb 100644 --- a/modules/codec/uleaddvaudio.c +++ b/modules/codec/uleaddvaudio.c @@ -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 = _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
