]> git.sesse.net Git - vlc/commitdiff
Adds Disconnect method to release the org.freedesktop.MediaPlayer name on the bus
authorRafaël Carré <funman@videolan.org>
Mon, 25 Jun 2007 15:24:15 +0000 (15:24 +0000)
committerRafaël Carré <funman@videolan.org>
Mon, 25 Jun 2007 15:24:15 +0000 (15:24 +0000)
modules/control/dbus.c
modules/control/dbus.h

index 9d762cfb0f12e4281e23a0ac16cb3ba521a5ecfa..b2493a93a763d16b326d9f046b4bf190229ef0ca 100644 (file)
  *      http://dbus.freedesktop.org/doc/dbus-specification.html
  * D-Bus low-level C API (libdbus)
  *      http://dbus.freedesktop.org/doc/dbus/api/html/index.html
- */
-
-/*
- * TODO:
- *  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 )
+ *  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):
+ *      http://wiki.xmms2.xmms.se/index.php/Media_Player_Interfaces
  */
 
 /*****************************************************************************
@@ -328,6 +320,22 @@ DBUS_METHOD( Play )
     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 )
 {
     REPLY_INIT;
@@ -668,6 +676,7 @@ DBUS_METHOD( handle_player )
     METHOD_FUNC( "Play",                    Play );
     METHOD_FUNC( "Pause",                   Pause );
     METHOD_FUNC( "Repeat",                  Repeat );
+    METHOD_FUNC( "Disconnect",              Disconnect );
     METHOD_FUNC( "VolumeSet",               VolumeSet );
     METHOD_FUNC( "VolumeGet",               VolumeGet );
     METHOD_FUNC( "PositionSet",             PositionSet );
index cd263357ca03c70b264b9be9030d8db5f8e4a969..ac7139a00ba1371306b9ea9592925eea0b3f569a 100644 (file)
@@ -145,6 +145,8 @@ const char* psz_introspection_xml_data_player =
 "    <method name=\"GetMetadata\">\n"
 "      <arg type=\"a{sv}\" direction=\"out\" />\n"
 "    </method>\n"
+"    <method name=\"Disconnect\">\n"
+"    </method>\n"
 "  </interface>\n"
 "</node>\n"
 ;