Privatized i_pts_delay (input_thread_t).
authorLaurent Aimar <fenrir@videolan.org>
Fri, 16 Jan 2009 20:06:30 +0000 (21:06 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Fri, 16 Jan 2009 20:07:48 +0000 (21:07 +0100)
include/vlc_input.h
src/input/decoder.c
src/input/es_out.c
src/input/input.c
src/input/input_internal.h
src/input/var.c

index 553c906..eeb0c0e 100644 (file)
@@ -415,9 +415,6 @@ struct input_thread_t
     bool b_can_pace_control;
     int64_t     i_time;     /* Current time */
 
     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;
     /* All other data is input_thread is PRIVATE. You can't access it
      * outside of src/input */
     input_thread_private_t *p;
index 9aecc36..bcaebb8 100644 (file)
@@ -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;
 
     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 )
 {
 }
 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 );
 
 
     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 )
     const mtime_t i_es_delay = p_owner->i_ts_delay;
 
     if( p_clock )
index fc9e64b..d736f63 100644 (file)
@@ -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 */
             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;
                 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 );
 
     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;
 
                                          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;
 
         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;
     }
         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;
         }
 
         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;
     }
     if( i_delay < 0 )
         return 0;
index 3e726a9..9680497 100644 (file)
@@ -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->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() */
     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 */
     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 )
 
     /* 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 */
 
     /* 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;
     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 );
         /* 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,
 
         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 );
         {
             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,
 
             in->b_title_demux = false;
             if( access_Control( in->p_access, ACCESS_GET_TITLE_INFO,
index c6f5488..ff409ec 100644 (file)
@@ -80,6 +80,9 @@ struct input_thread_private_t
     bool        b_can_rate_control;
     double      f_fps;
 
     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;
     /* Current state */
     int         i_rate;
     bool        b_recording;
index 4de97a5..3ffe2b0 100644 (file)
@@ -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 )
         {
         /* 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 );
     }
         }
         input_ControlPush( p_input, INPUT_CONTROL_SET_AUDIO_DELAY, &newval );
     }