[vlc-devel] commit: Extended input_GetPcrSystem to also return the current delay. ( Laurent Aimar )

git version control git at videolan.org
Sat Feb 6 16:24:43 CET 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Feb  6 16:23:03 2010 +0100| [028ea651e57285d26d14c5d56ccd4e0de0ba5598] | committer: Laurent Aimar 

Extended input_GetPcrSystem to also return the current delay.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=028ea651e57285d26d14c5d56ccd4e0de0ba5598
---

 include/vlc_es_out.h         |    6 +++---
 include/vlc_input.h          |    6 +++---
 modules/control/netsync.c    |    5 +++--
 src/input/clock.c            |    8 ++++----
 src/input/clock.h            |    4 ++--
 src/input/control.c          |    3 ++-
 src/input/es_out.c           |    3 ++-
 src/input/es_out_timeshift.c |    3 ++-
 8 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h
index 3d25e40..57fc5c0 100644
--- a/include/vlc_es_out.h
+++ b/include/vlc_es_out.h
@@ -86,7 +86,7 @@ enum es_out_query_e
     ES_OUT_SET_META, /* arg1=const vlc_meta_t * */
 
     /* PCR system clock manipulation for external clock synchronization */
-    ES_OUT_GET_PCR_SYSTEM, /* arg1=mtime_t * res=can fail */
+    ES_OUT_GET_PCR_SYSTEM, /* arg1=mtime_t *, arg2=mtime_t * res=can fail */
     ES_OUT_MODIFY_PCR_SYSTEM, /* arg1=int is_absolute, arg2=mtime_t, res=can fail */
 
     /* First value usable for private control */
@@ -147,9 +147,9 @@ static inline int es_out_ControlSetMeta( es_out_t *out, const vlc_meta_t *p_meta
     return es_out_Control( out, ES_OUT_SET_META, p_meta );
 }
 
-static inline int es_out_ControlGetPcrSystem( es_out_t *out, mtime_t *pi_system )
+static inline int es_out_ControlGetPcrSystem( es_out_t *out, mtime_t *pi_system, mtime_t *pi_delay )
 {
-    return es_out_Control( out, ES_OUT_GET_PCR_SYSTEM, pi_system );
+    return es_out_Control( out, ES_OUT_GET_PCR_SYSTEM, pi_system, pi_delay );
 }
 static inline int es_out_ControlModifyPcrSystem( es_out_t *out, bool b_absolute, mtime_t i_system )
 {
diff --git a/include/vlc_input.h b/include/vlc_input.h
index 7f7c72f..250cdcd 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -516,7 +516,7 @@ enum input_query_e
     INPUT_GET_ES_OBJECTS,   /* arg1=int id, vlc_object_t **dec, vout_thread_t **, aout_instance_t ** */
 
     /* External clock managments */
-    INPUT_GET_PCR_SYSTEM,   /* arg1=mtime_t *                       res=can fail */
+    INPUT_GET_PCR_SYSTEM,   /* arg1=mtime_t *, arg2=mtime_t *       res=can fail */
     INPUT_MODIFY_PCR_SYSTEM,/* arg1=int absolute, arg2=mtime_t      res=can fail */
 };
 
@@ -622,9 +622,9 @@ static inline int input_GetEsObjects( input_thread_t *p_input, int i_id,
 /**
  * \see input_clock_GetSystemOrigin
  */
-static inline int input_GetPcrSystem( input_thread_t *p_input, mtime_t *pi_system )
+static inline int input_GetPcrSystem( input_thread_t *p_input, mtime_t *pi_system, mtime_t *pi_delay )
 {
-    return input_Control( p_input, INPUT_GET_PCR_SYSTEM, pi_system );
+    return input_Control( p_input, INPUT_GET_PCR_SYSTEM, pi_system, pi_delay );
 }
 /**
  * \see input_clock_ChangeSystemOrigin
diff --git a/modules/control/netsync.c b/modules/control/netsync.c
index 63fb8f4..fb7956e 100644
--- a/modules/control/netsync.c
+++ b/modules/control/netsync.c
@@ -164,8 +164,9 @@ void Close(vlc_object_t *object)
 static mtime_t GetPcrSystem(input_thread_t *input)
 {
     int canc = vlc_savecancel();
+    /* TODO use the delay */
     mtime_t system;
-    if (input_GetPcrSystem(input, &system))
+    if (input_GetPcrSystem(input, &system, NULL))
         system = -1;
     vlc_restorecancel(canc);
 
@@ -251,7 +252,7 @@ static void *Slave(void *handle)
             int canc = vlc_savecancel();
 
             mtime_t client_system;
-            if (!input_GetPcrSystem(sys->input, &client_system)) {
+            if (!input_GetPcrSystem(sys->input, &client_system, NULL)) {
                 const mtime_t diff_system = client_system - master_system - diff_date;
                 if (diff_system != 0) {
                     input_ModifyPcrSystem(sys->input, true, master_system - diff_date);
diff --git a/src/input/clock.c b/src/input/clock.c
index 9b87b4b..c4f8100 100644
--- a/src/input/clock.c
+++ b/src/input/clock.c
@@ -515,17 +515,17 @@ void input_clock_ChangeSystemOrigin( input_clock_t *cl, bool b_absolute, mtime_t
     vlc_mutex_unlock( &cl->lock );
 }
 
-mtime_t input_clock_GetSystemOrigin( input_clock_t *cl )
+void input_clock_GetSystemOrigin( input_clock_t *cl, mtime_t *pi_system, mtime_t *pi_delay )
 {
     vlc_mutex_lock( &cl->lock );
 
     assert( cl->b_has_reference );
 
-    const mtime_t i_system = cl->ref.i_system;
+    *pi_system = cl->ref.i_system;
+    if( pi_delay )
+        *pi_delay  = cl->i_pts_delay;
 
     vlc_mutex_unlock( &cl->lock );
-
-    return i_system;
 }
 
 #warning "input_clock_SetJitter needs more work"
diff --git a/src/input/clock.h b/src/input/clock.h
index 688b56f..99c0af5 100644
--- a/src/input/clock.h
+++ b/src/input/clock.h
@@ -84,10 +84,10 @@ void    input_clock_ChangeRate( input_clock_t *, int i_rate );
 void    input_clock_ChangePause( input_clock_t *, bool b_paused, mtime_t i_date );
 
 /**
- * This function returns the original system value date for the current
+ * This function returns the original system value date and the delay for the current
  * reference point (a valid reference point must have been set).
  */
-mtime_t input_clock_GetSystemOrigin( input_clock_t * );
+void    input_clock_GetSystemOrigin( input_clock_t *, mtime_t *pi_system, mtime_t *pi_delay );
 
 /**
  * This function allows to rebase the original system value date (a valid
diff --git a/src/input/control.c b/src/input/control.c
index b2cf6b4..e1cd747 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -466,7 +466,8 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
         case INPUT_GET_PCR_SYSTEM:
         {
             mtime_t *pi_system = va_arg( args, mtime_t * );
-            return es_out_ControlGetPcrSystem( p_input->p->p_es_out_display, pi_system );
+            mtime_t *pi_delay  = va_arg( args, mtime_t * );
+            return es_out_ControlGetPcrSystem( p_input->p->p_es_out_display, pi_system, pi_delay );
         }
 
         case INPUT_MODIFY_PCR_SYSTEM:
diff --git a/src/input/es_out.c b/src/input/es_out.c
index c596ae6..9bf2803 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2624,7 +2624,8 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
                 return VLC_EGENERIC;
 
             mtime_t *pi_system = va_arg( args, mtime_t *);
-            *pi_system = input_clock_GetSystemOrigin( p_pgrm->p_clock );
+            mtime_t *pi_delay  = va_arg( args, mtime_t *);
+            input_clock_GetSystemOrigin( p_pgrm->p_clock, pi_system, pi_delay );
             return VLC_SUCCESS;
         }
 
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index d650234..dd840fa 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -678,7 +678,8 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
             return VLC_EGENERIC;
 
         mtime_t *pi_system = (mtime_t*)va_arg( args, mtime_t * );
-        return es_out_ControlGetPcrSystem( p_sys->p_out, pi_system );
+        mtime_t *pi_delay  = (mtime_t*)va_arg( args, mtime_t * );
+        return es_out_ControlGetPcrSystem( p_sys->p_out, pi_system, pi_delay );
     }
     case ES_OUT_MODIFY_PCR_SYSTEM:
     {




More information about the vlc-devel mailing list