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__ @@ -237,9 +240,6 @@ int main( int i_argc, const char *ppsz_argv[] ) libvlc_add_intf (vlc, "hotkeys,none"); #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 ****************************************************************************/ @@ -2037,6 +2041,9 @@ vlc_module_begin () ONEINSTANCEWHENSTARTEDFROMFILE_TEXT, true ) 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 #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 }