[vlc-devel] commit: playlist: Listen to vlc_InputItemMetaChanged. This removes one more playlist->vout dependency. (Pierre d'Herbemont )

git version control git at videolan.org
Sun Jun 1 21:44:23 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sun Jun  1 21:44:31 2008 +0200| [9ff2a688923e778b1526dba269c836afa1c5a1e1]

playlist: Listen to vlc_InputItemMetaChanged. This removes one more playlist->vout dependency.

This could trigger some interface bugs, especially if they handle their callbacks carelessly. Revert if you have issues, but also consider to fix your interface.

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

 src/input/input.c   |    2 --
 src/playlist/item.c |   20 +++++++++++++++++++-
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index a4b459a..4ab5b55 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2124,8 +2124,6 @@ static int UpdateFromAccess( input_thread_t *p_input )
         vlc_meta_t *p_meta = vlc_meta_New();
         access_Control( p_input->p->input.p_access,ACCESS_GET_META, p_meta );
         InputUpdateMeta( p_input, p_meta );
-        var_SetInteger( libvlc_priv (p_input->p_libvlc)->p_playlist,
-                        "item-change", p_input->p->input.p_item->i_id );
         p_access->info.i_update &= ~INPUT_UPDATE_META;
     }
 
diff --git a/src/playlist/item.c b/src/playlist/item.c
index 1545401..c2bc35c 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -107,6 +107,17 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
 }
 
 /*****************************************************************************
+ * An input item's meta has changed (Event Callback)
+ *****************************************************************************/
+static void input_item_meta_changed( const vlc_event_t * p_event,
+                                      void * user_data )
+{
+    playlist_item_t * p_item = user_data;
+    var_SetInteger( p_item->p_playlist,
+                    "item-change", p_item->i_id );
+}
+
+/*****************************************************************************
  * Listen to vlc_InputItemAddSubItem event
  *****************************************************************************/
 static void install_input_item_observer( playlist_item_t * p_item )
@@ -115,15 +126,22 @@ static void install_input_item_observer( playlist_item_t * p_item )
                       vlc_InputItemSubItemAdded,
                       input_item_subitem_added,
                       p_item );
+    vlc_event_attach( &p_item->p_input->event_manager,
+                      vlc_InputItemMetaChanged,
+                      input_item_meta_changed,
+                      p_item );
 }
 
 static void uninstall_input_item_observer( playlist_item_t * p_item )
 {
     vlc_event_detach( &p_item->p_input->event_manager,
+                      vlc_InputItemMetaChanged,
+                      input_item_meta_changed,
+                      p_item );
+    vlc_event_detach( &p_item->p_input->event_manager,
                       vlc_InputItemSubItemAdded,
                       input_item_subitem_added,
                       p_item );
-
 }
 
 /*****************************************************************************




More information about the vlc-devel mailing list