[vlc-commits] input: notify "subtree added" on the input thread

Romain Vimont git at videolan.org
Mon Aug 20 13:59:10 CEST 2018


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Thu Aug  2 14:10:33 2018 +0200| [9da7193926407cb4eecd10aafed4afff9ec1669b] | committer: Romain Vimont

input: notify "subtree added" on the input thread

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.

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

 include/vlc_input.h | 5 +++++
 src/input/es_out.c  | 5 +++++
 src/input/event.c   | 8 ++++++++
 src/input/event.h   | 2 ++
 src/input/var.c     | 2 ++
 5 files changed, 22 insertions(+)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index bcac1e3fa5..3223c7183f 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -387,6 +387,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_SUBITEMS,
+
 } input_event_type_e;
 
 #define VLC_INPUT_CAPABILITIES_SEEKABLE (1<<0)
@@ -470,6 +473,8 @@ struct vlc_input_event
         vlc_tick_t subtitle_delay;
         /* INPUT_EVENT_CACHE */
         float cache;
+        /* INPUT_EVENT_SUBITEMS */
+        input_item_node_t *subitems;
     };
 };
 
diff --git a/src/input/es_out.c b/src/input/es_out.c
index d119b4a5fb..8695dfb95e 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2913,8 +2913,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 2fe8c306b7..b6c88529d2 100644
--- a/src/input/event.c
+++ b/src/input/event.c
@@ -289,3 +289,11 @@ 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_SUBITEMS,
+        .subitems = p_root,
+    });
+}
diff --git a/src/input/event.h b/src/input/event.h
index f1c7f7794f..faead56a5a 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
  *****************************************************************************/
diff --git a/src/input/var.c b/src/input/var.c
index d1ebec2bca..e463cac7de 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -415,6 +415,8 @@ void input_LegacyEvents( input_thread_t *p_input, void *user_data,
             break;
         case INPUT_EVENT_VOUT:
             break;
+        case INPUT_EVENT_SUBITEMS:
+            break;
     }
     Trigger( p_input, event->type );
 }



More information about the vlc-commits mailing list