mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	export-spa: print node id
This commit is contained in:
		
							parent
							
								
									38bc80a3b8
								
							
						
					
					
						commit
						320dc203cf
					
				
					 1 changed files with 27 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -43,6 +43,25 @@ struct data {
 | 
			
		|||
	const char *library;
 | 
			
		||||
	const char *factory;
 | 
			
		||||
	const char *path;
 | 
			
		||||
 | 
			
		||||
	struct pw_proxy *proxy;
 | 
			
		||||
	struct spa_hook node_listener;
 | 
			
		||||
	uint32_t id;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void node_event_info(void *object, const struct pw_node_info *info)
 | 
			
		||||
{
 | 
			
		||||
	struct data *data = object;
 | 
			
		||||
 | 
			
		||||
	if (data->id != info->id) {
 | 
			
		||||
		printf("node id: %u\n", info->id);
 | 
			
		||||
		data->id = info->id;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct pw_node_proxy_events node_events = {
 | 
			
		||||
	PW_VERSION_NODE_PROXY_EVENTS,
 | 
			
		||||
	.info = node_event_info,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int make_node(struct data *data)
 | 
			
		||||
| 
						 | 
				
			
			@ -67,10 +86,17 @@ static int make_node(struct data *data)
 | 
			
		|||
					      PW_TYPE_INTERFACE_Node,
 | 
			
		||||
					      PW_VERSION_NODE_PROXY,
 | 
			
		||||
					      props, SPA_ID_INVALID);
 | 
			
		||||
	if (data->node == NULL)
 | 
			
		||||
		return -errno;
 | 
			
		||||
 | 
			
		||||
	pw_node_set_active(data->node, true);
 | 
			
		||||
 | 
			
		||||
	pw_remote_export(data->remote, PW_TYPE_INTERFACE_Node, NULL, data->node, 0);
 | 
			
		||||
	data->proxy = pw_remote_export(data->remote, PW_TYPE_INTERFACE_Node, NULL, data->node, 0);
 | 
			
		||||
	if (data->proxy == NULL)
 | 
			
		||||
		return -errno;
 | 
			
		||||
 | 
			
		||||
	pw_node_proxy_add_listener((struct pw_node_proxy*)data->proxy,
 | 
			
		||||
			&data->node_listener, &node_events, data);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue