* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.38 2001/05/30 17:03:11 sam Exp $
+ * $Id: input_ext-intf.h,v 1.39 2001/06/09 17:01:21 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
mtime_t cr_ref, sysdate_ref;
mtime_t last_cr; /* reference to detect unexpected stream
* discontinuities */
+ mtime_t last_syscr;
count_t c_average_count;
/* counter used to compute dynamic average values */
int i_synchro_state;
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: input_dvd.c,v 1.68 2001/06/07 22:25:42 sam Exp $
+ * $Id: input_dvd.c,v 1.69 2001/06/09 17:01:22 stef Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
DVDFindSector( p_dvd );
p_dvd->i_cell += p_dvd->i_angle_cell;
+
+ if( p_input->stream.pp_programs[0]->i_synchro_state == SYNCHRO_OK )
+ {
+ p_input->stream.pp_programs[0]->i_synchro_state =
+ SYNCHRO_REINIT;
+ }
}
else
{
p_input->stream.b_seekable = 1;
p_input->stream.b_changed = 1;
- p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_REINIT;
return 0;
}
p_input->stream.p_selected_area->i_part = p_dvd->i_chapter;
/* the synchro has to be reinitialized when we change cell */
- p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_REINIT;
+// p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_REINIT;
vlc_mutex_unlock( &p_input->stream.stream_lock );
* ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: ac3_spdif.c,v 1.7 2001/05/31 01:37:08 sam Exp $
+ * $Id: ac3_spdif.c,v 1.8 2001/06/09 17:01:22 stef Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
while( !p_spdif->p_fifo->b_die && !p_spdif->p_fifo->b_error )
{
/* Handle the dates */
- if(DECODER_FIFO_START(*p_spdif->p_fifo)->i_pts)
+ if( p_spdif->i_pts != m_last_pts )
{
- m_last_pts = DECODER_FIFO_START(*p_spdif->p_fifo)->i_pts;
- DECODER_FIFO_START(*p_spdif->p_fifo)->i_pts = 0;
+ m_last_pts = p_spdif->i_pts;
}
else
{
static void BitstreamCallback ( bit_stream_t * p_bit_stream,
boolean_t b_new_pes)
{
+ ac3_spdif_thread_t * p_spdif;
+
if( b_new_pes )
{
+ p_spdif = (ac3_spdif_thread_t *)p_bit_stream->p_callback_arg;
+
p_bit_stream->p_byte += 3;
+
+ p_spdif->i_pts =
+ DECODER_FIFO_START( *p_bit_stream->p_decoder_fifo )->i_pts;
+ DECODER_FIFO_START( *p_bit_stream->p_decoder_fifo )->i_pts = 0;
}
}
* ac3_spdif.h: header for ac3 pass-through
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: ac3_spdif.h,v 1.3 2001/05/06 18:32:30 stef Exp $
+ * $Id: ac3_spdif.h,v 1.4 2001/06/09 17:01:22 stef Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
*
u8 * p_ac3;
u8 * p_iec;
+ /* current pes date */
+ mtime_t i_pts;
+
/*
* Output properties
*/
* aout_spdif: ac3 passthrough output
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: aout_spdif.c,v 1.11 2001/05/31 16:10:05 stef Exp $
+ * $Id: aout_spdif.c,v 1.12 2001/06/09 17:01:22 stef Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Stéphane Borel <stef@via.ecp.fr>
/* variable used to compute the nnumber of blank frames since the
* last significant frame */
i_blank = 0;
+ mdelta = 0;
/* Compute the theorical duration of an ac3 frame */
l_start_frame];
mdelta = mplay - mdate();
- if( mdelta < ( 2 * SLEEP_TIME ) )
+ if( mdelta < ( 3 * SLEEP_TIME ) )
{
intf_WarnMsg( 12, "spdif out (%d):"
"playing frame %lld (%lld)",
i_frame++;
i_blank = 0;
}
+ else
+ {
+ intf_WarnMsg( 12, "spdif out (%d): early frame %lld",
+ i_fifo, mdelta );
+ }
vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
}
else
if( i_frame )
{
- /* we leave some time for aout fifo to fill and not to stress
- * the external decoder too much */
- msleep( SLEEP_TIME );
+ if( mdelta > 0 )
+ {
+ /* we leave some time for aout fifo to fill and not to stress
+ * the external decoder too much */
+ msleep( mdelta + SLEEP_TIME );
+ }
+ else if( mdelta > -SLEEP_TIME )
+ {
+ msleep( SLEEP_TIME );
+ }
}
else
{
/* insert blank frame for stream continuity to
* the external decoder */
intf_WarnMsg( 6, "spdif warning: blank frame" );
- p_aout->pf_play( p_aout, pi_blank, SPDIF_FRAME_SIZE/4 );
+ p_aout->pf_play( p_aout, pi_blank, SPDIF_FRAME_SIZE );
/* we kill the output if we don't have any stream */
if( ++i_blank > BLANK_FRAME_MAX )
* input_clock.c: Clock/System date convertions, stream management
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_clock.c,v 1.16 2001/05/08 14:53:31 bozo Exp $
+ * $Id: input_clock.c,v 1.17 2001/06/09 17:01:22 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
mtime_t i_clock, mtime_t i_sysdate )
{
p_pgrm->cr_ref = i_clock;
- p_pgrm->sysdate_ref = i_sysdate;
+ p_pgrm->sysdate_ref = p_pgrm->last_syscr ? p_pgrm->last_syscr : i_sysdate;
}
/*****************************************************************************
void input_ClockInit( pgrm_descriptor_t * p_pgrm )
{
p_pgrm->last_cr = 0;
+ p_pgrm->last_syscr = 0;
p_pgrm->cr_ref = 0;
p_pgrm->sysdate_ref = 0;
p_pgrm->delta_cr = 0;
void input_ClockManageRef( input_thread_t * p_input,
pgrm_descriptor_t * p_pgrm, mtime_t i_clock )
{
- if( p_pgrm->i_synchro_state != SYNCHRO_OK )
+ 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() );
else
{
p_pgrm->last_cr = 0;
+ p_pgrm->last_syscr = 0;
p_pgrm->delta_cr = 0;
p_pgrm->c_average_count = 0;
}
/* Wait a while before delivering the packets to the decoder.
* In case of multiple programs, we arbitrarily follow the
* clock of the first program. */
- mwait( ClockToSysdate( p_input, p_pgrm, i_clock ) );
+ p_pgrm->last_syscr = ClockToSysdate( p_input, p_pgrm, i_clock );
+ mwait( p_pgrm->last_syscr );
/* Now take into account interface changes. */
vlc_mutex_lock( &p_input->stream.stream_lock );