D-Bus - Implement "Random" Method. Patch from Mirsal ENNAIME, as usual.
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 3 Jun 2007 00:46:03 +0000 (00:46 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 3 Jun 2007 00:46:03 +0000 (00:46 +0000)
NEWS
modules/control/dbus.c
modules/control/dbus.h

diff --git a/NEWS b/NEWS
index 113d519..4a23da3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -83,6 +83,10 @@ Interfaces:
    * Improved mouse gestures
  * Unix
    * Allow only one running instance, using D-Bus interface (experimental).
+   * D-Bus Interface (experimental) implements the MPRIS 
+     (Media Player Remote Interfacing specification), a common dbus control 
+     interface for media players that intends to become an xdg standard when 
+     finished.
 
 Capture:
  * new BDA device driver plugin for DVB-C/S/T capture cards on Microsoft
index 7d0a2c2..0a39ff0 100644 (file)
@@ -573,6 +573,37 @@ DBUS_METHOD( Repeat )
     REPLY_SEND;
 }
 
+DBUS_METHOD( Random )
+{
+    REPLY_INIT;
+    OUT_ARGUMENTS;
+
+    DBusError error;
+    dbus_bool_t b_random;
+    vlc_value_t val;
+    playlist_t* p_playlist = NULL;
+    
+    dbus_error_init( &error );
+    dbus_message_get_args( p_from, &error,
+            DBUS_TYPE_BOOLEAN, &b_random,
+            DBUS_TYPE_INVALID );
+    
+    if( dbus_error_is_set( &error ) )
+    {
+        msg_Err( (vlc_object_t*) p_this, "D-Bus message reading : %s\n",
+                error.message );
+        dbus_error_free( &error );
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+    }
+
+    val.b_bool = ( b_random == TRUE ) ? VLC_TRUE : VLC_FALSE ;
+    
+    p_playlist = pl_Yield( (vlc_object_t*) p_this );
+    var_Set ( p_playlist, "random", val );
+    pl_Release( ((vlc_object_t*) p_this) );
+
+    REPLY_SEND;
+}
 /*****************************************************************************
  * Introspection method
  *****************************************************************************/
@@ -663,6 +694,7 @@ DBUS_METHOD( handle_tracklist )
     METHOD_FUNC( "DelTrack",                DelTrack );
     METHOD_FUNC( "Loop",                    Loop );
     METHOD_FUNC( "Repeat",                  Repeat );
+    METHOD_FUNC( "Random",                  Random );
 
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
index 897608d..43a3c63 100644 (file)
@@ -179,6 +179,9 @@ const char* psz_introspection_xml_data_tracklist =
 "    <method name=\"Repeat\">\n"
 "      <arg type=\"b\" direction=\"in\" />\n"
 "    </method>\n"
+"    <method name=\"Random\">\n"
+"      <arg type=\"b\" direction=\"in\" />\n"
+"    </method>\n"
 "  </interface>\n"
 "</node>\n"
 ;