mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
impl-node: implement mode node.passive property values
The node.passive property can actually take true, in and out as values to mark what ports to make passive. Keep track of what port direction to make passive. Set the passive property also on ports and make all port inherit the property from the node first (based on direction) and then use the new port.passive property as an override. Make the link use the passive property from the ports that it links to check the passive state of the link.
This commit is contained in:
parent
b2ba946625
commit
99482f0166
5 changed files with 23 additions and 4 deletions
|
|
@ -1203,7 +1203,7 @@ struct pw_impl_link *pw_context_create_link(struct pw_context *context,
|
|||
|
||||
/* passive means that this link does not make the nodes active */
|
||||
str = pw_properties_get(properties, PW_KEY_LINK_PASSIVE);
|
||||
this->passive = str ? spa_atob(str) : output_node->passive | input_node->passive;
|
||||
this->passive = str ? spa_atob(str) : output->passive | input->passive;
|
||||
if (this->passive && str == NULL)
|
||||
pw_properties_set(properties, PW_KEY_LINK_PASSIVE, "true");
|
||||
|
||||
|
|
|
|||
|
|
@ -947,7 +947,15 @@ static void check_properties(struct pw_impl_node *node)
|
|||
recalc_reason = "link group changed";
|
||||
}
|
||||
|
||||
node->passive = pw_properties_get_bool(node->properties, PW_KEY_NODE_PASSIVE, false);
|
||||
if ((str = pw_properties_get(node->properties, PW_KEY_NODE_PASSIVE)) == NULL)
|
||||
str = "false";
|
||||
if (spa_streq(str, "out"))
|
||||
node->out_passive = true;
|
||||
else if (spa_streq(str, "in"))
|
||||
node->in_passive = true;
|
||||
else
|
||||
node->in_passive = node->out_passive = spa_atob(str);
|
||||
|
||||
node->want_driver = pw_properties_get_bool(node->properties, PW_KEY_NODE_WANT_DRIVER, false);
|
||||
node->always_process = pw_properties_get_bool(node->properties, PW_KEY_NODE_ALWAYS_PROCESS, false);
|
||||
|
||||
|
|
|
|||
|
|
@ -999,10 +999,18 @@ int pw_impl_port_add(struct pw_impl_port *port, struct pw_impl_node *node)
|
|||
}
|
||||
else {
|
||||
dir = port->direction == PW_DIRECTION_INPUT ? "in" : "out";
|
||||
|
||||
}
|
||||
pw_properties_set(port->properties, PW_KEY_PORT_DIRECTION, dir);
|
||||
|
||||
/* inherit passive state from parent node */
|
||||
if (port->direction == PW_DIRECTION_INPUT)
|
||||
port->passive = node->in_passive;
|
||||
else
|
||||
port->passive = node->out_passive;
|
||||
/* override with specific port property if available */
|
||||
port->passive = pw_properties_get_bool(port->properties, PW_KEY_PORT_PASSIVE,
|
||||
port->passive);
|
||||
|
||||
if (media_class != NULL &&
|
||||
(strstr(media_class, "Sink") != NULL ||
|
||||
strstr(media_class, "Source") != NULL))
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ extern "C" {
|
|||
#define PW_KEY_PORT_CACHE_PARAMS "port.cache-params" /**< cache the node port params */
|
||||
#define PW_KEY_PORT_EXTRA "port.extra" /**< api specific extra port info, API name
|
||||
* should be prefixed. "jack:flags:56" */
|
||||
#define PW_KEY_PORT_PASSIVE "port.passive" /**< the ports wants passive links, since 0.3.67 */
|
||||
|
||||
/** link properties */
|
||||
#define PW_KEY_LINK_ID "link.id" /**< a link id */
|
||||
|
|
|
|||
|
|
@ -686,7 +686,8 @@ struct pw_impl_node {
|
|||
* is selected to drive the graph */
|
||||
unsigned int visited:1; /**< for sorting */
|
||||
unsigned int want_driver:1; /**< this node wants to be assigned to a driver */
|
||||
unsigned int passive:1; /**< node links should be passive */
|
||||
unsigned int in_passive:1; /**< node input links should be passive */
|
||||
unsigned int out_passive:1; /**< node output links should be passive */
|
||||
unsigned int runnable:1; /**< node is runnable */
|
||||
unsigned int freewheel:1; /**< if this is the freewheel driver */
|
||||
unsigned int loopchecked:1; /**< for feedback loop checking */
|
||||
|
|
@ -859,6 +860,7 @@ struct pw_impl_port {
|
|||
} rt; /**< data only accessed from the data thread */
|
||||
unsigned int added:1;
|
||||
unsigned int destroying:1;
|
||||
unsigned int passive:1;
|
||||
int busy_count;
|
||||
|
||||
struct spa_latency_info latency[2]; /**< latencies */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue