[vlc-commits] input: Emit an event when new attachments are found

Hugo Beauzée-Luyssen git at videolan.org
Thu Nov 19 11:00:26 CET 2020


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Nov 18 14:54:28 2020 +0100| [67f30f947d9518986500efc00d4f5eaf0e856090] | committer: Hugo Beauzée-Luyssen

input: Emit an event when new attachments are found

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

 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;
     }



More information about the vlc-commits mailing list