[vlc-devel] commit: Privatized i_pts_delay (input_thread_t). (Laurent Aimar )

git version control git at videolan.org
Fri Jan 16 21:10:37 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Jan 16 21:06:30 2009 +0100| [7ccd46a8a014e991d23e34fdc169ae621036eb2b] | committer: Laurent Aimar 

Privatized i_pts_delay (input_thread_t).

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

 include/vlc_input.h        |    3 ---
 src/input/decoder.c        |    4 ++--
 src/input/es_out.c         |    8 ++++----
 src/input/input.c          |   14 +++++++-------
 src/input/input_internal.h |    3 +++
 src/input/var.c            |    2 +-
 6 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 553c906..eeb0c0e 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -415,9 +415,6 @@ struct input_thread_t
     bool b_can_pace_control;
     int64_t     i_time;     /* Current time */
 
-    /* Internal caching common to all inputs */
-    mtime_t i_pts_delay;
-
     /* All other data is input_thread is PRIVATE. You can't access it
      * outside of src/input */
     input_thread_private_t *p;
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 9aecc36..bcaebb8 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -653,7 +653,7 @@ static mtime_t DecoderGetDisplayDate( decoder_t *p_dec, mtime_t i_ts )
     if( !p_owner->p_clock || !i_ts )
         return i_ts;
 
-    return input_clock_GetTS( p_owner->p_clock, NULL, p_owner->p_input->i_pts_delay, i_ts );
+    return input_clock_GetTS( p_owner->p_clock, NULL, p_owner->p_input->p->i_pts_delay, i_ts );
 }
 static int DecoderGetDisplayRate( decoder_t *p_dec )
 {
@@ -1044,7 +1044,7 @@ static void DecoderFixTs( decoder_t *p_dec, mtime_t *pi_ts0, mtime_t *pi_ts1,
 
     vlc_assert_locked( &p_owner->lock );
 
-    const mtime_t i_ts_delay = p_owner->p_input->i_pts_delay;
+    const mtime_t i_ts_delay = p_owner->p_input->p->i_pts_delay;
     const mtime_t i_es_delay = p_owner->i_ts_delay;
 
     if( p_clock )
diff --git a/src/input/es_out.c b/src/input/es_out.c
index fc9e64b..d736f63 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -545,7 +545,7 @@ static void EsOutChangePause( es_out_t *out, bool b_paused, mtime_t i_date )
             if( !i_ret )
             {
                 /* FIXME pcr != exactly what wanted */
-                const mtime_t i_used = /*(i_stream_duration - p_sys->p_input->i_pts_delay)*/ p_sys->i_buffering_extra_system - p_sys->i_buffering_extra_initial;
+                const mtime_t i_used = /*(i_stream_duration - p_sys->p_input->p->i_pts_delay)*/ p_sys->i_buffering_extra_system - p_sys->i_buffering_extra_initial;
                 i_date -= i_used;
             }
             p_sys->i_buffering_extra_initial = 0;
@@ -622,7 +622,7 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
     if( p_sys->i_preroll_end >= 0 )
         i_preroll_duration = __MAX( p_sys->i_preroll_end - i_stream_start, 0 );
 
-    const mtime_t i_buffering_duration = p_sys->p_input->i_pts_delay +
+    const mtime_t i_buffering_duration = p_sys->p_input->p->i_pts_delay +
                                          i_preroll_duration +
                                          p_sys->i_buffering_extra_stream - p_sys->i_buffering_extra_initial;
 
@@ -787,7 +787,7 @@ static void EsOutFrameNext( es_out_t *out )
         if( i_ret )
             return;
 
-        p_sys->i_buffering_extra_initial = 1 + i_stream_duration - p_sys->p_input->i_pts_delay; /* FIXME < 0 ? */
+        p_sys->i_buffering_extra_initial = 1 + i_stream_duration - p_sys->p_input->p->i_pts_delay; /* FIXME < 0 ? */
         p_sys->i_buffering_extra_system =
         p_sys->i_buffering_extra_stream = p_sys->i_buffering_extra_initial;
     }
@@ -842,7 +842,7 @@ static mtime_t EsOutGetBuffering( es_out_t *out )
         }
 
         const mtime_t i_consumed = i_system_duration * INPUT_RATE_DEFAULT / p_sys->i_rate - i_stream_duration;
