[vlc-commits] libvlc: Update the mpris client code used for the one-instance mode

Mirsal Ennaime git at videolan.org
Mon May 16 22:58:50 CEST 2011


vlc | branch: master | Mirsal Ennaime <mirsal at mirsal.fr> | Sun May 15 13:03:34 2011 +0200| [950b29f8a3ea12e056fc55c6e667a05560b26b95] | committer: Mirsal Ennaime

libvlc: Update the mpris client code used for the one-instance mode

 * Connect to the other instance using the mpris2 bus name,
   object path and interfaces so that the one-instance mode
   works with the mpris2-enabled dbus control interface

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=950b29f8a3ea12e056fc55c6e667a05560b26b95
---

 src/libvlc.c |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/libvlc.c b/src/libvlc.c
index 8bb298e..d26b0d1 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -533,11 +533,13 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
             /* check if VLC is available on the bus
              * if not: D-Bus control is not enabled on the other
              * instance and we can't pass MRLs to it */
-            DBusMessage *p_test_msg = NULL;
+            DBusMessage *p_test_msg   = NULL;
             DBusMessage *p_test_reply = NULL;
+
             p_test_msg =  dbus_message_new_method_call(
-                    "org.mpris.vlc", "/",
-                    "org.freedesktop.MediaPlayer", "Identity" );
+                    "org.mpris.MediaPlayer2.vlc", "/org/mpris/MediaPlayer2",
+                    "org.mpris.MediaPlayer2",     "Identity" );
+
             /* block until a reply arrives */
             p_test_reply = dbus_connection_send_with_reply_and_block(
                     p_conn, p_test_msg, -1, &dbus_error );
@@ -571,14 +573,16 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
 
                     /* We need to resolve relative paths in this instance */
                     char *psz_mrl = make_URI( ppsz_argv[i_input], NULL );
+                    char *psz_after_track = "";
+
                     if( psz_mrl == NULL )
                         continue;
                     msg_Dbg( p_libvlc, "Adds %s to the running Media Player",
                              psz_mrl );
 
                     p_dbus_msg = dbus_message_new_method_call(
-                            "org.mpris.vlc", "/TrackList",
-                            "org.freedesktop.MediaPlayer", "AddTrack" );
+                        "org.mpris.MediaPlayer2.vlc", "/org/mpris/MediaPlayer2",
+                        "org.mpris.MediaPlayer2.TrackList", "AddTrack" );
 
                     if ( NULL == p_dbus_msg )
                     {
@@ -599,9 +603,19 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
                         exit( 1 );
                     }
                     free( psz_mrl );
+
+                    if( !dbus_message_iter_append_basic( &dbus_args,
+                                DBUS_TYPE_OBJECT_PATH, &psz_after_track ) )
+                    {
+                        dbus_message_unref( p_dbus_msg );
+                        system_End( p_libvlc );
+                        exit( 1 );
+                    }
+
                     b_play = TRUE;
                     if( var_InheritBool( p_libvlc, "playlist-enqueue" ) )
                         b_play = FALSE;
+
                     if ( !dbus_message_iter_append_basic( &dbus_args,
                                 DBUS_TYPE_BOOLEAN, &b_play ) )
                     {



More information about the vlc-commits mailing list