diff --git a/audio/media.c b/audio/media.c
index 5528ada..cf157d7 100644
--- a/audio/media.c
+++ b/audio/media.c
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);
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 c748e50..690f373 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
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