bluez5: support and use old api.bluez5.a2dp.* factory names for A2DP

For backward compatibility with old Wireplumber releases, support the
old api.bluez5.a2dp.sink/source names, and use them in object events
instead of the media.sink/source names.
This commit is contained in:
Pauli Virtanen 2022-09-15 23:02:51 +03:00
parent 101287159e
commit 8de03f5c29
5 changed files with 36 additions and 6 deletions

View file

@ -116,6 +116,8 @@ extern "C" {
#define SPA_NAME_API_BLUEZ5_DEVICE "api.bluez5.device" /**< a Device interface */
#define SPA_NAME_API_BLUEZ5_MEDIA_SINK "api.bluez5.media.sink" /**< a playback Node interface for A2DP/BAP profiles */
#define SPA_NAME_API_BLUEZ5_MEDIA_SOURCE "api.bluez5.media.source" /**< a capture Node interface for A2DP/BAP profiles */
#define SPA_NAME_API_BLUEZ5_A2DP_SINK "api.bluez5.a2dp.sink" /**< alias for media.sink */
#define SPA_NAME_API_BLUEZ5_A2DP_SOURCE "api.bluez5.a2dp.source" /**< alias for media.source */
#define SPA_NAME_API_BLUEZ5_SCO_SINK "api.bluez5.sco.sink" /**< a playback Node interface for HSP/HFP profiles */
#define SPA_NAME_API_BLUEZ5_SCO_SOURCE "api.bluez5.sco.source" /**< a capture Node interface for HSP/HFP profiles */

View file

@ -683,11 +683,11 @@ static int emit_nodes(struct impl *this)
if (t) {
this->props.codec = t->media_codec->id;
emit_dynamic_node(&this->dyn_media_source, this, t,
2, SPA_NAME_API_BLUEZ5_MEDIA_SOURCE, false);
2, SPA_NAME_API_BLUEZ5_A2DP_SOURCE, false);
if (t->media_codec->duplex_codec) {
emit_dynamic_node(&this->dyn_media_sink, this, t,
3, SPA_NAME_API_BLUEZ5_MEDIA_SINK, true);
3, SPA_NAME_API_BLUEZ5_A2DP_SINK, true);
}
}
}
@ -698,11 +698,11 @@ static int emit_nodes(struct impl *this)
if (t) {
this->props.codec = t->media_codec->id;
emit_dynamic_node(&this->dyn_media_source, this, t,
DEVICE_ID_SOURCE, SPA_NAME_API_BLUEZ5_MEDIA_SOURCE, false);
DEVICE_ID_SOURCE, SPA_NAME_API_BLUEZ5_A2DP_SOURCE, false);
if (t->media_codec->duplex_codec) {
emit_node(this, t,
DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_MEDIA_SINK, true);
DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_A2DP_SINK, true);
}
}
}
@ -711,11 +711,11 @@ static int emit_nodes(struct impl *this)
t = find_transport(this, SPA_BT_PROFILE_A2DP_SINK, this->props.codec);
if (t) {
this->props.codec = t->media_codec->id;
emit_node(this, t, DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_MEDIA_SINK, false);
emit_node(this, t, DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_A2DP_SINK, false);
if (t->media_codec->duplex_codec) {
emit_node(this, t,
DEVICE_ID_SOURCE, SPA_NAME_API_BLUEZ5_MEDIA_SOURCE, true);
DEVICE_ID_SOURCE, SPA_NAME_API_BLUEZ5_A2DP_SOURCE, true);
}
}
}

View file

@ -1842,3 +1842,13 @@ const struct spa_handle_factory spa_media_sink_factory = {
impl_init,
impl_enum_interface_info,
};
/* Retained for backward compatibility: */
const struct spa_handle_factory spa_a2dp_sink_factory = {
SPA_VERSION_HANDLE_FACTORY,
SPA_NAME_API_BLUEZ5_A2DP_SINK,
&info,
impl_get_size,
impl_init,
impl_enum_interface_info,
};

View file

@ -1651,3 +1651,13 @@ const struct spa_handle_factory spa_media_source_factory = {
impl_init,
impl_enum_interface_info,
};
/* Retained for backward compatibility */
const struct spa_handle_factory spa_a2dp_source_factory = {
SPA_VERSION_HANDLE_FACTORY,
SPA_NAME_API_BLUEZ5_A2DP_SOURCE,
&info,
impl_get_size,
impl_init,
impl_enum_interface_info,
};

View file

@ -33,6 +33,8 @@ extern const struct spa_handle_factory spa_media_sink_factory;
extern const struct spa_handle_factory spa_media_source_factory;
extern const struct spa_handle_factory spa_sco_sink_factory;
extern const struct spa_handle_factory spa_sco_source_factory;
extern const struct spa_handle_factory spa_a2dp_sink_factory;
extern const struct spa_handle_factory spa_a2dp_source_factory;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
@ -59,6 +61,12 @@ int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t
case 5:
*factory = &spa_sco_source_factory;
break;
case 6:
*factory = &spa_a2dp_sink_factory;
break;
case 7:
*factory = &spa_a2dp_source_factory;
break;
default:
return 0;
}