[vlc-devel] [PATCH] input: force user interaction when preparsing the first parent item

Thomas Guillem thomas at gllm.fr
Wed Feb 3 18:45:06 CET 2016


i.e. when an item was explicitly preparsed by the user (from
libvlc_MetaRequest).
---
 include/vlc_input_item.h |  3 +++
 src/input/input.c        | 23 +++++++++++++++--------
 src/libvlc.c             |  1 +
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 1587e53..3a33aba 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -94,6 +94,9 @@ struct input_item_t
 
     int         i_preparse_depth;    /**< How many level of sub items can be preparsed:
                                           -1: recursive, 0: none, >0: n levels */
+
+    bool        b_preparse_interact; /**< Force interaction with the user when
+                                          preparsing.*/
 };
 
 TYPEDEF_ARRAY(input_item_t*, input_item_array_t)
diff --git a/src/input/input.c b/src/input/input.c
index a5d408c..48258fa 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -355,6 +355,21 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
             p_item->i_preparse_depth = -1;
     }
 
+    /* */
+    if( p_input->b_preparsing )
+        p_input->i_flags |= OBJECT_FLAGS_QUIET | OBJECT_FLAGS_NOINTERACT;
+
+    /* Make sure the interaction option is honored */
+    if( !var_InheritBool( p_input, "interact" ) )
+        p_input->i_flags |= OBJECT_FLAGS_NOINTERACT;
+    else if( p_item->b_preparse_interact )
+    {
+        /* If true, this item was asked explicitly to interact with the user
+         * (via libvlc_MetaRequest). Sub items created from this input won't
+         * have this flag and won't interact with the user */
+        p_input->i_flags &= ~OBJECT_FLAGS_NOINTERACT;
+    }
+
     vlc_mutex_unlock( &p_item->lock );
 
     /* No slave */
@@ -439,14 +454,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     input_SendEventMeta( p_input );
 
     /* */
-    if( p_input->b_preparsing )
-        p_input->i_flags |= OBJECT_FLAGS_QUIET | OBJECT_FLAGS_NOINTERACT;
-
-    /* Make sure the interaction option is honored */
-    if( !var_InheritBool( p_input, "interact" ) )
-        p_input->i_flags |= OBJECT_FLAGS_NOINTERACT;
-
-    /* */
     memset( &p_input->p->counters, 0, sizeof( p_input->p->counters ) );
     vlc_mutex_init( &p_input->p->counters.counters_lock );
 
diff --git a/src/libvlc.c b/src/libvlc.c
index 964e586..485472a 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -622,6 +622,7 @@ int libvlc_MetaRequest(libvlc_int_t *libvlc, input_item_t *item,
     vlc_mutex_lock( &item->lock );
     if( item->i_preparse_depth == 0 )
         item->i_preparse_depth = 1;
+    item->b_preparse_interact = true;
     vlc_mutex_unlock( &item->lock );
     playlist_preparser_Push(priv->parser, item, i_options);
     return VLC_SUCCESS;
-- 
2.7.0.rc3



More information about the vlc-devel mailing list