[vlc-devel] [V3 12/13] input: Emit an event when new attachments are found

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Nov 18 15:23:58 CET 2020


---
 include/vlc_events.h | 8 +++++++-
 src/input/input.c    | 4 ++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/vlc_events.h b/include/vlc_events.h
index 845dd31ccf..61c6ee9b31 100644
--- a/include/vlc_events.h
+++ b/include/vlc_events.h
@@ -102,6 +102,7 @@ typedef enum vlc_event_type_t {
     vlc_InputItemNameChanged,
     vlc_InputItemInfoChanged,
     vlc_InputItemErrorWhenReadingChanged,
+    vlc_InputItemAttachmentsFound,
 } vlc_event_type_t;
 
 typedef struct vlc_event_listeners_group_t
@@ -114,7 +115,7 @@ typedef struct vlc_event_manager_t
 {
     void * p_obj;
     vlc_mutex_t lock;
-    vlc_event_listeners_group_t events[vlc_InputItemErrorWhenReadingChanged + 1];
+    vlc_event_listeners_group_t events[vlc_InputItemAttachmentsFound + 1];
 } vlc_event_manager_t;
 
 /* Event definition */
@@ -161,6 +162,11 @@ typedef struct vlc_event_t
         {
             int new_status;
         } input_item_preparse_ended;
+        struct input_item_attachments_found
+        {
+            input_attachment_t** attachments;
+            size_t count;
+        } input_item_attachments_found;
     } u;
 } vlc_event_t;
 
diff --git a/src/input/input.c b/src/input/input.c
index 06b18e2f5c..8f80406f3b 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -3050,6 +3050,10 @@ static void AppendAttachment( input_thread_t *p_input, int i_new,
         }
         /* */
         priv->i_attachment = i_attachment;
+        vlc_event_send( &priv->p_item->event_manager, &(vlc_event_t) {
+            .type = vlc_InputItemAttachmentsFound,
+            .u.input_item_attachments_found.attachments = pp_new,
+            .u.input_item_attachments_found.count = i_new } );
         free( pp_new );
         return;
     }
-- 
2.29.2



More information about the vlc-devel mailing list