vlc | branch: master | Rafaël Carré <[email protected]> | Fri Nov 8 13:49:48 2013 +0100| [696fa37a6c22576a5c409f7672ca8c363ee5ca2b] | committer: Rafaël Carré
AAC packetizer: move functions around file > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=696fa37a6c22576a5c409f7672ca8c363ee5ca2b --- modules/packetizer/mpeg4audio.c | 90 +++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c index 468b47f..61ce3db 100644 --- a/modules/packetizer/mpeg4audio.c +++ b/modules/packetizer/mpeg4audio.c @@ -258,6 +258,18 @@ static int OpenPacketizer(vlc_object_t *p_this) return VLC_SUCCESS; } +/***************************************************************************** + * ClosePacketizer: clean up the packetizer + *****************************************************************************/ +static void ClosePacketizer(vlc_object_t *p_this) +{ + decoder_t *p_dec = (decoder_t *)p_this; + decoder_sys_t *p_sys = p_dec->p_sys; + + block_BytestreamRelease(&p_sys->bytestream); + free(p_sys); +} + /**************************************************************************** * PacketizeRawBlock: the whole thing **************************************************************************** @@ -863,10 +875,41 @@ static int LOASParse(decoder_t *p_dec, uint8_t *p_buffer, int i_buffer) return i_accumulated; } +/***************************************************************************** + * + *****************************************************************************/ +static void SetupOutput(decoder_t *p_dec, block_t *p_block) +{ + decoder_sys_t *p_sys = p_dec->p_sys; + + if (p_dec->fmt_out.audio.i_rate != p_sys->i_rate) { + msg_Info(p_dec, "AAC channels: %d samplerate: %d", + p_sys->i_channels, p_sys->i_rate); + + const mtime_t i_end_date = date_Get(&p_sys->end_date); + date_Init(&p_sys->end_date, p_sys->i_rate, 1); + date_Set(&p_sys->end_date, i_end_date); + } + + p_dec->fmt_out.audio.i_rate = p_sys->i_rate; + p_dec->fmt_out.audio.i_channels = p_sys->i_channels; + p_dec->fmt_out.audio.i_bytes_per_frame = p_sys->i_frame_size; + p_dec->fmt_out.audio.i_frame_length = p_sys->i_frame_length; + +#if 0 + p_dec->fmt_out.audio.i_original_channels = p_sys->i_channels_conf; + p_dec->fmt_out.audio.i_physical_channels = p_sys->i_channels_conf; +#endif + + p_block->i_pts = p_block->i_dts = date_Get(&p_sys->end_date); + + p_block->i_length = + date_Increment(&p_sys->end_date, p_sys->i_frame_length) - p_block->i_pts; +} + /**************************************************************************** * PacketizeStreamBlock: ADTS/LOAS packetizer ****************************************************************************/ -static void SetupOutput(decoder_t *p_dec, block_t *p_block); static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block) { decoder_sys_t *p_sys = p_dec->p_sys; @@ -1046,48 +1089,3 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block) return NULL; } - -/***************************************************************************** - * SetupBuffer: - *****************************************************************************/ -static void SetupOutput(decoder_t *p_dec, block_t *p_block) -{ - decoder_sys_t *p_sys = p_dec->p_sys; - - if (p_dec->fmt_out.audio.i_rate != p_sys->i_rate) { - msg_Info(p_dec, "AAC channels: %d samplerate: %d", - p_sys->i_channels, p_sys->i_rate); - - const mtime_t i_end_date = date_Get(&p_sys->end_date); - date_Init(&p_sys->end_date, p_sys->i_rate, 1); - date_Set(&p_sys->end_date, i_end_date); - } - - p_dec->fmt_out.audio.i_rate = p_sys->i_rate; - p_dec->fmt_out.audio.i_channels = p_sys->i_channels; - p_dec->fmt_out.audio.i_bytes_per_frame = p_sys->i_frame_size; - p_dec->fmt_out.audio.i_frame_length = p_sys->i_frame_length; - -#if 0 - p_dec->fmt_out.audio.i_original_channels = p_sys->i_channels_conf; - p_dec->fmt_out.audio.i_physical_channels = p_sys->i_channels_conf; -#endif - - p_block->i_pts = p_block->i_dts = date_Get(&p_sys->end_date); - - p_block->i_length = - date_Increment(&p_sys->end_date, p_sys->i_frame_length) - p_block->i_pts; -} - -/***************************************************************************** - * ClosePacketizer: clean up the packetizer - *****************************************************************************/ -static void ClosePacketizer(vlc_object_t *p_this) -{ - decoder_t *p_dec = (decoder_t *)p_this; - decoder_sys_t *p_sys = p_dec->p_sys; - - block_BytestreamRelease(&p_sys->bytestream); - - free(p_dec->p_sys); -} _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
