Commit 696fa37a authored by Rafaël Carré's avatar Rafaël Carré

AAC packetizer: move functions around file

parent 89646284
......@@ -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);
}
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