if( !p_owner->p_clock )
return i_ts;
- return input_clock_GetTS( p_owner->p_clock, p_owner->p_input->i_pts_delay, i_ts );
+ return input_clock_GetTS( p_owner->p_clock, NULL, p_owner->p_input->i_pts_delay, i_ts );
}
/* decoder_GetDisplayRate:
*/
}
}
-void input_DecoderDiscontinuity( decoder_t * p_dec, bool b_flush )
-{
- decoder_owner_sys_t *p_owner = p_dec->p_owner;
- block_t *p_null;
-
- /* Empty the fifo */
- if( p_owner->b_own_thread && b_flush )
- block_FifoEmpty( p_owner->p_fifo );
-
- /* Send a special block */
- p_null = block_New( p_dec, 128 );
- p_null->i_flags |= BLOCK_FLAG_DISCONTINUITY;
- if( b_flush && p_dec->fmt_in.i_cat == SPU_ES )
- p_null->i_flags |= BLOCK_FLAG_CORE_FLUSH;
- /* FIXME check for p_packetizer or b_packitized from es_format_t of input ? */
- if( p_owner->p_packetizer && b_flush )
- p_null->i_flags |= BLOCK_FLAG_CORRUPTED;
- memset( p_null->p_buffer, 0, p_null->i_buffer );
-
- input_DecoderDecode( p_dec, p_null );
-}
-
-bool input_DecoderEmpty( decoder_t * p_dec )
+bool input_DecoderIsEmpty( decoder_t * p_dec )
{
if( p_dec->p_owner->b_own_thread &&
block_FifoCount( p_dec->p_owner->p_fifo ) > 0 )
p_owner->i_ts_delay = i_delay;
vlc_mutex_unlock( &p_owner->lock );
}
+
+void input_DecoderFlush( decoder_t *p_dec )
+{
+ decoder_owner_sys_t *p_owner = p_dec->p_owner;
+ block_t *p_null;
+
+ /* Empty the fifo */
+ if( p_owner->b_own_thread )
+ block_FifoEmpty( p_owner->p_fifo );
+
+ /* Send a special block */
+ p_null = block_New( p_dec, 128 );
+ p_null->i_flags |= BLOCK_FLAG_DISCONTINUITY;
+ if( p_dec->fmt_in.i_cat == SPU_ES )
+ p_null->i_flags |= BLOCK_FLAG_CORE_FLUSH;
+ /* FIXME check for p_packetizer or b_packitized from es_format_t of input ? */
+ if( p_owner->p_packetizer )
+ p_null->i_flags |= BLOCK_FLAG_CORRUPTED;
+ memset( p_null->p_buffer, 0, p_null->i_buffer );
+
+ input_DecoderDecode( p_dec, p_null );
+}
+
/**
* Create a decoder object
*
{
assert( p_clock );
- p_block->i_rate = input_clock_GetRate( p_clock );
+ p_block->i_rate = 0;
if( p_block->i_dts > 0 )
- p_block->i_dts = input_clock_GetTS( p_clock, i_ts_delay, p_block->i_dts );
+ p_block->i_dts = input_clock_GetTS( p_clock, &p_block->i_rate,
+ i_ts_delay, p_block->i_dts );
if( p_block->i_pts > 0 )
- p_block->i_pts = input_clock_GetTS( p_clock, i_ts_delay, p_block->i_pts );
+ p_block->i_pts = input_clock_GetTS( p_clock, &p_block->i_rate,
+ i_ts_delay, p_block->i_pts );
if( p_block->i_length > 0 )
p_block->i_length = ( p_block->i_length * p_block->i_rate +
if( b_teletext )
p_block->i_pts = DecoderTeletextFixTs( p_block->i_pts, i_ts_delay );
}
-static void DecoderAoutBufferFixTs( aout_buffer_t *p_buffer,
+static void DecoderAoutBufferFixTs( aout_buffer_t *p_buffer, int *pi_rate,
input_clock_t *p_clock, mtime_t i_ts_delay )
{
/* sout display module does not set clock */
if( !p_clock )
return;
+ if( !p_buffer->start_date && !p_buffer->end_date )
+ *pi_rate = input_clock_GetRate( p_clock );
+
if( p_buffer->start_date )
- p_buffer->start_date = input_clock_GetTS( p_clock, i_ts_delay, p_buffer->start_date );
+ p_buffer->start_date = input_clock_GetTS( p_clock, pi_rate,
+ i_ts_delay, p_buffer->start_date );
if( p_buffer->end_date )
- p_buffer->end_date = input_clock_GetTS( p_clock, i_ts_delay, p_buffer->end_date );
+ p_buffer->end_date = input_clock_GetTS( p_clock, pi_rate,
+ i_ts_delay, p_buffer->end_date );
}
static void DecoderVoutBufferFixTs( picture_t *p_picture,
input_clock_t *p_clock, mtime_t i_ts_delay )
return;
if( p_picture->date )
- p_picture->date = input_clock_GetTS( p_clock, i_ts_delay, p_picture->date );
+ p_picture->date = input_clock_GetTS( p_clock, NULL,
+ i_ts_delay, p_picture->date );
}
static void DecoderSpuBufferFixTs( subpicture_t *p_subpic,
input_clock_t *p_clock, mtime_t i_ts_delay,
return;
if( p_subpic->i_start )
- p_subpic->i_start = input_clock_GetTS( p_clock, i_ts_delay, p_subpic->i_start );
+ p_subpic->i_start = input_clock_GetTS( p_clock, NULL,
+ i_ts_delay, p_subpic->i_start );
if( p_subpic->i_stop )
- p_subpic->i_stop = input_clock_GetTS( p_clock, i_ts_delay, p_subpic->i_stop );
+ p_subpic->i_stop = input_clock_GetTS( p_clock, NULL,
+ i_ts_delay, p_subpic->i_stop );
/* Do not create ephemere picture because of rounding errors */
if( !b_ephemere && p_subpic->i_start == p_subpic->i_stop )
{
aout_instance_t *p_aout = p_owner->p_aout;
aout_input_t *p_aout_input = p_owner->p_aout_input;
- int i_rate;
int i_lost;
int i_played;
DecoderWaitUnpause( p_dec );
const mtime_t i_delay = DecoderGetTotalDelay( p_dec );
+ int i_rate = INPUT_RATE_DEFAULT;
- DecoderAoutBufferFixTs( p_aout_buf, p_clock, i_delay );
+ DecoderAoutBufferFixTs( p_aout_buf, &i_rate, p_clock, i_delay );
- if( p_clock )
- i_rate = input_clock_GetRate( p_clock );
- else if( p_block && p_block->i_rate > 0 )
+ if( !p_clock && p_block && p_block->i_rate > 0 )
i_rate = p_block->i_rate;
- else
- i_rate = INPUT_RATE_DEFAULT;
/* FIXME TODO take care of audio-delay for mdate check */
const mtime_t i_max_date = mdate() + i_delay + AOUT_MAX_ADVANCE_TIME;
return input_clock_GetWakeup( p_sys->p_pgrm->p_clock );
}
-static void EsOutDiscontinuity( es_out_t *out, bool b_flush, bool b_audio )
-{
- es_out_sys_t *p_sys = out->p_sys;
- int i;
-
- for( i = 0; i < p_sys->i_es; i++ )
- {
- es_out_id_t *es = p_sys->es[i];
-
- /* Send a dummy block to let decoder know that
- * there is a discontinuity */
- if( es->p_dec && ( !b_audio || es->fmt.i_cat == AUDIO_ES ) )
- {
- input_DecoderDiscontinuity( es->p_dec, b_flush );
- if( es->p_dec_record )
- input_DecoderDiscontinuity( es->p_dec_record, b_flush );
- }
- }
-}
static void EsOutDecodersChangePause( es_out_t *out, bool b_paused, mtime_t i_date )
{
es_out_sys_t *p_sys = out->p_sys;
}
void input_EsOutChangePosition( es_out_t *out )
{
- //es_out_sys_t *p_sys = out->p_sys;
+ es_out_sys_t *p_sys = out->p_sys;
+
+ for( int i = 0; i < p_sys->i_es; i++ )
+ {
+ es_out_id_t *es = p_sys->es[i];
+
+ /* Send a dummy block to let decoder know that
+ * there is a discontinuity */
+ if( es->p_dec )
+ {
+ input_DecoderFlush( es->p_dec );
+ if( es->p_dec_record )
+ input_DecoderFlush( es->p_dec_record );
+ }
+ }
es_out_Control( out, ES_OUT_RESET_PCR );
- EsOutDiscontinuity( out, true, false );
}
bool input_EsOutDecodersEmpty( es_out_t *out )
{
es_out_id_t *es = p_sys->es[i];
- if( es->p_dec && !input_DecoderEmpty( es->p_dec ) )
+ if( es->p_dec && !input_DecoderIsEmpty( es->p_dec ) )
return false;
- if( es->p_dec_record && !input_DecoderEmpty( es->p_dec_record ) )
+ if( es->p_dec_record && !input_DecoderIsEmpty( es->p_dec_record ) )
return false;
}
return true;
{
es_out_sys_t *p_sys = out->p_sys;
input_thread_t *p_input = p_sys->p_input;
- es_out_pgrm_t *p_pgrm = es->p_pgrm;
int i_total = 0;
if( libvlc_stats( p_input ) )
{
while( !out->p_sys->p_input->b_die && es->p_dec )
{
- if( input_DecoderEmpty( es->p_dec ) &&
- ( !es->p_dec_record || input_DecoderEmpty( es->p_dec_record ) ))
+ if( input_DecoderIsEmpty( es->p_dec ) &&
+ ( !es->p_dec_record || input_DecoderIsEmpty( es->p_dec_record ) ))
break;
msleep( 20*1000 );
}
{
int64_t i_ts = (int64_t)va_arg( args, int64_t );
int64_t *pi_ts = (int64_t *)va_arg( args, int64_t * );
- *pi_ts = input_clock_GetTS( p_sys->p_pgrm->p_clock,
+ *pi_ts = input_clock_GetTS( p_sys->p_pgrm->p_clock, NULL,
p_sys->p_input->i_pts_delay, i_ts );
return VLC_SUCCESS;
}