[vlc-commits] libvlc: libvlc_MediaSubItemTreeAdded event type added

Sergey Radionov git at videolan.org
Mon Sep 2 17:42:35 CEST 2013


vlc | branch: master | Sergey Radionov <rsatom at gmail.com> | Sun Sep  1 21:00:18 2013 +0700| [11104cb5b25c366bcac66736d862c81f31dc1016] | committer: Rémi Denis-Courmont

libvlc: libvlc_MediaSubItemTreeAdded event type added

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 include/vlc/libvlc_events.h |    5 +++++
 lib/event.c                 |    1 +
 lib/media.c                 |   26 ++++++++++++++++++++++++++
 3 files changed, 32 insertions(+)

diff --git a/include/vlc/libvlc_events.h b/include/vlc/libvlc_events.h
index 2cfedbf..ae1a94b 100644
--- a/include/vlc/libvlc_events.h
+++ b/include/vlc/libvlc_events.h
@@ -52,6 +52,7 @@ enum libvlc_event_e {
     libvlc_MediaParsedChanged,
     libvlc_MediaFreed,
     libvlc_MediaStateChanged,
+    libvlc_MediaSubItemTreeAdded,
 
     libvlc_MediaPlayerMediaChanged=0x100,
     libvlc_MediaPlayerNothingSpecial,
@@ -137,6 +138,10 @@ typedef struct libvlc_event_t
         {
             libvlc_state_t new_state;
         } media_state_changed;
+        struct
+        {
+            libvlc_media_t * item;
+        } media_subitemtree_added;
 
         /* media instance */
         struct
diff --git a/lib/event.c b/lib/event.c
index c71a48a..87f7d12 100644
--- a/lib/event.c
+++ b/lib/event.c
@@ -259,6 +259,7 @@ static const event_name_t event_list[] = {
     DEF(MediaParsedChanged)
     DEF(MediaFreed)
     DEF(MediaStateChanged)
+    DEF(MediaSubItemTreeAdded)
 
     DEF(MediaPlayerMediaChanged)
     DEF(MediaPlayerNothingSpecial)
diff --git a/lib/media.c b/lib/media.c
index 593f5c6..7acfb69 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -120,6 +120,23 @@ static void input_item_subitem_added( const vlc_event_t *p_event,
 }
 
 /**************************************************************************
+ * input_item_subitemtree_added (Private) (vlc event Callback)
+ **************************************************************************/
+static void input_item_subitemtree_added( const vlc_event_t * p_event,
+                                          void * user_data )
+{
+    libvlc_media_t * p_md = user_data;
+    libvlc_event_t event;
+
+    /* Construct the event */
+    event.type = libvlc_MediaSubItemTreeAdded;
+    event.u.media_subitemtree_added.item = p_md;
+
+    /* Send the event */
+    libvlc_event_send( p_md->p_event_manager, &event );
+}
+
+/**************************************************************************
  * input_item_meta_changed (Private) (vlc event Callback)
  **************************************************************************/
 static void input_item_meta_changed( const vlc_event_t *p_event,
@@ -201,6 +218,10 @@ static void install_input_item_observer( libvlc_media_t *p_md )
                       vlc_InputItemPreparsedChanged,
                       input_item_preparsed_changed,
                       p_md );
+    vlc_event_attach( &p_md->p_input_item->event_manager,
+                      vlc_InputItemSubItemTreeAdded,
+                      input_item_subitemtree_added,
+                      p_md );
 }
 
 /**************************************************************************
@@ -224,6 +245,10 @@ static void uninstall_input_item_observer( libvlc_media_t *p_md )
                       vlc_InputItemPreparsedChanged,
                       input_item_preparsed_changed,
                       p_md );
+    vlc_event_detach( &p_md->p_input_item->event_manager,
+                      vlc_InputItemSubItemTreeAdded,
+                      input_item_subitemtree_added,
+                      p_md );
 }
 
 /**************************************************************************
@@ -277,6 +302,7 @@ libvlc_media_t * libvlc_media_new_from_input_item(
     libvlc_event_manager_register_event_type(em, libvlc_MediaDurationChanged);
     libvlc_event_manager_register_event_type(em, libvlc_MediaStateChanged);
     libvlc_event_manager_register_event_type(em, libvlc_MediaParsedChanged);
+    libvlc_event_manager_register_event_type(em, libvlc_MediaSubItemTreeAdded);
 
     vlc_gc_incref( p_md->p_input_item );
 



More information about the vlc-commits mailing list