From 5d5d49e6396b4326e30f6cb5541dc322fb4b76fa Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 19 Aug 2016 16:43:21 +0300 Subject: [PATCH] audio/player: Fix not setting scope properly If file is played from search folder it shall use search scope not vfs. --- profiles/audio/avrcp.c | 2 ++ profiles/audio/player.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index e20515d3d..51a89b126 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -3137,6 +3137,8 @@ static int ct_play_item(struct media_player *mp, const char *name, if (g_strrstr(name, "/NowPlaying")) player->scope = 0x03; + else if (g_strrstr(name, "/Search")) + player->scope = 0x02; else player->scope = 0x01; diff --git a/profiles/audio/player.c b/profiles/audio/player.c index f1bd9de3e..7944b493e 100644 --- a/profiles/audio/player.c +++ b/profiles/audio/player.c @@ -1483,12 +1483,15 @@ static DBusMessage *media_item_play(DBusConnection *conn, DBusMessage *msg, struct media_item *item = data; struct media_player *mp = item->player; struct player_callback *cb = mp->cb; + const char *path; int err; if (!item->playable || !cb->cbs->play_item) return btd_error_not_supported(msg); - err = cb->cbs->play_item(mp, item->path, item->uid, cb->user_data); + path = mp->search && mp->scope == mp->search ? "/Search" : item->path; + + err = cb->cbs->play_item(mp, path, item->uid, cb->user_data); if (err < 0) return btd_error_failed(msg, strerror(-err)); -- 2.47.3