[vlc-commits] dbus: add command line option to disable MPRIS

Rémi Denis-Courmont git at videolan.org
Sun Jun 18 17:47:37 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jun 18 17:50:23 2017 +0300| [334979d1547e66a3e42f7bb37b2d3f0af14535f4] | committer: Rémi Denis-Courmont

dbus: add command line option to disable MPRIS

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

 bin/vlc.c            | 8 ++++----
 src/libvlc-module.c  | 7 +++++++
 src/posix/specific.c | 5 +++++
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/bin/vlc.c b/bin/vlc.c
index 0a33a0f41d..72e0eee428 100644
--- a/bin/vlc.c
+++ b/bin/vlc.c
@@ -201,11 +201,14 @@ int main( int i_argc, const char *ppsz_argv[] )
     pthread_t self = pthread_self ();
     pthread_sigmask (SIG_SETMASK, &set, NULL);
 
-    const char *argv[i_argc + 2];
+    const char *argv[i_argc + 3];
     int argc = 0;
 
     argv[argc++] = "--no-ignore-config";
     argv[argc++] = "--media-library";
+#ifdef HAVE_DBUS
+    argv[argc++] = "--dbus";
+#endif
     ppsz_argv++; i_argc--; /* skip executable path */
 
 #ifdef __OS2__
@@ -238,9 +241,6 @@ int main( int i_argc, const char *ppsz_argv[] )
 #if !defined (__OS2__)
     libvlc_add_intf (vlc, "globalhotkeys,none");
 #endif
-#ifdef HAVE_DBUS
-    libvlc_add_intf (vlc, "dbus,none");
-#endif
     if (libvlc_add_intf (vlc, NULL))
         goto out;
 
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index dea57cee9e..4cde870d9f 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -1086,6 +1086,10 @@ static const char *const ppsz_prefres[] = {
     "When using the one instance only option, enqueue items to playlist " \
     "and keep playing current item.")
 
+#define DBUS_TEXT N_("Expose media player via D-Bus")
+#define DBUS_LONGTEXT N_("Allow other applications to control " \
+    "the VLC media player using the D-Bus MPRIS protocol.")
+
 /*****************************************************************************
  * Playlist
  ****************************************************************************/
@@ -2038,6 +2042,9 @@ vlc_module_begin ()
     add_bool( "playlist-enqueue", 0, PLAYLISTENQUEUE_TEXT,
               PLAYLISTENQUEUE_LONGTEXT, true )
 #endif
+#ifdef HAVE_DBUS
+    add_bool( "dbus", false, DBUS_TEXT, DBUS_LONGTEXT, true )
+#endif
     add_bool( "media-library", 0, ML_TEXT, ML_LONGTEXT, false )
     add_bool( "playlist-tree", 0, PLTREE_TEXT, PLTREE_LONGTEXT, false )
 
diff --git a/src/posix/specific.c b/src/posix/specific.c
index 9622816d5f..fe26903002 100644
--- a/src/posix/specific.c
+++ b/src/posix/specific.c
@@ -24,6 +24,7 @@
 
 #include <vlc_common.h>
 #include "../libvlc.h"
+#include "../lib/libvlc_internal.h"
 
 #ifdef HAVE_DBUS
 /* used for one-instance mode */
@@ -157,4 +158,8 @@ void system_Configure(libvlc_int_t *libvlc,
                       int argc, const char *const argv[])
 {
     system_ConfigureDbus(libvlc, argc, argv);
+#ifdef HAVE_DBUS
+    if (var_InheritBool(libvlc, "dbus"))
+        libvlc_InternalAddIntf(libvlc, "dbus,none");
+#endif
 }



More information about the vlc-commits mailing list