pulse-server: improve network and virtual node checks

Tag the sink/source as HARDWARE when it's not virtual, the presence
of a DEVICE_API property is not a good check.

Make a method to check if a node is a NETWORK sink/source to make it
use the same logic everywhere.
This commit is contained in:
Wim Taymans 2023-07-26 11:51:48 +02:00
parent ae4042e7a2
commit 39a1887a0b
5 changed files with 18 additions and 9 deletions

View file

@ -974,6 +974,16 @@ bool pw_manager_object_is_virtual(struct pw_manager_object *o)
pw_properties_parse_bool(str);
}
bool pw_manager_object_is_network(struct pw_manager_object *o)
{
const char *str;
struct pw_node_info *info;
return spa_streq(o->type, PW_TYPE_INTERFACE_Node) &&
(info = o->info) != NULL && info->props != NULL &&
(str = spa_dict_lookup(info->props, PW_KEY_NODE_NETWORK)) != NULL &&
pw_properties_parse_bool(str);
}
bool pw_manager_object_is_source_or_monitor(struct pw_manager_object *o)
{
return pw_manager_object_is_source(o) || pw_manager_object_is_monitor(o);