diff --git a/src/modules/module-protocol-pulse/collect.c b/src/modules/module-protocol-pulse/collect.c index 300eee262..d24608b98 100644 --- a/src/modules/module-protocol-pulse/collect.c +++ b/src/modules/module-protocol-pulse/collect.c @@ -233,6 +233,7 @@ static void collect_device_info(struct pw_manager_object *device, struct pw_mana struct device_info *dev_info, bool monitor, struct defs *defs) { struct pw_manager_param *p; + dev_info->active_port_name = NULL; if (card) { spa_list_for_each(p, &card->param_list, link) { @@ -256,6 +257,30 @@ static void collect_device_info(struct pw_manager_object *device, struct pw_mana dev_info->have_volume = true; } } + + /* Look up the port name for the active port */ + if (dev_info->active_port != SPA_ID_INVALID) { + spa_list_for_each(p, &card->param_list, link) { + uint32_t index, direction; + const char *name = NULL; + + if (p->id != SPA_PARAM_EnumRoute) + continue; + + if (spa_pod_parse_object(p->param, + SPA_TYPE_OBJECT_ParamRoute, NULL, + SPA_PARAM_ROUTE_index, SPA_POD_Int(&index), + SPA_PARAM_ROUTE_direction, SPA_POD_Id(&direction), + SPA_PARAM_ROUTE_name, SPA_POD_String(&name)) < 0) + continue; + + if (index == dev_info->active_port && + direction == dev_info->direction) { + dev_info->active_port_name = name; + break; + } + } + } } spa_list_for_each(p, &device->param_list, link) {