size_t i_size, i_nb_bytes;
unsigned int i_nb_samples;
uint32_t i_flags;
- mtime_t i_pts, end_date;
+ mtime_t i_pts, i_length;
struct aout_buffer_t * p_next;
void *p_sys;
p_sys->i_old_wing;
p_out_buf->i_pts = date_Get( &p_sys->end_date );
- p_out_buf->end_date =
+ p_out_buf->i_length =
date_Increment( &p_sys->end_date,
- p_out_buf->i_nb_samples );
+ p_out_buf->i_nb_samples ) - p_out_buf->i_pts;
p_out_buf->i_nb_bytes = p_out_buf->i_nb_samples *
p_filter->input.i_bytes_per_frame;
/* Finalize aout buffer */
p_out_buf->i_nb_samples = i_out;
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->i_length = date_Increment( &p_sys->end_date,
+ p_out_buf->i_nb_samples ) - p_out_buf->i_pts;
p_out_buf->i_nb_bytes = p_out_buf->i_nb_samples *
i_nb_channels * sizeof(int32_t);
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->i_nb_samples );
+ p_out_buf->i_length = date_Increment( &p_sys->end_date,
+ p_out_buf->i_nb_samples ) - p_out_buf->i_pts;
p_out_buf->i_nb_bytes = p_out_buf->i_nb_samples *
i_nb_channels * sizeof(int32_t);
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_pts = p_in_buf->i_pts;
- p_out_buf->end_date = p_out_buf->i_pts + p_out_buf->i_nb_samples *
+ p_out_buf->i_length = p_out_buf->i_nb_samples *
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_pts = p_in_buf->i_pts;
- p_out_buf->end_date = p_out_buf->i_pts + p_out_buf->i_nb_samples *
+ p_out_buf->i_length = p_out_buf->i_nb_samples *
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 */
- next_date += p_buffer->end_date - p_buffer->i_pts;
+ next_date += p_buffer->i_length;
}
else
{
if( p_buffer )
{
- mtime_t buffer_length = (p_buffer->end_date
- - p_buffer->i_pts);
+ mtime_t buffer_length = p_buffer->i_length;
next_date = next_date + buffer_length;
i_buffer_length = buffer_length/1000;
}
if( p_buf == NULL ) return NULL;
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 );
+ p_buf->i_length = date_Increment( &p_sys->end_date,
+ p_sys->frame.i_samples ) - p_buf->i_pts;
return p_buf;
}
}
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->i_length = date_Increment( &p_sys->end_date,
+ p_sys->i_samplesperblock ) - p_out->i_pts;
switch( p_sys->codec )
{
goto exit;
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->i_length = date_Increment( &p_sys->end_date,
+ i_frame_length ) - p_aout_buffer->i_pts;
p_block->i_buffer -= AES3_HEADER_LEN;
p_block->p_buffer += AES3_HEADER_LEN;
}
p_out->i_pts = date_Get( &p_sys->end_date );
- p_out->end_date = date_Increment( &p_sys->end_date, i_samples );
+ p_out->i_length = date_Increment( &p_sys->end_date, i_samples )
+ - p_out->i_pts;
if( p_sys->p_logtos16 )
{
return NULL;
p_buffer->i_pts = date_Get( &p_sys->end_date );
- p_buffer->end_date = date_Increment( &p_sys->end_date, i_samples );
+ p_buffer->i_length = date_Increment( &p_sys->end_date, i_samples )
+ - p_buffer->i_pts;
if( p_sys->b_extract )
aout_ChannelExtract( p_buffer->p_buffer, p_dec->fmt_out.audio.i_channels,
block_out.p_buffer, block_out.i_buffer );
/* Date management */
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->i_length =
+ date_Increment( &p_sys->end_date, i_samples )
+ - p_aout_buffer->i_pts;
}
p_out->vt->Release( (IUnknown *)p_out );
p_buf->i_nb_bytes = p_sys->i_frame_size;
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->i_length = date_Increment( &p_sys->end_date, p_sys->i_frame_length )
+ - p_buf->i_pts;
return p_buf;
}
}
p_out->i_pts = date_Get( &p_sys->date );
- p_out->end_date = date_Increment( &p_sys->date, frame.samples / frame.channels );
+ p_out->i_length = date_Increment( &p_sys->date,
+ frame.samples / frame.channels ),
+ - p_out->i_pts;
DoReordering( (uint32_t *)p_out->p_buffer, samples,
frame.samples / frame.channels, frame.channels,
/* Date management (already done by packetizer) */
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->i_length = p_sys->p_block->i_length;
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
goto drop;
p_out->i_pts = date_Get (&p_sys->end_date );
- p_out->end_date = date_Increment (&p_sys->end_date, samples);
+ p_out->i_length = date_Increment (&p_sys->end_date, samples)
+ - p_out->i_pts;
if (!p_sys->fixed)
fluid_synth_write_float (p_sys->synth, samples,
p_out->p_buffer, 0, 2,
return NULL;
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->i_length =
+ date_Increment( &p_sys->end_date, i_frame_length )
+ - p_aout_buffer->i_pts;
p_block->p_buffer += p_sys->i_header_size + i_padding;
p_block->i_buffer -= p_sys->i_header_size + i_padding;
if( p_buf == NULL ) return NULL;
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->i_length = date_Increment( &p_sys->end_date, p_sys->i_frame_length )
+ - p_buf->i_pts;
if( p_sys->b_discontinuity )
p_buf->i_flags |= BLOCK_FLAG_DISCONTINUITY;
p_sys->b_discontinuity = false;
if( p_out )
{
p_out->i_pts = date_Get( &p_sys->date );
- p_out->end_date = date_Increment( &p_sys->date, i_frames );
+ p_out->i_length = date_Increment( &p_sys->date, i_frames )
+ - p_out->i_pts;
memcpy( p_out->p_buffer,
&p_sys->out_buffer[2 * p_sys->i_out * p_dec->fmt_out.audio.i_channels],
/* Date management */
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->i_length = date_Increment( &p_sys->end_date, i_samples )
+ - p_aout_buffer->i_pts;
}
block_Release( p_block );
*/
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_sys->p_header->frame_size ) - p_aout_buffer->i_pts;
p_sys->i_frame_in_packet++;
/* Date management */
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->i_length =
+ date_Increment( &p_sys->end_date, p_sys->p_header->frame_size )
+ - p_aout_buffer->i_pts;
p_sys->i_frame_in_packet++;
/* Date management */
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->i_length = date_Increment( &p_sys->end_date,
+ i_samples ) - p_aout_buffer->i_pts;
return p_aout_buffer;
}
else
return NULL;
p_buffer->i_pts = date_Get( &p_sys->end_date );
- p_buffer->end_date = date_Increment( &p_sys->end_date, i_samples );
+ p_buffer->i_length = date_Increment( &p_sys->end_date, i_samples )
+ - p_buffer->i_pts;
memcpy( p_buffer->p_buffer, p_sys->p_samples, p_buffer->i_nb_bytes );
p_sys->p_samples += p_buffer->i_nb_bytes;
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->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->i_pts;
- p_audio_block->i_length = p_audio_buf->end_date -
- p_audio_buf->i_pts;
+ p_audio_block->i_length = p_audio_buf->i_length;
p_audio_block->i_nb_samples = p_audio_buf->i_nb_samples;
/* Run filter chain */
p_audio_buf->i_nb_bytes = p_audio_block->i_buffer;
p_audio_buf->i_nb_samples = p_audio_block->i_nb_samples;
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;
+ p_audio_buf->i_length = p_audio_block->i_length;
audio_timer_start( id->p_encoder );
p_block = id->p_encoder->pf_encode_audio( id->p_encoder, p_audio_buf );
#undef p_effect
}
- p_outpic->date = ( p_in_buf->i_pts + p_in_buf->end_date ) / 2;
+ p_outpic->date = p_in_buf->i_pts + (p_in_buf->i_length / 2);
vout_DisplayPicture( p_sys->p_vout, p_outpic );
}
if ( 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_length = date_Increment( &p_fifo->end_date,
p_buffer->i_nb_samples );
+ p_buffer->i_length -= p_buffer->i_pts;
}
else
{
- date_Set( &p_fifo->end_date, p_buffer->end_date );
+ date_Set( &p_fifo->end_date, p_buffer->i_pts + p_buffer->i_length );
}
}
while ( p_buffer != NULL )
{
p_buffer->i_pts += difference;
- p_buffer->end_date += difference;
p_buffer = p_buffer->p_next;
}
}
return NULL;
p_buffer->i_nb_samples = i_nb_samples;
- p_buffer->i_pts = p_buffer->end_date = 0;
+ p_buffer->i_pts = p_buffer->i_length = 0;
return p_buffer;
}
assert( p_buffer->i_pts > 0 );
- p_buffer->end_date = p_buffer->i_pts
- + (mtime_t)p_buffer->i_nb_samples * 1000000
+ p_buffer->i_length = (mtime_t)p_buffer->i_nb_samples * 1000000
/ p_input->input.i_rate;
aout_lock_input( p_aout, p_input );
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->i_pts = p_buffer->i_pts;
- p_new_buffer->end_date = p_buffer->end_date;
+ p_new_buffer->i_length = p_buffer->i_length;
aout_BufferFree( p_buffer );
p_buffer = p_new_buffer;
p_input->b_changed = false;
for( aout_buffer_t *p = p_input->mixer.fifo.p_first; p != NULL; p = p->p_next )
{
p->i_pts += i_duration;
- p->end_date += i_duration;
}
aout_unlock_mixer( p_aout );
}
if( p_output_buffer == NULL )
return;
p_output_buffer->i_pts = (*pp_input_buffer)->i_pts;
- p_output_buffer->end_date = (*pp_input_buffer)->end_date;
+ p_output_buffer->i_length = (*pp_input_buffer)->i_length;
/* Please note that p_output_buffer->i_nb_samples & i_nb_bytes
* shall be set by the filter plug-in. */
#endif
/* Adding the start date will be managed by aout_FifoPush(). */
- p_buffer->end_date = start_date +
- (p_buffer->end_date - p_buffer->i_pts);
p_buffer->i_pts = start_date;
aout_lock_input_fifos( p_aout );
}
/* Check for the continuity of start_date */
- while ( p_buffer != NULL && p_buffer->end_date < start_date - 1 )
+ while ( p_buffer != NULL
+ && p_buffer->i_pts + p_buffer->i_length < start_date - 1 )
{
/* We authorize a +-1 because rounding errors get compensated
* regularly. */
aout_buffer_t * p_next = p_buffer->p_next;
msg_Warn( p_aout, "the mixer got a packet in the past (%"PRId64")",
- start_date - p_buffer->end_date );
+ start_date - (p_buffer->i_pts + p_buffer->i_length) );
aout_BufferFree( p_buffer );
p_fifo->p_first = p_buffer = p_next;
p_input->mixer.begin = NULL;
{
p_buffer = p_fifo->p_first;
if ( p_buffer == NULL ) break;
- if ( p_buffer->end_date >= end_date ) break;
+ if ( p_buffer->i_pts + p_buffer->i_length >= end_date ) break;
/* Check that all buffers are contiguous. */
- prev_date = p_fifo->p_first->end_date;
+ prev_date = p_fifo->p_first->i_pts + p_fifo->p_first->i_length;
p_buffer = p_buffer->p_next;
b_drop_buffers = 0;
for ( ; p_buffer != NULL; p_buffer = p_buffer->p_next )
b_drop_buffers = 1;
break;
}
- if ( p_buffer->end_date >= end_date ) break;
- prev_date = p_buffer->end_date;
+ if ( p_buffer->i_pts + p_buffer->i_length >= end_date ) break;
+ prev_date = p_buffer->i_pts + p_buffer->i_length;
}
if ( b_drop_buffers )
{
/ p_aout->p_mixer->fmt.i_frame_length;
}
p_output_buffer->i_pts = start_date;
- p_output_buffer->end_date = end_date;
+ p_output_buffer->i_length = end_date - start_date;
p_aout->p_mixer->mix( p_aout->p_mixer, p_output_buffer );
{
msg_Dbg( p_aout, "audio output is too slow (%"PRId64"), "
"trashing %"PRId64"us", mdate() - p_buffer->i_pts,
- p_buffer->end_date - p_buffer->i_pts );
+ p_buffer->i_length );
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.
*/
- if ( p_buffer->i_pts > start_date
- + (p_buffer->end_date - p_buffer->i_pts) )
+ if ( p_buffer->i_pts > start_date + p_buffer->i_length )
/*
* + AOUT_PTS_TOLERANCE )
* There is no reason to want that, it just worsen the scheduling of
const bool b_dated = p_audio->i_pts > VLC_TS_INVALID;
int i_rate = INPUT_RATE_DEFAULT;
- DecoderFixTs( p_dec, &p_audio->i_pts, &p_audio->end_date, NULL,
+ DecoderFixTs( p_dec, &p_audio->i_pts, NULL, &p_audio->i_length,
&i_rate, AOUT_MAX_ADVANCE_TIME, false );
vlc_mutex_unlock( &p_owner->lock );