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:
Wim Taymans 2017-11-13 09:41:41 +01:00
parent dda28b1589
commit 6fb0f580ea
86 changed files with 2019 additions and 1988 deletions

View file

@ -17,6 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
#include <errno.h>
typedef enum {
GRAY = 0,
YELLOW,
@ -135,21 +137,21 @@ static int drawing_data_init(DrawingData * dd, struct impl *this, char *data)
if ((format->media_type != this->type.media_type.video) ||
(format->media_subtype != this->type.media_subtype.raw))
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
if (format->info.raw.format == this->type.video_format.RGB) {
dd->draw_pixel = draw_pixel_rgb;
} else if (format->info.raw.format == this->type.video_format.UYVY) {
dd->draw_pixel = draw_pixel_uyvy;
} else
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
dd->line = data;
dd->width = size->width;
dd->height = size->height;
dd->stride = this->stride;
return SPA_RESULT_OK;
return 0;
}
static inline void draw_pixels(DrawingData * dd, int offset, Color color, int length)
@ -264,8 +266,7 @@ static int draw(struct impl *this, char *data)
init_colors();
res = drawing_data_init(&dd, this, data);
if (res != SPA_RESULT_OK)
if ((res = drawing_data_init(&dd, this, data)) < 0)
return res;
pattern = this->props.pattern;
@ -274,7 +275,7 @@ static int draw(struct impl *this, char *data)
else if (pattern == this->type.pattern_snow)
draw_snow(&dd);
else
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
return SPA_RESULT_OK;
return 0;
}

View file

