* input_clock.c: Clock/System date convertions, stream management
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: input_clock.c,v 1.33 2002/11/10 18:04:23 sam Exp $
+ * $Id: input_clock.c,v 1.37 2003/05/22 16:01:02 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
#include <vlc/vlc.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h> /* off_t */
-#endif
-
#include "stream_control.h"
#include "input_ext-intf.h"
#include "input_ext-dec.h"
/*****************************************************************************
* ClockToSysdate: converts a movie clock to system date
*****************************************************************************/
-static void ClockNewRef( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm,
- mtime_t i_clock, mtime_t i_sysdate );
static mtime_t ClockToSysdate( input_thread_t * p_input,
pgrm_descriptor_t * p_pgrm, mtime_t i_clock )
{
/*****************************************************************************
* ClockNewRef: writes a new clock reference
*****************************************************************************/
-static void ClockNewRef( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm,
+static void ClockNewRef( pgrm_descriptor_t * p_pgrm,
mtime_t i_clock, mtime_t i_sysdate )
{
p_pgrm->cr_ref = i_clock;
i_old_status = p_input->stream.control.i_status;
p_input->stream.control.i_status = PAUSE_S;
vlc_mutex_unlock( &p_input->stream.control.control_lock );
-
+
vlc_cond_wait( &p_input->stream.stream_wait,
&p_input->stream.stream_lock );
p_pgrm->last_syscr = 0;
- ClockNewRef( p_input, p_pgrm, i_clock, mdate() );
+ ClockNewRef( p_pgrm, i_clock, mdate() );
if( p_input->stream.i_new_status == PAUSE_S )
- {
+ {
/* PAUSE_S undoes the pause state: Return to old state. */
vlc_mutex_lock( &p_input->stream.control.control_lock );
p_input->stream.control.i_status = i_old_status;
vlc_mutex_unlock( &p_input->stream.control.control_lock );
-
+
p_input->stream.i_new_status = UNDEF_S;
p_input->stream.i_new_rate = UNDEF_S;
}
p_input->stream.control.i_status = p_input->stream.i_new_status;
- ClockNewRef( p_input, p_pgrm, i_clock,
+ ClockNewRef( p_pgrm, i_clock,
ClockToSysdate( p_input, p_pgrm, i_clock ) );
if( p_input->stream.control.i_status == PLAYING_S )
if( ( p_pgrm->i_synchro_state != SYNCHRO_OK ) || ( i_clock == 0 ) )
{
/* Feed synchro with a new reference point. */
- ClockNewRef( p_input, p_pgrm, i_clock, mdate() );
+ ClockNewRef( p_pgrm, i_clock, mdate() );
p_pgrm->i_synchro_state = SYNCHRO_OK;
if( p_input->stream.b_pace_control
if( p_pgrm->i_synchro_state == SYNCHRO_OK )
{
return( ClockToSysdate( p_input, p_pgrm, i_ts + p_pgrm->delta_cr )
- + DEFAULT_PTS_DELAY
- + (p_input->p_vlc->i_desync > 0
- ? p_input->p_vlc->i_desync : 0) );
+ + p_input->i_pts_delay );
}
else
{