mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -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
|
|
@ -17,6 +17,7 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
|
|
@ -179,7 +180,7 @@ static Uint32 id_to_sdl_format(struct data *data, uint32_t id)
|
|||
|
||||
static int impl_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_set_callbacks(struct spa_node *node,
|
||||
|
|
@ -188,7 +189,7 @@ static int impl_set_callbacks(struct spa_node *node,
|
|||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
d->callbacks = callbacks;
|
||||
d->callbacks_data = data;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_get_n_ports(struct spa_node *node,
|
||||
|
|
@ -199,7 +200,7 @@ static int impl_get_n_ports(struct spa_node *node,
|
|||
{
|
||||
*n_input_ports = *max_input_ports = 1;
|
||||
*n_output_ports = *max_output_ports = 0;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_get_port_ids(struct spa_node *node,
|
||||
|
|
@ -210,7 +211,7 @@ static int impl_get_port_ids(struct spa_node *node,
|
|||
{
|
||||
if (n_input_ports > 0)
|
||||
input_ids[0] = 0;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_io(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -218,7 +219,7 @@ static int impl_port_set_io(struct spa_node *node, enum spa_direction direction,
|
|||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
d->io = io;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_get_info(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -232,7 +233,7 @@ static int impl_port_get_info(struct spa_node *node, enum spa_direction directio
|
|||
|
||||
*info = &d->port_info;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_enum_formats(struct spa_node *node,
|
||||
|
|
@ -246,7 +247,7 @@ static int port_enum_formats(struct spa_node *node,
|
|||
int i, c;
|
||||
|
||||
if (*index != 0)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
SDL_GetRendererInfo(d->renderer, &info);
|
||||
|
||||
|
|
@ -287,7 +288,7 @@ static int port_enum_formats(struct spa_node *node,
|
|||
|
||||
(*index)++;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int port_get_format(struct spa_node *node,
|
||||
|
|
@ -299,7 +300,7 @@ static int port_get_format(struct spa_node *node,
|
|||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
||||
if (*index != 0 || d->format.format == 0)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
d->t->param.idFormat, d->type.format,
|
||||
|
|
@ -311,7 +312,7 @@ static int port_get_format(struct spa_node *node,
|
|||
|
||||
(*index)++;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int impl_port_enum_params(struct spa_node *node,
|
||||
|
|
@ -334,7 +335,7 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
id, t->param.List,
|
||||
":", t->param.listId, "I", list[*index]);
|
||||
else
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
return port_enum_formats(node, direction, port_id, index, filter, builder);
|
||||
|
|
@ -344,7 +345,7 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
}
|
||||
else if (id == t->param.idBuffers) {
|
||||
if (*index != 0)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
id, t->param_buffers.Buffers,
|
||||
|
|
@ -356,7 +357,7 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
}
|
||||
else if (id == t->param.idMeta) {
|
||||
if (*index != 0)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
id, t->param_meta.Meta,
|
||||
|
|
@ -364,11 +365,11 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
":", t->param_meta.size, "i", sizeof(struct spa_meta_header));
|
||||
}
|
||||
else
|
||||
return SPA_RESULT_UNKNOWN_PARAM;
|
||||
return -ENOENT;
|
||||
|
||||
(*index)++;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int port_set_format(struct spa_node *node,
|
||||
|
|
@ -380,7 +381,7 @@ static int port_set_format(struct spa_node *node,
|
|||
void *dest;
|
||||
|
||||
if (format == NULL)
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
|
||||
spa_debug_pod(&format->pod, SPA_DEBUG_FLAG_FORMAT);
|
||||
|
||||
|
|
@ -388,7 +389,7 @@ static int port_set_format(struct spa_node *node,
|
|||
|
||||
sdl_format = id_to_sdl_format(d, d->format.format);
|
||||
if (sdl_format == SDL_PIXELFORMAT_UNKNOWN)
|
||||
return SPA_RESULT_ERROR;
|
||||
return -EINVAL;
|
||||
|
||||
d->texture = SDL_CreateTexture(d->renderer,
|
||||
sdl_format,
|
||||
|
|
@ -398,7 +399,7 @@ static int port_set_format(struct spa_node *node,
|
|||
SDL_LockTexture(d->texture, NULL, &dest, &d->stride);
|
||||
SDL_UnlockTexture(d->texture);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_param(struct spa_node *node,
|
||||
|
|
@ -413,7 +414,7 @@ static int impl_port_set_param(struct spa_node *node,
|
|||
return port_set_format(node, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
return SPA_RESULT_UNKNOWN_PARAM;
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -424,7 +425,7 @@ static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direc
|
|||
for (i = 0; i < n_buffers; i++)
|
||||
d->buffers[i] = buffers[i];
|
||||
d->n_buffers = n_buffers;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_process_input(struct spa_node *node)
|
||||
|
|
@ -437,7 +438,7 @@ static int impl_node_process_input(struct spa_node *node)
|
|||
int i;
|
||||
uint8_t *src, *dst;
|
||||
|
||||
if (d->io->status != SPA_RESULT_HAVE_BUFFER)
|
||||
if (d->io->status != SPA_STATUS_HAVE_BUFFER)
|
||||
goto done;
|
||||
|
||||
if (d->io->buffer_id > d->n_buffers)
|
||||
|
|
@ -454,11 +455,11 @@ static int impl_node_process_input(struct spa_node *node)
|
|||
map = NULL;
|
||||
sdata = buf->datas[0].data;
|
||||
} else
|
||||
return SPA_RESULT_ERROR;
|
||||
return -EINVAL;
|
||||
|
||||
if (SDL_LockTexture(d->texture, NULL, &ddata, &dstride) < 0) {
|
||||
fprintf(stderr, "Couldn't lock texture: %s\n", SDL_GetError());
|
||||
return SPA_RESULT_ERROR;
|
||||
return -EIO;
|
||||
}
|
||||
sstride = buf->datas[0].chunk->stride;
|
||||
ostride = SPA_MIN(sstride, dstride);
|
||||
|
|
@ -482,7 +483,7 @@ static int impl_node_process_input(struct spa_node *node)
|
|||
done:
|
||||
handle_events(d);
|
||||
|
||||
return d->io->status = SPA_RESULT_NEED_BUFFER;
|
||||
return d->io->status = SPA_STATUS_NEED_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <sys/mman.h>
|
||||
|
|
@ -96,7 +97,7 @@ struct data {
|
|||
|
||||
static int impl_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_set_callbacks(struct spa_node *node,
|
||||
|
|
@ -105,7 +106,7 @@ static int impl_set_callbacks(struct spa_node *node,
|
|||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
d->callbacks = callbacks;
|
||||
d->callbacks_data = data;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_get_n_ports(struct spa_node *node,
|
||||
|
|
@ -116,7 +117,7 @@ static int impl_get_n_ports(struct spa_node *node,
|
|||
{
|
||||
*n_input_ports = *max_input_ports = 0;
|
||||
*n_output_ports = *max_output_ports = 1;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_get_port_ids(struct spa_node *node,
|
||||
|
|
@ -127,7 +128,7 @@ static int impl_get_port_ids(struct spa_node *node,
|
|||
{
|
||||
if (n_output_ports > 0)
|
||||
output_ids[0] = 0;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_io(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -135,7 +136,7 @@ static int impl_port_set_io(struct spa_node *node, enum spa_direction direction,
|
|||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
d->io = io;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_get_info(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -149,7 +150,7 @@ static int impl_port_get_info(struct spa_node *node, enum spa_direction directio
|
|||
|
||||
*info = &d->port_info;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_enum_formats(struct spa_node *node,
|
||||
|
|
@ -161,7 +162,7 @@ static int port_enum_formats(struct spa_node *node,
|
|||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
||||
if (*index != 0)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
d->t->param.idEnumFormat, d->type.format,
|
||||
|
|
@ -173,7 +174,7 @@ static int port_enum_formats(struct spa_node *node,
|
|||
|
||||
(*index)++;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int port_get_format(struct spa_node *node,
|
||||
|
|
@ -185,10 +186,10 @@ static int port_get_format(struct spa_node *node,
|
|||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
||||
if (*index != 0)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
if (d->format.format == 0)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
d->t->param.idFormat, d->type.format,
|
||||
|
|
@ -200,7 +201,7 @@ static int port_get_format(struct spa_node *node,
|
|||
|
||||
(*index)++;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int impl_port_enum_params(struct spa_node *node,
|
||||
|
|
@ -223,7 +224,7 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
id, t->param.List,
|
||||
":", t->param.listId, "I", list[*index]);
|
||||
else
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
}
|
||||
else if (id == t->param.idEnumFormat) {
|
||||
return port_enum_formats(node, direction, port_id, index, filter, builder);
|
||||
|
|
@ -233,7 +234,7 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
}
|
||||
else if (id == t->param.idBuffers) {
|
||||
if (*index > 0)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
id, t->param_buffers.Buffers,
|
||||
|
|
@ -264,15 +265,15 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
":", t->param_meta.ringbufferAlign, "i", 16);
|
||||
break;
|
||||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
return SPA_RESULT_UNKNOWN_PARAM;
|
||||
return -ENOENT;
|
||||
|
||||
(*index)++;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int port_set_format(struct spa_node *node,
|
||||
|
|
@ -283,18 +284,18 @@ static int port_set_format(struct spa_node *node,
|
|||
|
||||
if (format == NULL) {
|
||||
d->format.format = 0;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
spa_debug_pod(&format->pod, SPA_DEBUG_FLAG_FORMAT);
|
||||
|
||||
if (spa_format_audio_raw_parse(format, &d->format, &d->type.format_audio) < 0)
|
||||
return SPA_RESULT_INVALID_MEDIA_TYPE;
|
||||
return -EINVAL;
|
||||
|
||||
if (d->format.format != d->type.audio_format.S16)
|
||||
return SPA_RESULT_ERROR;
|
||||
return -EINVAL;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_param(struct spa_node *node,
|
||||
|
|
@ -309,7 +310,7 @@ static int impl_port_set_param(struct spa_node *node,
|
|||
return port_set_format(node, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
return SPA_RESULT_UNKNOWN_PARAM;
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -331,7 +332,7 @@ static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direc
|
|||
MAP_SHARED, datas[0].fd, 0);
|
||||
if (b->ptr == MAP_FAILED) {
|
||||
pw_log_error("failed to buffer mem");
|
||||
return SPA_RESULT_ERROR;
|
||||
return -errno;
|
||||
|
||||
}
|
||||
b->ptr = SPA_MEMBER(b->ptr, datas[0].mapoffset, void);
|
||||
|
|
@ -339,7 +340,7 @@ static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direc
|
|||
}
|
||||
else {
|
||||
pw_log_error("invalid buffer mem");
|
||||
return SPA_RESULT_ERROR;
|
||||
return -EINVAL;
|
||||
}
|
||||
b->buffer = buffers[i];
|
||||
b->rb = spa_buffer_find_meta(buffers[i], d->type.meta.Ringbuffer);
|
||||
|
|
@ -347,7 +348,7 @@ static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direc
|
|||
spa_list_append(&d->empty, &b->link);
|
||||
}
|
||||
d->n_buffers = n_buffers;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void reuse_buffer(struct data *d, uint32_t id)
|
||||
|
|
@ -360,7 +361,7 @@ static int impl_port_reuse_buffer(struct spa_node *node, uint32_t port_id, uint3
|
|||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
reuse_buffer(d, buffer_id);
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_process_output(struct spa_node *node)
|
||||
|
|
@ -378,7 +379,7 @@ static int impl_node_process_output(struct spa_node *node)
|
|||
}
|
||||
if (spa_list_is_empty(&d->empty)) {
|
||||
pw_log_error("sine-source %p: out of buffers", d);
|
||||
return SPA_RESULT_OUT_OF_BUFFERS;
|
||||
return -EPIPE;
|
||||
}
|
||||
b = spa_list_first(&d->empty, struct buffer, link);
|
||||
spa_list_remove(&b->link);
|
||||
|
|
@ -424,9 +425,9 @@ static int impl_node_process_output(struct spa_node *node)
|
|||
}
|
||||
|
||||
io->buffer_id = b->buffer->id;
|
||||
io->status = SPA_RESULT_HAVE_BUFFER;
|
||||
io->status = SPA_STATUS_HAVE_BUFFER;
|
||||
|
||||
return SPA_RESULT_HAVE_BUFFER;
|
||||
return SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ static Uint32 id_to_sdl_format(struct data *data, uint32_t id)
|
|||
|
||||
static int impl_send_command(struct spa_node *node, const struct spa_command *command)
|
||||
{
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_set_callbacks(struct spa_node *node,
|
||||
|
|
@ -184,7 +184,7 @@ static int impl_set_callbacks(struct spa_node *node,
|
|||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
d->callbacks = callbacks;
|
||||
d->callbacks_data = data;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_get_n_ports(struct spa_node *node,
|
||||
|
|
@ -195,7 +195,7 @@ static int impl_get_n_ports(struct spa_node *node,
|
|||
{
|
||||
*n_input_ports = *max_input_ports = 1;
|
||||
*n_output_ports = *max_output_ports = 0;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_get_port_ids(struct spa_node *node,
|
||||
|
|
@ -206,7 +206,7 @@ static int impl_get_port_ids(struct spa_node *node,
|
|||
{
|
||||
if (n_input_ports > 0)
|
||||
input_ids[0] = 0;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_io(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -214,7 +214,7 @@ static int impl_port_set_io(struct spa_node *node, enum spa_direction direction,
|
|||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
d->io = io;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_get_info(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -228,7 +228,7 @@ static int impl_port_get_info(struct spa_node *node, enum spa_direction directio
|
|||
|
||||
*info = &d->port_info;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int port_enum_formats(struct spa_node *node,
|
||||
|
|
@ -242,7 +242,7 @@ static int port_enum_formats(struct spa_node *node,
|
|||
int i, c;
|
||||
|
||||
if (*index != 0)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
SDL_GetRendererInfo(d->renderer, &info);
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ static int port_enum_formats(struct spa_node *node,
|
|||
|
||||
(*index)++;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int impl_port_enum_params(struct spa_node *node,
|
||||
|
|
@ -301,7 +301,7 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
}
|
||||
else if (id == t->param.idBuffers) {
|
||||
if (*index > 0)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
id, t->param_buffers.Buffers,
|
||||
|
|
@ -313,7 +313,7 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
}
|
||||
else if (id == t->param.idMeta) {
|
||||
if (*index > 0)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
return 0;
|
||||
|
||||
spa_pod_builder_object(builder,
|
||||
id, t->param_meta.Meta,
|
||||
|
|
@ -321,10 +321,10 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
":", t->param_meta.size, "i", sizeof(struct spa_meta_header));
|
||||
}
|
||||
else
|
||||
return SPA_RESULT_UNKNOWN_PARAM;
|
||||
return -ENOENT;
|
||||
|
||||
(*index)++;
|
||||
return SPA_RESULT_OK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int port_set_format(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -335,7 +335,7 @@ static int port_set_format(struct spa_node *node, enum spa_direction direction,
|
|||
void *dest;
|
||||
|
||||
if (format == NULL)
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
|
||||
spa_debug_pod(&format->pod, SPA_DEBUG_FLAG_FORMAT);
|
||||
|
||||
|
|
@ -343,7 +343,7 @@ static int port_set_format(struct spa_node *node, enum spa_direction direction,
|
|||
|
||||
sdl_format = id_to_sdl_format(d, d->format.format);
|
||||
if (sdl_format == SDL_PIXELFORMAT_UNKNOWN)
|
||||
return SPA_RESULT_ERROR;
|
||||
return -EINVAL;
|
||||
|
||||
d->texture = SDL_CreateTexture(d->renderer,
|
||||
sdl_format,
|
||||
|
|
@ -353,7 +353,7 @@ static int port_set_format(struct spa_node *node, enum spa_direction direction,
|
|||
SDL_LockTexture(d->texture, NULL, &dest, &d->stride);
|
||||
SDL_UnlockTexture(d->texture);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_port_set_param(struct spa_node *node,
|
||||
|
|
@ -368,7 +368,7 @@ static int impl_port_set_param(struct spa_node *node,
|
|||
return port_set_format(node, direction, port_id, flags, param);
|
||||
}
|
||||
else
|
||||
return SPA_RESULT_UNKNOWN_PARAM;
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direction, uint32_t port_id,
|
||||
|
|
@ -379,7 +379,7 @@ static int impl_port_use_buffers(struct spa_node *node, enum spa_direction direc
|
|||
for (i = 0; i < n_buffers; i++)
|
||||
d->buffers[i] = buffers[i];
|
||||
d->n_buffers = n_buffers;
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int impl_node_process_input(struct spa_node *node)
|
||||
|
|
@ -403,11 +403,11 @@ static int impl_node_process_input(struct spa_node *node)
|
|||
map = NULL;
|
||||
sdata = buf->datas[0].data;
|
||||
} else
|
||||
return SPA_RESULT_ERROR;
|
||||
return -EINVAL;
|
||||
|
||||
if (SDL_LockTexture(d->texture, NULL, &ddata, &dstride) < 0) {
|
||||
fprintf(stderr, "Couldn't lock texture: %s\n", SDL_GetError());
|
||||
return SPA_RESULT_ERROR;
|
||||
return -EIO;
|
||||
}
|
||||
sstride = buf->datas[0].chunk->stride;
|
||||
ostride = SPA_MIN(sstride, dstride);
|
||||
|
|
@ -430,9 +430,9 @@ static int impl_node_process_input(struct spa_node *node)
|
|||
|
||||
handle_events(d);
|
||||
|
||||
d->io->status = SPA_RESULT_NEED_BUFFER;
|
||||
d->io->status = SPA_STATUS_NEED_BUFFER;
|
||||
|
||||
return SPA_RESULT_NEED_BUFFER;
|
||||
return SPA_STATUS_NEED_BUFFER;
|
||||
}
|
||||
|
||||
static const struct spa_node impl_node = {
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ on_stream_format_changed(void *_data, struct spa_pod_object *format)
|
|||
void *d;
|
||||
|
||||
if (format == NULL) {
|
||||
pw_stream_finish_format(stream, SPA_RESULT_OK, 0, NULL);
|
||||
pw_stream_finish_format(stream, 0, 0, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ on_stream_format_changed(void *_data, struct spa_pod_object *format)
|
|||
|
||||
sdl_format = id_to_sdl_format(data, data->format.format);
|
||||
if (sdl_format == SDL_PIXELFORMAT_UNKNOWN) {
|
||||
pw_stream_finish_format(stream, SPA_RESULT_ERROR, 0, NULL);
|
||||
pw_stream_finish_format(stream, -EINVAL, 0, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -279,7 +279,7 @@ on_stream_format_changed(void *_data, struct spa_pod_object *format)
|
|||
":", t->param_meta.type, "I", t->meta.Header,
|
||||
":", t->param_meta.size, "i", sizeof(struct spa_meta_header));
|
||||
|
||||
pw_stream_finish_format(stream, SPA_RESULT_OK, 2, params);
|
||||
pw_stream_finish_format(stream, 0, 2, params);
|
||||
}
|
||||
|
||||
static const struct pw_stream_events stream_events = {
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ on_stream_format_changed(void *_data, struct spa_pod_object *format)
|
|||
struct spa_pod_object *params[2];
|
||||
|
||||
if (format == NULL) {
|
||||
pw_stream_finish_format(stream, SPA_RESULT_OK, 0, NULL);
|
||||
pw_stream_finish_format(stream, 0, 0, NULL);
|
||||
return;
|
||||
}
|
||||
spa_format_video_raw_parse(format, &data->format, &data->type.format_video);
|
||||
|
|
@ -196,7 +196,7 @@ on_stream_format_changed(void *_data, struct spa_pod_object *format)
|
|||
":", t->param_meta.type, "I", t->meta.Header,
|
||||
":", t->param_meta.size, "i", sizeof(struct spa_meta_header));
|
||||
|
||||
pw_stream_finish_format(stream, SPA_RESULT_OK, 2, params);
|
||||
pw_stream_finish_format(stream, 0, 2, params);
|
||||
}
|
||||
|
||||
static const struct pw_stream_events stream_events = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue