Commit d3db3640 authored by Gildas Bazin's avatar Gildas Bazin

* src/audio_output/*, src/input/*: fixed the audio desync option. You can use positive as well as negative values.
parent 8b5235d6
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dec.c : audio output API towards decoders * dec.c : audio output API towards decoders
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: dec.c,v 1.9 2003/03/06 23:10:11 gbazin Exp $ * $Id: dec.c,v 1.10 2003/05/22 16:01:02 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -136,11 +136,13 @@ static aout_input_t * DecNew( vlc_object_t * p_this, aout_instance_t * p_aout, ...@@ -136,11 +136,13 @@ static aout_input_t * DecNew( vlc_object_t * p_this, aout_instance_t * p_aout,
if( p_input_thread ) if( p_input_thread )
{ {
p_aout->i_pts_delay = p_input_thread->i_pts_delay; p_aout->i_pts_delay = p_input_thread->i_pts_delay;
p_aout->i_pts_delay += p_aout->p_vlc->i_desync;
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
} }
else else
{ {
p_aout->i_pts_delay = DEFAULT_PTS_DELAY; p_aout->i_pts_delay = DEFAULT_PTS_DELAY;
p_aout->i_pts_delay += p_aout->p_vlc->i_desync;
} }
return p_input; return p_input;
...@@ -299,6 +301,10 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -299,6 +301,10 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
return -1; return -1;
} }
/* Apply the desynchronisation requested by the user */
p_buffer->start_date += p_aout->p_vlc->i_desync;
p_buffer->end_date += p_aout->p_vlc->i_desync;
if ( p_buffer->start_date > mdate() + p_aout->i_pts_delay + if ( p_buffer->start_date > mdate() + p_aout->i_pts_delay +
AOUT_MAX_ADVANCE_TIME ) AOUT_MAX_ADVANCE_TIME )
{ {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: input.c,v 1.229 2003/05/05 16:09:35 gbazin Exp $ * $Id: input.c,v 1.230 2003/05/22 16:01:02 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -488,6 +488,11 @@ static int InitThread( input_thread_t * p_input ) ...@@ -488,6 +488,11 @@ static int InitThread( input_thread_t * p_input )
p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE; p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE;
} }
/* If the desynchronisation requested by the user is < 0, we need to
* cache more data. */
if( p_input->p_vlc->i_desync < 0 )
p_input->i_pts_delay -= p_input->p_vlc->i_desync;
if( p_input->p_current_data == NULL && p_input->pf_read != NULL ) if( p_input->p_current_data == NULL && p_input->pf_read != NULL )
{ {
while( !input_FillBuffer( p_input ) ) while( !input_FillBuffer( p_input ) )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_clock.c: Clock/System date convertions, stream management * input_clock.c: Clock/System date convertions, stream management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: input_clock.c,v 1.36 2002/12/12 15:10:58 gbazin Exp $ * $Id: input_clock.c,v 1.37 2003/05/22 16:01:02 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -319,9 +319,7 @@ mtime_t input_ClockGetTS( input_thread_t * p_input, ...@@ -319,9 +319,7 @@ mtime_t input_ClockGetTS( input_thread_t * p_input,
if( p_pgrm->i_synchro_state == SYNCHRO_OK ) if( p_pgrm->i_synchro_state == SYNCHRO_OK )
{ {
return( ClockToSysdate( p_input, p_pgrm, i_ts + p_pgrm->delta_cr ) return( ClockToSysdate( p_input, p_pgrm, i_ts + p_pgrm->delta_cr )
+ p_input->i_pts_delay + p_input->i_pts_delay );
+ (p_input->p_vlc->i_desync > 0
? p_input->p_vlc->i_desync : 0) );
} }
else else
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment