AVRCP: Prefix folder name with /Filesystem
Luiz Augusto von Dentz
maintainerPATCH v2 1/5 AVRCP: Prefix folder name with /Filesystem
From: Luiz Augusto von Dentz <[email protected]>
This separate the scopes of the folder as documented in doc/media-api.txt
--- profiles/audio/avrcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
profiles/audio/avrcp.c +3 -2
@@ -1935,9 +1935,10 @@ static gboolean avrcp_set_browsed_player_rsp(struct avctp *conn, depth = operands[13 ]; - folders = g_new0(char *, depth + 1); + folders = g_new0(char *, depth + 2); + folders[0 ] =g_strdup ("/Filesystem" ); -for (i =14 , count =0 ; count < depth; count++) { +for (i =14 , count =1 ; count -1 < depth; count++) {char *part;uint8_t len;
Signature · 1 line
1.8.1
Luiz Augusto von Dentz
maintainerPATCH v2 2/5 AVRCP: Parse browsing and searching features bits
From: Luiz Augusto von Dentz <[email protected]>
This parses browsing and searching features bits and set the respective property.
---
v2: Check if folder is available to enable Browsable and Searchable properties
profiles/audio/avrcp.c | 18 +++++++++---- profiles/audio/player.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++- profiles/audio/player.h | 2 ++ 3 files changed, 85 insertions(+), 6 deletions(-)
profiles/audio/avrcp.c +13 -5
@@ -1976,6 +1976,18 @@ static void avrcp_set_browsed_player(struct avrcp *session, avrcp_set_browsed_player_rsp, session); } +static void avrcp_player_parse_features (struct avrcp_player *player, +uint8_t *features) +{ +struct media_player *mp = player->user_data; + +if (features[7 ] &0x08 ) +media_player_set_browsable (mp, true); + +if (features[7 ] &0x10 ) +media_player_set_searchable (mp, true); +} +static void avrcp_parse_media_player_item (struct avrcp *session,uint8_t *operands,uint16_t len) {
@@ -1984,7 +1996,6 @@ static void avrcp_parse_media_player_item(struct avrcp *session,uint16_t id;uint32_t subtype;const char *curval, *strval; -uint64_t features[2 ];char name[255 ];if (len <28 )
@@ -2009,10 +2020,7 @@ static void avrcp_parse_media_player_item(struct avrcp *session,avrcp_get_play_status (session); } - features[0 ] =bt_get_be64 (&operands[8 ]); - features[1 ] =bt_get_be64 (&operands[16 ]); - -media_player_set_features (mp, features); +avrcp_player_parse_features (player, &operands[8 ]);if (operands[26 ] !=0 ) {memcpy (name, &operands[27 ], operands[26 ]);
profiles/audio/player.c +70 -1
101 lines not on this page · raw message
profiles/audio/player.h +2 -0
@@ -51,6 +51,8 @@ void media_player_set_type(struct media_player *mp, const char *type);void media_player_set_subtype (struct media_player *mp,const char *subtype);void media_player_set_features (struct media_player *mp,uint64_t *features);void media_player_set_name (struct media_player *mp,const char *name); +void media_player_set_browsable (struct media_player *mp,bool enabled); +void media_player_set_searchable (struct media_player *mp,bool enabled);void media_player_set_folder (struct media_player *mp,const char *path,uint32_t items);
Signature · 1 line
1.8.1
Luiz Augusto von Dentz
maintainerPATCH v2 3/5 media-api: Fix referencing to MediaLibrary instead of MediaFolder
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
MediaLibrary was replaced by MediaFolder so doesn't exist anymore.
--- doc/media-api.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
doc/media-api.txt +2 -2
@@ -233,7 +233,7 @@ Properties string Equalizer [readwrite] boolean Browsable [readonly] If present indicates the player can be browsed using - MediaLibrary interface. + MediaFolder interface. Possible values:
@@ -248,7 +248,7 @@ Properties string Equalizer [readwrite] boolean Searchable [readonly] If present indicates the player can be searched using - MediaLibrary interface. + MediaFolder interface. Possible values:
Signature · 1 line
1.8.1
Luiz Augusto von Dentz
maintainerPATCH v2 4/5 AVRCP: Move features to avrcp.c
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
avrcp.c should be responsible for specifics of AVRCP not player.c which is more high level abstraction.
--- profiles/audio/avrcp.c | 4 ++++ profiles/audio/player.c | 8 -------- profiles/audio/player.h | 1 - 3 files changed, 4 insertions(+), 9 deletions(-)
profiles/audio/avrcp.c +4 -0
@@ -180,6 +180,7 @@ struct avrcp_player {GSList *sessions;uint16_t id;uint16_t uid_counter; +uint8_t *features;struct avrcp_player_cb *cb;void *user_data;
@@ -1981,6 +1982,8 @@ static void avrcp_player_parse_features(struct avrcp_player *player, {struct media_player *mp = player->user_data; + player->features =g_memdup (features,16 ); +if (features[7 ] &0x08 )media_player_set_browsable (mp, true);
@@ -2553,6 +2556,7 @@ static void player_destroy(gpointer data) player->destroy (player->user_data);g_slist_free (player->sessions); +g_free (player->features);g_free (player); }
profiles/audio/player.c +0 -8
@@ -69,7 +69,6 @@ struct media_player {char *subtype;/* Player subtype */ bool browsable;/* Player browsing feature */ bool searchable;/* Player searching feature */ -uint8_t *features;/* Player features */ struct media_folder *folder;/* Player currenct folder */ char *path;/* Player object path */ GHashTable *settings;/* Player settings */
@@ -939,13 +938,6 @@ void media_player_set_folder(struct media_player *mp, const char *path, } } -void media_player_set_features (struct media_player *mp,uint64_t *features) -{ -DBG ("0x%016" PRIx64"%016" PRIx64, features[0 ], features[1 ]); - -memcpy (features, mp->features,sizeof (mp->features)); -} -void media_player_set_callbacks (struct media_player *mp,const struct media_player_callback *cbs,void *user_data)
profiles/audio/player.h +0 -1
@@ -49,7 +49,6 @@ void media_player_set_metadata(struct media_player *mp, const char *key, void *data, size_t len);void media_player_set_type (struct media_player *mp,const char *type);void media_player_set_subtype (struct media_player *mp,const char *subtype); -void media_player_set_features (struct media_player *mp,uint64_t *features);void media_player_set_name (struct media_player *mp,const char *name);void media_player_set_browsable (struct media_player *mp,bool enabled);void media_player_set_searchable (struct media_player *mp,bool enabled);
Signature · 1 line
1.8.1
Luiz Augusto von Dentz
maintainerPATCH v2 5/5 AVRCP: Create folders for /Filesystem and /NowPlaying
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
If browsing is supported create objects representing /Filesystem and /NowPlaying, these object implement MediaItem interface and can be passed to ChangeFolder to change the scope.
--- profiles/audio/avrcp.c | 7 +- profiles/audio/player.c | 232 ++++++++++++++++++++++++++++++++++++++++++------ profiles/audio/player.h | 2 + 3 files changed, 215 insertions(+), 26 deletions(-)
profiles/audio/avrcp.c +6 -1
@@ -1984,11 +1984,16 @@ static void avrcp_player_parse_features(struct avrcp_player *player, player->features =g_memdup (features,16 ); -if (features[7 ] &0x08 ) +if (features[7 ] &0x08 ) {media_player_set_browsable (mp, true); +media_player_create_folder (mp,"/Filesystem" ); + }if (features[7 ] &0x10 )media_player_set_searchable (mp, true); + +if (features[8 ] &0x02 ) +media_player_create_folder (mp,"/NowPlaying" ); } static void avrcp_parse_media_player_item(struct avrcp *session,
profiles/audio/player.c +207 -25
313 lines not on this page · raw message
profiles/audio/player.h +2 -0
@@ -55,6 +55,8 @@ void media_player_set_searchable(struct media_player *mp, bool enabled);void media_player_set_folder (struct media_player *mp,const char *path,uint32_t items); +int media_player_create_folder (struct media_player *mp,const char *path); +void media_player_set_callbacks (struct media_player *mp,const struct media_player_callback *cbs,void *user_data);
Signature · 1 line
1.8.1