Commit c09763be authored by Laurent Aimar's avatar Laurent Aimar

Used date_t instead of audio_date_t in packetizers.

parent b8813031
...@@ -80,7 +80,7 @@ struct decoder_sys_t ...@@ -80,7 +80,7 @@ struct decoder_sys_t
/* /*
* Common properties * Common properties
*/ */
audio_date_t end_date; date_t end_date;
mtime_t i_pts; mtime_t i_pts;
int i_frame_size; int i_frame_size;
...@@ -131,7 +131,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -131,7 +131,7 @@ static int Open( vlc_object_t *p_this )
/* */ /* */
p_sys->i_state = STATE_NOSYNC; p_sys->i_state = STATE_NOSYNC;
aout_DateSet( &p_sys->end_date, 0 ); date_Set( &p_sys->end_date, 0 );
p_sys->bytestream = block_BytestreamInit(); p_sys->bytestream = block_BytestreamInit();
p_sys->b_mlp = false; p_sys->b_mlp = false;
...@@ -168,12 +168,12 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block ) ...@@ -168,12 +168,12 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
p_sys->i_state = STATE_NOSYNC; p_sys->i_state = STATE_NOSYNC;
block_BytestreamEmpty( &p_sys->bytestream ); block_BytestreamEmpty( &p_sys->bytestream );
} }
aout_DateSet( &p_sys->end_date, 0 ); date_Set( &p_sys->end_date, 0 );
block_Release( *pp_block ); block_Release( *pp_block );
return NULL; return NULL;
} }
if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts ) if( !date_Get( &p_sys->end_date ) && !(*pp_block)->i_pts )
{ {
/* We've just started the stream, wait for the first PTS. */ /* We've just started the stream, wait for the first PTS. */
block_Release( *pp_block ); block_Release( *pp_block );
...@@ -213,9 +213,9 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block ) ...@@ -213,9 +213,9 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
/* New frame, set the Presentation Time Stamp */ /* New frame, set the Presentation Time Stamp */
p_sys->i_pts = p_sys->bytestream.p_block->i_pts; p_sys->i_pts = p_sys->bytestream.p_block->i_pts;
if( p_sys->i_pts != 0 && if( p_sys->i_pts != 0 &&
p_sys->i_pts != aout_DateGet( &p_sys->end_date ) ) p_sys->i_pts != date_Get( &p_sys->end_date ) )
{ {
aout_DateSet( &p_sys->end_date, p_sys->i_pts ); date_Set( &p_sys->end_date, p_sys->i_pts );
} }
p_sys->i_state = STATE_HEADER; p_sys->i_state = STATE_HEADER;
...@@ -302,8 +302,8 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block ) ...@@ -302,8 +302,8 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
msg_Info( p_dec, "MLP channels: %d samplerate: %d", msg_Info( p_dec, "MLP channels: %d samplerate: %d",
p_sys->mlp.i_channels, p_sys->mlp.i_rate ); p_sys->mlp.i_channels, p_sys->mlp.i_rate );
aout_DateInit( &p_sys->end_date, p_sys->mlp.i_rate ); date_Init( &p_sys->end_date, p_sys->mlp.i_rate, 1 );
aout_DateSet( &p_sys->end_date, p_sys->i_pts ); date_Set( &p_sys->end_date, p_sys->i_pts );
} }
p_dec->fmt_out.audio.i_rate = p_sys->mlp.i_rate; p_dec->fmt_out.audio.i_rate = p_sys->mlp.i_rate;
...@@ -311,10 +311,10 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block ) ...@@ -311,10 +311,10 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
p_dec->fmt_out.audio.i_original_channels = p_sys->mlp.i_channels_conf; p_dec->fmt_out.audio.i_original_channels = p_sys->mlp.i_channels_conf;
p_dec->fmt_out.audio.i_physical_channels = p_sys->mlp.i_channels_conf & AOUT_CHAN_PHYSMASK; p_dec->fmt_out.audio.i_physical_channels = p_sys->mlp.i_channels_conf & AOUT_CHAN_PHYSMASK;
p_out_buffer->i_pts = p_out_buffer->i_dts = aout_DateGet( &p_sys->end_date ); p_out_buffer->i_pts = p_out_buffer->i_dts = date_Get( &p_sys->end_date );
p_out_buffer->i_length = p_out_buffer->i_length =
aout_DateIncrement( &p_sys->end_date, p_sys->mlp.i_samples ) - p_out_buffer->i_pts; date_Increment( &p_sys->end_date, p_sys->mlp.i_samples ) - p_out_buffer->i_pts;
/* Make sure we don't reuse the same pts twice */ /* Make sure we don't reuse the same pts twice */
if( p_sys->i_pts == p_sys->bytestream.p_block->i_pts ) if( p_sys->i_pts == p_sys->bytestream.p_block->i_pts )
......
...@@ -126,7 +126,7 @@ struct decoder_sys_t ...@@ -126,7 +126,7 @@ struct decoder_sys_t
/* /*
* Common properties * Common properties
*/ */
audio_date_t end_date; date_t end_date;
mtime_t i_pts; mtime_t i_pts;
int i_frame_size; int i_frame_size;
...@@ -205,7 +205,7 @@ static int OpenPacketizer( vlc_object_t *p_this ) ...@@ -205,7 +205,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
/* Misc init */ /* Misc init */
p_sys->i_state = STATE_NOSYNC; p_sys->i_state = STATE_NOSYNC;
aout_DateSet( &p_sys->end_date, 0 ); date_Set( &p_sys->end_date, 0 );
p_sys->bytestream = block_BytestreamInit(); p_sys->bytestream = block_BytestreamInit();
p_sys->b_latm_cfg = false; p_sys->b_latm_cfg = false;
...@@ -243,7 +243,7 @@ static int OpenPacketizer( vlc_object_t *p_this ) ...@@ -243,7 +243,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
p_dec->fmt_out.audio.i_rate, p_dec->fmt_out.audio.i_rate,
p_dec->fmt_out.audio.i_frame_length ); p_dec->fmt_out.audio.i_frame_length );
aout_DateInit( &p_sys->end_date, p_dec->fmt_out.audio.i_rate ); date_Init( &p_sys->end_date, p_dec->fmt_out.audio.i_rate, 1 );
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra; p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
p_dec->fmt_out.p_extra = malloc( p_dec->fmt_in.i_extra ); p_dec->fmt_out.p_extra = malloc( p_dec->fmt_in.i_extra );
...@@ -263,7 +263,7 @@ static int OpenPacketizer( vlc_object_t *p_this ) ...@@ -263,7 +263,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
{ {
msg_Dbg( p_dec, "no decoder specific info, must be an ADTS or LOAS stream" ); msg_Dbg( p_dec, "no decoder specific info, must be an ADTS or LOAS stream" );
aout_DateInit( &p_sys->end_date, p_dec->fmt_in.audio.i_rate ); date_Init( &p_sys->end_date, p_dec->fmt_in.audio.i_rate, 1 );
/* We will try to create a AAC Config from adts/loas */ /* We will try to create a AAC Config from adts/loas */
p_dec->fmt_out.i_extra = 0; p_dec->fmt_out.i_extra = 0;
...@@ -291,7 +291,7 @@ static block_t *PacketizeRawBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -291,7 +291,7 @@ static block_t *PacketizeRawBlock( decoder_t *p_dec, block_t **pp_block )
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{ {
aout_DateSet( &p_sys->end_date, 0 ); date_Set( &p_sys->end_date, 0 );
block_Release( *pp_block ); block_Release( *pp_block );
return NULL; return NULL;
} }
...@@ -299,21 +299,21 @@ static block_t *PacketizeRawBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -299,21 +299,21 @@ static block_t *PacketizeRawBlock( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block; p_block = *pp_block;
*pp_block = NULL; /* Don't reuse this block */ *pp_block = NULL; /* Don't reuse this block */
if( !aout_DateGet( &p_sys->end_date ) && !p_block->i_pts ) if( !date_Get( &p_sys->end_date ) && !p_block->i_pts )
{ {
/* We've just started the stream, wait for the first PTS. */ /* We've just started the stream, wait for the first PTS. */
block_Release( p_block ); block_Release( p_block );
return NULL; return NULL;
} }
else if( p_block->i_pts != 0 && else if( p_block->i_pts != 0 &&
p_block->i_pts != aout_DateGet( &p_sys->end_date ) ) p_block->i_pts != date_Get( &p_sys->end_date ) )
{ {
aout_DateSet( &p_sys->end_date, p_block->i_pts ); date_Set( &p_sys->end_date, p_block->i_pts );
} }
p_block->i_pts = p_block->i_dts = aout_DateGet( &p_sys->end_date ); p_block->i_pts = p_block->i_dts = date_Get( &p_sys->end_date );
p_block->i_length = aout_DateIncrement( &p_sys->end_date, p_block->i_length = date_Increment( &p_sys->end_date,
p_dec->fmt_out.audio.i_frame_length ) - p_block->i_pts; p_dec->fmt_out.audio.i_frame_length ) - p_block->i_pts;
return p_block; return p_block;
...@@ -987,12 +987,12 @@ static block_t *PacketizeStreamBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -987,12 +987,12 @@ static block_t *PacketizeStreamBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->i_state = STATE_NOSYNC; p_sys->i_state = STATE_NOSYNC;
block_BytestreamEmpty( &p_sys->bytestream ); block_BytestreamEmpty( &p_sys->bytestream );
} }
aout_DateSet( &p_sys->end_date, 0 ); date_Set( &p_sys->end_date, 0 );
block_Release( *pp_block ); block_Release( *pp_block );
return NULL; return NULL;
} }
if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts ) if( !date_Get( &p_sys->end_date ) && !(*pp_block)->i_pts )
{ {
/* We've just started the stream, wait for the first PTS. */ /* We've just started the stream, wait for the first PTS. */
block_Release( *pp_block ); block_Release( *pp_block );
...@@ -1043,9 +1043,9 @@ static block_t *PacketizeStreamBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -1043,9 +1043,9 @@ static block_t *PacketizeStreamBlock( decoder_t *p_dec, block_t **pp_block )
/* New frame, set the Presentation Time Stamp */ /* New frame, set the Presentation Time Stamp */
p_sys->i_pts = p_sys->bytestream.p_block->i_pts; p_sys->i_pts = p_sys->bytestream.p_block->i_pts;
if( p_sys->i_pts != 0 && if( p_sys->i_pts != 0 &&
p_sys->i_pts != aout_DateGet( &p_sys->end_date ) ) p_sys->i_pts != date_Get( &p_sys->end_date ) )
{ {
aout_DateSet( &p_sys->end_date, p_sys->i_pts ); date_Set( &p_sys->end_date, p_sys->i_pts );
} }
p_sys->i_state = STATE_HEADER; p_sys->i_state = STATE_HEADER;
break; break;
...@@ -1205,8 +1205,8 @@ static void SetupOutput( decoder_t *p_dec, block_t *p_block ) ...@@ -1205,8 +1205,8 @@ static void SetupOutput( decoder_t *p_dec, block_t *p_block )
msg_Info( p_dec, "AAC channels: %d samplerate: %d", msg_Info( p_dec, "AAC channels: %d samplerate: %d",
p_sys->i_channels, p_sys->i_rate ); p_sys->i_channels, p_sys->i_rate );
aout_DateInit( &p_sys->end_date, p_sys->i_rate ); date_Init( &p_sys->end_date, p_sys->i_rate, 1 );
aout_DateSet( &p_sys->end_date, p_sys->i_pts ); date_Set( &p_sys->end_date, p_sys->i_pts );
} }
p_dec->fmt_out.audio.i_rate = p_sys->i_rate; p_dec->fmt_out.audio.i_rate = p_sys->i_rate;
...@@ -1220,10 +1220,10 @@ static void SetupOutput( decoder_t *p_dec, block_t *p_block ) ...@@ -1220,10 +1220,10 @@ static void SetupOutput( decoder_t *p_dec, block_t *p_block )
p_sys->i_channels_conf & AOUT_CHAN_PHYSMASK; p_sys->i_channels_conf & AOUT_CHAN_PHYSMASK;
#endif #endif
p_block->i_pts = p_block->i_dts = aout_DateGet( &p_sys->end_date ); p_block->i_pts = p_block->i_dts = date_Get( &p_sys->end_date );
p_block->i_length = p_block->i_length =
aout_DateIncrement( &p_sys->end_date, p_sys->i_frame_length ) - p_block->i_pts; date_Increment( &p_sys->end_date, p_sys->i_frame_length ) - p_block->i_pts;
} }
/***************************************************************************** /*****************************************************************************
......
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