Re: [PATCH ] audio/player: Fix player name value for MPRIS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20.10.2015 15:05, Bharat Bhusan Panda wrote:
ping

-----Original Message-----
From: linux-bluetooth-owner@xxxxxxxxxxxxxxx [mailto:linux-bluetooth-
owner@xxxxxxxxxxxxxxx] On Behalf Of Bharat Panda
Sent: Monday, October 12, 2015 2:11 PM
To: linux-bluetooth@xxxxxxxxxxxxxxx
Cc: cpgs@xxxxxxxxxxx; Bharat Panda
Subject: [PATCH ] audio/player: Fix player name value for MPRIS

Added fix for setting media player name when the player Identity value is
invalid.
---
  profiles/audio/media.c | 15 +++++++++++++--
  tools/mpris-proxy.c    |  1 +
  2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c index
69070bf..68111e6 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1805,7 +1805,7 @@ static DBusMessage
*register_player(DBusConnection *conn, DBusMessage *msg,
  	struct media_adapter *adapter = data;
  	struct media_player *mp;
  	DBusMessageIter args;
-	const char *sender, *path;
+	const char *sender, *path, *name;
  	int err;

  	sender = dbus_message_get_sender(msg); @@ -1814,6 +1814,8 @@
static DBusMessage *register_player(DBusConnection *conn, DBusMessage
*msg,

  	dbus_message_iter_get_basic(&args, &path);
  	dbus_message_iter_next(&args);
+	dbus_message_iter_get_basic(&args, &name);
+	dbus_message_iter_next(&args);

  	if (media_adapter_find_player(adapter, sender, path) != NULL)
  		return btd_error_already_exists(msg); @@ -1831,6 +1833,14
@@ static DBusMessage *register_player(DBusConnection *conn,
DBusMessage *msg,
  		return btd_error_invalid_args(msg);
  	}

+	/*
+	 * The Player Identity value is NULL in MPRIS case, so create
+	 * mpris name on the basis of player bus name and assign
+	 * the value.
+	 */
+	if (mp->name == NULL)
+		mp->name = g_strdup(name);
+
  	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);  }

@@ -1864,7 +1874,8 @@ static const GDBusMethodTable media_methods[]
= {
  	{ GDBUS_METHOD("UnregisterEndpoint",
  		GDBUS_ARGS({ "endpoint", "o" }), NULL,
unregister_endpoint) },
  	{ GDBUS_METHOD("RegisterPlayer",
-		GDBUS_ARGS({ "player", "o" }, { "properties", "a{sv}" }),
+		GDBUS_ARGS({ "player", "o" }, { "name", "s" },
+						{ "properties", "a{sv}" }),

This breaks the API. Can't the name be passed as a member of the properties dict?

regards,
Simon

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux