From: Laurent Aimar Date: Mon, 29 Mar 2004 14:21:47 +0000 (+0000) Subject: * mpeg_audio: fixed input infos update, and removed all tabs. X-Git-Tag: 0.7.2~558 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=f1c9b20a620b2622ebd187e08ef856a7a93f11e5;p=vlc * mpeg_audio: fixed input infos update, and removed all tabs. (each vlc_object_find has to be followed by a vlc_object_release once the object isn't needed anymore) Btw, I think we should better do that update in src/input/input_dec.c, this way it will work with every decoder AND a decoder should not touch p_input (decoders will be used by transcode for instance ...) --- diff --git a/modules/codec/mpeg_audio.c b/modules/codec/mpeg_audio.c index 59f7af3594..9af3348b3e 100644 --- a/modules/codec/mpeg_audio.c +++ b/modules/codec/mpeg_audio.c @@ -28,6 +28,7 @@ * Preamble *****************************************************************************/ #include +#include /* for input infos */ #include #include @@ -465,29 +466,33 @@ static uint8_t *GetOutBuffer( decoder_t *p_dec, void **pp_out_buffer ) { #define TITLE_MAX 30 input_info_category_t *p_cat; - char psz_streamid[TITLE_MAX]; - int i_es_id = p_dec->fmt_out.i_id; - input_thread_t * p_input = vlc_object_find( p_dec, VLC_OBJECT_INPUT, - FIND_PARENT ); + char psz_streamid[TITLE_MAX]; + int i_es_id = p_dec->fmt_out.i_id; + input_thread_t * p_input = vlc_object_find( p_dec, VLC_OBJECT_INPUT, FIND_PARENT ); - snprintf(psz_streamid, TITLE_MAX, "%s%04x", _("Stream "), i_es_id); - p_cat = input_InfoCategory( p_input, psz_streamid ); + if( p_input ) + { + snprintf(psz_streamid, TITLE_MAX, "%s%04x", _("Stream "), i_es_id); + p_cat = input_InfoCategory( p_input, psz_streamid ); #if 1 - /* We should be finding this stream, but we aren't. */ - input_AddInfo( p_cat, _("Type"), "%s", _("audio") ); - input_AddInfo( p_cat, _("Description"), "%s", _("MPEG audio") ); + /* We should be finding this stream, but we aren't. */ + input_AddInfo( p_cat, _("Type"), "%s", _("audio") ); + input_AddInfo( p_cat, _("Description"), "%s", _("MPEG audio") ); #endif - input_AddInfo( p_cat, _("Sample Rate"), "%d", p_sys->i_rate ); - input_AddInfo( p_cat, _("Bit Rate"), "%d", p_sys->i_bit_rate ); - input_AddInfo( p_cat, _("Channel(s)"), "%d", p_sys->i_channels ); + input_AddInfo( p_cat, _("Sample Rate"), "%d", p_sys->i_rate ); + input_AddInfo( p_cat, _("Bit Rate"), "%d", p_sys->i_bit_rate ); + input_AddInfo( p_cat, _("Channel(s)"), "%d", p_sys->i_channels ); + + msg_Info( p_dec, "MPGA channels:%d samplerate:%d bitrate:%d", + p_sys->i_channels, p_sys->i_rate, p_sys->i_bit_rate ); - msg_Info( p_dec, "MPGA channels:%d samplerate:%d bitrate:%d", - p_sys->i_channels, p_sys->i_rate, p_sys->i_bit_rate ); + aout_DateInit( &p_sys->end_date, p_sys->i_rate ); + aout_DateSet( &p_sys->end_date, p_sys->i_pts ); - aout_DateInit( &p_sys->end_date, p_sys->i_rate ); - aout_DateSet( &p_sys->end_date, p_sys->i_pts ); + vlc_object_release( p_input ); + } } p_dec->fmt_out.audio.i_rate = p_sys->i_rate;