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

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 );
......
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