mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	more async improvements
Make the sequence number an int. Keep track of the last received seq number and pass it in error replies. Pass seq in for_each methods.
This commit is contained in:
		
							parent
							
								
									d2c18c7b1a
								
							
						
					
					
						commit
						f2ff6f393b
					
				
					 34 changed files with 377 additions and 347 deletions
				
			
		| 
						 | 
					@ -68,7 +68,7 @@ struct impl {
 | 
				
			||||||
	struct spa_list client_list;
 | 
						struct spa_list client_list;
 | 
				
			||||||
	struct spa_list node_list;
 | 
						struct spa_list node_list;
 | 
				
			||||||
	struct spa_list session_list;
 | 
						struct spa_list session_list;
 | 
				
			||||||
	uint32_t seq;
 | 
						int seq;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct object {
 | 
					struct object {
 | 
				
			||||||
| 
						 | 
					@ -367,7 +367,7 @@ static int node_event_info(void *object, const struct pw_node_info *info)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int node_event_param(void *object, uint32_t seq,
 | 
					static int node_event_param(void *object, int seq,
 | 
				
			||||||
                       uint32_t id, uint32_t index, uint32_t next,
 | 
					                       uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
                       const struct spa_pod *param)
 | 
					                       const struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -528,7 +528,7 @@ handle_node(struct impl *impl, uint32_t id, uint32_t parent_id,
 | 
				
			||||||
		pw_log_debug(NAME "%p: node %d is stream %s", impl, id, node->media);
 | 
							pw_log_debug(NAME "%p: node %d is stream %s", impl, id, node->media);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		pw_node_proxy_enum_params((struct pw_node_proxy*)p,
 | 
							pw_node_proxy_enum_params((struct pw_node_proxy*)p,
 | 
				
			||||||
				SPA_PARAM_EnumFormat,
 | 
									0, SPA_PARAM_EnumFormat,
 | 
				
			||||||
				0, -1, NULL);
 | 
									0, -1, NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else {
 | 
						else {
 | 
				
			||||||
| 
						 | 
					@ -588,7 +588,7 @@ static int port_event_info(void *object, const struct pw_port_info *info)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int port_event_param(void *object, uint32_t seq,
 | 
					static int port_event_param(void *object, int seq,
 | 
				
			||||||
                       uint32_t id, uint32_t index, uint32_t next,
 | 
					                       uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
                       const struct spa_pod *param)
 | 
					                       const struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -693,7 +693,7 @@ handle_port(struct impl *impl, uint32_t id, uint32_t parent_id, uint32_t type,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (node->type == NODE_TYPE_DEVICE) {
 | 
						if (node->type == NODE_TYPE_DEVICE) {
 | 
				
			||||||
		pw_port_proxy_enum_params((struct pw_port_proxy*)p,
 | 
							pw_port_proxy_enum_params((struct pw_port_proxy*)p,
 | 
				
			||||||
				SPA_PARAM_EnumFormat,
 | 
									0, SPA_PARAM_EnumFormat,
 | 
				
			||||||
				0, -1, NULL);
 | 
									0, -1, NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1309,10 +1309,10 @@ static void do_rescan(struct impl *impl)
 | 
				
			||||||
		rescan_node(impl, node);
 | 
							rescan_node(impl, node);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_done(void *data, uint32_t id, uint32_t seq)
 | 
					static int core_done(void *data, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = data;
 | 
						struct impl *impl = data;
 | 
				
			||||||
	pw_log_debug("media-session %p: sync %d %u/%u", impl, id, seq, impl->seq);
 | 
						pw_log_debug("media-session %p: sync %d %d/%d", impl, id, seq, impl->seq);
 | 
				
			||||||
	if (impl->seq == seq)
 | 
						if (impl->seq == seq)
 | 
				
			||||||
		do_rescan(impl);
 | 
							do_rescan(impl);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -162,13 +162,13 @@ enum
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pending {
 | 
					struct pending {
 | 
				
			||||||
  struct spa_list link;
 | 
					  struct spa_list link;
 | 
				
			||||||
  uint32_t seq;
 | 
					  int seq;
 | 
				
			||||||
  void (*callback) (void *data);
 | 
					  void (*callback) (void *data);
 | 
				
			||||||
  void *data;
 | 
					  void *data;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct remote_data {
 | 
					struct remote_data {
 | 
				
			||||||
  uint32_t seq;
 | 
					  int seq;
 | 
				
			||||||
  GstPipeWireDeviceProvider *self;
 | 
					  GstPipeWireDeviceProvider *self;
 | 
				
			||||||
  struct spa_hook core_listener;
 | 
					  struct spa_hook core_listener;
 | 
				
			||||||
  struct pw_registry_proxy *registry;
 | 
					  struct pw_registry_proxy *registry;
 | 
				
			||||||
| 
						 | 
					@ -285,10 +285,10 @@ static void add_pending(GstPipeWireDeviceProvider *self, struct pending *p,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void remove_pending(struct pending *p)
 | 
					static void remove_pending(struct pending *p)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (p->seq != SPA_ID_INVALID) {
 | 
					  if (p->seq != 0) {
 | 
				
			||||||
    pw_log_debug("remove pending %d", p->seq);
 | 
					    pw_log_debug("remove pending %d", p->seq);
 | 
				
			||||||
    spa_list_remove(&p->link);
 | 
					    spa_list_remove(&p->link);
 | 
				
			||||||
    p->seq = SPA_ID_INVALID;
 | 
					    p->seq = 0;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -321,7 +321,7 @@ on_core_info (void *data, const struct pw_core_info *info)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
on_core_done (void *data, uint32_t id, uint32_t seq)
 | 
					on_core_done (void *data, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  GstPipeWireDeviceProvider *self = data;
 | 
					  GstPipeWireDeviceProvider *self = data;
 | 
				
			||||||
  struct pending *p, *t;
 | 
					  struct pending *p, *t;
 | 
				
			||||||
| 
						 | 
					@ -379,7 +379,7 @@ static int port_event_info(void *data, const struct pw_port_info *info)
 | 
				
			||||||
  return 0;
 | 
					  return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int port_event_param(void *data, uint32_t seq, uint32_t id,
 | 
					static int port_event_param(void *data, int seq, uint32_t id,
 | 
				
			||||||
		uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
							uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  struct port_data *port_data = data;
 | 
					  struct port_data *port_data = data;
 | 
				
			||||||
| 
						 | 
					@ -503,7 +503,7 @@ static int registry_event_global(void *data, uint32_t id, uint32_t parent_id, ui
 | 
				
			||||||
    pw_port_proxy_add_listener(port, &pd->port_listener, &port_events, pd);
 | 
					    pw_port_proxy_add_listener(port, &pd->port_listener, &port_events, pd);
 | 
				
			||||||
    pw_proxy_add_listener((struct pw_proxy*)port, &pd->proxy_listener, &proxy_port_events, pd);
 | 
					    pw_proxy_add_listener((struct pw_proxy*)port, &pd->proxy_listener, &proxy_port_events, pd);
 | 
				
			||||||
    pw_port_proxy_enum_params((struct pw_port_proxy*)port,
 | 
					    pw_port_proxy_enum_params((struct pw_port_proxy*)port,
 | 
				
			||||||
				SPA_PARAM_EnumFormat, 0, 0, NULL);
 | 
									0, SPA_PARAM_EnumFormat, 0, 0, NULL);
 | 
				
			||||||
    add_pending(self, &pd->pending, do_add_node, pd);
 | 
					    add_pending(self, &pd->pending, do_add_node, pd);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,7 +93,7 @@ struct _GstPipeWireDeviceProvider {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  struct pw_core_proxy *core_proxy;
 | 
					  struct pw_core_proxy *core_proxy;
 | 
				
			||||||
  struct spa_list pending;
 | 
					  struct spa_list pending;
 | 
				
			||||||
  uint32_t seq;
 | 
					  int seq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  struct pw_registry_proxy *registry;
 | 
					  struct pw_registry_proxy *registry;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,7 +89,7 @@ static void *create_object(void *_data,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      no_mem:
 | 
					      no_mem:
 | 
				
			||||||
	pw_log_error("can't create node");
 | 
						pw_log_error("can't create node");
 | 
				
			||||||
	pw_core_resource_error(pw_client_get_core_resource(client), new_id, -ENOMEM, "can't create node: no memory");
 | 
						pw_resource_error(resource, -ENOMEM, "can't create node: no memory");
 | 
				
			||||||
	goto done;
 | 
						goto done;
 | 
				
			||||||
      done:
 | 
					      done:
 | 
				
			||||||
	if (properties)
 | 
						if (properties)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1213,14 +1213,18 @@ static void client_node_resource_destroy(void *data)
 | 
				
			||||||
	pw_node_destroy(this->node);
 | 
						pw_node_destroy(this->node);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void client_node_resource_error(void *data, int res, const char *message)
 | 
					static void client_node_resource_error(void *data, int seq, int res, const char *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = data;
 | 
						struct impl *impl = data;
 | 
				
			||||||
	struct node *this = &impl->node;
 | 
						struct node *this = &impl->node;
 | 
				
			||||||
	pw_log_error("client-node %p: error %d: %s", this, res, message);
 | 
						struct spa_result_node_error result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_log_error("client-node %p: error seq:%d %d (%s)", this, seq, res, message);
 | 
				
			||||||
 | 
						result.message = message;
 | 
				
			||||||
 | 
						this->callbacks->result(this->callbacks_data, seq, res, &result);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void client_node_resource_done(void *data, uint32_t seq)
 | 
					static void client_node_resource_done(void *data, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = data;
 | 
						struct impl *impl = data;
 | 
				
			||||||
	struct node *this = &impl->node;
 | 
						struct node *this = &impl->node;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -393,7 +393,7 @@ static int client_node_transport(void *object, uint32_t node_id,
 | 
				
			||||||
	if (data->node->active)
 | 
						if (data->node->active)
 | 
				
			||||||
		pw_client_node_proxy_set_active(data->node_proxy, true);
 | 
							pw_client_node_proxy_set_active(data->node_proxy, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_remote_events_exported(remote, proxy->id, node_id);
 | 
						pw_remote_emit_exported(remote, proxy->id, node_id);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -127,11 +127,13 @@ process_messages(struct client_data *data)
 | 
				
			||||||
		const struct pw_protocol_native_demarshal *demarshal;
 | 
							const struct pw_protocol_native_demarshal *demarshal;
 | 
				
			||||||
	        const struct pw_protocol_marshal *marshal;
 | 
						        const struct pw_protocol_marshal *marshal;
 | 
				
			||||||
		uint32_t permissions, required;
 | 
							uint32_t permissions, required;
 | 
				
			||||||
		int seq;
 | 
							int seq = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!pw_protocol_native_connection_get_next(conn, &opcode, &id, &message, &size, &seq))
 | 
							if (!pw_protocol_native_connection_get_next(conn, &opcode, &id, &message, &size, &seq))
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							client->seq = seq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		pw_log_trace("protocol-native %p: got message %d from %u", client->protocol,
 | 
							pw_log_trace("protocol-native %p: got message %d from %u", client->protocol,
 | 
				
			||||||
			     opcode, id);
 | 
								     opcode, id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -148,7 +150,6 @@ process_messages(struct client_data *data)
 | 
				
			||||||
					-EINVAL, "unknown resource %u", id);
 | 
										-EINVAL, "unknown resource %u", id);
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		resource->seq = seq;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		marshal = pw_resource_get_marshal(resource);
 | 
							marshal = pw_resource_get_marshal(resource);
 | 
				
			||||||
		if (marshal == NULL || opcode >= marshal->n_methods)
 | 
							if (marshal == NULL || opcode >= marshal->n_methods)
 | 
				
			||||||
| 
						 | 
					@ -492,6 +493,8 @@ on_remote_data(void *data, int fd, enum spa_io mask)
 | 
				
			||||||
                        pw_log_trace("protocol-native %p: got message %d from %u seq:%d",
 | 
					                        pw_log_trace("protocol-native %p: got message %d from %u seq:%d",
 | 
				
			||||||
					this, opcode, id, seq);
 | 
										this, opcode, id, seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								this->seq = seq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (debug_messages) {
 | 
								if (debug_messages) {
 | 
				
			||||||
				fprintf(stderr, "<<<<<<<<< in: %d %d %d %d\n", id, opcode, size, seq);
 | 
									fprintf(stderr, "<<<<<<<<< in: %d %d %d %d\n", id, opcode, size, seq);
 | 
				
			||||||
			        spa_debug_pod(0, NULL, (struct spa_pod *)message);
 | 
								        spa_debug_pod(0, NULL, (struct spa_pod *)message);
 | 
				
			||||||
| 
						 | 
					@ -503,7 +506,6 @@ on_remote_data(void *data, int fd, enum spa_io mask)
 | 
				
			||||||
                                pw_log_error("protocol-native %p: could not find proxy %u", this, id);
 | 
					                                pw_log_error("protocol-native %p: could not find proxy %u", this, id);
 | 
				
			||||||
                                continue;
 | 
					                                continue;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
			proxy->seq = seq;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			marshal = pw_proxy_get_marshal(proxy);
 | 
								marshal = pw_proxy_get_marshal(proxy);
 | 
				
			||||||
                        if (marshal == NULL || opcode >= marshal->n_events) {
 | 
					                        if (marshal == NULL || opcode >= marshal->n_events) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,22 +45,21 @@ static int core_method_marshal_hello(void *object, uint32_t version)
 | 
				
			||||||
	return pw_protocol_native_end_proxy(proxy, b);
 | 
						return pw_protocol_native_end_proxy(proxy, b);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_method_marshal_sync(void *object, uint32_t id, uint32_t seq)
 | 
					static int core_method_marshal_sync(void *object, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
	int res;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_SYNC, &res);
 | 
						b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_SYNC, &seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_builder_add_struct(b,
 | 
						spa_pod_builder_add_struct(b,
 | 
				
			||||||
			SPA_POD_Int(id),
 | 
								SPA_POD_Int(id),
 | 
				
			||||||
			SPA_POD_Int(res));
 | 
								SPA_POD_Int(seq));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pw_protocol_native_end_proxy(proxy, b);
 | 
						return pw_protocol_native_end_proxy(proxy, b);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_method_marshal_done(void *object, uint32_t id, uint32_t seq)
 | 
					static int core_method_marshal_done(void *object, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
| 
						 | 
					@ -74,7 +73,7 @@ static int core_method_marshal_done(void *object, uint32_t id, uint32_t seq)
 | 
				
			||||||
	return pw_protocol_native_end_proxy(proxy, b);
 | 
						return pw_protocol_native_end_proxy(proxy, b);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_method_marshal_error(void *object, uint32_t id, int res, const char *error)
 | 
					static int core_method_marshal_error(void *object, uint32_t id, int seq, int res, const char *error)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
| 
						 | 
					@ -83,6 +82,7 @@ static int core_method_marshal_error(void *object, uint32_t id, int res, const c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_builder_add_struct(b,
 | 
						spa_pod_builder_add_struct(b,
 | 
				
			||||||
			       SPA_POD_Int(id),
 | 
								       SPA_POD_Int(id),
 | 
				
			||||||
 | 
								       SPA_POD_Int(seq),
 | 
				
			||||||
			       SPA_POD_Int(res),
 | 
								       SPA_POD_Int(res),
 | 
				
			||||||
			       SPA_POD_String(error));
 | 
								       SPA_POD_String(error));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -233,16 +233,18 @@ static int core_event_demarshal_error(void *object, void *data, size_t size)
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
	struct spa_pod_parser prs;
 | 
						struct spa_pod_parser prs;
 | 
				
			||||||
	uint32_t id, res;
 | 
						uint32_t id, res;
 | 
				
			||||||
 | 
						int seq;
 | 
				
			||||||
	const char *error;
 | 
						const char *error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_parser_init(&prs, data, size);
 | 
						spa_pod_parser_init(&prs, data, size);
 | 
				
			||||||
	if (spa_pod_parser_get_struct(&prs,
 | 
						if (spa_pod_parser_get_struct(&prs,
 | 
				
			||||||
			SPA_POD_Int(&id),
 | 
								SPA_POD_Int(&id),
 | 
				
			||||||
 | 
								SPA_POD_Int(&seq),
 | 
				
			||||||
			SPA_POD_Int(&res),
 | 
								SPA_POD_Int(&res),
 | 
				
			||||||
			SPA_POD_String(&error)) < 0)
 | 
								SPA_POD_String(&error)) < 0)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pw_proxy_notify(proxy, struct pw_core_proxy_events, error, 0, id, res, error);
 | 
						return pw_proxy_notify(proxy, struct pw_core_proxy_events, error, 0, id, seq, res, error);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_event_demarshal_remove_id(void *object, void *data, size_t size)
 | 
					static int core_event_demarshal_remove_id(void *object, void *data, size_t size)
 | 
				
			||||||
| 
						 | 
					@ -282,7 +284,7 @@ static int core_event_marshal_info(void *object, const struct pw_core_info *info
 | 
				
			||||||
	return pw_protocol_native_end_resource(resource, b);
 | 
						return pw_protocol_native_end_resource(resource, b);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_event_marshal_done(void *object, uint32_t id, uint32_t seq)
 | 
					static int core_event_marshal_done(void *object, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
| 
						 | 
					@ -296,22 +298,21 @@ static int core_event_marshal_done(void *object, uint32_t id, uint32_t seq)
 | 
				
			||||||
	return pw_protocol_native_end_resource(resource, b);
 | 
						return pw_protocol_native_end_resource(resource, b);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_event_marshal_sync(void *object, uint32_t id, uint32_t seq)
 | 
					static int core_event_marshal_sync(void *object, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
	int res;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_SYNC, &res);
 | 
						b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_SYNC, &seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_builder_add_struct(b,
 | 
						spa_pod_builder_add_struct(b,
 | 
				
			||||||
			SPA_POD_Int(id),
 | 
								SPA_POD_Int(id),
 | 
				
			||||||
			SPA_POD_Int(res));
 | 
								SPA_POD_Int(seq));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pw_protocol_native_end_resource(resource, b);
 | 
						return pw_protocol_native_end_resource(resource, b);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_event_marshal_error(void *object, uint32_t id, int res, const char *error)
 | 
					static int core_event_marshal_error(void *object, uint32_t id, int seq, int res, const char *error)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
| 
						 | 
					@ -320,6 +321,7 @@ static int core_event_marshal_error(void *object, uint32_t id, int res, const ch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_builder_add_struct(b,
 | 
						spa_pod_builder_add_struct(b,
 | 
				
			||||||
			       SPA_POD_Int(id),
 | 
								       SPA_POD_Int(id),
 | 
				
			||||||
 | 
								       SPA_POD_Int(seq),
 | 
				
			||||||
			       SPA_POD_Int(res),
 | 
								       SPA_POD_Int(res),
 | 
				
			||||||
			       SPA_POD_String(error));
 | 
								       SPA_POD_String(error));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -388,16 +390,18 @@ static int core_method_demarshal_error(void *object, void *data, size_t size)
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	struct spa_pod_parser prs;
 | 
						struct spa_pod_parser prs;
 | 
				
			||||||
	uint32_t id, res;
 | 
						uint32_t id, res;
 | 
				
			||||||
 | 
						int seq;
 | 
				
			||||||
	const char *error;
 | 
						const char *error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_parser_init(&prs, data, size);
 | 
						spa_pod_parser_init(&prs, data, size);
 | 
				
			||||||
	if (spa_pod_parser_get_struct(&prs,
 | 
						if (spa_pod_parser_get_struct(&prs,
 | 
				
			||||||
			SPA_POD_Int(&id),
 | 
								SPA_POD_Int(&id),
 | 
				
			||||||
 | 
								SPA_POD_Int(&seq),
 | 
				
			||||||
			SPA_POD_Int(&res),
 | 
								SPA_POD_Int(&res),
 | 
				
			||||||
			SPA_POD_String(&error)) < 0)
 | 
								SPA_POD_String(&error)) < 0)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return pw_resource_do(resource, struct pw_core_proxy_methods, error, 0, id, res, error);
 | 
						return pw_resource_do(resource, struct pw_core_proxy_methods, error, 0, id, seq, res, error);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_method_demarshal_get_registry(void *object, void *data, size_t size)
 | 
					static int core_method_demarshal_get_registry(void *object, void *data, size_t size)
 | 
				
			||||||
| 
						 | 
					@ -646,7 +650,7 @@ static int device_demarshal_info(void *object, void *data, size_t size)
 | 
				
			||||||
	return pw_proxy_notify(proxy, struct pw_device_proxy_events, info, 0, &info);
 | 
						return pw_proxy_notify(proxy, struct pw_device_proxy_events, info, 0, &info);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int device_marshal_param(void *object, uint32_t seq, uint32_t id, uint32_t index, uint32_t next,
 | 
					static int device_marshal_param(void *object, int seq, uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
		const struct spa_pod *param)
 | 
							const struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
| 
						 | 
					@ -668,7 +672,8 @@ static int device_demarshal_param(void *object, void *data, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
	struct spa_pod_parser prs;
 | 
						struct spa_pod_parser prs;
 | 
				
			||||||
	uint32_t seq, id, index, next;
 | 
						uint32_t id, index, next;
 | 
				
			||||||
 | 
						int seq;
 | 
				
			||||||
	struct spa_pod *param;
 | 
						struct spa_pod *param;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_parser_init(&prs, data, size);
 | 
						spa_pod_parser_init(&prs, data, size);
 | 
				
			||||||
| 
						 | 
					@ -684,17 +689,16 @@ static int device_demarshal_param(void *object, void *data, size_t size)
 | 
				
			||||||
			seq, id, index, next, param);
 | 
								seq, id, index, next, param);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int device_marshal_enum_params(void *object, uint32_t seq,
 | 
					static int device_marshal_enum_params(void *object, int seq,
 | 
				
			||||||
		uint32_t id, uint32_t index, uint32_t num, const struct spa_pod *filter)
 | 
							uint32_t id, uint32_t index, uint32_t num, const struct spa_pod *filter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
	int res;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	b = pw_protocol_native_begin_proxy(proxy, PW_DEVICE_PROXY_METHOD_ENUM_PARAMS, &res);
 | 
						b = pw_protocol_native_begin_proxy(proxy, PW_DEVICE_PROXY_METHOD_ENUM_PARAMS, &seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_builder_add_struct(b,
 | 
						spa_pod_builder_add_struct(b,
 | 
				
			||||||
			SPA_POD_Int(res),
 | 
								SPA_POD_Int(seq),
 | 
				
			||||||
			SPA_POD_Id(id),
 | 
								SPA_POD_Id(id),
 | 
				
			||||||
			SPA_POD_Int(index),
 | 
								SPA_POD_Int(index),
 | 
				
			||||||
			SPA_POD_Int(num),
 | 
								SPA_POD_Int(num),
 | 
				
			||||||
| 
						 | 
					@ -707,7 +711,8 @@ static int device_demarshal_enum_params(void *object, void *data, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	struct spa_pod_parser prs;
 | 
						struct spa_pod_parser prs;
 | 
				
			||||||
	uint32_t id, index, num, seq;
 | 
						uint32_t id, index, num;
 | 
				
			||||||
 | 
						int seq;
 | 
				
			||||||
	struct spa_pod *filter;
 | 
						struct spa_pod *filter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_parser_init(&prs, data, size);
 | 
						spa_pod_parser_init(&prs, data, size);
 | 
				
			||||||
| 
						 | 
					@ -877,7 +882,7 @@ static int node_demarshal_info(void *object, void *data, size_t size)
 | 
				
			||||||
	return pw_proxy_notify(proxy, struct pw_node_proxy_events, info, 0, &info);
 | 
						return pw_proxy_notify(proxy, struct pw_node_proxy_events, info, 0, &info);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int node_marshal_param(void *object, uint32_t seq, uint32_t id,
 | 
					static int node_marshal_param(void *object, int seq, uint32_t id,
 | 
				
			||||||
		uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
							uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
| 
						 | 
					@ -899,7 +904,8 @@ static int node_demarshal_param(void *object, void *data, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
	struct spa_pod_parser prs;
 | 
						struct spa_pod_parser prs;
 | 
				
			||||||
	uint32_t seq, id, index, next;
 | 
						uint32_t id, index, next;
 | 
				
			||||||
 | 
						int seq;
 | 
				
			||||||
	struct spa_pod *param;
 | 
						struct spa_pod *param;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_parser_init(&prs, data, size);
 | 
						spa_pod_parser_init(&prs, data, size);
 | 
				
			||||||
| 
						 | 
					@ -915,17 +921,16 @@ static int node_demarshal_param(void *object, void *data, size_t size)
 | 
				
			||||||
			seq, id, index, next, param);
 | 
								seq, id, index, next, param);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int node_marshal_enum_params(void *object, uint32_t seq, uint32_t id,
 | 
					static int node_marshal_enum_params(void *object, int seq, uint32_t id,
 | 
				
			||||||
		uint32_t index, uint32_t num, const struct spa_pod *filter)
 | 
							uint32_t index, uint32_t num, const struct spa_pod *filter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
	int res;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	b = pw_protocol_native_begin_proxy(proxy, PW_NODE_PROXY_METHOD_ENUM_PARAMS, &res);
 | 
						b = pw_protocol_native_begin_proxy(proxy, PW_NODE_PROXY_METHOD_ENUM_PARAMS, &seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_builder_add_struct(b,
 | 
						spa_pod_builder_add_struct(b,
 | 
				
			||||||
			SPA_POD_Int(res),
 | 
								SPA_POD_Int(seq),
 | 
				
			||||||
			SPA_POD_Id(id),
 | 
								SPA_POD_Id(id),
 | 
				
			||||||
			SPA_POD_Int(index),
 | 
								SPA_POD_Int(index),
 | 
				
			||||||
			SPA_POD_Int(num),
 | 
								SPA_POD_Int(num),
 | 
				
			||||||
| 
						 | 
					@ -938,7 +943,8 @@ static int node_demarshal_enum_params(void *object, void *data, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	struct spa_pod_parser prs;
 | 
						struct spa_pod_parser prs;
 | 
				
			||||||
	uint32_t seq, id, index, num;
 | 
						uint32_t id, index, num;
 | 
				
			||||||
 | 
						int seq;
 | 
				
			||||||
	struct spa_pod *filter;
 | 
						struct spa_pod *filter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_parser_init(&prs, data, size);
 | 
						spa_pod_parser_init(&prs, data, size);
 | 
				
			||||||
| 
						 | 
					@ -1064,7 +1070,7 @@ static int port_demarshal_info(void *object, void *data, size_t size)
 | 
				
			||||||
	return pw_proxy_notify(proxy, struct pw_port_proxy_events, info, 0, &info);
 | 
						return pw_proxy_notify(proxy, struct pw_port_proxy_events, info, 0, &info);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int port_marshal_param(void *object, uint32_t seq, uint32_t id,
 | 
					static int port_marshal_param(void *object, int seq, uint32_t id,
 | 
				
			||||||
		uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
							uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
| 
						 | 
					@ -1086,7 +1092,8 @@ static int port_demarshal_param(void *object, void *data, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
	struct spa_pod_parser prs;
 | 
						struct spa_pod_parser prs;
 | 
				
			||||||
	uint32_t seq, id, index, next;
 | 
						uint32_t id, index, next;
 | 
				
			||||||
 | 
						int seq;
 | 
				
			||||||
	struct spa_pod *param;
 | 
						struct spa_pod *param;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_parser_init(&prs, data, size);
 | 
						spa_pod_parser_init(&prs, data, size);
 | 
				
			||||||
| 
						 | 
					@ -1102,17 +1109,16 @@ static int port_demarshal_param(void *object, void *data, size_t size)
 | 
				
			||||||
			seq, id, index, next, param);
 | 
								seq, id, index, next, param);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int port_marshal_enum_params(void *object, uint32_t seq, uint32_t id,
 | 
					static int port_marshal_enum_params(void *object, int seq, uint32_t id,
 | 
				
			||||||
		uint32_t index, uint32_t num, const struct spa_pod *filter)
 | 
							uint32_t index, uint32_t num, const struct spa_pod *filter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_proxy *proxy = object;
 | 
						struct pw_proxy *proxy = object;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
	int res;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	b = pw_protocol_native_begin_proxy(proxy, PW_PORT_PROXY_METHOD_ENUM_PARAMS, &res);
 | 
						b = pw_protocol_native_begin_proxy(proxy, PW_PORT_PROXY_METHOD_ENUM_PARAMS, &seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_builder_add_struct(b,
 | 
						spa_pod_builder_add_struct(b,
 | 
				
			||||||
			SPA_POD_Int(res),
 | 
								SPA_POD_Int(seq),
 | 
				
			||||||
			SPA_POD_Id(id),
 | 
								SPA_POD_Id(id),
 | 
				
			||||||
			SPA_POD_Int(index),
 | 
								SPA_POD_Int(index),
 | 
				
			||||||
			SPA_POD_Int(num),
 | 
								SPA_POD_Int(num),
 | 
				
			||||||
| 
						 | 
					@ -1125,7 +1131,8 @@ static int port_demarshal_enum_params(void *object, void *data, size_t size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	struct spa_pod_parser prs;
 | 
						struct spa_pod_parser prs;
 | 
				
			||||||
	uint32_t seq, id, index, num;
 | 
						uint32_t id, index, num;
 | 
				
			||||||
 | 
						int seq;
 | 
				
			||||||
	struct spa_pod *filter;
 | 
						struct spa_pod *filter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_parser_init(&prs, data, size);
 | 
						spa_pod_parser_init(&prs, data, size);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -206,7 +206,8 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      no_mem:
 | 
					      no_mem:
 | 
				
			||||||
	pw_log_error("can't create client resource");
 | 
						pw_log_error("can't create client resource");
 | 
				
			||||||
	pw_core_resource_error(client->core_resource, id, -ENOMEM, "can't create client resource: no memory");
 | 
						pw_core_resource_error(client->core_resource, id, client->seq,
 | 
				
			||||||
 | 
								-ENOMEM, "can't create client resource: no memory");
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -289,7 +290,7 @@ struct pw_client *pw_client_new(struct pw_core *core,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->info.props = &this->properties->dict;
 | 
						this->info.props = &this->properties->dict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_core_events_check_access(core, this);
 | 
						pw_core_emit_check_access(core, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return this;
 | 
						return this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -400,7 +401,7 @@ void pw_client_destroy(struct pw_client *client)
 | 
				
			||||||
	struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this);
 | 
						struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("client %p: destroy", client);
 | 
						pw_log_debug("client %p: destroy", client);
 | 
				
			||||||
	pw_client_events_destroy(client);
 | 
						pw_client_emit_destroy(client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_hook_remove(&impl->core_listener);
 | 
						spa_hook_remove(&impl->core_listener);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -414,7 +415,7 @@ void pw_client_destroy(struct pw_client *client)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_map_for_each(&client->objects, destroy_resource, client);
 | 
						pw_map_for_each(&client->objects, destroy_resource, client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_client_events_free(client);
 | 
						pw_client_emit_free(client);
 | 
				
			||||||
	pw_log_debug("client %p: free", impl);
 | 
						pw_log_debug("client %p: free", impl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_map_clear(&client->objects);
 | 
						pw_map_clear(&client->objects);
 | 
				
			||||||
| 
						 | 
					@ -467,7 +468,7 @@ int pw_client_update_properties(struct pw_client *client, const struct spa_dict
 | 
				
			||||||
	client->info.change_mask |= PW_CLIENT_CHANGE_MASK_PROPS;
 | 
						client->info.change_mask |= PW_CLIENT_CHANGE_MASK_PROPS;
 | 
				
			||||||
	client->info.props = &client->properties->dict;
 | 
						client->info.props = &client->properties->dict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_client_events_info_changed(client, &client->info);
 | 
						pw_client_emit_info_changed(client, &client->info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (client->global)
 | 
						if (client->global)
 | 
				
			||||||
		spa_list_for_each(resource, &client->global->resource_list, link)
 | 
							spa_list_for_each(resource, &client->global->resource_list, link)
 | 
				
			||||||
| 
						 | 
					@ -543,6 +544,6 @@ void pw_client_set_busy(struct pw_client *client, bool busy)
 | 
				
			||||||
	if (client->busy != busy) {
 | 
						if (client->busy != busy) {
 | 
				
			||||||
		pw_log_debug("client %p: busy %d", client, busy);
 | 
							pw_log_debug("client %p: busy %d", client, busy);
 | 
				
			||||||
		client->busy = busy;
 | 
							client->busy = busy;
 | 
				
			||||||
		pw_client_events_busy_changed(client, busy);
 | 
							pw_client_emit_busy_changed(client, busy);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,7 +80,7 @@ pw_control_new(struct pw_core *core,
 | 
				
			||||||
	spa_list_append(&core->control_list[direction], &this->link);
 | 
						spa_list_append(&core->control_list[direction], &this->link);
 | 
				
			||||||
	if (port) {
 | 
						if (port) {
 | 
				
			||||||
		spa_list_append(&port->control_list[direction], &this->port_link);
 | 
							spa_list_append(&port->control_list[direction], &this->port_link);
 | 
				
			||||||
		pw_port_events_control_added(port, this);
 | 
							pw_port_emit_control_added(port, this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return this;
 | 
						return this;
 | 
				
			||||||
| 
						 | 
					@ -96,7 +96,7 @@ void pw_control_destroy(struct pw_control *control)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("control %p: destroy", control);
 | 
						pw_log_debug("control %p: destroy", control);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_control_events_destroy(control);
 | 
						pw_control_emit_destroy(control);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (control->direction == SPA_DIRECTION_OUTPUT) {
 | 
						if (control->direction == SPA_DIRECTION_OUTPUT) {
 | 
				
			||||||
		spa_list_for_each_safe(other, tmp, &control->inputs, inputs_link)
 | 
							spa_list_for_each_safe(other, tmp, &control->inputs, inputs_link)
 | 
				
			||||||
| 
						 | 
					@ -111,11 +111,11 @@ void pw_control_destroy(struct pw_control *control)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (control->port) {
 | 
						if (control->port) {
 | 
				
			||||||
		spa_list_remove(&control->port_link);
 | 
							spa_list_remove(&control->port_link);
 | 
				
			||||||
		pw_port_events_control_removed(control->port, control);
 | 
							pw_port_emit_control_removed(control->port, control);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("control %p: free", control);
 | 
						pw_log_debug("control %p: free", control);
 | 
				
			||||||
	pw_control_events_free(control);
 | 
						pw_control_emit_free(control);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (control->direction == SPA_DIRECTION_OUTPUT) {
 | 
						if (control->direction == SPA_DIRECTION_OUTPUT) {
 | 
				
			||||||
		if (impl->mem)
 | 
							if (impl->mem)
 | 
				
			||||||
| 
						 | 
					@ -211,8 +211,8 @@ int pw_control_link(struct pw_control *control, struct pw_control *other)
 | 
				
			||||||
	other->output = control;
 | 
						other->output = control;
 | 
				
			||||||
	spa_list_append(&control->inputs, &other->inputs_link);
 | 
						spa_list_append(&control->inputs, &other->inputs_link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_control_events_linked(control, other);
 | 
						pw_control_emit_linked(control, other);
 | 
				
			||||||
	pw_control_events_linked(other, control);
 | 
						pw_control_emit_linked(other, control);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     exit:
 | 
					     exit:
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
| 
						 | 
					@ -258,8 +258,8 @@ int pw_control_unlink(struct pw_control *control, struct pw_control *other)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_control_events_unlinked(control, other);
 | 
						pw_control_emit_unlinked(control, other);
 | 
				
			||||||
	pw_control_events_unlinked(other, control);
 | 
						pw_control_emit_unlinked(other, control);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -159,7 +159,7 @@ static int core_hello(void *object, uint32_t version)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_sync(void *object, uint32_t id, uint32_t seq)
 | 
					static int core_sync(void *object, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	pw_log_debug("core %p: sync %d for resource %d", resource->core, seq, id);
 | 
						pw_log_debug("core %p: sync %d for resource %d", resource->core, seq, id);
 | 
				
			||||||
| 
						 | 
					@ -167,7 +167,7 @@ static int core_sync(void *object, uint32_t id, uint32_t seq)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_done(void *object, uint32_t id, uint32_t seq)
 | 
					static int core_done(void *object, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	struct pw_client *client = resource->client;
 | 
						struct pw_client *client = resource->client;
 | 
				
			||||||
| 
						 | 
					@ -178,11 +178,11 @@ static int core_done(void *object, uint32_t id, uint32_t seq)
 | 
				
			||||||
	if ((r = pw_client_find_resource(client, id)) == NULL)
 | 
						if ((r = pw_client_find_resource(client, id)) == NULL)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_resource_events_done(r, seq);
 | 
						pw_resource_emit_done(r, seq);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_error(void *object, uint32_t id, int res, const char *message)
 | 
					static int core_error(void *object, uint32_t id, int seq, int res, const char *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	struct pw_client *client = resource->client;
 | 
						struct pw_client *client = resource->client;
 | 
				
			||||||
| 
						 | 
					@ -193,7 +193,7 @@ static int core_error(void *object, uint32_t id, int res, const char *message)
 | 
				
			||||||
	if ((r = pw_client_find_resource(client, id)) == NULL)
 | 
						if ((r = pw_client_find_resource(client, id)) == NULL)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_resource_events_error(r, res, message);
 | 
						pw_resource_emit_error(r, seq, res, message);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -245,7 +245,8 @@ static int core_get_registry(void *object, uint32_t version, uint32_t new_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      no_mem:
 | 
					      no_mem:
 | 
				
			||||||
	pw_log_error("can't create registry resource");
 | 
						pw_log_error("can't create registry resource");
 | 
				
			||||||
	pw_core_resource_error(client->core_resource, new_id, -ENOMEM, "no memory");
 | 
						pw_core_resource_error(client->core_resource, new_id,
 | 
				
			||||||
 | 
								client->seq, -ENOMEM, "no memory");
 | 
				
			||||||
	pw_map_insert_at(&client->objects, new_id, NULL);
 | 
						pw_map_insert_at(&client->objects, new_id, NULL);
 | 
				
			||||||
	pw_core_resource_remove_id(client->core_resource, new_id);
 | 
						pw_core_resource_remove_id(client->core_resource, new_id);
 | 
				
			||||||
	return -ENOMEM;
 | 
						return -ENOMEM;
 | 
				
			||||||
| 
						 | 
					@ -540,7 +541,7 @@ void pw_core_destroy(struct pw_core *core)
 | 
				
			||||||
	struct pw_node *node;
 | 
						struct pw_node *node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("core %p: destroy", core);
 | 
						pw_log_debug("core %p: destroy", core);
 | 
				
			||||||
	pw_core_events_destroy(core);
 | 
						pw_core_emit_destroy(core);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_hook_remove(&core->global_listener);
 | 
						spa_hook_remove(&core->global_listener);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -559,7 +560,7 @@ void pw_core_destroy(struct pw_core *core)
 | 
				
			||||||
	spa_list_consume(global, &core->global_list, link)
 | 
						spa_list_consume(global, &core->global_list, link)
 | 
				
			||||||
		pw_global_destroy(global);
 | 
							pw_global_destroy(global);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_core_events_free(core);
 | 
						pw_core_emit_free(core);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_data_loop_destroy(core->data_loop_impl);
 | 
						pw_data_loop_destroy(core->data_loop_impl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -644,7 +645,7 @@ int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict)
 | 
				
			||||||
	core->info.change_mask = PW_CORE_CHANGE_MASK_PROPS;
 | 
						core->info.change_mask = PW_CORE_CHANGE_MASK_PROPS;
 | 
				
			||||||
	core->info.props = &core->properties->dict;
 | 
						core->info.props = &core->properties->dict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_core_events_info_changed(core, &core->info);
 | 
						pw_core_emit_info_changed(core, &core->info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (core->global)
 | 
						if (core->global)
 | 
				
			||||||
		spa_list_for_each(resource, &core->global->resource_list, link)
 | 
							spa_list_for_each(resource, &core->global->resource_list, link)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -94,7 +94,7 @@ void pw_data_loop_destroy(struct pw_data_loop *loop)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pw_log_debug("data-loop %p: destroy", loop);
 | 
						pw_log_debug("data-loop %p: destroy", loop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_data_loop_events_destroy(loop);
 | 
						pw_data_loop_emit_destroy(loop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_data_loop_stop(loop);
 | 
						pw_data_loop_stop(loop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,6 @@ struct resource_data {
 | 
				
			||||||
	struct spa_hook resource_listener;
 | 
						struct spa_hook resource_listener;
 | 
				
			||||||
	struct pw_device *device;
 | 
						struct pw_device *device;
 | 
				
			||||||
	struct pw_resource *resource;
 | 
						struct pw_resource *resource;
 | 
				
			||||||
	uint32_t seq;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct node_data {
 | 
					struct node_data {
 | 
				
			||||||
| 
						 | 
					@ -102,7 +101,7 @@ void pw_device_destroy(struct pw_device *device)
 | 
				
			||||||
	struct node_data *nd;
 | 
						struct node_data *nd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("device %p: destroy", device);
 | 
						pw_log_debug("device %p: destroy", device);
 | 
				
			||||||
	pw_device_events_destroy(device);
 | 
						pw_device_emit_destroy(device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_consume(nd, &device->node_list, link)
 | 
						spa_list_consume(nd, &device->node_list, link)
 | 
				
			||||||
		pw_node_destroy(nd->node);
 | 
							pw_node_destroy(nd->node);
 | 
				
			||||||
| 
						 | 
					@ -133,10 +132,10 @@ static const struct pw_resource_events resource_events = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
int pw_device_for_each_param(struct pw_device *device,
 | 
					int pw_device_for_each_param(struct pw_device *device,
 | 
				
			||||||
			     uint32_t param_id,
 | 
								     int seq, uint32_t param_id,
 | 
				
			||||||
			     uint32_t index, uint32_t max,
 | 
								     uint32_t index, uint32_t max,
 | 
				
			||||||
			     const struct spa_pod *filter,
 | 
								     const struct spa_pod *filter,
 | 
				
			||||||
			     int (*callback) (void *data,
 | 
								     int (*callback) (void *data, int seq,
 | 
				
			||||||
					      uint32_t id, uint32_t index, uint32_t next,
 | 
										      uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
					      struct spa_pod *param),
 | 
										      struct spa_pod *param),
 | 
				
			||||||
			     void *data)
 | 
								     void *data)
 | 
				
			||||||
| 
						 | 
					@ -161,32 +160,33 @@ int pw_device_for_each_param(struct pw_device *device,
 | 
				
			||||||
						&impl->pending)) != 1)
 | 
											&impl->pending)) != 1)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ((res = callback(data, param_id, idx, index, param)) != 0)
 | 
							if ((res = callback(data, seq, param_id, idx, index, param)) != 0)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int reply_param(void *data, uint32_t id, uint32_t index, uint32_t next, struct spa_pod *param)
 | 
					static int reply_param(void *data, int seq, uint32_t id,
 | 
				
			||||||
 | 
							uint32_t index, uint32_t next, struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct resource_data *d = data;
 | 
						struct resource_data *d = data;
 | 
				
			||||||
	pw_device_resource_param(d->resource, d->seq, id, index, next, param);
 | 
						pw_device_resource_param(d->resource, seq, id, index, next, param);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int device_enum_params(void *object, uint32_t seq, uint32_t id, uint32_t start, uint32_t num,
 | 
					static int device_enum_params(void *object, int seq, uint32_t id, uint32_t start, uint32_t num,
 | 
				
			||||||
		const struct spa_pod *filter)
 | 
							const struct spa_pod *filter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct resource_data *data = object;
 | 
						struct resource_data *data = object;
 | 
				
			||||||
	struct pw_resource *resource = data->resource;
 | 
						struct pw_resource *resource = data->resource;
 | 
				
			||||||
	struct pw_device *device = data->device;
 | 
						struct pw_device *device = data->device;
 | 
				
			||||||
 | 
						struct pw_client *client = resource->client;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	data->seq = seq;
 | 
						if ((res = pw_device_for_each_param(device, seq, id, start, num,
 | 
				
			||||||
	if ((res = pw_device_for_each_param(device, id, start, num,
 | 
					 | 
				
			||||||
				filter, reply_param, data)) < 0)
 | 
									filter, reply_param, data)) < 0)
 | 
				
			||||||
		pw_core_resource_error(resource->client->core_resource,
 | 
							pw_core_resource_error(client->core_resource,
 | 
				
			||||||
				resource->id, res, spa_strerror(res));
 | 
									resource->id, seq, res, spa_strerror(res));
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -196,11 +196,12 @@ static int device_set_param(void *object, uint32_t id, uint32_t flags,
 | 
				
			||||||
	struct resource_data *data = object;
 | 
						struct resource_data *data = object;
 | 
				
			||||||
	struct pw_resource *resource = data->resource;
 | 
						struct pw_resource *resource = data->resource;
 | 
				
			||||||
	struct pw_device *device = data->device;
 | 
						struct pw_device *device = data->device;
 | 
				
			||||||
 | 
						struct pw_client *client = resource->client;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = spa_device_set_param(device->implementation, id, flags, param)) < 0)
 | 
						if ((res = spa_device_set_param(device->implementation, id, flags, param)) < 0)
 | 
				
			||||||
		pw_core_resource_error(resource->client->core_resource,
 | 
							pw_core_resource_error(client->core_resource,
 | 
				
			||||||
				resource->id, res, spa_strerror(res));
 | 
									resource->id, client->seq, res, spa_strerror(res));
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -242,7 +243,8 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      no_mem:
 | 
					      no_mem:
 | 
				
			||||||
	pw_log_error("can't create device resource");
 | 
						pw_log_error("can't create device resource");
 | 
				
			||||||
	pw_core_resource_error(client->core_resource, id, -ENOMEM, "no memory");
 | 
						pw_core_resource_error(client->core_resource, id,
 | 
				
			||||||
 | 
								client->seq, -ENOMEM, "no memory");
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -462,7 +464,7 @@ int pw_device_update_properties(struct pw_device *device, const struct spa_dict
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	device->info.props = &device->properties->dict;
 | 
						device->info.props = &device->properties->dict;
 | 
				
			||||||
	device->info.change_mask |= PW_DEVICE_CHANGE_MASK_PROPS;
 | 
						device->info.change_mask |= PW_DEVICE_CHANGE_MASK_PROPS;
 | 
				
			||||||
	pw_device_events_info_changed(device, &device->info);
 | 
						pw_device_emit_info_changed(device, &device->info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (device->global)
 | 
						if (device->global)
 | 
				
			||||||
		spa_list_for_each(resource, &device->global->resource_list, link)
 | 
							spa_list_for_each(resource, &device->global->resource_list, link)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -94,10 +94,10 @@ int pw_device_update_properties(struct pw_device *device, const struct spa_dict
 | 
				
			||||||
const struct pw_properties *pw_device_get_properties(struct pw_device *device);
 | 
					const struct pw_properties *pw_device_get_properties(struct pw_device *device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int pw_device_for_each_param(struct pw_device *device,
 | 
					int pw_device_for_each_param(struct pw_device *device,
 | 
				
			||||||
			     uint32_t param_id,
 | 
								     int seq, uint32_t param_id,
 | 
				
			||||||
			     uint32_t index, uint32_t max,
 | 
								     uint32_t index, uint32_t max,
 | 
				
			||||||
			     const struct spa_pod *filter,
 | 
								     const struct spa_pod *filter,
 | 
				
			||||||
			     int (*callback) (void *data,
 | 
								     int (*callback) (void *data, int seq,
 | 
				
			||||||
					      uint32_t id, uint32_t index, uint32_t next,
 | 
										      uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
					      struct spa_pod *param),
 | 
										      struct spa_pod *param),
 | 
				
			||||||
			     void *data);
 | 
								     void *data);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,7 @@ SPA_EXPORT
 | 
				
			||||||
void pw_factory_destroy(struct pw_factory *factory)
 | 
					void pw_factory_destroy(struct pw_factory *factory)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pw_log_debug("factory %p: destroy", factory);
 | 
						pw_log_debug("factory %p: destroy", factory);
 | 
				
			||||||
	pw_factory_events_destroy(factory);
 | 
						pw_factory_emit_destroy(factory);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (factory->registered)
 | 
						if (factory->registered)
 | 
				
			||||||
		spa_list_remove(&factory->link);
 | 
							spa_list_remove(&factory->link);
 | 
				
			||||||
| 
						 | 
					@ -122,7 +122,8 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      no_mem:
 | 
					      no_mem:
 | 
				
			||||||
	pw_log_error("can't create factory resource");
 | 
						pw_log_error("can't create factory resource");
 | 
				
			||||||
	pw_core_resource_error(client->core_resource, id, -ENOMEM, "no memory");
 | 
						pw_core_resource_error(client->core_resource, id,
 | 
				
			||||||
 | 
								client->seq, -ENOMEM, "no memory");
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -144,10 +144,10 @@ pw_global_register(struct pw_global *global,
 | 
				
			||||||
						        &global->properties->dict : NULL);
 | 
											        &global->properties->dict : NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_global_events_registering(global);
 | 
						pw_global_emit_registering(global);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("global %p: add %u owner %p parent %p", global, global->id, owner, parent);
 | 
						pw_log_debug("global %p: add %u owner %p parent %p", global, global->id, owner, parent);
 | 
				
			||||||
	pw_core_events_global_added(core, global);
 | 
						pw_core_emit_global_added(core, global);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -172,7 +172,7 @@ static int global_unregister(struct pw_global *global)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_remove(&global->link);
 | 
						spa_list_remove(&global->link);
 | 
				
			||||||
	pw_map_remove(&core->globals, global->id);
 | 
						pw_map_remove(&core->globals, global->id);
 | 
				
			||||||
	pw_core_events_global_removed(core, global);
 | 
						pw_core_emit_global_removed(core, global);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl->registered = false;
 | 
						impl->registered = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -259,13 +259,13 @@ pw_global_bind(struct pw_global *global, struct pw_client *client, uint32_t perm
 | 
				
			||||||
	if (global->version < version)
 | 
						if (global->version < version)
 | 
				
			||||||
		goto wrong_version;
 | 
							goto wrong_version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_global_events_bind(global, client, permissions, version, id);
 | 
						pw_global_emit_bind(global, client, permissions, version, id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      wrong_version:
 | 
					      wrong_version:
 | 
				
			||||||
	res = -EINVAL;
 | 
						res = -EINVAL;
 | 
				
			||||||
	pw_core_resource_errorf(client->core_resource, id,
 | 
						pw_core_resource_errorf(client->core_resource, id, 0,
 | 
				
			||||||
			res, "id %d: interface version %d < %d",
 | 
								res, "id %d: interface version %d < %d",
 | 
				
			||||||
			id, global->version, version);
 | 
								id, global->version, version);
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
| 
						 | 
					@ -321,7 +321,7 @@ void pw_global_destroy(struct pw_global *global)
 | 
				
			||||||
	struct pw_resource *resource;
 | 
						struct pw_resource *resource;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("global %p: destroy %u", global, global->id);
 | 
						pw_log_debug("global %p: destroy %u", global, global->id);
 | 
				
			||||||
	pw_global_events_destroy(global);
 | 
						pw_global_emit_destroy(global);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	global_unregister(global);
 | 
						global_unregister(global);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -329,7 +329,7 @@ void pw_global_destroy(struct pw_global *global)
 | 
				
			||||||
		pw_resource_destroy(resource);
 | 
							pw_resource_destroy(resource);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("global %p: free", global);
 | 
						pw_log_debug("global %p: free", global);
 | 
				
			||||||
	pw_global_events_free(global);
 | 
						pw_global_emit_free(global);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (global->properties)
 | 
						if (global->properties)
 | 
				
			||||||
		pw_properties_free(global->properties);
 | 
							pw_properties_free(global->properties);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -110,7 +110,7 @@ struct pw_core_proxy_methods {
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
	 * \param seq the seq number passed to the done event
 | 
						 * \param seq the seq number passed to the done event
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*sync) (void *object, uint32_t id, uint32_t seq);
 | 
						int (*sync) (void *object, uint32_t id, int seq);
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Reply to a server sync event.
 | 
						 * Reply to a server sync event.
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
| 
						 | 
					@ -118,7 +118,7 @@ struct pw_core_proxy_methods {
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
	 * \param seq the seq number received in the sync event
 | 
						 * \param seq the seq number received in the sync event
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*done) (void *object, uint32_t id, uint32_t seq);
 | 
						int (*done) (void *object, uint32_t id, int seq);
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Fatal error event
 | 
						 * Fatal error event
 | 
				
			||||||
         *
 | 
					         *
 | 
				
			||||||
| 
						 | 
					@ -135,7 +135,7 @@ struct pw_core_proxy_methods {
 | 
				
			||||||
         * \param res error code
 | 
					         * \param res error code
 | 
				
			||||||
         * \param message error description
 | 
					         * \param message error description
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*error) (void *object, uint32_t id, int res, const char *message);
 | 
						int (*error) (void *object, uint32_t id, int seq, int res, const char *message);
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Get the registry object
 | 
						 * Get the registry object
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
| 
						 | 
					@ -177,43 +177,43 @@ pw_core_proxy_hello(struct pw_core_proxy *core, uint32_t version)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
pw_core_proxy_sync(struct pw_core_proxy *core, uint32_t id, uint32_t seq)
 | 
					pw_core_proxy_sync(struct pw_core_proxy *core, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, sync, id, seq);
 | 
						return pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, sync, id, seq);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
pw_core_proxy_done(struct pw_core_proxy *core, uint32_t id, uint32_t seq)
 | 
					pw_core_proxy_done(struct pw_core_proxy *core, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, done, id, seq);
 | 
						return pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, done, id, seq);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
pw_core_proxy_error(struct pw_core_proxy *core, uint32_t id,
 | 
					pw_core_proxy_error(struct pw_core_proxy *core, uint32_t id, int seq,
 | 
				
			||||||
		int res, const char *message)
 | 
							int res, const char *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, error,
 | 
						return pw_proxy_do((struct pw_proxy*)core, struct pw_core_proxy_methods, error,
 | 
				
			||||||
			id, res, message);
 | 
								id, seq, res, message);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
pw_core_proxy_errorv(struct pw_core_proxy *core, uint32_t id,
 | 
					pw_core_proxy_errorv(struct pw_core_proxy *core, uint32_t id, int seq,
 | 
				
			||||||
		int res, const char *message, va_list args)
 | 
							int res, const char *message, va_list args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char buffer[1024];
 | 
						char buffer[1024];
 | 
				
			||||||
	vsnprintf(buffer, sizeof(buffer), message, args);
 | 
						vsnprintf(buffer, sizeof(buffer), message, args);
 | 
				
			||||||
	buffer[1023] = '\0';
 | 
						buffer[1023] = '\0';
 | 
				
			||||||
	return pw_core_proxy_error(core, id, res, buffer);
 | 
						return pw_core_proxy_error(core, id, seq, res, buffer);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
pw_core_proxy_errorf(struct pw_core_proxy *core, uint32_t id,
 | 
					pw_core_proxy_errorf(struct pw_core_proxy *core, uint32_t id, int seq,
 | 
				
			||||||
		int res, const char *message, ...)
 | 
							int res, const char *message, ...)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
        va_list args;
 | 
					        va_list args;
 | 
				
			||||||
	int r;
 | 
						int r;
 | 
				
			||||||
	va_start(args, message);
 | 
						va_start(args, message);
 | 
				
			||||||
	r = pw_core_proxy_errorv(core, id, res, message, args);
 | 
						r = pw_core_proxy_errorv(core, id, seq, res, message, args);
 | 
				
			||||||
	va_end(args);
 | 
						va_end(args);
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -278,14 +278,14 @@ struct pw_core_proxy_events {
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
	 * \param seq the seq number passed to the sync method call
 | 
						 * \param seq the seq number passed to the sync method call
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*done) (void *object, uint32_t id, uint32_t seq);
 | 
						int (*done) (void *object, uint32_t id, int seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/** Emit a sync event
 | 
						/** Emit a sync event
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
	 * The client should reply with a done reply with the same seq
 | 
						 * The client should reply with a done reply with the same seq
 | 
				
			||||||
	 * number.
 | 
						 * number.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*sync) (void *object, uint32_t id, uint32_t seq);
 | 
						int (*sync) (void *object, uint32_t id, int seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Fatal error event
 | 
						 * Fatal error event
 | 
				
			||||||
| 
						 | 
					@ -300,10 +300,11 @@ struct pw_core_proxy_events {
 | 
				
			||||||
	 * \a id.
 | 
						 * \a id.
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
         * \param id object where the error occurred
 | 
					         * \param id object where the error occurred
 | 
				
			||||||
 | 
					         * \param seq the sequence number that generated the error
 | 
				
			||||||
         * \param res error code
 | 
					         * \param res error code
 | 
				
			||||||
         * \param message error description
 | 
					         * \param message error description
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*error) (void *object, uint32_t id, int res, const char *message);
 | 
						int (*error) (void *object, uint32_t id, int seq, int res, const char *message);
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Remove an object ID
 | 
						 * Remove an object ID
 | 
				
			||||||
         *
 | 
					         *
 | 
				
			||||||
| 
						 | 
					@ -335,20 +336,22 @@ pw_core_proxy_add_listener(struct pw_core_proxy *core,
 | 
				
			||||||
#define pw_core_resource_remove_id(r,...)    pw_resource_notify(r,struct pw_core_proxy_events,remove_id,__VA_ARGS__)
 | 
					#define pw_core_resource_remove_id(r,...)    pw_resource_notify(r,struct pw_core_proxy_events,remove_id,__VA_ARGS__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
pw_core_resource_errorv(struct pw_resource *resource, uint32_t id, int res, const char *message, va_list args)
 | 
					pw_core_resource_errorv(struct pw_resource *resource, uint32_t id, int seq,
 | 
				
			||||||
 | 
							int res, const char *message, va_list args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char buffer[1024];
 | 
						char buffer[1024];
 | 
				
			||||||
	vsnprintf(buffer, sizeof(buffer), message, args);
 | 
						vsnprintf(buffer, sizeof(buffer), message, args);
 | 
				
			||||||
	buffer[1023] = '\0';
 | 
						buffer[1023] = '\0';
 | 
				
			||||||
	return pw_core_resource_error(resource, id, res, buffer);
 | 
						return pw_core_resource_error(resource, id, seq, res, buffer);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
pw_core_resource_errorf(struct pw_resource *resource, uint32_t id, int res, const char *message, ...)
 | 
					pw_core_resource_errorf(struct pw_resource *resource, uint32_t id, int seq,
 | 
				
			||||||
 | 
							int res, const char *message, ...)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
        va_list args;
 | 
					        va_list args;
 | 
				
			||||||
	va_start(args, message);
 | 
						va_start(args, message);
 | 
				
			||||||
	res = pw_core_resource_errorv(resource, id, res, message, args);
 | 
						res = pw_core_resource_errorv(resource, id, seq, res, message, args);
 | 
				
			||||||
	va_end(args);
 | 
						va_end(args);
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -545,7 +548,7 @@ struct pw_device_proxy_methods {
 | 
				
			||||||
	 * \param num the maximum number of params to retrieve
 | 
						 * \param num the maximum number of params to retrieve
 | 
				
			||||||
	 * \param filter a param filter or NULL
 | 
						 * \param filter a param filter or NULL
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*enum_params) (void *object, uint32_t seq, uint32_t id, uint32_t start, uint32_t num,
 | 
						int (*enum_params) (void *object, int seq, uint32_t id, uint32_t start, uint32_t num,
 | 
				
			||||||
			    const struct spa_pod *filter);
 | 
								    const struct spa_pod *filter);
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Set a parameter on the device
 | 
						 * Set a parameter on the device
 | 
				
			||||||
| 
						 | 
					@ -559,11 +562,11 @@ struct pw_device_proxy_methods {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
pw_device_proxy_enum_params(struct pw_device_proxy *device, uint32_t id, uint32_t index,
 | 
					pw_device_proxy_enum_params(struct pw_device_proxy *device, int seq, uint32_t id, uint32_t index,
 | 
				
			||||||
		uint32_t num, const struct spa_pod *filter)
 | 
							uint32_t num, const struct spa_pod *filter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return pw_proxy_do((struct pw_proxy*)device, struct pw_device_proxy_methods, enum_params,
 | 
						return pw_proxy_do((struct pw_proxy*)device, struct pw_device_proxy_methods, enum_params,
 | 
				
			||||||
			0, id, index, num, filter);
 | 
								seq, id, index, num, filter);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
| 
						 | 
					@ -599,7 +602,7 @@ struct pw_device_proxy_events {
 | 
				
			||||||
	 * \param next the param index of the next param
 | 
						 * \param next the param index of the next param
 | 
				
			||||||
	 * \param param the parameter
 | 
						 * \param param the parameter
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*param) (void *object, uint32_t seq,
 | 
						int (*param) (void *object, int seq,
 | 
				
			||||||
		      uint32_t id, uint32_t index, uint32_t next,
 | 
							      uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
		      const struct spa_pod *param);
 | 
							      const struct spa_pod *param);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -639,7 +642,7 @@ struct pw_node_proxy_methods {
 | 
				
			||||||
	 * \param num the maximum number of params to retrieve
 | 
						 * \param num the maximum number of params to retrieve
 | 
				
			||||||
	 * \param filter a param filter or NULL
 | 
						 * \param filter a param filter or NULL
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*enum_params) (void *object, uint32_t seq, uint32_t id,
 | 
						int (*enum_params) (void *object, int seq, uint32_t id,
 | 
				
			||||||
			uint32_t start, uint32_t num,
 | 
								uint32_t start, uint32_t num,
 | 
				
			||||||
			const struct spa_pod *filter);
 | 
								const struct spa_pod *filter);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -663,11 +666,11 @@ struct pw_node_proxy_methods {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Node */
 | 
					/** Node */
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
pw_node_proxy_enum_params(struct pw_node_proxy *node, uint32_t id, uint32_t index,
 | 
					pw_node_proxy_enum_params(struct pw_node_proxy *node, int seq, uint32_t id, uint32_t index,
 | 
				
			||||||
		uint32_t num, const struct spa_pod *filter)
 | 
							uint32_t num, const struct spa_pod *filter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return pw_proxy_do((struct pw_proxy*)node, struct pw_node_proxy_methods, enum_params,
 | 
						return pw_proxy_do((struct pw_proxy*)node, struct pw_node_proxy_methods, enum_params,
 | 
				
			||||||
			0, id, index, num, filter);
 | 
								seq, id, index, num, filter);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
| 
						 | 
					@ -710,7 +713,7 @@ struct pw_node_proxy_events {
 | 
				
			||||||
	 * \param next the param index of the next param
 | 
						 * \param next the param index of the next param
 | 
				
			||||||
	 * \param param the parameter
 | 
						 * \param param the parameter
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*param) (void *object, uint32_t seq,
 | 
						int (*param) (void *object, int seq,
 | 
				
			||||||
		      uint32_t id, uint32_t index, uint32_t next,
 | 
							      uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
		      const struct spa_pod *param);
 | 
							      const struct spa_pod *param);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -749,18 +752,18 @@ struct pw_port_proxy_methods {
 | 
				
			||||||
	 * \param num the maximum number of params to retrieve
 | 
						 * \param num the maximum number of params to retrieve
 | 
				
			||||||
	 * \param filter a param filter or NULL
 | 
						 * \param filter a param filter or NULL
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*enum_params) (void *object, uint32_t seq,
 | 
						int (*enum_params) (void *object, int seq,
 | 
				
			||||||
			uint32_t id, uint32_t start, uint32_t num,
 | 
								uint32_t id, uint32_t start, uint32_t num,
 | 
				
			||||||
			const struct spa_pod *filter);
 | 
								const struct spa_pod *filter);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Port params */
 | 
					/** Port params */
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
pw_port_proxy_enum_params(struct pw_port_proxy *port, uint32_t id, uint32_t index,
 | 
					pw_port_proxy_enum_params(struct pw_port_proxy *port, int seq, uint32_t id, uint32_t index,
 | 
				
			||||||
		uint32_t num, const struct spa_pod *filter)
 | 
							uint32_t num, const struct spa_pod *filter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return pw_proxy_do((struct pw_proxy*)port, struct pw_port_proxy_methods, enum_params,
 | 
						return pw_proxy_do((struct pw_proxy*)port, struct pw_port_proxy_methods, enum_params,
 | 
				
			||||||
			0, id, index, num, filter);
 | 
								seq, id, index, num, filter);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PW_PORT_PROXY_EVENT_INFO	0
 | 
					#define PW_PORT_PROXY_EVENT_INFO	0
 | 
				
			||||||
| 
						 | 
					@ -788,7 +791,7 @@ struct pw_port_proxy_events {
 | 
				
			||||||
	 * \param next the param index of the next param
 | 
						 * \param next the param index of the next param
 | 
				
			||||||
	 * \param param the parameter
 | 
						 * \param param the parameter
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*param) (void *object, uint32_t seq,
 | 
						int (*param) (void *object, int seq,
 | 
				
			||||||
		       uint32_t id, uint32_t index, uint32_t next,
 | 
							       uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
		       const struct spa_pod *param);
 | 
							       const struct spa_pod *param);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -118,10 +118,10 @@ static void pw_link_update_state(struct pw_link *link, enum pw_link_state state,
 | 
				
			||||||
	free((char*)link->info.error);
 | 
						free((char*)link->info.error);
 | 
				
			||||||
	link->info.error = error;
 | 
						link->info.error = error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_link_events_state_changed(link, old, state, error);
 | 
						pw_link_emit_state_changed(link, old, state, error);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	link->info.change_mask |= PW_LINK_CHANGE_MASK_STATE;
 | 
						link->info.change_mask |= PW_LINK_CHANGE_MASK_STATE;
 | 
				
			||||||
	pw_link_events_info_changed(link, &link->info);
 | 
						pw_link_emit_info_changed(link, &link->info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (link->global)
 | 
						if (link->global)
 | 
				
			||||||
		spa_list_for_each(resource, &link->global->resource_list, link)
 | 
							spa_list_for_each(resource, &link->global->resource_list, link)
 | 
				
			||||||
| 
						 | 
					@ -331,7 +331,7 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
 | 
				
			||||||
	if (changed) {
 | 
						if (changed) {
 | 
				
			||||||
		this->info.change_mask |= PW_LINK_CHANGE_MASK_FORMAT;
 | 
							this->info.change_mask |= PW_LINK_CHANGE_MASK_FORMAT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		pw_link_events_info_changed(this, &this->info);
 | 
							pw_link_emit_info_changed(this, &this->info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (this->global)
 | 
							if (this->global)
 | 
				
			||||||
			spa_list_for_each(resource, &this->global->resource_list, link)
 | 
								spa_list_for_each(resource, &this->global->resource_list, link)
 | 
				
			||||||
| 
						 | 
					@ -906,7 +906,7 @@ static void input_remove(struct pw_link *this, struct pw_port *port)
 | 
				
			||||||
	spa_hook_remove(&impl->input_node_listener);
 | 
						spa_hook_remove(&impl->input_node_listener);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_remove(&this->input_link);
 | 
						spa_list_remove(&this->input_link);
 | 
				
			||||||
	pw_port_events_link_removed(this->input, this);
 | 
						pw_port_emit_link_removed(this->input, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	clear_port_buffers(this, port);
 | 
						clear_port_buffers(this, port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -925,7 +925,7 @@ static void output_remove(struct pw_link *this, struct pw_port *port)
 | 
				
			||||||
	spa_hook_remove(&impl->output_node_listener);
 | 
						spa_hook_remove(&impl->output_node_listener);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_remove(&this->output_link);
 | 
						spa_list_remove(&this->output_link);
 | 
				
			||||||
	pw_port_events_link_removed(this->output, this);
 | 
						pw_port_emit_link_removed(this->output, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	clear_port_buffers(this, port);
 | 
						clear_port_buffers(this, port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -936,7 +936,7 @@ static void output_remove(struct pw_link *this, struct pw_port *port)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void on_port_destroy(struct pw_link *this, struct pw_port *port)
 | 
					static void on_port_destroy(struct pw_link *this, struct pw_port *port)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pw_link_events_port_unlinked(this, port);
 | 
						pw_link_emit_port_unlinked(this, port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_link_update_state(this, PW_LINK_STATE_UNLINKED, NULL);
 | 
						pw_link_update_state(this, PW_LINK_STATE_UNLINKED, NULL);
 | 
				
			||||||
	pw_link_destroy(this);
 | 
						pw_link_destroy(this);
 | 
				
			||||||
| 
						 | 
					@ -1095,7 +1095,7 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      no_mem:
 | 
					      no_mem:
 | 
				
			||||||
	pw_log_error("can't create link resource");
 | 
						pw_log_error("can't create link resource");
 | 
				
			||||||
	pw_core_resource_error(client->core_resource, id, -ENOMEM, "no memory");
 | 
						pw_core_resource_error(client->core_resource, id, client->seq, -ENOMEM, "no memory");
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1328,8 +1328,8 @@ struct pw_link *pw_link_new(struct pw_core *core,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	find_driver(this);
 | 
						find_driver(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_port_events_link_added(output, this);
 | 
						pw_port_emit_link_added(output, this);
 | 
				
			||||||
	pw_port_events_link_added(input, this);
 | 
						pw_port_emit_link_added(input, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	try_link_controls(impl, output, input);
 | 
						try_link_controls(impl, output, input);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1421,7 +1421,7 @@ void pw_link_destroy(struct pw_link *link)
 | 
				
			||||||
	struct impl *impl = SPA_CONTAINER_OF(link, struct impl, this);
 | 
						struct impl *impl = SPA_CONTAINER_OF(link, struct impl, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("link %p: destroy", impl);
 | 
						pw_log_debug("link %p: destroy", impl);
 | 
				
			||||||
	pw_link_events_destroy(link);
 | 
						pw_link_emit_destroy(link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_link_deactivate(link);
 | 
						pw_link_deactivate(link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1441,7 +1441,7 @@ void pw_link_destroy(struct pw_link *link)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("link %p: free", impl);
 | 
						pw_log_debug("link %p: free", impl);
 | 
				
			||||||
	pw_link_events_free(link);
 | 
						pw_link_emit_free(link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_work_queue_destroy(impl->work);
 | 
						pw_work_queue_destroy(impl->work);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ SPA_EXPORT
 | 
				
			||||||
void pw_main_loop_destroy(struct pw_main_loop *loop)
 | 
					void pw_main_loop_destroy(struct pw_main_loop *loop)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pw_log_debug("main-loop %p: destroy", loop);
 | 
						pw_log_debug("main-loop %p: destroy", loop);
 | 
				
			||||||
	pw_main_loop_events_destroy(loop);
 | 
						pw_main_loop_emit_destroy(loop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_loop_destroy(loop->loop);
 | 
						pw_loop_destroy(loop->loop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -138,7 +138,8 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      no_mem:
 | 
					      no_mem:
 | 
				
			||||||
	pw_log_error("can't create module resource");
 | 
						pw_log_error("can't create module resource");
 | 
				
			||||||
	pw_core_resource_error(client->core_resource, id, -ENOMEM, "no memory");
 | 
						pw_core_resource_error(client->core_resource, id,
 | 
				
			||||||
 | 
								client->seq, -ENOMEM, "no memory");
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -296,7 +297,7 @@ void pw_module_destroy(struct pw_module *module)
 | 
				
			||||||
	struct impl *impl = SPA_CONTAINER_OF(module, struct impl, this);
 | 
						struct impl *impl = SPA_CONTAINER_OF(module, struct impl, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("module %p: destroy", module);
 | 
						pw_log_debug("module %p: destroy", module);
 | 
				
			||||||
	pw_module_events_destroy(module);
 | 
						pw_module_emit_destroy(module);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_remove(&module->link);
 | 
						spa_list_remove(&module->link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,7 +71,6 @@ struct resource_data {
 | 
				
			||||||
	struct spa_hook resource_listener;
 | 
						struct spa_hook resource_listener;
 | 
				
			||||||
	struct pw_node *node;
 | 
						struct pw_node *node;
 | 
				
			||||||
	struct pw_resource *resource;
 | 
						struct pw_resource *resource;
 | 
				
			||||||
	uint32_t seq;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** \endcond */
 | 
					/** \endcond */
 | 
				
			||||||
| 
						 | 
					@ -250,32 +249,33 @@ static const struct pw_resource_events resource_events = {
 | 
				
			||||||
	.destroy = node_unbind_func,
 | 
						.destroy = node_unbind_func,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int reply_param(void *data, uint32_t id, uint32_t index, uint32_t next, struct spa_pod *param)
 | 
					static int reply_param(void *data, uint32_t seq, uint32_t id,
 | 
				
			||||||
 | 
							uint32_t index, uint32_t next, struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct resource_data *d = data;
 | 
						struct resource_data *d = data;
 | 
				
			||||||
	pw_log_debug("resource %p: reply param %d", d->resource, d->seq);
 | 
						pw_log_debug("resource %p: reply param %d", d->resource, seq);
 | 
				
			||||||
	pw_node_resource_param(d->resource, d->seq, id, index, next, param);
 | 
						pw_node_resource_param(d->resource, seq, id, index, next, param);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int node_enum_params(void *object, uint32_t seq, uint32_t id,
 | 
					static int node_enum_params(void *object, int seq, uint32_t id,
 | 
				
			||||||
		uint32_t index, uint32_t num, const struct spa_pod *filter)
 | 
							uint32_t index, uint32_t num, const struct spa_pod *filter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	struct resource_data *data = pw_resource_get_user_data(resource);
 | 
						struct resource_data *data = pw_resource_get_user_data(resource);
 | 
				
			||||||
	struct pw_node *node = data->node;
 | 
						struct pw_node *node = data->node;
 | 
				
			||||||
 | 
						struct pw_client *client = resource->client;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("resource %p: enum params %d %s %u %u", resource, seq,
 | 
						pw_log_debug("resource %p: enum params %d %s %u %u", resource, seq,
 | 
				
			||||||
			spa_debug_type_find_name(spa_type_param, id), index, num);
 | 
								spa_debug_type_find_name(spa_type_param, id), index, num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	data->seq = seq;
 | 
						if ((res = pw_node_for_each_param(node, seq, id, index, num,
 | 
				
			||||||
	if ((res = pw_node_for_each_param(node, id, index, num,
 | 
					 | 
				
			||||||
				filter, reply_param, data)) < 0) {
 | 
									filter, reply_param, data)) < 0) {
 | 
				
			||||||
		pw_log_error("resource %p: %d error %d (%s)", resource,
 | 
							pw_log_error("resource %p: %d error %d (%s)", resource,
 | 
				
			||||||
				resource->id, res, spa_strerror(res));
 | 
									resource->id, res, spa_strerror(res));
 | 
				
			||||||
		pw_core_resource_error(resource->client->core_resource,
 | 
							pw_core_resource_error(client->core_resource,
 | 
				
			||||||
				resource->id, res, spa_strerror(res));
 | 
									resource->id, seq, res, spa_strerror(res));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -286,13 +286,14 @@ static int node_set_param(void *object, uint32_t id, uint32_t flags,
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
	struct resource_data *data = pw_resource_get_user_data(resource);
 | 
						struct resource_data *data = pw_resource_get_user_data(resource);
 | 
				
			||||||
	struct pw_node *node = data->node;
 | 
						struct pw_node *node = data->node;
 | 
				
			||||||
 | 
						struct pw_client *client = resource->client;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = spa_node_set_param(node->node, id, flags, param)) < 0) {
 | 
						if ((res = spa_node_set_param(node->node, id, flags, param)) < 0) {
 | 
				
			||||||
		pw_log_error("resource %p: %d error %d (%s)", resource,
 | 
							pw_log_error("resource %p: %d error %d (%s)", resource,
 | 
				
			||||||
				resource->id, res, spa_strerror(res));
 | 
									resource->id, res, spa_strerror(res));
 | 
				
			||||||
		pw_core_resource_error(resource->client->core_resource,
 | 
							pw_core_resource_error(client->core_resource,
 | 
				
			||||||
				resource->id, res, spa_strerror(res));
 | 
									resource->id, client->seq, res, spa_strerror(res));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -352,7 +353,8 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      no_mem:
 | 
					      no_mem:
 | 
				
			||||||
	pw_log_error("can't create node resource");
 | 
						pw_log_error("can't create node resource");
 | 
				
			||||||
	pw_core_resource_error(client->core_resource, id, -ENOMEM, "no memory");
 | 
						pw_core_resource_error(client->core_resource, id,
 | 
				
			||||||
 | 
								client->seq, -ENOMEM, "no memory");
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1067,10 +1069,10 @@ int pw_node_for_each_port(struct pw_node *node,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
int pw_node_for_each_param(struct pw_node *node,
 | 
					int pw_node_for_each_param(struct pw_node *node,
 | 
				
			||||||
			   uint32_t param_id,
 | 
								   uint32_t seq, uint32_t param_id,
 | 
				
			||||||
			   uint32_t index, uint32_t max,
 | 
								   uint32_t index, uint32_t max,
 | 
				
			||||||
			   const struct spa_pod *filter,
 | 
								   const struct spa_pod *filter,
 | 
				
			||||||
			   int (*callback) (void *data,
 | 
								   int (*callback) (void *data, uint32_t seq,
 | 
				
			||||||
					    uint32_t id, uint32_t index, uint32_t next,
 | 
										    uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
					    struct spa_pod *param),
 | 
										    struct spa_pod *param),
 | 
				
			||||||
			   void *data)
 | 
								   void *data)
 | 
				
			||||||
| 
						 | 
					@ -1099,7 +1101,7 @@ int pw_node_for_each_param(struct pw_node *node,
 | 
				
			||||||
						&impl->pending)) != 1)
 | 
											&impl->pending)) != 1)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ((res = callback(data, param_id, idx, index, param)) != 0)
 | 
							if ((res = callback(data, seq, param_id, idx, index, param)) != 0)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -168,10 +168,10 @@ int pw_node_for_each_port(struct pw_node *node,
 | 
				
			||||||
			  void *data);
 | 
								  void *data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int pw_node_for_each_param(struct pw_node *node,
 | 
					int pw_node_for_each_param(struct pw_node *node,
 | 
				
			||||||
			   uint32_t param_id,
 | 
								   uint32_t seq, uint32_t param_id,
 | 
				
			||||||
			   uint32_t index, uint32_t max,
 | 
								   uint32_t index, uint32_t max,
 | 
				
			||||||
			   const struct spa_pod *filter,
 | 
								   const struct spa_pod *filter,
 | 
				
			||||||
			   int (*callback) (void *data,
 | 
								   int (*callback) (void *data, uint32_t seq,
 | 
				
			||||||
					    uint32_t id, uint32_t index, uint32_t next,
 | 
										    uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
					    struct spa_pod *param),
 | 
										    struct spa_pod *param),
 | 
				
			||||||
			   void *data);
 | 
								   void *data);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,7 +46,6 @@ struct resource_data {
 | 
				
			||||||
	struct spa_hook resource_listener;
 | 
						struct spa_hook resource_listener;
 | 
				
			||||||
	struct pw_port *port;
 | 
						struct pw_port *port;
 | 
				
			||||||
	struct pw_resource *resource;
 | 
						struct pw_resource *resource;
 | 
				
			||||||
	uint32_t seq;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** \endcond */
 | 
					/** \endcond */
 | 
				
			||||||
| 
						 | 
					@ -87,7 +86,7 @@ void pw_port_update_state(struct pw_port *port, enum pw_port_state state)
 | 
				
			||||||
				SPA_LOG_LEVEL_ERROR : SPA_LOG_LEVEL_DEBUG,
 | 
									SPA_LOG_LEVEL_ERROR : SPA_LOG_LEVEL_DEBUG,
 | 
				
			||||||
			"port %p: state %d -> %d", port, port->state, state);
 | 
								"port %p: state %d -> %d", port, port->state, state);
 | 
				
			||||||
		port->state = state;
 | 
							port->state = state;
 | 
				
			||||||
		pw_port_events_state_changed(port, state);
 | 
							pw_port_emit_state_changed(port, state);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -367,7 +366,7 @@ int pw_port_update_properties(struct pw_port *port, const struct spa_dict *dict)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	port->info.props = &port->properties->dict;
 | 
						port->info.props = &port->properties->dict;
 | 
				
			||||||
	port->info.change_mask |= PW_PORT_CHANGE_MASK_PROPS;
 | 
						port->info.change_mask |= PW_PORT_CHANGE_MASK_PROPS;
 | 
				
			||||||
	pw_port_events_info_changed(port, &port->info);
 | 
						pw_port_emit_info_changed(port, &port->info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (port->global)
 | 
						if (port->global)
 | 
				
			||||||
		spa_list_for_each(resource, &port->global->resource_list, link)
 | 
							spa_list_for_each(resource, &port->global->resource_list, link)
 | 
				
			||||||
| 
						 | 
					@ -424,7 +423,8 @@ static int do_add_port(struct spa_loop *loop,
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int check_param_io(void *data, uint32_t id, uint32_t index, uint32_t next, struct spa_pod *param)
 | 
					static int check_param_io(void *data, int seq, uint32_t id,
 | 
				
			||||||
 | 
							uint32_t index, uint32_t next, struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_port *port = data;
 | 
						struct pw_port *port = data;
 | 
				
			||||||
	struct pw_node *node = port->node;
 | 
						struct pw_node *node = port->node;
 | 
				
			||||||
| 
						 | 
					@ -462,16 +462,17 @@ static const struct pw_resource_events resource_events = {
 | 
				
			||||||
	.destroy = port_unbind_func,
 | 
						.destroy = port_unbind_func,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int reply_param(void *data, uint32_t id, uint32_t index, uint32_t next, struct spa_pod *param)
 | 
					static int reply_param(void *data, int seq, uint32_t id,
 | 
				
			||||||
 | 
							uint32_t index, uint32_t next, struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct resource_data *d = data;
 | 
						struct resource_data *d = data;
 | 
				
			||||||
	struct pw_resource *resource = d->resource;
 | 
						struct pw_resource *resource = d->resource;
 | 
				
			||||||
	pw_log_debug("resource %p: reply param %d %d %d", resource, id, index, next);
 | 
						pw_log_debug("resource %p: reply param %d %d %d", resource, id, index, next);
 | 
				
			||||||
	pw_port_resource_param(resource, d->seq, id, index, next, param);
 | 
						pw_port_resource_param(resource, seq, id, index, next, param);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int port_enum_params(void *object, uint32_t seq, uint32_t id, uint32_t index, uint32_t num,
 | 
					static int port_enum_params(void *object, int seq, uint32_t id, uint32_t index, uint32_t num,
 | 
				
			||||||
		const struct spa_pod *filter)
 | 
							const struct spa_pod *filter)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
| 
						 | 
					@ -481,11 +482,10 @@ static int port_enum_params(void *object, uint32_t seq, uint32_t id, uint32_t in
 | 
				
			||||||
	pw_log_debug("resource %p: enum params %d %s %u %u", resource, seq,
 | 
						pw_log_debug("resource %p: enum params %d %s %u %u", resource, seq,
 | 
				
			||||||
			spa_debug_type_find_name(spa_type_param, id), index, num);
 | 
								spa_debug_type_find_name(spa_type_param, id), index, num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	data->seq = seq;
 | 
						if ((res = pw_port_for_each_param(port, seq, id, index, num, filter,
 | 
				
			||||||
	if ((res = pw_port_for_each_param(port, id, index, num, filter,
 | 
					 | 
				
			||||||
			reply_param, data)) < 0)
 | 
								reply_param, data)) < 0)
 | 
				
			||||||
		pw_core_resource_error(resource->client->core_resource,
 | 
							pw_core_resource_error(resource->client->core_resource,
 | 
				
			||||||
				resource->id, res, spa_strerror(res));
 | 
									resource->id, seq, res, spa_strerror(res));
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -525,7 +525,7 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      no_mem:
 | 
					      no_mem:
 | 
				
			||||||
	pw_log_error("can't create port resource");
 | 
						pw_log_error("can't create port resource");
 | 
				
			||||||
	pw_core_resource_error(client->core_resource, id, -ENOMEM, "no memory");
 | 
						pw_core_resource_error(client->core_resource, id, client->seq, -ENOMEM, "no memory");
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -592,7 +592,7 @@ int pw_port_add(struct pw_port *port, struct pw_node *node)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_node_emit_port_init(node, port);
 | 
						pw_node_emit_port_init(node, port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_port_for_each_param(port, SPA_PARAM_IO, 0, 0, NULL, check_param_io, port);
 | 
						pw_port_for_each_param(port, 0, SPA_PARAM_IO, 0, 0, NULL, check_param_io, port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dir = port->direction == PW_DIRECTION_INPUT ?  "in" : "out";
 | 
						dir = port->direction == PW_DIRECTION_INPUT ?  "in" : "out";
 | 
				
			||||||
	pw_properties_set(port->properties, "port.direction", dir);
 | 
						pw_properties_set(port->properties, "port.direction", dir);
 | 
				
			||||||
| 
						 | 
					@ -717,7 +717,7 @@ void pw_port_destroy(struct pw_port *port)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("port %p: destroy", port);
 | 
						pw_log_debug("port %p: destroy", port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_port_events_destroy(port);
 | 
						pw_port_emit_destroy(port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("port %p: control destroy", port);
 | 
						pw_log_debug("port %p: control destroy", port);
 | 
				
			||||||
	spa_list_consume(control, &port->control_list[0], port_link)
 | 
						spa_list_consume(control, &port->control_list[0], port_link)
 | 
				
			||||||
| 
						 | 
					@ -733,7 +733,7 @@ void pw_port_destroy(struct pw_port *port)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("port %p: free", port);
 | 
						pw_log_debug("port %p: free", port);
 | 
				
			||||||
	pw_port_events_free(port);
 | 
						pw_port_emit_free(port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free_allocation(&port->allocation);
 | 
						free_allocation(&port->allocation);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -745,10 +745,11 @@ void pw_port_destroy(struct pw_port *port)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int pw_port_for_each_param(struct pw_port *port,
 | 
					int pw_port_for_each_param(struct pw_port *port,
 | 
				
			||||||
 | 
								   int seq,
 | 
				
			||||||
			   uint32_t param_id,
 | 
								   uint32_t param_id,
 | 
				
			||||||
			   uint32_t index, uint32_t max,
 | 
								   uint32_t index, uint32_t max,
 | 
				
			||||||
			   const struct spa_pod *filter,
 | 
								   const struct spa_pod *filter,
 | 
				
			||||||
			   int (*callback) (void *data,
 | 
								   int (*callback) (void *data, int seq,
 | 
				
			||||||
					    uint32_t id, uint32_t index, uint32_t next,
 | 
										    uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
					    struct spa_pod *param),
 | 
										    struct spa_pod *param),
 | 
				
			||||||
			   void *data)
 | 
								   void *data)
 | 
				
			||||||
| 
						 | 
					@ -778,7 +779,7 @@ int pw_port_for_each_param(struct pw_port *port,
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		pw_log_debug("port %p: have param %d %u %u", port, param_id, idx, index);
 | 
							pw_log_debug("port %p: have param %d %u %u", port, param_id, idx, index);
 | 
				
			||||||
		if ((res = callback(data, param_id, idx, index, param)) != 0)
 | 
							if ((res = callback(data, seq, param_id, idx, index, param)) != 0)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pw_log_debug("port %p: res %d: (%s)", port, res, spa_strerror(res));
 | 
						pw_log_debug("port %p: res %d: (%s)", port, res, spa_strerror(res));
 | 
				
			||||||
| 
						 | 
					@ -788,38 +789,41 @@ int pw_port_for_each_param(struct pw_port *port,
 | 
				
			||||||
struct param_filter {
 | 
					struct param_filter {
 | 
				
			||||||
	struct pw_port *in_port;
 | 
						struct pw_port *in_port;
 | 
				
			||||||
	struct pw_port *out_port;
 | 
						struct pw_port *out_port;
 | 
				
			||||||
 | 
						int seq;
 | 
				
			||||||
	uint32_t in_param_id;
 | 
						uint32_t in_param_id;
 | 
				
			||||||
	uint32_t out_param_id;
 | 
						uint32_t out_param_id;
 | 
				
			||||||
	int (*callback) (void *data, uint32_t id, uint32_t index, uint32_t next, struct spa_pod *param);
 | 
						int (*callback) (void *data, int seq, uint32_t id, uint32_t index,
 | 
				
			||||||
 | 
								uint32_t next, struct spa_pod *param);
 | 
				
			||||||
	void *data;
 | 
						void *data;
 | 
				
			||||||
	uint32_t n_params;
 | 
						uint32_t n_params;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int do_filter(void *data, uint32_t id, uint32_t index, uint32_t next, struct spa_pod *param)
 | 
					static int do_filter(void *data, int seq, uint32_t id, uint32_t index, uint32_t next, struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct param_filter *f = data;
 | 
						struct param_filter *f = data;
 | 
				
			||||||
	f->n_params++;
 | 
						f->n_params++;
 | 
				
			||||||
	return pw_port_for_each_param(f->out_port, f->out_param_id, 0, 0, param, f->callback, f->data);
 | 
						return pw_port_for_each_param(f->out_port, seq, f->out_param_id, 0, 0, param, f->callback, f->data);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int pw_port_for_each_filtered_param(struct pw_port *in_port,
 | 
					int pw_port_for_each_filtered_param(struct pw_port *in_port,
 | 
				
			||||||
				    struct pw_port *out_port,
 | 
									    struct pw_port *out_port,
 | 
				
			||||||
 | 
									    int seq,
 | 
				
			||||||
				    uint32_t in_param_id,
 | 
									    uint32_t in_param_id,
 | 
				
			||||||
				    uint32_t out_param_id,
 | 
									    uint32_t out_param_id,
 | 
				
			||||||
				    const struct spa_pod *filter,
 | 
									    const struct spa_pod *filter,
 | 
				
			||||||
				    int (*callback) (void *data,
 | 
									    int (*callback) (void *data, int seq,
 | 
				
			||||||
						     uint32_t id, uint32_t index, uint32_t next,
 | 
											     uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
						     struct spa_pod *param),
 | 
											     struct spa_pod *param),
 | 
				
			||||||
				    void *data)
 | 
									    void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
	struct param_filter fd = { in_port, out_port, in_param_id, out_param_id, callback, data, 0 };
 | 
						struct param_filter fd = { in_port, out_port, seq, in_param_id, out_param_id, callback, data, 0 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = pw_port_for_each_param(in_port, in_param_id, 0, 0, filter, do_filter, &fd)) < 0)
 | 
						if ((res = pw_port_for_each_param(in_port, seq, in_param_id, 0, 0, filter, do_filter, &fd)) < 0)
 | 
				
			||||||
		return res;
 | 
							return res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (fd.n_params == 0)
 | 
						if (fd.n_params == 0)
 | 
				
			||||||
		res = do_filter(&filter, 0, 0, 0, NULL);
 | 
							res = do_filter(&filter, seq, 0, 0, 0, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,7 +60,7 @@ struct pw_command {
 | 
				
			||||||
        int n_args;
 | 
					        int n_args;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_protocol_events_destroy(p) spa_hook_list_call(&p->listener_list, struct pw_protocol_events, destroy, 0)
 | 
					#define pw_protocol_emit_destroy(p) spa_hook_list_call(&p->listener_list, struct pw_protocol_events, destroy, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_protocol {
 | 
					struct pw_protocol {
 | 
				
			||||||
	struct spa_list link;                   /**< link in core protocol_list */
 | 
						struct spa_list link;                   /**< link in core protocol_list */
 | 
				
			||||||
| 
						 | 
					@ -85,15 +85,15 @@ struct pw_protocol {
 | 
				
			||||||
typedef uint32_t (*pw_permission_func_t) (struct pw_global *global,
 | 
					typedef uint32_t (*pw_permission_func_t) (struct pw_global *global,
 | 
				
			||||||
					  struct pw_client *client, void *data);
 | 
										  struct pw_client *client, void *data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_client_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_client_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_client_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_client_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_client_events_destroy(o)		pw_client_events_emit(o, destroy, 0)
 | 
					#define pw_client_emit_destroy(o)		pw_client_emit(o, destroy, 0)
 | 
				
			||||||
#define pw_client_events_free(o)		pw_client_events_emit(o, free, 0)
 | 
					#define pw_client_emit_free(o)			pw_client_emit(o, free, 0)
 | 
				
			||||||
#define pw_client_events_info_changed(o,i)	pw_client_events_emit(o, info_changed, 0, i)
 | 
					#define pw_client_emit_info_changed(o,i)	pw_client_emit(o, info_changed, 0, i)
 | 
				
			||||||
#define pw_client_events_resource_added(o,r)	pw_client_events_emit(o, resource_added, 0, r)
 | 
					#define pw_client_emit_resource_added(o,r)	pw_client_emit(o, resource_added, 0, r)
 | 
				
			||||||
#define pw_client_events_resource_impl(o,r)	pw_client_events_emit(o, resource_impl, 0, r)
 | 
					#define pw_client_emit_resource_impl(o,r)	pw_client_emit(o, resource_impl, 0, r)
 | 
				
			||||||
#define pw_client_events_resource_removed(o,r)	pw_client_events_emit(o, resource_removed, 0, r)
 | 
					#define pw_client_emit_resource_removed(o,r)	pw_client_emit(o, resource_removed, 0, r)
 | 
				
			||||||
#define pw_client_events_busy_changed(o,b)	pw_client_events_emit(o, busy_changed, 0, b)
 | 
					#define pw_client_emit_busy_changed(o,b)	pw_client_emit(o, busy_changed, 0, b)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_client {
 | 
					struct pw_client {
 | 
				
			||||||
	struct pw_core *core;		/**< core object */
 | 
						struct pw_core *core;		/**< core object */
 | 
				
			||||||
| 
						 | 
					@ -116,6 +116,7 @@ struct pw_client {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct pw_protocol *protocol;	/**< protocol in use */
 | 
						struct pw_protocol *protocol;	/**< protocol in use */
 | 
				
			||||||
	struct spa_list protocol_link;	/**< link in the protocol client_list */
 | 
						struct spa_list protocol_link;	/**< link in the protocol client_list */
 | 
				
			||||||
 | 
						int seq;			/**< last received sequence number */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void *user_data;		/**< extra user data */
 | 
						void *user_data;		/**< extra user data */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,12 +126,12 @@ struct pw_client {
 | 
				
			||||||
	int busy:1;
 | 
						int busy:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_global_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_global_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_global_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_global_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_global_events_registering(g)	pw_global_events_emit(g, registering, 0)
 | 
					#define pw_global_emit_registering(g)	pw_global_emit(g, registering, 0)
 | 
				
			||||||
#define pw_global_events_destroy(g)	pw_global_events_emit(g, destroy, 0)
 | 
					#define pw_global_emit_destroy(g)	pw_global_emit(g, destroy, 0)
 | 
				
			||||||
#define pw_global_events_free(g)	pw_global_events_emit(g, free, 0)
 | 
					#define pw_global_emit_free(g)		pw_global_emit(g, free, 0)
 | 
				
			||||||
#define pw_global_events_bind(g,...)	pw_global_events_emit(g, bind, 0, __VA_ARGS__)
 | 
					#define pw_global_emit_bind(g,...)	pw_global_emit(g, bind, 0, __VA_ARGS__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_global {
 | 
					struct pw_global {
 | 
				
			||||||
	struct pw_core *core;		/**< the core */
 | 
						struct pw_core *core;		/**< the core */
 | 
				
			||||||
| 
						 | 
					@ -153,13 +154,13 @@ struct pw_global {
 | 
				
			||||||
	struct spa_list resource_list;	/**< The list of resources of this global */
 | 
						struct spa_list resource_list;	/**< The list of resources of this global */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_core_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_core_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_core_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_core_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
#define pw_core_events_destroy(c)		pw_core_events_emit(c, destroy, 0)
 | 
					#define pw_core_emit_destroy(c)			pw_core_emit(c, destroy, 0)
 | 
				
			||||||
#define pw_core_events_free(c)			pw_core_events_emit(c, free, 0)
 | 
					#define pw_core_emit_free(c)			pw_core_emit(c, free, 0)
 | 
				
			||||||
#define pw_core_events_info_changed(c,i)	pw_core_events_emit(c, info_changed, 0, i)
 | 
					#define pw_core_emit_info_changed(c,i)		pw_core_emit(c, info_changed, 0, i)
 | 
				
			||||||
#define pw_core_events_check_access(c,cl)	pw_core_events_emit(c, check_access, 0, cl)
 | 
					#define pw_core_emit_check_access(c,cl)		pw_core_emit(c, check_access, 0, cl)
 | 
				
			||||||
#define pw_core_events_global_added(c,g)	pw_core_events_emit(c, global_added, 0, g)
 | 
					#define pw_core_emit_global_added(c,g)		pw_core_emit(c, global_added, 0, g)
 | 
				
			||||||
#define pw_core_events_global_removed(c,g)	pw_core_events_emit(c, global_removed, 0, g)
 | 
					#define pw_core_emit_global_removed(c,g)	pw_core_emit(c, global_removed, 0, g)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_core {
 | 
					struct pw_core {
 | 
				
			||||||
	struct pw_global *global;	/**< the global of the core */
 | 
						struct pw_global *global;	/**< the global of the core */
 | 
				
			||||||
| 
						 | 
					@ -200,8 +201,8 @@ struct pw_core {
 | 
				
			||||||
	void *user_data;		/**< extra user data */
 | 
						void *user_data;		/**< extra user data */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_data_loop_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_data_loop_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_data_loop_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_data_loop_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
#define pw_data_loop_events_destroy(o) pw_data_loop_events_emit(o, destroy, 0)
 | 
					#define pw_data_loop_emit_destroy(o) pw_data_loop_emit(o, destroy, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_data_loop {
 | 
					struct pw_data_loop {
 | 
				
			||||||
        struct pw_loop *loop;
 | 
					        struct pw_loop *loop;
 | 
				
			||||||
| 
						 | 
					@ -214,8 +215,8 @@ struct pw_data_loop {
 | 
				
			||||||
        int running:1;
 | 
					        int running:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_main_loop_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_main_loop_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_main_loop_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_main_loop_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
#define pw_main_loop_events_destroy(o) pw_main_loop_events_emit(o, destroy, 0)
 | 
					#define pw_main_loop_emit_destroy(o) pw_main_loop_emit(o, destroy, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_main_loop {
 | 
					struct pw_main_loop {
 | 
				
			||||||
        struct pw_loop *loop;
 | 
					        struct pw_loop *loop;
 | 
				
			||||||
| 
						 | 
					@ -249,9 +250,9 @@ static inline void free_allocation(struct allocation *alloc)
 | 
				
			||||||
	alloc->n_buffers = 0;
 | 
						alloc->n_buffers = 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_device_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_device_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_device_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_device_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
#define pw_device_events_destroy(m)		pw_device_events_emit(m, destroy, 0)
 | 
					#define pw_device_emit_destroy(m)		pw_device_emit(m, destroy, 0)
 | 
				
			||||||
#define pw_device_events_info_changed(n,i)	pw_device_events_emit(n, info_changed, 0, i)
 | 
					#define pw_device_emit_info_changed(n,i)	pw_device_emit(n, info_changed, 0, i)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_device {
 | 
					struct pw_device {
 | 
				
			||||||
	struct pw_core *core;           /**< the core object */
 | 
						struct pw_core *core;           /**< the core object */
 | 
				
			||||||
| 
						 | 
					@ -272,8 +273,8 @@ struct pw_device {
 | 
				
			||||||
	int registered:1;
 | 
						int registered:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_module_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_module_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_module_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_module_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
#define pw_module_events_destroy(m)	pw_module_events_emit(m, destroy, 0)
 | 
					#define pw_module_emit_destroy(m)	pw_module_emit(m, destroy, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_module {
 | 
					struct pw_module {
 | 
				
			||||||
	struct pw_core *core;           /**< the core object */
 | 
						struct pw_core *core;           /**< the core object */
 | 
				
			||||||
| 
						 | 
					@ -405,15 +406,15 @@ struct pw_port_implementation {
 | 
				
			||||||
			  struct spa_buffer **buffers, uint32_t *n_buffers);
 | 
								  struct spa_buffer **buffers, uint32_t *n_buffers);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_port_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_port_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_port_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_port_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
#define pw_port_events_destroy(p)		pw_port_events_emit(p, destroy, 0)
 | 
					#define pw_port_emit_destroy(p)			pw_port_emit(p, destroy, 0)
 | 
				
			||||||
#define pw_port_events_free(p)			pw_port_events_emit(p, free, 0)
 | 
					#define pw_port_emit_free(p)			pw_port_emit(p, free, 0)
 | 
				
			||||||
#define pw_port_events_info_changed(p,i)	pw_port_events_emit(p, info_changed, 0, i)
 | 
					#define pw_port_emit_info_changed(p,i)		pw_port_emit(p, info_changed, 0, i)
 | 
				
			||||||
#define pw_port_events_link_added(p,l)		pw_port_events_emit(p, link_added, 0, l)
 | 
					#define pw_port_emit_link_added(p,l)		pw_port_emit(p, link_added, 0, l)
 | 
				
			||||||
#define pw_port_events_link_removed(p,l)	pw_port_events_emit(p, link_removed, 0, l)
 | 
					#define pw_port_emit_link_removed(p,l)		pw_port_emit(p, link_removed, 0, l)
 | 
				
			||||||
#define pw_port_events_state_changed(p,s)	pw_port_events_emit(p, state_changed, 0, s)
 | 
					#define pw_port_emit_state_changed(p,s)		pw_port_emit(p, state_changed, 0, s)
 | 
				
			||||||
#define pw_port_events_control_added(p,c)	pw_port_events_emit(p, control_added, 0, c)
 | 
					#define pw_port_emit_control_added(p,c)		pw_port_emit(p, control_added, 0, c)
 | 
				
			||||||
#define pw_port_events_control_removed(p,c)	pw_port_events_emit(p, control_removed, 0, c)
 | 
					#define pw_port_emit_control_removed(p,c)	pw_port_emit(p, control_removed, 0, c)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PW_PORT_IS_CONTROL(port)	SPA_FLAG_MASK(port->flags, \
 | 
					#define PW_PORT_IS_CONTROL(port)	SPA_FLAG_MASK(port->flags, \
 | 
				
			||||||
						PW_PORT_FLAG_BUFFERS|PW_PORT_FLAG_CONTROL,\
 | 
											PW_PORT_FLAG_BUFFERS|PW_PORT_FLAG_CONTROL,\
 | 
				
			||||||
| 
						 | 
					@ -478,12 +479,12 @@ struct pw_port {
 | 
				
			||||||
        void *user_data;                /**< extra user data */
 | 
					        void *user_data;                /**< extra user data */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_link_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_link_events, m, v, ##__VA_ARGS__)
 | 
					#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_events_destroy(l)		pw_link_events_emit(l, destroy, 0)
 | 
					#define pw_link_emit_destroy(l)			pw_link_emit(l, destroy, 0)
 | 
				
			||||||
#define pw_link_events_free(l)			pw_link_events_emit(l, free, 0)
 | 
					#define pw_link_emit_free(l)			pw_link_emit(l, free, 0)
 | 
				
			||||||
#define pw_link_events_info_changed(l,i)	pw_link_events_emit(l, info_changed, 0, i)
 | 
					#define pw_link_emit_info_changed(l,i)		pw_link_emit(l, info_changed, 0, i)
 | 
				
			||||||
#define pw_link_events_state_changed(l,...)	pw_link_events_emit(l, state_changed, 0, __VA_ARGS__)
 | 
					#define pw_link_emit_state_changed(l,...)	pw_link_emit(l, state_changed, 0, __VA_ARGS__)
 | 
				
			||||||
#define pw_link_events_port_unlinked(l,p)	pw_link_events_emit(l, port_unlinked, 0, p)
 | 
					#define pw_link_emit_port_unlinked(l,p)		pw_link_emit(l, port_unlinked, 0, p)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_link {
 | 
					struct pw_link {
 | 
				
			||||||
	struct pw_core *core;		/**< core object */
 | 
						struct pw_core *core;		/**< core object */
 | 
				
			||||||
| 
						 | 
					@ -515,11 +516,11 @@ struct pw_link {
 | 
				
			||||||
	int feedback:1;
 | 
						int feedback:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_resource_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_resource_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_resource_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_resource_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_resource_events_destroy(o)	pw_resource_events_emit(o, destroy, 0)
 | 
					#define pw_resource_emit_destroy(o)	pw_resource_emit(o, destroy, 0)
 | 
				
			||||||
#define pw_resource_events_done(o,s)	pw_resource_events_emit(o, done, 0, s)
 | 
					#define pw_resource_emit_done(o,s)	pw_resource_emit(o, done, 0, s)
 | 
				
			||||||
#define pw_resource_events_error(o,e,m)	pw_resource_events_emit(o, error, 0, e, m)
 | 
					#define pw_resource_emit_error(o,s,r,m)	pw_resource_emit(o, error, 0, s, r, m)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_resource {
 | 
					struct pw_resource {
 | 
				
			||||||
	struct pw_core *core;		/**< the core object */
 | 
						struct pw_core *core;		/**< the core object */
 | 
				
			||||||
| 
						 | 
					@ -537,16 +538,15 @@ struct pw_resource {
 | 
				
			||||||
	struct spa_hook_list listener_list;
 | 
						struct spa_hook_list listener_list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const struct pw_protocol_marshal *marshal;
 | 
					        const struct pw_protocol_marshal *marshal;
 | 
				
			||||||
	int seq;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void *access_private;		/**< private data for access control */
 | 
						void *access_private;		/**< private data for access control */
 | 
				
			||||||
	void *user_data;		/**< extra user data */
 | 
						void *user_data;		/**< extra user data */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_proxy_events_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_proxy_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_proxy_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_proxy_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
#define pw_proxy_events_destroy(p)	pw_proxy_events_emit(p, destroy, 0)
 | 
					#define pw_proxy_emit_destroy(p)	pw_proxy_emit(p, destroy, 0)
 | 
				
			||||||
#define pw_proxy_events_done(p,s)	pw_proxy_events_emit(p, done, 0, s)
 | 
					#define pw_proxy_emit_done(p,s)		pw_proxy_emit(p, done, 0, s)
 | 
				
			||||||
#define pw_proxy_events_error(p,r,m)	pw_proxy_events_emit(p, error, 0, r, m)
 | 
					#define pw_proxy_emit_error(p,s,r,m)	pw_proxy_emit(p, error, 0, s, r, m)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_proxy {
 | 
					struct pw_proxy {
 | 
				
			||||||
	struct pw_remote *remote;	/**< the owner remote of this proxy */
 | 
						struct pw_remote *remote;	/**< the owner remote of this proxy */
 | 
				
			||||||
| 
						 | 
					@ -558,15 +558,14 @@ struct pw_proxy {
 | 
				
			||||||
	struct spa_hook_list proxy_listener_list;
 | 
						struct spa_hook_list proxy_listener_list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const struct pw_protocol_marshal *marshal;	/**< protocol specific marshal functions */
 | 
						const struct pw_protocol_marshal *marshal;	/**< protocol specific marshal functions */
 | 
				
			||||||
	int seq;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void *user_data;		/**< extra user data */
 | 
						void *user_data;		/**< extra user data */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_remote_events_emit(r,m,v,...) spa_hook_list_call(&r->listener_list, struct pw_remote_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_remote_emit(r,m,v,...) spa_hook_list_call(&r->listener_list, struct pw_remote_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
#define pw_remote_events_destroy(r)		pw_remote_events_emit(r, destroy, 0)
 | 
					#define pw_remote_emit_destroy(r)		pw_remote_emit(r, destroy, 0)
 | 
				
			||||||
#define pw_remote_events_state_changed(r,o,s,e)	pw_remote_events_emit(r, state_changed, 0, o, s, e)
 | 
					#define pw_remote_emit_state_changed(r,o,s,e)	pw_remote_emit(r, state_changed, 0, o, s, e)
 | 
				
			||||||
#define pw_remote_events_exported(r,i,g)	pw_remote_events_emit(r, exported, 0, i,g)
 | 
					#define pw_remote_emit_exported(r,i,g)		pw_remote_emit(r, exported, 0, i,g)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_remote {
 | 
					struct pw_remote {
 | 
				
			||||||
	struct pw_core *core;			/**< core */
 | 
						struct pw_core *core;			/**< core */
 | 
				
			||||||
| 
						 | 
					@ -583,6 +582,7 @@ struct pw_remote {
 | 
				
			||||||
	struct spa_list remote_node_list;	/**< list of \ref pw_remote_node objects */
 | 
						struct spa_list remote_node_list;	/**< list of \ref pw_remote_node objects */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct pw_protocol_client *conn;	/**< the protocol client connection */
 | 
						struct pw_protocol_client *conn;	/**< the protocol client connection */
 | 
				
			||||||
 | 
						int seq;				/**< last received sequence number */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	enum pw_remote_state state;
 | 
						enum pw_remote_state state;
 | 
				
			||||||
	char *error;
 | 
						char *error;
 | 
				
			||||||
| 
						 | 
					@ -592,14 +592,14 @@ struct pw_remote {
 | 
				
			||||||
	void *user_data;			/**< extra user data */
 | 
						void *user_data;			/**< extra user data */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_stream_events_emit(s,m,v,...) spa_hook_list_call(&s->listener_list, struct pw_stream_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_stream_emit(s,m,v,...) spa_hook_list_call(&s->listener_list, struct pw_stream_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
#define pw_stream_events_destroy(s)		pw_stream_events_emit(s, destroy, 0)
 | 
					#define pw_stream_emit_destroy(s)		pw_stream_emit(s, destroy, 0)
 | 
				
			||||||
#define pw_stream_events_state_changed(s,o,n,e)	pw_stream_events_emit(s, state_changed,0,o,n,e)
 | 
					#define pw_stream_emit_state_changed(s,o,n,e)	pw_stream_emit(s, state_changed,0,o,n,e)
 | 
				
			||||||
#define pw_stream_events_format_changed(s,f)	pw_stream_events_emit(s, format_changed,0,f)
 | 
					#define pw_stream_emit_format_changed(s,f)	pw_stream_emit(s, format_changed,0,f)
 | 
				
			||||||
#define pw_stream_events_add_buffer(s,b)	pw_stream_events_emit(s, add_buffer, 0, b)
 | 
					#define pw_stream_emit_add_buffer(s,b)		pw_stream_emit(s, add_buffer, 0, b)
 | 
				
			||||||
#define pw_stream_events_remove_buffer(s,b)	pw_stream_events_emit(s, remove_buffer, 0, b)
 | 
					#define pw_stream_emit_remove_buffer(s,b)	pw_stream_emit(s, remove_buffer, 0, b)
 | 
				
			||||||
#define pw_stream_events_process(s)		pw_stream_events_emit(s, process, 0)
 | 
					#define pw_stream_emit_process(s)		pw_stream_emit(s, process, 0)
 | 
				
			||||||
#define pw_stream_events_drained(s)		pw_stream_events_emit(s, drained, 1)
 | 
					#define pw_stream_emit_drained(s)		pw_stream_emit(s, drained, 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_stream {
 | 
					struct pw_stream {
 | 
				
			||||||
| 
						 | 
					@ -620,9 +620,9 @@ struct pw_stream {
 | 
				
			||||||
	struct spa_hook proxy_listener;
 | 
						struct spa_hook proxy_listener;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_factory_events_emit(s,m,v,...) spa_hook_list_call(&s->listener_list, struct pw_factory_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_factory_emit(s,m,v,...) spa_hook_list_call(&s->listener_list, struct pw_factory_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_factory_events_destroy(s)		pw_factory_events_emit(s, destroy, 0)
 | 
					#define pw_factory_emit_destroy(s)		pw_factory_emit(s, destroy, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_factory {
 | 
					struct pw_factory {
 | 
				
			||||||
	struct pw_core *core;		/**< the core */
 | 
						struct pw_core *core;		/**< the core */
 | 
				
			||||||
| 
						 | 
					@ -643,11 +643,11 @@ struct pw_factory {
 | 
				
			||||||
	int registered:1;
 | 
						int registered:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_control_events_emit(c,m,v,...) spa_hook_list_call(&c->listener_list, struct pw_control_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_control_emit(c,m,v,...) spa_hook_list_call(&c->listener_list, struct pw_control_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
#define pw_control_events_destroy(c) pw_control_events_emit(c, destroy, 0)
 | 
					#define pw_control_emit_destroy(c)	pw_control_emit(c, destroy, 0)
 | 
				
			||||||
#define pw_control_events_free(c) pw_control_events_emit(c, free, 0)
 | 
					#define pw_control_emit_free(c)		pw_control_emit(c, free, 0)
 | 
				
			||||||
#define pw_control_events_linked(c,o) pw_control_events_emit(c, linked, 0, o)
 | 
					#define pw_control_emit_linked(c,o)	pw_control_emit(c, linked, 0, o)
 | 
				
			||||||
#define pw_control_events_unlinked(c,o) pw_control_events_emit(c, unlinked, 0, o)
 | 
					#define pw_control_emit_unlinked(c,o)	pw_control_emit(c, unlinked, 0, o)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pw_control {
 | 
					struct pw_control {
 | 
				
			||||||
	struct spa_list link;		/**< link in core control_list */
 | 
						struct spa_list link;		/**< link in core control_list */
 | 
				
			||||||
| 
						 | 
					@ -733,20 +733,21 @@ void pw_port_destroy(struct pw_port *port);
 | 
				
			||||||
 * 1 to fetch the next item, 0 to stop iteration or <0 on error.
 | 
					 * 1 to fetch the next item, 0 to stop iteration or <0 on error.
 | 
				
			||||||
 * The function returns 0 on success or the error returned by the callback. */
 | 
					 * The function returns 0 on success or the error returned by the callback. */
 | 
				
			||||||
int pw_port_for_each_param(struct pw_port *port,
 | 
					int pw_port_for_each_param(struct pw_port *port,
 | 
				
			||||||
			   uint32_t param_id,
 | 
								   int seq, uint32_t param_id,
 | 
				
			||||||
			   uint32_t index, uint32_t max,
 | 
								   uint32_t index, uint32_t max,
 | 
				
			||||||
			   const struct spa_pod *filter,
 | 
								   const struct spa_pod *filter,
 | 
				
			||||||
			   int (*callback) (void *data,
 | 
								   int (*callback) (void *data, int seq,
 | 
				
			||||||
					    uint32_t id, uint32_t index, uint32_t next,
 | 
										    uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
					    struct spa_pod *param),
 | 
										    struct spa_pod *param),
 | 
				
			||||||
			   void *data);
 | 
								   void *data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int pw_port_for_each_filtered_param(struct pw_port *in_port,
 | 
					int pw_port_for_each_filtered_param(struct pw_port *in_port,
 | 
				
			||||||
				    struct pw_port *out_port,
 | 
									    struct pw_port *out_port,
 | 
				
			||||||
 | 
									    int seq,
 | 
				
			||||||
				    uint32_t in_param_id,
 | 
									    uint32_t in_param_id,
 | 
				
			||||||
				    uint32_t out_param_id,
 | 
									    uint32_t out_param_id,
 | 
				
			||||||
				    const struct spa_pod *filter,
 | 
									    const struct spa_pod *filter,
 | 
				
			||||||
				    int (*callback) (void *data,
 | 
									    int (*callback) (void *data, int seq,
 | 
				
			||||||
						     uint32_t id, uint32_t index, uint32_t next,
 | 
											     uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
						     struct spa_pod *param),
 | 
											     struct spa_pod *param),
 | 
				
			||||||
				    void *data);
 | 
									    void *data);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -99,7 +99,7 @@ void pw_protocol_destroy(struct pw_protocol *protocol)
 | 
				
			||||||
	struct pw_protocol_client *client;
 | 
						struct pw_protocol_client *client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("protocol %p: destroy", protocol);
 | 
						pw_log_debug("protocol %p: destroy", protocol);
 | 
				
			||||||
	pw_protocol_events_destroy(protocol);
 | 
						pw_protocol_emit_destroy(protocol);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_remove(&protocol->link);
 | 
						spa_list_remove(&protocol->link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -138,7 +138,7 @@ void pw_proxy_destroy(struct pw_proxy *proxy)
 | 
				
			||||||
	struct proxy *impl = SPA_CONTAINER_OF(proxy, struct proxy, this);
 | 
						struct proxy *impl = SPA_CONTAINER_OF(proxy, struct proxy, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("proxy %p: destroy %u", proxy, proxy->id);
 | 
						pw_log_debug("proxy %p: destroy %u", proxy, proxy->id);
 | 
				
			||||||
	pw_proxy_events_destroy(proxy);
 | 
						pw_proxy_emit_destroy(proxy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_map_insert_at(&proxy->remote->objects, proxy->id, NULL);
 | 
						pw_map_insert_at(&proxy->remote->objects, proxy->id, NULL);
 | 
				
			||||||
	spa_list_remove(&proxy->link);
 | 
						spa_list_remove(&proxy->link);
 | 
				
			||||||
| 
						 | 
					@ -152,22 +152,22 @@ int pw_proxy_sync(struct pw_proxy *proxy, int seq)
 | 
				
			||||||
	int res = -EIO;
 | 
						int res = -EIO;
 | 
				
			||||||
	if (proxy->remote->core_proxy != NULL) {
 | 
						if (proxy->remote->core_proxy != NULL) {
 | 
				
			||||||
		res = pw_core_proxy_sync(proxy->remote->core_proxy, proxy->id, seq);
 | 
							res = pw_core_proxy_sync(proxy->remote->core_proxy, proxy->id, seq);
 | 
				
			||||||
		pw_log_debug("proxy %p: %u %d sync %u", proxy, proxy->id, seq, res);
 | 
							pw_log_debug("proxy %p: %u seq:%d sync %u", proxy, proxy->id, seq, res);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
int pw_proxy_error(struct pw_proxy *proxy, int result, const char *error, ...)
 | 
					int pw_proxy_error(struct pw_proxy *proxy, int res, const char *error, ...)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	va_list ap;
 | 
						va_list ap;
 | 
				
			||||||
	int res = -EIO;
 | 
						int r = -EIO;
 | 
				
			||||||
	va_start(ap, error);
 | 
						va_start(ap, error);
 | 
				
			||||||
	if (proxy->remote->core_proxy != NULL)
 | 
						if (proxy->remote->core_proxy != NULL)
 | 
				
			||||||
		res = pw_core_proxy_errorv(proxy->remote->core_proxy, proxy->id,
 | 
							r = pw_core_proxy_errorv(proxy->remote->core_proxy, proxy->id,
 | 
				
			||||||
				result, error, ap);
 | 
									proxy->remote->seq, res, error, ap);
 | 
				
			||||||
	va_end(ap);
 | 
						va_end(ap);
 | 
				
			||||||
	return res;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -112,10 +112,10 @@ struct pw_proxy_events {
 | 
				
			||||||
        void (*destroy) (void *data);
 | 
					        void (*destroy) (void *data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/** a reply to a sync method completed */
 | 
						/** a reply to a sync method completed */
 | 
				
			||||||
        void (*done) (void *data, uint32_t seq);
 | 
					        void (*done) (void *data, int seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/** an error occured on the proxy */
 | 
						/** an error occured on the proxy */
 | 
				
			||||||
        void (*error) (void *data, int res, const char *message);
 | 
					        void (*error) (void *data, int seq, int res, const char *message);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Make a new proxy object. The id can be used to bind to a remote object and
 | 
					/** Make a new proxy object. The id can be used to bind to a remote object and
 | 
				
			||||||
| 
						 | 
					@ -155,7 +155,7 @@ struct pw_protocol *pw_proxy_get_protocol(struct pw_proxy *proxy);
 | 
				
			||||||
int pw_proxy_sync(struct pw_proxy *proxy, int seq);
 | 
					int pw_proxy_sync(struct pw_proxy *proxy, int seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Generate an error for a proxy */
 | 
					/** Generate an error for a proxy */
 | 
				
			||||||
int pw_proxy_error(struct pw_proxy *proxy, int result, const char *error, ...);
 | 
					int pw_proxy_error(struct pw_proxy *proxy, int res, const char *error, ...);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get the listener of proxy */
 | 
					/** Get the listener of proxy */
 | 
				
			||||||
struct spa_hook_list *pw_proxy_get_proxy_listeners(struct pw_proxy *proxy);
 | 
					struct spa_hook_list *pw_proxy_get_proxy_listeners(struct pw_proxy *proxy);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,42 +93,42 @@ pw_remote_update_state(struct pw_remote *remote, enum pw_remote_state state, con
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		remote->state = state;
 | 
							remote->state = state;
 | 
				
			||||||
		pw_remote_events_state_changed(remote, old, state, remote->error);
 | 
							pw_remote_emit_state_changed(remote, old, state, remote->error);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_event_sync(void *data, uint32_t id, uint32_t seq)
 | 
					static int core_event_sync(void *data, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_remote *this = data;
 | 
						struct pw_remote *this = data;
 | 
				
			||||||
	pw_log_debug("remote %p: object %u sync %u", this, id, seq);
 | 
						pw_log_debug("remote %p: object %u sync %u", this, id, seq);
 | 
				
			||||||
	return pw_core_proxy_done(this->core_proxy, id, seq);
 | 
						return pw_core_proxy_done(this->core_proxy, id, seq);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_event_done(void *data, uint32_t id, uint32_t seq)
 | 
					static int core_event_done(void *data, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_remote *this = data;
 | 
						struct pw_remote *this = data;
 | 
				
			||||||
	struct pw_proxy *proxy;
 | 
						struct pw_proxy *proxy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("remote %p: object %u done %u", this, id, seq);
 | 
						pw_log_debug("remote %p: object %u done %d", this, id, seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	proxy = pw_map_lookup(&this->objects, id);
 | 
						proxy = pw_map_lookup(&this->objects, id);
 | 
				
			||||||
	if (proxy)
 | 
						if (proxy)
 | 
				
			||||||
		pw_proxy_events_done(proxy, seq);
 | 
							pw_proxy_emit_done(proxy, seq);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int core_event_error(void *data, uint32_t id, int res, const char *message)
 | 
					static int core_event_error(void *data, uint32_t id, int seq, int res, const char *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_remote *this = data;
 | 
						struct pw_remote *this = data;
 | 
				
			||||||
	struct pw_proxy *proxy;
 | 
						struct pw_proxy *proxy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_error("remote %p: object error %u: %d (%s): %s", this, id,
 | 
						pw_log_error("remote %p: object error %u: seq:%d %d (%s): %s", this, id, seq,
 | 
				
			||||||
			res, spa_strerror(res), message);
 | 
								res, spa_strerror(res), message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	proxy = pw_map_lookup(&this->objects, id);
 | 
						proxy = pw_map_lookup(&this->objects, id);
 | 
				
			||||||
	if (proxy)
 | 
						if (proxy)
 | 
				
			||||||
		pw_proxy_events_error(proxy, res, message);
 | 
							pw_proxy_emit_error(proxy, seq, res, message);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -239,7 +239,7 @@ void pw_remote_destroy(struct pw_remote *remote)
 | 
				
			||||||
	struct pw_stream *stream;
 | 
						struct pw_stream *stream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("remote %p: destroy", remote);
 | 
						pw_log_debug("remote %p: destroy", remote);
 | 
				
			||||||
	pw_remote_events_destroy(remote);
 | 
						pw_remote_emit_destroy(remote);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (remote->state != PW_REMOTE_STATE_UNCONNECTED)
 | 
						if (remote->state != PW_REMOTE_STATE_UNCONNECTED)
 | 
				
			||||||
		pw_remote_disconnect(remote);
 | 
							pw_remote_disconnect(remote);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,7 +80,7 @@ struct pw_resource *pw_resource_new(struct pw_client *client,
 | 
				
			||||||
			this, id,
 | 
								this, id,
 | 
				
			||||||
			spa_debug_type_find_name(pw_type_info(), type), version,
 | 
								spa_debug_type_find_name(pw_type_info(), type), version,
 | 
				
			||||||
			client, this->marshal);
 | 
								client, this->marshal);
 | 
				
			||||||
	pw_client_events_resource_added(client, this);
 | 
						pw_client_emit_resource_added(client, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return this;
 | 
						return this;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,7 +145,7 @@ void pw_resource_set_implementation(struct pw_resource *resource,
 | 
				
			||||||
	resource->implementation.funcs = implementation;
 | 
						resource->implementation.funcs = implementation;
 | 
				
			||||||
	resource->implementation.data = data;
 | 
						resource->implementation.data = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_client_events_resource_impl(client, resource);
 | 
						pw_client_emit_resource_impl(client, resource);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
| 
						 | 
					@ -170,26 +170,29 @@ const struct pw_protocol_marshal *pw_resource_get_marshal(struct pw_resource *re
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
int pw_resource_sync(struct pw_resource *resource, uint32_t seq)
 | 
					int pw_resource_sync(struct pw_resource *resource, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int res = -EIO;
 | 
						int res = -EIO;
 | 
				
			||||||
	if (resource->client->core_resource != NULL) {
 | 
						if (resource->client->core_resource != NULL) {
 | 
				
			||||||
		res = pw_core_resource_sync(resource->client->core_resource, resource->id, seq);
 | 
							res = pw_core_resource_sync(resource->client->core_resource, resource->id, seq);
 | 
				
			||||||
		pw_log_debug("resource %p: %u %u sync %u", resource, resource->id, seq, res);
 | 
							pw_log_debug("resource %p: %u seq:%d sync %d", resource, resource->id, seq, res);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
int pw_resource_error(struct pw_resource *resource, int result, const char *error, ...)
 | 
					int pw_resource_error(struct pw_resource *resource, int res, const char *error, ...)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	va_list ap;
 | 
						va_list ap;
 | 
				
			||||||
	int res = -EIO;
 | 
						int r = -EIO;
 | 
				
			||||||
 | 
						struct pw_client *client = resource->client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	va_start(ap, error);
 | 
						va_start(ap, error);
 | 
				
			||||||
	if (resource->client->core_resource != NULL)
 | 
						if (client->core_resource != NULL)
 | 
				
			||||||
		res = pw_core_resource_errorv(resource->client->core_resource, resource->id, result, error, ap);
 | 
							r = pw_core_resource_errorv(client->core_resource,
 | 
				
			||||||
 | 
									resource->id, client->seq, res, error, ap);
 | 
				
			||||||
	va_end(ap);
 | 
						va_end(ap);
 | 
				
			||||||
	return res;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
| 
						 | 
					@ -198,10 +201,10 @@ void pw_resource_destroy(struct pw_resource *resource)
 | 
				
			||||||
	struct pw_client *client = resource->client;
 | 
						struct pw_client *client = resource->client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("resource %p: destroy %u", resource, resource->id);
 | 
						pw_log_debug("resource %p: destroy %u", resource, resource->id);
 | 
				
			||||||
	pw_resource_events_destroy(resource);
 | 
						pw_resource_emit_destroy(resource);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_map_insert_at(&client->objects, resource->id, NULL);
 | 
						pw_map_insert_at(&client->objects, resource->id, NULL);
 | 
				
			||||||
	pw_client_events_resource_removed(client, resource);
 | 
						pw_client_emit_resource_removed(client, resource);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (client->core_resource)
 | 
						if (client->core_resource)
 | 
				
			||||||
		pw_core_resource_remove_id(client->core_resource, resource->id);
 | 
							pw_core_resource_remove_id(client->core_resource, resource->id);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -69,10 +69,10 @@ struct pw_resource_events {
 | 
				
			||||||
	void (*destroy) (void *data);
 | 
						void (*destroy) (void *data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/** a reply to a sync event completed */
 | 
						/** a reply to a sync event completed */
 | 
				
			||||||
        void (*done) (void *data, uint32_t seq);
 | 
					        void (*done) (void *data, int seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/** an error occured on the resource */
 | 
						/** an error occured on the resource */
 | 
				
			||||||
        void (*error) (void *data, int res, const char *message);
 | 
					        void (*error) (void *data, int seq, int res, const char *message);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Make a new resource for client */
 | 
					/** Make a new resource for client */
 | 
				
			||||||
| 
						 | 
					@ -124,10 +124,10 @@ void pw_resource_add_override(struct pw_resource *resource,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Generate an sync method for a resource. This will generate a done event
 | 
					/** Generate an sync method for a resource. This will generate a done event
 | 
				
			||||||
 * with the same \a sequence number in the return value. */
 | 
					 * with the same \a sequence number in the return value. */
 | 
				
			||||||
int pw_resource_sync(struct pw_resource *resource, uint32_t seq);
 | 
					int pw_resource_sync(struct pw_resource *resource, int seq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Generate an error for a resource */
 | 
					/** Generate an error for a resource */
 | 
				
			||||||
int pw_resource_error(struct pw_resource *resource, int result, const char *error, ...);
 | 
					int pw_resource_error(struct pw_resource *resource, int res, const char *error, ...);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get the implementation list of a resource */
 | 
					/** Get the implementation list of a resource */
 | 
				
			||||||
struct spa_hook_list *pw_resource_get_implementation(struct pw_resource *resource);
 | 
					struct spa_hook_list *pw_resource_get_implementation(struct pw_resource *resource);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -227,7 +227,7 @@ static bool stream_set_state(struct pw_stream *stream, enum pw_stream_state stat
 | 
				
			||||||
			     pw_stream_state_as_string(state), stream->error);
 | 
								     pw_stream_state_as_string(state), stream->error);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		stream->state = state;
 | 
							stream->state = state;
 | 
				
			||||||
		pw_stream_events_state_changed(stream, old, state, error);
 | 
							pw_stream_emit_state_changed(stream, old, state, error);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -249,7 +249,7 @@ do_call_process(struct spa_loop *loop,
 | 
				
			||||||
	struct stream *impl = user_data;
 | 
						struct stream *impl = user_data;
 | 
				
			||||||
	struct pw_stream *stream = &impl->this;
 | 
						struct pw_stream *stream = &impl->this;
 | 
				
			||||||
	pw_log_trace("do process");
 | 
						pw_log_trace("do process");
 | 
				
			||||||
	pw_stream_events_process(stream);
 | 
						pw_stream_emit_process(stream);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -464,7 +464,7 @@ static int port_set_format(struct spa_node *node,
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		p = NULL;
 | 
							p = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	count = pw_stream_events_format_changed(stream, p ? p->param : NULL);
 | 
						count = pw_stream_emit_format_changed(stream, p ? p->param : NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (count == 0)
 | 
						if (count == 0)
 | 
				
			||||||
		pw_stream_finish_format(stream, 0, NULL, 0);
 | 
							pw_stream_finish_format(stream, 0, NULL, 0);
 | 
				
			||||||
| 
						 | 
					@ -539,7 +539,7 @@ static void clear_buffers(struct pw_stream *stream)
 | 
				
			||||||
	for (i = 0; i < impl->n_buffers; i++) {
 | 
						for (i = 0; i < impl->n_buffers; i++) {
 | 
				
			||||||
		struct buffer *b = &impl->buffers[i];
 | 
							struct buffer *b = &impl->buffers[i];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		pw_stream_events_remove_buffer(stream, &b->this);
 | 
							pw_stream_emit_remove_buffer(stream, &b->this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_MAPPED)) {
 | 
							if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_MAPPED)) {
 | 
				
			||||||
			for (j = 0; j < b->this.buffer->n_datas; j++) {
 | 
								for (j = 0; j < b->this.buffer->n_datas; j++) {
 | 
				
			||||||
| 
						 | 
					@ -613,7 +613,7 @@ static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direc
 | 
				
			||||||
			push_queue(impl, &impl->dequeued, b);
 | 
								push_queue(impl, &impl->dequeued, b);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		pw_stream_events_add_buffer(stream, &b->this);
 | 
							pw_stream_emit_add_buffer(stream, &b->this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl->n_buffers = n_buffers;
 | 
						impl->n_buffers = n_buffers;
 | 
				
			||||||
| 
						 | 
					@ -792,7 +792,7 @@ static void proxy_destroy(void *_data)
 | 
				
			||||||
	stream_set_state(stream, PW_STREAM_STATE_UNCONNECTED, NULL);
 | 
						stream_set_state(stream, PW_STREAM_STATE_UNCONNECTED, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void proxy_error(void *_data, int res, const char *message)
 | 
					static void proxy_error(void *_data, int seq, int res, const char *message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_stream *stream = _data;
 | 
						struct pw_stream *stream = _data;
 | 
				
			||||||
	stream_set_state(stream, PW_STREAM_STATE_ERROR, message);
 | 
						stream_set_state(stream, PW_STREAM_STATE_ERROR, message);
 | 
				
			||||||
| 
						 | 
					@ -1014,7 +1014,7 @@ void pw_stream_destroy(struct pw_stream *stream)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("stream %p: destroy", stream);
 | 
						pw_log_debug("stream %p: destroy", stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_stream_events_destroy(stream);
 | 
						pw_stream_emit_destroy(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_stream_disconnect(stream);
 | 
						pw_stream_disconnect(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,9 +38,9 @@ static void test_core_abi(void)
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		uint32_t version;
 | 
							uint32_t version;
 | 
				
			||||||
	        int (*hello) (void *object, uint32_t version);
 | 
						        int (*hello) (void *object, uint32_t version);
 | 
				
			||||||
	        int (*sync) (void *object, uint32_t id, uint32_t seq);
 | 
						        int (*sync) (void *object, uint32_t id, int seq);
 | 
				
			||||||
	        int (*done) (void *object, uint32_t id, uint32_t seq);
 | 
						        int (*done) (void *object, uint32_t id, int seq);
 | 
				
			||||||
	        int (*error) (void *object, uint32_t id, int res, const char *error);
 | 
						        int (*error) (void *object, uint32_t id, int seq, int res, const char *error);
 | 
				
			||||||
	        int (*get_registry) (void *object, uint32_t version, uint32_t new_id);
 | 
						        int (*get_registry) (void *object, uint32_t version, uint32_t new_id);
 | 
				
			||||||
	        int (*create_object) (void *object,
 | 
						        int (*create_object) (void *object,
 | 
				
			||||||
				       const char *factory_name,
 | 
									       const char *factory_name,
 | 
				
			||||||
| 
						 | 
					@ -53,9 +53,9 @@ static void test_core_abi(void)
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		uint32_t version;
 | 
							uint32_t version;
 | 
				
			||||||
		int (*info) (void *object, const struct pw_core_info *info);
 | 
							int (*info) (void *object, const struct pw_core_info *info);
 | 
				
			||||||
	        int (*done) (void *object, uint32_t id, uint32_t seq);
 | 
						        int (*done) (void *object, uint32_t id, int seq);
 | 
				
			||||||
	        int (*sync) (void *object, uint32_t id, uint32_t seq);
 | 
						        int (*sync) (void *object, uint32_t id, int seq);
 | 
				
			||||||
	        int (*error) (void *object, uint32_t id, int res, const char *error);
 | 
						        int (*error) (void *object, uint32_t id, int seq, int res, const char *error);
 | 
				
			||||||
	        int (*remove_id) (void *object, uint32_t id);
 | 
						        int (*remove_id) (void *object, uint32_t id);
 | 
				
			||||||
	} events = { PW_VERSION_CORE_PROXY_EVENTS, };
 | 
						} events = { PW_VERSION_CORE_PROXY_EVENTS, };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -138,7 +138,7 @@ static void test_device_abi(void)
 | 
				
			||||||
	struct pw_device_proxy_events e;
 | 
						struct pw_device_proxy_events e;
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		uint32_t version;
 | 
							uint32_t version;
 | 
				
			||||||
		int (*enum_params) (void *object, uint32_t seq, uint32_t id,
 | 
							int (*enum_params) (void *object, int seq, uint32_t id,
 | 
				
			||||||
			uint32_t start, uint32_t num,
 | 
								uint32_t start, uint32_t num,
 | 
				
			||||||
			const struct spa_pod *filter);
 | 
								const struct spa_pod *filter);
 | 
				
			||||||
		int (*set_param) (void *object, uint32_t id, uint32_t flags,
 | 
							int (*set_param) (void *object, uint32_t id, uint32_t flags,
 | 
				
			||||||
| 
						 | 
					@ -147,7 +147,7 @@ static void test_device_abi(void)
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		uint32_t version;
 | 
							uint32_t version;
 | 
				
			||||||
		int (*info) (void *object, const struct pw_device_info *info);
 | 
							int (*info) (void *object, const struct pw_device_info *info);
 | 
				
			||||||
		int (*param) (void *object, uint32_t seq,
 | 
							int (*param) (void *object, int seq,
 | 
				
			||||||
			uint32_t id, uint32_t index, uint32_t next,
 | 
								uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
			const struct spa_pod *param);
 | 
								const struct spa_pod *param);
 | 
				
			||||||
	} events = { PW_VERSION_DEVICE_PROXY_EVENTS, };
 | 
						} events = { PW_VERSION_DEVICE_PROXY_EVENTS, };
 | 
				
			||||||
| 
						 | 
					@ -171,7 +171,7 @@ static void test_node_abi(void)
 | 
				
			||||||
	struct pw_node_proxy_events e;
 | 
						struct pw_node_proxy_events e;
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		uint32_t version;
 | 
							uint32_t version;
 | 
				
			||||||
		int (*enum_params) (void *object, uint32_t seq, uint32_t id,
 | 
							int (*enum_params) (void *object, int seq, uint32_t id,
 | 
				
			||||||
			uint32_t start, uint32_t num, const struct spa_pod *filter);
 | 
								uint32_t start, uint32_t num, const struct spa_pod *filter);
 | 
				
			||||||
		int (*set_param) (void *object, uint32_t id, uint32_t flags,
 | 
							int (*set_param) (void *object, uint32_t id, uint32_t flags,
 | 
				
			||||||
			const struct spa_pod *param);
 | 
								const struct spa_pod *param);
 | 
				
			||||||
| 
						 | 
					@ -180,7 +180,7 @@ static void test_node_abi(void)
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		uint32_t version;
 | 
							uint32_t version;
 | 
				
			||||||
		int (*info) (void *object, const struct pw_node_info *info);
 | 
							int (*info) (void *object, const struct pw_node_info *info);
 | 
				
			||||||
		int (*param) (void *object, uint32_t seq,
 | 
							int (*param) (void *object, int seq,
 | 
				
			||||||
			uint32_t id, uint32_t index, uint32_t next,
 | 
								uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
			const struct spa_pod *param);
 | 
								const struct spa_pod *param);
 | 
				
			||||||
	} events = { PW_VERSION_NODE_PROXY_EVENTS, };
 | 
						} events = { PW_VERSION_NODE_PROXY_EVENTS, };
 | 
				
			||||||
| 
						 | 
					@ -205,13 +205,13 @@ static void test_port_abi(void)
 | 
				
			||||||
	struct pw_port_proxy_events e;
 | 
						struct pw_port_proxy_events e;
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		uint32_t version;
 | 
							uint32_t version;
 | 
				
			||||||
		int (*enum_params) (void *object, uint32_t seq, uint32_t id,
 | 
							int (*enum_params) (void *object, int seq, uint32_t id,
 | 
				
			||||||
			uint32_t start, uint32_t num, const struct spa_pod *filter);
 | 
								uint32_t start, uint32_t num, const struct spa_pod *filter);
 | 
				
			||||||
	} methods = { PW_VERSION_PORT_PROXY_METHODS, };
 | 
						} methods = { PW_VERSION_PORT_PROXY_METHODS, };
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
		uint32_t version;
 | 
							uint32_t version;
 | 
				
			||||||
		int (*info) (void *object, const struct pw_port_info *info);
 | 
							int (*info) (void *object, const struct pw_port_info *info);
 | 
				
			||||||
		int (*param) (void *object, uint32_t seq,
 | 
							int (*param) (void *object, int seq,
 | 
				
			||||||
			uint32_t id, uint32_t index, uint32_t next,
 | 
								uint32_t id, uint32_t index, uint32_t next,
 | 
				
			||||||
			const struct spa_pod *param);
 | 
								const struct spa_pod *param);
 | 
				
			||||||
	} events = { PW_VERSION_PORT_PROXY_EVENTS, };
 | 
						} events = { PW_VERSION_PORT_PROXY_EVENTS, };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ struct remote_data {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct pw_remote *remote;
 | 
						struct pw_remote *remote;
 | 
				
			||||||
	struct spa_hook remote_listener;
 | 
						struct spa_hook remote_listener;
 | 
				
			||||||
	uint32_t prompt_pending;
 | 
						int prompt_pending;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct pw_core_proxy *core_proxy;
 | 
						struct pw_core_proxy *core_proxy;
 | 
				
			||||||
	struct spa_hook core_listener;
 | 
						struct spa_hook core_listener;
 | 
				
			||||||
| 
						 | 
					@ -258,7 +258,7 @@ static void show_prompt(struct remote_data *rd)
 | 
				
			||||||
	fflush(stdout);
 | 
						fflush(stdout);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int on_core_done(void *_data, uint32_t id, uint32_t seq)
 | 
					static int on_core_done(void *_data, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct remote_data *rd = _data;
 | 
						struct remote_data *rd = _data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -393,7 +393,7 @@ static void on_state_changed(void *_data, enum pw_remote_state old,
 | 
				
			||||||
		pw_registry_proxy_add_listener(rd->registry_proxy,
 | 
							pw_registry_proxy_add_listener(rd->registry_proxy,
 | 
				
			||||||
					       &rd->registry_listener,
 | 
										       &rd->registry_listener,
 | 
				
			||||||
					       ®istry_events, rd);
 | 
										       ®istry_events, rd);
 | 
				
			||||||
		pw_core_proxy_sync(rd->core_proxy, 0, ++rd->prompt_pending);
 | 
							rd->prompt_pending = pw_core_proxy_sync(rd->core_proxy, 0, 0);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
| 
						 | 
					@ -687,7 +687,7 @@ static int node_event_info(void *object, const struct pw_node_info *info)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int node_event_param(void *object, uint32_t seq, uint32_t id,
 | 
					static int node_event_param(void *object, int seq, uint32_t id,
 | 
				
			||||||
		uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
							uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
        struct proxy_data *data = object;
 | 
					        struct proxy_data *data = object;
 | 
				
			||||||
| 
						 | 
					@ -726,7 +726,7 @@ static int port_event_info(void *object, const struct pw_port_info *info)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int port_event_param(void *object, uint32_t seq, uint32_t id,
 | 
					static int port_event_param(void *object, int seq, uint32_t id,
 | 
				
			||||||
		uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
							uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
        struct proxy_data *data = object;
 | 
					        struct proxy_data *data = object;
 | 
				
			||||||
| 
						 | 
					@ -1206,7 +1206,7 @@ static bool do_node_params(struct data *data, const char *cmd, char *args, char
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_node_proxy_enum_params((struct pw_node_proxy*)global->proxy,
 | 
						pw_node_proxy_enum_params((struct pw_node_proxy*)global->proxy, 0,
 | 
				
			||||||
			param_id, 0, 0, NULL);
 | 
								param_id, 0, 0, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
| 
						 | 
					@ -1245,7 +1245,7 @@ static bool do_port_params(struct data *data, const char *cmd, char *args, char
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_port_proxy_enum_params((struct pw_port_proxy*)global->proxy,
 | 
						pw_port_proxy_enum_params((struct pw_port_proxy*)global->proxy, 0,
 | 
				
			||||||
			param_id, 0, 0, NULL);
 | 
								param_id, 0, 0, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
| 
						 | 
					@ -1389,7 +1389,7 @@ static void do_input(void *data, int fd, enum spa_io mask)
 | 
				
			||||||
		else  {
 | 
							else  {
 | 
				
			||||||
			struct remote_data *rd = d->current;
 | 
								struct remote_data *rd = d->current;
 | 
				
			||||||
			if (rd->core_proxy)
 | 
								if (rd->core_proxy)
 | 
				
			||||||
				pw_core_proxy_sync(rd->core_proxy, 0, ++rd->prompt_pending);
 | 
									rd->prompt_pending = pw_core_proxy_sync(rd->core_proxy, 0, 0);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,7 +48,6 @@ struct data {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct pw_core_proxy *core_proxy;
 | 
						struct pw_core_proxy *core_proxy;
 | 
				
			||||||
	struct spa_hook core_listener;
 | 
						struct spa_hook core_listener;
 | 
				
			||||||
	uint32_t seq;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct pw_registry_proxy *registry_proxy;
 | 
						struct pw_registry_proxy *registry_proxy;
 | 
				
			||||||
	struct spa_hook registry_listener;
 | 
						struct spa_hook registry_listener;
 | 
				
			||||||
| 
						 | 
					@ -69,7 +68,7 @@ struct proxy_data {
 | 
				
			||||||
	pw_destroy_t destroy;
 | 
						pw_destroy_t destroy;
 | 
				
			||||||
	struct spa_hook proxy_listener;
 | 
						struct spa_hook proxy_listener;
 | 
				
			||||||
	struct spa_hook proxy_proxy_listener;
 | 
						struct spa_hook proxy_proxy_listener;
 | 
				
			||||||
	uint32_t pending_seq;
 | 
						int pending_seq;
 | 
				
			||||||
	struct spa_list pending_link;
 | 
						struct spa_list pending_link;
 | 
				
			||||||
	print_func_t print_func;
 | 
						print_func_t print_func;
 | 
				
			||||||
	uint32_t n_params;
 | 
						uint32_t n_params;
 | 
				
			||||||
| 
						 | 
					@ -81,19 +80,18 @@ static void add_pending(struct proxy_data *pd)
 | 
				
			||||||
	struct data *d = pd->data;
 | 
						struct data *d = pd->data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_append(&d->pending_list, &pd->pending_link);
 | 
						spa_list_append(&d->pending_list, &pd->pending_link);
 | 
				
			||||||
	pd->pending_seq = d->seq++;
 | 
						pd->pending_seq = pw_core_proxy_sync(d->core_proxy, 0, pd->pending_seq);
 | 
				
			||||||
	pw_core_proxy_sync(d->core_proxy, 0, d->seq);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void remove_pending(struct proxy_data *pd)
 | 
					static void remove_pending(struct proxy_data *pd)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (pd->pending_seq != SPA_ID_INVALID) {
 | 
						if (pd->pending_seq != 0) {
 | 
				
			||||||
		spa_list_remove(&pd->pending_link);
 | 
							spa_list_remove(&pd->pending_link);
 | 
				
			||||||
		pd->pending_seq = SPA_ID_INVALID;
 | 
							pd->pending_seq = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int on_core_done(void *data, uint32_t id, uint32_t seq)
 | 
					static int on_core_done(void *data, uint32_t id, int seq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct data *d = data;
 | 
						struct data *d = data;
 | 
				
			||||||
	struct proxy_data *pd, *t;
 | 
						struct proxy_data *pd, *t;
 | 
				
			||||||
| 
						 | 
					@ -262,15 +260,15 @@ static int node_event_info(void *object, const struct pw_node_info *info)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (is_new) {
 | 
						if (is_new) {
 | 
				
			||||||
		pw_node_proxy_enum_params((struct pw_node_proxy*)data->proxy,
 | 
							pw_node_proxy_enum_params((struct pw_node_proxy*)data->proxy,
 | 
				
			||||||
				SPA_PARAM_List, 0, 0, NULL);
 | 
									0, SPA_PARAM_List, 0, 0, NULL);
 | 
				
			||||||
		add_pending(data);
 | 
							add_pending(data);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (data->pending_seq == SPA_ID_INVALID)
 | 
						if (data->pending_seq == 0)
 | 
				
			||||||
		data->print_func(data);
 | 
							data->print_func(data);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int node_event_param(void *object, uint32_t seq, uint32_t id,
 | 
					static int node_event_param(void *object, int seq, uint32_t id,
 | 
				
			||||||
		uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
							uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
        struct proxy_data *data = object;
 | 
					        struct proxy_data *data = object;
 | 
				
			||||||
| 
						 | 
					@ -330,15 +328,15 @@ static int port_event_info(void *object, const struct pw_port_info *info)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (is_new) {
 | 
						if (is_new) {
 | 
				
			||||||
		pw_port_proxy_enum_params((struct pw_port_proxy*)data->proxy,
 | 
							pw_port_proxy_enum_params((struct pw_port_proxy*)data->proxy,
 | 
				
			||||||
				SPA_PARAM_EnumFormat, 0, 0, NULL);
 | 
									0, SPA_PARAM_EnumFormat, 0, 0, NULL);
 | 
				
			||||||
		add_pending(data);
 | 
							add_pending(data);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (data->pending_seq == SPA_ID_INVALID)
 | 
						if (data->pending_seq == 0)
 | 
				
			||||||
		data->print_func(data);
 | 
							data->print_func(data);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int port_event_param(void *object, uint32_t seq, uint32_t id,
 | 
					static int port_event_param(void *object, int seq, uint32_t id,
 | 
				
			||||||
		uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
							uint32_t index, uint32_t next, const struct spa_pod *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
        struct proxy_data *data = object;
 | 
					        struct proxy_data *data = object;
 | 
				
			||||||
| 
						 | 
					@ -606,7 +604,7 @@ static int registry_event_global(void *data, uint32_t id, uint32_t parent_id,
 | 
				
			||||||
	pd->version = version;
 | 
						pd->version = version;
 | 
				
			||||||
	pd->type = type;
 | 
						pd->type = type;
 | 
				
			||||||
	pd->destroy = destroy;
 | 
						pd->destroy = destroy;
 | 
				
			||||||
	pd->pending_seq = SPA_ID_INVALID;
 | 
						pd->pending_seq = 0;
 | 
				
			||||||
	pd->print_func = print_func;
 | 
						pd->print_func = print_func;
 | 
				
			||||||
        pw_proxy_add_proxy_listener(proxy, &pd->proxy_proxy_listener, events, pd);
 | 
					        pw_proxy_add_proxy_listener(proxy, &pd->proxy_proxy_listener, events, pd);
 | 
				
			||||||
        pw_proxy_add_listener(proxy, &pd->proxy_listener, &proxy_events, pd);
 | 
					        pw_proxy_add_listener(proxy, &pd->proxy_listener, &proxy_events, pd);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue