mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	rename HAVE/NEED_BUFFER -> HAVE/NEED_DATA
It is more generic and works with control-only ports as well
This commit is contained in:
		
							parent
							
								
									d648ea4ad3
								
							
						
					
					
						commit
						8b85cc225e
					
				
					 40 changed files with 176 additions and 176 deletions
				
			
		| 
						 | 
				
			
			@ -428,11 +428,11 @@ static int impl_node_process(void *object)
 | 
			
		|||
	struct spa_buffer *buf;
 | 
			
		||||
	int res;
 | 
			
		||||
 | 
			
		||||
	if (d->io->status != SPA_STATUS_HAVE_BUFFER)
 | 
			
		||||
		return SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
	if (d->io->status != SPA_STATUS_HAVE_DATA)
 | 
			
		||||
		return SPA_STATUS_NEED_DATA;
 | 
			
		||||
 | 
			
		||||
	if (d->io->buffer_id >= d->n_buffers)
 | 
			
		||||
		return SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
		return SPA_STATUS_NEED_DATA;
 | 
			
		||||
 | 
			
		||||
	buf = d->buffers[d->io->buffer_id];
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -443,7 +443,7 @@ static int impl_node_process(void *object)
 | 
			
		|||
 | 
			
		||||
	update_param(d);
 | 
			
		||||
 | 
			
		||||
	return d->io->status = SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
	return d->io->status = SPA_STATUS_NEED_DATA;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct spa_node_methods impl_node = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -442,11 +442,11 @@ static int impl_node_process(void *object)
 | 
			
		|||
	od[0].chunk->stride = 0;
 | 
			
		||||
 | 
			
		||||
	io->buffer_id = b->id;
 | 
			
		||||
	io->status = SPA_STATUS_HAVE_BUFFER;
 | 
			
		||||
	io->status = SPA_STATUS_HAVE_DATA;
 | 
			
		||||
 | 
			
		||||
	update_volume(d);
 | 
			
		||||
 | 
			
		||||
	return SPA_STATUS_HAVE_BUFFER;
 | 
			
		||||
	return SPA_STATUS_HAVE_DATA;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct spa_node_methods impl_node = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -316,9 +316,9 @@ static int impl_node_process(void *object)
 | 
			
		|||
 | 
			
		||||
	handle_events(d);
 | 
			
		||||
 | 
			
		||||
	d->io->status = SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
	d->io->status = SPA_STATUS_NEED_DATA;
 | 
			
		||||
 | 
			
		||||
	return SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
	return SPA_STATUS_NEED_DATA;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct spa_node_methods impl_node = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -707,7 +707,7 @@ static int impl_node_process(void *object)
 | 
			
		|||
	spa_log_trace_fp(this->log, NAME " %p: status %p %d %d",
 | 
			
		||||
			this, outio, outio->status, outio->buffer_id);
 | 
			
		||||
 | 
			
		||||
	if (outio->status == SPA_STATUS_HAVE_BUFFER)
 | 
			
		||||
	if (outio->status == SPA_STATUS_HAVE_DATA)
 | 
			
		||||
		return outio->status;
 | 
			
		||||
 | 
			
		||||
	/* recycle */
 | 
			
		||||
| 
						 | 
				
			
			@ -729,7 +729,7 @@ static int impl_node_process(void *object)
 | 
			
		|||
		if (!inport->valid ||
 | 
			
		||||
		    (inio = inport->io) == NULL ||
 | 
			
		||||
		    inio->buffer_id >= inport->n_buffers ||
 | 
			
		||||
		    inio->status != SPA_STATUS_HAVE_BUFFER) {
 | 
			
		||||
		    inio->status != SPA_STATUS_HAVE_DATA) {
 | 
			
		||||
			spa_log_trace_fp(this->log, NAME " %p: skip input %d %d %p %d %d %d", this,
 | 
			
		||||
				i, inport->valid, inio,
 | 
			
		||||
				inio ? inio->status : -1,
 | 
			
		||||
| 
						 | 
				
			
			@ -746,7 +746,7 @@ static int impl_node_process(void *object)
 | 
			
		|||
		maxsize = SPA_MIN(inb->buffer->datas[0].chunk->size, maxsize);
 | 
			
		||||
 | 
			
		||||
		buffers[n_buffers++] = inb;
 | 
			
		||||
		inio->status = SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
		inio->status = SPA_STATUS_NEED_DATA;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	outb = dequeue_buffer(this, outport);
 | 
			
		||||
| 
						 | 
				
			
			@ -786,9 +786,9 @@ static int impl_node_process(void *object)
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	outio->buffer_id = outb->id;
 | 
			
		||||
	outio->status = SPA_STATUS_HAVE_BUFFER;
 | 
			
		||||
	outio->status = SPA_STATUS_HAVE_DATA;
 | 
			
		||||
 | 
			
		||||
	return SPA_STATUS_HAVE_BUFFER | SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
	return SPA_STATUS_HAVE_DATA | SPA_STATUS_NEED_DATA;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct spa_node_methods impl_node = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1074,7 +1074,7 @@ static void node_on_data_fd_events(struct spa_source *source)
 | 
			
		|||
			spa_log_warn(this->log, NAME" %p: read %"PRIu64" failed %m", this, cmd);
 | 
			
		||||
 | 
			
		||||
		spa_log_trace_fp(this->log, NAME" %p: got ready", this);
 | 
			
		||||
		spa_node_call_ready(&this->callbacks, SPA_STATUS_HAVE_BUFFER);
 | 
			
		||||
		spa_node_call_ready(&this->callbacks, SPA_STATUS_HAVE_DATA);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1325,7 +1325,7 @@ static int port_init_mix(void *data, struct pw_port_mix *mix)
 | 
			
		|||
	mix->io = SPA_MEMBER(impl->io_areas->map->ptr,
 | 
			
		||||
			mix->id * sizeof(struct spa_io_buffers), void);
 | 
			
		||||
	mix->io->buffer_id = SPA_ID_INVALID;
 | 
			
		||||
	mix->io->status = SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
	mix->io->status = SPA_STATUS_NEED_DATA;
 | 
			
		||||
 | 
			
		||||
	pw_log_debug(NAME " %p: init mix io %d %p %p", impl, mix->id, mix->io,
 | 
			
		||||
			impl->io_areas->map->ptr);
 | 
			
		||||
| 
						 | 
				
			
			@ -1453,7 +1453,7 @@ impl_mix_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
 | 
			
		|||
 | 
			
		||||
static int impl_mix_process(void *object)
 | 
			
		||||
{
 | 
			
		||||
	return SPA_STATUS_HAVE_BUFFER;
 | 
			
		||||
	return SPA_STATUS_HAVE_DATA;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct spa_node_methods impl_port_mix = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1044,7 +1044,7 @@ static int node_ready(void *d, int status)
 | 
			
		|||
	pw_log_trace("node %p: ready driver:%d exported:%d status:%d", node,
 | 
			
		||||
			node->driver, node->exported, status);
 | 
			
		||||
 | 
			
		||||
	if (status == SPA_STATUS_HAVE_BUFFER) {
 | 
			
		||||
	if (status == SPA_STATUS_HAVE_DATA) {
 | 
			
		||||
		spa_list_for_each(p, &node->rt.output_mix, rt.node_link)
 | 
			
		||||
			spa_node_process(p->mix);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1325,7 +1325,7 @@ struct pw_link *pw_link_new(struct pw_core *core,
 | 
			
		|||
	this->info.props = &this->properties->dict;
 | 
			
		||||
 | 
			
		||||
	impl->io.buffer_id = SPA_ID_INVALID;
 | 
			
		||||
	impl->io.status = SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
	impl->io.status = SPA_STATUS_NEED_DATA;
 | 
			
		||||
 | 
			
		||||
	pw_port_init_mix(output, &this->rt.out_mix);
 | 
			
		||||
	pw_port_init_mix(input, &this->rt.in_mix);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -844,7 +844,7 @@ static inline int process_node(void *data)
 | 
			
		|||
	status = spa_node_process(this->node);
 | 
			
		||||
	a->state[0].status = status;
 | 
			
		||||
 | 
			
		||||
	if (status & SPA_STATUS_HAVE_BUFFER) {
 | 
			
		||||
	if (status & SPA_STATUS_HAVE_DATA) {
 | 
			
		||||
		spa_list_for_each(p, &this->rt.output_mix, rt.node_link)
 | 
			
		||||
			spa_node_process(p->mix);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -1351,7 +1351,7 @@ static int node_ready(void *data, int status)
 | 
			
		|||
	if (node->driver && !node->master)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	if (status & SPA_STATUS_HAVE_BUFFER) {
 | 
			
		||||
	if (status & SPA_STATUS_HAVE_DATA) {
 | 
			
		||||
		spa_list_for_each(p, &node->rt.output_mix, rt.node_link)
 | 
			
		||||
			spa_node_process(p->mix);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -126,9 +126,9 @@ static int tee_process(void *object)
 | 
			
		|||
				mix->port.port_id, io, mix->io, mix->io->buffer_id);
 | 
			
		||||
		*mix->io = *io;
 | 
			
		||||
	}
 | 
			
		||||
	io->status = SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
	io->status = SPA_STATUS_NEED_DATA;
 | 
			
		||||
 | 
			
		||||
        return SPA_STATUS_HAVE_BUFFER | SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
        return SPA_STATUS_HAVE_DATA | SPA_STATUS_NEED_DATA;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int tee_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
 | 
			
		||||
| 
						 | 
				
			
			@ -156,16 +156,16 @@ static int schedule_mix_input(void *object)
 | 
			
		|||
	struct pw_port_mix *mix;
 | 
			
		||||
 | 
			
		||||
	if (PW_PORT_IS_CONTROL(this))
 | 
			
		||||
		return SPA_STATUS_HAVE_BUFFER | SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
		return SPA_STATUS_HAVE_DATA | SPA_STATUS_NEED_DATA;
 | 
			
		||||
 | 
			
		||||
	spa_list_for_each(mix, &this->rt.mix_list, rt_link) {
 | 
			
		||||
		pw_log_trace_fp(NAME" %p: mix input %d %p->%p %d %d", this,
 | 
			
		||||
				mix->port.port_id, mix->io, io, mix->io->status, mix->io->buffer_id);
 | 
			
		||||
		*io = *mix->io;
 | 
			
		||||
		mix->io->status = SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
		mix->io->status = SPA_STATUS_NEED_DATA;
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
        return SPA_STATUS_HAVE_BUFFER | SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
        return SPA_STATUS_HAVE_DATA | SPA_STATUS_NEED_DATA;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int schedule_mix_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
 | 
			
		||||
| 
						 | 
				
			
			@ -427,7 +427,7 @@ struct pw_port *pw_port_new(enum pw_direction direction,
 | 
			
		|||
 | 
			
		||||
	pw_map_init(&this->mix_port_map, 64, 64);
 | 
			
		||||
 | 
			
		||||
	this->rt.io.status = SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
	this->rt.io.status = SPA_STATUS_NEED_DATA;
 | 
			
		||||
 | 
			
		||||
	if (info)
 | 
			
		||||
		update_info(this, info);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -371,7 +371,7 @@ static int impl_send_command(void *object, const struct spa_command *command)
 | 
			
		|||
			pw_log_debug(NAME" %p: start %d", stream, impl->direction);
 | 
			
		||||
 | 
			
		||||
			if (impl->direction == SPA_DIRECTION_INPUT) {
 | 
			
		||||
				impl->io->status = SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
				impl->io->status = SPA_STATUS_NEED_DATA;
 | 
			
		||||
				impl->io->buffer_id = SPA_ID_INVALID;
 | 
			
		||||
			}
 | 
			
		||||
			else {
 | 
			
		||||
| 
						 | 
				
			
			@ -752,7 +752,7 @@ static int impl_node_process_input(void *object)
 | 
			
		|||
	pw_log_trace(NAME" %p: process in status:%d id:%d ticks:%"PRIu64" delay:%"PRIi64" size:%"PRIi64,
 | 
			
		||||
			stream, io->status, io->buffer_id, impl->time.ticks, impl->time.delay, size);
 | 
			
		||||
 | 
			
		||||
	if (io->status != SPA_STATUS_HAVE_BUFFER)
 | 
			
		||||
	if (io->status != SPA_STATUS_HAVE_DATA)
 | 
			
		||||
		goto done;
 | 
			
		||||
 | 
			
		||||
	if ((b = get_buffer(stream, io->buffer_id)) == NULL)
 | 
			
		||||
| 
						 | 
				
			
			@ -773,9 +773,9 @@ done:
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	io->buffer_id = b ? b->id : SPA_ID_INVALID;
 | 
			
		||||
	io->status = SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
	io->status = SPA_STATUS_NEED_DATA;
 | 
			
		||||
 | 
			
		||||
	return SPA_STATUS_HAVE_BUFFER;
 | 
			
		||||
	return SPA_STATUS_HAVE_DATA;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int impl_node_process_output(void *object)
 | 
			
		||||
| 
						 | 
				
			
			@ -792,7 +792,7 @@ again:
 | 
			
		|||
			io->status, io->buffer_id, impl->time.ticks, impl->time.delay);
 | 
			
		||||
 | 
			
		||||
	res = 0;
 | 
			
		||||
	if (io->status != SPA_STATUS_HAVE_BUFFER) {
 | 
			
		||||
	if (io->status != SPA_STATUS_HAVE_DATA) {
 | 
			
		||||
		/* recycle old buffer */
 | 
			
		||||
		if ((b = get_buffer(stream, io->buffer_id)) != NULL) {
 | 
			
		||||
			pw_log_trace(NAME" %p: recycle buffer %d", stream, b->id);
 | 
			
		||||
| 
						 | 
				
			
			@ -802,11 +802,11 @@ again:
 | 
			
		|||
		/* pop new buffer */
 | 
			
		||||
		if ((b = pop_queue(impl, &impl->queued)) != NULL) {
 | 
			
		||||
			io->buffer_id = b->id;
 | 
			
		||||
			io->status = SPA_STATUS_HAVE_BUFFER;
 | 
			
		||||
			io->status = SPA_STATUS_HAVE_DATA;
 | 
			
		||||
			pw_log_trace(NAME" %p: pop %d %p", stream, b->id, io);
 | 
			
		||||
		} else {
 | 
			
		||||
			io->buffer_id = SPA_ID_INVALID;
 | 
			
		||||
			io->status = SPA_STATUS_NEED_BUFFER;
 | 
			
		||||
			io->status = SPA_STATUS_NEED_DATA;
 | 
			
		||||
			pw_log_trace(NAME" %p: no more buffers %p", stream, io);
 | 
			
		||||
			if (impl->draining) {
 | 
			
		||||
				call_drained(impl);
 | 
			
		||||
| 
						 | 
				
			
			@ -818,7 +818,7 @@ again:
 | 
			
		|||
	if (!impl->draining && !SPA_FLAG_CHECK(impl->flags, PW_STREAM_FLAG_DRIVER)) {
 | 
			
		||||
		call_process(impl);
 | 
			
		||||
		if (spa_ringbuffer_get_read_index(&impl->queued.ring, &index) >= MIN_QUEUED &&
 | 
			
		||||
		    io->status == SPA_STATUS_NEED_BUFFER)
 | 
			
		||||
		    io->status == SPA_STATUS_NEED_DATA)
 | 
			
		||||
			goto again;
 | 
			
		||||
	}
 | 
			
		||||
exit:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue