mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-04 15:10:20 +00:00
impl-node: Expose driver id in node.props
Makes it easier for clients to track what the current driver of a node is.
This commit is contained in:
parent
78fbe6f750
commit
db365ac855
|
@ -991,9 +991,9 @@ int pw_impl_node_set_driver(struct pw_impl_node *node, struct pw_impl_node *driv
|
|||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
||||
struct pw_impl_node *old = node->driver_node;
|
||||
bool was_driving;
|
||||
bool was_driving, no_driver = (driver == NULL);
|
||||
|
||||
if (driver == NULL)
|
||||
if (no_driver)
|
||||
driver = node;
|
||||
|
||||
spa_list_remove(&node->follower_link);
|
||||
|
@ -1033,6 +1033,18 @@ int pw_impl_node_set_driver(struct pw_impl_node *node, struct pw_impl_node *driv
|
|||
pw_impl_node_emit_peer_removed(old, node);
|
||||
pw_impl_node_emit_peer_added(driver, node);
|
||||
|
||||
if (no_driver) {
|
||||
/* We don't have a driver, so remove the property */
|
||||
pw_properties_set(node->properties, PW_KEY_NODE_DRIVER_ID, NULL);
|
||||
} else if (node->driver_node->global) {
|
||||
/* Expose the driver ID if it is available as a global */
|
||||
pw_properties_setf(node->properties, PW_KEY_NODE_DRIVER_ID, "%u",
|
||||
pw_global_get_id(node->driver_node->global));
|
||||
}
|
||||
|
||||
node->info.change_mask |= PW_NODE_CHANGE_MASK_PROPS;
|
||||
pw_impl_node_emit_info_changed(driver, &node->info);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -191,6 +191,8 @@ extern "C" {
|
|||
#define PW_KEY_NODE_CACHE_PARAMS "node.cache-params" /**< cache the node params */
|
||||
#define PW_KEY_NODE_TRANSPORT_SYNC "node.transport.sync" /**< the node handles transport sync */
|
||||
#define PW_KEY_NODE_DRIVER "node.driver" /**< node can drive the graph */
|
||||
#define PW_KEY_NODE_DRIVER_ID "node.driver-id" /**< the node id of the node assigned as driver
|
||||
* for this node */
|
||||
#define PW_KEY_NODE_ASYNC "node.async" /**< the node wants async scheduling */
|
||||
#define PW_KEY_NODE_LOOP_NAME "node.loop.name" /**< the loop name fnmatch pattern to run in */
|
||||
#define PW_KEY_NODE_LOOP_CLASS "node.loop.class" /**< the loop class fnmatch pattern to run in */
|
||||
|
|
Loading…
Reference in a new issue