mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	Make interface types a string
This is more in line with wayland and it allows us to create new interfaces in modules without having to add anything to the type enum. It also removes some lookups to map type_id to readable name in debug.
This commit is contained in:
		
							parent
							
								
									9657486a81
								
							
						
					
					
						commit
						f391353c7f
					
				
					 123 changed files with 791 additions and 1251 deletions
				
			
		| 
						 | 
				
			
			@ -195,7 +195,7 @@ static int client_endpoint_create_link(void *object, const struct spa_dict *prop
 | 
			
		|||
			goto exit;
 | 
			
		||||
		}
 | 
			
		||||
		obj = sm_media_session_find_object(impl->session, atoi(str));
 | 
			
		||||
		if (obj == NULL || obj->type != PW_TYPE_INTERFACE_Endpoint) {
 | 
			
		||||
		if (obj == NULL || strcmp(obj->type, PW_TYPE_INTERFACE_Endpoint) !=0) {
 | 
			
		||||
			pw_log_warn(NAME" %p: could not find endpoint %s (%p)", impl, str, obj);
 | 
			
		||||
			res = -EINVAL;
 | 
			
		||||
			goto exit;
 | 
			
		||||
| 
						 | 
				
			
			@ -707,15 +707,11 @@ static void session_create(void *data, struct sm_object *object)
 | 
			
		|||
	struct impl *impl = data;
 | 
			
		||||
	int res;
 | 
			
		||||
 | 
			
		||||
	switch (object->type) {
 | 
			
		||||
	case PW_TYPE_INTERFACE_Device:
 | 
			
		||||
	if (strcmp(object->type, PW_TYPE_INTERFACE_Device) == 0)
 | 
			
		||||
		res = handle_device(impl, object);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	default:
 | 
			
		||||
	else
 | 
			
		||||
		res = 0;
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (res < 0) {
 | 
			
		||||
		pw_log_warn(NAME" %p: can't handle global %d: %s", impl,
 | 
			
		||||
				object->id, spa_strerror(res));
 | 
			
		||||
| 
						 | 
				
			
			@ -726,16 +722,10 @@ static void session_remove(void *data, struct sm_object *object)
 | 
			
		|||
{
 | 
			
		||||
	struct impl *impl = data;
 | 
			
		||||
 | 
			
		||||
	switch (object->type) {
 | 
			
		||||
	case PW_TYPE_INTERFACE_Device:
 | 
			
		||||
	{
 | 
			
		||||
	if (strcmp(object->type, PW_TYPE_INTERFACE_Device) == 0) {
 | 
			
		||||
		struct device *device;
 | 
			
		||||
		if ((device = sm_object_get_data(object, SESSION_KEY)) != NULL)
 | 
			
		||||
			destroy_device(impl, device);
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	default:
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue