[vlc-devel] commit: input: Send vlc_InputItemInfoChanged, and vlc_InputItemNameChanged events. (Pierre d'Herbemont )

git version control git at videolan.org
Sat Jun 14 15:47:50 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sat Jun 14 15:45:44 2008 +0200| [788413cf9c52db26d592426083b920cb5a364e3e]

input: Send vlc_InputItemInfoChanged, and vlc_InputItemNameChanged events.

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

 include/vlc_events.h |   10 ++++++++++
 src/input/control.c  |   18 ++++++++++++++++--
 src/input/item.c     |    4 ++++
 src/misc/events.c    |    2 ++
 4 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/include/vlc_events.h b/include/vlc_events.h
index 42329a6..2bef3ef 100644
--- a/include/vlc_events.h
+++ b/include/vlc_events.h
@@ -120,6 +120,8 @@ typedef enum vlc_event_type_t {
     vlc_InputItemSubItemAdded,
     vlc_InputItemDurationChanged,
     vlc_InputItemPreparsedChanged,
+    vlc_InputItemNameChanged,
+    vlc_InputItemInfoChanged,
 
     /* Service Discovery event */
     vlc_ServicesDiscoveryItemAdded,
@@ -158,6 +160,14 @@ typedef struct vlc_event_t
         {
             int new_status;
         } input_item_preparsed_changed;
+        struct vlc_input_item_name_changed
+        {
+            const char * new_name;
+        } input_item_name_changed;
+        struct vlc_input_item_info_changed
+        {
+            void * unused;
+        } input_item_info_changed;
 
         /* Service discovery events */
         struct vlc_services_discovery_item_added
diff --git a/src/input/control.c b/src/input/control.c
index be17856..78cdbd1 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -200,7 +200,12 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
             vlc_mutex_unlock( &p_input->p->input.p_item->lock );
 
             if( !p_input->b_preparsing )
+            {
                 NotifyPlaylist( p_input );
+                vlc_event_t event;
+                event.type = vlc_InputItemInfoChanged;
+                vlc_event_send( p_input->p->input.p_item, &event );
+            }
         }
         return VLC_SUCCESS;
 
@@ -267,8 +272,12 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
             vlc_mutex_unlock( &p_input->p->input.p_item->lock );
 
             if( !p_input->b_preparsing )
+            {
                 NotifyPlaylist( p_input );
-
+                vlc_event_t event;
+                event.type = vlc_InputItemInfoChanged;
+                vlc_event_send( p_input->p->input.p_item, &event );
+            }
             return VLC_SUCCESS;
         }
 
@@ -299,8 +308,13 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
             vlc_mutex_unlock( &p_input->p->input.p_item->lock );
 
             if( !p_input->b_preparsing )
+            {
                 NotifyPlaylist( p_input );
-
+                vlc_event_t event;
+                event.type = vlc_InputItemNameChanged;
+                event.u.input_item_name_changed.new_name = psz_name;
+                vlc_event_send( p_input->p->input.p_item, &event );
+            }
             return VLC_SUCCESS;
         }
 
diff --git a/src/input/item.c b/src/input/item.c
index 50455b5..579dac4 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -62,6 +62,10 @@ static inline void input_ItemInit( vlc_object_t *p_o, input_item_t *p_i )
         vlc_InputItemDurationChanged );
     vlc_event_manager_register_event_type( &p_i->event_manager,
         vlc_InputItemPreparsedChanged );
+    vlc_event_manager_register_event_type( &p_i->event_manager,
+        vlc_InputItemNameChanged );
+    vlc_event_manager_register_event_type( &p_i->event_manager,
+        vlc_InputItemInfoChanged );
 }
 
 static inline void input_ItemClean( input_item_t *p_i )
diff --git a/src/misc/events.c b/src/misc/events.c
index a558fd7..cd883c7 100644
--- a/src/misc/events.c
+++ b/src/misc/events.c
@@ -78,6 +78,8 @@ static const char ppsz_event_type_to_name[][33] =
     [vlc_InputItemSubItemAdded]         = "vlc_InputItemSubItemAdded",
     [vlc_InputItemDurationChanged]      = "vlc_InputItemDurationChanged",
     [vlc_InputItemPreparsedChanged]     = "vlc_InputItemPreparsedChanged",
+    [vlc_InputItemNameChanged]          = "vlc_InputItemNameChanged",
+    [vlc_InputItemInfoChanged]          = "vlc_InputItemInfoChanged",
 
     [vlc_ServicesDiscoveryItemAdded]    = "vlc_ServicesDiscoveryItemAdded",
     [vlc_ServicesDiscoveryItemRemoved]  = "vlc_ServicesDiscoveryItemRemoved"




More information about the vlc-devel mailing list