@@ -3819,6 +3819,17 @@ static void avrcp_setting_changed(struct avrcp *session,
}
}
+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)
{
@@ -3909,6 +3920,9 @@ static gboolean avrcp_handle_event(struct avctp *conn, uint8_t code,
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;
@@ -4000,6 +4014,7 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn, uint8_t code,
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:
@@ -64,6 +64,7 @@
#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
@@ -2024,6 +2024,17 @@ struct media_item *media_player_set_playlist_item(struct media_player *mp,
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;
@@ -86,6 +86,7 @@ void media_player_set_folder(struct media_player *mp, const char *path,
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,