]> git.sesse.net Git - vlc/commitdiff
* src/audio_output/*, src/input/*: fixed the audio desync option. You can use positiv...
authorGildas Bazin <gbazin@videolan.org>
Thu, 22 May 2003 16:01:02 +0000 (16:01 +0000)
committerGildas Bazin <gbazin@videolan.org>
Thu, 22 May 2003 16:01:02 +0000 (16:01 +0000)
src/audio_output/dec.c
src/input/input.c
src/input/input_clock.c

index 060cc79c37cc41737eb8c26db8a24efb603bdf37..25661f57ebd9a4b95b378a42687c8c11aa144872 100644 (file)
@@ -2,7 +2,7 @@
  * dec.c : audio output API towards decoders
  *****************************************************************************
  * 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>
  *
@@ -136,11 +136,13 @@ static aout_input_t * DecNew( vlc_object_t * p_this, aout_instance_t * p_aout,
     if( p_input_thread )
     {
         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 );
     }
     else
     {
         p_aout->i_pts_delay = DEFAULT_PTS_DELAY;
+        p_aout->i_pts_delay += p_aout->p_vlc->i_desync;
     }
 
     return p_input;
@@ -299,6 +301,10 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
         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 +
          AOUT_MAX_ADVANCE_TIME )
     {
index 33623338b6cc6896d749d927c4a6a62b1cf47f54..e9e8e42e55dc0ad247ffec83c39d261d3b79f81d 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * 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>
  *
@@ -488,6 +488,11 @@ static int InitThread( input_thread_t * p_input )
         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 )
     {
         while( !input_FillBuffer( p_input ) )
index 02ac6b821cf7f71f0efed436d955628816fd546e..7df1aa4d34314a037cdb05407b378788aa76146f 100644 (file)
@@ -2,7 +2,7 @@
  * input_clock.c: Clock/System date convertions, stream management
  *****************************************************************************
  * 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>
  *
@@ -319,9 +319,7 @@ mtime_t input_ClockGetTS( input_thread_t * p_input,
     if( p_pgrm->i_synchro_state == SYNCHRO_OK )
     {
         return( ClockToSysdate( p_input, p_pgrm, i_ts + p_pgrm->delta_cr )
-                 + p_input->i_pts_delay
-                 + (p_input->p_vlc->i_desync > 0
-                       ? p_input->p_vlc->i_desync : 0) );
+                 + p_input->i_pts_delay );
     }
     else
     {