mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	media-session: only replace : with space for node.nick
This commit is contained in:
		
							parent
							
								
									3b5e040659
								
							
						
					
					
						commit
						b23e33c99f
					
				
					 1 changed files with 22 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -203,6 +203,27 @@ static const struct sm_object_methods node_methods = {
 | 
			
		|||
	.release = node_release,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static SPA_PRINTF_FUNC(4,5) char *sanitize_nick(char *name, int size,
 | 
			
		||||
		char sub, const char *fmt, ...)
 | 
			
		||||
{
 | 
			
		||||
	char *p;
 | 
			
		||||
	va_list varargs;
 | 
			
		||||
 | 
			
		||||
	va_start(varargs, fmt);
 | 
			
		||||
	if (vsnprintf(name, size, fmt, varargs) < 0)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	va_end(varargs);
 | 
			
		||||
 | 
			
		||||
	for (p = name; *p; p++) {
 | 
			
		||||
		switch(*p) {
 | 
			
		||||
		case ':':
 | 
			
		||||
			*p = sub;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static struct node *alsa_create_node(struct device *device, uint32_t id,
 | 
			
		||||
		const struct spa_device_object_info *info)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -291,8 +312,7 @@ static struct node *alsa_create_node(struct device *device, uint32_t id,
 | 
			
		|||
			s = pw_properties_get(device->props, "alsa.card_name");
 | 
			
		||||
 | 
			
		||||
		pw_properties_set(node->props, PW_KEY_NODE_NICK,
 | 
			
		||||
			sm_media_session_sanitize_name(name, sizeof(name),
 | 
			
		||||
				' ', "%s", s));
 | 
			
		||||
			sanitize_nick(name, sizeof(name), ' ', "%s", s));
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	if (pw_properties_get(node->props, SPA_KEY_NODE_NAME) == NULL) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue