[vlc-commits] commit: Prepare for maximal clock jitter configuration. (Laurent Aimar )

git version control git at videolan.org
Thu Mar 4 23:06:59 CET 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Mar  4 22:23:29 2010 +0100| [4c0a761ae89d9c92d24f34e140cb84c75a33a5a9] | committer: Laurent Aimar 

Prepare for maximal clock jitter configuration.

No functionnal changes.

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

 src/input/es_out.c           |   11 ++++++-----
 src/input/es_out.h           |    8 +++++---
 src/input/es_out_timeshift.c |    4 ++++
 src/input/input.c            |    2 +-
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index 865af70..f717338 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2323,7 +2323,7 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
                      * TODO have a mean to correctly reenter bufferization */
                     es_out_Control( out, ES_OUT_RESET_PCR );
 
-                    es_out_SetJitter( out, i_pts_delay, p_sys->i_cr_average );
+                    es_out_SetJitter( out, i_pts_delay, 0, p_sys->i_cr_average );
                 }
             }
             return VLC_SUCCESS;
@@ -2598,19 +2598,20 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
         }
         case ES_OUT_SET_JITTER:
         {
-            mtime_t i_pts_delay = (mtime_t)va_arg( args, mtime_t );
+            mtime_t i_pts_delay  = (mtime_t)va_arg( args, mtime_t );
+            mtime_t i_pts_jitter = (mtime_t)va_arg( args, mtime_t );
             int     i_cr_average = (int)va_arg( args, int );
 
-            if( i_pts_delay == p_sys->i_pts_delay &&
+            if( i_pts_delay + i_pts_jitter == p_sys->i_pts_delay &&
                 i_cr_average == p_sys->i_cr_average )
                 return VLC_SUCCESS;
 
-            p_sys->i_pts_delay = i_pts_delay;
+            p_sys->i_pts_delay = i_pts_delay + i_pts_jitter;
             p_sys->i_cr_average = i_cr_average;
 
             for( int i = 0; i < p_sys->i_pgrm; i++ )
                 input_clock_SetJitter( p_sys->pgrm[i]->p_clock,
-                                       i_pts_delay, i_cr_average );
+                                       i_pts_delay + i_pts_jitter, i_cr_average );
             return VLC_SUCCESS;
         }
 
diff --git a/src/input/es_out.h b/src/input/es_out.h
index d6b2d30..89ece06 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -79,7 +79,7 @@ enum es_out_query_private_e
     ES_OUT_SET_TIMES,                               /* arg1=double f_position arg2=mtime_t i_time arg3=mtime_t i_length res=cannot fail */
 
     /* Set jitter */
-    ES_OUT_SET_JITTER,                              /* arg1=mtime_t i_pts_delay arg2=int i_cr_average res=cannot fail */
+    ES_OUT_SET_JITTER,                              /* arg1=mtime_t i_pts_delay arg2= mtime_t i_pts_jitter, arg2=int i_cr_average res=cannot fail */
 };
 
 static inline void es_out_SetMode( es_out_t *p_out, int i_mode )
@@ -141,9 +141,11 @@ static inline void es_out_SetTimes( es_out_t *p_out, double f_position, mtime_t
     int i_ret = es_out_Control( p_out, ES_OUT_SET_TIMES, f_position, i_time, i_length );
     assert( !i_ret );
 }
-static inline void es_out_SetJitter( es_out_t *p_out, mtime_t i_pts_delay, int i_cr_average )
+static inline void es_out_SetJitter( es_out_t *p_out,
+                                     mtime_t i_pts_delay, mtime_t i_pts_jitter, int i_cr_average )
 {
-    int i_ret = es_out_Control( p_out, ES_OUT_SET_JITTER, i_pts_delay, i_cr_average );
+    int i_ret = es_out_Control( p_out, ES_OUT_SET_JITTER,
+                                i_pts_delay, i_pts_jitter, i_cr_average );
     assert( !i_ret );
 }
 static inline int es_out_GetEsObjects( es_out_t *p_out, int i_id,
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index cbc4acc..aa17e7a 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -132,6 +132,7 @@ typedef struct attribute_packed
         struct
         {
             mtime_t i_pts_delay;
+            mtime_t i_pts_jitter;
             int     i_cr_average;
         } jitter;
     } u;
@@ -1426,9 +1427,11 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int i_query, va_list args, bool b_co
     case ES_OUT_SET_JITTER:
     {
         mtime_t i_pts_delay = (mtime_t)va_arg( args, mtime_t );
+        mtime_t i_pts_jitter = (mtime_t)va_arg( args, mtime_t );
         int     i_cr_average = (int)va_arg( args, int );
 
         p_cmd->u.control.u.jitter.i_pts_delay = i_pts_delay;
+        p_cmd->u.control.u.jitter.i_pts_jitter = i_pts_jitter;
         p_cmd->u.control.u.jitter.i_cr_average = i_cr_average;
         break;
     }
@@ -1498,6 +1501,7 @@ static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd )
                                                p_cmd->u.control.u.times.i_length );
     case ES_OUT_SET_JITTER:
         return es_out_Control( p_out, i_query, p_cmd->u.control.u.jitter.i_pts_delay,
+                                               p_cmd->u.control.u.jitter.i_pts_jitter,
                                                p_cmd->u.control.u.jitter.i_cr_average );
 
     default:
diff --git a/src/input/input.c b/src/input/input.c
index 8498bf2..892e54d 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1142,7 +1142,7 @@ static void UpdatePtsDelay( input_thread_t *p_input )
     /* */
     es_out_SetDelay( p_input->p->p_es_out_display, AUDIO_ES, i_audio_delay );
     es_out_SetDelay( p_input->p->p_es_out_display, SPU_ES, i_spu_delay );
-    es_out_SetJitter( p_input->p->p_es_out, i_pts_delay, i_cr_average );
+    es_out_SetJitter( p_input->p->p_es_out, i_pts_delay, 0, i_cr_average );
 }
 
 static void InitPrograms( input_thread_t * p_input )



More information about the vlc-commits mailing list