Commit 0222328d authored by Rafaël Carré's avatar Rafaël Carré

Advertises signals and renames VLC_ defines to MPRIS_

parent d112d7e9
...@@ -323,7 +323,7 @@ DBUS_METHOD( Disconnect ) ...@@ -323,7 +323,7 @@ DBUS_METHOD( Disconnect )
DBusError error; DBusError error;
int i; int i;
dbus_error_init( &error ); dbus_error_init( &error );
i = dbus_bus_release_name( p_conn, "org.mpris.vlc", &error ); i = dbus_bus_release_name( p_conn, VLC_MPRIS_DBUS_SERVICE, &error );
if( ( i == -1 ) && ( dbus_error_is_set( &error ) ) ) if( ( i == -1 ) && ( dbus_error_is_set( &error ) ) )
{ {
msg_Err( (vlc_object_t*) p_this, "D-Bus disconnection failed : %s\n", msg_Err( (vlc_object_t*) p_this, "D-Bus disconnection failed : %s\n",
...@@ -640,7 +640,7 @@ DBUS_METHOD( handle_introspect_tracklist ) ...@@ -640,7 +640,7 @@ DBUS_METHOD( handle_introspect_tracklist )
*****************************************************************************/ *****************************************************************************/
#define METHOD_FUNC( method, function ) \ #define METHOD_FUNC( method, function ) \
else if( dbus_message_is_method_call( p_from, VLC_DBUS_INTERFACE, method ) )\ else if( dbus_message_is_method_call( p_from, MPRIS_DBUS_INTERFACE, method ) )\
return function( p_conn, p_from, p_this ) return function( p_conn, p_from, p_this )
DBUS_METHOD( handle_root ) DBUS_METHOD( handle_root )
...@@ -734,21 +734,22 @@ static int Open( vlc_object_t *p_this ) ...@@ -734,21 +734,22 @@ static int Open( vlc_object_t *p_this )
} }
/* register a well-known name on the bus */ /* register a well-known name on the bus */
dbus_bus_request_name( p_conn, "org.mpris.vlc", 0, &error ); dbus_bus_request_name( p_conn, VLC_MPRIS_DBUS_SERVICE, 0, &error );
if( dbus_error_is_set( &error ) ) if( dbus_error_is_set( &error ) )
{ {
msg_Err( p_this, "Error requesting org.mpris.vlc service:" " %s\n", error.message ); msg_Err( p_this, "Error requesting % service: %s\n"
VLC_MPRIS_DBUS_SERVICE, error.message );
dbus_error_free( &error ); dbus_error_free( &error );
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* we register the objects */ /* we register the objects */
dbus_connection_register_object_path( p_conn, VLC_DBUS_ROOT_PATH, dbus_connection_register_object_path( p_conn, MPRIS_DBUS_ROOT_PATH,
&vlc_dbus_root_vtable, p_this ); &vlc_dbus_root_vtable, p_this );
dbus_connection_register_object_path( p_conn, VLC_DBUS_PLAYER_PATH, dbus_connection_register_object_path( p_conn, MPRIS_DBUS_PLAYER_PATH,
&vlc_dbus_player_vtable, p_this ); &vlc_dbus_player_vtable, p_this );
dbus_connection_register_object_path( p_conn, VLC_DBUS_TRACKLIST_PATH, dbus_connection_register_object_path( p_conn, MPRIS_DBUS_TRACKLIST_PATH,
&vlc_dbus_tracklist_vtable, p_this ); &vlc_dbus_tracklist_vtable, p_this );
dbus_connection_flush( p_conn ); dbus_connection_flush( p_conn );
......
...@@ -25,11 +25,11 @@ ...@@ -25,11 +25,11 @@
/* DBUS IDENTIFIERS */ /* DBUS IDENTIFIERS */
/* name registered on the session bus */ /* name registered on the session bus */
#define VLC_DBUS_SERVICE "org.mpris.vlc" #define VLC_MPRIS_DBUS_SERVICE "org.mpris.vlc"
#define VLC_DBUS_INTERFACE "org.freedesktop.MediaPlayer" #define MPRIS_DBUS_INTERFACE "org.freedesktop.MediaPlayer"
#define VLC_DBUS_ROOT_PATH "/" #define MPRIS_DBUS_ROOT_PATH "/"
#define VLC_DBUS_PLAYER_PATH "/Player" #define MPRIS_DBUS_PLAYER_PATH "/Player"
#define VLC_DBUS_TRACKLIST_PATH "/TrackList" #define MPRIS_DBUS_TRACKLIST_PATH "/TrackList"
/* MACROS */ /* MACROS */
...@@ -54,8 +54,8 @@ ...@@ -54,8 +54,8 @@
return DBUS_HANDLER_RESULT_HANDLED return DBUS_HANDLER_RESULT_HANDLED
#define SIGNAL_INIT( signal ) \ #define SIGNAL_INIT( signal ) \
DBusMessage *p_msg = dbus_message_new_signal( VLC_DBUS_PLAYER_PATH, \ DBusMessage *p_msg = dbus_message_new_signal( MPRIS_DBUS_PLAYER_PATH, \
VLC_DBUS_INTERFACE, signal ); \ MPRIS_DBUS_INTERFACE, signal ); \
if( !p_msg ) return DBUS_HANDLER_RESULT_NEED_MEMORY; \ if( !p_msg ) return DBUS_HANDLER_RESULT_NEED_MEMORY; \
#define SIGNAL_SEND \ #define SIGNAL_SEND \
...@@ -149,6 +149,15 @@ const char* psz_introspection_xml_data_player = ...@@ -149,6 +149,15 @@ const char* psz_introspection_xml_data_player =
" </method>\n" " </method>\n"
" <method name=\"Disconnect\">\n" " <method name=\"Disconnect\">\n"
" </method>\n" " </method>\n"
" <signal name=\"TrackChange\">\n"
" <arg type=\"a{sv}\"/>\n"
" </signal>\n"
" <signal name=\"StatusChange\">\n"
" <arg type=\"i\">\n"
" </signal>\n"
" <signal name=\"CapsChange\">\n"
" <arg type=\"i\">\n"
" </signal>\n"
" </interface>\n" " </interface>\n"
"</node>\n" "</node>\n"
; ;
...@@ -190,9 +199,9 @@ const char* psz_introspection_xml_data_tracklist = ...@@ -190,9 +199,9 @@ const char* psz_introspection_xml_data_tracklist =
"</node>\n" "</node>\n"
; ;
#define VLC_DBUS_ROOT_PATH "/" #define MPRIS_DBUS_ROOT_PATH "/"
#define VLC_DBUS_PLAYER_PATH "/Player" #define MPRIS_DBUS_PLAYER_PATH "/Player"
#define VLC_DBUS_TRACKLIST_PATH "/TrackList" #define MPRIS_DBUS_TRACKLIST_PATH "/TrackList"
/* Handle messages reception */ /* Handle messages reception */
DBUS_METHOD( handle_root ); DBUS_METHOD( handle_root );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment