[vlc-commits] input: privatize b_preparsing

Rémi Denis-Courmont git at videolan.org
Sat Nov 5 10:34:25 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov  5 11:30:29 2016 +0200| [f85bd3e47140524ae4e0842405c19c8b60e109aa] | committer: Rémi Denis-Courmont

input: privatize b_preparsing

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

 include/vlc_input.h        |  2 --
 src/input/control.c        |  8 ++++----
 src/input/es_out.c         |  2 +-
 src/input/input.c          | 33 ++++++++++++++++-----------------
 src/input/input_internal.h |  1 +
 src/input/var.c            |  6 +++---
 6 files changed, 25 insertions(+), 27 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 125e98b..a2ddaad 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -224,8 +224,6 @@ typedef struct input_resource_t input_resource_t;
 struct input_thread_t
 {
     VLC_COMMON_MEMBERS
-
-    bool b_preparsing;
 };
 
 /**
diff --git a/src/input/control.c b/src/input/control.c
index 9c9c6ed..bb5100c 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -163,7 +163,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
                                             "%s", psz_value );
             free( psz_value );
 
-            if( !p_input->b_preparsing && !i_ret )
+            if( !priv->b_preparsing && !i_ret )
                 input_SendEventMetaInfo( p_input );
             return i_ret;
         }
@@ -177,7 +177,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
             else
                 input_item_MergeInfos( priv->p_item, p_cat );
 
-            if( !p_input->b_preparsing )
+            if( !priv->b_preparsing )
                 input_SendEventMetaInfo( p_input );
             return VLC_SUCCESS;
         }
@@ -188,7 +188,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
 
             int i_ret = input_item_DelInfo( priv->p_item, psz_cat, psz_name );
 
-            if( !p_input->b_preparsing && !i_ret )
+            if( !priv->b_preparsing && !i_ret )
                 input_SendEventMetaInfo( p_input );
             return i_ret;
         }
@@ -213,7 +213,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
 
             input_item_SetName( priv->p_item, psz_name );
 
-            if( !p_input->b_preparsing )
+            if( !priv->b_preparsing )
                 input_SendEventMetaName( p_input, psz_name );
             return VLC_SUCCESS;
         }
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 18934d6..08eec10 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -269,7 +269,7 @@ static void EsOutPropsInit( es_out_es_props_t *p_props,
     p_props->i_demux_id = -1;
     p_props->p_main_es = NULL;
 
-    if( !p_input->b_preparsing && psz_langvar )
+    if( !input_priv(p_input)->b_preparsing && psz_langvar )
     {
         char *psz_string = var_GetString( p_input, psz_langvar );
         p_props->ppsz_language = LanguageSplit( psz_string );
diff --git a/src/input/input.c b/src/input/input.c
index 1f92449..fcba5f2 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -169,7 +169,7 @@ int input_Start( input_thread_t *p_input )
     input_thread_private_t *priv = input_priv(p_input);
     void *(*func)(void *) = Run;
 
-    if( p_input->b_preparsing )
+    if( priv->b_preparsing )
         func = Preparse;
 
     assert( !priv->is_running );
@@ -293,17 +293,18 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     snprintf( psz_timer_name, sizeof(psz_timer_name),
               "input launching for '%s'", psz_name );
 
-    msg_Dbg( p_input, "Creating an input for %s'%s'", b_preparsing ? "preparsing " : "", psz_name);
+    msg_Dbg( p_input, "Creating an input for %s'%s'",
+             b_preparsing ? "preparsing " : "", psz_name);
 
     free( psz_name );
 
     /* Parse input options */
     input_item_ApplyOptions( VLC_OBJECT(p_input), p_item );
 
-    p_input->b_preparsing = b_preparsing;
     p_input->obj.header = psz_header ? strdup( psz_header ) : NULL;
 
     /* Init Common fields */
+    priv->b_preparsing = b_preparsing;
     priv->b_can_pace_control = true;
     priv->i_start = 0;
     priv->i_time  = 0;
@@ -335,7 +336,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
 
     /* setup the preparse depth of the item
      * if we are preparsing, use the i_preparse_depth of the parent item */
-    if( !p_input->b_preparsing )
+    if( !priv->b_preparsing )
     {
         char *psz_rec = var_InheritString( p_parent, "recursive" );
 
@@ -351,9 +352,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
         } else
             p_item->i_preparse_depth = -1;
     }
-
-    /* */
-    if( p_input->b_preparsing )
+    else
         p_input->obj.flags |= OBJECT_FLAGS_QUIET | OBJECT_FLAGS_NOINTERACT;
 
     /* Make sure the interaction option is honored */
@@ -399,7 +398,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     input_ControlVarInit( p_input );
 
     /* */
-    if( !p_input->b_preparsing )
+    if( !priv->b_preparsing )
     {
         char *psz_bookmarks = var_GetNonEmptyString( p_input, "bookmarks" );
         if( psz_bookmarks )
@@ -789,7 +788,7 @@ static void InitStatistics( input_thread_t *p_input )
 {
     input_thread_private_t *priv = input_priv(p_input);
 
-    if( p_input->b_preparsing ) return;
+    if( priv->b_preparsing ) return;
 
     /* Prepare statistics */
 #define INIT_COUNTER( c, compute ) priv->counters.p_##c = \
@@ -821,7 +820,7 @@ static int InitSout( input_thread_t * p_input )
 {
     input_thread_private_t *priv = input_priv(p_input);
 
-    if( p_input->b_preparsing )
+    if( priv->b_preparsing )
         return VLC_SUCCESS;
 
     /* Find a usable sout and attach it to p_input */
@@ -859,7 +858,7 @@ static void InitTitle( input_thread_t * p_input )
     input_thread_private_t *priv = input_priv(p_input);
     input_source_t *p_master = priv->master;
 
-    if( p_input->b_preparsing )
+    if( priv->b_preparsing )
         return;
 
     vlc_mutex_lock( &priv->p_item->lock );
@@ -1312,7 +1311,7 @@ static int Init( input_thread_t * p_input )
 
     input_SendEventPosition( p_input, 0.0, 0 );
 
-    if( !p_input->b_preparsing )
+    if( !priv->b_preparsing )
     {
         StartTitle( p_input );
         SetSubtitlesOptions( p_input );
@@ -1327,7 +1326,7 @@ static int Init( input_thread_t * p_input )
         }
     }
 
-    if( !p_input->b_preparsing && input_priv(p_input)->p_sout )
+    if( !priv->b_preparsing && priv->p_sout )
     {
         priv->b_out_pace_control = priv->p_sout->i_out_pace_nocontrol > 0;
 
@@ -1376,7 +1375,7 @@ error:
             input_resource_Terminate( input_priv(p_input)->p_resource_private );
     }
 
-    if( !p_input->b_preparsing && libvlc_stats( p_input ) )
+    if( !priv->b_preparsing && libvlc_stats( p_input ) )
     {
 #define EXIT_COUNTER( c ) do { if( input_priv(p_input)->counters.p_##c ) \
                                    stats_CounterClean( input_priv(p_input)->counters.p_##c );\
@@ -1441,7 +1440,7 @@ static void End( input_thread_t * p_input )
         es_out_Delete( priv->p_es_out );
     es_out_SetMode( priv->p_es_out_display, ES_OUT_MODE_END );
 
-    if( !p_input->b_preparsing )
+    if( !priv->b_preparsing )
     {
 #define CL_CO( c ) \
 do { \
@@ -2297,7 +2296,7 @@ static input_source_t *InputSourceNew( input_thread_t *p_input,
 
     in->p_demux = input_DemuxNew( VLC_OBJECT(in), psz_access, psz_demux,
                                   psz_path, input_priv(p_input)->p_es_out,
-                                  p_input->b_preparsing, p_input );
+                                  input_priv(p_input)->b_preparsing, p_input );
     free( psz_dup );
 
     if( in->p_demux == NULL )
@@ -2367,7 +2366,7 @@ static input_source_t *InputSourceNew( input_thread_t *p_input,
 
     /* get attachment
      * FIXME improve for b_preparsing: move it after GET_META and check psz_arturl */
-    if( !p_input->b_preparsing )
+    if( !input_priv(p_input)->b_preparsing )
     {
         if( demux_Control( in->p_demux, DEMUX_GET_TITLE_INFO,
                            &in->title, &in->i_title,
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 2ae1568..0bc1de0 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -86,6 +86,7 @@ typedef struct input_thread_private_t
     struct input_thread_t input;
 
     /* Global properties */
+    bool        b_preparsing;
     bool        b_can_pause;
     bool        b_can_rate_control;
     bool        b_can_pace_control;
diff --git a/src/input/var.c b/src/input/var.c
index 722becc..d16fbae 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -216,7 +216,7 @@ void input_ControlVarInit ( input_thread_t *p_input )
     /* Add all callbacks
      * XXX we put callback only in non preparsing mode. We need to create the variable
      * unless someone want to check all var_Get/var_Change return value ... */
-    if( !p_input->b_preparsing )
+    if( !input_priv(p_input)->b_preparsing )
         InputAddCallbacks( p_input, p_input_callbacks );
 }
 
@@ -228,7 +228,7 @@ void input_ControlVarStop( input_thread_t *p_input )
     demux_t* p_demux  = input_priv(p_input)->master->p_demux;
     int i_cur_title;
 
-    if( !p_input->b_preparsing )
+    if( !input_priv(p_input)->b_preparsing )
         InputDelCallbacks( p_input, p_input_callbacks );
 
     if( input_priv(p_input)->i_title > 1 )
@@ -423,7 +423,7 @@ void input_ConfigVarInit ( input_thread_t *p_input )
 {
     /* Create Object Variables for private use only */
 
-    if( !p_input->b_preparsing )
+    if( !input_priv(p_input)->b_preparsing )
     {
         var_Create( p_input, "video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
         var_Create( p_input, "audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );



More information about the vlc-commits mailing list