mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pw_link -> pw_impl_link
This commit is contained in:
		
							parent
							
								
									443a49947e
								
							
						
					
					
						commit
						b88741dbb9
					
				
					 8 changed files with 134 additions and 134 deletions
				
			
		| 
						 | 
				
			
			@ -59,7 +59,7 @@ struct factory_data {
 | 
			
		|||
struct link_data {
 | 
			
		||||
	struct factory_data *data;
 | 
			
		||||
	struct spa_list l;
 | 
			
		||||
	struct pw_link *link;
 | 
			
		||||
	struct pw_impl_link *link;
 | 
			
		||||
	struct spa_hook link_listener;
 | 
			
		||||
 | 
			
		||||
	struct pw_resource *resource;
 | 
			
		||||
| 
						 | 
				
			
			@ -115,7 +115,7 @@ static void link_initialized(void *data)
 | 
			
		|||
	struct pw_impl_client *client = pw_resource_get_client(ld->factory_resource);
 | 
			
		||||
	int res;
 | 
			
		||||
 | 
			
		||||
	ld->global = pw_link_get_global(ld->link);
 | 
			
		||||
	ld->global = pw_impl_link_get_global(ld->link);
 | 
			
		||||
	pw_global_add_listener(ld->global, &ld->global_listener, &global_events, ld);
 | 
			
		||||
 | 
			
		||||
	res = pw_global_bind(ld->global, client, PW_PERM_RWX, PW_VERSION_LINK_PROXY, ld->new_id);
 | 
			
		||||
| 
						 | 
				
			
			@ -136,8 +136,8 @@ error_bind:
 | 
			
		|||
	pw_resource_errorf(ld->factory_resource, res, "can't bind link: %s", spa_strerror(res));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct pw_link_events link_events = {
 | 
			
		||||
	PW_VERSION_LINK_EVENTS,
 | 
			
		||||
static const struct pw_impl_link_events link_events = {
 | 
			
		||||
	PW_VERSION_IMPL_LINK_EVENTS,
 | 
			
		||||
	.destroy = link_destroy,
 | 
			
		||||
	.initialized = link_initialized
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -183,7 +183,7 @@ static void *create_object(void *_data,
 | 
			
		|||
	struct pw_port *outport, *inport;
 | 
			
		||||
	struct pw_context *context;
 | 
			
		||||
	struct pw_global *global;
 | 
			
		||||
	struct pw_link *link;
 | 
			
		||||
	struct pw_impl_link *link;
 | 
			
		||||
	uint32_t output_node_id, input_node_id;
 | 
			
		||||
	uint32_t output_port_id, input_port_id;
 | 
			
		||||
	struct link_data *ld;
 | 
			
		||||
| 
						 | 
				
			
			@ -258,14 +258,14 @@ static void *create_object(void *_data,
 | 
			
		|||
		pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	link = pw_link_new(context, outport, inport, NULL, properties, sizeof(struct link_data));
 | 
			
		||||
	link = pw_impl_link_new(context, outport, inport, NULL, properties, sizeof(struct link_data));
 | 
			
		||||
	properties = NULL;
 | 
			
		||||
	if (link == NULL) {
 | 
			
		||||
		res = -errno;
 | 
			
		||||
		goto error_create_link;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ld = pw_link_get_user_data(link);
 | 
			
		||||
	ld = pw_impl_link_get_user_data(link);
 | 
			
		||||
	ld->data = d;
 | 
			
		||||
	ld->factory_resource = resource;
 | 
			
		||||
	ld->link = link;
 | 
			
		||||
| 
						 | 
				
			
			@ -273,8 +273,8 @@ static void *create_object(void *_data,
 | 
			
		|||
	ld->linger = linger;
 | 
			
		||||
	spa_list_append(&d->link_list, &ld->l);
 | 
			
		||||
 | 
			
		||||
	pw_link_add_listener(link, &ld->link_listener, &link_events, ld);
 | 
			
		||||
	if ((res = pw_link_register(link, NULL)) < 0)
 | 
			
		||||
	pw_impl_link_add_listener(link, &ld->link_listener, &link_events, ld);
 | 
			
		||||
	if ((res = pw_impl_link_register(link, NULL)) < 0)
 | 
			
		||||
		goto error_link_register;
 | 
			
		||||
 | 
			
		||||
	return link;
 | 
			
		||||
| 
						 | 
				
			
			@ -332,7 +332,7 @@ static void module_destroy(void *data)
 | 
			
		|||
	spa_hook_remove(&d->module_listener);
 | 
			
		||||
 | 
			
		||||
	spa_list_for_each_safe(ld, t, &d->link_list, l)
 | 
			
		||||
		pw_link_destroy(ld->link);
 | 
			
		||||
		pw_impl_link_destroy(ld->link);
 | 
			
		||||
 | 
			
		||||
	pw_impl_factory_destroy(d->this);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1095,7 +1095,7 @@ static int collect_nodes(struct pw_node *driver)
 | 
			
		|||
	struct spa_list queue;
 | 
			
		||||
	struct pw_node *n, *t;
 | 
			
		||||
	struct pw_port *p;
 | 
			
		||||
	struct pw_link *l;
 | 
			
		||||
	struct pw_impl_link *l;
 | 
			
		||||
	uint32_t max_quantum = 0;
 | 
			
		||||
	uint32_t min_quantum = 0;
 | 
			
		||||
	uint32_t quantum;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,7 +45,7 @@
 | 
			
		|||
 | 
			
		||||
/** \cond */
 | 
			
		||||
struct impl {
 | 
			
		||||
	struct pw_link this;
 | 
			
		||||
	struct pw_impl_link this;
 | 
			
		||||
 | 
			
		||||
	unsigned int prepare:1;
 | 
			
		||||
	unsigned int io_set:1;
 | 
			
		||||
| 
						 | 
				
			
			@ -75,7 +75,7 @@ struct resource_data {
 | 
			
		|||
 | 
			
		||||
/** \endcond */
 | 
			
		||||
 | 
			
		||||
static void debug_link(struct pw_link *link)
 | 
			
		||||
static void debug_link(struct pw_impl_link *link)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_node *in = link->input->node, *out = link->output->node;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -94,11 +94,11 @@ static void debug_link(struct pw_link *link)
 | 
			
		|||
			in->idle_used_output_links);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void info_changed(struct pw_link *link)
 | 
			
		||||
static void info_changed(struct pw_impl_link *link)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_resource *resource;
 | 
			
		||||
 | 
			
		||||
	pw_link_emit_info_changed(link, &link->info);
 | 
			
		||||
	pw_impl_link_emit_info_changed(link, &link->info);
 | 
			
		||||
 | 
			
		||||
	if (link->global)
 | 
			
		||||
		spa_list_for_each(resource, &link->global->resource_list, link)
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +107,7 @@ static void info_changed(struct pw_link *link)
 | 
			
		|||
	link->info.change_mask = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void pw_link_update_state(struct pw_link *link, enum pw_link_state state, char *error)
 | 
			
		||||
static void pw_impl_link_update_state(struct pw_impl_link *link, enum pw_link_state state, char *error)
 | 
			
		||||
{
 | 
			
		||||
	enum pw_link_state old = link->info.state;
 | 
			
		||||
	struct pw_node *in = link->input->node, *out = link->output->node;
 | 
			
		||||
| 
						 | 
				
			
			@ -127,7 +127,7 @@ static void pw_link_update_state(struct pw_link *link, enum pw_link_state state,
 | 
			
		|||
	free((char*)link->info.error);
 | 
			
		||||
	link->info.error = error;
 | 
			
		||||
 | 
			
		||||
	pw_link_emit_state_changed(link, old, state, error);
 | 
			
		||||
	pw_impl_link_emit_state_changed(link, old, state, error);
 | 
			
		||||
 | 
			
		||||
	link->info.change_mask |= PW_LINK_CHANGE_MASK_STATE;
 | 
			
		||||
	info_changed(link);
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +141,7 @@ static void pw_link_update_state(struct pw_link *link, enum pw_link_state state,
 | 
			
		|||
		if (++in->n_ready_input_links == in->n_used_input_links &&
 | 
			
		||||
		    in->n_ready_output_links == in->n_used_output_links)
 | 
			
		||||
			pw_node_set_state(in, PW_NODE_STATE_RUNNING);
 | 
			
		||||
		pw_link_activate(link);
 | 
			
		||||
		pw_impl_link_activate(link);
 | 
			
		||||
	}
 | 
			
		||||
	else if (old == PW_LINK_STATE_PAUSED && state < PW_LINK_STATE_PAUSED) {
 | 
			
		||||
		if (--out->n_ready_output_links == 0 &&
 | 
			
		||||
| 
						 | 
				
			
			@ -156,7 +156,7 @@ static void pw_link_update_state(struct pw_link *link, enum pw_link_state state,
 | 
			
		|||
static void complete_ready(void *obj, void *data, int res, uint32_t id)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_port *port = obj;
 | 
			
		||||
	struct pw_link *this = data;
 | 
			
		||||
	struct pw_impl_link *this = data;
 | 
			
		||||
 | 
			
		||||
	pw_log_debug(NAME" %p: obj:%p port %p complete READY: %s", this, obj, port, spa_strerror(res));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -167,13 +167,13 @@ static void complete_ready(void *obj, void *data, int res, uint32_t id)
 | 
			
		|||
	}
 | 
			
		||||
	if (this->input->state >= PW_PORT_STATE_READY &&
 | 
			
		||||
	    this->output->state >= PW_PORT_STATE_READY)
 | 
			
		||||
		pw_link_update_state(this, PW_LINK_STATE_ALLOCATING, NULL);
 | 
			
		||||
		pw_impl_link_update_state(this, PW_LINK_STATE_ALLOCATING, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void complete_paused(void *obj, void *data, int res, uint32_t id)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_port *port = obj;
 | 
			
		||||
	struct pw_link *this = data;
 | 
			
		||||
	struct pw_impl_link *this = data;
 | 
			
		||||
	struct pw_port_mix *mix = port == this->input ? &this->rt.in_mix : &this->rt.out_mix;
 | 
			
		||||
 | 
			
		||||
	pw_log_debug(NAME" %p: obj:%p port %p complete PAUSED: %s", this, obj, port, spa_strerror(res));
 | 
			
		||||
| 
						 | 
				
			
			@ -186,10 +186,10 @@ static void complete_paused(void *obj, void *data, int res, uint32_t id)
 | 
			
		|||
		mix->have_buffers = false;
 | 
			
		||||
	}
 | 
			
		||||
	if (this->rt.in_mix.have_buffers && this->rt.out_mix.have_buffers)
 | 
			
		||||
		pw_link_update_state(this, PW_LINK_STATE_PAUSED, NULL);
 | 
			
		||||
		pw_impl_link_update_state(this, PW_LINK_STATE_PAUSED, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int do_negotiate(struct pw_link *this)
 | 
			
		||||
static int do_negotiate(struct pw_impl_link *this)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
 | 
			
		||||
	int res = -EIO, res2;
 | 
			
		||||
| 
						 | 
				
			
			@ -216,7 +216,7 @@ static int do_negotiate(struct pw_link *this)
 | 
			
		|||
	if (in_state != PW_PORT_STATE_CONFIGURE && out_state != PW_PORT_STATE_CONFIGURE)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	pw_link_update_state(this, PW_LINK_STATE_NEGOTIATING, NULL);
 | 
			
		||||
	pw_impl_link_update_state(this, PW_LINK_STATE_NEGOTIATING, NULL);
 | 
			
		||||
 | 
			
		||||
	input = this->input;
 | 
			
		||||
	output = this->output;
 | 
			
		||||
| 
						 | 
				
			
			@ -355,12 +355,12 @@ static int do_negotiate(struct pw_link *this)
 | 
			
		|||
	return res;
 | 
			
		||||
 | 
			
		||||
error:
 | 
			
		||||
	pw_link_update_state(this, PW_LINK_STATE_ERROR, error);
 | 
			
		||||
	pw_impl_link_update_state(this, PW_LINK_STATE_ERROR, error);
 | 
			
		||||
	free(format);
 | 
			
		||||
	return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int port_set_io(struct pw_link *this, struct pw_port *port, uint32_t id,
 | 
			
		||||
static int port_set_io(struct pw_impl_link *this, struct pw_port *port, uint32_t id,
 | 
			
		||||
		void *data, size_t size, struct pw_port_mix *mix)
 | 
			
		||||
{
 | 
			
		||||
	int res = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -383,7 +383,7 @@ static int port_set_io(struct pw_link *this, struct pw_port *port, uint32_t id,
 | 
			
		|||
	return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int select_io(struct pw_link *this)
 | 
			
		||||
static int select_io(struct pw_impl_link *this)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
 | 
			
		||||
	struct spa_io_buffers *io;
 | 
			
		||||
| 
						 | 
				
			
			@ -402,7 +402,7 @@ static int select_io(struct pw_link *this)
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int do_allocation(struct pw_link *this)
 | 
			
		||||
static int do_allocation(struct pw_impl_link *this)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
 | 
			
		||||
	int res;
 | 
			
		||||
| 
						 | 
				
			
			@ -418,7 +418,7 @@ static int do_allocation(struct pw_link *this)
 | 
			
		|||
 | 
			
		||||
	pw_log_debug(NAME" %p: out-state:%d in-state:%d", this, output->state, input->state);
 | 
			
		||||
 | 
			
		||||
	pw_link_update_state(this, PW_LINK_STATE_ALLOCATING, NULL);
 | 
			
		||||
	pw_impl_link_update_state(this, PW_LINK_STATE_ALLOCATING, NULL);
 | 
			
		||||
 | 
			
		||||
	out_flags = output->spa_flags;
 | 
			
		||||
	in_flags = input->spa_flags;
 | 
			
		||||
| 
						 | 
				
			
			@ -499,7 +499,7 @@ static int do_allocation(struct pw_link *this)
 | 
			
		|||
 | 
			
		||||
error:
 | 
			
		||||
	pw_buffers_clear(&output->buffers);
 | 
			
		||||
	pw_link_update_state(this, PW_LINK_STATE_ERROR, error);
 | 
			
		||||
	pw_impl_link_update_state(this, PW_LINK_STATE_ERROR, error);
 | 
			
		||||
	return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -507,7 +507,7 @@ static int
 | 
			
		|||
do_activate_link(struct spa_loop *loop,
 | 
			
		||||
		 bool async, uint32_t seq, const void *data, size_t size, void *user_data)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_link *this = user_data;
 | 
			
		||||
	struct pw_impl_link *this = user_data;
 | 
			
		||||
	struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
 | 
			
		||||
 | 
			
		||||
	pw_log_trace(NAME" %p: activate", this);
 | 
			
		||||
| 
						 | 
				
			
			@ -527,7 +527,7 @@ do_activate_link(struct spa_loop *loop,
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int pw_link_activate(struct pw_link *this)
 | 
			
		||||
int pw_impl_link_activate(struct pw_impl_link *this)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
 | 
			
		||||
	int res;
 | 
			
		||||
| 
						 | 
				
			
			@ -537,7 +537,7 @@ int pw_link_activate(struct pw_link *this)
 | 
			
		|||
	if (impl->activated)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	pw_link_prepare(this);
 | 
			
		||||
	pw_impl_link_prepare(this);
 | 
			
		||||
 | 
			
		||||
	if (!impl->io_set) {
 | 
			
		||||
		if ((res = port_set_io(this, this->output, SPA_IO_Buffers, this->io,
 | 
			
		||||
| 
						 | 
				
			
			@ -559,7 +559,7 @@ int pw_link_activate(struct pw_link *this)
 | 
			
		|||
}
 | 
			
		||||
static void check_states(void *obj, void *user_data, int res, uint32_t id)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_link *this = obj;
 | 
			
		||||
	struct pw_impl_link *this = obj;
 | 
			
		||||
	struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
 | 
			
		||||
	int in_state, out_state;
 | 
			
		||||
	struct pw_port *input, *output;
 | 
			
		||||
| 
						 | 
				
			
			@ -574,7 +574,7 @@ static void check_states(void *obj, void *user_data, int res, uint32_t id)
 | 
			
		|||
	input = this->input;
 | 
			
		||||
 | 
			
		||||
	if (output == NULL || input == NULL) {
 | 
			
		||||
		pw_link_update_state(this, PW_LINK_STATE_ERROR,
 | 
			
		||||
		pw_impl_link_update_state(this, PW_LINK_STATE_ERROR,
 | 
			
		||||
				strdup(NAME" without input or output port"));
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -593,14 +593,14 @@ static void check_states(void *obj, void *user_data, int res, uint32_t id)
 | 
			
		|||
	pw_log_debug(NAME" %p: output state %d, input state %d", this, out_state, in_state);
 | 
			
		||||
 | 
			
		||||
	if (out_state == PW_PORT_STATE_ERROR || in_state == PW_PORT_STATE_ERROR) {
 | 
			
		||||
		pw_link_update_state(this, PW_LINK_STATE_ERROR, strdup("ports are in error"));
 | 
			
		||||
		pw_impl_link_update_state(this, PW_LINK_STATE_ERROR, strdup("ports are in error"));
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (PW_PORT_IS_CONTROL(output) && PW_PORT_IS_CONTROL(input)) {
 | 
			
		||||
		pw_port_update_state(output, PW_PORT_STATE_PAUSED, NULL);
 | 
			
		||||
		pw_port_update_state(input, PW_PORT_STATE_PAUSED, NULL);
 | 
			
		||||
		pw_link_update_state(this, PW_LINK_STATE_PAUSED, NULL);
 | 
			
		||||
		pw_impl_link_update_state(this, PW_LINK_STATE_PAUSED, NULL);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((res = do_negotiate(this)) != 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -619,7 +619,7 @@ exit:
 | 
			
		|||
			  this, -EBUSY, (pw_work_func_t) check_states, this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void input_remove(struct pw_link *this, struct pw_port *port)
 | 
			
		||||
static void input_remove(struct pw_impl_link *this, struct pw_port *port)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = (struct impl *) this;
 | 
			
		||||
	struct pw_port_mix *mix = &this->rt.in_mix;
 | 
			
		||||
| 
						 | 
				
			
			@ -640,7 +640,7 @@ static void input_remove(struct pw_link *this, struct pw_port *port)
 | 
			
		|||
	this->input = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void output_remove(struct pw_link *this, struct pw_port *port)
 | 
			
		||||
static void output_remove(struct pw_impl_link *this, struct pw_port *port)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = (struct impl *) this;
 | 
			
		||||
	struct pw_port_mix *mix = &this->rt.out_mix;
 | 
			
		||||
| 
						 | 
				
			
			@ -660,13 +660,13 @@ static void output_remove(struct pw_link *this, struct pw_port *port)
 | 
			
		|||
	this->output = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void on_port_destroy(struct pw_link *this, struct pw_port *port)
 | 
			
		||||
static void on_port_destroy(struct pw_impl_link *this, struct pw_port *port)
 | 
			
		||||
{
 | 
			
		||||
	pw_log_debug(NAME" %p: port %p", this, port);
 | 
			
		||||
	pw_link_emit_port_unlinked(this, port);
 | 
			
		||||
	pw_impl_link_emit_port_unlinked(this, port);
 | 
			
		||||
 | 
			
		||||
	pw_link_update_state(this, PW_LINK_STATE_UNLINKED, NULL);
 | 
			
		||||
	pw_link_destroy(this);
 | 
			
		||||
	pw_impl_link_update_state(this, PW_LINK_STATE_UNLINKED, NULL);
 | 
			
		||||
	pw_impl_link_destroy(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void input_port_destroy(void *data)
 | 
			
		||||
| 
						 | 
				
			
			@ -681,7 +681,7 @@ static void output_port_destroy(void *data)
 | 
			
		|||
	on_port_destroy(&impl->this, impl->this.output);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int pw_link_prepare(struct pw_link *this)
 | 
			
		||||
int pw_impl_link_prepare(struct pw_impl_link *this)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -713,7 +713,7 @@ static int
 | 
			
		|||
do_deactivate_link(struct spa_loop *loop,
 | 
			
		||||
		   bool async, uint32_t seq, const void *data, size_t size, void *user_data)
 | 
			
		||||
{
 | 
			
		||||
        struct pw_link *this = user_data;
 | 
			
		||||
        struct pw_impl_link *this = user_data;
 | 
			
		||||
	struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
 | 
			
		||||
 | 
			
		||||
	pw_log_trace(NAME" %p: disable %p and %p", this, &this->rt.in_mix, &this->rt.out_mix);
 | 
			
		||||
| 
						 | 
				
			
			@ -733,7 +733,7 @@ do_deactivate_link(struct spa_loop *loop,
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int pw_link_deactivate(struct pw_link *this)
 | 
			
		||||
int pw_impl_link_deactivate(struct pw_impl_link *this)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
 | 
			
		||||
	struct pw_node *input_node, *output_node;
 | 
			
		||||
| 
						 | 
				
			
			@ -784,7 +784,7 @@ int pw_link_deactivate(struct pw_link *this)
 | 
			
		|||
				this->output, this->output->state, PW_PORT_STATE_PAUSED);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pw_link_update_state(this, PW_LINK_STATE_INIT, NULL);
 | 
			
		||||
	pw_impl_link_update_state(this, PW_LINK_STATE_INIT, NULL);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -804,7 +804,7 @@ static int
 | 
			
		|||
global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
 | 
			
		||||
	       uint32_t version, uint32_t id)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_link *this = _data;
 | 
			
		||||
	struct pw_impl_link *this = _data;
 | 
			
		||||
	struct pw_global *global = this->global;
 | 
			
		||||
	struct pw_resource *resource;
 | 
			
		||||
	struct resource_data *data;
 | 
			
		||||
| 
						 | 
				
			
			@ -832,12 +832,12 @@ error_resource:
 | 
			
		|||
	return -errno;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void port_state_changed(struct pw_link *this, struct pw_port *port, struct pw_port *other,
 | 
			
		||||
static void port_state_changed(struct pw_impl_link *this, struct pw_port *port, struct pw_port *other,
 | 
			
		||||
			enum pw_port_state state, const char *error)
 | 
			
		||||
{
 | 
			
		||||
	switch (state) {
 | 
			
		||||
	case PW_PORT_STATE_ERROR:
 | 
			
		||||
		pw_link_update_state(this, PW_LINK_STATE_ERROR, error ? strdup(error) : NULL);
 | 
			
		||||
		pw_impl_link_update_state(this, PW_LINK_STATE_ERROR, error ? strdup(error) : NULL);
 | 
			
		||||
		break;
 | 
			
		||||
	default:
 | 
			
		||||
		break;
 | 
			
		||||
| 
						 | 
				
			
			@ -848,7 +848,7 @@ static void input_port_state_changed(void *data, enum pw_port_state old,
 | 
			
		|||
			enum pw_port_state state, const char *error)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = data;
 | 
			
		||||
	struct pw_link *this = &impl->this;
 | 
			
		||||
	struct pw_impl_link *this = &impl->this;
 | 
			
		||||
	port_state_changed(this, this->input, this->output, state, error);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -856,7 +856,7 @@ static void output_port_state_changed(void *data, enum pw_port_state old,
 | 
			
		|||
			enum pw_port_state state, const char *error)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = data;
 | 
			
		||||
	struct pw_link *this = &impl->this;
 | 
			
		||||
	struct pw_impl_link *this = &impl->this;
 | 
			
		||||
	port_state_changed(this, this->output, this->input, state, error);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -916,7 +916,7 @@ static bool pw_node_can_reach(struct pw_node *output, struct pw_node *input)
 | 
			
		|||
		return true;
 | 
			
		||||
 | 
			
		||||
	spa_list_for_each(p, &output->output_ports, link) {
 | 
			
		||||
		struct pw_link *l;
 | 
			
		||||
		struct pw_impl_link *l;
 | 
			
		||||
 | 
			
		||||
		spa_list_for_each(l, &p->links, output_link) {
 | 
			
		||||
			if (l->feedback)
 | 
			
		||||
| 
						 | 
				
			
			@ -937,7 +937,7 @@ static bool pw_node_can_reach(struct pw_node *output, struct pw_node *input)
 | 
			
		|||
static void try_link_controls(struct impl *impl, struct pw_port *output, struct pw_port *input)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_control *cin, *cout;
 | 
			
		||||
	struct pw_link *this = &impl->this;
 | 
			
		||||
	struct pw_impl_link *this = &impl->this;
 | 
			
		||||
	uint32_t omix, imix;
 | 
			
		||||
	int res;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -965,7 +965,7 @@ static void try_link_controls(struct impl *impl, struct pw_port *output, struct
 | 
			
		|||
 | 
			
		||||
static void try_unlink_controls(struct impl *impl, struct pw_port *output, struct pw_port *input)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_link *this = &impl->this;
 | 
			
		||||
	struct pw_impl_link *this = &impl->this;
 | 
			
		||||
	int res;
 | 
			
		||||
 | 
			
		||||
	pw_log_debug(NAME" %p: unlinking controls", impl);
 | 
			
		||||
| 
						 | 
				
			
			@ -990,7 +990,7 @@ check_permission(struct pw_context *context,
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void permissions_changed(struct pw_link *this, struct pw_port *other,
 | 
			
		||||
static void permissions_changed(struct pw_impl_link *this, struct pw_port *other,
 | 
			
		||||
		struct pw_impl_client *client, uint32_t old, uint32_t new)
 | 
			
		||||
{
 | 
			
		||||
	uint32_t perm;
 | 
			
		||||
| 
						 | 
				
			
			@ -1001,7 +1001,7 @@ static void permissions_changed(struct pw_link *this, struct pw_port *other,
 | 
			
		|||
	pw_log_debug(NAME" %p: permissions changed %08x -> %08x", this, old, new);
 | 
			
		||||
 | 
			
		||||
	if (check_permission(this->context, this->output, this->input, this->properties) < 0) {
 | 
			
		||||
		pw_link_destroy(this);
 | 
			
		||||
		pw_impl_link_destroy(this);
 | 
			
		||||
	} else {
 | 
			
		||||
		pw_global_update_permissions(this->global, client, old, new);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -1010,7 +1010,7 @@ static void permissions_changed(struct pw_link *this, struct pw_port *other,
 | 
			
		|||
static void output_permissions_changed(void *data,
 | 
			
		||||
		struct pw_impl_client *client, uint32_t old, uint32_t new)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_link *this = data;
 | 
			
		||||
	struct pw_impl_link *this = data;
 | 
			
		||||
	permissions_changed(this, this->input, client, old, new);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1022,7 +1022,7 @@ static const struct pw_global_events output_global_events = {
 | 
			
		|||
static void input_permissions_changed(void *data,
 | 
			
		||||
		struct pw_impl_client *client, uint32_t old, uint32_t new)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_link *this = data;
 | 
			
		||||
	struct pw_impl_link *this = data;
 | 
			
		||||
	permissions_changed(this, this->output, client, old, new);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1032,7 +1032,7 @@ static const struct pw_global_events input_global_events = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
SPA_EXPORT
 | 
			
		||||
struct pw_link *pw_link_new(struct pw_context *context,
 | 
			
		||||
struct pw_impl_link *pw_impl_link_new(struct pw_context *context,
 | 
			
		||||
			    struct pw_port *output,
 | 
			
		||||
			    struct pw_port *input,
 | 
			
		||||
			    struct spa_pod *format_filter,
 | 
			
		||||
| 
						 | 
				
			
			@ -1040,7 +1040,7 @@ struct pw_link *pw_link_new(struct pw_context *context,
 | 
			
		|||
			    size_t user_data_size)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl;
 | 
			
		||||
	struct pw_link *this;
 | 
			
		||||
	struct pw_impl_link *this;
 | 
			
		||||
	struct pw_node *input_node, *output_node;
 | 
			
		||||
	const char *str;
 | 
			
		||||
	int res;
 | 
			
		||||
| 
						 | 
				
			
			@ -1052,7 +1052,7 @@ struct pw_link *pw_link_new(struct pw_context *context,
 | 
			
		|||
	    input->direction != PW_DIRECTION_INPUT)
 | 
			
		||||
		goto error_wrong_direction;
 | 
			
		||||
 | 
			
		||||
	if (pw_link_find(output, input))
 | 
			
		||||
	if (pw_impl_link_find(output, input))
 | 
			
		||||
		goto error_link_exists;
 | 
			
		||||
 | 
			
		||||
	if (check_permission(context, output, input, properties) < 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -1182,10 +1182,10 @@ error_exit:
 | 
			
		|||
 | 
			
		||||
static void global_destroy(void *object)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_link *link = object;
 | 
			
		||||
	struct pw_impl_link *link = object;
 | 
			
		||||
	spa_hook_remove(&link->global_listener);
 | 
			
		||||
	link->global = NULL;
 | 
			
		||||
	pw_link_destroy(link);
 | 
			
		||||
	pw_impl_link_destroy(link);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct pw_global_events global_events = {
 | 
			
		||||
| 
						 | 
				
			
			@ -1194,7 +1194,7 @@ static const struct pw_global_events global_events = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
SPA_EXPORT
 | 
			
		||||
int pw_link_register(struct pw_link *link,
 | 
			
		||||
int pw_impl_link_register(struct pw_impl_link *link,
 | 
			
		||||
		     struct pw_properties *properties)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_context *context = link->context;
 | 
			
		||||
| 
						 | 
				
			
			@ -1244,7 +1244,7 @@ int pw_link_register(struct pw_link *link,
 | 
			
		|||
	pw_properties_setf(link->properties, PW_KEY_OBJECT_ID, "%d", link->info.id);
 | 
			
		||||
	link->info.props = &link->properties->dict;
 | 
			
		||||
 | 
			
		||||
	pw_link_emit_initialized(link);
 | 
			
		||||
	pw_impl_link_emit_initialized(link);
 | 
			
		||||
 | 
			
		||||
	pw_global_add_listener(link->global, &link->global_listener, &global_events, link);
 | 
			
		||||
	pw_global_register(link->global);
 | 
			
		||||
| 
						 | 
				
			
			@ -1254,7 +1254,7 @@ int pw_link_register(struct pw_link *link,
 | 
			
		|||
	if ((input_node->n_used_input_links >= input_node->idle_used_input_links ||
 | 
			
		||||
	    output_node->n_used_output_links >= output_node->idle_used_output_links) &&
 | 
			
		||||
	    input_node->active && output_node->active)
 | 
			
		||||
		pw_link_prepare(link);
 | 
			
		||||
		pw_impl_link_prepare(link);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1265,14 +1265,14 @@ error_existed:
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
SPA_EXPORT
 | 
			
		||||
void pw_link_destroy(struct pw_link *link)
 | 
			
		||||
void pw_impl_link_destroy(struct pw_impl_link *link)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = SPA_CONTAINER_OF(link, struct impl, this);
 | 
			
		||||
 | 
			
		||||
	pw_log_debug(NAME" %p: destroy", impl);
 | 
			
		||||
	pw_link_emit_destroy(link);
 | 
			
		||||
	pw_impl_link_emit_destroy(link);
 | 
			
		||||
 | 
			
		||||
	pw_link_deactivate(link);
 | 
			
		||||
	pw_impl_link_deactivate(link);
 | 
			
		||||
 | 
			
		||||
	if (link->registered)
 | 
			
		||||
		spa_list_remove(&link->link);
 | 
			
		||||
| 
						 | 
				
			
			@ -1290,7 +1290,7 @@ void pw_link_destroy(struct pw_link *link)
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	pw_log_debug(NAME" %p: free", impl);
 | 
			
		||||
	pw_link_emit_free(link);
 | 
			
		||||
	pw_impl_link_emit_free(link);
 | 
			
		||||
 | 
			
		||||
	pw_work_queue_destroy(impl->work);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1303,18 +1303,18 @@ void pw_link_destroy(struct pw_link *link)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
SPA_EXPORT
 | 
			
		||||
void pw_link_add_listener(struct pw_link *link,
 | 
			
		||||
void pw_impl_link_add_listener(struct pw_impl_link *link,
 | 
			
		||||
			  struct spa_hook *listener,
 | 
			
		||||
			  const struct pw_link_events *events,
 | 
			
		||||
			  const struct pw_impl_link_events *events,
 | 
			
		||||
			  void *data)
 | 
			
		||||
{
 | 
			
		||||
	pw_log_debug(NAME" %p: add listener %p", link, listener);
 | 
			
		||||
	spa_hook_list_append(&link->listener_list, listener, events, data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct pw_link *pw_link_find(struct pw_port *output_port, struct pw_port *input_port)
 | 
			
		||||
struct pw_impl_link *pw_impl_link_find(struct pw_port *output_port, struct pw_port *input_port)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_link *pl;
 | 
			
		||||
	struct pw_impl_link *pl;
 | 
			
		||||
 | 
			
		||||
	spa_list_for_each(pl, &output_port->links, output_link) {
 | 
			
		||||
		if (pl->input == input_port)
 | 
			
		||||
| 
						 | 
				
			
			@ -1324,37 +1324,37 @@ struct pw_link *pw_link_find(struct pw_port *output_port, struct pw_port *input_
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
SPA_EXPORT
 | 
			
		||||
struct pw_context *pw_link_get_context(struct pw_link *link)
 | 
			
		||||
struct pw_context *pw_impl_link_get_context(struct pw_impl_link *link)
 | 
			
		||||
{
 | 
			
		||||
	return link->context;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SPA_EXPORT
 | 
			
		||||
void *pw_link_get_user_data(struct pw_link *link)
 | 
			
		||||
void *pw_impl_link_get_user_data(struct pw_impl_link *link)
 | 
			
		||||
{
 | 
			
		||||
	return link->user_data;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SPA_EXPORT
 | 
			
		||||
const struct pw_link_info *pw_link_get_info(struct pw_link *link)
 | 
			
		||||
const struct pw_link_info *pw_impl_link_get_info(struct pw_impl_link *link)
 | 
			
		||||
{
 | 
			
		||||
	return &link->info;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SPA_EXPORT
 | 
			
		||||
struct pw_global *pw_link_get_global(struct pw_link *link)
 | 
			
		||||
struct pw_global *pw_impl_link_get_global(struct pw_impl_link *link)
 | 
			
		||||
{
 | 
			
		||||
	return link->global;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SPA_EXPORT
 | 
			
		||||
struct pw_port *pw_link_get_output(struct pw_link *link)
 | 
			
		||||
struct pw_port *pw_impl_link_get_output(struct pw_impl_link *link)
 | 
			
		||||
{
 | 
			
		||||
	return link->output;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SPA_EXPORT
 | 
			
		||||
struct pw_port *pw_link_get_input(struct pw_link *link)
 | 
			
		||||
struct pw_port *pw_impl_link_get_input(struct pw_impl_link *link)
 | 
			
		||||
{
 | 
			
		||||
	return link->input;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,18 +22,18 @@
 | 
			
		|||
 * DEALINGS IN THE SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef PIPEWIRE_LINK_H
 | 
			
		||||
#define PIPEWIRE_LINK_H
 | 
			
		||||
#ifndef PIPEWIRE_IMPL_LINK_H
 | 
			
		||||
#define PIPEWIRE_IMPL_LINK_H
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/** \class pw_link
 | 
			
		||||
/** \class pw_impl_link
 | 
			
		||||
 *
 | 
			
		||||
 * PipeWire link object.
 | 
			
		||||
 */
 | 
			
		||||
struct pw_link;
 | 
			
		||||
struct pw_impl_link;
 | 
			
		||||
 | 
			
		||||
#include <pipewire/impl.h>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -48,9 +48,9 @@ struct pw_link;
 | 
			
		|||
 * the nodes.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/** link events added with \ref pw_link_add_listener */
 | 
			
		||||
struct pw_link_events {
 | 
			
		||||
#define PW_VERSION_LINK_EVENTS	0
 | 
			
		||||
/** link events added with \ref pw_impl_link_add_listener */
 | 
			
		||||
struct pw_impl_link_events {
 | 
			
		||||
#define PW_VERSION_IMPL_LINK_EVENTS	0
 | 
			
		||||
	uint32_t version;
 | 
			
		||||
 | 
			
		||||
	/** A link is destroyed */
 | 
			
		||||
| 
						 | 
				
			
			@ -75,53 +75,53 @@ struct pw_link_events {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/** Make a new link between two ports \memberof pw_link
 | 
			
		||||
/** Make a new link between two ports \memberof pw_impl_link
 | 
			
		||||
 * \return a newly allocated link */
 | 
			
		||||
struct pw_link *
 | 
			
		||||
pw_link_new(struct pw_context *context,		/**< the context object */
 | 
			
		||||
struct pw_impl_link *
 | 
			
		||||
pw_impl_link_new(struct pw_context *context,		/**< the context object */
 | 
			
		||||
	    struct pw_port *output,		/**< an output port */
 | 
			
		||||
	    struct pw_port *input,		/**< an input port */
 | 
			
		||||
	    struct spa_pod *format_filter,	/**< an optional format filter */
 | 
			
		||||
	    struct pw_properties *properties	/**< extra properties */,
 | 
			
		||||
	    size_t user_data_size		/**< extra user data size */);
 | 
			
		||||
 | 
			
		||||
/** Destroy a link \memberof pw_link */
 | 
			
		||||
void pw_link_destroy(struct pw_link *link);
 | 
			
		||||
/** Destroy a link \memberof pw_impl_link */
 | 
			
		||||
void pw_impl_link_destroy(struct pw_impl_link *link);
 | 
			
		||||
 | 
			
		||||
/** Add an event listener to \a link */
 | 
			
		||||
void pw_link_add_listener(struct pw_link *link,
 | 
			
		||||
void pw_impl_link_add_listener(struct pw_impl_link *link,
 | 
			
		||||
			  struct spa_hook *listener,
 | 
			
		||||
			  const struct pw_link_events *events,
 | 
			
		||||
			  const struct pw_impl_link_events *events,
 | 
			
		||||
			  void *data);
 | 
			
		||||
 | 
			
		||||
/** Finish link configuration and register */
 | 
			
		||||
int pw_link_register(struct pw_link *link,		/**< the link to register */
 | 
			
		||||
int pw_impl_link_register(struct pw_impl_link *link,		/**< the link to register */
 | 
			
		||||
		     struct pw_properties *properties	/**< extra properties */);
 | 
			
		||||
 | 
			
		||||
/** Get the context of a link */
 | 
			
		||||
struct pw_context *pw_link_get_context(struct pw_link *link);
 | 
			
		||||
struct pw_context *pw_impl_link_get_context(struct pw_impl_link *link);
 | 
			
		||||
 | 
			
		||||
/** Get the user_data of a link, the size of the memory is given when
 | 
			
		||||
  * constructing the link */
 | 
			
		||||
void *pw_link_get_user_data(struct pw_link *link);
 | 
			
		||||
void *pw_impl_link_get_user_data(struct pw_impl_link *link);
 | 
			
		||||
 | 
			
		||||
/** Get the link info */
 | 
			
		||||
const struct pw_link_info *pw_link_get_info(struct pw_link *link);
 | 
			
		||||
const struct pw_link_info *pw_impl_link_get_info(struct pw_impl_link *link);
 | 
			
		||||
 | 
			
		||||
/** Get the global of the link */
 | 
			
		||||
struct pw_global *pw_link_get_global(struct pw_link *link);
 | 
			
		||||
struct pw_global *pw_impl_link_get_global(struct pw_impl_link *link);
 | 
			
		||||
 | 
			
		||||
/** Get the output port of the link */
 | 
			
		||||
struct pw_port *pw_link_get_output(struct pw_link *link);
 | 
			
		||||
struct pw_port *pw_impl_link_get_output(struct pw_impl_link *link);
 | 
			
		||||
 | 
			
		||||
/** Get the input port of the link */
 | 
			
		||||
struct pw_port *pw_link_get_input(struct pw_link *link);
 | 
			
		||||
struct pw_port *pw_impl_link_get_input(struct pw_impl_link *link);
 | 
			
		||||
 | 
			
		||||
/** Find the link between 2 ports \memberof pw_link */
 | 
			
		||||
struct pw_link *pw_link_find(struct pw_port *output, struct pw_port *input);
 | 
			
		||||
/** Find the link between 2 ports \memberof pw_impl_link */
 | 
			
		||||
struct pw_impl_link *pw_impl_link_find(struct pw_port *output, struct pw_port *input);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* PIPEWIRE_LINK_H */
 | 
			
		||||
#endif /* PIPEWIRE_IMPL_LINK_H */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -75,16 +75,16 @@ struct resource_data {
 | 
			
		|||
static void node_deactivate(struct pw_node *this)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_port *port;
 | 
			
		||||
	struct pw_link *link;
 | 
			
		||||
	struct pw_impl_link *link;
 | 
			
		||||
 | 
			
		||||
	pw_log_debug(NAME" %p: deactivate", this);
 | 
			
		||||
	spa_list_for_each(port, &this->input_ports, link) {
 | 
			
		||||
		spa_list_for_each(link, &port->links, input_link)
 | 
			
		||||
			pw_link_deactivate(link);
 | 
			
		||||
			pw_impl_link_deactivate(link);
 | 
			
		||||
	}
 | 
			
		||||
	spa_list_for_each(port, &this->output_ports, link) {
 | 
			
		||||
		spa_list_for_each(link, &port->links, output_link)
 | 
			
		||||
			pw_link_deactivate(link);
 | 
			
		||||
			pw_impl_link_deactivate(link);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1734,14 +1734,14 @@ static void node_activate(struct pw_node *this)
 | 
			
		|||
 | 
			
		||||
	pw_log_debug(NAME" %p: activate", this);
 | 
			
		||||
	spa_list_for_each(port, &this->input_ports, link) {
 | 
			
		||||
		struct pw_link *link;
 | 
			
		||||
		struct pw_impl_link *link;
 | 
			
		||||
		spa_list_for_each(link, &port->links, input_link)
 | 
			
		||||
			pw_link_activate(link);
 | 
			
		||||
			pw_impl_link_activate(link);
 | 
			
		||||
	}
 | 
			
		||||
	spa_list_for_each(port, &this->output_ports, link) {
 | 
			
		||||
		struct pw_link *link;
 | 
			
		||||
		struct pw_impl_link *link;
 | 
			
		||||
		spa_list_for_each(link, &port->links, output_link)
 | 
			
		||||
			pw_link_activate(link);
 | 
			
		||||
			pw_impl_link_activate(link);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -919,9 +919,9 @@ int pw_port_add(struct pw_port *port, struct pw_node *node)
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int do_destroy_link(void *data, struct pw_link *link)
 | 
			
		||||
static int do_destroy_link(void *data, struct pw_impl_link *link)
 | 
			
		||||
{
 | 
			
		||||
	pw_link_destroy(link);
 | 
			
		||||
	pw_impl_link_destroy(link);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1113,10 +1113,10 @@ int pw_port_for_each_filtered_param(struct pw_port *in_port,
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
int pw_port_for_each_link(struct pw_port *port,
 | 
			
		||||
			  int (*callback) (void *data, struct pw_link *link),
 | 
			
		||||
			  int (*callback) (void *data, struct pw_impl_link *link),
 | 
			
		||||
			  void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct pw_link *l, *t;
 | 
			
		||||
	struct pw_impl_link *l, *t;
 | 
			
		||||
	int res = 0;
 | 
			
		||||
 | 
			
		||||
	if (port->direction == PW_DIRECTION_OUTPUT) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ extern "C" {
 | 
			
		|||
 * The port object
 | 
			
		||||
 */
 | 
			
		||||
struct pw_port;
 | 
			
		||||
struct pw_link;
 | 
			
		||||
struct pw_impl_link;
 | 
			
		||||
struct pw_control;
 | 
			
		||||
 | 
			
		||||
#include <pipewire/impl.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -73,10 +73,10 @@ struct pw_port_events {
 | 
			
		|||
	void (*info_changed) (void *data, const struct pw_port_info *info);
 | 
			
		||||
 | 
			
		||||
	/** a new link is added on this port */
 | 
			
		||||
	void (*link_added) (void *data, struct pw_link *link);
 | 
			
		||||
	void (*link_added) (void *data, struct pw_impl_link *link);
 | 
			
		||||
 | 
			
		||||
	/** a link is removed from this port */
 | 
			
		||||
	void (*link_removed) (void *data, struct pw_link *link);
 | 
			
		||||
	void (*link_removed) (void *data, struct pw_impl_link *link);
 | 
			
		||||
 | 
			
		||||
	/** the state of the port changed */
 | 
			
		||||
	void (*state_changed) (void *data, enum pw_port_state old,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -585,7 +585,7 @@ struct pw_port {
 | 
			
		|||
	struct pw_buffers buffers;	/**< buffers managed by this port, only on
 | 
			
		||||
					  *  output ports, shared with all links */
 | 
			
		||||
 | 
			
		||||
	struct spa_list links;		/**< list of \ref pw_link */
 | 
			
		||||
	struct spa_list links;		/**< list of \ref pw_impl_link */
 | 
			
		||||
 | 
			
		||||
	struct spa_list control_list[2];/**< list of \ref pw_control indexed by direction */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -626,15 +626,15 @@ struct pw_control_link {
 | 
			
		|||
	unsigned int valid:1;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define pw_link_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_link_events, m, v, ##__VA_ARGS__)
 | 
			
		||||
#define pw_link_emit_destroy(l)			pw_link_emit(l, destroy, 0)
 | 
			
		||||
#define pw_link_emit_free(l)			pw_link_emit(l, free, 0)
 | 
			
		||||
#define pw_link_emit_initialized(l)		pw_link_emit(l, initialized, 0)
 | 
			
		||||
#define pw_link_emit_info_changed(l,i)		pw_link_emit(l, info_changed, 0, i)
 | 
			
		||||
#define pw_link_emit_state_changed(l,...)	pw_link_emit(l, state_changed, 0, __VA_ARGS__)
 | 
			
		||||
#define pw_link_emit_port_unlinked(l,p)		pw_link_emit(l, port_unlinked, 0, p)
 | 
			
		||||
#define pw_impl_link_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_impl_link_events, m, v, ##__VA_ARGS__)
 | 
			
		||||
#define pw_impl_link_emit_destroy(l)		pw_impl_link_emit(l, destroy, 0)
 | 
			
		||||
#define pw_impl_link_emit_free(l)		pw_impl_link_emit(l, free, 0)
 | 
			
		||||
#define pw_impl_link_emit_initialized(l)	pw_impl_link_emit(l, initialized, 0)
 | 
			
		||||
#define pw_impl_link_emit_info_changed(l,i)	pw_impl_link_emit(l, info_changed, 0, i)
 | 
			
		||||
#define pw_impl_link_emit_state_changed(l,...)	pw_impl_link_emit(l, state_changed, 0, __VA_ARGS__)
 | 
			
		||||
#define pw_impl_link_emit_port_unlinked(l,p)	pw_impl_link_emit(l, port_unlinked, 0, p)
 | 
			
		||||
 | 
			
		||||
struct pw_link {
 | 
			
		||||
struct pw_impl_link {
 | 
			
		||||
	struct pw_context *context;		/**< context object */
 | 
			
		||||
	struct spa_list link;		/**< link in context link_list */
 | 
			
		||||
	struct pw_global *global;	/**< global for this link */
 | 
			
		||||
| 
						 | 
				
			
			@ -966,7 +966,7 @@ int pw_port_for_each_filtered_param(struct pw_port *in_port,
 | 
			
		|||
 * the value. When all callbacks return 0, this function returns 0 when all
 | 
			
		||||
 * items are iterated. */
 | 
			
		||||
int pw_port_for_each_link(struct pw_port *port,
 | 
			
		||||
			   int (*callback) (void *data, struct pw_link *link),
 | 
			
		||||
			   int (*callback) (void *data, struct pw_impl_link *link),
 | 
			
		||||
			   void *data);
 | 
			
		||||
 | 
			
		||||
/** check is a port has links, return 0 if not, 1 if it is linked */
 | 
			
		||||
| 
						 | 
				
			
			@ -993,14 +993,14 @@ int pw_node_initialized(struct pw_node *node);
 | 
			
		|||
 | 
			
		||||
int pw_node_set_driver(struct pw_node *node, struct pw_node *driver);
 | 
			
		||||
 | 
			
		||||
/** Prepare a link \memberof pw_link
 | 
			
		||||
/** Prepare a link \memberof pw_impl_link
 | 
			
		||||
  * Starts the negotiation of formats and buffers on \a link */
 | 
			
		||||
int pw_link_prepare(struct pw_link *link);
 | 
			
		||||
int pw_impl_link_prepare(struct pw_impl_link *link);
 | 
			
		||||
/** starts streaming on a link */
 | 
			
		||||
int pw_link_activate(struct pw_link *link);
 | 
			
		||||
int pw_impl_link_activate(struct pw_impl_link *link);
 | 
			
		||||
 | 
			
		||||
/** Deactivate a link \memberof pw_link */
 | 
			
		||||
int pw_link_deactivate(struct pw_link *link);
 | 
			
		||||
/** Deactivate a link \memberof pw_impl_link */
 | 
			
		||||
int pw_impl_link_deactivate(struct pw_impl_link *link);
 | 
			
		||||
 | 
			
		||||
struct pw_control *
 | 
			
		||||
pw_control_new(struct pw_context *context,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue