mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	cli: introspect device
This commit is contained in:
		
							parent
							
								
									5b303b5883
								
							
						
					
					
						commit
						10d277ce03
					
				
					 2 changed files with 41 additions and 0 deletions
				
			
		| 
						 | 
					@ -365,6 +365,9 @@ struct pw_device_info *pw_device_info_update(struct pw_device_info *info,
 | 
				
			||||||
			return NULL;
 | 
								return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	info->id = update->id;
 | 
						info->id = update->id;
 | 
				
			||||||
 | 
						if (info->name)
 | 
				
			||||||
 | 
							free((void *) info->name);
 | 
				
			||||||
 | 
						info->name = update->name ? strdup(update->name) : NULL;
 | 
				
			||||||
	info->change_mask = update->change_mask;
 | 
						info->change_mask = update->change_mask;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (update->change_mask & PW_CLIENT_CHANGE_MASK_PROPS) {
 | 
						if (update->change_mask & PW_CLIENT_CHANGE_MASK_PROPS) {
 | 
				
			||||||
| 
						 | 
					@ -377,6 +380,8 @@ struct pw_device_info *pw_device_info_update(struct pw_device_info *info,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void pw_device_info_free(struct pw_device_info *info)
 | 
					void pw_device_info_free(struct pw_device_info *info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if (info->name)
 | 
				
			||||||
 | 
							free((void *) info->name);
 | 
				
			||||||
	if (info->props)
 | 
						if (info->props)
 | 
				
			||||||
		pw_spa_dict_destroy(info->props);
 | 
							pw_spa_dict_destroy(info->props);
 | 
				
			||||||
	free(info);
 | 
						free(info);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -606,6 +606,15 @@ static void info_link(struct proxy_data *pd)
 | 
				
			||||||
	info->change_mask = 0;
 | 
						info->change_mask = 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void info_device(struct proxy_data *pd)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct pw_device_info *info = pd->info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						info_global(pd);
 | 
				
			||||||
 | 
						fprintf(stdout, "\tname: \"%s\"\n", info->name);
 | 
				
			||||||
 | 
						print_properties(info->props, MARK_CHANGE(0), true);
 | 
				
			||||||
 | 
						info->change_mask = 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void core_event_info(void *object, struct pw_core_info *info)
 | 
					static void core_event_info(void *object, struct pw_core_info *info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -781,6 +790,27 @@ static const struct pw_link_proxy_events link_events = {
 | 
				
			||||||
	.info = link_event_info
 | 
						.info = link_event_info
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void device_event_info(void *object, struct pw_device_info *info)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct proxy_data *pd = object;
 | 
				
			||||||
 | 
						struct remote_data *rd = pd->rd;
 | 
				
			||||||
 | 
						if (pd->info)
 | 
				
			||||||
 | 
							fprintf(stdout, "remote %d device %d changed\n", rd->id, info->id);
 | 
				
			||||||
 | 
						pd->info = pw_device_info_update(pd->info, info);
 | 
				
			||||||
 | 
						if (pd->global == NULL)
 | 
				
			||||||
 | 
							pd->global = pw_map_lookup(&rd->globals, info->id);
 | 
				
			||||||
 | 
						if (pd->global && pd->global->info_pending) {
 | 
				
			||||||
 | 
							info_device(pd);
 | 
				
			||||||
 | 
							pd->global->info_pending = false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const struct pw_device_proxy_events device_events = {
 | 
				
			||||||
 | 
						PW_VERSION_DEVICE_PROXY_EVENTS,
 | 
				
			||||||
 | 
						.info = device_event_info
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
destroy_proxy (void *data)
 | 
					destroy_proxy (void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -831,6 +861,12 @@ static bool bind_global(struct remote_data *rd, struct global *global, char **er
 | 
				
			||||||
		destroy = (pw_destroy_t) pw_module_info_free;
 | 
							destroy = (pw_destroy_t) pw_module_info_free;
 | 
				
			||||||
		info_func = info_module;
 | 
							info_func = info_module;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
						case PW_TYPE_INTERFACE_Device:
 | 
				
			||||||
 | 
							events = &device_events;
 | 
				
			||||||
 | 
							client_version = PW_VERSION_DEVICE;
 | 
				
			||||||
 | 
							destroy = (pw_destroy_t) pw_device_info_free;
 | 
				
			||||||
 | 
							info_func = info_device;
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
	case PW_TYPE_INTERFACE_Node:
 | 
						case PW_TYPE_INTERFACE_Node:
 | 
				
			||||||
		events = &node_events;
 | 
							events = &node_events;
 | 
				
			||||||
		client_version = PW_VERSION_NODE;
 | 
							client_version = PW_VERSION_NODE;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue