[vlc-devel] [PATCH 04/14] input: notify "subtree added" on the input thread

Romain Vimont rom1v at videolabs.io
Thu Aug 16 16:02:01 CEST 2018


Subitems do not belong to an input item: they are created only to fire
an event, then destroyed immediately. Thus, the detection of subitems is
more related to a specific preparsing task than to the item itself.

Therefore, notify the detection of subitems on the input thread, so that
we could eventually remove the vlc_InputItemSubItemTreeAdded event on
the input item.
---
 include/vlc_input.h | 12 ++++++++++++
 src/input/es_out.c  |  5 +++++
 src/input/event.c   | 11 +++++++++++
 src/input/event.h   |  2 ++
 4 files changed, 30 insertions(+)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 396449e755..743f0e39bd 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -389,6 +389,9 @@ typedef enum input_event_type_e
     /* A vout_thread_t object has been created/deleted by *the input* */
     INPUT_EVENT_VOUT,
 
+    /* (pre-)parsing events */
+    INPUT_EVENT_PARSING,
+
 } input_event_type_e;
 
 #define VLC_INPUT_CAPABILITIES_SEEKABLE (1<<0)
@@ -449,6 +452,13 @@ struct vlc_input_event_signal {
     float strength;
 };
 
+struct vlc_input_event_parsing {
+    enum {
+        VLC_INPUT_PARSING_SUBTREE_ADDED,
+    } action;
+    input_item_node_t *root;
+};
+
 struct vlc_input_event
 {
     input_event_type_e type;
@@ -484,6 +494,8 @@ struct vlc_input_event
         vlc_tick_t subtitle_delay;
         /* INPUT_EVENT_CACHE */
         float cache;
+        /* INPUT_EVENT_PARSING */
+        struct vlc_input_event_parsing parsing;
     };
 };
 
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 000cad3f97..e8a5c6e58b 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2932,8 +2932,13 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
 
     case ES_OUT_POST_SUBNODE:
     {
+        input_thread_t *input = p_sys->p_input;
         input_item_node_t *node = va_arg(args, input_item_node_t *);
+        input_SendEventParsing(input, node);
+
+        /* TODO remove "PostAnd" once InputItemSubItemTreeAdded is not needed */
         input_item_node_PostAndDelete(node);
+
         return VLC_SUCCESS;
     }
 
diff --git a/src/input/event.c b/src/input/event.c
index d4da9ce1ab..146a5a2ea6 100644
--- a/src/input/event.c
+++ b/src/input/event.c
@@ -314,3 +314,14 @@ void input_SendEventBookmark( input_thread_t *p_input )
         .type = INPUT_EVENT_BOOKMARK
     });
 }
+
+void input_SendEventParsing( input_thread_t *p_input, input_item_node_t *p_root )
+{
+    input_SendEvent( p_input, &(struct vlc_input_event) {
+        .type = INPUT_EVENT_PARSING,
+        .parsing = {
+            .action = VLC_INPUT_PARSING_SUBTREE_ADDED,
+            .root = p_root,
+        },
+    });
+}
diff --git a/src/input/event.h b/src/input/event.h
index 4c9792d228..fb17d78eae 100644
--- a/src/input/event.h
+++ b/src/input/event.h
@@ -49,6 +49,8 @@ void input_SendEventMeta( input_thread_t *p_input );
 void input_SendEventMetaInfo( input_thread_t *p_input );
 void input_SendEventMetaEpg( input_thread_t *p_input );
 
+void input_SendEventParsing( input_thread_t *p_input, input_item_node_t *p_root );
+
 /*****************************************************************************
  * Event for es_out.c
  *****************************************************************************/
-- 
2.18.0



More information about the vlc-devel mailing list