]> git.sesse.net Git - vlc/blobdiff - src/input/input_clock.c
* Altivec-enabled version of fastmemcpy
[vlc] / src / input / input_clock.c
index b72b7db528336b0e1bd1dc5ce79c98acc4c3eb95..96af2abba727252e972facfab268abcfe5241feb 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.25 2001/12/05 03:31:04 jobi Exp $
+ * $Id: input_clock.c,v 1.29 2002/03/05 17:46:33 stef Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include "defs.h"
-
 #include <string.h>                                    /* memcpy(), memset() */
 #include <sys/types.h>                                              /* off_t */
 
-#include "config.h"
-#include "common.h"
-#include "intf_msg.h"
-#include "threads.h"
-#include "mtime.h"
+#include <videolan/vlc.h>
 
 #include "stream_control.h"
 #include "input_ext-intf.h"
@@ -225,6 +219,12 @@ int input_ClockManageControl( input_thread_t * p_input,
 void input_ClockManageRef( input_thread_t * p_input,
                            pgrm_descriptor_t * p_pgrm, mtime_t i_clock )
 {
+    /* take selected program if none specified */
+    if( !p_pgrm )
+    {
+        p_pgrm = p_input->stream.p_selected_program;
+    }
+
     if( ( p_pgrm->i_synchro_state != SYNCHRO_OK ) || ( i_clock == 0 ) )
     {
         /* Feed synchro with a new reference point. */
@@ -309,10 +309,17 @@ void input_ClockManageRef( input_thread_t * p_input,
 mtime_t input_ClockGetTS( input_thread_t * p_input,
                           pgrm_descriptor_t * p_pgrm, mtime_t i_ts )
 {
+    /* take selected program if none specified */
+    if( !p_pgrm )
+    {
+        p_pgrm = p_input->stream.p_selected_program;
+    }
+
     if( p_pgrm->i_synchro_state == SYNCHRO_OK )
     {
         return( ClockToSysdate( p_input, p_pgrm, i_ts + p_pgrm->delta_cr )
-                 + DEFAULT_PTS_DELAY );
+                 + DEFAULT_PTS_DELAY
+                 + (p_main->i_desync > 0 ? p_main->i_desync : 0) );
     }
     else
     {