Add BIP for AVRCP covert art OBEX client
Subsystems (2)
cover Add BIP for AVRCP covert art OBEX client
If AVRCP Target supports Cover Art download its SDP record contains an additional access protocol for OBEX with an LCAP PSM on which the OBEX client session should connect to, with the specific OBEX target header 7163DD54-4A7E-11E2-B47C-0050C2490048.
Once the OBEX session is connected, the AVRCP track metadata will contain an Image Handle which can be used to get the associated image using GetImageThumbnail or GetImage with one of the description property found with GetImageProperties.
Frédéric Danis (7):
obexd: Add PSM support to session create
player: Add OBEX PSM port for cover art support
player: Add image handle support property
obexd: Add BIP client for AVRCP cover art download.
obexd: Add GetImageProperties to bip-avrcp
obexd: Add GetImage to bip-avrcp
doc: Add description of org.bluez.obex.BipAvrcp
Makefile.am | 9 +- Makefile.obexd | 2 + doc/org.bluez.MediaPlayer.rst | 10 + doc/org.bluez.obex.BipAvrcp.rst | 72 +++ doc/org.bluez.obex.Client.rst | 5 + doc/org.bluez.obex.Session.rst | 5 + monitor/avctp.c | 3 + obexd/client/bip-avrcp.c | 421 +++++++++++++++++ obexd/client/bip-avrcp.h | 12 + obexd/client/bip-common.c | 769 ++++++++++++++++++++++++++++++++ obexd/client/bip-common.h | 25 ++ obexd/client/manager.c | 16 +- obexd/client/session.c | 27 +- obexd/client/session.h | 1 + obexd/client/transfer.c | 16 + obexd/client/transfer.h | 2 + profiles/audio/avrcp.c | 64 ++- profiles/audio/avrcp.h | 3 +- profiles/audio/player.c | 29 ++ profiles/audio/player.h | 1 + tools/parser/avrcp.c | 3 + 21 files changed, 1476 insertions(+), 19 deletions(-) create mode 100644 doc/org.bluez.obex.BipAvrcp.rst create mode 100644 obexd/client/bip-avrcp.c create mode 100644 obexd/client/bip-avrcp.h create mode 100644 obexd/client/bip-common.c create mode 100644 obexd/client/bip-common.h
Signature · 1 line
2.34.1
PATCH 1/7 obexd: Add PSM support to session create
An OBEX session can be connected to a RFCOMM channel or a L2CAP PSM.
--- doc/org.bluez.obex.Client.rst | 4 ++++ doc/org.bluez.obex.Session.rst | 5 +++++ obexd/client/manager.c | 14 ++++++++++---- obexd/client/session.c | 27 ++++++++++++++++++++++++--- obexd/client/session.h | 1 + 5 files changed, 44 insertions(+), 7 deletions(-)
doc/org.bluez.obex.Client.rst +4 -0
@@ -52,6 +52,10 @@ object CreateSession(string destination, dict args) Channel to be used. + :uint16 PSM: + + L2CAP PSM to be used. + Possible errors: :org.bluez.obex.Error.InvalidArguments:
doc/org.bluez.obex.Session.rst +5 -0
@@ -50,6 +50,11 @@ byte Channel [readonly] Bluetooth channel +uint16 PSM [readonly] +``````````````````````` + + Bluetooth L2CAP PSM + string Target [readonly] ````````````````````````
obexd/client/manager.c +10 -4
@@ -107,7 +107,8 @@ done: }static int parse_device_dict (DBusMessageIter *iter, -const char **source,const char **target,uint8_t *channel) +const char **source,const char **target,uint8_t *channel, +uint16_t *psm) {while (dbus_message_iter_get_arg_type (iter) ==DBUS_TYPE_DICT_ENTRY ) {DBusMessageIter entry, value;
@@ -130,6 +131,10 @@ static int parse_device_dict(DBusMessageIter *iter,if (g_str_equal (key,"Channel" ) == TRUE)dbus_message_iter_get_basic (&value, channel);break ; +case DBUS_TYPE_UINT16 : +if (g_str_equal (key,"PSM" ) == TRUE) +dbus_message_iter_get_basic (&value, psm); +break ; }dbus_message_iter_next (iter);
@@ -160,6 +165,7 @@ static DBusMessage *create_session(DBusConnection *connection,struct send_data *data;const char *source =NULL , *dest =NULL , *target =NULL ;uint8_t channel =0 ; +uint16_t psm =0 ;dbus_message_iter_init (message, &iter);if (dbus_message_iter_get_arg_type (&iter) !=DBUS_TYPE_STRING )
@@ -175,8 +181,8 @@ static DBusMessage *create_session(DBusConnection *connection,dbus_message_iter_recurse (&iter, &dict); -parse_device_dict (&dict, &source, &target, &channel); -if (dest ==NULL || target ==NULL ) +parse_device_dict (&dict, &source, &target, &channel, &psm); +if (dest ==NULL || target ==NULL || (channel && psm))return g_dbus_create_error (message,ERROR_INTERFACE ".InvalidArguments" ,NULL );
@@ -188,7 +194,7 @@ static DBusMessage *create_session(DBusConnection *connection, data->connection =dbus_connection_ref (connection); data->message =dbus_message_ref (message); - session =obc_session_create (source, dest, target, channel, + session =obc_session_create (source, dest, target, channel, psm,dbus_message_get_sender (message), create_callback, data);if (session !=NULL ) {
obexd/client/session.c +24 -3
@@ -88,6 +88,7 @@ struct obc_session {char *source;char *destination;uint8_t channel; +uint16_t psm;struct obc_transport *transport;struct obc_driver *driver;char *path;/* Session path */
@@ -471,6 +472,7 @@ static struct obc_session *session_find(const char *source,const char *destination, const char *service, uint8_t channel, + uint16_t psm, const char *owner) { GSList *l;
@@ -490,6 +492,9 @@ static struct obc_session *session_find(const char *source,if (channel && session->channel != channel)continue ; +if (psm && session->psm != psm) +continue ; +if (g_strcmp0 (owner, session->owner))continue ;
@@ -541,8 +546,9 @@ static int session_connect(struct obc_session *session, } session->id = transport->connect (session->source, session->destination, - driver->uuid, session->channel, - transport_func, callback); + driver->uuid, + session->channel ? session->channel : session->psm, + transport_func, callback);if (session->id ==0 ) {obc_session_unref (callback->session);g_free (callback);
@@ -558,6 +564,7 @@ struct obc_session *obc_session_create(const char *source,const char *destination, const char *service, uint8_t channel, + uint16_t psm, const char *owner, session_callback_t function, void *user_data)
@@ -570,7 +577,8 @@ struct obc_session *obc_session_create(const char *source,if (destination ==NULL )return NULL ; - session =session_find (source, destination, service, channel, owner); + session =session_find (source, destination, service, channel, psm, + owner);if (session !=NULL ) goto proceed;
@@ -598,6 +606,7 @@ struct obc_session *obc_session_create(const char *source, session->source =g_strdup (source); session->destination =g_strdup (destination); session->channel = channel; + session->psm = psm; session->queue =g_queue_new (); session->folder =g_strdup ("/" );
@@ -762,6 +771,17 @@ static gboolean get_channel(const GDBusPropertyTable *property,return TRUE; } +static gboolean get_psm (const GDBusPropertyTable *property, +DBusMessageIter *iter,void *data) +{ +struct obc_session *session = data; + +dbus_message_iter_append_basic (iter,DBUS_TYPE_UINT16 , + &session->psm); + +return TRUE; +} +static const GDBusMethodTable session_methods[] = { { GDBUS_ASYNC_METHOD("GetCapabilities", NULL, GDBUS_ARGS({ "capabilities", "s" }),
@@ -794,6 +814,7 @@ static const GDBusPropertyTable session_properties[] = { { "Source", "s", get_source, NULL, source_exists }, { "Destination", "s", get_destination }, { "Channel", "y", get_channel }, + { "PSM", "q", get_psm }, { "Target", "s", get_target, NULL, target_exists }, { } };
obexd/client/session.h +1 -0
@@ -22,6 +22,7 @@ struct obc_session *obc_session_create(const char *source,const char *destination, const char *service, uint8_t channel, + uint16_t psm, const char *owner, session_callback_t function, void *user_data);
Signature · 1 line
2.34.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=886831
---Test result---
Test Summary:
CheckPatch FAIL 4.67 seconds GitLint FAIL 2.43 seconds BuildEll PASS 24.63 seconds BluezMake FAIL 102.66 seconds MakeCheck FAIL 2010.18 seconds MakeDistcheck FAIL 65.90 seconds CheckValgrind FAIL 76.06 seconds CheckSmatch FAIL 190.07 seconds bluezmakeextell FAIL 72.02 seconds IncrementalBuild FAIL 7943.14 seconds ScanBuild FAIL 727.96 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,5/7] obexd: Add GetImageProperties to bip-avrcp
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #78:
[2] https://github.com/enkait/Basic-Imaging-Profile-in-obexd/blob/gsoc_final/plugins/bip_util.c
/github/workspace/src/src/13790901.patch total: 0 errors, 1 warnings, 895 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13790901.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,4/7] obexd: Add BIP client for AVRCP cover art download.
WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T3 Title has trailing punctuation (.): "[BlueZ,4/7] obexd: Add BIP client for AVRCP cover art download."
[BlueZ,5/7] obexd: Add GetImageProperties to bip-avrcp
WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
10: B1 Line exceeds max length (95>80): "[2] https://github.com/enkait/Basic-Imaging-Profile-in-obexd/blob/gsoc_final/plugins/bip_util.c"
##############################
Test: BluezMake - FAIL
Desc: Build BlueZ
Output:
tools/mgmt-tester.c: In function ‘main’:tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12725 | int main(int argc, char *argv[])
| ^~~~
obexd/client/bip-common.c: In function ‘parse_properties’:
obexd/client/bip-common.c:639:12: error: ‘EINVAL’ undeclared (first use in this function)
639 | *err = -EINVAL;
| ^~~~~~obexd/client/bip-common.c:639:12: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:9989: obexd/client/obexd-bip-common.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4685: all] Error 2
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:
unit/test-avdtp.c: In function ‘main’:unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
766 | int main(int argc, char *argv[])
| ^~~~
unit/test-avrcp.c: In function ‘main’:
unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
989 | int main(int argc, char *argv[])
| ^~~~
obexd/client/bip-common.c: In function ‘parse_properties’:
obexd/client/bip-common.c:639:12: error: ‘EINVAL’ undeclared (first use in this function)
639 | *err = -EINVAL;
| ^~~~~~obexd/client/bip-common.c:639:12: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:9989: obexd/client/obexd-bip-common.o] Error 1
make: *** [Makefile:12348: check] Error 2
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:
Package cups was not found in the pkg-config search path.
Perhaps you should add the directory containing `cups.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cups' found../../obexd/client/bip-common.c: In function ‘parse_properties’:../../obexd/client/bip-common.c:639:12: error: ‘EINVAL’ undeclared (first use in this function)
639 | *err = -EINVAL;
| ^~~~~~../../obexd/client/bip-common.c:639:12: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [Makefile:9989: obexd/client/obexd-bip-common.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:4685: all] Error 2
make: *** [Makefile:12269: distcheck] Error 1
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:
tools/mgmt-tester.c: In function ‘main’:tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12725 | int main(int argc, char *argv[])
| ^~~~
obexd/client/bip-common.c: In function ‘parse_properties’:
obexd/client/bip-common.c:639:12: error: ‘EINVAL’ undeclared (first use in this function)
639 | *err = -EINVAL;
| ^~~~~~obexd/client/bip-common.c:639:12: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:9989: obexd/client/obexd-bip-common.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:12348: check] Error 2
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:
src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%'tools/sco-tester.c: note: in included file:./lib/bluetooth.h:219:15: warning: array of flexible structures./lib/bluetooth.h:224:31: warning: array of flexible structurestools/bneptest.c:634:39: warning: unknown escape sequence: '\%'tools/seq2bseq.c:57:26: warning: Variable length array is used.tools/obex-client-tool.c: note: in included file (through /usr/include/readline/readline.h):/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' android/avctp.c:505:34: warning: Variable length array is used.android/avctp.c:556:34: warning: Variable length array is used.unit/test-avrcp.c:373:26: warning: Variable length array is used. unit/test-avrcp.c:398:26: warning: Variable length array is used. unit/test-avrcp.c:414:24: warning: Variable length array is used. android/avrcp-lib.c:1085:34: warning: Variable length array is used. android/avrcp-lib.c:1583:34: warning: Variable length array is used. android/avrcp-lib.c:1612:34: warning: Variable length array is used. android/avrcp-lib.c:1638:34: warning: Variable length array is used. obexd/client/bip-common.c: In function ‘parse_properties’:obexd/client/bip-common.c:639:12: error: ‘EINVAL’ undeclared (first use in this function)
639 | *err = -EINVAL;
| ^~~~~~obexd/client/bip-common.c:639:12: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:9989: obexd/client/obexd-bip-common.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4685: all] Error 2
##############################
Test: bluezmakeextell - FAIL
Desc: Build Bluez with External ELL
Output:
obexd/client/bip-common.c: In function ‘parse_properties’:obexd/client/bip-common.c:639:12: error: ‘EINVAL’ undeclared (first use in this function)
639 | *err = -EINVAL;
| ^~~~~~obexd/client/bip-common.c:639:12: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:9989: obexd/client/obexd-bip-common.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4685: all] Error 2
##############################
Test: IncrementalBuild - FAIL
Desc: Incremental build with the patches in the series
Output:
[BlueZ,5/7] obexd: Add GetImageProperties to bip-avrcp
tools/mgmt-tester.c: In function ‘main’:tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12725 | int main(int argc, char *argv[])
| ^~~~
unit/test-avdtp.c: In function ‘main’:
unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
766 | int main(int argc, char *argv[])
| ^~~~
unit/test-avrcp.c: In function ‘main’:
unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
989 | int main(int argc, char *argv[])
| ^~~~
obexd/client/bip-common.c: In function ‘parse_properties’:
obexd/client/bip-common.c:620:12: error: ‘EINVAL’ undeclared (first use in this function)
620 | *err = -EINVAL;
| ^~~~~~obexd/client/bip-common.c:620:12: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:9988: obexd/client/obexd-bip-common.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4684: all] Error 2
##############################
Test: ScanBuild - FAIL
Desc: Run Scan Build
Output:
src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed
gatt_db_unregister(op->client->db, op->db_id);
^~~~~~~~~~
src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed
discovery_op_complete(op, false, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:996:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1102:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1296:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1361:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1636:6: warning: Use of memory after it is freed
if (read_db_hash(op)) {
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1641:2: warning: Use of memory after it is freed
discover_all(op);
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2145:6: warning: Use of memory after it is freed
if (read_db_hash(op)) {
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2153:8: warning: Use of memory after it is freed
discovery_op_ref(op),
^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3242:2: warning: Use of memory after it is freed
complete_write_long_op(req, success, 0, false);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3264:2: warning: Use of memory after it is freed
request_unref(req);
^~~~~~~~~~~~~~~~~~
12 warnings generated.
src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed
gatt_db_unregister(op->client->db, op->db_id);
^~~~~~~~~~
src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed
discovery_op_complete(op, false, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:996:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1102:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1296:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1361:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1636:6: warning: Use of memory after it is freed
if (read_db_hash(op)) {
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1641:2: warning: Use of memory after it is freed
discover_all(op);
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2145:6: warning: Use of memory after it is freed
if (read_db_hash(op)) {
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2153:8: warning: Use of memory after it is freed
discovery_op_ref(op),
^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3242:2: warning: Use of memory after it is freed
complete_write_long_op(req, success, 0, false);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3264:2: warning: Use of memory after it is freed
request_unref(req);
^~~~~~~~~~~~~~~~~~
12 warnings generated.
tools/hciattach.c:816:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 10)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:864:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 4)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:886:8: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 10)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:908:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 4)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:929:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 4)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:973:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 6)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 warnings generated.
src/oui.c:50:2: warning: Value stored to 'hwdb' is never read
hwdb = udev_hwdb_unref(hwdb);
^ ~~~~~~~~~~~~~~~~~~~~~
src/oui.c:53:2: warning: Value stored to 'udev' is never read
udev = udev_unref(udev);
^ ~~~~~~~~~~~~~~~~
2 warnings generated.
tools/hcidump.c:180:9: warning: Potential leak of memory pointed to by 'dp'
if (fds[i].fd == sock)
^~~
tools/hcidump.c:248:17: warning: Assigned value is garbage or undefined
dh->ts_sec = htobl(frm.ts.tv_sec);
^ ~~~~~~~~~~~~~~~~~~~~
tools/hcidump.c:326:9: warning: 1st function call argument is an uninitialized value
if (be32toh(dp.flags) & 0x02) {
^~~~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
# define be32toh(x) __bswap_32 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:341:20: warning: 1st function call argument is an uninitialized value
frm.data_len = be32toh(dp.len);
^~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
# define be32toh(x) __bswap_32 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:346:14: warning: 1st function call argument is an uninitialized value
opcode = be32toh(dp.flags) & 0xffff;
^~~~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
# define be32toh(x) __bswap_32 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:384:17: warning: Assigned value is garbage or undefined
frm.data_len = btohs(dh.len);
^ ~~~~~~~~~~~~~
tools/hcidump.c:394:11: warning: Assigned value is garbage or undefined
frm.len = frm.data_len;
^ ~~~~~~~~~~~~
tools/hcidump.c:398:9: warning: 1st function call argument is an uninitialized value
ts = be64toh(ph.ts);
^~~~~~~~~~~~~~
/usr/include/endian.h:51:22: note: expanded from macro 'be64toh'
# define be64toh(x) __bswap_64 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:403:13: warning: 1st function call argument is an uninitialized value
frm.in = be32toh(dp.flags) & 0x01;
^~~~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
# define be32toh(x) __bswap_32 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:408:11: warning: Assigned value is garbage or undefined
frm.in = dh.in;
^ ~~~~~
tools/hcidump.c:437:7: warning: Null pointer passed to 1st parameter expecting 'nonnull'
fd = open(file, open_flags, 0644);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 warnings generated.
tools/rfcomm.c:234:3: warning: Value stored to 'i' is never read
i = execvp(cmdargv[0], cmdargv);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rfcomm.c:234:7: warning: Null pointer passed to 1st parameter expecting 'nonnull'
i = execvp(cmdargv[0], cmdargv);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rfcomm.c:354:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd'
if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rfcomm.c:497:14: warning: Assigned value is garbage or undefined
req.channel = raddr.rc_channel;
^ ~~~~~~~~~~~~~~~~
tools/rfcomm.c:515:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd'
if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 warnings generated.
src/sdp-xml.c:126:10: warning: Assigned value is garbage or undefined
buf[1] = data[i + 1];
^ ~~~~~~~~~~~
src/sdp-xml.c:300:11: warning: Assigned value is garbage or undefined
buf[1] = data[i + 1];
^ ~~~~~~~~~~~
src/sdp-xml.c:338:11: warning: Assigned value is garbage or undefined
buf[1] = data[i + 1];
^ ~~~~~~~~~~~
3 warnings generated.
tools/ciptool.c:350:7: warning: 5th function call argument is an uninitialized value
sk = do_connect(ctl, dev_id, &src, &dst, psm, (1 << CMTP_LOOPBACK));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
tools/sdptool.c:941:26: warning: Result of 'malloc' is converted to a pointer of type 'uint32_t', which is incompatible with sizeof operand type 'int'
uint32_t *value_int = malloc(sizeof(int));
~~~~~~~~~~ ^~~~~~ ~~~~~~~~~~~
tools/sdptool.c:980:4: warning: 1st function call argument is an uninitialized value
free(allocArray[i]);
^~~~~~~~~~~~~~~~~~~
tools/sdptool.c:3777:2: warning: Potential leak of memory pointed to by 'si.name'
return add_service(0, &si);
^~~~~~~~~~~~~~~~~~~~~~~~~~
tools/sdptool.c:4112:4: warning: Potential leak of memory pointed to by 'context.svc'
return -1;
^~~~~~~~~
4 warnings generated.
tools/avtest.c:225:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:235:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 4);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:244:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~tools/avtest.c:258:5: warning: Value stored to 'len' is never read
len = write(sk, buf,
^ ~~~~~~~~~~~~~~tools/avtest.c:265:5: warning: Value stored to 'len' is never read
len = write(sk, buf,
^ ~~~~~~~~~~~~~~tools/avtest.c:272:5: warning: Value stored to 'len' is never read
len = write(sk, buf,
^ ~~~~~~~~~~~~~~tools/avtest.c:279:5: warning: Value stored to 'len' is never read
len = write(sk, buf,
^ ~~~~~~~~~~~~~~tools/avtest.c:291:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 4);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:295:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:304:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:308:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:317:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:324:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:346:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 4);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:350:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:359:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:363:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:376:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 4);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:380:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:387:4: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:397:4: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:562:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:570:3: warning: Value stored to 'len' is never read
len = write(sk, buf, invalid ? 2 : 3);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/avtest.c:584:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 4 + sizeof(media_transport));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/avtest.c:597:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:607:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:619:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:634:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:646:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:655:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:662:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:698:2: warning: Value stored to 'len' is never read
len = write(sk, buf, AVCTP_HEADER_LENGTH + sizeof(play_pressed));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 warnings generated.
tools/btproxy.c:836:15: warning: Null pointer passed to 1st parameter expecting 'nonnull'
tcp_port = atoi(optarg);
^~~~~~~~~~~~
tools/btproxy.c:839:8: warning: Null pointer passed to 1st parameter expecting 'nonnull'
if (strlen(optarg) > 3 && !strncmp(optarg, "hci", 3))
^~~~~~~~~~~~~~
2 warnings generated.
tools/create-image.c:76:3: warning: Value stored to 'fd' is never read
fd = -1;
^ ~~
tools/create-image.c:84:3: warning: Value stored to 'fd' is never read
fd = -1;
^ ~~
tools/create-image.c:92:3: warning: Value stored to 'fd' is never read
fd = -1;
^ ~~
tools/create-image.c:105:2: warning: Value stored to 'fd' is never read
fd = -1;
^ ~~
4 warnings generated.
tools/btgatt-client.c:1824:2: warning: Value stored to 'argv' is never read
argv += optind;
^ ~~~~~~
1 warning generated.
tools/btgatt-server.c:1212:2: warning: Value stored to 'argv' is never read
argv -= optind;
^ ~~~~~~
1 warning generated.
tools/check-selftest.c:42:3: warning: Value stored to 'ptr' is never read
ptr = fgets(result, sizeof(result), fp);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
tools/gatt-service.c:294:2: warning: 2nd function call argument is an uninitialized value
chr_write(chr, value, len);
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
tools/obex-server-tool.c:133:13: warning: Null pointer passed to 1st parameter expecting 'nonnull'
data->fd = open(name, O_WRONLY | O_CREAT | O_NOCTTY, 0600);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/obex-server-tool.c:192:13: warning: Null pointer passed to 1st parameter expecting 'nonnull'
data->fd = open(name, O_RDONLY | O_NOCTTY, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
tools/btpclientctl.c:402:3: warning: Value stored to 'bit' is never read
bit = 0;
^ ~
tools/btpclientctl.c:1655:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull'
memcpy(cp->data, ad_data, ad_len);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
src/sdpd-request.c:211:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint16_t'
pElem = malloc(sizeof(uint16_t));
^~~~~~ ~~~~~~~~~~~~~~~~
src/sdpd-request.c:239:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint32_t'
pElem = malloc(sizeof(uint32_t));
^~~~~~ ~~~~~~~~~~~~~~~~
2 warnings generated.
android/avrcp-lib.c:1968:3: warning: 1st function call argument is an uninitialized value
g_free(text[i]);
^~~~~~~~~~~~~~~
1 warning generated.
profiles/health/hdp.c:644:3: warning: Use of memory after it is freed
hdp_tmp_dc_data_unref(dc_data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/health/hdp.c:800:19: warning: Use of memory after it is freed
path = g_strdup(chan->path);
^~~~~~~~~~
profiles/health/hdp.c:1779:6: warning: Use of memory after it is freed
hdp_tmp_dc_data_ref(hdp_conn),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/health/hdp.c:1836:30: warning: Use of memory after it is freed
reply = g_dbus_create_error(data->msg, ERROR_INTERFACE ".HealthError",
^~~~~~~~~
4 warnings generated.
profiles/health/hdp_util.c:1052:2: warning: Use of memory after it is freed
conn_data->func(conn_data->data, gerr);
^~~~~~~~~~~~~~~
1 warning generated.
attrib/gatt.c:970:2: warning: Potential leak of memory pointed to by 'long_write'
return prepare_write(long_write);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
src/sdpd-request.c:211:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint16_t'
pElem = malloc(sizeof(uint16_t));
^~~~~~ ~~~~~~~~~~~~~~~~
src/sdpd-request.c:239:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint32_t'
pElem = malloc(sizeof(uint32_t));
^~~~~~ ~~~~~~~~~~~~~~~~
2 warnings generated.
src/sdp-xml.c:126:10: warning: Assigned value is garbage or undefined
buf[1] = data[i + 1];
^ ~~~~~~~~~~~
src/sdp-xml.c:300:11: warning: Assigned value is garbage or undefined
buf[1] = data[i + 1];
^ ~~~~~~~~~~~
src/sdp-xml.c:338:11: warning: Assigned value is garbage or undefined
buf[1] = data[i + 1];
^ ~~~~~~~~~~~
3 warnings generated.
src/sdp-client.c:353:14: warning: Access to field 'cb' results in a dereference of a null pointer
(*ctxt)->cb = cb;
~~~~~~~~~~~~^~~~
1 warning generated.
src/gatt-database.c:1155:10: warning: Value stored to 'bits' during its initialization is never read
uint8_t bits[] = { BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING,
^~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
gobex/gobex-header.c:67:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull'
memcpy(to, from, count);
^~~~~~~~~~~~~~~~~~~~~~~1 warning generated.gobex/gobex-transfer.c:423:7: warning: Use of memory after it is freed
if (!g_slist_find(transfers, transfer))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.obexd/client/bip-common.c: In function ‘parse_properties’:obexd/client/bip-common.c:620:12: error: ‘EINVAL’ undeclared (first use in this function)
620 | *err = -EINVAL;
| ^~~~~~obexd/client/bip-common.c:620:12: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [Makefile:9988: obexd/client/obexd-bip-common.o] Error 1
make[1]: *** Waiting for unfinished jobs....obexd/client/bip-avrcp.c:111:3: warning: Value stored to 'reply' is never read
reply = g_dbus_create_error(message,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~obexd/client/bip-avrcp.c:133:9: warning: Access to field 'message' results in a dereference of a null pointer (loaded from variable 'err')
err->message);
^~~~~~~~~~~~obexd/client/bip-avrcp.c:154:3: warning: Value stored to 'reply' is never read
reply = g_dbus_create_error(message,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~obexd/client/bip-avrcp.c:173:9: warning: Access to field 'message' results in a dereference of a null pointer (loaded from variable 'err')
err->message);
^~~~~~~~~~~~4 warnings generated.
make: *** [Makefile:4684: all] Error 2
---
Regards,
Linux Bluetooth
PATCH 2/7 player: Add OBEX PSM port for cover art support
In reply to Frédéric DanisThis parse the AVRCP Target SDP record for the L2CAP PSM to use with the OBEX session to get the cover art.
--- doc/org.bluez.MediaPlayer.rst | 6 +++++ profiles/audio/avrcp.c | 51 +++++++++++++++++++++++++++++++---- profiles/audio/player.c | 29 ++++++++++++++++++++ profiles/audio/player.h | 1 + 4 files changed, 82 insertions(+), 5 deletions(-)
doc/org.bluez.MediaPlayer.rst +6 -0
@@ -313,3 +313,9 @@ object Playlist ``````````````` Playlist object path. + +uint16 ObexPort [readonly] +````````````````````````````` + + If present indicates the player can get cover art using BIP over OBEX + on this PSM port.
profiles/audio/avrcp.c +46 -5
100 lines not on this page · raw message
profiles/audio/player.c +29 -0
@@ -88,6 +88,7 @@ struct media_player {struct player_callback *cb;GSList *pending;GSList *folders; +uint16_t obex_port; };static void append_track (void *key,void *value,void *user_data)
@@ -437,6 +438,28 @@ static gboolean get_playlist(const GDBusPropertyTable *property,return TRUE; } +static gboolean obexport_exists (const GDBusPropertyTable *property, +void *data) +{ +struct media_player *mp = data; + +return mp->obex_port !=0 ; +} + +static gboolean get_obexport (const GDBusPropertyTable *property, +DBusMessageIter *iter,void *data) +{ +struct media_player *mp = data; + +if (mp->obex_port ==0 ) +return FALSE; + +dbus_message_iter_append_basic (iter,DBUS_TYPE_UINT16 , + &mp->obex_port); + +return TRUE; +} +static DBusMessage *media_player_play (DBusConnection *conn,DBusMessage *msg,void *data) {
@@ -778,6 +801,7 @@ static const GDBusPropertyTable media_player_properties[] = { { "Browsable", "b", get_browsable, NULL, browsable_exists }, { "Searchable", "b", get_searchable, NULL, searchable_exists }, { "Playlist", "o", get_playlist, NULL, playlist_exists }, + { "ObexPort", "q", get_obexport, NULL, obexport_exists }, { } };
@@ -1997,3 +2021,8 @@ struct media_item *media_player_set_playlist_item(struct media_player *mp,return item; } + +void media_player_set_obex_port (struct media_player *mp,uint16_t port) +{ + mp->obex_port = port; +}
profiles/audio/player.h +1 -0
@@ -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_set_obex_port (struct media_player *mp,uint16_t port); struct media_item *media_player_create_folder(struct media_player *mp, const char *name,
Signature · 1 line
2.34.1
Luiz Augusto von Dentz
maintainerRe: [PATCH BlueZ 2/7] player: Add OBEX PSM port for cover art support
Hi Frédéric,
Quoted 15 lines · Frédéric Danis
This parse the AVRCP Target SDP record for the L2CAP PSM to use with the OBEX session to get the cover art.
--- doc/org.bluez.MediaPlayer.rst | 6 +++++ profiles/audio/avrcp.c | 51 +++++++++++++++++++++++++++++++---- profiles/audio/player.c | 29 ++++++++++++++++++++ profiles/audio/player.h | 1 + 4 files changed, 82 insertions(+), 5 deletions(-)doc/org.bluez.MediaPlayer.rst +0
-0
doc/org.bluez.MediaPlayer.rst object Playlist · line 321
Quoted 9 lines
doc/org.bluez.MediaPlayer.rst +6
-0@@ -313,3 +313,9 @@ object Playlist ``````````````` Playlist object path. + +uint16 ObexPort [readonly] +````````````````````````````` + + If present indicates the player can get cover art using BIP over OBEX + on this PSM port.
Id pass this via as part of URL e.g. obex://<address>/handle:[port]
That said, like I mentioned in the other change, we could perhaps attempt to load it directly from bluetoothd since obexd registered its profile with it the daemon will know that BIP has been registered and we could allow bluetoothd to create sessions/transfer via that connection rather than using the session D-Bus, it is a little more work compared to doing bluetoothctl but then we don't have to reimplement as part of upper layers or force the system to run bluetoothctl which is more like a testing tool to validate our API's, etc.
Quoted 186 lines
profiles/audio/avrcp.c +46
-5@@ -118,8 +118,14 @@#define AVRCP_FEATURE_CATEGORY_2 0x0002#define AVRCP_FEATURE_CATEGORY_3 0x0004#define AVRCP_FEATURE_CATEGORY_4 0x0008 -#define AVRCP_FEATURE_PLAYER_SETTINGS 0x0010 -#define AVRCP_FEATURE_BROWSING 0x0040 +#define AVRCP_FEATURE_TG_PLAYER_SETTINGS 0x0010 +#define AVRCP_FEATURE_TG_GROUP_NAVIGATION 0x0020 +#define AVRCP_FEATURE_BROWSING 0x0040 +#define AVRCP_FEATURE_TG_MULTIPLE_PLAYER 0x0080 +#define AVRCP_FEATURE_TG_COVERT_ART 0x0100 +#define AVRCP_FEATURE_CT_GET_IMAGE_PROP 0x0080 +#define AVRCP_FEATURE_CT_GET_IMAGE 0x0100 +#define AVRCP_FEATURE_CT_GET_THUMBNAIL 0x0200#define AVRCP_BATTERY_STATUS_NORMAL 0#define AVRCP_BATTERY_STATUS_WARNING 1@@ -254,6 +260,7 @@ struct avrcp_data {struct avrcp_player *player;uint16_t version;int features; +uint16_t obex_port;GSList *players; };@@ -487,7 +494,7 @@ static sdp_record_t *avrcp_tg_record(bool browsing)AVRCP_FEATURE_CATEGORY_2 |AVRCP_FEATURE_CATEGORY_3 |AVRCP_FEATURE_CATEGORY_4 | - AVRCP_FEATURE_PLAYER_SETTINGS ); + AVRCP_FEATURE_TG_PLAYER_SETTINGS); record =sdp_record_alloc ();if (!record)@@ -3522,6 +3529,7 @@ static struct avrcp_player *create_ct_player(struct avrcp *session,return NULL ; } +media_player_set_obex_port (mp, session->controller->obex_port);media_player_set_callbacks (mp, &ct_cbs, player); player->user_data = mp; player->destroy = (GDestroyNotify ) media_player_destroy;@@ -4006,7 +4014,8 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn, uint8_t code,if (events == (1 <<AVRCP_EVENT_VOLUME_CHANGED ))return FALSE; -if ((session->controller->features &AVRCP_FEATURE_PLAYER_SETTINGS ) && +if ((session->controller->features & +AVRCP_FEATURE_TG_PLAYER_SETTINGS ) && !(events & (1 <<AVRCP_EVENT_SETTINGS_CHANGED )))avrcp_list_player_attributes (session);@@ -4075,8 +4084,9 @@ static struct avrcp_data *data_init(struct avrcp *session, const char *uuid) {struct avrcp_data *data;const sdp_record_t *rec; -sdp_list_t *list; +sdp_list_t *list, *protos;sdp_profile_desc_t *desc; +int port =0 ; data = g_new0(struct avrcp_data, 1);@@ -4092,6 +4102,35 @@ static struct avrcp_data *data_init(struct avrcp *session, const char *uuid)sdp_get_int_attr (rec,SDP_ATTR_SUPPORTED_FEATURES , &data->features);sdp_list_free (list, free); +if ((g_strcmp0 (uuid,AVRCP_TARGET_UUID ) !=0 ) || + !(data->features &AVRCP_FEATURE_TG_COVERT_ART ) || + (sdp_get_add_access_protos (rec, &protos) !=0 )) +return data; + +/* Get the PSM port from the Additional Protocol Descriptor list +* entry containing OBEX UUID +*/ +for (list = protos; list; list = list->next) { +sdp_list_t *p; + +for (p = list->data; p; p = p->next) { +sdp_data_t *seq = p->data; + +if ((sdp_uuid_to_proto (&seq->val.uuid) ==OBEX_UUID ) && +SDP_IS_UUID (seq->dtd)) { + port =sdp_get_proto_port (list,L2CAP_UUID ); + goto done; + } + } + } + +done: +if (port >0 ) + data->obex_port = port; + +sdp_list_foreach (protos, (sdp_list_func_t ) sdp_list_free,NULL ); +sdp_list_free (protos,NULL ); +return data; }@@ -4189,6 +4228,8 @@ static void controller_init(struct avrcp *session) session->controller = controller;DBG ("%p version 0x%04x" , controller, controller->version); +if (controller->obex_port) +DBG ("%p OBEX PSM 0x%04x" , controller, controller->obex_port); service =btd_device_get_service (session->dev,AVRCP_TARGET_UUID );btd_service_connecting_complete (service,0 );profiles/audio/player.c +29
-0@@ -88,6 +88,7 @@ struct media_player {struct player_callback *cb;GSList *pending;GSList *folders; +uint16_t obex_port; };static void append_track (void *key,void *value,void *user_data)@@ -437,6 +438,28 @@ static gboolean get_playlist(const GDBusPropertyTable *property,return TRUE; } +static gboolean obexport_exists (const GDBusPropertyTable *property, +void *data) +{ +struct media_player *mp = data; + +return mp->obex_port !=0 ; +} + +static gboolean get_obexport (const GDBusPropertyTable *property, +DBusMessageIter *iter,void *data) +{ +struct media_player *mp = data; + +if (mp->obex_port ==0 ) +return FALSE; + +dbus_message_iter_append_basic (iter,DBUS_TYPE_UINT16 , + &mp->obex_port); + +return TRUE; +} +static DBusMessage *media_player_play (DBusConnection *conn,DBusMessage *msg,void *data) {@@ -778,6 +801,7 @@ static const GDBusPropertyTable media_player_properties[] = { { "Browsable", "b", get_browsable, NULL, browsable_exists }, { "Searchable", "b", get_searchable, NULL, searchable_exists }, { "Playlist", "o", get_playlist, NULL, playlist_exists }, + { "ObexPort", "q", get_obexport, NULL, obexport_exists }, { } };@@ -1997,3 +2021,8 @@ struct media_item *media_player_set_playlist_item(struct media_player *mp,return item; } + +void media_player_set_obex_port (struct media_player *mp,uint16_t port) +{ + mp->obex_port = port; +}profiles/audio/player.h +1
-1@@ -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_set_obex_port (struct media_player *mp,uint16_t port); struct media_item *media_player_create_folder(struct media_player *mp, const char *name, --2.34.1
Signature · 1 line
Luiz Augusto von Dentz
Re: [PATCH BlueZ 2/7] player: Add OBEX PSM port for cover art support
Hi Luiz,
Quoted 29 lines · Luiz Augusto von Dentz
Hi Frédéric,
Quoted 14 lines · Frédéric Danis
This parse the AVRCP Target SDP record for the L2CAP PSM to use with the OBEX session to get the cover art.
--- doc/org.bluez.MediaPlayer.rst | 6 +++++ profiles/audio/avrcp.c | 51 +++++++++++++++++++++++++++++++---- profiles/audio/player.c | 29 ++++++++++++++++++++ profiles/audio/player.h | 1 + 4 files changed, 82 insertions(+), 5 deletions(-)doc/org.bluez.MediaPlayer.rst +0
-0doc/org.bluez.MediaPlayer.rst object Playlist · line 321
Quoted 9 lines
doc/org.bluez.MediaPlayer.rst +6
-0@@ -313,3 +313,9 @@ object Playlist ``````````````` Playlist object path. + +uint16 ObexPort [readonly] +````````````````````````````` + + If present indicates the player can get cover art using BIP over OBEX + on this PSM port.Id pass this via as part of URL e.g. obex://<address>/handle:[port]
Quoted 9 lines
That said, like I mentioned in the other change, we could perhaps attempt to load it directly from bluetoothd since obexd registered its profile with it the daemon will know that BIP has been registered and we could allow bluetoothd to create sessions/transfer via that connection rather than using the session D-Bus, it is a little more work compared to doing bluetoothctl but then we don't have to reimplement as part of upper layers or force the system to run bluetoothctl which is more like a testing tool to validate our API's, etc.
The image handle is available in the tack metadata only if the OBEX session is already connected. So the L2CAP PSM is used before we get any image handle reference.
I may replace ObexPort property by ObexUrl with obex://<address>:<port> string. Does it seems better?
Regarding the automatic load of the image, afaiu this will prevent the user application to select the format of the image.
The remote service may provide different formats of the image like thumbnail (200*200 JPEG), original format (whatever it is) or some other formats, e.g. 300*300 JPEG and 300*300 PNG.
Quoted 187 lines
profiles/audio/avrcp.c +0
-0Quoted 185 lines
index
752e55be3..61558e492100644profiles/audio/avrcp.c +46
-5@@ -118,8 +118,14 @@#define AVRCP_FEATURE_CATEGORY_2 0x0002#define AVRCP_FEATURE_CATEGORY_3 0x0004#define AVRCP_FEATURE_CATEGORY_4 0x0008 -#define AVRCP_FEATURE_PLAYER_SETTINGS 0x0010 -#define AVRCP_FEATURE_BROWSING 0x0040 +#define AVRCP_FEATURE_TG_PLAYER_SETTINGS 0x0010 +#define AVRCP_FEATURE_TG_GROUP_NAVIGATION 0x0020 +#define AVRCP_FEATURE_BROWSING 0x0040 +#define AVRCP_FEATURE_TG_MULTIPLE_PLAYER 0x0080 +#define AVRCP_FEATURE_TG_COVERT_ART 0x0100 +#define AVRCP_FEATURE_CT_GET_IMAGE_PROP 0x0080 +#define AVRCP_FEATURE_CT_GET_IMAGE 0x0100 +#define AVRCP_FEATURE_CT_GET_THUMBNAIL 0x0200#define AVRCP_BATTERY_STATUS_NORMAL 0#define AVRCP_BATTERY_STATUS_WARNING 1@@ -254,6 +260,7 @@ struct avrcp_data {struct avrcp_player *player;uint16_t version;int features; +uint16_t obex_port;GSList *players; };@@ -487,7 +494,7 @@ static sdp_record_t *avrcp_tg_record(bool browsing)AVRCP_FEATURE_CATEGORY_2 |AVRCP_FEATURE_CATEGORY_3 |AVRCP_FEATURE_CATEGORY_4 | - AVRCP_FEATURE_PLAYER_SETTINGS ); + AVRCP_FEATURE_TG_PLAYER_SETTINGS); record =sdp_record_alloc ();if (!record)@@ -3522,6 +3529,7 @@ static struct avrcp_player *create_ct_player(struct avrcp *session,return NULL ; } +media_player_set_obex_port (mp, session->controller->obex_port);media_player_set_callbacks (mp, &ct_cbs, player); player->user_data = mp; player->destroy = (GDestroyNotify ) media_player_destroy;@@ -4006,7 +4014,8 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn, uint8_t code,if (events == (1 <<AVRCP_EVENT_VOLUME_CHANGED ))return FALSE; -if ((session->controller->features &AVRCP_FEATURE_PLAYER_SETTINGS ) && +if ((session->controller->features & +AVRCP_FEATURE_TG_PLAYER_SETTINGS ) && !(events & (1 <<AVRCP_EVENT_SETTINGS_CHANGED )))avrcp_list_player_attributes (session);@@ -4075,8 +4084,9 @@ static struct avrcp_data *data_init(struct avrcp *session, const char *uuid) {struct avrcp_data *data;const sdp_record_t *rec; -sdp_list_t *list; +sdp_list_t *list, *protos;sdp_profile_desc_t *desc; +int port =0 ; data = g_new0(struct avrcp_data, 1);@@ -4092,6 +4102,35 @@ static struct avrcp_data *data_init(struct avrcp *session, const char *uuid)sdp_get_int_attr (rec,SDP_ATTR_SUPPORTED_FEATURES , &data->features);sdp_list_free (list, free); +if ((g_strcmp0 (uuid,AVRCP_TARGET_UUID ) !=0 ) || + !(data->features &AVRCP_FEATURE_TG_COVERT_ART ) || + (sdp_get_add_access_protos (rec, &protos) !=0 )) +return data; + +/* Get the PSM port from the Additional Protocol Descriptor list +* entry containing OBEX UUID +*/ +for (list = protos; list; list = list->next) { +sdp_list_t *p; + +for (p = list->data; p; p = p->next) { +sdp_data_t *seq = p->data; + +if ((sdp_uuid_to_proto (&seq->val.uuid) ==OBEX_UUID ) && +SDP_IS_UUID (seq->dtd)) { + port =sdp_get_proto_port (list,L2CAP_UUID ); + goto done; + } + } + } + +done: +if (port >0 ) + data->obex_port = port; + +sdp_list_foreach (protos, (sdp_list_func_t ) sdp_list_free,NULL ); +sdp_list_free (protos,NULL ); +return data; }@@ -4189,6 +4228,8 @@ static void controller_init(struct avrcp *session) session->controller = controller;DBG ("%p version 0x%04x" , controller, controller->version); +if (controller->obex_port) +DBG ("%p OBEX PSM 0x%04x" , controller, controller->obex_port); service =btd_device_get_service (session->dev,AVRCP_TARGET_UUID );btd_service_connecting_complete (service,0 );profiles/audio/player.c +29
-0@@ -88,6 +88,7 @@ struct media_player {struct player_callback *cb;GSList *pending;GSList *folders; +uint16_t obex_port; };static void append_track (void *key,void *value,void *user_data)@@ -437,6 +438,28 @@ static gboolean get_playlist(const GDBusPropertyTable *property,return TRUE; } +static gboolean obexport_exists (const GDBusPropertyTable *property, +void *data) +{ +struct media_player *mp = data; + +return mp->obex_port !=0 ; +} + +static gboolean get_obexport (const GDBusPropertyTable *property, +DBusMessageIter *iter,void *data) +{ +struct media_player *mp = data; + +if (mp->obex_port ==0 ) +return FALSE; + +dbus_message_iter_append_basic (iter,DBUS_TYPE_UINT16 , + &mp->obex_port); + +return TRUE; +} +static DBusMessage *media_player_play (DBusConnection *conn,DBusMessage *msg,void *data) {@@ -778,6 +801,7 @@ static const GDBusPropertyTable media_player_properties[] = { { "Browsable", "b", get_browsable, NULL, browsable_exists }, { "Searchable", "b", get_searchable, NULL, searchable_exists }, { "Playlist", "o", get_playlist, NULL, playlist_exists }, + { "ObexPort", "q", get_obexport, NULL, obexport_exists }, { } };@@ -1997,3 +2021,8 @@ struct media_item *media_player_set_playlist_item(struct media_player *mp,return item; } + +void media_player_set_obex_port (struct media_player *mp,uint16_t port) +{ + mp->obex_port = port; +}profiles/audio/player.h +1
-1@@ -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_set_obex_port (struct media_player *mp,uint16_t port); struct media_item *media_player_create_folder(struct media_player *mp, const char *name, --2.34.1
Signature · 6 lines
Frédéric Danis Senior Software Engineer Collabora Ltd. Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, United Kingdom Registered in England & Wales, no. 5513718
PATCH 3/7 player: Add image handle support property
In reply to Frédéric DanisThis is part of the metadata when the AVRCP target supports covert art download and a OBEX BIP session is connected.
The image handle references the cover art associated to the track, and is valid only during OBEX BIP session.
--- doc/org.bluez.MediaPlayer.rst | 4 ++++ monitor/avctp.c | 3 +++ profiles/audio/avrcp.c | 7 ++++++- profiles/audio/avrcp.h | 3 ++- tools/parser/avrcp.c | 3 +++ 5 files changed, 18 insertions(+), 2 deletions(-)
doc/org.bluez.MediaPlayer.rst +4 -0
@@ -237,6 +237,10 @@ dict Track [readonly] Track duration in milliseconds + :string ImgHandle: + + Track image handle + object Device [readonly] ````````````````````````
monitor/avctp.c +3 -0
@@ -156,6 +156,7 @@#define AVRCP_MEDIA_ATTRIBUTE_TOTAL 0x05#define AVRCP_MEDIA_ATTRIBUTE_GENRE 0x06#define AVRCP_MEDIA_ATTRIBUTE_DURATION 0x07 +#define AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE 0x08/* play status */ #define AVRCP_PLAY_STATUS_STOPPED 0x00
@@ -582,6 +583,8 @@ static const char *mediattr2str(uint32_t attr)return "Genre" ;case AVRCP_MEDIA_ATTRIBUTE_DURATION :return "Track duration" ; +case AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE : +return "Imaging handle" ;default :return "Reserved" ; }
profiles/audio/avrcp.c +6 -1
@@ -417,7 +417,8 @@ static sdp_record_t *avrcp_ct_record(bool browsing)uint16_t feat = (AVRCP_FEATURE_CATEGORY_1 |AVRCP_FEATURE_CATEGORY_2 |AVRCP_FEATURE_CATEGORY_3 | -AVRCP_FEATURE_CATEGORY_4 ); +AVRCP_FEATURE_CATEGORY_4 | +AVRCP_FEATURE_CT_GET_THUMBNAIL ); record =sdp_record_alloc ();if (!record)
@@ -883,6 +884,8 @@ static const char *metadata_to_str(uint32_t id)return "NumberOfTracks" ;case AVRCP_MEDIA_ATTRIBUTE_DURATION :return "Duration" ; +case AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE : +return "ImgHandle" ; }return NULL ;
@@ -1197,6 +1200,8 @@ static uint32_t str_to_metadata(const char *str)return AVRCP_MEDIA_ATTRIBUTE_N_TRACKS ; else if (strcasecmp(str, "Duration") == 0) return AVRCP_MEDIA_ATTRIBUTE_DURATION; + else if (strcasecmp(str, "ImgHandle") == 0) + return AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE;return 0 ; }
profiles/audio/avrcp.h +2 -1
@@ -46,7 +46,8 @@#define AVRCP_MEDIA_ATTRIBUTE_N_TRACKS 0x05#define AVRCP_MEDIA_ATTRIBUTE_GENRE 0x06#define AVRCP_MEDIA_ATTRIBUTE_DURATION 0x07 -#define AVRCP_MEDIA_ATTRIBUTE_LAST AVRCP_MEDIA_ATTRIBUTE_DURATION +#define AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE 0x08 +#define AVRCP_MEDIA_ATTRIBUTE_LAST AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE/* play status */ #define AVRCP_PLAY_STATUS_STOPPED 0x00
tools/parser/avrcp.c +3 -0
@@ -160,6 +160,7 @@#define AVRCP_MEDIA_ATTRIBUTE_TOTAL 0x5#define AVRCP_MEDIA_ATTRIBUTE_GENRE 0x6#define AVRCP_MEDIA_ATTRIBUTE_DURATION 0x7 +#define AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE 0x08/* play status */ #define AVRCP_PLAY_STATUS_STOPPED 0x00
@@ -933,6 +934,8 @@ static const char *mediattr2str(uint32_t attr)return "Genre" ;case AVRCP_MEDIA_ATTRIBUTE_DURATION :return "Track duration" ; +case AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE : +return "Imaging handle" ;default :return "Reserved" ; }
Signature · 1 line
2.34.1
Luiz Augusto von Dentz
maintainerRe: [PATCH BlueZ 3/7] player: Add image handle support property
Hi Frédéric,
Quoted 18 lines · Frédéric Danis
This is part of the metadata when the AVRCP target supports covert art download and a OBEX BIP session is connected.
The image handle references the cover art associated to the track, and is valid only during OBEX BIP session.--- doc/org.bluez.MediaPlayer.rst | 4 ++++ monitor/avctp.c | 3 +++ profiles/audio/avrcp.c | 7 ++++++- profiles/audio/avrcp.h | 3 ++- tools/parser/avrcp.c | 3 +++ 5 files changed, 18 insertions(+), 2 deletions(-)doc/org.bluez.MediaPlayer.rst +0
-0
doc/org.bluez.MediaPlayer.rst dict Track [readonly] · line 242
Quoted 6 lines
doc/org.bluez.MediaPlayer.rst +3
-0@@ -237,6 +237,10 @@ dict Track [readonly] Track duration in milliseconds + :string ImgHandle: + + Track image handle
I guess we want something more descriptive here, as ThumbnailURL or something .e.g obex://<handle>, that said I don't know if perhaps we could load it automatically via plugin.
Quoted 95 lines
doc/org.bluez.MediaPlayer.rst +0
-0object Device [readonly] ````````````````````````monitor/avctp.c +3
-0@@ -156,6 +156,7 @@#define AVRCP_MEDIA_ATTRIBUTE_TOTAL 0x05#define AVRCP_MEDIA_ATTRIBUTE_GENRE 0x06#define AVRCP_MEDIA_ATTRIBUTE_DURATION 0x07 +#define AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE 0x08/* play status */ #define AVRCP_PLAY_STATUS_STOPPED 0x00@@ -582,6 +583,8 @@ static const char *mediattr2str(uint32_t attr)return "Genre" ;case AVRCP_MEDIA_ATTRIBUTE_DURATION :return "Track duration" ; +case AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE : +return "Imaging handle" ;default :return "Reserved" ; }profiles/audio/avrcp.c +6
-1@@ -417,7 +417,8 @@ static sdp_record_t *avrcp_ct_record(bool browsing)uint16_t feat = (AVRCP_FEATURE_CATEGORY_1 |AVRCP_FEATURE_CATEGORY_2 |AVRCP_FEATURE_CATEGORY_3 | -AVRCP_FEATURE_CATEGORY_4 ); +AVRCP_FEATURE_CATEGORY_4 | +AVRCP_FEATURE_CT_GET_THUMBNAIL ); record =sdp_record_alloc ();if (!record)@@ -883,6 +884,8 @@ static const char *metadata_to_str(uint32_t id)return "NumberOfTracks" ;case AVRCP_MEDIA_ATTRIBUTE_DURATION :return "Duration" ; +case AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE : +return "ImgHandle" ; }return NULL ;@@ -1197,6 +1200,8 @@ static uint32_t str_to_metadata(const char *str)return AVRCP_MEDIA_ATTRIBUTE_N_TRACKS ; else if (strcasecmp(str, "Duration") == 0) return AVRCP_MEDIA_ATTRIBUTE_DURATION; + else if (strcasecmp(str, "ImgHandle") == 0) + return AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE;return 0 ; }profiles/audio/avrcp.h +2
-1@@ -46,7 +46,8 @@#define AVRCP_MEDIA_ATTRIBUTE_N_TRACKS 0x05#define AVRCP_MEDIA_ATTRIBUTE_GENRE 0x06#define AVRCP_MEDIA_ATTRIBUTE_DURATION 0x07 -#define AVRCP_MEDIA_ATTRIBUTE_LAST AVRCP_MEDIA_ATTRIBUTE_DURATION +#define AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE 0x08 +#define AVRCP_MEDIA_ATTRIBUTE_LAST AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE/* play status */ #define AVRCP_PLAY_STATUS_STOPPED 0x00tools/parser/avrcp.c +3
-1@@ -160,6 +160,7 @@#define AVRCP_MEDIA_ATTRIBUTE_TOTAL 0x5#define AVRCP_MEDIA_ATTRIBUTE_GENRE 0x6#define AVRCP_MEDIA_ATTRIBUTE_DURATION 0x7 +#define AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE 0x08/* play status */ #define AVRCP_PLAY_STATUS_STOPPED 0x00@@ -933,6 +934,8 @@ static const char *mediattr2str(uint32_t attr)return "Genre" ;case AVRCP_MEDIA_ATTRIBUTE_DURATION :return "Track duration" ; +case AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE : +return "Imaging handle" ;default :return "Reserved" ; } --2.34.1
Signature · 1 line
Luiz Augusto von Dentz
PATCH 4/7 obexd: Add BIP client for AVRCP cover art download.
In reply to Frédéric DanisThe cover art image handle is available in the metadata of the track when the OBEX BIP session is connected to the PSM port provided in AVRCP SDP record and available as org.bluez.MediaPlayer property.
This service allows to get the thumbnail.
--- Makefile.obexd | 1 + obexd/client/bip-avrcp.c | 171 +++++++++++++++++++++++++++++++++++++++ obexd/client/bip-avrcp.h | 12 +++ obexd/client/manager.c | 2 + obexd/client/transfer.c | 16 ++++ obexd/client/transfer.h | 2 + 6 files changed, 204 insertions(+) create mode 100644 obexd/client/bip-avrcp.c create mode 100644 obexd/client/bip-avrcp.h
Makefile.obexd +1 -0
@@ -82,6 +82,7 @@ obexd_src_obexd_SOURCES = $(btio_sources) $(gobex_sources) \ obexd/client/ftp.h obexd/client/ftp.c \ obexd/client/opp.h obexd/client/opp.c \ obexd/client/map.h obexd/client/map.c \ + obexd/client/bip-avrcp.h obexd/client/bip-avrcp.c \ obexd/client/map-event.h obexd/client/map-event.c \ obexd/client/transfer.h obexd/client/transfer.c \ obexd/client/transport.h obexd/client/transport.c \
obexd/client/bip-avrcp.c new file +171 -0
171 lines not on this page · raw message
obexd/client/bip-avrcp.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* +* OBEX Client +* +* Copyright (C) 2024 Collabora Ltd. +* +* +*/ + +int bip_avrcp_init (void ); +void bip_avrcp_exit (void );
obexd/client/manager.c +2 -0
@@ -32,6 +32,7 @@#include "pbap.h" #include "sync.h" #include "map.h" +#include "bip-avrcp.h" #include "manager.h" #define CLIENT_INTERFACE "org.bluez.obex.Client1"
@@ -258,6 +259,7 @@ static const struct obc_module { { "pbap", pbap_init, pbap_exit }, { "sync", sync_init, sync_exit }, { "map", map_init, map_exit }, + { "bip-avrcp", bip_avrcp_init, bip_avrcp_exit }, { } };
obexd/client/transfer.c +16 -0
@@ -57,6 +57,7 @@ struct obc_transfer {GObex *obex;uint8_t status;GObexApparam *apparam; +GSList *headers;guint8 op;struct transfer_callback *callback;DBusConnection *conn;
@@ -820,6 +821,16 @@ static gboolean transfer_start_get(struct obc_transfer *transfer, GError **err)g_obex_packet_add_bytes (req,G_OBEX_HDR_TYPE , transfer->type,strlen (transfer->type) +1 ); +if (transfer->headers !=NULL ) { +GSList *l; + +for (l = transfer->headers; l !=NULL ; l =g_slist_next (l)) { +GObexHeader *hdr = l->data; + +g_obex_packet_add_header (req, hdr); + } + } +if (transfer->apparam !=NULL ) { hdr =g_obex_header_new_apparam (transfer->apparam);g_obex_packet_add_header (req, hdr);
@@ -974,3 +985,8 @@ gint64 obc_transfer_get_size(struct obc_transfer *transfer) {return transfer->size; } + +void obc_transfer_add_header (struct obc_transfer *transfer,void *data) +{ + transfer->headers =g_slist_append (transfer->headers, data); +}
obexd/client/transfer.h +2 -0
@@ -47,3 +47,5 @@ gint64 obc_transfer_get_size(struct obc_transfer *transfer);DBusMessage *obc_transfer_create_dbus_reply (struct obc_transfer *transfer,DBusMessage *message); + +void obc_transfer_add_header (struct obc_transfer *transfer,void *data);
Signature · 1 line
2.34.1
PATCH 5/7 obexd: Add GetImageProperties to bip-avrcp
In reply to Frédéric DanisThis allows to get the different version of the image provided by the remote device to chose the one to use with GetImage.
This bip-common.[ch] files are based on previous work done by Jakub Adamek for GSoC 2011, see [1] and [2].
[1] https://www.bluez.org/gsoc-basic-image-profilebip/
[2] https://github.com/enkait/Basic-Imaging-Profile-in-obexd/blob/gsoc_final/plugins/bip_util.c
--- Makefile.obexd | 1 + obexd/client/bip-avrcp.c | 101 +++++ obexd/client/bip-common.c | 750 ++++++++++++++++++++++++++++++++++++++ obexd/client/bip-common.h | 19 + 4 files changed, 871 insertions(+) create mode 100644 obexd/client/bip-common.c create mode 100644 obexd/client/bip-common.h
Makefile.obexd +1 -0
@@ -83,6 +83,7 @@ obexd_src_obexd_SOURCES = $(btio_sources) $(gobex_sources) \ obexd/client/opp.h obexd/client/opp.c \ obexd/client/map.h obexd/client/map.c \ obexd/client/bip-avrcp.h obexd/client/bip-avrcp.c \ + obexd/client/bip-common.h obexd/client/bip-common.c \ obexd/client/map-event.h obexd/client/map-event.c \ obexd/client/transfer.h obexd/client/transfer.c \ obexd/client/transport.h obexd/client/transport.c \
obexd/client/bip-avrcp.c +101 -0
119 lines not on this page · raw message
obexd/client/bip-common.c new file +750 -0
750 lines not on this page · raw message
obexd/client/bip-common.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* +* OBEX Client +* +* Copyright (C) 2024 Collabora Ltd. +* +* +*/ + +#include <glib.h> +#include "gdbus/gdbus.h" + +struct prop_object ; + +struct prop_object *parse_properties (char *data,unsigned int length, +int *err); +gboolean verify_properties (struct prop_object *obj); +void append_properties (DBusMessageIter *args,struct prop_object *obj);
Signature · 1 line
2.34.1
PATCH 6/7 obexd: Add GetImage to bip-avrcp
In reply to Frédéric DanisRetrieves the image corresponding to the handle and the description, as one of the descriptions retrieved by GetImageProperties, and store it in a local file.
If the "transform" property description exists it should be set to one of the value listed by GetImageProperties for this description.
--- obexd/client/bip-avrcp.c | 149 ++++++++++++++++++++++++++++++++++++++ obexd/client/bip-common.c | 23 +++++- obexd/client/bip-common.h | 6 ++ profiles/audio/avrcp.c | 10 ++- 4 files changed, 182 insertions(+), 6 deletions(-)
obexd/client/bip-avrcp.c +149 -0
@@ -32,6 +32,14 @@#define BIP_AVRCP_UUID "0000111A-0000-1000-8000-00805f9b34fb"#define IMG_HANDLE_TAG 0x30 +#define IMG_DESC_TAG 0x71 + +#define EOL_CHARS "\n" +#define IMG_DESC_BEGIN "<image-descriptor version=\"1.0\">" EOL_CHARS +#define IMG_BEGIN "<image encoding=\"%s\" pixel=\"%s\"" +#define IMG_TRANSFORM " transformation=\"%s\"" +#define IMG_END "/>" EOL_CHARS +#define IMG_DESC_END "</image-descriptor>" EOL_CHARSstatic DBusConnection *conn;
@@ -175,11 +183,152 @@ fail:return reply; } +static gboolean parse_get_image_dict (DBusMessage *msg,char **path, +char **handle,char **pixel, +char **encoding,char **maxsize, +char **transform) +{ +DBusMessageIter iter, array; + +DBG ("" ); + + *path =NULL ; + *handle =NULL ; + *pixel =NULL ; + *encoding =NULL ; + *maxsize =NULL ; + *transform =NULL ; + +dbus_message_iter_init (msg, &iter); + +if (dbus_message_iter_get_arg_type (&iter) !=DBUS_TYPE_STRING ) + goto failed; +dbus_message_iter_get_basic (&iter, path); + *path =g_strdup (*path); +if (dbus_message_iter_get_arg_type (&iter) !=DBUS_TYPE_STRING ) + goto failed; +dbus_message_iter_next (&iter); +dbus_message_iter_get_basic (&iter, handle); + *handle =g_strdup (*handle); +dbus_message_iter_next (&iter); +if (dbus_message_iter_get_arg_type (&iter) !=DBUS_TYPE_ARRAY ) + goto failed; + +dbus_message_iter_recurse (&iter, &array); + +while (dbus_message_iter_get_arg_type (&array) ==DBUS_TYPE_DICT_ENTRY ) { +DBusMessageIter entry; +const char *key, *val; + +dbus_message_iter_recurse (&array, &entry); + +if (dbus_message_iter_get_arg_type (&entry) !=DBUS_TYPE_STRING ) +return FALSE; +dbus_message_iter_get_basic (&entry, &key); +dbus_message_iter_next (&entry); +dbus_message_iter_get_basic (&entry, &val); + +if (g_str_equal (key,"pixel" )) { +if (!parse_pixel_range (val,NULL ,NULL ,NULL )) + goto failed; + *pixel =g_strdup (val); + }else if (g_str_equal (key,"encoding" )) { +if (!verify_encoding (val)) + goto failed; + *encoding =g_strdup (val); +if (*encoding ==NULL ) + goto failed; + }else if (g_str_equal (key,"maxsize" )) { + *maxsize =parse_unsignednumber (val); +if (*maxsize ==NULL ) + goto failed; + }else if (g_str_equal (key,"transformation" )) { + *transform =parse_transform (val); +if (*transform ==NULL ) + goto failed; + } +dbus_message_iter_next (&array); + } + +if (*pixel ==NULL ) + *pixel =strdup ("" ); +if (*encoding ==NULL ) + *encoding =strdup ("" ); + +DBG ("pixel: '%s' encoding: '%s' maxsize: '%s' transform: '%s'" , + *pixel, *encoding, *maxsize, *transform + ); + +return TRUE; +failed: +g_free (*path); +g_free (*handle); +g_free (*pixel); +g_free (*encoding); +g_free (*maxsize); +g_free (*transform); +return FALSE; +} + +static DBusMessage *get_image (DBusConnection *connection, +DBusMessage *message,void *user_data) +{ +struct bip_avrcp_data *bip_avrcp = user_data; +char *handle =NULL , *image_path =NULL , *transform =NULL , + *encoding =NULL , *pixel =NULL , *maxsize =NULL ; +struct obc_transfer *transfer; +GObexHeader *header; +DBusMessage *reply =NULL ; +GString *descriptor =NULL ; +GError *err =NULL ; + +DBG ("" ); + +if (!parse_get_image_dict (message, &image_path, &handle, &pixel, + &encoding, &maxsize, &transform)) +return g_dbus_create_error (message, +ERROR_INTERFACE ".InvalidArguments" ,NULL ); + + transfer =obc_transfer_get ("x-bt/img-img" ,NULL , image_path, &err); +if (transfer ==NULL ) + goto fail; + + header =g_obex_header_new_unicode (IMG_HANDLE_TAG , handle); +obc_transfer_add_header (transfer, header); + + descriptor =g_string_new (IMG_DESC_BEGIN ); +g_string_append_printf (descriptor,IMG_BEGIN , encoding, pixel); +if (transform !=NULL ) +g_string_append_printf (descriptor,IMG_TRANSFORM , transform); +g_string_append (descriptor,IMG_END ); + descriptor =g_string_append (descriptor,IMG_DESC_END ); + header =g_obex_header_new_bytes (IMG_DESC_TAG , descriptor->str, + descriptor->len); +obc_transfer_add_header (transfer, header); +g_string_free (descriptor, TRUE); + +if (!obc_session_queue (bip_avrcp->session, transfer,NULL ,NULL , &err)) + goto fail; + +return obc_transfer_create_dbus_reply (transfer, message); + +fail: + reply =g_dbus_create_error (message,ERROR_INTERFACE ".Failed" ,"%s" , + err->message); +g_error_free (err); +return reply; +} +static const GDBusMethodTable bip_avrcp_methods[] = { {GDBUS_ASYNC_METHOD ("GetImageProperties" , GDBUS_ARGS({ "handle", "s"}), GDBUS_ARGS({ "properties", "aa{ss}" }), get_image_properties) }, + {GDBUS_ASYNC_METHOD ("GetImage" , + GDBUS_ARGS({ "file", "s" }, { "handle", "s"}, + {"properties", "a{ss}"}), + GDBUS_ARGS({ "transfer", "o" }, { "properties", "a{sv}" }), + get_image) }, { GDBUS_ASYNC_METHOD("GetImageThumbnail", GDBUS_ARGS({ "file", "s" }, { "handle", "s"}), GDBUS_ARGS({ "transfer", "o" }, { "properties", "a{sv}" }),
obexd/client/bip-common.c +21 -2
@@ -47,7 +47,7 @@ static const gchar *convBIP2IM(const gchar *encoding)return NULL ; } -static gboolean parse_pixel_range (const gchar *dim,unsigned int *lower_ret, +gboolean parse_pixel_range (const gchar *dim,unsigned int *lower_ret,unsigned int *upper_ret,gboolean *fixed_ratio_ret) {
@@ -122,7 +122,7 @@ static gboolean verify_unsignednumber(const char *size)return TRUE; } -static char *parse_unsignednumber (const char *size) +char *parse_unsignednumber (const char *size) {if (!verify_unsignednumber (size))return NULL ;
@@ -137,6 +137,18 @@ char *transforms[] = { NULL }; +gboolean verify_encoding (const char *encoding) +{ +struct encconv_pair *et = encconv_table; + +while (et->bip) { +if (g_strcmp0 (encoding, et->bip) ==0 ) +return TRUE; + et++; + } +return FALSE; +} +static gboolean verify_transform (const char *transform) {char **str = transforms;
@@ -149,6 +161,13 @@ static gboolean verify_transform(const char *transform)return FALSE; } +char *parse_transform (const char *transform) +{ +if (!verify_transform (transform)) +return NULL ; +return g_strdup (transform); +} +static char *parse_transform_list (const char *transform) {char **args =NULL , **arg =NULL ;
obexd/client/bip-common.h +6 -0
@@ -13,6 +13,12 @@struct prop_object ; +gboolean parse_pixel_range (const gchar *dim,unsigned int *lower_ret, +unsigned int *upper_ret, +gboolean *fixed_ratio_ret); +char *parse_unsignednumber (const char *size); +gboolean verify_encoding (const char *encoding); +char *parse_transform (const char *transform);struct prop_object *parse_properties (char *data,unsigned int length,int *err);gboolean verify_properties (struct prop_object *obj);
profiles/audio/avrcp.c +6 -4
@@ -415,10 +415,12 @@ static sdp_record_t *avrcp_ct_record(bool browsing)uint16_t lp =AVCTP_CONTROL_PSM ;uint16_t avctp_ver =0x0103 ;uint16_t feat = (AVRCP_FEATURE_CATEGORY_1 | -AVRCP_FEATURE_CATEGORY_2 | -AVRCP_FEATURE_CATEGORY_3 | -AVRCP_FEATURE_CATEGORY_4 | -AVRCP_FEATURE_CT_GET_THUMBNAIL ); +AVRCP_FEATURE_CATEGORY_2 | +AVRCP_FEATURE_CATEGORY_3 | +AVRCP_FEATURE_CATEGORY_4 | +AVRCP_FEATURE_CT_GET_IMAGE_PROP | +AVRCP_FEATURE_CT_GET_IMAGE | +AVRCP_FEATURE_CT_GET_THUMBNAIL ); record =sdp_record_alloc ();if (!record)
Signature · 1 line
2.34.1
PATCH 7/7 doc: Add description of org.bluez.obex.BipAvrcp
In reply to Frédéric DanisThis new interface allows to get the image referenced in the audio metadata ImgHandle available in org.bluez.MediaPlayer track properties. The image handle is only available in track info if an OBEX session is connected to the ObexPort port provided in org.bluez.MediaPlayer properties.
--- Makefile.am | 9 +++-- doc/org.bluez.obex.BipAvrcp.rst | 72 +++++++++++++++++++++++++++++++++ doc/org.bluez.obex.Client.rst | 1 + 3 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 doc/org.bluez.obex.BipAvrcp.rst
Makefile.am +6 -3
@@ -379,7 +379,8 @@ man_MANS += doc/org.bluez.obex.Client.5 doc/org.bluez.obex.Session.5 \ doc/org.bluez.obex.PhonebookAccess.5 \ doc/org.bluez.obex.MessageAccess.5 \ doc/org.bluez.obex.Message.5 \ - doc/org.bluez.obex.AgentManager.5 doc/org.bluez.obex.Agent.5 + doc/org.bluez.obex.AgentManager.5 doc/org.bluez.obex.Agent.5 \ + doc/org.bluez.obex.BipAvrcp.5 endif manual_pages += src/bluetoothd.8 manual_pages += doc/l2cap.7 doc/rfcomm.7
@@ -412,7 +413,8 @@ manual_pages += doc/org.bluez.obex.Client.5 doc/org.bluez.obex.Session.5 \ doc/org.bluez.obex.PhonebookAccess.5 \ doc/org.bluez.obex.MessageAccess.5 \ doc/org.bluez.obex.Message.5 \ - doc/org.bluez.obex.AgentManager.5 doc/org.bluez.obex.Agent.5 + doc/org.bluez.obex.AgentManager.5 doc/org.bluez.obex.Agent.5 \ + doc/org.bluez.obex.BipAvrcp.5 EXTRA_DIST += src/genbuiltin src/bluetooth.conf \ src/main.conf profiles/network/network.conf \
@@ -494,7 +496,8 @@ EXTRA_DIST += doc/org.bluez.obex.Client.rst doc/org.bluez.obex.Session.rst \ doc/org.bluez.obex.PhonebookAccess.rst \ doc/org.bluez.obex.MessageAccess.rst \ doc/org.bluez.obex.Message.rst \ - doc/org.bluez.obex.AgentManager.rst doc/org.bluez.obex.Agent.rst + doc/org.bluez.obex.AgentManager.rst doc/org.bluez.obex.Agent.rst \ + doc/org.bluez.obex.BipAvrcp.rst EXTRA_DIST += doc/pics-opp.txt doc/pixit-opp.txt \ doc/pts-opp.txt
doc/org.bluez.obex.BipAvrcp.rst new file +72 -0
72 lines not on this page · raw message
doc/org.bluez.obex.Client.rst +1 -0
@@ -43,6 +43,7 @@ object CreateSession(string destination, dict args) :"opp": :"pbap": :"sync": + :"bip-avrcp": :string Source:
Signature · 1 line
2.34.1