mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
Use errno for result errors
Make new enumeration for data transport status and use errno style error numbers for errors.
This commit is contained in:
parent
dda28b1589
commit
6fb0f580ea
86 changed files with 2019 additions and 1988 deletions
|
|
@ -124,7 +124,7 @@ link_state_changed(void *data, enum pw_link_state old, enum pw_link_state state,
|
|||
|
||||
pw_log_debug("module %p: link %p: state error: %s", impl, link, error);
|
||||
if (owner)
|
||||
pw_resource_error(pw_client_get_core_resource(owner), SPA_RESULT_ERROR, error);
|
||||
pw_resource_error(pw_client_get_core_resource(owner), -ENODEV, error);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -218,7 +218,7 @@ static void try_link_port(struct pw_node *node, struct pw_port *port, struct nod
|
|||
struct pw_global *global = pw_node_get_global(info->node);
|
||||
struct pw_client *owner = pw_global_get_owner(global);
|
||||
if (owner)
|
||||
pw_resource_error(pw_client_get_core_resource(owner), SPA_RESULT_ERROR, error);
|
||||
pw_resource_error(pw_client_get_core_resource(owner), -EINVAL, error);
|
||||
}
|
||||
free(error);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -67,11 +67,11 @@ static void *create_object(void *_data,
|
|||
|
||||
no_resource:
|
||||
pw_log_error("client-node needs a resource");
|
||||
pw_resource_error(resource, SPA_RESULT_INVALID_ARGUMENTS, "no resource");
|
||||
pw_resource_error(resource, -EINVAL, "no resource");
|
||||
goto done;
|
||||
no_mem:
|
||||
pw_log_error("can't create node");
|
||||
pw_resource_error(resource, SPA_RESULT_NO_MEMORY, "no memory");
|
||||
pw_resource_error(resource, -ENOMEM, "no memory");
|
||||
goto done;
|
||||
done:
|
||||
if (properties)
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ static int clear_buffers(struct proxy *this, struct proxy_port *port)
|
|||
spa_log_info(this->log, "proxy %p: clear buffers", this);
|
||||
port->n_buffers = 0;
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spa_proxy_node_enum_params(struct spa_node *node,
|
||||
|
|
@ -158,9 +158,9 @@ static int spa_proxy_node_enum_params(struct spa_node *node,
|
|||
struct proxy *this;
|
||||
uint32_t offset;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail(index != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail(builder != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(index != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(builder != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
|
|
@ -170,19 +170,19 @@ static int spa_proxy_node_enum_params(struct spa_node *node,
|
|||
struct spa_pod_object *param;
|
||||
|
||||
if (*index >= this->n_params)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
param = this->params[(*index)++];
|
||||
|
||||
if (param->body.id != id)
|
||||
continue;
|
||||
|
||||
if (spa_pod_filter(builder, ¶m->pod, &filter->pod) == SPA_RESULT_OK)
|
||||
if (spa_pod_filter(builder, ¶m->pod, &filter->pod) == 0)
|
||||
break;
|
||||
|
||||
spa_pod_builder_reset(builder, offset);
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int spa_proxy_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
|
||||
|
|
@ -191,12 +191,12 @@ static int spa_proxy_node_set_param(struct spa_node *node, uint32_t id, uint32_t
|
|||
struct proxy *this;
|
||||
|
||||
if (node == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (this->resource == NULL)
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
|
||||
pw_client_node_resource_set_param(this->resource, this->seq, id, flags, param);
|
||||
|
||||
|
|
@ -214,16 +214,16 @@ static inline void do_flush(struct proxy *this)
|
|||
static int spa_proxy_node_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
struct proxy *this;
|
||||
int res = SPA_RESULT_OK;
|
||||
int res = 0;
|
||||
struct pw_type *t;
|
||||
|
||||
if (node == NULL || command == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (this->resource == NULL)
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
|
||||
t = this->impl->t;
|
||||
|
||||
|
|
@ -245,13 +245,13 @@ spa_proxy_node_set_callbacks(struct spa_node *node,
|
|||
struct proxy *this;
|
||||
|
||||
if (node == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
this->callbacks = callbacks;
|
||||
this->callbacks_data = data;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -264,7 +264,7 @@ spa_proxy_node_get_n_ports(struct spa_node *node,
|
|||
struct proxy *this;
|
||||
|
||||
if (node == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ spa_proxy_node_get_n_ports(struct spa_node *node,
|
|||
if (max_output_ports)
|
||||
*max_output_ports = this->max_outputs == 0 ? this->n_outputs : this->max_outputs;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -291,7 +291,7 @@ spa_proxy_node_get_port_ids(struct spa_node *node,
|
|||
int c, i;
|
||||
|
||||
if (node == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
|
|
@ -307,7 +307,7 @@ spa_proxy_node_get_port_ids(struct spa_node *node,
|
|||
output_ids[c++] = i;
|
||||
}
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -394,17 +394,17 @@ spa_proxy_node_add_port(struct spa_node *node, enum spa_direction direction, uin
|
|||
struct proxy_port *port;
|
||||
|
||||
if (node == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (!CHECK_FREE_PORT(this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
return -EINVAL;
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
clear_port(this, port, direction, port_id);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -413,16 +413,16 @@ spa_proxy_node_remove_port(struct spa_node *node, enum spa_direction direction,
|
|||
struct proxy *this;
|
||||
|
||||
if (node == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (!CHECK_PORT(this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
return -EINVAL;
|
||||
|
||||
do_uninit_port(this, direction, port_id);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -434,17 +434,17 @@ spa_proxy_node_port_get_info(struct spa_node *node,
|
|||
struct proxy_port *port;
|
||||
|
||||
if (node == NULL || info == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (!CHECK_PORT(this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
return -EINVAL;
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
*info = &port->info;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -458,13 +458,13 @@ spa_proxy_node_port_enum_params(struct spa_node *node,
|
|||
struct proxy_port *port;
|
||||
uint32_t offset;
|
||||
|
||||
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail(index != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail(builder != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail(node != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(index != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(builder != NULL, -EINVAL);
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
||||
spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
||||
|
|
@ -473,19 +473,19 @@ spa_proxy_node_port_enum_params(struct spa_node *node,
|
|||
struct spa_pod_object *param;
|
||||
|
||||
if (*index >= port->n_params)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
param = port->params[(*index)++];
|
||||
|
||||
if (param->body.id != id)
|
||||
continue;
|
||||
|
||||
if (spa_pod_filter(builder, ¶m->pod, &filter->pod) == SPA_RESULT_OK)
|
||||
if (spa_pod_filter(builder, ¶m->pod, &filter->pod) == 0)
|
||||
break;
|
||||
|
||||
spa_pod_builder_reset(builder, offset);
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -497,15 +497,15 @@ spa_proxy_node_port_set_param(struct spa_node *node,
|
|||
struct proxy *this;
|
||||
|
||||
if (node == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (!CHECK_PORT(this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
return -EINVAL;
|
||||
|
||||
if (this->resource == NULL)
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
|
||||
pw_client_node_resource_port_set_param(this->resource,
|
||||
this->seq,
|
||||
|
|
@ -524,17 +524,17 @@ spa_proxy_node_port_set_io(struct spa_node *node,
|
|||
struct proxy_port *port;
|
||||
|
||||
if (node == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (!CHECK_PORT(this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
return -EINVAL;
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
port->io = io;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -560,12 +560,12 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
t = impl->t;
|
||||
|
||||
if (!CHECK_PORT(this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
return -EINVAL;
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
||||
if (!port->have_format)
|
||||
return SPA_RESULT_NO_FORMAT;
|
||||
return -EIO;
|
||||
|
||||
clear_buffers(this, port);
|
||||
|
||||
|
|
@ -578,7 +578,7 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
port->n_buffers = n_buffers;
|
||||
|
||||
if (this->resource == NULL)
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
|
||||
n_mem = 0;
|
||||
for (i = 0; i < n_buffers; i++) {
|
||||
|
|
@ -587,7 +587,7 @@ spa_proxy_node_port_use_buffers(struct spa_node *node,
|
|||
msh = spa_buffer_find_meta(buffers[i], t->meta.Shared);
|
||||
if (msh == NULL) {
|
||||
spa_log_error(this->log, "missing shared metadata on buffer %d", i);
|
||||
return SPA_RESULT_ERROR;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
b->outbuf = buffers[i];
|
||||
|
|
@ -660,19 +660,19 @@ spa_proxy_node_port_alloc_buffers(struct spa_node *node,
|
|||
struct proxy_port *port;
|
||||
|
||||
if (node == NULL || buffers == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
if (!CHECK_PORT(this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
return -EINVAL;
|
||||
|
||||
port = GET_PORT(this, direction, port_id);
|
||||
|
||||
if (!port->have_format)
|
||||
return SPA_RESULT_NO_FORMAT;
|
||||
return -EIO;
|
||||
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -685,14 +685,14 @@ spa_proxy_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32
|
|||
impl = this->impl;
|
||||
|
||||
if (!CHECK_OUT_PORT(this, SPA_DIRECTION_OUTPUT, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
return -EINVAL;
|
||||
|
||||
spa_log_trace(this->log, "reuse buffer %d", buffer_id);
|
||||
|
||||
pw_client_node_transport_add_message(impl->transport, (struct pw_client_node_message *)
|
||||
&PW_CLIENT_NODE_MESSAGE_REUSE_BUFFER_INIT(port_id, buffer_id));
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -703,12 +703,12 @@ spa_proxy_node_port_send_command(struct spa_node *node,
|
|||
struct proxy *this;
|
||||
|
||||
if (node == NULL || command == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
this = SPA_CONTAINER_OF(node, struct proxy, node);
|
||||
|
||||
spa_log_warn(this->log, "unhandled command %d", SPA_COMMAND_TYPE(command));
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int spa_proxy_node_process_input(struct spa_node *node)
|
||||
|
|
@ -724,8 +724,8 @@ static int spa_proxy_node_process_input(struct spa_node *node)
|
|||
/* the client is not ready to receive our buffers, recycle them */
|
||||
pw_log_trace("node not ready, recycle buffers");
|
||||
spa_list_for_each(p, &n->ports[SPA_DIRECTION_INPUT], link)
|
||||
p->io->status = SPA_RESULT_NEED_BUFFER;
|
||||
res = SPA_RESULT_NEED_BUFFER;
|
||||
p->io->status = SPA_STATUS_NEED_BUFFER;
|
||||
res = SPA_STATUS_NEED_BUFFER;
|
||||
}
|
||||
else {
|
||||
spa_list_for_each(p, &n->ports[SPA_DIRECTION_INPUT], link) {
|
||||
|
|
@ -743,7 +743,7 @@ static int spa_proxy_node_process_input(struct spa_node *node)
|
|||
do_flush(this);
|
||||
|
||||
impl->input_ready--;
|
||||
res = SPA_RESULT_OK;
|
||||
res = SPA_STATUS_OK;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -779,7 +779,7 @@ static int spa_proxy_node_process_output(struct spa_node *node)
|
|||
&PW_CLIENT_NODE_MESSAGE_INIT(PW_CLIENT_NODE_MESSAGE_PROCESS_OUTPUT));
|
||||
do_flush(this);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return SPA_STATUS_OK;
|
||||
}
|
||||
|
||||
static int handle_node_message(struct proxy *this, struct pw_client_node_message *message)
|
||||
|
|
@ -812,7 +812,7 @@ static int handle_node_message(struct proxy *this, struct pw_client_node_message
|
|||
p->body.buffer_id.value);
|
||||
}
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void setup_transport(struct impl *impl)
|
||||
|
|
@ -832,7 +832,7 @@ client_node_done(void *data, int seq, int res)
|
|||
struct impl *impl = data;
|
||||
struct proxy *this = &impl->proxy;
|
||||
|
||||
if (seq == 0 && res == SPA_RESULT_OK)
|
||||
if (seq == 0 && res == 0)
|
||||
setup_transport(impl);
|
||||
|
||||
this->callbacks->done(this->callbacks_data, seq, res);
|
||||
|
|
@ -946,7 +946,7 @@ static void proxy_on_data_fd_events(struct spa_source *source)
|
|||
spa_log_warn(this->log, "proxy %p: error reading message: %s",
|
||||
this, strerror(errno));
|
||||
|
||||
while (pw_client_node_transport_next_message(impl->transport, &message) == SPA_RESULT_OK) {
|
||||
while (pw_client_node_transport_next_message(impl->transport, &message) == 1) {
|
||||
struct pw_client_node_message *msg = alloca(SPA_POD_SIZE(&message));
|
||||
pw_client_node_transport_parse_message(impl->transport, msg);
|
||||
handle_node_message(this, msg);
|
||||
|
|
@ -995,11 +995,11 @@ proxy_init(struct proxy *this,
|
|||
}
|
||||
if (this->data_loop == NULL) {
|
||||
spa_log_error(this->log, "a data-loop is needed");
|
||||
return SPA_RESULT_ERROR;
|
||||
return -EINVAL;
|
||||
}
|
||||
if (this->map == NULL) {
|
||||
spa_log_error(this->log, "a type map is needed");
|
||||
return SPA_RESULT_ERROR;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
this->node = proxy_node;
|
||||
|
|
@ -1026,7 +1026,7 @@ static int proxy_clear(struct proxy *this)
|
|||
clear_port(this, &this->out_ports[i], SPA_DIRECTION_OUTPUT, i);
|
||||
}
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void client_node_resource_destroy(void *data)
|
||||
|
|
|
|||
|
|
@ -87,11 +87,11 @@ static void transport_reset_area(struct pw_client_node_transport *trans)
|
|||
struct pw_client_node_area *a = trans->area;
|
||||
|
||||
for (i = 0; i < a->max_input_ports; i++) {
|
||||
trans->inputs[i].status = SPA_RESULT_OK;
|
||||
trans->inputs[i].status = SPA_STATUS_OK;
|
||||
trans->inputs[i].buffer_id = SPA_ID_INVALID;
|
||||
}
|
||||
for (i = 0; i < a->max_output_ports; i++) {
|
||||
trans->outputs[i].status = SPA_RESULT_OK;
|
||||
trans->outputs[i].status = SPA_STATUS_OK;
|
||||
trans->outputs[i].buffer_id = SPA_ID_INVALID;
|
||||
}
|
||||
spa_ringbuffer_init(trans->input_buffer, INPUT_BUFFER_SIZE);
|
||||
|
|
@ -115,20 +115,20 @@ static int add_message(struct pw_client_node_transport *trans, struct pw_client_
|
|||
uint32_t size, index;
|
||||
|
||||
if (impl == NULL || message == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
filled = spa_ringbuffer_get_write_index(trans->output_buffer, &index);
|
||||
avail = trans->output_buffer->size - filled;
|
||||
size = SPA_POD_SIZE(message);
|
||||
if (avail < size)
|
||||
return SPA_RESULT_ERROR;
|
||||
return -ENOSPC;
|
||||
|
||||
spa_ringbuffer_write_data(trans->output_buffer,
|
||||
trans->output_data,
|
||||
index & trans->output_buffer->mask, message, size);
|
||||
spa_ringbuffer_write_update(trans->output_buffer, index + size);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int next_message(struct pw_client_node_transport *trans, struct pw_client_node_message *message)
|
||||
|
|
@ -137,11 +137,11 @@ static int next_message(struct pw_client_node_transport *trans, struct pw_client
|
|||
int32_t avail;
|
||||
|
||||
if (impl == NULL || message == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
avail = spa_ringbuffer_get_read_index(trans->input_buffer, &impl->current_index);
|
||||
if (avail < sizeof(struct pw_client_node_message))
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
spa_ringbuffer_read_data(trans->input_buffer,
|
||||
trans->input_data,
|
||||
|
|
@ -150,7 +150,7 @@ static int next_message(struct pw_client_node_transport *trans, struct pw_client
|
|||
|
||||
*message = impl->current;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int parse_message(struct pw_client_node_transport *trans, void *message)
|
||||
|
|
@ -159,7 +159,7 @@ static int parse_message(struct pw_client_node_transport *trans, void *message)
|
|||
uint32_t size;
|
||||
|
||||
if (impl == NULL || message == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
size = SPA_POD_SIZE(&impl->current);
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ static int parse_message(struct pw_client_node_transport *trans, void *message)
|
|||
impl->current_index & trans->input_buffer->mask, message, size);
|
||||
spa_ringbuffer_read_update(trans->input_buffer, impl->current_index + size);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Create a new transport
|
||||
|
|
@ -229,7 +229,7 @@ pw_client_node_transport_new_from_info(struct pw_client_node_transport_info *inf
|
|||
impl->mem.fd = info->memfd;
|
||||
impl->mem.offset = info->offset;
|
||||
impl->mem.size = info->size;
|
||||
if (pw_memblock_map(&impl->mem) != SPA_RESULT_OK) {
|
||||
if (pw_memblock_map(&impl->mem) < 0) {
|
||||
pw_log_warn("transport %p: failed to map fd %d: %s", impl, info->memfd,
|
||||
strerror(errno));
|
||||
goto mmap_failed;
|
||||
|
|
@ -278,5 +278,5 @@ int pw_client_node_transport_get_info(struct pw_client_node_transport *trans,
|
|||
info->offset = impl->offset;
|
||||
info->size = impl->mem.size;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ portal_response(DBusConnection *connection, DBusMessage *msg, void *user_data)
|
|||
&p->properties->dict,
|
||||
p->new_id);
|
||||
} else {
|
||||
pw_resource_error(p->resource->resource, SPA_RESULT_NO_PERMISSION, "not allowed");
|
||||
pw_resource_error(p->resource->resource, -EPERM, "not allowed");
|
||||
|
||||
}
|
||||
free_pending(p);
|
||||
|
|
@ -424,7 +424,7 @@ static void do_create_object(void *data,
|
|||
dbus_error_free(&error);
|
||||
goto not_allowed;
|
||||
not_allowed:
|
||||
pw_resource_error(cinfo->core_resource->resource, SPA_RESULT_NO_PERMISSION, "not allowed");
|
||||
pw_resource_error(cinfo->core_resource->resource, -EPERM, "not allowed");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -442,7 +442,7 @@ do_create_link(void *data,
|
|||
struct client_info *cinfo = resource->cinfo;
|
||||
|
||||
if (cinfo->is_sandboxed) {
|
||||
pw_resource_error(resource->resource, SPA_RESULT_NO_PERMISSION, "not allowed");
|
||||
pw_resource_error(resource->resource, -EPERM, "not allowed");
|
||||
return;
|
||||
}
|
||||
pw_resource_do_parent(resource->resource,
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ static int do_add_node(struct spa_loop *loop, bool async, uint32_t seq, size_t s
|
|||
struct jack_client *jc = user_data;
|
||||
struct impl *impl = jc->data;
|
||||
spa_list_append(&impl->rt.nodes, &jc->node->graph_link);
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_remove_node(struct spa_loop *loop, bool async, uint32_t seq, size_t size, const void *data,
|
||||
|
|
@ -338,7 +338,7 @@ static int do_remove_node(struct spa_loop *loop, bool async, uint32_t seq, size_
|
|||
{
|
||||
struct jack_client *jc = user_data;
|
||||
spa_list_remove(&jc->node->graph_link);
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -1102,7 +1102,7 @@ static int do_graph_order_changed(struct spa_loop *loop,
|
|||
}
|
||||
|
||||
notify_clients(impl, jack_notify_GraphOrderCallback, false, "", 0, 0);
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void jack_node_pull(void *data)
|
||||
|
|
@ -1328,7 +1328,7 @@ static bool on_global(void *data, struct pw_global *global)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (spa_node_enum_params(node->node, SPA_ID_INVALID, &index, NULL, &b) == SPA_RESULT_OK) {
|
||||
if (spa_node_enum_params(node->node, SPA_ID_INVALID, &index, NULL, &b) == 1) {
|
||||
int min_latency = -1;
|
||||
struct spa_pod_object *props = spa_pod_builder_deref(&b, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -128,26 +128,26 @@ static int node_enum_params(struct spa_node *node,
|
|||
const struct spa_pod_object *filter,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int node_set_param(struct spa_node *node,
|
||||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int node_send_command(struct spa_node *node,
|
||||
const struct spa_command *command)
|
||||
{
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int node_set_callbacks(struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks, void *data)
|
||||
{
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int node_get_n_ports(struct spa_node *node,
|
||||
|
|
@ -167,7 +167,7 @@ static int node_get_n_ports(struct spa_node *node,
|
|||
if (max_output_ports)
|
||||
*max_output_ports = PORT_NUM_FOR_CLIENT / 2;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int node_get_port_ids(struct spa_node *node,
|
||||
|
|
@ -187,17 +187,17 @@ static int node_get_port_ids(struct spa_node *node,
|
|||
if (nd->port_data[SPA_DIRECTION_OUTPUT][i])
|
||||
output_ids[c++] = nd->port_data[SPA_DIRECTION_OUTPUT][i]->port.port->port_id;
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int node_remove_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static struct buffer *buffer_dequeue(struct pw_jack_node *this, struct port_data *pd)
|
||||
|
|
@ -222,7 +222,7 @@ static void recycle_buffer(struct pw_jack_node *this, struct port_data *pd, uint
|
|||
|
||||
static int driver_process_input(struct spa_node *node)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static void conv_f32_s16(int16_t *out, float *in, int n_samples, int stride)
|
||||
|
|
@ -267,8 +267,8 @@ static int driver_process_output(struct spa_node *node)
|
|||
|
||||
pw_log_trace(NAME "%p: process output", this);
|
||||
|
||||
if (out_io->status == SPA_RESULT_HAVE_BUFFER)
|
||||
return SPA_RESULT_HAVE_BUFFER;
|
||||
if (out_io->status == SPA_STATUS_HAVE_BUFFER)
|
||||
return SPA_STATUS_HAVE_BUFFER;
|
||||
|
||||
if (out_io->buffer_id < opd->n_buffers) {
|
||||
recycle_buffer(this, opd, out_io->buffer_id);
|
||||
|
|
@ -277,10 +277,10 @@ static int driver_process_output(struct spa_node *node)
|
|||
|
||||
out = buffer_dequeue(this, opd);
|
||||
if (out == NULL)
|
||||
return SPA_RESULT_OUT_OF_BUFFERS;
|
||||
return -EPIPE;
|
||||
|
||||
out_io->buffer_id = out->outbuf->id;
|
||||
out_io->status = SPA_RESULT_HAVE_BUFFER;
|
||||
out_io->status = SPA_STATUS_HAVE_BUFFER;
|
||||
|
||||
op = out->ptr;
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ static int driver_process_output(struct spa_node *node)
|
|||
struct buffer *in;
|
||||
int stride = 2;
|
||||
|
||||
if (in_io->buffer_id < ipd->n_buffers && in_io->status == SPA_RESULT_HAVE_BUFFER) {
|
||||
if (in_io->buffer_id < ipd->n_buffers && in_io->status == SPA_STATUS_HAVE_BUFFER) {
|
||||
in = &ipd->buffers[in_io->buffer_id];
|
||||
conv_f32_s16(op, in->ptr, ctrl->buffer_size, stride);
|
||||
}
|
||||
|
|
@ -301,14 +301,14 @@ static int driver_process_output(struct spa_node *node)
|
|||
fill_s16(op, ctrl->buffer_size, stride);
|
||||
}
|
||||
op++;
|
||||
in_io->status = SPA_RESULT_NEED_BUFFER;
|
||||
in_io->status = SPA_STATUS_NEED_BUFFER;
|
||||
}
|
||||
out->outbuf->datas[0].chunk->size = ctrl->buffer_size * sizeof(int16_t) * 2;
|
||||
|
||||
spa_hook_list_call(&nd->listener_list, struct pw_jack_node_events, push);
|
||||
gn->ready[SPA_DIRECTION_INPUT] = gn->required[SPA_DIRECTION_OUTPUT] = 0;
|
||||
|
||||
return SPA_RESULT_HAVE_BUFFER;
|
||||
return SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
|
||||
static int node_process_input(struct spa_node *node)
|
||||
|
|
@ -324,8 +324,8 @@ static int node_process_input(struct spa_node *node)
|
|||
int ref_num = this->control->ref_num;
|
||||
|
||||
pw_log_trace(NAME " %p: process input", nd);
|
||||
if (nd->status == SPA_RESULT_HAVE_BUFFER)
|
||||
return SPA_RESULT_HAVE_BUFFER;
|
||||
if (nd->status == SPA_STATUS_HAVE_BUFFER)
|
||||
return SPA_STATUS_HAVE_BUFFER;
|
||||
|
||||
mgr->client_timing[ref_num].status = Triggered;
|
||||
mgr->client_timing[ref_num].signaled_at = current_date;
|
||||
|
|
@ -340,10 +340,10 @@ static int node_process_input(struct spa_node *node)
|
|||
struct port_data *opd = pw_port_get_user_data(port);
|
||||
struct spa_port_io *out_io = opd->io;
|
||||
out_io->buffer_id = 0;
|
||||
out_io->status = SPA_RESULT_HAVE_BUFFER;
|
||||
out_io->status = SPA_STATUS_HAVE_BUFFER;
|
||||
pw_log_trace(NAME " %p: port %p: %d %d", nd, p, out_io->buffer_id, out_io->status);
|
||||
}
|
||||
return nd->status = SPA_RESULT_HAVE_BUFFER;
|
||||
return nd->status = SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
|
||||
static int node_process_output(struct spa_node *node)
|
||||
|
|
@ -359,10 +359,10 @@ static int node_process_output(struct spa_node *node)
|
|||
struct port_data *ipd = pw_port_get_user_data(port);
|
||||
struct spa_port_io *in_io = ipd->io;
|
||||
in_io->buffer_id = 0;
|
||||
in_io->status = SPA_RESULT_NEED_BUFFER;
|
||||
in_io->status = SPA_STATUS_NEED_BUFFER;
|
||||
pw_log_trace(NAME " %p: port %p: %d %d", nd, p, in_io->buffer_id, in_io->status);
|
||||
}
|
||||
return nd->status = SPA_RESULT_NEED_BUFFER;
|
||||
return nd->status = SPA_STATUS_NEED_BUFFER;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -372,7 +372,7 @@ static int port_set_io(struct spa_node *node, enum spa_direction direction, uint
|
|||
struct node_data *nd = SPA_CONTAINER_OF(node, struct node_data, node_impl);
|
||||
struct port_data *pd = nd->port_data[direction][port_id];
|
||||
pd->io = io;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_get_info(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -389,7 +389,7 @@ static int port_get_info(struct spa_node *node, enum spa_direction direction, ui
|
|||
pd->info.rate = pd->node->node.server->engine_control->sample_rate;
|
||||
*info = &pd->info;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_enum_formats(struct spa_node *node,
|
||||
|
|
@ -405,7 +405,7 @@ static int port_enum_formats(struct spa_node *node,
|
|||
struct jack_engine_control *ctrl = pd->node->node.server->engine_control;
|
||||
|
||||
if (index > 0)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
if (pd->port.jack_port) {
|
||||
if (pd->port.jack_port->type_id == 0) {
|
||||
|
|
@ -424,7 +424,7 @@ static int port_enum_formats(struct spa_node *node,
|
|||
"I", t->media_subtype_audio.midi);
|
||||
}
|
||||
else
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
*param = spa_pod_builder_object(builder,
|
||||
|
|
@ -435,7 +435,7 @@ static int port_enum_formats(struct spa_node *node,
|
|||
":", t->format_audio.rate, "i", ctrl->sample_rate,
|
||||
":", t->format_audio.channels, "i", 2);
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int port_enum_params(struct spa_node *node,
|
||||
|
|
@ -454,15 +454,15 @@ static int port_enum_params(struct spa_node *node,
|
|||
|
||||
next:
|
||||
if (id == t->param.idEnumFormat) {
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, ¶m)) < 0)
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else if (id == t->param.idFormat) {
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, ¶m)) < 0)
|
||||
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, ¶m)) <= 0)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
return SPA_RESULT_UNKNOWN_PARAM;
|
||||
return -ENOENT;
|
||||
|
||||
(*index)++;
|
||||
|
||||
|
|
@ -470,7 +470,7 @@ static int port_enum_params(struct spa_node *node,
|
|||
if ((res = spa_pod_filter(builder, param, (struct spa_pod*)filter)) < 0)
|
||||
goto next;
|
||||
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int port_set_param(struct spa_node *node,
|
||||
|
|
@ -478,7 +478,7 @@ static int port_set_param(struct spa_node *node,
|
|||
uint32_t id, uint32_t flags,
|
||||
const struct spa_pod_object *param)
|
||||
{
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_use_buffers(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -490,7 +490,7 @@ static int port_use_buffers(struct spa_node *node, enum spa_direction direction,
|
|||
int i;
|
||||
|
||||
if (pd->have_buffers)
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
|
||||
pw_log_debug("use_buffers %d", n_buffers);
|
||||
for (i = 0; i < n_buffers; i++) {
|
||||
|
|
@ -505,13 +505,13 @@ static int port_use_buffers(struct spa_node *node, enum spa_direction direction,
|
|||
b->ptr = d[0].data;
|
||||
} else {
|
||||
pw_log_error(NAME " %p: invalid memory on buffer %p", pd, buffers[i]);
|
||||
return SPA_RESULT_ERROR;
|
||||
return -EINVAL;
|
||||
}
|
||||
spa_list_append(&pd->empty, &b->link);
|
||||
}
|
||||
pd->n_buffers = n_buffers;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_alloc_buffers(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -537,12 +537,12 @@ static int port_alloc_buffers(struct spa_node *node, enum spa_direction directio
|
|||
}
|
||||
pd->n_buffers = *n_buffers;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int driver_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id)
|
||||
|
|
@ -553,13 +553,13 @@ static int driver_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t
|
|||
|
||||
recycle_buffer(this, opd, buffer_id);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_send_command(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
const struct spa_command *command)
|
||||
{
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_node driver_impl = {
|
||||
|
|
@ -624,7 +624,7 @@ static int schedule_mix_input(struct spa_node *_node)
|
|||
|
||||
pw_log_trace("mix %p: input %d %d", node, p->io->buffer_id, link->output->n_buffers);
|
||||
|
||||
if (!(p->io->buffer_id < link->output->n_buffers && p->io->status == SPA_RESULT_HAVE_BUFFER))
|
||||
if (!(p->io->buffer_id < link->output->n_buffers && p->io->status == SPA_STATUS_HAVE_BUFFER))
|
||||
continue;
|
||||
|
||||
inbuf = link->output->buffers[p->io->buffer_id];
|
||||
|
|
@ -638,10 +638,10 @@ static int schedule_mix_input(struct spa_node *_node)
|
|||
p, p->io, io, p->io->status, p->io->buffer_id);
|
||||
*io = *p->io;
|
||||
io->buffer_id = 0;
|
||||
p->io->status = SPA_RESULT_OK;
|
||||
p->io->status = SPA_STATUS_OK;
|
||||
p->io->buffer_id = SPA_ID_INVALID;
|
||||
}
|
||||
return SPA_RESULT_HAVE_BUFFER;
|
||||
return SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
|
||||
static int schedule_mix_output(struct spa_node *_node)
|
||||
|
|
|
|||
|
|
@ -74,10 +74,10 @@ static const struct spa_handle_factory *find_factory(struct impl *impl)
|
|||
goto no_symbol;
|
||||
}
|
||||
|
||||
for (index = 0;; index++) {
|
||||
if ((res = enum_func(&factory, index)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
pw_log_error("can't enumerate factories: %d", res);
|
||||
for (index = 0;;) {
|
||||
if ((res = enum_func(&factory, &index)) <= 0) {
|
||||
if (res != 0)
|
||||
pw_log_error("can't enumerate factories: %s", spa_strerror(res));
|
||||
goto enum_failed;
|
||||
}
|
||||
if (strcmp(factory->name, "audiomixer") == 0)
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ static void *create_object(void *_data,
|
|||
no_properties:
|
||||
pw_log_error("needed properties: spa.library.name=<library-name> spa.factory.name=<factory-name>");
|
||||
if (resource) {
|
||||
pw_resource_error(resource, SPA_RESULT_INVALID_ARGUMENTS,
|
||||
pw_resource_error(resource, -EINVAL,
|
||||
"needed properties: "
|
||||
"spa.library.name=<library-name> "
|
||||
"spa.factory.name=<factory-name>");
|
||||
|
|
@ -92,7 +92,7 @@ static void *create_object(void *_data,
|
|||
no_mem:
|
||||
pw_log_error("can't create node");
|
||||
if (resource) {
|
||||
pw_resource_error(resource, SPA_RESULT_NO_MEMORY, "no memory");
|
||||
pw_resource_error(resource, -ENOMEM, "no memory");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -253,10 +253,10 @@ struct pw_spa_monitor *pw_spa_monitor_load(struct pw_core *core,
|
|||
goto no_symbol;
|
||||
}
|
||||
|
||||
for (index = 0;; index++) {
|
||||
if ((res = enum_func(&factory, index)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
pw_log_error("can't enumerate factories: %d", res);
|
||||
for (index = 0;;) {
|
||||
if ((res = enum_func(&factory, &index)) <= 0) {
|
||||
if (res != 0)
|
||||
pw_log_error("can't enumerate factories: %s", spa_strerror(res));
|
||||
goto enum_failed;
|
||||
}
|
||||
if (strcmp(factory->name, factory_name) == 0)
|
||||
|
|
@ -294,13 +294,13 @@ struct pw_spa_monitor *pw_spa_monitor_load(struct pw_core *core,
|
|||
|
||||
spa_list_init(&impl->item_list);
|
||||
|
||||
for (index = 0;; index++) {
|
||||
for (index = 0;;) {
|
||||
struct spa_monitor_item *item;
|
||||
int res;
|
||||
|
||||
if ((res = spa_monitor_enum_items(this->monitor, &item, index)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
pw_log_debug("spa_monitor_enum_items: got error %d\n", res);
|
||||
if ((res = spa_monitor_enum_items(this->monitor, &item, &index)) <= 0) {
|
||||
if (res != 0)
|
||||
pw_log_debug("spa_monitor_enum_items: %s\n", spa_strerror(res));
|
||||
break;
|
||||
}
|
||||
add_item(this, item);
|
||||
|
|
|
|||
|
|
@ -163,9 +163,9 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
|
|||
uint8_t buf[2048];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
||||
|
||||
if ((res = spa_node_enum_params(spa_node, t->param.idProps, &index, NULL, &b)) != SPA_RESULT_OK) {
|
||||
if ((res = spa_node_enum_params(spa_node, t->param.idProps, &index, NULL, &b)) <= 0) {
|
||||
pw_log_debug("spa_node_get_props failed: %d", res);
|
||||
return SPA_RESULT_ERROR;
|
||||
return res;
|
||||
}
|
||||
props = spa_pod_builder_deref(&b, 0);
|
||||
|
||||
|
|
@ -218,11 +218,11 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
|
|||
}
|
||||
}
|
||||
|
||||
if ((res = spa_node_set_param(spa_node, t->param.idProps, 0, props)) != SPA_RESULT_OK) {
|
||||
if ((res = spa_node_set_param(spa_node, t->param.idProps, 0, props)) < 0) {
|
||||
pw_log_debug("spa_node_set_props failed: %d", res);
|
||||
return SPA_RESULT_ERROR;
|
||||
return res;
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -266,10 +266,10 @@ struct pw_node *pw_spa_node_load(struct pw_core *core,
|
|||
goto no_symbol;
|
||||
}
|
||||
|
||||
for (index = 0;; index++) {
|
||||
if ((res = enum_func(&factory, index)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
pw_log_error("can't enumerate factories: %d", res);
|
||||
for (index = 0;;) {
|
||||
if ((res = enum_func(&factory, &index)) <= 0) {
|
||||
if (res != 0)
|
||||
pw_log_error("can't enumerate factories: %s", spa_strerror(res));
|
||||
goto enum_failed;
|
||||
}
|
||||
if (strcmp(factory->name, factory_name) == 0)
|
||||
|
|
@ -294,7 +294,7 @@ struct pw_node *pw_spa_node_load(struct pw_core *core,
|
|||
spa_node = iface;
|
||||
|
||||
if (properties != NULL) {
|
||||
if (setup_props(core, spa_node, properties) != SPA_RESULT_OK) {
|
||||
if (setup_props(core, spa_node, properties) < 0) {
|
||||
pw_log_debug("Unrecognized properties");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue