mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	v0: set media class
Set the media class on the client-node after we know the number of ports. Add more type mappings Fix change_mask on core_info
This commit is contained in:
		
							parent
							
								
									59c92bddba
								
							
						
					
					
						commit
						e9b62c0ce6
					
				
					 3 changed files with 37 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -903,6 +903,7 @@ static void setup_transport(struct impl *impl)
 | 
			
		|||
{
 | 
			
		||||
	struct node *this = &impl->node;
 | 
			
		||||
	uint32_t max_inputs = 0, max_outputs = 0, n_inputs = 0, n_outputs = 0;
 | 
			
		||||
	struct spa_dict_item items[1];
 | 
			
		||||
 | 
			
		||||
	n_inputs = this->n_inputs;
 | 
			
		||||
	max_inputs = this->info.max_input_ports == 0 ? this->n_inputs : this->info.max_input_ports;
 | 
			
		||||
| 
						 | 
				
			
			@ -912,6 +913,13 @@ static void setup_transport(struct impl *impl)
 | 
			
		|||
	impl->transport = pw_client_node0_transport_new(impl->context, max_inputs, max_outputs);
 | 
			
		||||
	impl->transport->area->n_input_ports = n_inputs;
 | 
			
		||||
	impl->transport->area->n_output_ports = n_outputs;
 | 
			
		||||
 | 
			
		||||
	if (n_inputs > 0) {
 | 
			
		||||
		items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_MEDIA_CLASS, "Stream/Input/Video");
 | 
			
		||||
	} else {
 | 
			
		||||
		items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_MEDIA_CLASS, "Stream/Output/Video");
 | 
			
		||||
	}
 | 
			
		||||
	pw_impl_node_update_properties(impl->this.node, &SPA_DICT_INIT(items, 1));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
| 
						 | 
				
			
			@ -1292,7 +1300,6 @@ struct pw_impl_client_node0 *pw_impl_client_node0_new(struct pw_resource *resour
 | 
			
		|||
	if ((name = pw_properties_get(properties, "node.name")) == NULL)
 | 
			
		||||
		name = "client-node";
 | 
			
		||||
	pw_properties_set(properties, PW_KEY_MEDIA_TYPE, "Video");
 | 
			
		||||
	pw_properties_set(properties, SPA_KEY_MEDIA_CLASS, "Stream/Duplex/Video");
 | 
			
		||||
 | 
			
		||||
	impl->node.resource = resource;
 | 
			
		||||
	this->resource = resource;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -75,22 +75,38 @@ static void core_marshal_info(void *object, const struct pw_core_info *info)
 | 
			
		|||
	struct pw_resource *resource = object;
 | 
			
		||||
	struct spa_pod_builder *b;
 | 
			
		||||
	uint32_t i, n_items;
 | 
			
		||||
	uint64_t change_mask = 0;
 | 
			
		||||
	struct spa_pod_frame f;
 | 
			
		||||
	struct pw_protocol_native_message *msg;
 | 
			
		||||
 | 
			
		||||
	b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_INFO, &msg);
 | 
			
		||||
 | 
			
		||||
#define PW_CORE_V0_CHANGE_MASK_USER_NAME  (1 << 0)
 | 
			
		||||
#define PW_CORE_V0_CHANGE_MASK_HOST_NAME  (1 << 1)
 | 
			
		||||
#define PW_CORE_V0_CHANGE_MASK_VERSION    (1 << 2)
 | 
			
		||||
#define PW_CORE_V0_CHANGE_MASK_NAME       (1 << 3)
 | 
			
		||||
#define PW_CORE_V0_CHANGE_MASK_COOKIE     (1 << 4)
 | 
			
		||||
#define PW_CORE_V0_CHANGE_MASK_PROPS      (1 << 5)
 | 
			
		||||
 | 
			
		||||
	if (msg->seq == 0) {
 | 
			
		||||
		update_types_server(resource);
 | 
			
		||||
		b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_INFO, &msg);
 | 
			
		||||
		change_mask |= PW_CORE_V0_CHANGE_MASK_USER_NAME |
 | 
			
		||||
			PW_CORE_V0_CHANGE_MASK_HOST_NAME |
 | 
			
		||||
			PW_CORE_V0_CHANGE_MASK_VERSION |
 | 
			
		||||
			PW_CORE_V0_CHANGE_MASK_NAME |
 | 
			
		||||
			PW_CORE_V0_CHANGE_MASK_COOKIE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	n_items = info->props ? info->props->n_items : 0;
 | 
			
		||||
 | 
			
		||||
	if (info->change_mask & PW_CORE_CHANGE_MASK_PROPS)
 | 
			
		||||
		change_mask |= PW_CORE_V0_CHANGE_MASK_PROPS;
 | 
			
		||||
 | 
			
		||||
        spa_pod_builder_push_struct(b, &f);
 | 
			
		||||
	spa_pod_builder_add(b,
 | 
			
		||||
			    "i", info->id,
 | 
			
		||||
			    "l", info->change_mask,
 | 
			
		||||
			    "l", change_mask,
 | 
			
		||||
			    "s", info->user_name,
 | 
			
		||||
			    "s", info->host_name,
 | 
			
		||||
			    "s", info->version,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,8 +17,18 @@ const struct type_info {
 | 
			
		|||
	{ "PipeWire:Interface:Link",  PW_TYPE_INFO_INTERFACE_BASE "Link", PW_TYPE_INTERFACE_Link, },
 | 
			
		||||
	{ "PipeWire:Interface:Client", PW_TYPE_INFO_INTERFACE_BASE "Client", PW_TYPE_INTERFACE_Client, },
 | 
			
		||||
	{ "PipeWire:Interface:Module", PW_TYPE_INFO_INTERFACE_BASE "Module", PW_TYPE_INTERFACE_Module, },
 | 
			
		||||
	{ "PipeWire:Interface:ClientNode", PW_TYPE_INFO_INTERFACE_BASE "ClientNode", PW_TYPE_INTERFACE_ClientNode, },
 | 
			
		||||
	{ "PipeWire:Interface:Device", PW_TYPE_INFO_INTERFACE_BASE "Device", PW_TYPE_INTERFACE_Device, },
 | 
			
		||||
 | 
			
		||||
	{ "PipeWire:Interface:Metadata", PW_TYPE_INFO_INTERFACE_BASE "Metadata", PW_TYPE_INTERFACE_Metadata, },
 | 
			
		||||
	{ "PipeWire:Interface:Session", PW_TYPE_INFO_INTERFACE_BASE "Session", PW_TYPE_INTERFACE_Session, },
 | 
			
		||||
	{ "PipeWire:Interface:Endpoint", PW_TYPE_INFO_INTERFACE_BASE "Endpoint", PW_TYPE_INTERFACE_Endpoint, },
 | 
			
		||||
	{ "PipeWire:Interface:EndpointStream", PW_TYPE_INFO_INTERFACE_BASE "EndpointStream", PW_TYPE_INTERFACE_EndpointStream, },
 | 
			
		||||
	{ "PipeWire:Interface:EndpointLink", PW_TYPE_INFO_INTERFACE_BASE "EndpointLink", PW_TYPE_INTERFACE_EndpointLink, },
 | 
			
		||||
 | 
			
		||||
	{ "PipeWire:Interface:ClientNode", PW_TYPE_INFO_INTERFACE_BASE "ClientNode", PW_TYPE_INTERFACE_ClientNode, },
 | 
			
		||||
	{ "PipeWire:Interface:ClientSession", PW_TYPE_INFO_INTERFACE_BASE "ClientSession", PW_TYPE_INTERFACE_ClientSession, },
 | 
			
		||||
	{ "PipeWire:Interface:ClientEndpoint", PW_TYPE_INFO_INTERFACE_BASE "ClientEndpoint", PW_TYPE_INTERFACE_ClientEndpoint, },
 | 
			
		||||
 | 
			
		||||
	{ "Spa:Interface:Node", SPA_TYPE_INFO_INTERFACE_BASE "Node", SPA_TYPE_INTERFACE_Node, },
 | 
			
		||||
	{ "Spa:Interface:Clock", },
 | 
			
		||||
	{ "Spa:Interface:Monitor", },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue