Commit 77f036c8 authored by Mirsal Ennaime's avatar Mirsal Ennaime

dbus: Fix the instance identifier part of the MPRIS bus name

The D-Bus specification forbids parts of well-known bus names to begin
with a digit. This patch changes the instance-specific part of the bus
name to .instance<pid> instead of -<pid> in order to comply with the
MPRIS v2.2

see: http://specifications.freedesktop.org/mpris-spec/2.2/#Bus-Name-Policy
parent 15b1a1b9
......@@ -2,8 +2,8 @@
* dbus.c : D-Bus control interface
*****************************************************************************
* Copyright © 2006-2008 Rafaël Carré
* Copyright © 2007-2010 Mirsal Ennaime
* Copyright © 2009-2010 The VideoLAN team
* Copyright © 2007-2012 Mirsal Ennaime
* Copyright © 2009-2012 The VideoLAN team
* $Id$
*
* Authors: Rafaël Carré <funman at videolanorg>
......@@ -185,10 +185,17 @@ static int Open( vlc_object_t *p_this )
dbus_connection_set_exit_on_disconnect( p_conn, FALSE );
/* register a well-known name on the bus */
char unique_service[sizeof (DBUS_MPRIS_BUS_NAME) + 10];
size_t i_length = sizeof( DBUS_MPRIS_BUS_NAME ) +
sizeof( DBUS_INSTANCE_ID_PREFIX ) + 10;
char unique_service[i_length];
snprintf( unique_service, sizeof (unique_service),
DBUS_MPRIS_BUS_NAME"-%"PRIu32, (uint32_t)getpid() );
DBUS_MPRIS_BUS_NAME"."DBUS_INSTANCE_ID_PREFIX"%"PRIu32,
(uint32_t)getpid() );
dbus_bus_request_name( p_conn, unique_service, 0, &error );
if( dbus_error_is_set( &error ) )
{
msg_Err( p_this, "Error requesting service name %s: %s",
......
......@@ -2,8 +2,8 @@
* dbus.h : D-Bus control interface
*****************************************************************************
* Copyright © 2006-2008 Rafaël Carré
* Copyright © 2007-2010 Mirsal Ennaime
* Copyright © 2009-2010 The VideoLAN team
* Copyright © 2007-2012 Mirsal Ennaime
* Copyright © 2009-2012 The VideoLAN team
* $Id$
*
* Authors: Rafaël Carré <funman at videolanorg>
......@@ -28,6 +28,7 @@
#define _VLC_DBUS_H
#define DBUS_MPRIS_BUS_NAME "org.mpris.MediaPlayer2.vlc"
#define DBUS_INSTANCE_ID_PREFIX "instance"
static DBusHandlerResult
MPRISEntryPoint ( DBusConnection *p_conn, DBusMessage *p_from, void *p_this );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment