mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
bluez5: A2DP and BAP profiles to enumerate only codec profiles
This avoids the potential confusion when both codecless and codec profiles are enumerated for A2DP. Give base name to highest priority profile, so that best codec can be selected at command line with out knowing which codecs are actually supported.
This commit is contained in:
parent
8f6d266632
commit
cd24fe2fe9
1 changed files with 28 additions and 14 deletions
|
|
@ -1467,19 +1467,8 @@ static uint32_t get_index_from_profile(struct impl *this, uint32_t profile, enum
|
||||||
if (profile == DEVICE_PROFILE_OFF || profile == DEVICE_PROFILE_AG)
|
if (profile == DEVICE_PROFILE_OFF || profile == DEVICE_PROFILE_AG)
|
||||||
return profile;
|
return profile;
|
||||||
|
|
||||||
if (profile == DEVICE_PROFILE_A2DP) {
|
if ((profile == DEVICE_PROFILE_A2DP) || (profile == DEVICE_PROFILE_BAP))
|
||||||
if (codec == 0 || (this->bt_dev->connected_profiles & SPA_BT_PROFILE_MEDIA_SOURCE))
|
|
||||||
return profile;
|
|
||||||
|
|
||||||
return codec + DEVICE_PROFILE_LAST;
|
return codec + DEVICE_PROFILE_LAST;
|
||||||
}
|
|
||||||
|
|
||||||
if (profile == DEVICE_PROFILE_BAP) {
|
|
||||||
if (codec == 0)
|
|
||||||
return profile;
|
|
||||||
|
|
||||||
return codec + DEVICE_PROFILE_LAST;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (profile == DEVICE_PROFILE_HSP_HFP) {
|
if (profile == DEVICE_PROFILE_HSP_HFP) {
|
||||||
if (codec == 0 || (this->bt_dev->connected_profiles & SPA_BT_PROFILE_HFP_AG))
|
if (codec == 0 || (this->bt_dev->connected_profiles & SPA_BT_PROFILE_HFP_AG))
|
||||||
|
|
@ -1607,6 +1596,11 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder *
|
||||||
if (!(profile & SPA_BT_PROFILE_A2DP_SINK)) {
|
if (!(profile & SPA_BT_PROFILE_A2DP_SINK)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A2DP will only enlist codec profiles */
|
||||||
|
if (!codec)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
name = spa_bt_profile_name(profile);
|
name = spa_bt_profile_name(profile);
|
||||||
n_sink++;
|
n_sink++;
|
||||||
if (codec) {
|
if (codec) {
|
||||||
|
|
@ -1617,7 +1611,15 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder *
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
name_and_codec = spa_aprintf("%s-%s", name, media_codec->name);
|
name_and_codec = spa_aprintf("%s-%s", name, media_codec->name);
|
||||||
name = name_and_codec;
|
|
||||||
|
/*
|
||||||
|
* Give base name to highest priority profile, so that best codec can be
|
||||||
|
* selected at command line with out knowing which codecs are actually
|
||||||
|
* supported
|
||||||
|
*/
|
||||||
|
if (idx != 0)
|
||||||
|
name = name_and_codec;
|
||||||
|
|
||||||
if (profile == SPA_BT_PROFILE_A2DP_SINK && !media_codec->duplex_codec) {
|
if (profile == SPA_BT_PROFILE_A2DP_SINK && !media_codec->duplex_codec) {
|
||||||
desc_and_codec = spa_aprintf(_("High Fidelity Playback (A2DP Sink, codec %s)"),
|
desc_and_codec = spa_aprintf(_("High Fidelity Playback (A2DP Sink, codec %s)"),
|
||||||
media_codec->description);
|
media_codec->description);
|
||||||
|
|
@ -1645,6 +1647,10 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder *
|
||||||
size_t idx;
|
size_t idx;
|
||||||
const struct media_codec *media_codec;
|
const struct media_codec *media_codec;
|
||||||
|
|
||||||
|
/* BAP will only enlist codec profiles */
|
||||||
|
if (codec == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (profile == 0)
|
if (profile == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -1671,7 +1677,15 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder *
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
name_and_codec = spa_aprintf("%s-%s", name, media_codec->name);
|
name_and_codec = spa_aprintf("%s-%s", name, media_codec->name);
|
||||||
name = name_and_codec;
|
|
||||||
|
/*
|
||||||
|
* Give base name to highest priority profile, so that best codec can be
|
||||||
|
* selected at command line with out knowing which codecs are actually
|
||||||
|
* supported
|
||||||
|
*/
|
||||||
|
if (idx != 0)
|
||||||
|
name = name_and_codec;
|
||||||
|
|
||||||
switch (profile) {
|
switch (profile) {
|
||||||
case SPA_BT_PROFILE_BAP_SINK:
|
case SPA_BT_PROFILE_BAP_SINK:
|
||||||
desc_and_codec = spa_aprintf(_("High Fidelity Playback (BAP Sink, codec %s)"),
|
desc_and_codec = spa_aprintf(_("High Fidelity Playback (BAP Sink, codec %s)"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue