mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	client-node: remove the area
Remove the share node area, we don't need it
This commit is contained in:
		
							parent
							
								
									2a159c04ff
								
							
						
					
					
						commit
						c547baf952
					
				
					 4 changed files with 9 additions and 42 deletions
				
			
		| 
						 | 
					@ -38,14 +38,6 @@ struct pw_client_node_proxy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_client_node_message;
 | 
					struct pw_client_node_message;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Shared structure between client and server \memberof pw_client_node */
 | 
					 | 
				
			||||||
struct pw_client_node_area {
 | 
					 | 
				
			||||||
	uint32_t max_input_ports;	/**< max input ports of the node */
 | 
					 | 
				
			||||||
	uint32_t n_input_ports;		/**< number of input ports of the node */
 | 
					 | 
				
			||||||
	uint32_t max_output_ports;	/**< max output ports of the node */
 | 
					 | 
				
			||||||
	uint32_t n_output_ports;	/**< number of output ports of the node */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/** \class pw_client_node_transport
 | 
					/** \class pw_client_node_transport
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * \brief Transport object
 | 
					 * \brief Transport object
 | 
				
			||||||
| 
						 | 
					@ -55,7 +47,6 @@ struct pw_client_node_area {
 | 
				
			||||||
 * lockfree way.
 | 
					 * lockfree way.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct pw_client_node_transport {
 | 
					struct pw_client_node_transport {
 | 
				
			||||||
	struct pw_client_node_area *area;	/**< the transport area */
 | 
					 | 
				
			||||||
	void *input_data;			/**< input memory for ringbuffer */
 | 
						void *input_data;			/**< input memory for ringbuffer */
 | 
				
			||||||
	struct spa_ringbuffer *input_buffer;	/**< ringbuffer for input memory */
 | 
						struct spa_ringbuffer *input_buffer;	/**< ringbuffer for input memory */
 | 
				
			||||||
	void *output_data;			/**< output memory for ringbuffer */
 | 
						void *output_data;			/**< output memory for ringbuffer */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -938,17 +938,6 @@ static int handle_node_message(struct node *this, struct pw_client_node_message
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void setup_transport(struct impl *impl)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	uint32_t max_inputs = 0, max_outputs = 0, n_inputs = 0, n_outputs = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spa_node_get_n_ports(&impl->node.node, &n_inputs, &max_inputs, &n_outputs, &max_outputs);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	impl->transport = pw_client_node_transport_new(max_inputs, max_outputs);
 | 
					 | 
				
			||||||
	impl->transport->area->n_input_ports = n_inputs;
 | 
					 | 
				
			||||||
	impl->transport->area->n_output_ports = n_outputs;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
client_node_done(void *data, int seq, int res)
 | 
					client_node_done(void *data, int seq, int res)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -956,7 +945,7 @@ client_node_done(void *data, int seq, int res)
 | 
				
			||||||
	struct node *this = &impl->node;
 | 
						struct node *this = &impl->node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (seq == 0 && res == 0 && impl->transport == NULL)
 | 
						if (seq == 0 && res == 0 && impl->transport == NULL)
 | 
				
			||||||
		setup_transport(impl);
 | 
							impl->transport = pw_client_node_transport_new();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->callbacks->done(this->callbacks_data, seq, res);
 | 
						this->callbacks->done(this->callbacks_data, seq, res);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1259,6 +1248,8 @@ static int port_init_mix(void *data, struct pw_port_mix *mix)
 | 
				
			||||||
	ioid = pw_map_insert_new(&impl->io_map, NULL);
 | 
						ioid = pw_map_insert_new(&impl->io_map, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mix->port.io = SPA_MEMBER(impl->io_areas->ptr, ioid * sizeof(struct spa_io_buffers), void);
 | 
						mix->port.io = SPA_MEMBER(impl->io_areas->ptr, ioid * sizeof(struct spa_io_buffers), void);
 | 
				
			||||||
 | 
						mix->port.io->buffer_id = SPA_ID_INVALID;
 | 
				
			||||||
 | 
						mix->port.io->status = SPA_STATUS_NEED_BUFFER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("client-node %p: init mix io %d %p", impl, ioid, mix->port.io);
 | 
						pw_log_debug("client-node %p: init mix io %d %p", impl, ioid, mix->port.io);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,11 +44,10 @@ struct transport {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
/** \endcond */
 | 
					/** \endcond */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static size_t area_get_size(struct pw_client_node_area *area)
 | 
					static size_t area_get_size(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	size_t size;
 | 
						size_t size;
 | 
				
			||||||
	size = sizeof(struct pw_client_node_area);
 | 
						size = sizeof(struct spa_ringbuffer);
 | 
				
			||||||
	size += sizeof(struct spa_ringbuffer);
 | 
					 | 
				
			||||||
	size += INPUT_BUFFER_SIZE;
 | 
						size += INPUT_BUFFER_SIZE;
 | 
				
			||||||
	size += sizeof(struct spa_ringbuffer);
 | 
						size += sizeof(struct spa_ringbuffer);
 | 
				
			||||||
	size += OUTPUT_BUFFER_SIZE;
 | 
						size += OUTPUT_BUFFER_SIZE;
 | 
				
			||||||
| 
						 | 
					@ -57,11 +56,6 @@ static size_t area_get_size(struct pw_client_node_area *area)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void transport_setup_area(void *p, struct pw_client_node_transport *trans)
 | 
					static void transport_setup_area(void *p, struct pw_client_node_transport *trans)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_client_node_area *a;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	trans->area = a = p;
 | 
					 | 
				
			||||||
	p = SPA_MEMBER(p, sizeof(struct pw_client_node_area), struct spa_io_buffers);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	trans->input_buffer = p;
 | 
						trans->input_buffer = p;
 | 
				
			||||||
	p = SPA_MEMBER(p, sizeof(struct spa_ringbuffer), void);
 | 
						p = SPA_MEMBER(p, sizeof(struct spa_ringbuffer), void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,28 +152,20 @@ static int parse_message(struct pw_client_node_transport *trans, void *message)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Create a new transport
 | 
					/** Create a new transport
 | 
				
			||||||
 * \param max_input_ports maximum number of input_ports
 | 
					 | 
				
			||||||
 * \param max_output_ports maximum number of output_ports
 | 
					 | 
				
			||||||
 * \return a newly allocated \ref pw_client_node_transport
 | 
					 * \return a newly allocated \ref pw_client_node_transport
 | 
				
			||||||
 * \memberof pw_client_node_transport
 | 
					 * \memberof pw_client_node_transport
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct pw_client_node_transport *
 | 
					struct pw_client_node_transport *
 | 
				
			||||||
pw_client_node_transport_new(uint32_t max_input_ports, uint32_t max_output_ports)
 | 
					pw_client_node_transport_new(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct transport *impl;
 | 
						struct transport *impl;
 | 
				
			||||||
	struct pw_client_node_transport *trans;
 | 
						struct pw_client_node_transport *trans;
 | 
				
			||||||
	struct pw_client_node_area area = { 0 };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	area.max_input_ports = max_input_ports;
 | 
					 | 
				
			||||||
	area.n_input_ports = 0;
 | 
					 | 
				
			||||||
	area.max_output_ports = max_output_ports;
 | 
					 | 
				
			||||||
	area.n_output_ports = 0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct transport));
 | 
						impl = calloc(1, sizeof(struct transport));
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("transport %p: new %d %d", impl, max_input_ports, max_output_ports);
 | 
						pw_log_debug("transport %p: new", impl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	trans = &impl->trans;
 | 
						trans = &impl->trans;
 | 
				
			||||||
	impl->offset = 0;
 | 
						impl->offset = 0;
 | 
				
			||||||
| 
						 | 
					@ -187,11 +173,10 @@ pw_client_node_transport_new(uint32_t max_input_ports, uint32_t max_output_ports
 | 
				
			||||||
	if (pw_memblock_alloc(PW_MEMBLOCK_FLAG_WITH_FD |
 | 
						if (pw_memblock_alloc(PW_MEMBLOCK_FLAG_WITH_FD |
 | 
				
			||||||
			  PW_MEMBLOCK_FLAG_MAP_READWRITE |
 | 
								  PW_MEMBLOCK_FLAG_MAP_READWRITE |
 | 
				
			||||||
			  PW_MEMBLOCK_FLAG_SEAL,
 | 
								  PW_MEMBLOCK_FLAG_SEAL,
 | 
				
			||||||
			  area_get_size(&area),
 | 
								  area_get_size(),
 | 
				
			||||||
			  &impl->mem) < 0)
 | 
								  &impl->mem) < 0)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	memcpy(impl->mem->ptr, &area, sizeof(struct pw_client_node_area));
 | 
					 | 
				
			||||||
	transport_setup_area(impl->mem->ptr, trans);
 | 
						transport_setup_area(impl->mem->ptr, trans);
 | 
				
			||||||
	transport_reset_area(trans);
 | 
						transport_reset_area(trans);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,7 +38,7 @@ struct pw_client_node_transport_info {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_client_node_transport *
 | 
					struct pw_client_node_transport *
 | 
				
			||||||
pw_client_node_transport_new(uint32_t max_input_ports, uint32_t max_output_ports);
 | 
					pw_client_node_transport_new(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_client_node_transport *
 | 
					struct pw_client_node_transport *
 | 
				
			||||||
pw_client_node_transport_new_from_info(struct pw_client_node_transport_info *info);
 | 
					pw_client_node_transport_new_from_info(struct pw_client_node_transport_info *info);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue