* [PATCH BlueZ 1/4] Add rule to allow sending messages to MediaPlayer interface
@ 2011-10-28 7:49 Luiz Augusto von Dentz
2011-10-28 7:49 ` [PATCH BlueZ 2/4] Add MediaPlayer.Release method Luiz Augusto von Dentz
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2011-10-28 7:49 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
src/bluetooth.conf | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/bluetooth.conf b/src/bluetooth.conf
index 853f926..b5a6af3 100644
--- a/src/bluetooth.conf
+++ b/src/bluetooth.conf
@@ -13,6 +13,7 @@
<allow send_interface="org.bluez.Agent"/>
<allow send_interface="org.bluez.HandsfreeAgent"/>
<allow send_interface="org.bluez.MediaEndpoint"/>
+ <allow send_interface="org.bluez.MediaPlayer"/>
<allow send_interface="org.bluez.Watcher"/>
</policy>
--
1.7.6.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ 2/4] Add MediaPlayer.Release method
2011-10-28 7:49 [PATCH BlueZ 1/4] Add rule to allow sending messages to MediaPlayer interface Luiz Augusto von Dentz
@ 2011-10-28 7:49 ` Luiz Augusto von Dentz
2011-10-28 7:49 ` [PATCH BlueZ 3/4] Add support for MediaPlayer.Release to mpris-player Luiz Augusto von Dentz
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2011-10-28 7:49 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This is similar to MediaEndpoint.Release which is useful to notify the
player that it is no longer registered/active.
---
audio/media.c | 26 +++++++++++++++++++++++++-
doc/media-api.txt | 8 ++++++++
2 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/audio/media.c b/audio/media.c
index 5528ada..cf157d7 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -870,11 +870,33 @@ static struct media_player *media_adapter_find_player(
return NULL;
}
+static void release_player(struct media_player *mp)
+{
+ DBusMessage *msg;
+
+ DBG("sender=%s path=%s", mp->sender, mp->path);
+
+ msg = dbus_message_new_method_call(mp->sender, mp->path,
+ MEDIA_PLAYER_INTERFACE,
+ "Release");
+ if (msg == NULL) {
+ error("Couldn't allocate D-Bus message");
+ return;
+ }
+
+ g_dbus_send_message(mp->adapter->conn, msg);
+}
+
static void media_player_free(gpointer data)
{
struct media_player *mp = data;
struct media_adapter *adapter = mp->adapter;
+ if (mp->player) {
+ adapter->players = g_slist_remove(adapter->players, mp);
+ release_player(mp);
+ }
+
g_dbus_remove_watch(adapter->conn, mp->watch);
g_dbus_remove_watch(adapter->conn, mp->property_watch);
g_dbus_remove_watch(adapter->conn, mp->track_watch);
@@ -898,8 +920,10 @@ static void media_player_destroy(struct media_player *mp)
DBG("sender=%s path=%s", mp->sender, mp->path);
if (mp->player) {
+ struct avrcp_player *player = mp->player;
+ mp->player = NULL;
adapter->players = g_slist_remove(adapter->players, mp);
- avrcp_unregister_player(mp->player);
+ avrcp_unregister_player(player);
return;
}
diff --git a/doc/media-api.txt b/doc/media-api.txt
index 5a3aa3e..f10afe1 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -137,6 +137,14 @@ Methods void SetProperty(string property, variant value)
On success this will emit a PropertyChanged signal.
+ void Release()
+
+ This method gets called when the service daemon
+ unregisters the player which can then perform
+ cleanup tasks. There is no need to unregister the
+ player, because when this method gets called it has
+ already been unregistered.
+
Signals PropertyChanged(string setting, variant value)
This signal indicates a changed value of the given
--
1.7.6.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ 3/4] Add support for MediaPlayer.Release to mpris-player
2011-10-28 7:49 [PATCH BlueZ 1/4] Add rule to allow sending messages to MediaPlayer interface Luiz Augusto von Dentz
2011-10-28 7:49 ` [PATCH BlueZ 2/4] Add MediaPlayer.Release method Luiz Augusto von Dentz
@ 2011-10-28 7:49 ` Luiz Augusto von Dentz
2011-10-28 7:49 ` [PATCH BlueZ 4/4] Add support for MediaPlayer.Release to simple-player Luiz Augusto von Dentz
2011-10-28 12:16 ` [PATCH BlueZ 1/4] Add rule to allow sending messages to MediaPlayer interface Johan Hedberg
3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2011-10-28 7:49 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
test/mpris-player.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/test/mpris-player.c b/test/mpris-player.c
index 4592e5d..a1632f3 100644
--- a/test/mpris-player.c
+++ b/test/mpris-player.c
@@ -429,6 +429,22 @@ static char *sender2path(const char *sender)
return g_strdelimit(path, ":.", '_');
}
+static DBusHandlerResult player_message(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ if (dbus_message_is_method_call(msg, "org.bluez.MediaPlayer",
+ "Release")) {
+ printf("Release\n");
+ exit(1);
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static const DBusObjectPathVTable player_table = {
+ .message_function = player_message,
+};
+
static void add_player(DBusConnection *conn, const char *name,
const char *sender)
{
@@ -492,6 +508,10 @@ static void add_player(DBusConnection *conn, const char *name,
goto done;
}
+ if (!dbus_connection_register_object_path(sys, path, &player_table,
+ NULL))
+ fprintf(stderr, "Can't register object path for agent\n");
+
done:
if (reply)
dbus_message_unref(reply);
--
1.7.6.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ 4/4] Add support for MediaPlayer.Release to simple-player
2011-10-28 7:49 [PATCH BlueZ 1/4] Add rule to allow sending messages to MediaPlayer interface Luiz Augusto von Dentz
2011-10-28 7:49 ` [PATCH BlueZ 2/4] Add MediaPlayer.Release method Luiz Augusto von Dentz
2011-10-28 7:49 ` [PATCH BlueZ 3/4] Add support for MediaPlayer.Release to mpris-player Luiz Augusto von Dentz
@ 2011-10-28 7:49 ` Luiz Augusto von Dentz
2011-10-28 12:16 ` [PATCH BlueZ 1/4] Add rule to allow sending messages to MediaPlayer interface Johan Hedberg
3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2011-10-28 7:49 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
test/simple-player | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/test/simple-player b/test/simple-player
index 209fcdc..166caff 100755
--- a/test/simple-player
+++ b/test/simple-player
@@ -10,6 +10,12 @@ import gobject
class Player(dbus.service.Object):
@dbus.service.method("org.bluez.MediaPlayer",
+ in_signature="", out_signature="")
+ def Release(self):
+ print("Release")
+ mainloop.quit()
+
+ @dbus.service.method("org.bluez.MediaPlayer",
in_signature="sv", out_signature="")
def SetProperty(self, key, value):
print("SetProperty (%s, %s)" % (key, value), file=sys.stderr)
--
1.7.6.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH BlueZ 1/4] Add rule to allow sending messages to MediaPlayer interface
2011-10-28 7:49 [PATCH BlueZ 1/4] Add rule to allow sending messages to MediaPlayer interface Luiz Augusto von Dentz
` (2 preceding siblings ...)
2011-10-28 7:49 ` [PATCH BlueZ 4/4] Add support for MediaPlayer.Release to simple-player Luiz Augusto von Dentz
@ 2011-10-28 12:16 ` Johan Hedberg
3 siblings, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2011-10-28 12:16 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
On Fri, Oct 28, 2011, Luiz Augusto von Dentz wrote:
> ---
> src/bluetooth.conf | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
All four patches have been applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-28 12:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 7:49 [PATCH BlueZ 1/4] Add rule to allow sending messages to MediaPlayer interface Luiz Augusto von Dentz
2011-10-28 7:49 ` [PATCH BlueZ 2/4] Add MediaPlayer.Release method Luiz Augusto von Dentz
2011-10-28 7:49 ` [PATCH BlueZ 3/4] Add support for MediaPlayer.Release to mpris-player Luiz Augusto von Dentz
2011-10-28 7:49 ` [PATCH BlueZ 4/4] Add support for MediaPlayer.Release to simple-player Luiz Augusto von Dentz
2011-10-28 12:16 ` [PATCH BlueZ 1/4] Add rule to allow sending messages to MediaPlayer interface Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox