bluez5: fix device supported codec checks

Make supported codec checks to use profiles, not "is-a-sink" flag, to
determine which codecs can be used.

Fixes bluez5-device checking only source profiles, even when the local
device is only a sink.
This commit is contained in:
Pauli Virtanen 2023-09-02 15:06:27 +03:00 committed by P V
parent 6abc6e6693
commit 186b730c9c
3 changed files with 59 additions and 66 deletions

View file

@ -169,6 +169,7 @@ enum spa_bt_media_direction {
SPA_BT_MEDIA_SINK,
SPA_BT_MEDIA_SOURCE_BROADCAST,
SPA_BT_MEDIA_SINK_BROADCAST,
SPA_BT_MEDIA_DIRECTION_LAST,
};
enum spa_bt_profile {
@ -538,8 +539,8 @@ int spa_bt_device_add_profile(struct spa_bt_device *device, enum spa_bt_profile
int spa_bt_device_connect_profile(struct spa_bt_device *device, enum spa_bt_profile profile);
int spa_bt_device_check_profiles(struct spa_bt_device *device, bool force);
int spa_bt_device_ensure_media_codec(struct spa_bt_device *device, const struct media_codec * const *codecs);
bool spa_bt_device_supports_media_codec(struct spa_bt_device *device, const struct media_codec *codec, bool sink);
const struct media_codec **spa_bt_device_get_supported_media_codecs(struct spa_bt_device *device, size_t *count, bool sink);
bool spa_bt_device_supports_media_codec(struct spa_bt_device *device, const struct media_codec *codec, enum spa_bt_profile profile);
const struct media_codec **spa_bt_device_get_supported_media_codecs(struct spa_bt_device *device, size_t *count);
int spa_bt_device_ensure_hfp_codec(struct spa_bt_device *device, unsigned int codec);
int spa_bt_device_supports_hfp_codec(struct spa_bt_device *device, unsigned int codec);
int spa_bt_device_release_transports(struct spa_bt_device *device);