Commit 4f2cfd11 authored by Rafaël Carré's avatar Rafaël Carré

Adds Disconnect method to release the org.freedesktop.MediaPlayer name on the bus

parent 4936cc77
...@@ -27,18 +27,10 @@ ...@@ -27,18 +27,10 @@
* http://dbus.freedesktop.org/doc/dbus-specification.html * http://dbus.freedesktop.org/doc/dbus-specification.html
* D-Bus low-level C API (libdbus) * D-Bus low-level C API (libdbus)
* http://dbus.freedesktop.org/doc/dbus/api/html/index.html * http://dbus.freedesktop.org/doc/dbus/api/html/index.html
*/ * extract:
"If you use this low-level API directly, you're signing up for some pain."
/* * MPRIS Specification (still drafting on June, 25 of 2007):
* TODO: * http://wiki.xmms2.xmms.se/index.php/Media_Player_Interfaces
* properties ?
*
* macros to read incoming arguments
*
* explore different possible types (arrays..)
*
* what must we do if org.videolan.vlc already exist on the bus ?
* ( there is more than one vlc instance )
*/ */
/***************************************************************************** /*****************************************************************************
...@@ -328,6 +320,22 @@ DBUS_METHOD( Play ) ...@@ -328,6 +320,22 @@ DBUS_METHOD( Play )
REPLY_SEND; REPLY_SEND;
} }
DBUS_METHOD( Disconnect )
{
REPLY_INIT;
DBusError error;
int i;
dbus_error_init( &error );
i = dbus_bus_release_name( p_conn, "org.freedesktop.MediaPlayer", &error );
if( ( i == -1 ) && ( dbus_error_is_set( &error ) ) )
{
msg_Err( (vlc_object_t*) p_this, "D-Bus disconnection failed : %s\n",
error.message );
dbus_error_free( &error );
}
REPLY_SEND;
}
DBUS_METHOD( GetCurrentMetadata ) DBUS_METHOD( GetCurrentMetadata )
{ {
REPLY_INIT; REPLY_INIT;
...@@ -668,6 +676,7 @@ DBUS_METHOD( handle_player ) ...@@ -668,6 +676,7 @@ DBUS_METHOD( handle_player )
METHOD_FUNC( "Play", Play ); METHOD_FUNC( "Play", Play );
METHOD_FUNC( "Pause", Pause ); METHOD_FUNC( "Pause", Pause );
METHOD_FUNC( "Repeat", Repeat ); METHOD_FUNC( "Repeat", Repeat );
METHOD_FUNC( "Disconnect", Disconnect );
METHOD_FUNC( "VolumeSet", VolumeSet ); METHOD_FUNC( "VolumeSet", VolumeSet );
METHOD_FUNC( "VolumeGet", VolumeGet ); METHOD_FUNC( "VolumeGet", VolumeGet );
METHOD_FUNC( "PositionSet", PositionSet ); METHOD_FUNC( "PositionSet", PositionSet );
......
...@@ -145,6 +145,8 @@ const char* psz_introspection_xml_data_player = ...@@ -145,6 +145,8 @@ const char* psz_introspection_xml_data_player =
" <method name=\"GetMetadata\">\n" " <method name=\"GetMetadata\">\n"
" <arg type=\"a{sv}\" direction=\"out\" />\n" " <arg type=\"a{sv}\" direction=\"out\" />\n"
" </method>\n" " </method>\n"
" <method name=\"Disconnect\">\n"
" </method>\n"
" </interface>\n" " </interface>\n"
"</node>\n" "</node>\n"
; ;
......
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