bluez5: a2dp-sink: support duplex codec

Allow running a2dp-sink using the duplex codec, when the local endpoint
is the A2DP sink.
This commit is contained in:
Pauli Virtanen 2022-05-22 19:08:56 +03:00 committed by Wim Taymans
parent 1a5ec4452f
commit f593a44069

View file

@ -137,6 +137,8 @@ struct impl {
unsigned int started:1;
unsigned int following:1;
unsigned int is_duplex:1;
struct spa_source source;
int timerfd;
struct spa_source flush_source;
@ -1697,6 +1699,9 @@ impl_init(const struct spa_handle_factory *factory,
spa_list_init(&port->ready);
if (info && (str = spa_dict_lookup(info, "api.bluez5.a2dp-duplex")) != NULL)
this->is_duplex = spa_atob(str);
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
sscanf(str, "pointer:%p", &this->transport);
@ -1708,7 +1713,17 @@ impl_init(const struct spa_handle_factory *factory,
spa_log_error(this->log, "a transport codec is needed");
return -EINVAL;
}
this->codec = this->transport->a2dp_codec;
if (this->is_duplex) {
if (!this->codec->duplex_codec) {
spa_log_error(this->log, "transport codec doesn't support duplex");
return -EINVAL;
}
this->codec = this->codec->duplex_codec;
}
if (this->codec->init_props != NULL)
this->codec_props = this->codec->init_props(this->codec,
this->transport->device->settings);