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
				
			
		| 
						 | 
				
			
			@ -278,7 +278,7 @@ static const struct spa_system_methods impl_system = {
 | 
			
		|||
	.signalfd_read = impl_signalfd_read,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **interface)
 | 
			
		||||
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -287,13 +287,11 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t type, void **i
 | 
			
		|||
 | 
			
		||||
	impl = (struct impl *) handle;
 | 
			
		||||
 | 
			
		||||
	switch (type) {
 | 
			
		||||
	case SPA_TYPE_INTERFACE_System:
 | 
			
		||||
	if (strcmp(type, SPA_TYPE_INTERFACE_System) == 0)
 | 
			
		||||
		*interface = &impl->system;
 | 
			
		||||
		break;
 | 
			
		||||
	default:
 | 
			
		||||
	else
 | 
			
		||||
		return -ENOENT;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -318,7 +316,6 @@ impl_init(const struct spa_handle_factory *factory,
 | 
			
		|||
	  uint32_t n_support)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl;
 | 
			
		||||
	uint32_t i;
 | 
			
		||||
 | 
			
		||||
	spa_return_val_if_fail(factory != NULL, -EINVAL);
 | 
			
		||||
	spa_return_val_if_fail(handle != NULL, -EINVAL);
 | 
			
		||||
| 
						 | 
				
			
			@ -332,13 +329,7 @@ impl_init(const struct spa_handle_factory *factory,
 | 
			
		|||
			SPA_VERSION_SYSTEM,
 | 
			
		||||
			&impl_system, impl);
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < n_support; i++) {
 | 
			
		||||
		switch (support[i].type) {
 | 
			
		||||
		case SPA_TYPE_INTERFACE_Log:
 | 
			
		||||
			impl->log = support[i].data;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	impl->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
 | 
			
		||||
 | 
			
		||||
	spa_log_debug(impl->log, NAME " %p: initialized", impl);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue