mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
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:
parent
ae4042e7a2
commit
39a1887a0b
5 changed files with 18 additions and 9 deletions
|
|
@ -974,6 +974,16 @@ bool pw_manager_object_is_virtual(struct pw_manager_object *o)
|
||||||
pw_properties_parse_bool(str);
|
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)
|
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);
|
return pw_manager_object_is_source(o) || pw_manager_object_is_monitor(o);
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ bool pw_manager_object_is_sink(struct pw_manager_object *o);
|
||||||
bool pw_manager_object_is_source(struct pw_manager_object *o);
|
bool pw_manager_object_is_source(struct pw_manager_object *o);
|
||||||
bool pw_manager_object_is_monitor(struct pw_manager_object *o);
|
bool pw_manager_object_is_monitor(struct pw_manager_object *o);
|
||||||
bool pw_manager_object_is_virtual(struct pw_manager_object *o);
|
bool pw_manager_object_is_virtual(struct pw_manager_object *o);
|
||||||
|
bool pw_manager_object_is_network(struct pw_manager_object *o);
|
||||||
bool pw_manager_object_is_source_or_monitor(struct pw_manager_object *o);
|
bool pw_manager_object_is_source_or_monitor(struct pw_manager_object *o);
|
||||||
bool pw_manager_object_is_sink_input(struct pw_manager_object *o);
|
bool pw_manager_object_is_sink_input(struct pw_manager_object *o);
|
||||||
bool pw_manager_object_is_source_output(struct pw_manager_object *o);
|
bool pw_manager_object_is_source_output(struct pw_manager_object *o);
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ static void manager_added(void *data, struct pw_manager_object *o)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->ignore_virtual && spa_dict_lookup(info->props, PW_KEY_DEVICE_API) == NULL) {
|
if (d->ignore_virtual && pw_manager_object_is_virtual(o)) {
|
||||||
pw_log_debug("not switching to virtual device");
|
pw_log_debug("not switching to virtual device");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ static void fill_service_data(struct module_zeroconf_publish_data *d, struct ser
|
||||||
|
|
||||||
collect_device_info(o, card, &dev_info, false, &impl->defs);
|
collect_device_info(o, card, &dev_info, false, &impl->defs);
|
||||||
|
|
||||||
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_API)) != NULL) {
|
if (!pw_manager_object_is_virtual(o)) {
|
||||||
if (is_sink)
|
if (is_sink)
|
||||||
flags |= SINK_HARDWARE;
|
flags |= SINK_HARDWARE;
|
||||||
else if (is_source)
|
else if (is_source)
|
||||||
|
|
@ -574,7 +574,6 @@ static void manager_added(void *d, struct pw_manager_object *o)
|
||||||
{
|
{
|
||||||
struct service *s;
|
struct service *s;
|
||||||
struct pw_node_info *info;
|
struct pw_node_info *info;
|
||||||
const char *str;
|
|
||||||
|
|
||||||
if (!pw_manager_object_is_sink(o) && !pw_manager_object_is_source(o))
|
if (!pw_manager_object_is_sink(o) && !pw_manager_object_is_source(o))
|
||||||
return;
|
return;
|
||||||
|
|
@ -583,8 +582,7 @@ static void manager_added(void *d, struct pw_manager_object *o)
|
||||||
if (info == NULL || info->props == NULL)
|
if (info == NULL || info->props == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((str = spa_dict_lookup(info->props, PW_KEY_NODE_NETWORK)) != NULL &&
|
if (pw_manager_object_is_network(o))
|
||||||
spa_atob(str))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s = create_service(d, o);
|
s = create_service(d, o);
|
||||||
|
|
|
||||||
|
|
@ -3715,9 +3715,9 @@ static int fill_sink_info(struct client *client, struct message *m,
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = SINK_LATENCY | SINK_DYNAMIC_LATENCY | SINK_DECIBEL_VOLUME;
|
flags = SINK_LATENCY | SINK_DYNAMIC_LATENCY | SINK_DECIBEL_VOLUME;
|
||||||
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_API)) != NULL)
|
if (!pw_manager_object_is_virtual(o))
|
||||||
flags |= SINK_HARDWARE;
|
flags |= SINK_HARDWARE;
|
||||||
if ((str = spa_dict_lookup(info->props, PW_KEY_NODE_NETWORK)) != NULL)
|
if (pw_manager_object_is_network(o))
|
||||||
flags |= SINK_NETWORK;
|
flags |= SINK_NETWORK;
|
||||||
if (SPA_FLAG_IS_SET(dev_info.volume_info.flags, VOLUME_HW_VOLUME))
|
if (SPA_FLAG_IS_SET(dev_info.volume_info.flags, VOLUME_HW_VOLUME))
|
||||||
flags |= SINK_HW_VOLUME_CTRL;
|
flags |= SINK_HW_VOLUME_CTRL;
|
||||||
|
|
@ -3927,9 +3927,9 @@ static int fill_source_info(struct client *client, struct message *m,
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = SOURCE_LATENCY | SOURCE_DYNAMIC_LATENCY | SOURCE_DECIBEL_VOLUME;
|
flags = SOURCE_LATENCY | SOURCE_DYNAMIC_LATENCY | SOURCE_DECIBEL_VOLUME;
|
||||||
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_API)) != NULL)
|
if (!pw_manager_object_is_virtual(o))
|
||||||
flags |= SOURCE_HARDWARE;
|
flags |= SOURCE_HARDWARE;
|
||||||
if ((str = spa_dict_lookup(info->props, PW_KEY_NODE_NETWORK)) != NULL)
|
if (pw_manager_object_is_network(o))
|
||||||
flags |= SOURCE_NETWORK;
|
flags |= SOURCE_NETWORK;
|
||||||
if (SPA_FLAG_IS_SET(dev_info.volume_info.flags, VOLUME_HW_VOLUME))
|
if (SPA_FLAG_IS_SET(dev_info.volume_info.flags, VOLUME_HW_VOLUME))
|
||||||
flags |= SOURCE_HW_VOLUME_CTRL;
|
flags |= SOURCE_HW_VOLUME_CTRL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue