[vlc-devel] [PATCH 4/7] input: MainLoop use intermediate variable

Thomas Guillem thomas at gllm.fr
Wed Oct 30 15:56:58 CET 2019


---
 src/input/input.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 747fa276f34..429a6298bd9 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -653,6 +653,7 @@ static void MainLoopStatistics( input_thread_t *p_input )
  */
 static void MainLoop( input_thread_t *p_input, bool b_interactive )
 {
+    input_thread_private_t *priv = input_priv(p_input);
     vlc_tick_t i_intf_update = 0;
     vlc_tick_t i_last_seek_mdate = 0;
 
@@ -663,43 +664,43 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
                            var_InheritBool( p_input, "play-and-pause" );
     bool b_paused_at_eof = false;
 
-    demux_t *p_demux = input_priv(p_input)->master->p_demux;
+    demux_t *p_demux = priv->master->p_demux;
     const bool b_can_demux = p_demux->pf_demux != NULL;
 
-    while( !input_Stopped( p_input ) && input_priv(p_input)->i_state != ERROR_S )
+    while( !input_Stopped( p_input ) && priv->i_state != ERROR_S )
     {
         vlc_tick_t i_wakeup = -1;
-        bool b_paused = input_priv(p_input)->i_state == PAUSE_S;
-        /* FIXME if input_priv(p_input)->i_state == PAUSE_S the access/access_demux
+        bool b_paused = priv->i_state == PAUSE_S;
+        /* FIXME if priv->i_state == PAUSE_S the access/access_demux
          * is paused -> this may cause problem with some of them
          * The same problem can be seen when seeking while paused */
         if( b_paused )
-            b_paused = !es_out_GetBuffering( input_priv(p_input)->p_es_out )
-                    || input_priv(p_input)->master->b_eof;
+            b_paused = !es_out_GetBuffering( priv->p_es_out )
+                    || priv->master->b_eof;
 
         if( !b_paused )
         {
-            if( !input_priv(p_input)->master->b_eof )
+            if( !priv->master->b_eof )
             {
                 bool b_force_update = false;
 
                 MainLoopDemux( p_input, &b_force_update );
 
                 if( b_can_demux )
-                    i_wakeup = es_out_GetWakeup( input_priv(p_input)->p_es_out );
+                    i_wakeup = es_out_GetWakeup( priv->p_es_out );
                 if( b_force_update )
                     i_intf_update = 0;
 
                 b_paused_at_eof = false;
             }
-            else if( !es_out_GetEmpty( input_priv(p_input)->p_es_out ) )
+            else if( !es_out_GetEmpty( priv->p_es_out ) )
             {
                 msg_Dbg( p_input, "waiting decoder fifos to empty" );
                 i_wakeup = vlc_tick_now() + INPUT_IDLE_SLEEP;
             }
             /* Pause after eof only if the input is pausable.
              * This way we won't trigger timeshifting for nothing */
-            else if( b_pause_after_eof && input_priv(p_input)->b_can_pause )
+            else if( b_pause_after_eof && priv->b_can_pause )
             {
                 if( b_paused_at_eof )
                     break;
@@ -735,8 +736,8 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
 
             /* Postpone seeking until ES buffering is complete or at most
              * 125 ms. */
-            bool b_postpone = es_out_GetBuffering( input_priv(p_input)->p_es_out )
-                            && !input_priv(p_input)->master->b_eof;
+            bool b_postpone = es_out_GetBuffering( priv->p_es_out )
+                            && !priv->master->b_eof;
             if( b_postpone )
             {
                 vlc_tick_t now = vlc_tick_now();
@@ -771,7 +772,7 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
 
             /* Update the wakeup time */
             if( i_wakeup != 0 )
-                i_wakeup = es_out_GetWakeup( input_priv(p_input)->p_es_out );
+                i_wakeup = es_out_GetWakeup( priv->p_es_out );
         }
     }
 }
-- 
2.20.1



More information about the vlc-devel mailing list