diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index ee750f5..cab9fb4 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
}
}
+static void avrcp_now_playing_changed(struct avrcp *session,
+ struct avrcp_header *pdu)
+{
+ struct avrcp_player *player = session->controller->player;
+ struct media_player *mp = player->user_data;
+
+ DBG("NowPlaying changed");
+
+ media_player_clear_playlist(mp);
+}
+
static void avrcp_available_players_changed(struct avrcp *session,
struct avrcp_header *pdu)
{
case AVRCP_EVENT_SETTINGS_CHANGED:
avrcp_setting_changed(session, pdu);
break;
+ case AVRCP_EVENT_NOW_PLAYING_CHANGED:
+ avrcp_now_playing_changed(session, pdu);
+ break;
case AVRCP_EVENT_AVAILABLE_PLAYERS_CHANGED:
avrcp_available_players_changed(session, pdu);
break;
case AVRCP_EVENT_TRACK_CHANGED:
case AVRCP_EVENT_PLAYBACK_POS_CHANGED:
case AVRCP_EVENT_SETTINGS_CHANGED:
+ case AVRCP_EVENT_NOW_PLAYING_CHANGED:
case AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED:
case AVRCP_EVENT_UIDS_CHANGED:
case AVRCP_EVENT_AVAILABLE_PLAYERS_CHANGED:
diff --git a/profiles/audio/avrcp.h b/profiles/audio/avrcp.h
index 59117e9..887753d 100644
--- a/profiles/audio/avrcp.h
+++ b/profiles/audio/avrcp.h
#define AVRCP_EVENT_TRACK_REACHED_START 0x04
#define AVRCP_EVENT_PLAYBACK_POS_CHANGED 0x05
#define AVRCP_EVENT_SETTINGS_CHANGED 0x08
+#define AVRCP_EVENT_NOW_PLAYING_CHANGED 0x09
#define AVRCP_EVENT_AVAILABLE_PLAYERS_CHANGED 0x0a
#define AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED 0x0b
#define AVRCP_EVENT_UIDS_CHANGED 0x0c
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index 5bb3bc1..0f72d76 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
return item;
}
+void media_player_clear_playlist(struct media_player *mp)
+{
+ if (mp->playlist) {
+ g_slist_free_full(mp->playlist->items, media_item_destroy);
+ mp->playlist->items = NULL;
+ }
+
+ g_dbus_emit_property_changed(btd_get_dbus_connection(), mp->path,
+ MEDIA_PLAYER_INTERFACE, "Playlist");
+}
+
void media_player_set_obex_port(struct media_player *mp, uint16_t port)
{
mp->obex_port = port;
diff --git a/profiles/audio/player.h b/profiles/audio/player.h
index 0076c46..5e18159 100644
--- a/profiles/audio/player.h
+++ b/profiles/audio/player.h
void media_player_set_playlist(struct media_player *mp, const char *name);
struct media_item *media_player_set_playlist_item(struct media_player *mp,
uint64_t uid);
+void media_player_clear_playlist(struct media_player *mp);
void media_player_set_obex_port(struct media_player *mp, uint16_t port);
struct media_item *media_player_create_folder(struct media_player *mp,