p_input->p->input.b_rescale_ts = true;
p_input->p->input.b_eof = false;
p_input->p->input.i_cr_average = 0;
- memset( &p_input->p->input_last_times, 0, sizeof(p_input->p->input_last_times) );
vlc_mutex_lock( &p_item->lock );
*/
static void MainLoopInterface( input_thread_t *p_input )
{
- input_event_times_t ev;
- mtime_t i_es_out_delay;
-
- es_out_GetBuffering( p_input->p->p_es_out, &i_es_out_delay );
-
- ev.f_position = 0.0;
- ev.i_time = 0;
- ev.i_length = 0;
+ double f_position = 0.0;
+ mtime_t i_time = 0;
+ mtime_t i_length = 0;
/* update input status variables */
if( demux_Control( p_input->p->input.p_demux,
- DEMUX_GET_POSITION, &ev.f_position ) )
- ev.f_position = 0.0;
+ DEMUX_GET_POSITION, &f_position ) )
+ f_position = 0.0;
if( demux_Control( p_input->p->input.p_demux,
- DEMUX_GET_TIME, &ev.i_time ) )
- ev.i_time = 0;
+ DEMUX_GET_TIME, &i_time ) )
+ i_time = 0;
if( demux_Control( p_input->p->input.p_demux,
- DEMUX_GET_LENGTH, &ev.i_length ) )
- ev.i_length = 0;
-
- if( ev.i_time > 0 )
- {
- ev.i_time -= i_es_out_delay;
- if( ev.i_time < 0 )
- ev.i_time = 0;
- }
- if( ev.i_length > 0 )
- {
- ev.f_position -= (double)i_es_out_delay / ev.i_length;
- }
+ DEMUX_GET_LENGTH, &i_length ) )
+ i_length = 0;
- if( p_input->i_state == PAUSE_S )
- {
- input_event_times_t old = p_input->p->input_last_times;
-
- /* XXX We have a jitter because of PCR frequency/get time precision.
- * Hides it */
- if( llabs(ev.i_time - old.i_time) < CLOCK_FREQ )
- ev.i_time = old.i_time;
- }
-
- p_input->p->input_last_times = ev;
-
- input_SendEventTimes( p_input, &ev );
+ es_out_SetTimes( p_input->p->p_es_out, f_position, i_time, i_length );
}
/**
* is paused -> this may cause problem with some of them
* The same problem can be seen when seeking while paused */
b_paused = p_input->i_state == PAUSE_S &&
- !es_out_GetBuffering( p_input->p->p_es_out, NULL );
+ !es_out_GetBuffering( p_input->p->p_es_out );
if( !b_paused )
{
/* Load master infos */
/* Init length */
- input_event_times_t ev_times;
- ev_times.f_position = 0;
- ev_times.i_time = 0;
+ mtime_t i_length;
if( demux_Control( p_input->p->input.p_demux, DEMUX_GET_LENGTH,
- &ev_times.i_length ) )
- ev_times.i_length = 0;
- if( ev_times.i_length <= 0 )
- ev_times.i_length = input_item_GetDuration( p_input->p->input.p_item );
- input_SendEventTimes( p_input, &ev_times );
+ &i_length ) )
+ i_length = 0;
+ if( i_length <= 0 )
+ i_length = input_item_GetDuration( p_input->p->input.p_item );
+ input_SendEventTimes( p_input, 0.0, 0, i_length );
StartTitle( p_input );
/* Clean control variables */
input_ControlVarStop( p_input );
+ /* Stop es out activity */
+ es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ACTIVE, false );
+ es_out_Control( p_input->p->p_es_out, ES_OUT_SET_MODE, ES_OUT_MODE_NONE );
+
/* Clean up master */
InputSourceClean( &p_input->p->input );
msg_Err( p_input, "INPUT_CONTROL_SET_POSITION(_OFFSET) ignored while recording" );
break;
}
- if( i_type == INPUT_CONTROL_SET_POSITION )
- {
- f_pos = val.f_float;
- }
- else
- {
- /* Should not fail */
- demux_Control( p_input->p->input.p_demux,
- DEMUX_GET_POSITION, &f_pos );
- f_pos += val.f_float;
- }
- if( f_pos < 0.0 ) f_pos = 0.0;
- if( f_pos > 1.0 ) f_pos = 1.0;
+ f_pos = val.f_float;
+ if( i_type != INPUT_CONTROL_SET_POSITION )
+ f_pos += var_GetFloat( p_input, "position" );
+ if( f_pos < 0.0 )
+ f_pos = 0.0;
+ else if( f_pos > 1.0 )
+ f_pos = 1.0;
/* Reset the decoders states and clock sync (before calling the demuxer */
es_out_SetTime( p_input->p->p_es_out, -1 );
if( demux_Control( p_input->p->input.p_demux, DEMUX_SET_POSITION,
break;
}
- if( i_type == INPUT_CONTROL_SET_TIME )
- {
- i_time = val.i_time;
- }
- else
- {
- /* Should not fail */
- demux_Control( p_input->p->input.p_demux,
- DEMUX_GET_TIME, &i_time );
- i_time += val.i_time;
- }
- if( i_time < 0 ) i_time = 0;
+ i_time = val.i_time;
+ if( i_type != INPUT_CONTROL_SET_TIME )
+ i_time += var_GetTime( p_input, "time" );
+
+ if( i_time < 0 )
+ i_time = 0;
/* Reset the decoders states and clock sync (before calling the demuxer */
es_out_SetTime( p_input->p->p_es_out, -1 );
{
i_seekpoint = p_demux->info.i_seekpoint;
i_seekpoint_time = p_input->p->input.title[p_demux->info.i_title]->seekpoint[i_seekpoint]->i_time_offset;
- if( i_seekpoint_time >= 0 &&
- !demux_Control( p_demux,
- DEMUX_GET_TIME, &i_input_time ) )
+ i_input_time = var_GetTime( p_input, "time" );
+ if( i_seekpoint_time >= 0 && i_input_time >= 0 )
{
if( i_input_time < i_seekpoint_time + 3000000 )
i_seekpoint--;
{
i_seekpoint = p_access->info.i_seekpoint;
i_seekpoint_time = p_input->p->input.title[p_access->info.i_title]->seekpoint[i_seekpoint]->i_time_offset;
- if( i_seekpoint_time >= 0 &&
- demux_Control( p_demux,
- DEMUX_GET_TIME, &i_input_time ) )
+ i_input_time = var_GetTime( p_input, "time" );
+ if( i_seekpoint_time >= 0 && i_input_time >= 0 )
{
if( i_input_time < i_seekpoint_time + 3000000 )
i_seekpoint--;