[vlc-devel] commit: Modify playlist code to always use input_item_t->i_id in " item-change" callback. (Laurent Aimar )

git version control git at videolan.org
Mon Feb 16 22:09:34 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Feb 16 21:33:43 2009 +0100| [aaa0d27584304a53f5f413f9b7a7f1b77d22c24e] | committer: Laurent Aimar 

Modify playlist code to always use input_item_t->i_id in "item-change" callback.

 The previous code mixed up playlist_item_t->i_id and input_item_t->i_id and
 so this callback was unusable.

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

 include/vlc_playlist.h |    8 ++++++++
 src/playlist/item.c    |    9 ++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index 12521b7..6fbd4a1 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -114,6 +114,14 @@ TYPEDEF_ARRAY(playlist_item_t*, playlist_item_array_t);
  * To delete an item, use playlist_DeleteFromInput( input_id ) which will
  * remove all occurrences of the input in both trees
  *
+ *
+ * The playlist defines the following event variables:
+ * - "item-change": It will contains the input_item_t->i_id of a changed input
+ * item monitored by the playlist.
+ *
+ * XXX Be really carefull, playlist_item_t->i_id and input_item_t->i_id are not
+ * the same.
+ *
  * @{
  */
 
diff --git a/src/playlist/item.c b/src/playlist/item.c
index e8179b1..383771a 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -115,9 +115,9 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
 static void input_item_changed( const vlc_event_t * p_event,
                                 void * user_data )
 {
-    (void)p_event;
-    playlist_item_t * p_item = user_data;
-    var_SetInteger( p_item->p_playlist, "item-change", p_item->i_id );
+    playlist_item_t *p_item = user_data;
+    VLC_UNUSED( p_event );
+    var_SetInteger( p_item->p_playlist, "item-change", p_item->p_input->i_id );
 }
 
 /*****************************************************************************
@@ -624,8 +624,7 @@ static playlist_item_t *ItemToNode( playlist_t *p_playlist,
         }
         pl_priv(p_playlist)->b_reset_currently_playing = true;
         vlc_cond_signal( &pl_priv(p_playlist)->signal );
-        var_SetInteger( p_playlist, "item-change", p_item_in_category->
-                                                        p_input->i_id );
+        var_SetInteger( p_playlist, "item-change", p_item_in_category->p_input->i_id );
         PL_UNLOCK_IF( !b_locked );
         return p_item_in_category;
     }




More information about the vlc-devel mailing list