[vlc-commits] input: remove "audio-delay" and "spu-delay" var dependencies

Thomas Guillem git at videolan.org
Thu Sep 6 15:54:46 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Sep  6 15:53:33 2018 +0200| [f58e09e7c85c78f058967d3812d4ec7c76bcc25b] | committer: Thomas Guillem

input: remove "audio-delay" and "spu-delay" var dependencies

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

 src/input/input.c          | 16 +++++++++++-----
 src/input/input_internal.h |  4 ++++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index b33c74370e..f2945a635e 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -437,6 +437,10 @@ static input_thread_t *Create( vlc_object_t *p_parent,
     /* Create Object Variables for private use only */
     input_ConfigVarInit( p_input );
 
+    priv->i_audio_delay =
+        VLC_TICK_FROM_MS( var_GetInteger( p_input, "audio-desync" ) );
+    priv->i_spu_delay = 0;
+
     /* */
     if( !priv->b_preparsing )
     {
@@ -1217,9 +1221,7 @@ static void UpdatePtsDelay( input_thread_t *p_input )
         i_pts_delay = 0;
 
     /* Take care of audio/spu delay */
-    const vlc_tick_t i_audio_delay = var_GetInteger( p_input, "audio-delay" );
-    const vlc_tick_t i_spu_delay   = var_GetInteger( p_input, "spu-delay" );
-    const vlc_tick_t i_extra_delay = __MIN( i_audio_delay, i_spu_delay );
+    const vlc_tick_t i_extra_delay = __MIN( p_sys->i_audio_delay, p_sys->i_spu_delay );
     if( i_extra_delay < 0 )
         i_pts_delay -= i_extra_delay;
 
@@ -1227,8 +1229,10 @@ static void UpdatePtsDelay( input_thread_t *p_input )
     const int i_cr_average = var_GetInteger( p_input, "cr-average" ) * i_pts_delay / DEFAULT_PTS_DELAY;
 
     /* */
-    es_out_SetDelay( input_priv(p_input)->p_es_out_display, AUDIO_ES, i_audio_delay );
-    es_out_SetDelay( input_priv(p_input)->p_es_out_display, SPU_ES, i_spu_delay );
+    es_out_SetDelay( input_priv(p_input)->p_es_out_display, AUDIO_ES,
+                     p_sys->i_audio_delay );
+    es_out_SetDelay( input_priv(p_input)->p_es_out_display, SPU_ES,
+                     p_sys->i_spu_delay );
     es_out_SetJitter( input_priv(p_input)->p_es_out, i_pts_delay, 0, i_cr_average );
 }
 
@@ -2078,11 +2082,13 @@ static bool Control( input_thread_t *p_input,
             break;
 
         case INPUT_CONTROL_SET_AUDIO_DELAY:
+            priv->i_audio_delay = param.val.i_int;
             input_SendEventAudioDelay( p_input, param.val.i_int );
             UpdatePtsDelay( p_input );
             break;
 
         case INPUT_CONTROL_SET_SPU_DELAY:
+            priv->i_spu_delay = param.val.i_int;
             input_SendEventSubtitleDelay( p_input, param.val.i_int );
             UpdatePtsDelay( p_input );
             break;
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index e2b65cd3a3..50e6cbf8fb 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -126,6 +126,10 @@ typedef struct input_thread_private_t
     vlc_tick_t  i_stop;     /* :stop-time, 0 if none */
     vlc_tick_t  i_time;     /* Current time */
 
+    /* Delays */
+    vlc_tick_t  i_audio_delay;
+    vlc_tick_t  i_spu_delay;
+
     /* Output */
     bool            b_out_pace_control; /* XXX Move it ot es_sout ? */
     sout_instance_t *p_sout;            /* Idem ? */



More information about the vlc-commits mailing list