@ -17,21 +17,25 @@
* Boston, MA 02110-1301, USA.
*/
#include <errno.h>
#include <spa/support/plugin.h>
extern const struct spa_handle_factory spa_videotestsrc_factory;
int
spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t index)
spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{
spa_return_val_if_fail(factory != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(index != NULL, -EINVAL);
switch (index) {
switch (*index) {
case 0:
*factory = &spa_videotestsrc_factory;
break;
default:
return SPA_RESULT_ENUM_END;
return 0;
}
return SPA_RESULT_OK;
(*index)++;
return 1;
}

View file

@ -18,6 +18,7 @@
* Boston, MA 02110-1301, USA.
*/
#include <errno.h>
#include <stddef.h>
#include <unistd.h>
#include <string.h>
@ -160,8 +161,8 @@ static int impl_node_enum_params(struct spa_node *node,
uint32_t offset;
struct spa_pod *param;
spa_return_val_if_fail(node != 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(builder != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct impl, node);
t = &this->type;
@ -171,7 +172,7 @@ static int impl_node_enum_params(struct spa_node *node,
next:
if (id == t->param.idList) {
if (*index > 0)
return SPA_RESULT_ENUM_END;
return 0;
param = spa_pod_builder_object(builder,
id, t->param.List,
@ -181,7 +182,7 @@ static int impl_node_enum_params(struct spa_node *node,
struct props *p = &this->props;
if (*index > 0)
return SPA_RESULT_ENUM_END;
return 0;
param = spa_pod_builder_object(builder,
id, t->props,
@ -191,7 +192,7 @@ static int impl_node_enum_params(struct spa_node *node,
t->pattern_snow);
}
else
return SPA_RESULT_UNKNOWN_PARAM;
return -ENOENT;
(*index)++;
@ -199,7 +200,7 @@ static int impl_node_enum_params(struct spa_node *node,
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
goto next;
return SPA_RESULT_OK;
return 1;
}
static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flags,
@ -208,7 +209,7 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
struct impl *this;
struct type *t;
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(node != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct impl, node);
t = &this->type;
@ -227,9 +228,9 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
this->info.flags &= ~SPA_PORT_INFO_FLAG_LIVE;
}
else
return SPA_RESULT_UNKNOWN_PARAM;
return -ENOENT;
return SPA_RESULT_OK;
return 0;
}
#include "draw.c"
@ -280,7 +281,7 @@ static int make_buffer(struct impl *this)
if (spa_list_is_empty(&this->empty)) {
set_timer(this, false);
spa_log_error(this->log, NAME " %p: out of buffers", this);
return SPA_RESULT_OUT_OF_BUFFERS;
return -EPIPE;
}
b = spa_list_first(&this->empty, struct buffer, link);
spa_list_remove(&b->link);
@ -307,7 +308,7 @@ static int make_buffer(struct impl *this)
set_timer(this, true);
io->buffer_id = b->outbuf->id;
io->status = SPA_RESULT_HAVE_BUFFER;
io->status = SPA_STATUS_HAVE_BUFFER;
return io->status;
}
@ -319,7 +320,7 @@ static void on_output(struct spa_source *source)
res = make_buffer(this);
if (res == SPA_RESULT_HAVE_BUFFER)
if (res == SPA_STATUS_HAVE_BUFFER)
this->callbacks->have_output(this->callbacks_data);
}
@ -327,8 +328,8 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
{
struct impl *this;
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(command != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(node != NULL, -EINVAL);
spa_return_val_if_fail(command != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct impl, node);
@ -336,13 +337,12 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
struct timespec now;
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
return -EIO;
if (this->n_buffers == 0)
return SPA_RESULT_NO_BUFFERS;
return -EIO;
if (this->started)
return SPA_RESULT_OK;
return 0;
clock_gettime(CLOCK_MONOTONIC, &now);
if (this->props.live)
@ -356,20 +356,19 @@ static int impl_node_send_command(struct spa_node *node, const struct spa_comman
set_timer(this, true);
} else if (SPA_COMMAND_TYPE(command) == this->type.command_node.Pause) {
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
return -EIO;
if (this->n_buffers == 0)
return SPA_RESULT_NO_BUFFERS;
return -EIO;
if (!this->started)
return SPA_RESULT_OK;
return 0;
this->started = false;
set_timer(this, false);
} else
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
return SPA_RESULT_OK;
return 0;
}
static int
@ -379,14 +378,14 @@ impl_node_set_callbacks(struct spa_node *node,
{
struct impl *this;
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(node != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct impl, node);
this->callbacks = callbacks;
this->callbacks_data = data;
return SPA_RESULT_OK;
return 0;
}
static int
@ -396,7 +395,7 @@ impl_node_get_n_ports(struct spa_node *node,
uint32_t *n_output_ports,
uint32_t *max_output_ports)
{
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(node != NULL, -EINVAL);
if (n_input_ports)
*n_input_ports = 0;
@ -407,7 +406,7 @@ impl_node_get_n_ports(struct spa_node *node,
if (max_output_ports)
*max_output_ports = 1;
return SPA_RESULT_OK;
return 0;
}
static int
@ -417,23 +416,23 @@ impl_node_get_port_ids(struct spa_node *node,
uint32_t n_output_ports,
uint32_t *output_ids)
{
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(node != NULL, -EINVAL);
if (n_output_ports > 0 && output_ids != NULL)
output_ids[0] = 0;
return SPA_RESULT_OK;
return 0;
}
static int impl_node_add_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id)
{
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
}
static int
impl_node_remove_port(struct spa_node *node, enum spa_direction direction, uint32_t port_id)
{
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
}
static int
@ -444,16 +443,16 @@ impl_node_port_get_info(struct spa_node *node,
{
struct impl *this;
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(info != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(node != NULL, -EINVAL);
spa_return_val_if_fail(info != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct impl, 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);
*info = &this->info;
return SPA_RESULT_OK;
return 0;
}
static int port_enum_formats(struct spa_node *node,
@ -483,9 +482,9 @@ static int port_enum_formats(struct spa_node *node,
&SPA_FRACTION(INT32_MAX, 1));
break;
default:
return SPA_RESULT_ENUM_END;
return 0;
}
return SPA_RESULT_OK;
return 1;
}
static int port_get_format(struct spa_node *node,
@ -499,9 +498,9 @@ static int port_get_format(struct spa_node *node,
struct type *t = &this->type;
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
return -EIO;
if (*index > 0)
return SPA_RESULT_ENUM_END;
return 0;
*param = spa_pod_builder_object(builder,
t->param.idFormat, t->format,
@ -511,7 +510,7 @@ static int port_get_format(struct spa_node *node,
":", t->format_video.size, "R", &this->current_format.info.raw.size,
":", t->format_video.framerate, "F", &this->current_format.info.raw.framerate);
return SPA_RESULT_OK;
return 1;
}
static int
@ -527,14 +526,14 @@ impl_node_port_enum_params(struct spa_node *node,
struct spa_pod *param;
int res;
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 impl, node);
t = &this->type;
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);
offset = builder->offset;
@ -549,23 +548,23 @@ impl_node_port_enum_params(struct spa_node *node,
param = spa_pod_builder_object(builder, id, t->param.List,
":", t->param.listId, "I", list[*index]);
else
return SPA_RESULT_ENUM_END;
return 0;
}
else if (id == t->param.idEnumFormat) {
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, &param)) < 0)
if ((res = port_enum_formats(node, direction, port_id, index, filter, builder, &param)) <= 0)
return res;
}
else if (id == t->param.idFormat) {
if ((res = port_get_format(node, direction, port_id, index, filter, builder, &param)) < 0)
if ((res = port_get_format(node, direction, port_id, index, filter, builder, &param)) <= 0)
return res;
}
else if (id == t->param.idBuffers) {
struct spa_video_info_raw *raw_info = &this->current_format.info.raw;
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
return -EIO;
if (*index > 0)
return SPA_RESULT_ENUM_END;
return 0;
param = spa_pod_builder_object(builder,
id, t->param_buffers.Buffers,
@ -577,7 +576,7 @@ impl_node_port_enum_params(struct spa_node *node,
}
else if (id == t->param.idMeta) {
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
return -EIO;
switch (*index) {
case 0:
@ -588,11 +587,11 @@ impl_node_port_enum_params(struct spa_node *node,
break;
default:
return SPA_RESULT_ENUM_END;
return 0;
}
}
else
return SPA_RESULT_UNKNOWN_PARAM;
return -ENOENT;
(*index)++;
@ -600,7 +599,7 @@ impl_node_port_enum_params(struct spa_node *node,
if (spa_pod_filter(builder, param, (struct spa_pod*)filter) < 0)
goto next;
return SPA_RESULT_OK;
return 1;
}
static int clear_buffers(struct impl *this)
@ -612,7 +611,7 @@ static int clear_buffers(struct impl *this)
this->started = false;
set_timer(this, false);
}
return SPA_RESULT_OK;
return 0;
}
static int port_set_format(struct spa_node *node,
@ -634,17 +633,17 @@ static int port_set_format(struct spa_node *node,
if (info.media_type != this->type.media_type.video &&
info.media_subtype != this->type.media_subtype.raw)
return SPA_RESULT_INVALID_MEDIA_TYPE;
return -EINVAL;
if (spa_format_video_raw_parse(format, &info.info.raw, &this->type.format_video) < 0)
return SPA_RESULT_INVALID_MEDIA_TYPE;
return -EINVAL;
if (info.info.raw.format == this->type.video_format.RGB)
this->bpp = 3;
else if (info.info.raw.format == this->type.video_format.UYVY)
this->bpp = 2;
else
return SPA_RESULT_INVALID_MEDIA_TYPE;
return -EINVAL;
this->current_format = info;
this->have_format = true;
@ -655,7 +654,7 @@ static int port_set_format(struct spa_node *node,
this->stride = SPA_ROUND_UP_N(this->bpp * raw_info->size.width, 4);
}
return SPA_RESULT_OK;
return 0;
}
static int
@ -667,18 +666,18 @@ impl_node_port_set_param(struct spa_node *node,
struct impl *this;
struct type *t;
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(node != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct impl, node);
t = &this->type;
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);
if (id == t->param.idFormat) {
return port_set_format(node, direction, port_id, flags, param);
}
else
return SPA_RESULT_UNKNOWN_PARAM;
return -ENOENT;
}
static int
@ -691,14 +690,14 @@ impl_node_port_use_buffers(struct spa_node *node,
struct impl *this;
uint32_t i;
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(node != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct impl, 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);
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
return -EIO;
clear_buffers(this);
@ -716,13 +715,13 @@ impl_node_port_use_buffers(struct spa_node *node,
d[0].type == this->type.data.DmaBuf) && d[0].data == NULL) {
spa_log_error(this->log, NAME " %p: invalid memory on buffer %p", this,
buffers[i]);
return SPA_RESULT_ERROR;
return -EINVAL;
}
spa_list_append(&this->empty, &b->link);
}
this->n_buffers = n_buffers;
return SPA_RESULT_OK;
return 0;
}
static int
@ -736,16 +735,16 @@ impl_node_port_alloc_buffers(struct spa_node *node,
{
struct impl *this;
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(node != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct impl, 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);
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
return -EIO;
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
}
static int
@ -756,15 +755,15 @@ impl_node_port_set_io(struct spa_node *node,
{
struct impl *this;
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(node != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct impl, 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);
this->io = io;
return SPA_RESULT_OK;
return 0;
}
static inline void reuse_buffer(struct impl *this, uint32_t id)
@ -785,17 +784,16 @@ static int impl_node_port_reuse_buffer(struct spa_node *node, uint32_t port_id,
{
struct impl *this;
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(node != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct impl, node);
spa_return_val_if_fail(port_id == 0, SPA_RESULT_INVALID_PORT);
spa_return_val_if_fail(this->n_buffers > 0, SPA_RESULT_NO_BUFFERS);
spa_return_val_if_fail(buffer_id < this->n_buffers, SPA_RESULT_INVALID_BUFFER_ID);
spa_return_val_if_fail(port_id == 0, -EINVAL);
spa_return_val_if_fail(buffer_id < this->n_buffers, -EINVAL);
reuse_buffer(this, buffer_id);
return SPA_RESULT_OK;
return 0;
}
static int
@ -804,12 +802,12 @@ impl_node_port_send_command(struct spa_node *node,
uint32_t port_id,
const struct spa_command *command)
{
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
}
static int impl_node_process_input(struct spa_node *node)
{
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
}
static int impl_node_process_output(struct spa_node *node)
@ -817,24 +815,24 @@ static int impl_node_process_output(struct spa_node *node)
struct impl *this;
struct spa_port_io *io;
spa_return_val_if_fail(node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(node != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct impl, node);
io = this->io;
spa_return_val_if_fail(io != NULL, SPA_RESULT_UNEXPECTED);
spa_return_val_if_fail(io != NULL, -EIO);
if (io->status == SPA_RESULT_HAVE_BUFFER)
return SPA_RESULT_HAVE_BUFFER;
if (io->status == SPA_STATUS_HAVE_BUFFER)
return SPA_STATUS_HAVE_BUFFER;
if (io->buffer_id < this->n_buffers) {
reuse_buffer(this, this->io->buffer_id);
this->io->buffer_id = SPA_ID_INVALID;
}
if (!this->props.live && (io->status == SPA_RESULT_NEED_BUFFER))
if (!this->props.live && (io->status == SPA_STATUS_NEED_BUFFER))
return make_buffer(this);
else
return SPA_RESULT_OK;
return SPA_STATUS_OK;
}
static const struct spa_dict_item node_info_items[] = {
@ -872,13 +870,13 @@ static const struct spa_node impl_node = {
static int impl_clock_enum_params(struct spa_clock *clock, uint32_t id, uint32_t *index,
struct spa_pod_builder *builder)
{
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
}
static int impl_clock_set_param(struct spa_clock *clock, uint32_t id, uint32_t flags,
const struct spa_pod_object *param)
{
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
}
static int
@ -890,7 +888,7 @@ impl_clock_get_time(struct spa_clock *clock,
struct timespec now;
uint64_t tnow;
spa_return_val_if_fail(clock != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(clock != NULL, -EINVAL);
if (rate)
*rate = SPA_NSEC_PER_SEC;
@ -903,7 +901,7 @@ impl_clock_get_time(struct spa_clock *clock,
if (monotonic_time)
*monotonic_time = tnow;
return SPA_RESULT_OK;
return 0;
}
static const struct spa_clock impl_clock = {
@ -919,8 +917,8 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t interface_id,
{
struct impl *this;
spa_return_val_if_fail(handle != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(interface != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(handle != NULL, -EINVAL);
spa_return_val_if_fail(interface != NULL, -EINVAL);
this = (struct impl *) handle;
@ -929,16 +927,16 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t interface_id,
else if (interface_id == this->type.clock)
*interface = &this->clock;
else
return SPA_RESULT_UNKNOWN_INTERFACE;
return -ENOENT;
return SPA_RESULT_OK;
return 0;
}
static int impl_clear(struct spa_handle *handle)
{
struct impl *this;
spa_return_val_if_fail(handle != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(handle != NULL, -EINVAL);
this = (struct impl *) handle;
@ -946,7 +944,7 @@ static int impl_clear(struct spa_handle *handle)
spa_loop_remove_source(this->data_loop, &this->timer_source);
close(this->timer_source.fd);
return SPA_RESULT_OK;
return 0;
}
static int
@ -959,8 +957,8 @@ impl_init(const struct spa_handle_factory *factory,
struct impl *this;
uint32_t i;
spa_return_val_if_fail(factory != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(handle != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(handle != NULL, -EINVAL);
handle->get_interface = impl_get_interface;
handle->clear = impl_clear;
@ -977,7 +975,7 @@ impl_init(const struct spa_handle_factory *factory,
}
if (this->map == NULL) {
spa_log_error(this->log, "a type-map is needed");
return SPA_RESULT_ERROR;
return -EINVAL;
}
init_type(&this->type, this->map);
@ -1006,7 +1004,7 @@ impl_init(const struct spa_handle_factory *factory,
spa_log_info(this->log, NAME " %p: initialized", this);
return SPA_RESULT_OK;
return 0;
}
static const struct spa_interface_info impl_interfaces[] = {
@ -1017,19 +1015,21 @@ static const struct spa_interface_info impl_interfaces[] = {
static int
impl_enum_interface_info(const struct spa_handle_factory *factory,
const struct spa_interface_info **info,
uint32_t index)
uint32_t *index)
{
spa_return_val_if_fail(factory != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(info != NULL, SPA_RESULT_INVALID_ARGUMENTS);
spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(info != NULL, -EINVAL);
spa_return_val_if_fail(index != NULL, -EINVAL);
switch (index) {
switch (*index) {
case 0:
*info = &impl_interfaces[index];
*info = &impl_interfaces[*index];
break;
default:
return SPA_RESULT_ENUM_END;
return 0;
}
return SPA_RESULT_OK;
(*index)++;
return 1;
}
static const struct spa_dict_item info_items[] = {