[vlc-devel] [PATCH] osx_notifications: Identify item by pointer instead of id

Marvin Scholz epirat07 at gmail.com
Wed Nov 16 16:16:56 CET 2016


The input_item_t does not has a i_id anymore, so this commit changes
the usage of the id to use the pointer of the item instead.
---
 modules/notify/osx_notifications.m | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/notify/osx_notifications.m b/modules/notify/osx_notifications.m
index ef43b1a..8619103 100644
--- a/modules/notify/osx_notifications.m
+++ b/modules/notify/osx_notifications.m
@@ -102,7 +102,7 @@ - (void)notifyWithTitle:(const char *)title
 struct intf_sys_t
 {
     VLCGrowlDelegate *o_growl_delegate;
-    int             i_id;
+    input_item_t    *p_item_old;
     int             i_item_changes;
 };
 
@@ -146,6 +146,8 @@ static int Open( vlc_object_t *p_this )
     if( !p_sys->o_growl_delegate )
       return VLC_ENOMEM;
 
+    p_sys->p_item_old = NULL;
+
     p_playlist = pl_Get( p_intf );
     var_AddCallback( p_playlist, "item-change", ItemChange, p_intf );
     var_AddCallback( p_playlist, "input-current", ItemChange, p_intf );
@@ -196,9 +198,9 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
             return VLC_SUCCESS;
 
         p_item = input_GetItem( p_input );
-        if( p_intf->p_sys->i_id != p_item->i_id )
+        if( p_intf->p_sys->p_item_old != p_item )
         {
-            p_intf->p_sys->i_id = p_item->i_id;
+            p_intf->p_sys->p_item_old = p_item;
             p_intf->p_sys->i_item_changes = 0;
         }
 
@@ -209,7 +211,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
         return VLC_SUCCESS;
     else
     {   /* "item-change" */
-        if( p_item->i_id != p_intf->p_sys->i_id )
+        if( p_item != p_intf->p_sys->p_item_old )
             return VLC_SUCCESS;
 
         /* Some variable bitrate inputs call "item-change" callbacks each time
-- 
2.9.3 (Apple Git-75)



More information about the vlc-devel mailing list