AVRCP Fixes
Luiz Augusto von Dentz
maintainerv3 cover AVRCP Fixes
From: Luiz Augusto von Dentz <[email protected]>
This set fixes some bugs with iOS and WP8 stacks, excessive changes on the metadata causing duplicate signals and some missing signals when properties changes.
v2: Rework MediaItem Type to be clear about folder items
v3: Add defines for item types an folder types
Luiz Augusto von Dentz (10):
player: Fix property Device type
media: Rework MediaItem Type property
player: Add defines for item types and folder types
player: Add Playlist property
player: Fix not emitting PropertiesChanged for Browsable and
Searchable
AVRCP: Fix changing track metadata too many times
player: Only emit PropertiesChanged for Position if track exists
player: Only expose Track property if there is metadata
AVRCP: Add support to UIDs changed event for CT role
AVRCP: Fix storing wrong UID counter
doc/media-api.txt | 51 +++++++++---- profiles/audio/avrcp.c | 29 +++++-- profiles/audio/avrcp.h | 1 + profiles/audio/player.c | 195 ++++++++++++++++++++++++++++++++++++++++++------ profiles/audio/player.h | 18 ++++- 5 files changed, 251 insertions(+), 43 deletions(-)
Signature · 1 line
1.8.1.2
Luiz Augusto von Dentz
maintainerPATCH v3 1/10 player: Fix property Device type
From: Luiz Augusto von Dentz <[email protected]>
Device property should be an objecy path not a string.
--- profiles/audio/player.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
profiles/audio/player.c +3 -2
@@ -290,7 +290,8 @@ static gboolean get_device(const GDBusPropertyTable *property, {struct media_player *mp = data; -dbus_message_iter_append_basic (iter,DBUS_TYPE_STRING , &mp->device); +dbus_message_iter_append_basic (iter,DBUS_TYPE_OBJECT_PATH , + &mp->device);return TRUE; }
@@ -570,7 +571,7 @@ static const GDBusPropertyTable media_player_properties[] = { G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, {"Track" ,"a{sv}" , get_track,NULL ,NULL , G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, - { "Device", "s", get_device, NULL, NULL, + { "Device", "o", get_device, NULL, NULL, G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, { "Browsable", "b", get_browsable, NULL, browsable_exists, G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
Signature · 1 line
1.8.1.2
Luiz Augusto von Dentz
maintainerPATCH v3 2/10 media: Rework MediaItem Type property
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
Type now can assume the value "folder" so it is no longer necessary to have Folder property, FolderType in introduced to provide the folder type that before was on the Type itself.
In addition to this add proper documentation what properties are optional and under what condition they are available.
--- doc/media-api.txt | 47 ++++++++++++++++++++++----------- profiles/audio/avrcp.c | 4 +-- profiles/audio/player.c | 69 +++++++++++++++++++++++++++++++++++++++---------- profiles/audio/player.h | 3 ++- 4 files changed, 91 insertions(+), 32 deletions(-)
doc/media-api.txt +32 -15
@@ -352,51 +352,68 @@ Properties string Name [readonly] Item displayable name - boolean Folder [readonly] - - Indicates whether the item is a folder - string Type [readonly] Item type - Possible values: + Possible values: "video", "audio", "folder" + + string FolderType [readonly, optional] - Folder: "Mixed", "Titles", "Albums", "Artists" - Other Items: "Video", "Audio" + Folder type. - boolean Playable [readonly] + Possible values: "mixed", "titles", "albums", "artists" + + Available if property Type is "Folder" + + boolean Playable [readonly, optional] Indicates if the item can be played - string Title: + Available if property Type is "folder" + + string Title [readonly, optional] Item title name - string Artist: + Available if property Type is "audio" or "video" + + string Artist [readonly, optional] Item artist name - string Album: + Available if property Type is "audio" or "video" + + string Album [readonly, optional] Item album name - string Genre: + Available if property Type is "audio" or "video" + + string Genre [readonly, optional] Item genre name - uint32 NumberOfTracks: + Available if property Type is "audio" or "video" + + uint32 NumberOfTracks [readonly, optional] Item album number of tracks in total - uint32 Number: + Available if property Type is "audio" or "video" + + uint32 Number [readonly, optional] Item album number - uint32 Duration: + Available if property Type is "audio" or "video" + + uint32 Duration [readonly, optional] Item duration in milliseconds + Available if property Type is "audio" or "video" + MediaEndpoint1 hierarchy ========================
profiles/audio/avrcp.c +2 -2
@@ -2035,14 +2035,14 @@ static void avrcp_player_parse_features(struct avrcp_player *player,if (features[7 ] &0x08 ) {media_player_set_browsable (mp, true); -media_player_create_folder (mp,"/Filesystem" ); +media_player_create_folder (mp,"/Filesystem" ,"mixed" ); }if (features[7 ] &0x10 )media_player_set_searchable (mp, true);if (features[8 ] &0x02 ) -media_player_create_folder (mp,"/NowPlaying" ); +media_player_create_folder (mp,"/NowPlaying" ,"mixed" ); } static void avrcp_parse_media_player_item(struct avrcp *session,
profiles/audio/player.c +55 -14
132 lines not on this page · raw message
profiles/audio/player.h +2 -1
@@ -55,7 +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); +int media_player_create_folder (struct media_player *mp,const char *name, +const char *type); void media_player_set_callbacks(struct media_player *mp, const struct media_player_callback *cbs,
Signature · 1 line
1.8.1.2
Luiz Augusto von Dentz
maintainerPATCH v3 3/10 player: Add defines for item types and folder types
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This avoid having to allocate memory just to store string representation of these types.
--- profiles/audio/avrcp.c | 6 ++-- profiles/audio/player.c | 81 ++++++++++++++++++++++++++++++++++++++----------- profiles/audio/player.h | 16 +++++++++- 3 files changed, 82 insertions(+), 21 deletions(-)
profiles/audio/avrcp.c +4 -2
@@ -2035,14 +2035,16 @@ static void avrcp_player_parse_features(struct avrcp_player *player,if (features[7 ] &0x08 ) {media_player_set_browsable (mp, true); -media_player_create_folder (mp,"/Filesystem" ,"mixed" ); +media_player_create_folder (mp,"/Filesystem" , +PLAYER_FOLDER_TYPE_MIXED ); }if (features[7 ] &0x10 )media_player_set_searchable (mp, true);if (features[8 ] &0x02 ) -media_player_create_folder (mp,"/NowPlaying" ,"mixed" ); +media_player_create_folder (mp,"/NowPlaying" , +PLAYER_FOLDER_TYPE_MIXED ); } static void avrcp_parse_media_player_item(struct avrcp *session,
profiles/audio/player.c +63 -18
158 lines not on this page · raw message
profiles/audio/player.h +15 -1
@@ -23,6 +23,20 @@* */ +#define PLAYER_ITEM_TYPE_AUDIO 0x00 +#define PLAYER_ITEM_TYPE_VIDEO 0x01 +#define PLAYER_ITEM_TYPE_FOLDER 0x02 +#define PLAYER_ITEM_TYPE_INVALID 0xff + +#define PLAYER_FOLDER_TYPE_MIXED 0x00 +#define PLAYER_FOLDER_TYPE_TITLES 0x01 +#define PLAYER_FOLDER_TYPE_ALBUMS 0x02 +#define PLAYER_FOLDER_TYPE_ARTISTS 0x03 +#define PLAYER_FOLDER_TYPE_GENRES 0x04 +#define PLAYER_FOLDER_TYPE_PLAYLISTS 0x05 +#define PLAYER_FOLDER_TYPE_YEARS 0x06 +#define PLAYER_FOLDER_TYPE_INVALID 0xff +struct media_player ;struct media_player_callback {
@@ -56,7 +70,7 @@ 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 *name, -const char *type); +uint8_t type); void media_player_set_callbacks(struct media_player *mp, const struct media_player_callback *cbs,
Signature · 1 line
1.8.1.2
Re: [PATCH BlueZ 03/10 v3] player: Add defines for item types and folder types
Hi Luiz,
Quoted 47 lines · Luiz Augusto von Dentz
(quoted diff) +35
-0+static const char *type_to_string(uint8_t type) +{ + switch (type) { + case PLAYER_ITEM_TYPE_AUDIO: + return "audio"; + case PLAYER_ITEM_TYPE_VIDEO: + return "video"; + case PLAYER_ITEM_TYPE_FOLDER: + return "folder"; + } + + return NULL; +} + +static const char *folder_type_to_string(uint8_t type) +{ + switch (type) { + case PLAYER_FOLDER_TYPE_MIXED: + return "mixed"; + case PLAYER_FOLDER_TYPE_TITLES: + return "titles"; + case PLAYER_FOLDER_TYPE_ALBUMS: + return "albums"; + case PLAYER_FOLDER_TYPE_ARTISTS: + return "artists"; + case PLAYER_FOLDER_TYPE_GENRES: + return "genres"; + case PLAYER_FOLDER_TYPE_PLAYLISTS: + return "playlists"; + case PLAYER_FOLDER_TYPE_YEARS: + return "years"; + } + + return NULL; +}profiles/audio/player.h +3
-0@@ -23,6 +23,20 @@* */ +#define PLAYER_ITEM_TYPE_AUDIO 0x00 +#define PLAYER_ITEM_TYPE_VIDEO 0x01 +#define PLAYER_ITEM_TYPE_FOLDER 0x02
profiles/audio/player.h line 38
Quoted 10 lines
profiles/audio/player.h +10
-0+#define PLAYER_ITEM_TYPE_INVALID 0xff + +#define PLAYER_FOLDER_TYPE_MIXED 0x00 +#define PLAYER_FOLDER_TYPE_TITLES 0x01 +#define PLAYER_FOLDER_TYPE_ALBUMS 0x02 +#define PLAYER_FOLDER_TYPE_ARTISTS 0x03 +#define PLAYER_FOLDER_TYPE_GENRES 0x04 +#define PLAYER_FOLDER_TYPE_PLAYLISTS 0x05 +#define PLAYER_FOLDER_TYPE_YEARS 0x06 +#define PLAYER_FOLDER_TYPE_INVALID 0xff
Why not enums? That'd let the compiler verify that all values are covered in switch statements and since this is an internal API and not a protocol detail there really isn't a need to use a fixed size integer (uint8_t).
Johan
Luiz Augusto von Dentz
maintainerRe: [PATCH BlueZ 03/10 v3] player: Add defines for item types and folder types
Hi Johan,
Quoted 57 lines · Johan Hedberg
Hi Luiz,
Quoted 54 lines · Luiz Augusto von Dentz
(quoted diff) +35
-0+static const char *type_to_string(uint8_t type) +{ + switch (type) { + case PLAYER_ITEM_TYPE_AUDIO: + return "audio"; + case PLAYER_ITEM_TYPE_VIDEO: + return "video"; + case PLAYER_ITEM_TYPE_FOLDER: + return "folder"; + } + + return NULL; +} + +static const char *folder_type_to_string(uint8_t type) +{ + switch (type) { + case PLAYER_FOLDER_TYPE_MIXED: + return "mixed"; + case PLAYER_FOLDER_TYPE_TITLES: + return "titles"; + case PLAYER_FOLDER_TYPE_ALBUMS: + return "albums"; + case PLAYER_FOLDER_TYPE_ARTISTS: + return "artists"; + case PLAYER_FOLDER_TYPE_GENRES: + return "genres"; + case PLAYER_FOLDER_TYPE_PLAYLISTS: + return "playlists"; + case PLAYER_FOLDER_TYPE_YEARS: + return "years"; + } + + return NULL; +}profiles/audio/player.h +10
-0@@ -23,6 +23,20 @@* */ +#define PLAYER_ITEM_TYPE_AUDIO 0x00 +#define PLAYER_ITEM_TYPE_VIDEO 0x01 +#define PLAYER_ITEM_TYPE_FOLDER 0x02 +#define PLAYER_ITEM_TYPE_INVALID 0xff + +#define PLAYER_FOLDER_TYPE_MIXED 0x00 +#define PLAYER_FOLDER_TYPE_TITLES 0x01 +#define PLAYER_FOLDER_TYPE_ALBUMS 0x02 +#define PLAYER_FOLDER_TYPE_ARTISTS 0x03 +#define PLAYER_FOLDER_TYPE_GENRES 0x04
Quoted 8 lines
profiles/audio/player.h line 38
Quoted 3 lines
profiles/audio/player.h +3
-0+#define PLAYER_FOLDER_TYPE_PLAYLISTS 0x05 +#define PLAYER_FOLDER_TYPE_YEARS 0x06 +#define PLAYER_FOLDER_TYPE_INVALID 0xffWhy not enums? That'd let the compiler verify that all values are covered in switch statements and since this is an internal API and not a protocol detail there really isn't a need to use a fixed size integer (
uint8_t).
Well I was expecting it should follow the AVRCP spec, otherwise we are always going to have to do 2 conversions: AVRCP <-> enum <-> string. You can argument that the dependency should be the other way around, player.c depending on includiong avrcp.h, which Im planning to address in a upcoming set so perhaps we should leave this using strings until I have this properly fixed?
Signature · 1 line
Luiz Augusto von Dentz
Re: [PATCH BlueZ 03/10 v3] player: Add defines for item types and folder types
Hi Luiz,
Quoted 67 lines · Luiz Augusto von Dentz
Quoted 57 lines · Johan Hedberg
Hi Luiz,
Quoted 54 lines · Luiz Augusto von Dentz
(quoted diff) +35
-0+static const char *type_to_string(uint8_t type) +{ + switch (type) { + case PLAYER_ITEM_TYPE_AUDIO: + return "audio"; + case PLAYER_ITEM_TYPE_VIDEO: + return "video"; + case PLAYER_ITEM_TYPE_FOLDER: + return "folder"; + } + + return NULL; +} + +static const char *folder_type_to_string(uint8_t type) +{ + switch (type) { + case PLAYER_FOLDER_TYPE_MIXED: + return "mixed"; + case PLAYER_FOLDER_TYPE_TITLES: + return "titles"; + case PLAYER_FOLDER_TYPE_ALBUMS: + return "albums"; + case PLAYER_FOLDER_TYPE_ARTISTS: + return "artists"; + case PLAYER_FOLDER_TYPE_GENRES: + return "genres"; + case PLAYER_FOLDER_TYPE_PLAYLISTS: + return "playlists"; + case PLAYER_FOLDER_TYPE_YEARS: + return "years"; + } + + return NULL; +}profiles/audio/player.h +10
-0@@ -23,6 +23,20 @@* */ +#define PLAYER_ITEM_TYPE_AUDIO 0x00 +#define PLAYER_ITEM_TYPE_VIDEO 0x01 +#define PLAYER_ITEM_TYPE_FOLDER 0x02 +#define PLAYER_ITEM_TYPE_INVALID 0xff + +#define PLAYER_FOLDER_TYPE_MIXED 0x00 +#define PLAYER_FOLDER_TYPE_TITLES 0x01 +#define PLAYER_FOLDER_TYPE_ALBUMS 0x02 +#define PLAYER_FOLDER_TYPE_ARTISTS 0x03 +#define PLAYER_FOLDER_TYPE_GENRES 0x04Quoted 8 lines
profiles/audio/player.h line 38
Quoted 3 lines
profiles/audio/player.h +3
-0+#define PLAYER_FOLDER_TYPE_PLAYLISTS 0x05 +#define PLAYER_FOLDER_TYPE_YEARS 0x06 +#define PLAYER_FOLDER_TYPE_INVALID 0xffWhy not enums? That'd let the compiler verify that all values are covered in switch statements and since this is an internal API and not a protocol detail there really isn't a need to use a fixed size integer (
uint8_t).
Quoted 2 lines
Well I was expecting it should follow the AVRCP spec, otherwise we are always going to have to do 2 conversions: AVRCP <-> enum <-> string.
There is no AVRCP correspondence at least for the item type where you've molded two protocol concepts together into one value. Also, using an enum doesn't mean that you can't use protocol values.
Johan
Luiz Augusto von Dentz
maintainerPATCH v3 4/10 player: Add Playlist property
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
Playlist property refer to the folder where the list of items being played can be found.
--- doc/media-api.txt | 4 ++++ profiles/audio/avrcp.c | 4 +++- profiles/audio/player.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- profiles/audio/player.h | 1 + 4 files changed, 53 insertions(+), 2 deletions(-)
doc/media-api.txt +4 -0
@@ -259,6 +259,10 @@ Properties string Equalizer [readwrite] by using MediaLibrary interface but it might interfere in the playback of other players. + object Playlist + + Playlist object path. + MediaFolder1 hierarchy ======================
profiles/audio/avrcp.c +3 -1
@@ -2042,9 +2042,11 @@ static void avrcp_player_parse_features(struct avrcp_player *player,if (features[7 ] &0x10 )media_player_set_searchable (mp, true); -if (features[8 ] &0x02 ) +if (features[8 ] &0x02 ) {media_player_create_folder (mp,"/NowPlaying" ,PLAYER_FOLDER_TYPE_MIXED ); +media_player_set_playlist (mp,"/NowPlaying" ); + } } static void avrcp_parse_media_player_item(struct avrcp *session,
profiles/audio/player.c +45 -1
70 lines not on this page · raw message
profiles/audio/player.h +1 -0
@@ -68,6 +68,7 @@ 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); +void media_player_set_playlist (struct media_player *mp,const char *name);int media_player_create_folder (struct media_player *mp,const char *name,uint8_t type);
Signature · 1 line
1.8.1.2
Luiz Augusto von Dentz
maintainerPATCH v3 5/10 player: Fix not emitting PropertiesChanged for Browsable and Searchable
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
Browsable and Searchable should emit PropertiesChanged when their values changes.
--- profiles/audio/player.c | 8 ++++++++ 1 file changed, 8 insertions(+)
profiles/audio/player.c +8 -0
@@ -959,6 +959,10 @@ void media_player_set_browsable(struct media_player *mp, bool enabled)DBG ("%s" , enabled ?"true" :"false" ); mp->browsable = enabled; + +g_dbus_emit_property_changed (btd_get_dbus_connection (), + mp->path,MEDIA_PLAYER_INTERFACE , +"Browsable" ); }void media_player_set_searchable (struct media_player *mp,bool enabled)
@@ -966,6 +970,10 @@ void media_player_set_searchable(struct media_player *mp, bool enabled)DBG ("%s" , enabled ?"true" :"false" ); mp->searchable = enabled; + +g_dbus_emit_property_changed (btd_get_dbus_connection (), + mp->path,MEDIA_PLAYER_INTERFACE , +"Searchable" ); } static void media_player_set_folder_item(struct media_player *mp,
Signature · 1 line
1.8.1.2
Luiz Augusto von Dentz
maintainerPATCH v3 6/10 AVRCP: Fix changing track metadata too many times
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
Certain stacks may respond to GetPlayStatus before GetItemAttributes (e.g iOS 6), which may cause Track to be changed due to duration being different.
To fix this the code now only attempt to do GetPlayStatus once GetItemAttributes completes, in addition to this do not require a exact match of the duration because they can be different as can be observed bellow:
Quoted 1 line
L2CAP(d): cid
0x0044len 141 ctrl0x0c16fcs0xa5ad[psm 27]
I-frame: Unsegmented TxSeq 11 ReqSeq 12
AVCTP Browsing: Response : pt 0x00 transaction 11 pid 0x110e
AVRCP: GetItemAttributes: len 0x0083
...
AttributeID: 0x00000007 (Track duration)
CharsetID: 0x006a (UTF-8)
AttributeLength: 0x0006 (6)
AttributeValue: 222641...
Quoted 1 line
L2CAP(d): cid
0x0043len 22 [psm 23]
AVCTP Control: Response : pt 0x00 transaction 2 pid 0x110e
AV/C: Stable: address 0x48 opcode 0x00
Subunit: Panel
Opcode: Vendor Dependent
Company ID: 0x001958
AVRCP: GetPlayStatus: pt Single len 0x0009
SongLength: 0x00036597 (222615 miliseconds)
SongPosition: 0x00000000 (0 miliconds)
PlayStatus: 0x02 (PAUSED)
---
profiles/audio/avrcp.c | 6 ++++--
profiles/audio/player.c | 11 +++++++----
2 files changed, 11 insertions(+), 6 deletions(-)profiles/audio/avrcp.c +4 -2
@@ -1844,6 +1844,8 @@ static gboolean avrcp_get_element_attributes_rsp(struct avctp *conn,avrcp_parse_attribute_list (player, &pdu->params[1 ], count); +avrcp_get_play_status (session); +return FALSE; }
@@ -2006,6 +2008,8 @@ static gboolean avrcp_get_item_attributes_rsp(struct avctp *conn,avrcp_parse_attribute_list (player, &pdu->params[2 ], count); +avrcp_get_play_status (session); +return FALSE; }
@@ -2182,8 +2186,6 @@ static void avrcp_track_changed(struct avrcp *session,avrcp_get_item_attributes (session, uid); }else avrcp_get_element_attributes (session); - -avrcp_get_play_status (session); } static void avrcp_setting_changed(struct avrcp *session,
profiles/audio/player.c +7 -4
@@ -792,13 +792,16 @@ void media_player_set_duration(struct media_player *mp, uint32_t duration)DBG ("%u" , duration); - value =g_strdup_printf ("%u" , duration); +/* Only update duration if track exists */ +if (g_hash_table_size (mp->track) ==0 ) +return ; +/* Ignore if duration is already set */ curval =g_hash_table_lookup (mp->track,"Duration" ); -if (g_strcmp0 (curval, value) ==0 ) { -g_free (value); +if (curval !=NULL )return ; - } + + value =g_strdup_printf ("%u" , duration);g_hash_table_replace (mp->track,g_strdup ("Duration" ), value);
Signature · 1 line
1.8.1.2
Luiz Augusto von Dentz
maintainerPATCH v3 7/10 player: Only emit PropertiesChanged for Position if track exists
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
--- profiles/audio/player.c | 4 ++++ 1 file changed, 4 insertions(+)
profiles/audio/player.c +4 -0
@@ -814,6 +814,10 @@ void media_player_set_position(struct media_player *mp, uint32_t position) {DBG ("%u" , position); +/* Only update duration if track exists */ +if (g_hash_table_size (mp->track) ==0 ) +return ; + mp->position = position;g_timer_start (mp->progress);
Signature · 1 line
1.8.1.2
Luiz Augusto von Dentz
maintainerPATCH v3 8/10 player: Only expose Track property if there is metadata
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
If no metadata is set there is no point in exposing it.
--- profiles/audio/player.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
profiles/audio/player.c +8 -1
@@ -267,6 +267,13 @@ static void set_setting(const GDBusPropertyTable *property,player_set_setting (mp, id, property->name, value); } +static gboolean track_exists (const GDBusPropertyTable *property,void *data) +{ +struct media_player *mp = data; + +return g_hash_table_size (mp->track) !=0 ; +} +static gboolean get_track (const GDBusPropertyTable *property,DBusMessageIter *iter,void *data) {
@@ -594,7 +601,7 @@ static const GDBusPropertyTable media_player_properties[] = { G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, {"Scan" ,"s" , get_setting, set_setting, setting_exists, G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, - { "Track", "a{sv}", get_track, NULL, NULL, + { "Track", "a{sv}", get_track, NULL, track_exists, G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, { "Device", "o", get_device, NULL, NULL, G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
Signature · 1 line
1.8.1.2
Luiz Augusto von Dentz
maintainerPATCH v3 9/10 AVRCP: Add support to UIDs changed event for CT role
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This adds support for registering to UIDs changed event if supported by TG.
--- profiles/audio/avrcp.c | 11 +++++++++++ profiles/audio/avrcp.h | 1 + 2 files changed, 12 insertions(+)
profiles/audio/avrcp.c +11 -0
@@ -2226,6 +2226,13 @@ static void avrcp_addressed_player_changed(struct avrcp *session,avrcp_get_media_player_list (session); } +static void avrcp_uids_changed (struct avrcp *session,struct avrcp_header *pdu) +{ +struct avrcp_player *player = session->player; + + player->uid_counter =bt_get_be16 (&pdu->params[1 ]); +} + static gboolean avrcp_handle_event(struct avctp *conn, uint8_t code, uint8_t subunit, uint8_t *operands, size_t operand_count,
@@ -2262,6 +2269,9 @@ static gboolean avrcp_handle_event(struct avctp *conn,case AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED :avrcp_addressed_player_changed (session, pdu);break ; +case AVRCP_EVENT_UIDS_CHANGED : +avrcp_uids_changed (session, pdu); +break ; } session->registered_events |= (1 << event);
@@ -2443,6 +2453,7 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn,case AVRCP_EVENT_TRACK_CHANGED :case AVRCP_EVENT_SETTINGS_CHANGED :case AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED : +case AVRCP_EVENT_UIDS_CHANGED :avrcp_register_notification (session, event);break ; }
profiles/audio/avrcp.h +1 -0
@@ -75,6 +75,7 @@#define AVRCP_EVENT_TRACK_REACHED_START 0x04#define AVRCP_EVENT_SETTINGS_CHANGED 0x08#define AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED 0x0b +#define AVRCP_EVENT_UIDS_CHANGED 0x0c#define AVRCP_EVENT_VOLUME_CHANGED 0x0d#define AVRCP_EVENT_LAST AVRCP_EVENT_VOLUME_CHANGED
Signature · 1 line
1.8.1.2