Commit 8146a7f0 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

aout_buffer_t.start_data -> aout_buffer_t.i_pts

This will be needed to replace aout_buffer_t with block_t.
We also need to replace end_date with i_length, which is a bit more
involved.
parent 56ed95e8
......@@ -134,7 +134,7 @@ struct aout_buffer_t
size_t i_size, i_nb_bytes;
unsigned int i_nb_samples;
bool b_discontinuity; /* Set on discontinuity (for non pcm stream) */
mtime_t start_date, end_date;
mtime_t i_pts, end_date;
struct aout_buffer_t * p_next;
void *p_sys;
......
......@@ -146,7 +146,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{
if( p_filter->p_sys->i_frames == 1 )
/* We'll need the starting date */
p_filter->p_sys->start_date = p_in_buf->start_date;
p_filter->p_sys->start_date = p_in_buf->i_pts;
/* Not enough data */
p_out_buf->i_nb_samples = 0;
......@@ -213,7 +213,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
}
}
p_out_buf->start_date = p_filter->p_sys->start_date;
p_out_buf->i_pts = p_filter->p_sys->start_date;
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples * 3;
p_out_buf->i_nb_bytes = p_out_buf->i_nb_samples * 4;
}
......@@ -219,7 +219,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples +
p_sys->i_old_wing;
p_out_buf->start_date = date_Get( &p_sys->end_date );
p_out_buf->i_pts = date_Get( &p_sys->end_date );
p_out_buf->end_date =
date_Increment( &p_sys->end_date,
p_out_buf->i_nb_samples );
......@@ -239,7 +239,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_filter->b_continuity = true;
p_sys->i_remainder = 0;
date_Init( &p_sys->end_date, i_out_rate, 1 );
date_Set( &p_sys->end_date, p_in_buf->start_date );
date_Set( &p_sys->end_date, p_in_buf->i_pts );
p_sys->i_old_rate = p_filter->input.i_rate;
p_sys->d_old_factor = 1;
p_sys->i_old_wing = 0;
......@@ -454,7 +454,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
/* Finalize aout buffer */
p_out_buf->i_nb_samples = i_out;
p_out_buf->start_date = date_Get( &p_sys->end_date );
p_out_buf->i_pts = date_Get( &p_sys->end_date );
p_out_buf->end_date = date_Increment( &p_sys->end_date,
p_out_buf->i_nb_samples );
......
......@@ -223,12 +223,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
}
p_out_buf->i_nb_samples = i_out;
p_out_buf->start_date = p_in_buf->start_date;
p_out_buf->i_pts = p_in_buf->i_pts;
if( p_in_buf->start_date !=
if( p_in_buf->i_pts !=
date_Get( &p_sys->end_date ) )
{
date_Set( &p_sys->end_date, p_in_buf->start_date );
date_Set( &p_sys->end_date, p_in_buf->i_pts );
}
p_out_buf->end_date = date_Increment( &p_sys->end_date,
......
......@@ -112,7 +112,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out_buf->i_nb_samples = i_out_nb;
p_out_buf->i_nb_bytes = i_out_nb * i_sample_bytes;
p_out_buf->start_date = p_in_buf->start_date;
p_out_buf->end_date = p_out_buf->start_date + p_out_buf->i_nb_samples *
p_out_buf->i_pts = p_in_buf->i_pts;
p_out_buf->end_date = p_out_buf->i_pts + p_out_buf->i_nb_samples *
1000000 / p_filter->output.i_rate;
}
......@@ -125,7 +125,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out_buf->i_nb_samples = i_out_nb;
p_out_buf->i_nb_bytes = i_out_nb * i_sample_bytes;
p_out_buf->start_date = p_in_buf->start_date;
p_out_buf->end_date = p_out_buf->start_date + p_out_buf->i_nb_samples *
p_out_buf->i_pts = p_in_buf->i_pts;
p_out_buf->end_date = p_out_buf->i_pts + p_out_buf->i_nb_samples *
1000000 / p_filter->output.i_rate;
}
......@@ -663,7 +663,7 @@ static void* OSSThread( vlc_object_t *p_this )
i_size = p_buffer->i_nb_bytes;
/* This is theoretical ... we'll see next iteration whether
* we're drifting */
next_date += p_buffer->end_date - p_buffer->start_date;
next_date += p_buffer->end_date - p_buffer->i_pts;
}
else
{
......
......@@ -1063,7 +1063,7 @@ static void* WaveOutThread( vlc_object_t *p_this )
if( p_buffer )
{
mtime_t buffer_length = (p_buffer->end_date
- p_buffer->start_date);
- p_buffer->i_pts);
next_date = next_date + buffer_length;
i_buffer_length = buffer_length/1000;
}
......
......@@ -393,7 +393,7 @@ static aout_buffer_t *GetAoutBuffer( decoder_t *p_dec )
p_buf = decoder_NewAudioBuffer( p_dec, p_sys->frame.i_samples );
if( p_buf == NULL ) return NULL;
p_buf->start_date = date_Get( &p_sys->end_date );
p_buf->i_pts = date_Get( &p_sys->end_date );
p_buf->end_date = date_Increment( &p_sys->end_date, p_sys->frame.i_samples );
return p_buf;
......
......@@ -300,7 +300,7 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL;
}
p_out->start_date = date_Get( &p_sys->end_date );
p_out->i_pts = date_Get( &p_sys->end_date );
p_out->end_date =
date_Increment( &p_sys->end_date, p_sys->i_samplesperblock );
......
......@@ -134,7 +134,7 @@ static aout_buffer_t *Decode( decoder_t *p_dec, block_t **pp_block )
if( p_aout_buffer == NULL )
goto exit;
p_aout_buffer->start_date = date_Get( &p_sys->end_date );
p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
p_aout_buffer->end_date = date_Increment( &p_sys->end_date, i_frame_length );
p_block->i_buffer -= AES3_HEADER_LEN;
......
......@@ -370,7 +370,7 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL;
}
p_out->start_date = date_Get( &p_sys->end_date );
p_out->i_pts = date_Get( &p_sys->end_date );
p_out->end_date = date_Increment( &p_sys->end_date, i_samples );
if( p_sys->p_logtos16 )
......@@ -1419,7 +1419,7 @@ static block_t *EncoderEncode( encoder_t *p_enc, aout_buffer_t *p_aout_buf )
if( p_block )
{
p_block->i_dts = p_block->i_pts = p_aout_buf->start_date;
p_block->i_dts = p_block->i_pts = p_aout_buf->i_pts;
p_block->i_length = (int64_t)p_aout_buf->i_nb_samples *
(int64_t)1000000 / p_enc->fmt_in.audio.i_rate;
}
......
......@@ -239,7 +239,7 @@ static aout_buffer_t *SplitBuffer( decoder_t *p_dec )
if( ( p_buffer = decoder_NewAudioBuffer( p_dec, i_samples ) ) == NULL )
return NULL;
p_buffer->start_date = date_Get( &p_sys->end_date );
p_buffer->i_pts = date_Get( &p_sys->end_date );
p_buffer->end_date = date_Increment( &p_sys->end_date, i_samples );
if( p_sys->b_extract )
......
......@@ -1055,7 +1055,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, aout_buffer_t *p_aout_buf )
int i_samples = p_aout_buf->i_nb_samples;
int i_samples_delay = p_sys->i_samples_delay;
p_sys->i_pts = p_aout_buf->start_date -
p_sys->i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
......
......@@ -981,7 +981,7 @@ static void *DecBlock( decoder_t *p_dec, block_t **pp_block )
memcpy( p_aout_buffer->p_buffer,
block_out.p_buffer, block_out.i_buffer );
/* Date management */
p_aout_buffer->start_date = date_Get( &p_sys->end_date );
p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
p_aout_buffer->end_date =
date_Increment( &p_sys->end_date, i_samples );
}
......@@ -1538,7 +1538,7 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
memcpy( p_block_in->p_buffer, p_aout_buffer->p_buffer,
p_block_in->i_buffer );
i_pts = p_aout_buffer->start_date;
i_pts = p_aout_buffer->i_pts;
}
/* Feed input to the DMO */
......
......@@ -410,7 +410,7 @@ static aout_buffer_t *GetAoutBuffer( decoder_t *p_dec )
p_buf->i_nb_samples = p_sys->i_frame_length;
p_buf->i_nb_bytes = p_sys->i_frame_size;
p_buf->start_date = date_Get( &p_sys->end_date );
p_buf->i_pts = date_Get( &p_sys->end_date );
p_buf->end_date =
date_Increment( &p_sys->end_date, p_sys->i_frame_length );
......
......@@ -414,7 +414,7 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL;
}
p_out->start_date = date_Get( &p_sys->date );
p_out->i_pts = date_Get( &p_sys->date );
p_out->end_date = date_Increment( &p_sys->date, frame.samples / frame.channels );
DoReordering( (uint32_t *)p_out->p_buffer, samples,
......
......@@ -662,7 +662,7 @@ DecoderWriteCallback( const FLAC__StreamDecoder *decoder,
}
/* Date management (already done by packetizer) */
p_sys->p_aout_buffer->start_date = p_sys->p_block->i_pts;
p_sys->p_aout_buffer->i_pts = p_sys->p_block->i_pts;
p_sys->p_aout_buffer->end_date =
p_sys->p_block->i_pts + p_sys->p_block->i_length;
......@@ -1359,7 +1359,7 @@ static block_t *Encode( encoder_t *p_enc, aout_buffer_t *p_aout_buf )
block_t *p_chain;
unsigned int i;
p_sys->i_pts = p_aout_buf->start_date -
p_sys->i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
......
......@@ -197,7 +197,7 @@ static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
if (p_out == NULL)
goto drop;
p_out->start_date = date_Get (&p_sys->end_date );
p_out->i_pts = date_Get (&p_sys->end_date );
p_out->end_date = date_Increment (&p_sys->end_date, samples);
if (!p_sys->fixed)
fluid_synth_write_float (p_sys->synth, samples,
......
......@@ -360,7 +360,7 @@ static void *DecodeFrame( decoder_t *p_dec, block_t **pp_block )
if( !p_aout_buffer )
return NULL;
p_aout_buffer->start_date = date_Get( &p_sys->end_date );
p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
p_aout_buffer->end_date =
date_Increment( &p_sys->end_date, i_frame_length );
......
......@@ -538,7 +538,7 @@ static aout_buffer_t *GetAoutBuffer( decoder_t *p_dec )
p_buf = decoder_NewAudioBuffer( p_dec, p_sys->i_frame_length );
if( p_buf == NULL ) return NULL;
p_buf->start_date = date_Get( &p_sys->end_date );
p_buf->i_pts = date_Get( &p_sys->end_date );
p_buf->end_date =
date_Increment( &p_sys->end_date, p_sys->i_frame_length );
p_buf->b_discontinuity = p_sys->b_discontinuity;
......
......@@ -646,7 +646,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
if( p_out )
{
p_out->start_date = date_Get( &p_sys->date );
p_out->i_pts = date_Get( &p_sys->date );
p_out->end_date = date_Increment( &p_sys->date, i_frames );
memcpy( p_out->p_buffer,
......
......@@ -723,7 +723,7 @@ static aout_buffer_t *Decode( decoder_t *p_dec, block_t **pp_block )
memcpy( p_aout_buffer->p_buffer, p_sys->p_out, p_sys->i_out );
/* Date management */
p_aout_buffer->start_date = date_Get( &p_sys->end_date );
p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
p_aout_buffer->end_date =
date_Increment( &p_sys->end_date, i_samples );
}
......
......@@ -184,7 +184,7 @@ static block_t *EncodeFrame( encoder_t *p_enc, aout_buffer_t *p_block )
block_t *p_pcm_block;
block_t *p_chain = NULL;
unsigned int i_samples = p_block->i_nb_bytes >> 2 /* s16l stereo */;
mtime_t start_date = p_block->start_date;
mtime_t start_date = p_block->i_pts;
start_date -= (mtime_t)i_samples * (mtime_t)1000000 / (mtime_t)p_enc->fmt_out.audio.i_rate;
VLC_UNUSED(p_enc);
......
......@@ -711,7 +711,7 @@ static aout_buffer_t *DecodeRtpSpeexPacket( decoder_t *p_dec, block_t **pp_block
/*
Handle date management on the audio output buffer.
*/
p_aout_buffer->start_date = date_Get( &p_sys->end_date );
p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
p_aout_buffer->end_date = date_Increment( &p_sys->end_date,
p_sys->p_header->frame_size );
......@@ -771,7 +771,7 @@ static aout_buffer_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
&p_sys->stereo );
/* Date management */
p_aout_buffer->start_date = date_Get( &p_sys->end_date );
p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
p_aout_buffer->end_date =
date_Increment( &p_sys->end_date, p_sys->p_header->frame_size );
......@@ -1037,7 +1037,7 @@ static block_t *Encode( encoder_t *p_enc, aout_buffer_t *p_aout_buf )
int i_samples = p_aout_buf->i_nb_samples;
int i_samples_delay = p_sys->i_samples_delay;
p_sys->i_pts = p_aout_buf->start_date -
p_sys->i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
......
......@@ -271,7 +271,7 @@ static block_t *Encode( encoder_t *p_enc, aout_buffer_t *p_aout_buf )
int i_nb_samples = p_aout_buf->i_nb_samples;
block_t *p_chain = NULL;
p_sys->i_pts = p_aout_buf->start_date -
p_sys->i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_nb_samples /
(mtime_t)p_enc->fmt_out.audio.i_rate;
......
......@@ -559,7 +559,7 @@ static aout_buffer_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
vorbis_synthesis_read( &p_sys->vd, i_samples );
/* Date management */
p_aout_buffer->start_date = date_Get( &p_sys->end_date );
p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
p_aout_buffer->end_date = date_Increment( &p_sys->end_date, i_samples );
return p_aout_buffer;
}
......@@ -915,7 +915,7 @@ static block_t *Encode( encoder_t *p_enc, aout_buffer_t *p_aout_buf )
int i;
unsigned int j;
p_sys->i_pts = p_aout_buf->start_date -
p_sys->i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
......
......@@ -101,7 +101,7 @@ static aout_buffer_t *SplitBuffer( decoder_t *p_dec )
if( !( p_buffer = p_dec->pf_aout_buffer_new( p_dec, i_samples ) ) )
return NULL;
p_buffer->start_date = date_Get( &p_sys->end_date );
p_buffer->i_pts = date_Get( &p_sys->end_date );
p_buffer->end_date = date_Increment( &p_sys->end_date, i_samples );
memcpy( p_buffer->p_buffer, p_sys->p_samples, p_buffer->i_nb_bytes );
......
......@@ -1295,25 +1295,25 @@ static int transcode_audio_process( sout_stream_t *p_stream,
if( p_sys->b_master_sync )
{
mtime_t i_dts = date_Get( &id->interpolated_pts ) + 1;
if ( p_audio_buf->start_date - i_dts > MASTER_SYNC_MAX_DRIFT
|| p_audio_buf->start_date - i_dts < -MASTER_SYNC_MAX_DRIFT )
if ( p_audio_buf->i_pts - i_dts > MASTER_SYNC_MAX_DRIFT
|| p_audio_buf->i_pts - i_dts < -MASTER_SYNC_MAX_DRIFT )
{
msg_Dbg( p_stream, "drift is too high, resetting master sync" );
date_Set( &id->interpolated_pts, p_audio_buf->start_date );
i_dts = p_audio_buf->start_date + 1;
date_Set( &id->interpolated_pts, p_audio_buf->i_pts );
i_dts = p_audio_buf->i_pts + 1;
}
p_sys->i_master_drift = p_audio_buf->start_date - i_dts;
p_sys->i_master_drift = p_audio_buf->i_pts - i_dts;
date_Increment( &id->interpolated_pts, p_audio_buf->i_nb_samples );
p_audio_buf->start_date -= p_sys->i_master_drift;
p_audio_buf->i_pts -= p_sys->i_master_drift;
p_audio_buf->end_date -= p_sys->i_master_drift;
}
p_audio_block = p_audio_buf->p_sys;
p_audio_block->i_buffer = p_audio_buf->i_nb_bytes;
p_audio_block->i_dts = p_audio_block->i_pts =
p_audio_buf->start_date;
p_audio_buf->i_pts;
p_audio_block->i_length = p_audio_buf->end_date -
p_audio_buf->start_date;
p_audio_buf->i_pts;
p_audio_block->i_samples = p_audio_buf->i_nb_samples;
/* Run filter chain */
......@@ -1329,7 +1329,7 @@ static int transcode_audio_process( sout_stream_t *p_stream,
p_audio_buf->p_buffer = p_audio_block->p_buffer;
p_audio_buf->i_nb_bytes = p_audio_block->i_buffer;
p_audio_buf->i_nb_samples = p_audio_block->i_samples;
p_audio_buf->start_date = p_audio_block->i_dts;
p_audio_buf->i_pts = p_audio_block->i_dts;
p_audio_buf->end_date = p_audio_block->i_dts + p_audio_block->i_length;
audio_timer_start( id->p_encoder );
......
......@@ -238,7 +238,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
return;
}
memcpy( p_block->p_buffer, p_in_buf->p_buffer, p_in_buf->i_nb_bytes );
p_block->i_pts = p_in_buf->start_date;
p_block->i_pts = p_in_buf->i_pts;
p_sys->p_thread->pp_blocks[p_sys->p_thread->i_blocks++] = p_block;
......
......@@ -375,7 +375,7 @@ static void DoWork( aout_instance_t *p_aout, aout_filter_t *p_filter,
#undef p_effect
}
p_outpic->date = ( p_in_buf->start_date + p_in_buf->end_date ) / 2;
p_outpic->date = ( p_in_buf->i_pts + p_in_buf->end_date ) / 2;
vout_DisplayPicture( p_sys->p_vout, p_outpic );
}
......
......@@ -369,7 +369,7 @@ void aout_FifoPush( aout_instance_t * p_aout, aout_fifo_t * p_fifo,
/* Enforce the continuity of the stream. */
if ( date_Get( &p_fifo->end_date ) )
{
p_buffer->start_date = date_Get( &p_fifo->end_date );
p_buffer->i_pts = date_Get( &p_fifo->end_date );
p_buffer->end_date = date_Increment( &p_fifo->end_date,
p_buffer->i_nb_samples );
}
......@@ -416,7 +416,7 @@ void aout_FifoMoveDates( aout_instance_t * p_aout, aout_fifo_t * p_fifo,
p_buffer = p_fifo->p_first;
while ( p_buffer != NULL )
{
p_buffer->start_date += difference;
p_buffer->i_pts += difference;
p_buffer->end_date += difference;
p_buffer = p_buffer->p_next;
}
......@@ -440,7 +440,7 @@ mtime_t aout_FifoFirstDate( aout_instance_t * p_aout, aout_fifo_t * p_fifo )
{
(void)p_aout;
AOUT_ASSERT_FIFO_LOCKED;
return p_fifo->p_first ? p_fifo->p_first->start_date : 0;
return p_fifo->p_first ? p_fifo->p_first->i_pts : 0;
}
/*****************************************************************************
......
......@@ -281,7 +281,7 @@ aout_buffer_t * aout_DecNewBuffer( aout_input_t * p_input,
return NULL;
p_buffer->i_nb_samples = i_nb_samples;
p_buffer->start_date = p_buffer->end_date = 0;
p_buffer->i_pts = p_buffer->end_date = 0;
return p_buffer;
}
......@@ -304,9 +304,9 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
assert( i_input_rate >= INPUT_RATE_DEFAULT / AOUT_MAX_INPUT_RATE &&
i_input_rate <= INPUT_RATE_DEFAULT * AOUT_MAX_INPUT_RATE );
assert( p_buffer->start_date > 0 );
assert( p_buffer->i_pts > 0 );
p_buffer->end_date = p_buffer->start_date
p_buffer->end_date = p_buffer->i_pts
+ (mtime_t)p_buffer->i_nb_samples * 1000000
/ p_input->input.i_rate;
......@@ -331,7 +331,7 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
p_buffer->i_nb_bytes );
p_new_buffer->i_nb_samples = p_buffer->i_nb_samples;
p_new_buffer->i_nb_bytes = p_buffer->i_nb_bytes;
p_new_buffer->start_date = p_buffer->start_date;
p_new_buffer->i_pts = p_buffer->i_pts;
p_new_buffer->end_date = p_buffer->end_date;
aout_BufferFree( p_buffer );
p_buffer = p_new_buffer;
......@@ -383,7 +383,7 @@ void aout_DecChangePause( aout_instance_t *p_aout, aout_input_t *p_input, bool b
aout_lock_mixer( p_aout );
for( aout_buffer_t *p = p_input->mixer.fifo.p_first; p != NULL; p = p->p_next )
{
p->start_date += i_duration;
p->i_pts += i_duration;
p->end_date += i_duration;
}
aout_unlock_mixer( p_aout );
......
......@@ -353,7 +353,7 @@ void aout_FiltersPlay( aout_instance_t * p_aout,
*pp_input_buffer );
if( p_output_buffer == NULL )
return;
p_output_buffer->start_date = (*pp_input_buffer)->start_date;
p_output_buffer->i_pts = (*pp_input_buffer)->i_pts;
p_output_buffer->end_date = (*pp_input_buffer)->end_date;
/* Please note that p_output_buffer->i_nb_samples & i_nb_bytes
......
......@@ -552,7 +552,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
/* Actually run the resampler now. */
if ( p_input->i_nb_resamplers > 0 )
{
const mtime_t i_date = p_buffer->start_date;
const mtime_t i_date = p_buffer->i_pts;
aout_FiltersPlay( p_aout, p_input->pp_resamplers,
p_input->i_nb_resamplers,
&p_buffer );
......@@ -600,12 +600,12 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
start_date = 0;
}
if ( p_buffer->start_date < mdate() + AOUT_MIN_PREPARE_TIME )
if ( p_buffer->i_pts < mdate() + AOUT_MIN_PREPARE_TIME )
{
/* The decoder gives us f*cked up PTS. It's its business, but we
* can't present it anyway, so drop the buffer. */
msg_Warn( p_aout, "PTS is out of range (%"PRId64"), dropping buffer",
mdate() - p_buffer->start_date );
mdate() - p_buffer->i_pts );
inputDrop( p_input, p_buffer );
inputResamplingStop( p_input );
......@@ -616,10 +616,10 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
* the audio. */
mtime_t i_pts_tolerance = 3 * AOUT_PTS_TOLERANCE * i_input_rate / INPUT_RATE_DEFAULT;
if ( start_date != 0 &&
( start_date < p_buffer->start_date - i_pts_tolerance ) )
( start_date < p_buffer->i_pts - i_pts_tolerance ) )
{
msg_Warn( p_aout, "audio drift is too big (%"PRId64"), clearing out",
start_date - p_buffer->start_date );
start_date - p_buffer->i_pts );
aout_lock_input_fifos( p_aout );
aout_FifoSet( p_aout, &p_input->mixer.fifo, 0 );
p_input->mixer.begin = NULL;
......@@ -630,15 +630,15 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
start_date = 0;
}
else if ( start_date != 0 &&
( start_date > p_buffer->start_date + i_pts_tolerance) )
( start_date > p_buffer->i_pts + i_pts_tolerance) )
{
msg_Warn( p_aout, "audio drift is too big (%"PRId64"), dropping buffer",
start_date - p_buffer->start_date );
start_date - p_buffer->i_pts );
inputDrop( p_input, p_buffer );
return 0;
}
if ( start_date == 0 ) start_date = p_buffer->start_date;
if ( start_date == 0 ) start_date = p_buffer->i_pts;
#ifndef AOUT_PROCESS_BEFORE_CHEKS
/* Run pre-filters. */
......@@ -649,8 +649,8 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
/* Run the resampler if needed.
* We first need to calculate the output rate of this resampler. */
if ( ( p_input->i_resampling_type == AOUT_RESAMPLING_NONE ) &&
( start_date < p_buffer->start_date - AOUT_PTS_TOLERANCE
|| start_date > p_buffer->start_date + AOUT_PTS_TOLERANCE ) &&
( start_date < p_buffer->i_pts - AOUT_PTS_TOLERANCE
|| start_date > p_buffer->i_pts + AOUT_PTS_TOLERANCE ) &&
p_input->i_nb_resamplers > 0 )
{
/* Can happen in several circumstances :
......@@ -660,7 +660,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
* synchronization
* Solution : resample the buffer to avoid a scratch.
*/
mtime_t drift = p_buffer->start_date - start_date;
mtime_t drift = p_buffer->i_pts - start_date;
p_input->i_resamp_start_date = mdate();
p_input->i_resamp_start_drift = (int)drift;
......@@ -703,9 +703,9 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
msg_Warn( p_aout, "resampling stopped after %"PRIi64" usec "
"(drift: %"PRIi64")",
mdate() - p_input->i_resamp_start_date,
p_buffer->start_date - start_date);
p_buffer->i_pts - start_date);
}
else if( abs( (int)(p_buffer->start_date - start_date) ) <
else if( abs( (int)(p_buffer->i_pts - start_date) ) <
abs( p_input->i_resamp_start_drift ) / 2 )
{
/* if we reduced the drift from half, then it is time to switch
......@@ -717,7 +717,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
p_input->i_resamp_start_drift = 0;
}
else if( p_input->i_resamp_start_drift &&
( abs( (int)(p_buffer->start_date - start_date) ) >
( abs( (int)(p_buffer->i_pts - start_date) ) >
abs( p_input->i_resamp_start_drift ) * 3 / 2 ) )
{
/* If the drift is increasing and not decreasing, than something
......@@ -745,8 +745,8 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
/* Adding the start date will be managed by aout_FifoPush(). */
p_buffer->end_date = start_date +
(p_buffer->end_date - p_buffer->start_date);
p_buffer->start_date = start_date;
(p_buffer->end_date - p_buffer->i_pts);
p_buffer->i_pts = start_date;
aout_lock_input_fifos( p_aout );
aout_FifoPush( p_aout, &p_input->mixer.fifo, p_buffer );
......
......@@ -169,10 +169,10 @@ static int MixBuffer( aout_instance_t * p_aout )
continue;
p_buffer = p_fifo->p_first;
while ( p_buffer != NULL && p_buffer->start_date < mdate() )
while ( p_buffer != NULL && p_buffer->i_pts < mdate() )
{
msg_Warn( p_aout, "input PTS is out of range (%"PRId64"), "
"trashing", mdate() - p_buffer->start_date );
"trashing", mdate() - p_buffer->i_pts );
p_buffer = aout_FifoPop( p_aout, p_fifo );
aout_BufferFree( p_buffer );
p_buffer = p_fifo->p_first;
......@@ -184,10 +184,10 @@ static int MixBuffer( aout_instance_t * p_aout )
break;
}
if ( !start_date || start_date < p_buffer->start_date )
if ( !start_date || start_date < p_buffer->i_pts )
{
date_Set( &exact_start_date, p_buffer->start_date );