-        i_delay = p_sys->p_input->i_pts_delay - i_consumed;
+        i_delay = p_sys->p_input->p->i_pts_delay - i_consumed;
     }
     if( i_delay < 0 )
         return 0;
diff --git a/src/input/input.c b/src/input/input.c
index 3e726a9..9680497 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -183,7 +183,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     p_input->p->p_es_out = NULL;
     p_input->p->p_sout   = NULL;
     p_input->p->b_out_pace_control = false;
-    p_input->i_pts_delay = 0;
+    p_input->p->i_pts_delay = 0;
     p_input->p->i_cr_average = 0;
 
     vlc_gc_incref( p_item ); /* Released in Destructor() */
@@ -906,17 +906,17 @@ static void InitTitle( input_thread_t * p_input )
     p_input->p->b_can_rate_control = p_master->b_can_rate_control;
 
     /* Fix pts delay */
-    if( p_input->i_pts_delay < 0 )
-        p_input->i_pts_delay = 0;
+    if( p_input->p->i_pts_delay < 0 )
+        p_input->p->i_pts_delay = 0;
 
     /* If the desynchronisation requested by the user is < 0, we need to
      * cache more data. */
     const int i_desynch = var_GetInteger( p_input, "audio-desync" );
     if( i_desynch < 0 )
-        p_input->i_pts_delay -= i_desynch * 1000;
+        p_input->p->i_pts_delay -= i_desynch * 1000;
 
     /* Update cr_average depending on the caching */
-    p_input->p->i_cr_average *= (10 * p_input->i_pts_delay / 200000);
+    p_input->p->i_cr_average *= (10 * p_input->p->i_pts_delay / 200000);
     p_input->p->i_cr_average /= 10;
     if( p_input->p->i_cr_average < 10 )
         p_input->p->i_cr_average = 10;
@@ -2344,7 +2344,7 @@ static int InputSourceInit( input_thread_t *p_input,
         /* Get infos from access_demux */
         demux_Control( in->p_demux,
                         DEMUX_GET_PTS_DELAY, &i_pts_delay );
-        p_input->i_pts_delay = __MAX( p_input->i_pts_delay, i_pts_delay );
+        p_input->p->i_pts_delay = __MAX( p_input->p->i_pts_delay, i_pts_delay );
 
         in->b_title_demux = true;
         if( demux_Control( in->p_demux, DEMUX_GET_TITLE_INFO,
@@ -2418,7 +2418,7 @@ static int InputSourceInit( input_thread_t *p_input,
         {
             access_Control( in->p_access,
                              ACCESS_GET_PTS_DELAY, &i_pts_delay );
-            p_input->i_pts_delay = __MAX( p_input->i_pts_delay, i_pts_delay );
+            p_input->p->i_pts_delay = __MAX( p_input->p->i_pts_delay, i_pts_delay );
 
             in->b_title_demux = false;
             if( access_Control( in->p_access, ACCESS_GET_TITLE_INFO,
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index c6f5488..ff409ec 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -80,6 +80,9 @@ struct input_thread_private_t
     bool        b_can_rate_control;
     double      f_fps;
 
+    /* Internal caching common to all sources */
+    mtime_t     i_pts_delay;
+
     /* Current state */
     int         i_rate;
     bool        b_recording;
diff --git a/src/input/var.c b/src/input/var.c
index 4de97a5..3ffe2b0 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -777,7 +777,7 @@ static int EsDelayCallback ( vlc_object_t *p_this, char const *psz_cmd,
         /* Change i_pts_delay to make sure es are decoded in time */
         if( newval.i_int < 0 || oldval.i_int < 0 )
         {
-            p_input->i_pts_delay -= newval.i_int - oldval.i_int;
+            p_input->p->i_pts_delay -= newval.i_int - oldval.i_int;
         }
         input_ControlPush( p_input, INPUT_CONTROL_SET_AUDIO_DELAY, &newval );
     }




More information about the vlc-devel mailing list