summaryrefslogtreecommitdiff
path: root/profiles/audio/avrcp.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-06-12 18:32:19 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-06-17 19:13:54 +0300
commit0a232a434d4b4da14c5d6b975ac1b55dc7ec92bb (patch)
treece78f5d28a05b57d53d278764d77b07b6b36451c /profiles/audio/avrcp.c
parentd2e642c78ad20d466f1cf7d04fd4c18f54153fa5 (diff)
downloadbluez-0a232a434d4b4da14c5d6b975ac1b55dc7ec92bb.tar.gz
audio/player: Add implementation of MediaFolder.Search
Diffstat (limited to 'profiles/audio/avrcp.c')
-rw-r--r--profiles/audio/avrcp.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index b198f7b5a..14cdece89 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -2588,6 +2588,8 @@ static int ct_list_items(struct media_player *mp, const char *name,
if (g_str_has_prefix(name, "/NowPlaying"))
player->scope = 0x03;
+ else if (g_str_has_suffix(name, "/search"))
+ player->scope = 0x02;
else
player->scope = 0x01;
@@ -2642,12 +2644,24 @@ static gboolean avrcp_search_rsp(struct avctp *conn, uint8_t *operands,
struct avrcp_browsing_header *pdu = (void *) operands;
struct avrcp *session = (void *) user_data;
struct avrcp_player *player = session->player;
+ struct media_player *mp = player->user_data;
+ int ret;
- if (pdu == NULL || pdu->params[0] != AVRCP_STATUS_SUCCESS ||
- operand_count < 7)
- return FALSE;
+ if (pdu == NULL) {
+ ret = -ETIMEDOUT;
+ goto done;
+ }
+
+ if (pdu->params[0] != AVRCP_STATUS_SUCCESS || operand_count < 7) {
+ ret = -EINVAL;
+ goto done;
+ }
player->uid_counter = bt_get_be16(&pdu->params[1]);
+ ret = bt_get_be32(&pdu->params[3]);
+
+done:
+ media_player_search_complete(mp, ret);
return FALSE;
}