acp: add current profile in the route

This commit is contained in:
Wim Taymans 2020-08-14 15:09:00 +02:00
parent 4ad6c627a0
commit 90e12299f1
3 changed files with 10 additions and 3 deletions

View file

@ -155,6 +155,7 @@ enum spa_param_route {
SPA_PARAM_ROUTE_profiles, /**< associated profile indexes (Array of Int) */
SPA_PARAM_ROUTE_props, /**< properties SPA_TYPE_OBJECT_Props */
SPA_PARAM_ROUTE_devices, /**< associated device indexes (Array of Int) */
SPA_PARAM_ROUTE_profile, /**< profile id (Int) */
};

View file

@ -336,6 +336,7 @@ static const struct spa_type_info spa_type_param_route[] = {
{ SPA_PARAM_ROUTE_profiles, SPA_TYPE_Array, SPA_TYPE_INFO_PARAM_ROUTE_BASE "profiles", NULL, },
{ SPA_PARAM_ROUTE_props, SPA_TYPE_Object, SPA_TYPE_INFO_PARAM_ROUTE_BASE "props", NULL, },
{ SPA_PARAM_ROUTE_devices, SPA_TYPE_Array, SPA_TYPE_INFO_PARAM_ROUTE_BASE "devices", NULL, },
{ SPA_PARAM_ROUTE_profile, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "profile", NULL, },
{ 0, 0, NULL, NULL },
};

View file

@ -304,7 +304,7 @@ static struct spa_pod *build_profile(struct spa_pod_builder *b, uint32_t id,
}
static struct spa_pod *build_route(struct spa_pod_builder *b, uint32_t id,
struct acp_port *p, struct acp_device *dev)
struct acp_port *p, struct acp_device *dev, uint32_t profile)
{
struct spa_pod_frame f[2];
const struct acp_dict_item *item;
@ -385,6 +385,11 @@ static struct spa_pod *build_route(struct spa_pod_builder *b, uint32_t id,
for (i = 0; i < p->n_devices; i++)
spa_pod_builder_int(b, p->devices[i]->index);
spa_pod_builder_pop(b, &f[1]);
if (profile != SPA_ID_INVALID) {
spa_pod_builder_prop(b, SPA_PARAM_ROUTE_profile, 0);
spa_pod_builder_int(b, profile);
}
return spa_pod_builder_pop(b, &f[0]);
}
@ -448,7 +453,7 @@ static int impl_enum_params(void *object, int seq,
return 0;
p = card->ports[result.index];
param = build_route(&b, id, p, NULL);
param = build_route(&b, id, p, NULL, SPA_ID_INVALID);
break;
case SPA_PARAM_Route:
@ -466,7 +471,7 @@ static int impl_enum_params(void *object, int seq,
if (p == NULL)
return 0;
result.next = result.index + 1;
param = build_route(&b, id, p, dev);
param = build_route(&b, id, p, dev, card->active_profile_index);
if (param == NULL)
return -errno;
break;