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.
38 files changed:
size_t i_size, i_nb_bytes;
unsigned int i_nb_samples;
bool b_discontinuity; /* Set on discontinuity (for non pcm stream) */
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;
struct aout_buffer_t * p_next;
void *p_sys;
{
if( p_filter->p_sys->i_frames == 1 )
/* We'll need the starting date */
{
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;
/* Not enough data */
p_out_buf->i_nb_samples = 0;
- 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;
}
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;
}
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples +
p_sys->i_old_wing;
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 );
p_out_buf->end_date =
date_Increment( &p_sys->end_date,
p_out_buf->i_nb_samples );
p_filter->b_continuity = true;
p_sys->i_remainder = 0;
date_Init( &p_sys->end_date, i_out_rate, 1 );
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;
p_sys->i_old_rate = p_filter->input.i_rate;
p_sys->d_old_factor = 1;
p_sys->i_old_wing = 0;
/* Finalize aout buffer */
p_out_buf->i_nb_samples = i_out;
/* 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 );
p_out_buf->end_date = date_Increment( &p_sys->end_date,
p_out_buf->i_nb_samples );
}
p_out_buf->i_nb_samples = i_out;
}
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 !=
date_Get( &p_sys->end_date ) )
{
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,
}
p_out_buf->end_date = date_Increment( &p_sys->end_date,
p_out_buf->i_nb_samples = i_out_nb;
p_out_buf->i_nb_bytes = i_out_nb * i_sample_bytes;
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;
}
1000000 / p_filter->output.i_rate;
}
p_out_buf->i_nb_samples = i_out_nb;
p_out_buf->i_nb_bytes = i_out_nb * i_sample_bytes;
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;
}
1000000 / p_filter->output.i_rate;
}
i_size = p_buffer->i_nb_bytes;
/* This is theoretical ... we'll see next iteration whether
* we're drifting */
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;
if( p_buffer )
{
mtime_t buffer_length = (p_buffer->end_date
if( p_buffer )
{
mtime_t buffer_length = (p_buffer->end_date
- - p_buffer->start_date);
next_date = next_date + buffer_length;
i_buffer_length = buffer_length/1000;
}
next_date = next_date + buffer_length;
i_buffer_length = buffer_length/1000;
}
p_buf = decoder_NewAudioBuffer( p_dec, p_sys->frame.i_samples );
if( p_buf == NULL ) return NULL;
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;
p_buf->end_date = date_Increment( &p_sys->end_date, p_sys->frame.i_samples );
return p_buf;
- 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 );
p_out->end_date =
date_Increment( &p_sys->end_date, p_sys->i_samplesperblock );
if( p_aout_buffer == NULL )
goto exit;
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;
p_aout_buffer->end_date = date_Increment( &p_sys->end_date, i_frame_length );
p_block->i_buffer -= AES3_HEADER_LEN;
- 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 )
p_out->end_date = date_Increment( &p_sys->end_date, i_samples );
if( p_sys->p_logtos16 )
- 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;
}
p_block->i_length = (int64_t)p_aout_buf->i_nb_samples *
(int64_t)1000000 / p_enc->fmt_in.audio.i_rate;
}
if( ( p_buffer = decoder_NewAudioBuffer( p_dec, i_samples ) ) == NULL )
return NULL;
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 )
p_buffer->end_date = date_Increment( &p_sys->end_date, i_samples );
if( p_sys->b_extract )
int i_samples = p_aout_buf->i_nb_samples;
int i_samples_delay = p_sys->i_samples_delay;
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;
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
memcpy( p_aout_buffer->p_buffer,
block_out.p_buffer, block_out.i_buffer );
/* Date management */
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 );
}
p_aout_buffer->end_date =
date_Increment( &p_sys->end_date, i_samples );
}
memcpy( p_block_in->p_buffer, p_aout_buffer->p_buffer,
p_block_in->i_buffer );
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 */
}
/* Feed input to the DMO */
p_buf->i_nb_samples = p_sys->i_frame_length;
p_buf->i_nb_bytes = p_sys->i_frame_size;
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 );
p_buf->end_date =
date_Increment( &p_sys->end_date, p_sys->i_frame_length );
- 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,
p_out->end_date = date_Increment( &p_sys->date, frame.samples / frame.channels );
DoReordering( (uint32_t *)p_out->p_buffer, samples,
}
/* Date management (already done by packetizer) */
}
/* 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;
p_sys->p_aout_buffer->end_date =
p_sys->p_block->i_pts + p_sys->p_block->i_length;
block_t *p_chain;
unsigned int i;
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;
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
if (p_out == NULL)
goto drop;
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,
p_out->end_date = date_Increment (&p_sys->end_date, samples);
if (!p_sys->fixed)
fluid_synth_write_float (p_sys->synth, samples,
if( !p_aout_buffer )
return NULL;
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 );
p_aout_buffer->end_date =
date_Increment( &p_sys->end_date, i_frame_length );
p_buf = decoder_NewAudioBuffer( p_dec, p_sys->i_frame_length );
if( p_buf == NULL ) return NULL;
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;
p_buf->end_date =
date_Increment( &p_sys->end_date, p_sys->i_frame_length );
p_buf->b_discontinuity = p_sys->b_discontinuity;
- 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,
p_out->end_date = date_Increment( &p_sys->date, i_frames );
memcpy( p_out->p_buffer,
memcpy( p_aout_buffer->p_buffer, p_sys->p_out, p_sys->i_out );
/* Date management */
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 );
}
p_aout_buffer->end_date =
date_Increment( &p_sys->end_date, i_samples );
}
block_t *p_pcm_block;
block_t *p_chain = NULL;
unsigned int i_samples = p_block->i_nb_bytes >> 2 /* s16l stereo */;
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);
start_date -= (mtime_t)i_samples * (mtime_t)1000000 / (mtime_t)p_enc->fmt_out.audio.i_rate;
VLC_UNUSED(p_enc);
/*
Handle date management on the audio output buffer.
*/
/*
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 );
p_aout_buffer->end_date = date_Increment( &p_sys->end_date,
p_sys->p_header->frame_size );
&p_sys->stereo );
/* Date management */
&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 );
p_aout_buffer->end_date =
date_Increment( &p_sys->end_date, p_sys->p_header->frame_size );
int i_samples = p_aout_buf->i_nb_samples;
int i_samples_delay = p_sys->i_samples_delay;
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;
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
int i_nb_samples = p_aout_buf->i_nb_samples;
block_t *p_chain = NULL;
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;
(mtime_t)1000000 * (mtime_t)p_sys->i_nb_samples /
(mtime_t)p_enc->fmt_out.audio.i_rate;
vorbis_synthesis_read( &p_sys->vd, i_samples );
/* Date management */
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;
}
p_aout_buffer->end_date = date_Increment( &p_sys->end_date, i_samples );
return p_aout_buffer;
}
- 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;
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
if( !( p_buffer = p_dec->pf_aout_buffer_new( p_dec, i_samples ) ) )
return NULL;
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 );
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 );
if( p_sys->b_master_sync )
{
mtime_t i_dts = date_Get( &id->interpolated_pts ) + 1;
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" );
{
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 );
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->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_block->i_length = p_audio_buf->end_date -
p_audio_block->i_length = p_audio_buf->end_date -
- p_audio_buf->start_date;
p_audio_block->i_samples = p_audio_buf->i_nb_samples;
/* Run filter chain */
p_audio_block->i_samples = p_audio_buf->i_nb_samples;
/* Run filter chain */
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->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 );
p_audio_buf->end_date = p_audio_block->i_dts + p_audio_block->i_length;
audio_timer_start( id->p_encoder );
return;
}
memcpy( p_block->p_buffer, p_in_buf->p_buffer, p_in_buf->i_nb_bytes );
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;
p_sys->p_thread->pp_blocks[p_sys->p_thread->i_blocks++] = p_block;
- 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 );
}
vout_DisplayPicture( p_sys->p_vout, p_outpic );
}
/* Enforce the continuity of the stream. */
if ( date_Get( &p_fifo->end_date ) )
{
/* 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 );
}
p_buffer->end_date = date_Increment( &p_fifo->end_date,
p_buffer->i_nb_samples );
}
p_buffer = p_fifo->p_first;
while ( p_buffer != NULL )
{
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;
}
p_buffer->end_date += difference;
p_buffer = p_buffer->p_next;
}
{
(void)p_aout;
AOUT_ASSERT_FIFO_LOCKED;
{
(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;
}
/*****************************************************************************
}
/*****************************************************************************
return NULL;
p_buffer->i_nb_samples = i_nb_samples;
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;
assert( i_input_rate >= INPUT_RATE_DEFAULT / AOUT_MAX_INPUT_RATE &&
i_input_rate <= INPUT_RATE_DEFAULT * AOUT_MAX_INPUT_RATE );
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;
+ (mtime_t)p_buffer->i_nb_samples * 1000000
/ p_input->input.i_rate;
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_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;
p_new_buffer->end_date = p_buffer->end_date;
aout_BufferFree( p_buffer );
p_buffer = p_new_buffer;
aout_lock_mixer( p_aout );
for( aout_buffer_t *p = p_input->mixer.fifo.p_first; p != NULL; p = p->p_next )
{
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 );
p->end_date += i_duration;
}
aout_unlock_mixer( p_aout );
*pp_input_buffer );
if( p_output_buffer == NULL )
return;
*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
p_output_buffer->end_date = (*pp_input_buffer)->end_date;
/* Please note that p_output_buffer->i_nb_samples & i_nb_bytes
/* Actually run the resampler now. */
if ( p_input->i_nb_resamplers > 0 )
{
/* 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 );
aout_FiltersPlay( p_aout, p_input->pp_resamplers,
p_input->i_nb_resamplers,
&p_buffer );
- 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",
{
/* 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 );
inputDrop( p_input, p_buffer );
inputResamplingStop( p_input );
* the audio. */
mtime_t i_pts_tolerance = 3 * AOUT_PTS_TOLERANCE * i_input_rate / INPUT_RATE_DEFAULT;
if ( start_date != 0 &&
* 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",
{
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;
aout_lock_input_fifos( p_aout );
aout_FifoSet( p_aout, &p_input->mixer.fifo, 0 );
p_input->mixer.begin = NULL;
start_date = 0;
}
else if ( start_date != 0 &&
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",
{
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;
}
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. */
#ifndef AOUT_PROCESS_BEFORE_CHEKS
/* Run pre-filters. */
/* 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 ) &&
/* 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 :
p_input->i_nb_resamplers > 0 )
{
/* Can happen in several circumstances :
* synchronization
* Solution : resample the buffer to avoid a scratch.
*/
* 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;
p_input->i_resamp_start_date = mdate();
p_input->i_resamp_start_drift = (int)drift;
msg_Warn( p_aout, "resampling stopped after %"PRIi64" usec "
"(drift: %"PRIi64")",
mdate() - p_input->i_resamp_start_date,
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
abs( p_input->i_resamp_start_drift ) / 2 )
{
/* if we reduced the drift from half, then it is time to switch
p_input->i_resamp_start_drift = 0;
}
else if( p_input->i_resamp_start_drift &&
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
abs( p_input->i_resamp_start_drift ) * 3 / 2 ) )
{
/* If the drift is increasing and not decreasing, than something
/* Adding the start date will be managed by aout_FifoPush(). */
p_buffer->end_date = start_date +
/* 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 );
aout_lock_input_fifos( p_aout );
aout_FifoPush( p_aout, &p_input->mixer.fifo, p_buffer );
continue;
p_buffer = p_fifo->p_first;
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"), "
{
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;
p_buffer = aout_FifoPop( p_aout, p_fifo );
aout_BufferFree( p_buffer );
p_buffer = p_fifo->p_first;
- 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 );
- start_date = p_buffer->start_date;
+ date_Set( &exact_start_date, p_buffer->i_pts );
+ start_date = p_buffer->i_pts;
b_drop_buffers = 0;
for ( ; p_buffer != NULL; p_buffer = p_buffer->p_next )
{
b_drop_buffers = 0;
for ( ; p_buffer != NULL; p_buffer = p_buffer->p_next )
{
- if ( prev_date != p_buffer->start_date )
+ if ( prev_date != p_buffer->i_pts )
{
msg_Warn( p_aout,
"buffer hole, dropping packets (%"PRId64")",
{
msg_Warn( p_aout,
"buffer hole, dropping packets (%"PRId64")",
- p_buffer->start_date - prev_date );
+ p_buffer->i_pts - prev_date );
b_drop_buffers = 1;
break;
}
b_drop_buffers = 1;
break;
}
{
/* Additionally check that p_first_byte_to_mix is well
* located. */
{
/* Additionally check that p_first_byte_to_mix is well
* located. */
- mtime_t i_nb_bytes = (start_date - p_buffer->start_date)
+ mtime_t i_nb_bytes = (start_date - p_buffer->i_pts)
* p_aout->p_mixer->fmt.i_bytes_per_frame
* p_aout->p_mixer->fmt.i_rate
/ p_aout->p_mixer->fmt.i_frame_length
* p_aout->p_mixer->fmt.i_bytes_per_frame
* p_aout->p_mixer->fmt.i_rate
/ p_aout->p_mixer->fmt.i_frame_length
* p_aout->p_mixer->fmt.i_bytes_per_frame
/ p_aout->p_mixer->fmt.i_frame_length;
}
* p_aout->p_mixer->fmt.i_bytes_per_frame
/ p_aout->p_mixer->fmt.i_frame_length;
}
- p_output_buffer->start_date = start_date;
+ p_output_buffer->i_pts = start_date;
p_output_buffer->end_date = end_date;
p_aout->p_mixer->mix( p_aout->p_mixer, p_output_buffer );
p_output_buffer->end_date = end_date;
p_aout->p_mixer->mix( p_aout->p_mixer, p_output_buffer );
/* Drop the audio sample if the audio output is really late.
* In the case of b_can_sleek, we don't use a resampler so we need to be
* a lot more severe. */
/* Drop the audio sample if the audio output is really late.
* In the case of b_can_sleek, we don't use a resampler so we need to be
* a lot more severe. */
- while ( p_buffer && p_buffer->start_date <
+ while ( p_buffer && p_buffer->i_pts <
(b_can_sleek ? start_date : mdate()) - AOUT_PTS_TOLERANCE )
{
msg_Dbg( p_aout, "audio output is too slow (%"PRId64"), "
(b_can_sleek ? start_date : mdate()) - AOUT_PTS_TOLERANCE )
{
msg_Dbg( p_aout, "audio output is too slow (%"PRId64"), "
- "trashing %"PRId64"us", mdate() - p_buffer->start_date,
- p_buffer->end_date - p_buffer->start_date );
+ "trashing %"PRId64"us", mdate() - p_buffer->i_pts,
+ p_buffer->end_date - p_buffer->i_pts );
p_buffer = p_buffer->p_next;
aout_BufferFree( p_aout->output.fifo.p_first );
p_aout->output.fifo.p_first = p_buffer;
p_buffer = p_buffer->p_next;
aout_BufferFree( p_aout->output.fifo.p_first );
p_aout->output.fifo.p_first = p_buffer;
/* Here we suppose that all buffers have the same duration - this is
* generally true, and anyway if it's wrong it won't be a disaster.
*/
/* Here we suppose that all buffers have the same duration - this is
* generally true, and anyway if it's wrong it won't be a disaster.
*/
- if ( p_buffer->start_date > start_date
- + (p_buffer->end_date - p_buffer->start_date) )
+ if ( p_buffer->i_pts > start_date
+ + (p_buffer->end_date - p_buffer->i_pts) )
/*
* + AOUT_PTS_TOLERANCE )
* There is no reason to want that, it just worsen the scheduling of
/*
* + AOUT_PTS_TOLERANCE )
* There is no reason to want that, it just worsen the scheduling of
- const mtime_t i_delta = p_buffer->start_date - start_date;
+ const mtime_t i_delta = p_buffer->i_pts - start_date;
aout_unlock_output_fifo( p_aout );
if ( !p_aout->output.b_starving )
aout_unlock_output_fifo( p_aout );
if ( !p_aout->output.b_starving )
p_aout->output.b_starving = 0;
if ( !b_can_sleek &&
p_aout->output.b_starving = 0;
if ( !b_can_sleek &&
- ( (p_buffer->start_date - start_date > AOUT_PTS_TOLERANCE)
- || (start_date - p_buffer->start_date > AOUT_PTS_TOLERANCE) ) )
+ ( (p_buffer->i_pts - start_date > AOUT_PTS_TOLERANCE)
+ || (start_date - p_buffer->i_pts > AOUT_PTS_TOLERANCE) ) )
{
/* Try to compensate the drift by doing some resampling. */
int i;
{
/* Try to compensate the drift by doing some resampling. */
int i;
- mtime_t difference = start_date - p_buffer->start_date;
+ mtime_t difference = start_date - p_buffer->i_pts;
msg_Warn( p_aout, "output date isn't PTS date, requesting "
"resampling (%"PRId64")", difference );
msg_Warn( p_aout, "output date isn't PTS date, requesting "
"resampling (%"PRId64")", difference );
aout_input_t *p_aout_input = p_owner->p_aout_input;
/* */
aout_input_t *p_aout_input = p_owner->p_aout_input;
/* */
- if( p_audio->start_date <= VLC_TS_INVALID ) // FIXME --VLC_TS_INVALID verify audio_output/*
+ if( p_audio->i_pts <= VLC_TS_INVALID ) // FIXME --VLC_TS_INVALID verify audio_output/*
{
msg_Warn( p_dec, "non-dated audio buffer received" );
*pi_lost_sum += 1;
{
msg_Warn( p_dec, "non-dated audio buffer received" );
*pi_lost_sum += 1;
p_owner->buffer.i_count++;
if( p_owner->buffer.i_count > DECODER_MAX_BUFFERING_COUNT ||
p_owner->buffer.i_count++;
if( p_owner->buffer.i_count > DECODER_MAX_BUFFERING_COUNT ||
- p_audio->start_date - p_owner->buffer.p_audio->start_date > DECODER_MAX_BUFFERING_AUDIO_DURATION )
+ p_audio->i_pts - p_owner->buffer.p_audio->i_pts > DECODER_MAX_BUFFERING_AUDIO_DURATION )
{
p_owner->buffer.b_full = true;
vlc_cond_signal( &p_owner->wait_acknowledge );
{
p_owner->buffer.b_full = true;
vlc_cond_signal( &p_owner->wait_acknowledge );
- const bool b_dated = p_audio->start_date > VLC_TS_INVALID;
+ const bool b_dated = p_audio->i_pts > VLC_TS_INVALID;
int i_rate = INPUT_RATE_DEFAULT;
int i_rate = INPUT_RATE_DEFAULT;
- DecoderFixTs( p_dec, &p_audio->start_date, &p_audio->end_date, NULL,
+ DecoderFixTs( p_dec, &p_audio->i_pts, &p_audio->end_date, NULL,
&i_rate, AOUT_MAX_ADVANCE_TIME, false );
vlc_mutex_unlock( &p_owner->lock );
if( !p_aout || !p_aout_input ||
&i_rate, AOUT_MAX_ADVANCE_TIME, false );
vlc_mutex_unlock( &p_owner->lock );
if( !p_aout || !p_aout_input ||
- p_audio->start_date <= VLC_TS_INVALID ||
+ p_audio->i_pts <= VLC_TS_INVALID ||
i_rate < INPUT_RATE_DEFAULT/AOUT_MAX_INPUT_RATE ||
i_rate > INPUT_RATE_DEFAULT*AOUT_MAX_INPUT_RATE )
b_reject = true;
DecoderWaitDate( p_dec, &b_reject,
i_rate < INPUT_RATE_DEFAULT/AOUT_MAX_INPUT_RATE ||
i_rate > INPUT_RATE_DEFAULT*AOUT_MAX_INPUT_RATE )
b_reject = true;
DecoderWaitDate( p_dec, &b_reject,
- p_audio->start_date - AOUT_MAX_PREPARE_TIME );
+ p_audio->i_pts - AOUT_MAX_PREPARE_TIME );
i_decoded++;
if( p_owner->i_preroll_end > VLC_TS_INVALID &&
i_decoded++;
if( p_owner->i_preroll_end > VLC_TS_INVALID &&
- p_aout_buf->start_date < p_owner->i_preroll_end )
+ p_aout_buf->i_pts < p_owner->i_preroll_end )
{
aout_DecDeleteBuffer( p_aout, p_aout_input, p_aout_buf );
continue;
{
aout_DecDeleteBuffer( p_aout, p_aout_input, p_aout_buf );
continue;