]> git.sesse.net Git - vlc/blobdiff - modules/misc/notify/growl_udp.c
Renamed playlist "playlist-current" to "item-current".
[vlc] / modules / misc / notify / growl_udp.c
index 3035c75ae1b8424515430bc04ffbf13e885959db..4e980c11373237f5ec2f54fb07ce945340a864ea 100644 (file)
@@ -29,7 +29,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_interface.h>
 #include <vlc_playlist.h>
 #include <vlc_meta.h>
@@ -65,22 +66,22 @@ static int CheckAndSend( vlc_object_t *p_this, uint8_t* p_data, int i_offset );
 #define PORT_TEXT N_("UDP port")
 #define PORT_LONGTEXT N_("Growl UDP port on the Growl server.")
 
-vlc_module_begin();
-    set_category( CAT_INTERFACE );
-    set_subcategory( SUBCAT_INTERFACE_CONTROL );
-    set_shortname( "Growl-UDP" );
-    set_description( _("Growl UDP Notification Plugin") );
+vlc_module_begin ()
+    set_category( CAT_INTERFACE )
+    set_subcategory( SUBCAT_INTERFACE_CONTROL )
+    set_shortname( "Growl-UDP" )
+    set_description( N_("Growl UDP Notification Plugin") )
 
     add_string( "growl-server", SERVER_DEFAULT, NULL,
-                SERVER_TEXT, SERVER_LONGTEXT, VLC_FALSE );
+                SERVER_TEXT, SERVER_LONGTEXT, false )
     add_password( "growl-password", PASS_DEFAULT, NULL,
-                PASS_TEXT, PASS_LONGTEXT, VLC_FALSE );
+                PASS_TEXT, PASS_LONGTEXT, false )
     add_integer( "growl-port", 9887, NULL,
-                PORT_TEXT, PORT_LONGTEXT, VLC_TRUE );
+                PORT_TEXT, PORT_LONGTEXT, true )
 
-    set_capability( "interface", 0 );
-    set_callbacks( Open, Close );
-vlc_module_end();
+    set_capability( "interface", 0 )
+    set_callbacks( Open, Close )
+vlc_module_end ()
 
 /*****************************************************************************
  * Open: initialize and create stuff
@@ -89,8 +90,8 @@ static int Open( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
-    playlist_t *p_playlist = pl_Yield( p_intf );
-    var_AddCallback( p_playlist, "playlist-current", ItemChange, p_intf );
+    playlist_t *p_playlist = pl_Hold( p_intf );
+    var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
     pl_Release( p_intf );
 
     RegisterToGrowl( p_this );
@@ -102,8 +103,8 @@ static int Open( vlc_object_t *p_this )
  *****************************************************************************/
 static void Close( vlc_object_t *p_this )
 {
-    playlist_t *p_playlist = pl_Yield( p_this );
-    var_DelCallback( p_playlist, "playlist-current", ItemChange, p_this );
+    playlist_t *p_playlist = pl_Hold( p_this );
+    var_DelCallback( p_playlist, "item-current", ItemChange, p_this );
     pl_Release( p_this );
 }
 
@@ -120,13 +121,13 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     char *psz_artist = NULL;
     char *psz_album = NULL;
     input_thread_t *p_input;
-    playlist_t *p_playlist = pl_Yield( p_this );
+    playlist_t *p_playlist = pl_Hold( p_this );
 
     p_input = p_playlist->p_input;
-    vlc_object_release( p_playlist );
+    pl_Release( p_this );
 
     if( !p_input ) return VLC_SUCCESS;
-    vlc_object_yield( p_input );
+    vlc_object_hold( p_input );
 
     char *psz_name = input_item_GetName( input_GetItem( p_input ) );
     if( p_input->b_dead || !psz_name )
@@ -199,10 +200,10 @@ static int RegisterToGrowl( vlc_object_t *p_this )
     uint8_t *psz_encoded = malloc(100);
     uint8_t i_defaults = 0;
     static const char *psz_notifications[] = {"Now Playing", NULL};
-    vlc_bool_t pb_defaults[] = {VLC_TRUE, VLC_FALSE};
+    bool pb_defaults[] = {true, false};
     int i = 0, j;
     if( psz_encoded == NULL )
-        return VLC_FALSE;
+        return false;
 
     memset( psz_encoded, 0, sizeof(psz_encoded) );
     psz_encoded[i++] = GROWL_PROTOCOL_VERSION;
@@ -219,7 +220,7 @@ static int RegisterToGrowl( vlc_object_t *p_this )
     }
     psz_encoded[4] = j;
     for( j = 0 ; psz_notifications[j] != NULL ; j++)
-        if(pb_defaults[j] == VLC_TRUE)
+        if(pb_defaults[j] == true)
         {
             psz_encoded[i++] = (uint8_t)j;
             i_defaults++;
@@ -238,7 +239,7 @@ static int NotifyToGrowl( vlc_object_t *p_this, const char *psz_desc )
     uint16_t flags;
     int i = 0;
     if( psz_encoded == NULL )
-        return VLC_FALSE;
+        return false;
 
     memset( psz_encoded, 0, sizeof(psz_encoded) );
     psz_encoded[i++] = GROWL_PROTOCOL_VERSION;
@@ -288,7 +289,7 @@ static int CheckAndSend( vlc_object_t *p_this, uint8_t* p_data, int i_offset )
         p_data[i_offset++] = (md5.p_digest[i]>>24)&0xFF;
     }
 
-    i_handle = net_ConnectUDP( p_this, psz_server, i_port, 0 );
+    i_handle = net_ConnectUDP( p_this, psz_server, i_port, -1 );
     if( i_handle == -1 )
     {
          msg_Err( p_this, "failed to open a connection (udp)" );