bluez5: support api.bluez5.internal flag also for sco

Enable the /Internal media class hack also for SCO.

Session manager can use this to adjust SCO sink/source media.class when
it is going to emit front-end nodes hiding the hardware ones.
This commit is contained in:
Pauli Virtanen 2024-01-25 20:13:45 +02:00 committed by Wim Taymans
parent 05402284c1
commit 84c5ba09dc
2 changed files with 14 additions and 4 deletions

View file

@ -128,6 +128,8 @@ struct impl {
unsigned int following:1;
unsigned int flush_pending:1;
unsigned int is_internal:1;
/* Sources */
struct spa_source source;
struct spa_source flush_timer_source;
@ -956,9 +958,9 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
static const struct spa_dict_item hu_node_info_items[] = {
const struct spa_dict_item hu_node_info_items[] = {
{ SPA_KEY_DEVICE_API, "bluez5" },
{ SPA_KEY_MEDIA_CLASS, "Audio/Sink" },
{ SPA_KEY_MEDIA_CLASS, this->is_internal ? "Audio/Sink/Internal" : "Audio/Sink" },
{ SPA_KEY_NODE_DRIVER, "true" },
};
@ -1626,6 +1628,9 @@ impl_init(const struct spa_handle_factory *factory,
if (info && (str = spa_dict_lookup(info, "clock.quantum-limit")))
spa_atou32(str, &this->quantum_limit, 0);
if (info && (str = spa_dict_lookup(info, "api.bluez5.internal")) != NULL)
this->is_internal = spa_atob(str);
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
sscanf(str, "pointer:%p", &this->transport);

View file

@ -124,6 +124,8 @@ struct impl {
unsigned int resampling:1;
unsigned int io_error:1;
unsigned int is_internal:1;
struct spa_source timer_source;
int timerfd;
@ -929,9 +931,9 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
static void emit_node_info(struct impl *this, bool full)
{
static const struct spa_dict_item hu_node_info_items[] = {
const struct spa_dict_item hu_node_info_items[] = {
{ SPA_KEY_DEVICE_API, "bluez5" },
{ SPA_KEY_MEDIA_CLASS, "Audio/Source" },
{ SPA_KEY_MEDIA_CLASS, this->is_internal ? "Audio/Source/Internal" : "Audio/Source" },
{ SPA_KEY_NODE_DRIVER, "true" },
};
const struct spa_dict_item ag_node_info_items[] = {
@ -1715,6 +1717,9 @@ impl_init(const struct spa_handle_factory *factory,
if (info && (str = spa_dict_lookup(info, "clock.quantum-limit")))
spa_atou32(str, &this->quantum_limit, 0);
if (info && (str = spa_dict_lookup(info, "api.bluez5.internal")) != NULL)
this->is_internal = spa_atob(str);
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
sscanf(str, "pointer:%p", &this->transport);