mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	alsa-udev: add property to emit ACP devices
This commit is contained in:
		
							parent
							
								
									bec950440b
								
							
						
					
					
						commit
						8cb1db5a61
					
				
					 1 changed files with 10 additions and 1 deletions
				
			
		| 
						 | 
					@ -68,6 +68,7 @@ struct impl {
 | 
				
			||||||
	uint32_t n_cards;
 | 
						uint32_t n_cards;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct spa_source source;
 | 
						struct spa_source source;
 | 
				
			||||||
 | 
						unsigned int use_acp:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int impl_udev_open(struct impl *this)
 | 
					static int impl_udev_open(struct impl *this)
 | 
				
			||||||
| 
						 | 
					@ -225,7 +226,9 @@ static int emit_object_info(struct impl *this, uint32_t id, struct udev_device *
 | 
				
			||||||
	info = SPA_DEVICE_OBJECT_INFO_INIT();
 | 
						info = SPA_DEVICE_OBJECT_INFO_INIT();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	info.type = SPA_TYPE_INTERFACE_Device;
 | 
						info.type = SPA_TYPE_INTERFACE_Device;
 | 
				
			||||||
	info.factory_name = SPA_NAME_API_ALSA_PCM_DEVICE;
 | 
						info.factory_name = this->use_acp ?
 | 
				
			||||||
 | 
							SPA_NAME_API_ALSA_ACP_DEVICE :
 | 
				
			||||||
 | 
							SPA_NAME_API_ALSA_PCM_DEVICE;
 | 
				
			||||||
	info.change_mask = SPA_DEVICE_OBJECT_CHANGE_MASK_FLAGS |
 | 
						info.change_mask = SPA_DEVICE_OBJECT_CHANGE_MASK_FLAGS |
 | 
				
			||||||
		SPA_DEVICE_OBJECT_CHANGE_MASK_PROPS;
 | 
							SPA_DEVICE_OBJECT_CHANGE_MASK_PROPS;
 | 
				
			||||||
	info.flags = 0;
 | 
						info.flags = 0;
 | 
				
			||||||
| 
						 | 
					@ -583,6 +586,7 @@ impl_init(const struct spa_handle_factory *factory,
 | 
				
			||||||
	  uint32_t n_support)
 | 
						  uint32_t n_support)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *this;
 | 
						struct impl *this;
 | 
				
			||||||
 | 
						const char *str;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_return_val_if_fail(factory != NULL, -EINVAL);
 | 
						spa_return_val_if_fail(factory != NULL, -EINVAL);
 | 
				
			||||||
	spa_return_val_if_fail(handle != NULL, -EINVAL);
 | 
						spa_return_val_if_fail(handle != NULL, -EINVAL);
 | 
				
			||||||
| 
						 | 
					@ -611,6 +615,11 @@ impl_init(const struct spa_handle_factory *factory,
 | 
				
			||||||
			SPA_DEVICE_CHANGE_MASK_PROPS;
 | 
								SPA_DEVICE_CHANGE_MASK_PROPS;
 | 
				
			||||||
	this->info.flags = 0;
 | 
						this->info.flags = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (info) {
 | 
				
			||||||
 | 
							if ((str = spa_dict_lookup(info, "alsa.use-acp")) != NULL)
 | 
				
			||||||
 | 
								this->use_acp = strcmp(str, "true") == 0 || atoi(str) != 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue