mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	filter-chain: also allow control params with index
Allow specifying the control parameter by index instead of name.
This commit is contained in:
		
							parent
							
								
									ce8af10cfe
								
							
						
					
					
						commit
						6d081d5214
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
					@ -343,7 +343,7 @@ static struct port *find_port(struct node *node, const char *name, int descripto
 | 
				
			||||||
	char *col, *node_name, *port_name, *str;
 | 
						char *col, *node_name, *port_name, *str;
 | 
				
			||||||
	struct port *ports;
 | 
						struct port *ports;
 | 
				
			||||||
	const struct fc_descriptor *d;
 | 
						const struct fc_descriptor *d;
 | 
				
			||||||
	uint32_t i, n_ports;
 | 
						uint32_t i, n_ports, port_id = SPA_ID_INVALID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	str = strdupa(name);
 | 
						str = strdupa(name);
 | 
				
			||||||
	col = strchr(str, ':');
 | 
						col = strchr(str, ':');
 | 
				
			||||||
| 
						 | 
					@ -359,6 +359,9 @@ static struct port *find_port(struct node *node, const char *name, int descripto
 | 
				
			||||||
	if (node == NULL)
 | 
						if (node == NULL)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!spa_atou32(port_name, &port_id, 0))
 | 
				
			||||||
 | 
							port_id = SPA_ID_INVALID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (FC_IS_PORT_INPUT(descriptor)) {
 | 
						if (FC_IS_PORT_INPUT(descriptor)) {
 | 
				
			||||||
		if (FC_IS_PORT_CONTROL(descriptor)) {
 | 
							if (FC_IS_PORT_CONTROL(descriptor)) {
 | 
				
			||||||
			ports = node->control_port;
 | 
								ports = node->control_port;
 | 
				
			||||||
| 
						 | 
					@ -381,7 +384,8 @@ static struct port *find_port(struct node *node, const char *name, int descripto
 | 
				
			||||||
	d = node->desc->desc;
 | 
						d = node->desc->desc;
 | 
				
			||||||
	for (i = 0; i < n_ports; i++) {
 | 
						for (i = 0; i < n_ports; i++) {
 | 
				
			||||||
		struct port *port = &ports[i];
 | 
							struct port *port = &ports[i];
 | 
				
			||||||
		if (spa_streq(d->ports[port->p].name, port_name))
 | 
							if (i == port_id ||
 | 
				
			||||||
 | 
							    spa_streq(d->ports[port->p].name, port_name))
 | 
				
			||||||
			return port;
 | 
								return port;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue