Use types with known sizes where we can, easier to serialize

Add iterator for POD and use it to implement some demarshalling.
This commit is contained in:
Wim Taymans 2017-03-07 11:56:43 +01:00
parent 23d09d5b60
commit f92b68c3c3
77 changed files with 839 additions and 695 deletions

View file

@ -36,7 +36,7 @@ typedef struct {
size_t buffer_size; size_t buffer_size;
size_t buffer_maxsize; size_t buffer_maxsize;
int fds[MAX_FDS]; int fds[MAX_FDS];
unsigned int n_fds; uint32_t n_fds;
off_t offset; off_t offset;
void *data; void *data;
@ -52,7 +52,7 @@ struct _PinosConnection {
int int
pinos_connection_get_fd (PinosConnection *conn, pinos_connection_get_fd (PinosConnection *conn,
int index) uint32_t index)
{ {
if (index < 0 || index >= conn->in.n_fds) if (index < 0 || index >= conn->in.n_fds)
return -1; return -1;
@ -60,11 +60,11 @@ pinos_connection_get_fd (PinosConnection *conn,
return conn->in.fds[index]; return conn->in.fds[index];
} }
int uint32_t
pinos_connection_add_fd (PinosConnection *conn, pinos_connection_add_fd (PinosConnection *conn,
int fd) int fd)
{ {
int index, i; uint32_t index, i;
for (i = 0; i < conn->out.n_fds; i++) { for (i = 0; i < conn->out.n_fds; i++) {
if (conn->out.fds[i] == fd) if (conn->out.fds[i] == fd)
@ -202,7 +202,7 @@ pinos_connection_get_next (PinosConnection *conn,
uint8_t *opcode, uint8_t *opcode,
uint32_t *dest_id, uint32_t *dest_id,
void **dt, void **dt,
size_t *sz) uint32_t *sz)
{ {
size_t len, size; size_t len, size;
uint8_t *data; uint8_t *data;
@ -265,7 +265,7 @@ again:
void * void *
pinos_connection_begin_write (PinosConnection *conn, pinos_connection_begin_write (PinosConnection *conn,
size_t size) uint32_t size)
{ {
uint32_t *p; uint32_t *p;
ConnectionBuffer *buf = &conn->out; ConnectionBuffer *buf = &conn->out;
@ -278,7 +278,7 @@ void
pinos_connection_end_write (PinosConnection *conn, pinos_connection_end_write (PinosConnection *conn,
uint32_t dest_id, uint32_t dest_id,
uint8_t opcode, uint8_t opcode,
size_t size) uint32_t size)
{ {
uint32_t *p; uint32_t *p;
ConnectionBuffer *buf = &conn->out; ConnectionBuffer *buf = &conn->out;

View file

@ -31,23 +31,23 @@ typedef struct _PinosConnection PinosConnection;
PinosConnection * pinos_connection_new (int fd); PinosConnection * pinos_connection_new (int fd);
void pinos_connection_destroy (PinosConnection *conn); void pinos_connection_destroy (PinosConnection *conn);
int pinos_connection_add_fd (PinosConnection *conn, uint32_t pinos_connection_add_fd (PinosConnection *conn,
int fd); int fd);
int pinos_connection_get_fd (PinosConnection *conn, int pinos_connection_get_fd (PinosConnection *conn,
int index); uint32_t index);
bool pinos_connection_get_next (PinosConnection *conn, bool pinos_connection_get_next (PinosConnection *conn,
uint8_t *opcode, uint8_t *opcode,
uint32_t *dest_id, uint32_t *dest_id,
void **data, void **data,
size_t *size); uint32_t *size);
void * pinos_connection_begin_write (PinosConnection *conn, void * pinos_connection_begin_write (PinosConnection *conn,
size_t size); uint32_t size);
void pinos_connection_end_write (PinosConnection *conn, void pinos_connection_end_write (PinosConnection *conn,
uint32_t dest_id, uint32_t dest_id,
uint8_t opcode, uint8_t opcode,
size_t size); uint32_t size);
bool pinos_connection_flush (PinosConnection *conn); bool pinos_connection_flush (PinosConnection *conn);
bool pinos_connection_clear (PinosConnection *conn); bool pinos_connection_clear (PinosConnection *conn);

View file

@ -387,7 +387,7 @@ on_context_data (SpaSource *source,
PinosConnection *conn = impl->connection; PinosConnection *conn = impl->connection;
uint8_t opcode; uint8_t opcode;
uint32_t id; uint32_t id;
size_t size; uint32_t size;
void *message; void *message;
while (pinos_connection_get_next (conn, &opcode, &id, &message, &size)) { while (pinos_connection_get_next (conn, &opcode, &id, &message, &size)) {

View file

@ -117,8 +117,8 @@ typedef struct {
struct _PinosClientNodeBuffer { struct _PinosClientNodeBuffer {
uint32_t mem_id; uint32_t mem_id;
off_t offset; uint32_t offset;
size_t size; uint32_t size;
SpaBuffer *buffer; SpaBuffer *buffer;
}; };
@ -128,8 +128,8 @@ typedef struct {
#define PINOS_MESSAGE_NODE_UPDATE_MAX_OUTPUTS (1 << 1) #define PINOS_MESSAGE_NODE_UPDATE_MAX_OUTPUTS (1 << 1)
#define PINOS_MESSAGE_NODE_UPDATE_PROPS (1 << 2) #define PINOS_MESSAGE_NODE_UPDATE_PROPS (1 << 2)
uint32_t change_mask, uint32_t change_mask,
unsigned int max_input_ports, uint32_t max_input_ports,
unsigned int max_output_ports, uint32_t max_output_ports,
const SpaProps *props); const SpaProps *props);
void (*port_update) (void *object, void (*port_update) (void *object,
@ -140,7 +140,7 @@ typedef struct {
#define PINOS_MESSAGE_PORT_UPDATE_PROPS (1 << 2) #define PINOS_MESSAGE_PORT_UPDATE_PROPS (1 << 2)
#define PINOS_MESSAGE_PORT_UPDATE_INFO (1 << 3) #define PINOS_MESSAGE_PORT_UPDATE_INFO (1 << 3)
uint32_t change_mask, uint32_t change_mask,
unsigned int n_possible_formats, uint32_t n_possible_formats,
const SpaFormat **possible_formats, const SpaFormat **possible_formats,
const SpaFormat *format, const SpaFormat *format,
const SpaProps *props, const SpaProps *props,
@ -182,7 +182,7 @@ typedef struct {
void (*set_property) (void *object, void (*set_property) (void *object,
uint32_t seq, uint32_t seq,
uint32_t id, uint32_t id,
size_t size, uint32_t size,
const void *value); const void *value);
void (*add_mem) (void *object, void (*add_mem) (void *object,
SpaDirection direction, SpaDirection direction,
@ -191,13 +191,13 @@ typedef struct {
SpaDataType type, SpaDataType type,
int memfd, int memfd,
uint32_t flags, uint32_t flags,
off_t offset, uint32_t offset,
size_t size); uint32_t size);
void (*use_buffers) (void *object, void (*use_buffers) (void *object,
uint32_t seq, uint32_t seq,
SpaDirection direction, SpaDirection direction,
uint32_t port_id, uint32_t port_id,
unsigned int n_buffers, uint32_t n_buffers,
PinosClientNodeBuffer *buffers); PinosClientNodeBuffer *buffers);
void (*node_command) (void *object, void (*node_command) (void *object,
uint32_t seq, uint32_t seq,
@ -207,8 +207,8 @@ typedef struct {
const SpaNodeCommand *command); const SpaNodeCommand *command);
void (*transport) (void *object, void (*transport) (void *object,
int memfd, int memfd,
off_t offset, uint32_t offset,
size_t size); uint32_t size);
} PinosClientNodeEvent; } PinosClientNodeEvent;
#define pinos_client_node_notify_done(r,...) ((PinosClientNodeEvent*)r->event)->done(r,__VA_ARGS__) #define pinos_client_node_notify_done(r,...) ((PinosClientNodeEvent*)r->event)->done(r,__VA_ARGS__)

View file

@ -119,7 +119,7 @@ static SpaDict *
pinos_spa_dict_copy (SpaDict *dict) pinos_spa_dict_copy (SpaDict *dict)
{ {
SpaDict *copy; SpaDict *copy;
unsigned int i; uint32_t i;
if (dict == NULL) if (dict == NULL)
return NULL; return NULL;

View file

@ -256,13 +256,13 @@ struct _PinosNodeInfo {
uint32_t id; uint32_t id;
uint64_t change_mask; uint64_t change_mask;
const char *name; const char *name;
unsigned int max_inputs; uint32_t max_inputs;
unsigned int n_inputs; uint32_t n_inputs;
unsigned int n_input_formats; uint32_t n_input_formats;
SpaFormat **input_formats; SpaFormat **input_formats;
unsigned int max_outputs; uint32_t max_outputs;
unsigned int n_outputs; uint32_t n_outputs;
unsigned int n_output_formats; uint32_t n_output_formats;
SpaFormat **output_formats; SpaFormat **output_formats;
PinosNodeState state; PinosNodeState state;
const char *error; const char *error;

View file

@ -225,7 +225,7 @@ event_func (SpaSource *source,
void *data) void *data)
{ {
PinosLoopImpl *impl = data; PinosLoopImpl *impl = data;
size_t offset; uint32_t offset;
while (spa_ringbuffer_get_read_offset (&impl->buffer, &offset) > 0) { while (spa_ringbuffer_get_read_offset (&impl->buffer, &offset) > 0) {
InvokeItem *item = SPA_MEMBER (impl->buffer_data, offset, InvokeItem); InvokeItem *item = SPA_MEMBER (impl->buffer_data, offset, InvokeItem);

View file

@ -105,7 +105,7 @@ pinos_properties_new (const char *key, ...)
PinosProperties * PinosProperties *
pinos_properties_new_dict (const SpaDict *dict) pinos_properties_new_dict (const SpaDict *dict)
{ {
unsigned int i; uint32_t i;
PinosPropertiesImpl *impl; PinosPropertiesImpl *impl;
impl = calloc (1, sizeof (PinosPropertiesImpl)); impl = calloc (1, sizeof (PinosPropertiesImpl));
@ -307,7 +307,7 @@ pinos_properties_iterate (PinosProperties *properties,
void **state) void **state)
{ {
PinosPropertiesImpl *impl = SPA_CONTAINER_OF (properties, PinosPropertiesImpl, this); PinosPropertiesImpl *impl = SPA_CONTAINER_OF (properties, PinosPropertiesImpl, this);
unsigned int index; uint32_t index;
if (*state == NULL) if (*state == NULL)
index = 0; index = 0;

View file

@ -19,6 +19,7 @@
#include <errno.h> #include <errno.h>
#include "spa/pod-iter.h"
#include "pinos/client/pinos.h" #include "pinos/client/pinos.h"
#include "pinos/client/protocol-native.h" #include "pinos/client/protocol-native.h"
@ -30,8 +31,8 @@ typedef struct {
PinosConnection *connection; PinosConnection *connection;
} Builder; } Builder;
static off_t static uint32_t
write_pod (SpaPODBuilder *b, off_t ref, const void *data, size_t size) write_pod (SpaPODBuilder *b, uint32_t ref, const void *data, uint32_t size)
{ {
if (ref == -1) if (ref == -1)
ref = b->offset; ref = b->offset;
@ -165,31 +166,30 @@ core_demarshal_info (void *object,
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaDict props; SpaDict props;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data);
PinosCoreInfo info; PinosCoreInfo info;
int32_t i1, i2, i3; SpaPODIter it;
int64_t l1;
int i; int i;
if (!spa_pod_get_int (&p, &i1) || if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_get_long (&p, &l1) || !spa_pod_iter_get (&it,
!spa_pod_get_string (&p, &info.user_name) || SPA_POD_TYPE_INT, &info.id,
!spa_pod_get_string (&p, &info.host_name) || SPA_POD_TYPE_LONG, &info.change_mask,
!spa_pod_get_string (&p, &info.version) || SPA_POD_TYPE_STRING, &info.user_name,
!spa_pod_get_string (&p, &info.name) || SPA_POD_TYPE_STRING, &info.host_name,
!spa_pod_get_int (&p, &i3) || SPA_POD_TYPE_STRING, &info.version,
!spa_pod_get_int (&p, &i2)) SPA_POD_TYPE_STRING, &info.name,
SPA_POD_TYPE_INT, &info.cookie,
SPA_POD_TYPE_INT, &props.n_items,
0))
return; return;
info.id = i1;
info.change_mask = l1;
info.cookie = i3;
info.props = &props; info.props = &props;
props.n_items = i2;
props.items = alloca (props.n_items * sizeof (SpaDictItem)); props.items = alloca (props.n_items * sizeof (SpaDictItem));
for (i = 0; i < props.n_items; i++) { for (i = 0; i < props.n_items; i++) {
if (!spa_pod_get_string (&p, &props.items[i].key) || if (!spa_pod_iter_get (&it,
!spa_pod_get_string (&p, &props.items[i].value)) SPA_POD_TYPE_STRING, &props.items[i].key,
SPA_POD_TYPE_STRING, &props.items[i].value,
0))
return; return;
} }
pinos_core_notify_info (proxy, &info); pinos_core_notify_info (proxy, &info);
@ -201,13 +201,16 @@ core_demarshal_done (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); SpaPODIter it;
int32_t i32; uint32_t seq;
if (!spa_pod_get_int (&p, &i32)) if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_iter_get (&it,
SPA_POD_TYPE_INT, &seq,
0))
return; return;
pinos_core_notify_done (proxy, i32); pinos_core_notify_done (proxy, seq);
} }
static void static void
@ -216,16 +219,19 @@ core_demarshal_error (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); SpaPODIter it;
int32_t i1, i2; uint32_t id, res;
const char *error; const char *error;
if (!spa_pod_get_int (&p, &i1) || if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_get_int (&p, &i2) || !spa_pod_iter_get (&it,
!spa_pod_get_string (&p, &error)) SPA_POD_TYPE_INT, &id,
SPA_POD_TYPE_INT, &res,
SPA_POD_TYPE_STRING, &error,
0))
return; return;
pinos_core_notify_error (proxy, i1, i2, error); pinos_core_notify_error (proxy, id, res, error);
} }
static void static void
@ -234,13 +240,16 @@ core_demarshal_remove_id (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); SpaPODIter it;
int32_t i1; uint32_t id;
if (!spa_pod_get_int (&p, &i1)) if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_iter_get (&it,
SPA_POD_TYPE_INT, &id,
0))
return; return;
pinos_core_notify_remove_id (proxy, i1); pinos_core_notify_remove_id (proxy, id);
} }
static void static void
@ -249,29 +258,29 @@ module_demarshal_info (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPODIter it;
SpaDict props; SpaDict props;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data);
PinosModuleInfo info; PinosModuleInfo info;
int32_t i1, i2;
int64_t l1;
int i; int i;
if (!spa_pod_get_int (&p, &i1) || if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_get_long (&p, &l1) || !spa_pod_iter_get (&it,
!spa_pod_get_string (&p, &info.name) || SPA_POD_TYPE_INT, &info.id,
!spa_pod_get_string (&p, &info.filename) || SPA_POD_TYPE_LONG, &info.change_mask,
!spa_pod_get_string (&p, &info.args) || SPA_POD_TYPE_STRING, &info.name,
!spa_pod_get_int (&p, &i2)) SPA_POD_TYPE_STRING, &info.filename,
SPA_POD_TYPE_STRING, &info.args,
SPA_POD_TYPE_INT, &props.n_items,
0))
return; return;
info.id = i1;
info.change_mask = l1;
info.props = &props; info.props = &props;
props.n_items = i2;
props.items = alloca (props.n_items * sizeof (SpaDictItem)); props.items = alloca (props.n_items * sizeof (SpaDictItem));
for (i = 0; i < props.n_items; i++) { for (i = 0; i < props.n_items; i++) {
if (!spa_pod_get_string (&p, &props.items[i].key) || if (!spa_pod_iter_get (&it,
!spa_pod_get_string (&p, &props.items[i].value)) SPA_POD_TYPE_STRING, &props.items[i].key,
SPA_POD_TYPE_STRING, &props.items[i].value,
0))
return; return;
} }
pinos_module_notify_info (proxy, &info); pinos_module_notify_info (proxy, &info);
@ -283,13 +292,16 @@ node_demarshal_done (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); SpaPODIter it;
int32_t i1; uint32_t seq;
if (!spa_pod_get_int (&p, &i1)) if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_iter_get (&it,
SPA_POD_TYPE_INT, &seq,
0))
return; return;
pinos_node_notify_done (proxy, i1); pinos_node_notify_done (proxy, seq);
} }
static void static void
@ -298,54 +310,52 @@ node_demarshal_info (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPODIter it;
SpaDict props; SpaDict props;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data);
PinosNodeInfo info; PinosNodeInfo info;
int32_t i1, i2, i3, i4;
int64_t l1;
int i; int i;
if (!spa_pod_get_int (&p, &i1) || if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_get_long (&p, &l1) || !spa_pod_iter_get (&it,
!spa_pod_get_string (&p, &info.name) || SPA_POD_TYPE_INT, &info.id,
!spa_pod_get_int (&p, &i2) || SPA_POD_TYPE_LONG, &info.change_mask,
!spa_pod_get_int (&p, &i3) || SPA_POD_TYPE_STRING, &info.name,
!spa_pod_get_int (&p, &i4)) SPA_POD_TYPE_INT, &info.max_inputs,
SPA_POD_TYPE_INT, &info.n_inputs,
SPA_POD_TYPE_INT, &info.n_input_formats,
0))
return; return;
info.id = i1;
info.change_mask = l1;
info.max_inputs = i2;
info.n_inputs = i3;
info.n_input_formats = i4;
info.input_formats = alloca (info.n_input_formats * sizeof (SpaFormat*)); info.input_formats = alloca (info.n_input_formats * sizeof (SpaFormat*));
for (i = 0; i < info.n_input_formats; i++) for (i = 0; i < info.n_input_formats; i++)
spa_pod_get_object (&p, (const SpaPOD**)&info.input_formats[i]); spa_pod_iter_get (&it,
SPA_POD_TYPE_OBJECT, &info.input_formats[i], 0);
if (!spa_pod_get_int (&p, &i2) || if (!spa_pod_iter_get (&it,
!spa_pod_get_int (&p, &i3) || SPA_POD_TYPE_INT, &info.max_outputs,
!spa_pod_get_int (&p, &i4)) SPA_POD_TYPE_INT, &info.n_outputs,
SPA_POD_TYPE_INT, &info.n_output_formats,
0))
return; return;
info.max_outputs = i2;
info.n_outputs = i3;
info.n_output_formats = i4;
info.output_formats = alloca (info.n_output_formats * sizeof (SpaFormat*)); info.output_formats = alloca (info.n_output_formats * sizeof (SpaFormat*));
for (i = 0; i < info.n_output_formats; i++) for (i = 0; i < info.n_output_formats; i++)
spa_pod_get_object (&p, (const SpaPOD**)&info.output_formats[i]); spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &info.output_formats[i], 0);
if (!spa_pod_get_int (&p, &i1) || if (!spa_pod_iter_get (&it,
!spa_pod_get_string (&p, &info.error) || SPA_POD_TYPE_INT, &info.state,
!spa_pod_get_int (&p, &i2)) SPA_POD_TYPE_STRING, &info.error,
SPA_POD_TYPE_INT, &props.n_items,
0))
return; return;
info.state = i1;
info.props = &props; info.props = &props;
props.n_items = i2;
props.items = alloca (props.n_items * sizeof (SpaDictItem)); props.items = alloca (props.n_items * sizeof (SpaDictItem));
for (i = 0; i < props.n_items; i++) { for (i = 0; i < props.n_items; i++) {
if (!spa_pod_get_string (&p, &props.items[i].key) || if (!spa_pod_iter_get (&it,
!spa_pod_get_string (&p, &props.items[i].value)) SPA_POD_TYPE_STRING, &props.items[i].key,
SPA_POD_TYPE_STRING, &props.items[i].value,
0))
return; return;
} }
pinos_node_notify_info (proxy, &info); pinos_node_notify_info (proxy, &info);
@ -354,8 +364,8 @@ node_demarshal_info (void *object,
static void static void
client_node_marshal_update (void *object, client_node_marshal_update (void *object,
uint32_t change_mask, uint32_t change_mask,
unsigned int max_input_ports, uint32_t max_input_ports,
unsigned int max_output_ports, uint32_t max_output_ports,
const SpaProps *props) const SpaProps *props)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
@ -380,7 +390,7 @@ client_node_marshal_port_update (void *object,
SpaDirection direction, SpaDirection direction,
uint32_t port_id, uint32_t port_id,
uint32_t change_mask, uint32_t change_mask,
unsigned int n_possible_formats, uint32_t n_possible_formats,
const SpaFormat **possible_formats, const SpaFormat **possible_formats,
const SpaFormat *format, const SpaFormat *format,
const SpaProps *props, const SpaProps *props,
@ -481,17 +491,20 @@ client_node_demarshal_done (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); SpaPODIter it;
PinosConnection *connection = proxy->context->protocol_private; PinosConnection *connection = proxy->context->protocol_private;
int32_t i1, i2; int32_t seq, idx;
int fd; int fd;
if (!spa_pod_get_int (&p, &i1) || if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_get_int (&p, &i2)) !spa_pod_iter_get (&it,
SPA_POD_TYPE_INT, &seq,
SPA_POD_TYPE_INT, &idx,
0))
return; return;
fd = pinos_connection_get_fd (connection, i2); fd = pinos_connection_get_fd (connection, idx);
pinos_client_node_notify_done (proxy, i1, fd); pinos_client_node_notify_done (proxy, seq, fd);
} }
static void static void
@ -500,11 +513,14 @@ client_node_demarshal_event (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); SpaPODIter it;
const SpaNodeEvent *event; const SpaNodeEvent *event;
uint32_t s; uint32_t s;
if (!spa_pod_get_bytes (&p, (const void**)&event, &s)) if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_iter_get (&it,
SPA_POD_TYPE_BYTES, &event, &s,
0))
return; return;
pinos_client_node_notify_event (proxy, event); pinos_client_node_notify_event (proxy, event);
@ -516,15 +532,18 @@ client_node_demarshal_add_port (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); SpaPODIter it;
int32_t i1, i2, i3; int32_t seq, direction, port_id;
if (!spa_pod_get_int (&p, &i1) || if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_get_int (&p, &i2) || !spa_pod_iter_get (&it,
!spa_pod_get_int (&p, &i3)) SPA_POD_TYPE_INT, &seq,
SPA_POD_TYPE_INT, &direction,
SPA_POD_TYPE_INT, &port_id,
0))
return; return;
pinos_client_node_notify_add_port (proxy, i1, i2, i3); pinos_client_node_notify_add_port (proxy, seq, direction, port_id);
} }
static void static void
@ -533,15 +552,18 @@ client_node_demarshal_remove_port (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); SpaPODIter it;
int32_t i1, i2, i3; int32_t seq, direction, port_id;
if (!spa_pod_get_int (&p, &i1) || if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_get_int (&p, &i2) || !spa_pod_iter_get (&it,
!spa_pod_get_int (&p, &i3)) SPA_POD_TYPE_INT, &seq,
SPA_POD_TYPE_INT, &direction,
SPA_POD_TYPE_INT, &port_id,
0))
return; return;
pinos_client_node_notify_remove_port (proxy, i1, i2, i3); pinos_client_node_notify_remove_port (proxy, seq, direction, port_id);
} }
static void static void
@ -550,18 +572,21 @@ client_node_demarshal_set_format (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); SpaPODIter it;
int32_t seq, direction, port_id, flags, have_format; uint32_t seq, direction, port_id, flags, have_format;
const SpaFormat *format = NULL; const SpaFormat *format = NULL;
if (!spa_pod_get_int (&p, &seq) || if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_get_int (&p, &direction) || !spa_pod_iter_get (&it,
!spa_pod_get_int (&p, &port_id) || SPA_POD_TYPE_INT, &seq,
!spa_pod_get_int (&p, &flags) || SPA_POD_TYPE_INT, &direction,
!spa_pod_get_int (&p, &have_format)) SPA_POD_TYPE_INT, &port_id,
SPA_POD_TYPE_INT, &flags,
SPA_POD_TYPE_INT, &have_format,
0))
return; return;
if (have_format && !spa_pod_get_object (&p, (const SpaPOD**)&format)) if (have_format && !spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &format, 0))
return; return;
pinos_client_node_notify_set_format (proxy, seq, direction, port_id, pinos_client_node_notify_set_format (proxy, seq, direction, port_id,
@ -574,14 +599,17 @@ client_node_demarshal_set_property (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); SpaPODIter it;
int32_t seq, id; uint32_t seq, id;
const void *value; const void *value;
uint32_t s; uint32_t s;
if (!spa_pod_get_int (&p, &seq) || if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_get_int (&p, &id) || !spa_pod_iter_get (&it,
!spa_pod_get_bytes (&p, &value, &s)) SPA_POD_TYPE_INT, &seq,
SPA_POD_TYPE_INT, &id,
SPA_POD_TYPE_BYTES, &value, &s,
0))
return; return;
pinos_client_node_notify_set_property (proxy, seq, id, s, value); pinos_client_node_notify_set_property (proxy, seq, id, s, value);
@ -593,21 +621,25 @@ client_node_demarshal_add_mem (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); SpaPODIter it;
PinosConnection *connection = proxy->context->protocol_private; PinosConnection *connection = proxy->context->protocol_private;
int32_t direction, port_id, mem_id, type, memfd, flags, offset, sz; uint32_t direction, port_id, mem_id, type, memfd_idx, flags, offset, sz;
int memfd;
if (!spa_pod_get_int (&p, &direction) || if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_get_int (&p, &port_id) || !spa_pod_iter_get (&it,
!spa_pod_get_int (&p, &mem_id) || SPA_POD_TYPE_INT, &direction,
!spa_pod_get_int (&p, &type) || SPA_POD_TYPE_INT, &port_id,
!spa_pod_get_int (&p, &memfd) || SPA_POD_TYPE_INT, &mem_id,
!spa_pod_get_int (&p, &flags) || SPA_POD_TYPE_INT, &type,
!spa_pod_get_int (&p, &offset) || SPA_POD_TYPE_INT, &memfd_idx,
!spa_pod_get_int (&p, &sz)) SPA_POD_TYPE_INT, &flags,
SPA_POD_TYPE_INT, &offset,
SPA_POD_TYPE_INT, &sz,
0))
return; return;
memfd = pinos_connection_get_fd (connection, memfd); memfd = pinos_connection_get_fd (connection, memfd_idx);
pinos_client_node_notify_add_mem (proxy, pinos_client_node_notify_add_mem (proxy,
direction, direction,
@ -626,66 +658,60 @@ client_node_demarshal_use_buffers (void *object,
size_t size) size_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); SpaPODIter it;
int32_t seq, direction, port_id, n_buffers; uint32_t seq, direction, port_id, n_buffers, data_id;
PinosClientNodeBuffer *buffers; PinosClientNodeBuffer *buffers;
int i, j; int i, j;
if (!spa_pod_get_int (&p, &seq) || if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_get_int (&p, &direction) || !spa_pod_iter_get (&it,
!spa_pod_get_int (&p, &port_id) || SPA_POD_TYPE_INT, &seq,
!spa_pod_get_int (&p, &n_buffers)) SPA_POD_TYPE_INT, &direction,
SPA_POD_TYPE_INT, &port_id,
SPA_POD_TYPE_INT, &n_buffers,
0))
return; return;
buffers = alloca (sizeof (PinosClientNodeBuffer) * n_buffers); buffers = alloca (sizeof (PinosClientNodeBuffer) * n_buffers);
for (i = 0; i < n_buffers; i++) { for (i = 0; i < n_buffers; i++) {
SpaBuffer *buf = buffers[i].buffer = alloca (sizeof (SpaBuffer)); SpaBuffer *buf = buffers[i].buffer = alloca (sizeof (SpaBuffer));
int32_t i1, i2, i3, i4, i5;
if (!spa_pod_get_int (&p, &i1) || if (!spa_pod_iter_get (&it,
!spa_pod_get_int (&p, &i2) || SPA_POD_TYPE_INT, &buffers[i].mem_id,
!spa_pod_get_int (&p, &i3) || SPA_POD_TYPE_INT, &buffers[i].offset,
!spa_pod_get_int (&p, &i4) || SPA_POD_TYPE_INT, &buffers[i].size,
!spa_pod_get_int (&p, &i5)) SPA_POD_TYPE_INT, &buf->id,
SPA_POD_TYPE_INT, &buf->n_metas, 0))
return; return;
buffers[i].mem_id = i1;
buffers[i].offset = i2;
buffers[i].size = i3;
buf->id = i4;
buf->n_metas = i5;
buf->metas = alloca (sizeof (SpaMeta) * buf->n_metas); buf->metas = alloca (sizeof (SpaMeta) * buf->n_metas);
for (j = 0; j < buf->n_metas; j++) { for (j = 0; j < buf->n_metas; j++) {
SpaMeta *m = &buf->metas[j]; SpaMeta *m = &buf->metas[j];
if (!spa_pod_get_int (&p, &i1) || if (!spa_pod_iter_get (&it,
!spa_pod_get_int (&p, &i2)) SPA_POD_TYPE_INT, &m->type,
SPA_POD_TYPE_INT, &size, 0))
return; return;
m->type = i1; m->size = size;
m->size = i2;
} }
if (!spa_pod_get_int (&p, &i1)) if (!spa_pod_iter_get (&it, SPA_POD_TYPE_INT, &buf->n_datas, 0))
return; return;
buf->n_datas = i1;
buf->datas = alloca (sizeof (SpaData) * buf->n_datas); buf->datas = alloca (sizeof (SpaData) * buf->n_datas);
for (j = 0; j < buf->n_datas; j++) { for (j = 0; j < buf->n_datas; j++) {
SpaData *d = &buf->datas[j]; SpaData *d = &buf->datas[j];
if (!spa_pod_get_int (&p, &i1) || if (!spa_pod_iter_get (&it,
!spa_pod_get_int (&p, &i2) || SPA_POD_TYPE_INT, &d->type,
!spa_pod_get_int (&p, &i3) || SPA_POD_TYPE_INT, &data_id,
!spa_pod_get_int (&p, &i4) || SPA_POD_TYPE_INT, &d->flags,
!spa_pod_get_int (&p, &i5)) SPA_POD_TYPE_INT, &d->mapoffset,
SPA_POD_TYPE_INT, &d->maxsize,
0))
return; return;
d->type = i1; d->data = SPA_UINT32_TO_PTR (data_id);
d->data = SPA_UINT32_TO_PTR (i2);
d->flags = i3;
d->mapoffset = i4;
d->maxsize = i5;
} }
} }
pinos_client_node_notify_use_buffers (proxy, pinos_client_node_notify_use_buffers (proxy,

View file

@ -47,8 +47,8 @@ typedef struct {
int fd; int fd;
uint32_t flags; uint32_t flags;
void *ptr; void *ptr;
off_t offset; uint32_t offset;
size_t size; uint32_t size;
} MemId; } MemId;
typedef struct { typedef struct {
@ -66,7 +66,7 @@ typedef struct
uint32_t seq; uint32_t seq;
unsigned int n_possible_formats; uint32_t n_possible_formats;
SpaFormat **possible_formats; SpaFormat **possible_formats;
SpaFormat *format; SpaFormat *format;
@ -310,7 +310,7 @@ static void
add_node_update (PinosStream *stream, uint32_t change_mask, bool flush) add_node_update (PinosStream *stream, uint32_t change_mask, bool flush)
{ {
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this); PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
unsigned int max_input_ports = 0, max_output_ports = 0; uint32_t max_input_ports = 0, max_output_ports = 0;
if (change_mask & PINOS_MESSAGE_NODE_UPDATE_MAX_INPUTS) if (change_mask & PINOS_MESSAGE_NODE_UPDATE_MAX_INPUTS)
max_input_ports = impl->direction == SPA_DIRECTION_INPUT ? 1 : 0; max_input_ports = impl->direction == SPA_DIRECTION_INPUT ? 1 : 0;
@ -724,7 +724,7 @@ static void
client_node_set_property (void *object, client_node_set_property (void *object,
uint32_t seq, uint32_t seq,
uint32_t id, uint32_t id,
size_t size, uint32_t size,
const void *value) const void *value)
{ {
pinos_log_warn ("set property not implemented"); pinos_log_warn ("set property not implemented");
@ -738,8 +738,8 @@ client_node_add_mem (void *object,
SpaDataType type, SpaDataType type,
int memfd, int memfd,
uint32_t flags, uint32_t flags,
off_t offset, uint32_t offset,
size_t size) uint32_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
PinosStream *stream = proxy->user_data; PinosStream *stream = proxy->user_data;
@ -748,12 +748,12 @@ client_node_add_mem (void *object,
m = find_mem (stream, mem_id); m = find_mem (stream, mem_id);
if (m) { if (m) {
pinos_log_debug ("update mem %u, fd %d, flags %d, off %zd, size %zd", pinos_log_debug ("update mem %u, fd %d, flags %d, off %d, size %d",
mem_id, memfd, flags, offset, size); mem_id, memfd, flags, offset, size);
clear_memid (m); clear_memid (m);
} else { } else {
m = pinos_array_add (&impl->mem_ids, sizeof (MemId)); m = pinos_array_add (&impl->mem_ids, sizeof (MemId));
pinos_log_debug ("add mem %u, fd %d, flags %d, off %zd, size %zd", pinos_log_debug ("add mem %u, fd %d, flags %d, off %d, size %d",
mem_id, memfd, flags, offset, size); mem_id, memfd, flags, offset, size);
} }
m->id = mem_id; m->id = mem_id;
@ -769,14 +769,14 @@ client_node_use_buffers (void *object,
uint32_t seq, uint32_t seq,
SpaDirection direction, SpaDirection direction,
uint32_t port_id, uint32_t port_id,
unsigned int n_buffers, uint32_t n_buffers,
PinosClientNodeBuffer *buffers) PinosClientNodeBuffer *buffers)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
PinosStream *stream = proxy->user_data; PinosStream *stream = proxy->user_data;
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this); PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
BufferId *bid; BufferId *bid;
unsigned int i, j, len; uint32_t i, j, len;
SpaBuffer *b; SpaBuffer *b;
/* clear previous buffers */ /* clear previous buffers */
@ -795,7 +795,7 @@ client_node_use_buffers (void *object,
mid->ptr = mmap (NULL, mid->size + mid->offset, PROT_READ | PROT_WRITE, MAP_SHARED, mid->fd, 0); mid->ptr = mmap (NULL, mid->size + mid->offset, PROT_READ | PROT_WRITE, MAP_SHARED, mid->fd, 0);
if (mid->ptr == MAP_FAILED) { if (mid->ptr == MAP_FAILED) {
mid->ptr = NULL; mid->ptr = NULL;
pinos_log_warn ("Failed to mmap memory %zd %p: %s", mid->size, mid, strerror (errno)); pinos_log_warn ("Failed to mmap memory %d %p: %s", mid->size, mid, strerror (errno));
continue; continue;
} }
mid->ptr = SPA_MEMBER (mid->ptr, mid->offset, void); mid->ptr = SPA_MEMBER (mid->ptr, mid->offset, void);
@ -820,7 +820,7 @@ client_node_use_buffers (void *object,
pinos_log_warn ("unexpected id %u found, expected %u", bid->id, len); pinos_log_warn ("unexpected id %u found, expected %u", bid->id, len);
impl->in_order = false; impl->in_order = false;
} }
pinos_log_debug ("add buffer %d %d %zd", mid->id, bid->id, buffers[i].offset); pinos_log_debug ("add buffer %d %d %u", mid->id, bid->id, buffers[i].offset);
for (j = 0; j < b->n_metas; j++) { for (j = 0; j < b->n_metas; j++) {
SpaMeta *m = &b->metas[j]; SpaMeta *m = &b->metas[j];
@ -893,8 +893,8 @@ client_node_port_command (void *object,
static void static void
client_node_transport (void *object, client_node_transport (void *object,
int memfd, int memfd,
off_t offset, uint32_t offset,
size_t size) uint32_t size)
{ {
PinosProxy *proxy = object; PinosProxy *proxy = object;
PinosStream *stream = proxy->user_data; PinosStream *stream = proxy->user_data;
@ -964,7 +964,7 @@ pinos_stream_connect (PinosStream *stream,
PinosStreamMode mode, PinosStreamMode mode,
const char *port_path, const char *port_path,
PinosStreamFlags flags, PinosStreamFlags flags,
unsigned int n_possible_formats, uint32_t n_possible_formats,
SpaFormat **possible_formats) SpaFormat **possible_formats)
{ {
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this); PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
@ -1030,7 +1030,7 @@ bool
pinos_stream_finish_format (PinosStream *stream, pinos_stream_finish_format (PinosStream *stream,
SpaResult res, SpaResult res,
SpaAllocParam **params, SpaAllocParam **params,
unsigned int n_params) uint32_t n_params)
{ {
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this); PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);

View file

@ -105,14 +105,14 @@ bool pinos_stream_connect (PinosStream *stream,
PinosStreamMode mode, PinosStreamMode mode,
const char *port_path, const char *port_path,
PinosStreamFlags flags, PinosStreamFlags flags,
unsigned int n_possible_formats, uint32_t n_possible_formats,
SpaFormat **possible_formats); SpaFormat **possible_formats);
bool pinos_stream_disconnect (PinosStream *stream); bool pinos_stream_disconnect (PinosStream *stream);
bool pinos_stream_finish_format (PinosStream *stream, bool pinos_stream_finish_format (PinosStream *stream,
SpaResult res, SpaResult res,
SpaAllocParam **params, SpaAllocParam **params,
unsigned int n_params); uint32_t n_params);

View file

@ -99,8 +99,8 @@ transport_setup_area (void *p, PinosTransport *trans)
} }
PinosTransport * PinosTransport *
pinos_transport_new (unsigned int max_inputs, pinos_transport_new (uint32_t max_inputs,
unsigned int max_outputs) uint32_t max_outputs)
{ {
PinosTransportImpl *impl; PinosTransportImpl *impl;
PinosTransport *trans; PinosTransport *trans;

View file

@ -37,9 +37,9 @@ typedef struct _PinosTransportArea PinosTransportArea;
#include <pinos/client/sig.h> #include <pinos/client/sig.h>
typedef struct { typedef struct {
int memfd; int memfd;
off_t offset; uint32_t offset;
size_t size; uint32_t size;
} PinosTransportInfo; } PinosTransportInfo;
/** /**
@ -48,10 +48,10 @@ typedef struct {
* Shared structure between client and server * Shared structure between client and server
*/ */
struct _PinosTransportArea { struct _PinosTransportArea {
unsigned int max_inputs; uint32_t max_inputs;
unsigned int n_inputs; uint32_t n_inputs;
unsigned int max_outputs; uint32_t max_outputs;
unsigned int n_outputs; uint32_t n_outputs;
}; };
struct _PinosTransport { struct _PinosTransport {
@ -67,8 +67,8 @@ struct _PinosTransport {
SpaRingbuffer *output_buffer; SpaRingbuffer *output_buffer;
}; };
PinosTransport * pinos_transport_new (unsigned int max_inputs, PinosTransport * pinos_transport_new (uint32_t max_inputs,
unsigned int max_outputs); uint32_t max_outputs);
PinosTransport * pinos_transport_new_from_info (PinosTransportInfo *info); PinosTransport * pinos_transport_new_from_info (PinosTransportInfo *info);
void pinos_transport_destroy (PinosTransport *trans); void pinos_transport_destroy (PinosTransport *trans);

View file

@ -353,8 +353,8 @@ handle_audio_fields (ConvertData *d)
return TRUE; return TRUE;
} }
static off_t static uint32_t
write_pod (SpaPODBuilder *b, off_t ref, const void *data, size_t size) write_pod (SpaPODBuilder *b, uint32_t ref, const void *data, uint32_t size)
{ {
if (ref == -1) if (ref == -1)
ref = b->offset; ref = b->offset;

View file

@ -369,7 +369,7 @@ on_add_buffer (PinosListener *listener,
GstPinosSink *pinossink = SPA_CONTAINER_OF (listener, GstPinosSink, stream_add_buffer); GstPinosSink *pinossink = SPA_CONTAINER_OF (listener, GstPinosSink, stream_add_buffer);
SpaBuffer *b; SpaBuffer *b;
GstBuffer *buf; GstBuffer *buf;
unsigned int i; uint32_t i;
ProcessMemData data; ProcessMemData data;
GST_LOG_OBJECT (pinossink, "add buffer"); GST_LOG_OBJECT (pinossink, "add buffer");

View file

@ -386,7 +386,7 @@ on_add_buffer (PinosListener *listener,
GstPinosSrc *pinossrc = SPA_CONTAINER_OF (listener, GstPinosSrc, stream_add_buffer); GstPinosSrc *pinossrc = SPA_CONTAINER_OF (listener, GstPinosSrc, stream_add_buffer);
SpaBuffer *b; SpaBuffer *b;
GstBuffer *buf; GstBuffer *buf;
unsigned int i; uint32_t i;
ProcessMemData data; ProcessMemData data;
GST_LOG_OBJECT (pinossrc, "add buffer"); GST_LOG_OBJECT (pinossrc, "add buffer");

View file

@ -141,7 +141,7 @@ connection_data (SpaSource *source,
PinosConnection *conn = client->connection; PinosConnection *conn = client->connection;
uint8_t opcode; uint8_t opcode;
uint32_t id; uint32_t id;
size_t size; uint32_t size;
PinosClient *c = client->client; PinosClient *c = client->client;
void *message; void *message;

View file

@ -84,7 +84,7 @@ add_item (PinosSpaMonitor *this, SpaMonitorItem *item)
props = pinos_properties_new (NULL, NULL); props = pinos_properties_new (NULL, NULL);
if (item->info) { if (item->info) {
unsigned int i; uint32_t i;
for (i = 0; i < item->info->n_items; i++) { for (i = 0; i < item->info->n_items; i++) {
pinos_properties_set (props, pinos_properties_set (props,
@ -203,7 +203,7 @@ pinos_spa_monitor_load (PinosCore *core,
SpaResult res; SpaResult res;
void *iface; void *iface;
void *hnd; void *hnd;
unsigned int index; uint32_t index;
SpaEnumHandleFactoryFunc enum_func; SpaEnumHandleFactoryFunc enum_func;
const SpaHandleFactory *factory; const SpaHandleFactory *factory;

View file

@ -47,7 +47,7 @@ pinos_spa_node_load (PinosCore *core,
SpaResult res; SpaResult res;
SpaHandle *handle; SpaHandle *handle;
void *hnd; void *hnd;
unsigned int index; uint32_t index;
SpaEnumHandleFactoryFunc enum_func; SpaEnumHandleFactoryFunc enum_func;
const SpaHandleFactory *factory; const SpaHandleFactory *factory;
void *iface; void *iface;

View file

@ -72,11 +72,11 @@ typedef struct {
bool valid; bool valid;
SpaPortInfo *info; SpaPortInfo *info;
SpaFormat *format; SpaFormat *format;
unsigned int n_formats; uint32_t n_formats;
SpaFormat **formats; SpaFormat **formats;
void *io; void *io;
unsigned int n_buffers; uint32_t n_buffers;
ProxyBuffer buffers[MAX_BUFFERS]; ProxyBuffer buffers[MAX_BUFFERS];
uint32_t buffer_mem_id; uint32_t buffer_mem_id;
@ -101,10 +101,10 @@ struct _SpaProxy
SpaSource data_source; SpaSource data_source;
unsigned int max_inputs; uint32_t max_inputs;
unsigned int n_inputs; uint32_t n_inputs;
unsigned int max_outputs; uint32_t max_outputs;
unsigned int n_outputs; uint32_t n_outputs;
SpaProxyPort in_ports[MAX_INPUTS]; SpaProxyPort in_ports[MAX_INPUTS];
SpaProxyPort out_ports[MAX_OUTPUTS]; SpaProxyPort out_ports[MAX_OUTPUTS];
@ -254,10 +254,10 @@ spa_proxy_node_set_event_callback (SpaNode *node,
static SpaResult static SpaResult
spa_proxy_node_get_n_ports (SpaNode *node, spa_proxy_node_get_n_ports (SpaNode *node,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
SpaProxy *this; SpaProxy *this;
@ -280,9 +280,9 @@ spa_proxy_node_get_n_ports (SpaNode *node,
static SpaResult static SpaResult
spa_proxy_node_get_port_ids (SpaNode *node, spa_proxy_node_get_port_ids (SpaNode *node,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
SpaProxy *this; SpaProxy *this;
@ -313,14 +313,14 @@ do_update_port (SpaProxy *this,
SpaDirection direction, SpaDirection direction,
uint32_t port_id, uint32_t port_id,
uint32_t change_mask, uint32_t change_mask,
unsigned int n_possible_formats, uint32_t n_possible_formats,
const SpaFormat **possible_formats, const SpaFormat **possible_formats,
const SpaFormat *format, const SpaFormat *format,
const SpaProps *props, const SpaProps *props,
const SpaPortInfo *info) const SpaPortInfo *info)
{ {
SpaProxyPort *port; SpaProxyPort *port;
unsigned int i; uint32_t i;
size_t size; size_t size;
if (direction == SPA_DIRECTION_INPUT) { if (direction == SPA_DIRECTION_INPUT) {
@ -459,7 +459,7 @@ spa_proxy_node_port_enum_formats (SpaNode *node,
uint32_t port_id, uint32_t port_id,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index) uint32_t index)
{ {
SpaProxy *this; SpaProxy *this;
SpaProxyPort *port; SpaProxyPort *port;
@ -630,7 +630,7 @@ spa_proxy_node_port_use_buffers (SpaNode *node,
{ {
SpaProxy *this; SpaProxy *this;
SpaProxyPort *port; SpaProxyPort *port;
unsigned int i, j; uint32_t i, j;
size_t n_mem; size_t n_mem;
PinosClientNodeBuffer *mb; PinosClientNodeBuffer *mb;
SpaMetaShared *msh; SpaMetaShared *msh;
@ -886,8 +886,8 @@ handle_node_event (SpaProxy *this,
static void static void
client_node_update (void *object, client_node_update (void *object,
uint32_t change_mask, uint32_t change_mask,
unsigned int max_input_ports, uint32_t max_input_ports,
unsigned int max_output_ports, uint32_t max_output_ports,
const SpaProps *props) const SpaProps *props)
{ {
PinosResource *resource = object; PinosResource *resource = object;
@ -909,7 +909,7 @@ client_node_port_update (void *object,
SpaDirection direction, SpaDirection direction,
uint32_t port_id, uint32_t port_id,
uint32_t change_mask, uint32_t change_mask,
unsigned int n_possible_formats, uint32_t n_possible_formats,
const SpaFormat **possible_formats, const SpaFormat **possible_formats,
const SpaFormat *format, const SpaFormat *format,
const SpaProps *props, const SpaProps *props,
@ -1044,9 +1044,9 @@ static SpaResult
proxy_init (SpaProxy *this, proxy_init (SpaProxy *this,
SpaDict *info, SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
unsigned int i; uint32_t i;
for (i = 0; i < n_support; i++) { for (i = 0; i < n_support; i++) {
if (strcmp (support[i].uri, SPA_LOG_URI) == 0) if (strcmp (support[i].uri, SPA_LOG_URI) == 0)
@ -1114,7 +1114,7 @@ on_global_added (PinosListener *listener,
static SpaResult static SpaResult
proxy_clear (SpaProxy *this) proxy_clear (SpaProxy *this)
{ {
unsigned int i; uint32_t i;
for (i = 0; i < MAX_INPUTS; i++) { for (i = 0; i < MAX_INPUTS; i++) {
if (this->in_ports[i].valid) if (this->in_ports[i].valid)

View file

@ -171,7 +171,7 @@ pinos_client_update_properties (PinosClient *client,
if (dict) if (dict)
client->properties = pinos_properties_new_dict (dict); client->properties = pinos_properties_new_dict (dict);
} else { } else {
unsigned int i; uint32_t i;
for (i = 0; i < dict->n_items; i++) for (i = 0; i < dict->n_items; i++)
pinos_properties_set (client->properties, pinos_properties_set (client->properties,

View file

@ -435,7 +435,7 @@ pinos_core_update_properties (PinosCore *core,
if (dict) if (dict)
core->properties = pinos_properties_new_dict (dict); core->properties = pinos_properties_new_dict (dict);
} else if (dict != &core->properties->dict) { } else if (dict != &core->properties->dict) {
unsigned int i; uint32_t i;
for (i = 0; i < dict->n_items; i++) for (i = 0; i < dict->n_items; i++)
pinos_properties_set (core->properties, pinos_properties_set (core->properties,
@ -456,7 +456,7 @@ pinos_core_find_port (PinosCore *core,
PinosPort *other_port, PinosPort *other_port,
uint32_t id, uint32_t id,
PinosProperties *props, PinosProperties *props,
unsigned int n_format_filters, uint32_t n_format_filters,
SpaFormat **format_filters, SpaFormat **format_filters,
char **error) char **error)
{ {
@ -520,14 +520,14 @@ pinos_core_find_format (PinosCore *core,
PinosPort *output, PinosPort *output,
PinosPort *input, PinosPort *input,
PinosProperties *props, PinosProperties *props,
unsigned int n_format_filters, uint32_t n_format_filters,
SpaFormat **format_filterss, SpaFormat **format_filterss,
char **error) char **error)
{ {
SpaNodeState out_state, in_state; SpaNodeState out_state, in_state;
SpaResult res; SpaResult res;
SpaFormat *filter = NULL, *format; SpaFormat *filter = NULL, *format;
unsigned int iidx = 0, oidx = 0; uint32_t iidx = 0, oidx = 0;
out_state = output->node->node->state; out_state = output->node->node->state;
in_state = input->node->node->state; in_state = input->node->node->state;

View file

@ -85,7 +85,7 @@ struct _PinosCore {
PinosDataLoop *data_loop; PinosDataLoop *data_loop;
SpaSupport *support; SpaSupport *support;
unsigned int n_support; uint32_t n_support;
PINOS_SIGNAL (destroy_signal, (PinosListener *listener, PINOS_SIGNAL (destroy_signal, (PinosListener *listener,
PinosCore *core)); PinosCore *core));
@ -122,7 +122,7 @@ SpaFormat * pinos_core_find_format (PinosCore *core,
PinosPort *output, PinosPort *output,
PinosPort *input, PinosPort *input,
PinosProperties *props, PinosProperties *props,
unsigned int n_format_filters, uint32_t n_format_filters,
SpaFormat **format_filters, SpaFormat **format_filters,
char **error); char **error);
@ -130,7 +130,7 @@ PinosPort * pinos_core_find_port (PinosCore *core,
PinosPort *other_port, PinosPort *other_port,
uint32_t id, uint32_t id,
PinosProperties *props, PinosProperties *props,
unsigned int n_format_filters, uint32_t n_format_filters,
SpaFormat **format_filters, SpaFormat **format_filters,
char **error); char **error);

View file

@ -49,7 +49,7 @@ typedef struct
bool allocated; bool allocated;
PinosMemblock buffer_mem; PinosMemblock buffer_mem;
SpaBuffer **buffers; SpaBuffer **buffers;
unsigned int n_buffers; uint32_t n_buffers;
} PinosLinkImpl; } PinosLinkImpl;
static void static void
@ -142,7 +142,7 @@ error:
static void * static void *
find_param (const SpaPortInfo *info, SpaAllocParamType type) find_param (const SpaPortInfo *info, SpaAllocParamType type)
{ {
unsigned int i; uint32_t i;
for (i = 0; i < info->n_params; i++) { for (i = 0; i < info->n_params; i++) {
if (info->params[i]->type == type) if (info->params[i]->type == type)
@ -154,7 +154,7 @@ find_param (const SpaPortInfo *info, SpaAllocParamType type)
static void * static void *
find_meta_enable (const SpaPortInfo *info, SpaMetaType type) find_meta_enable (const SpaPortInfo *info, SpaMetaType type)
{ {
unsigned int i; uint32_t i;
for (i = 0; i < info->n_params; i++) { for (i = 0; i < info->n_params; i++) {
if (info->params[i]->type == SPA_ALLOC_PARAM_TYPE_META_ENABLE && if (info->params[i]->type == SPA_ALLOC_PARAM_TYPE_META_ENABLE &&
@ -167,20 +167,20 @@ find_meta_enable (const SpaPortInfo *info, SpaMetaType type)
static SpaBuffer ** static SpaBuffer **
alloc_buffers (PinosLink *this, alloc_buffers (PinosLink *this,
unsigned int n_buffers, uint32_t n_buffers,
unsigned int n_params, uint32_t n_params,
SpaAllocParam **params, SpaAllocParam **params,
unsigned int n_datas, uint32_t n_datas,
size_t *data_sizes, size_t *data_sizes,
ssize_t *data_strides, ssize_t *data_strides,
PinosMemblock *mem) PinosMemblock *mem)
{ {
SpaBuffer **buffers, *bp; SpaBuffer **buffers, *bp;
unsigned int i; uint32_t i;
size_t skel_size, data_size, meta_size; size_t skel_size, data_size, meta_size;
SpaChunk *cdp; SpaChunk *cdp;
void *ddp; void *ddp;
unsigned int n_metas; uint32_t n_metas;
SpaMeta *metas; SpaMeta *metas;
n_metas = data_size = meta_size = 0; n_metas = data_size = meta_size = 0;
@ -382,7 +382,7 @@ do_allocation (PinosLink *this, SpaNodeState in_state, SpaNodeState out_state)
if (impl->buffers == NULL) { if (impl->buffers == NULL) {
SpaAllocParamBuffers *in_alloc, *out_alloc; SpaAllocParamBuffers *in_alloc, *out_alloc;
SpaAllocParamMetaEnableRingbuffer *in_me, *out_me; SpaAllocParamMetaEnableRingbuffer *in_me, *out_me;
unsigned int max_buffers; uint32_t max_buffers;
size_t minsize, stride, blocks; size_t minsize, stride, blocks;
in_me = find_meta_enable (iinfo, SPA_META_TYPE_RINGBUFFER); in_me = find_meta_enable (iinfo, SPA_META_TYPE_RINGBUFFER);

View file

@ -69,7 +69,7 @@ struct _PinosLink {
PinosPort *port)); PinosPort *port));
struct { struct {
unsigned int in_ready; uint32_t in_ready;
PinosPort *input; PinosPort *input;
PinosPort *output; PinosPort *output;
SpaList input_link; SpaList input_link;

View file

@ -45,8 +45,8 @@ update_port_ids (PinosNode *node, bool create)
{ {
PinosNodeImpl *impl = SPA_CONTAINER_OF (node, PinosNodeImpl, this); PinosNodeImpl *impl = SPA_CONTAINER_OF (node, PinosNodeImpl, this);
uint32_t *input_port_ids, *output_port_ids; uint32_t *input_port_ids, *output_port_ids;
unsigned int n_input_ports, n_output_ports, max_input_ports, max_output_ports; uint32_t n_input_ports, n_output_ports, max_input_ports, max_output_ports;
unsigned int i; uint32_t i;
SpaList *ports; SpaList *ports;
if (node->node == NULL) if (node->node == NULL)
@ -524,7 +524,7 @@ pinos_node_new (PinosCore *core,
spa_list_init (&this->output_ports); spa_list_init (&this->output_ports);
if (this->node->info) { if (this->node->info) {
unsigned int i; uint32_t i;
if (this->properties == NULL) if (this->properties == NULL)
this->properties = pinos_properties_new (NULL, NULL); this->properties = pinos_properties_new (NULL, NULL);
@ -681,7 +681,7 @@ PinosPort *
pinos_node_get_free_port (PinosNode *node, pinos_node_get_free_port (PinosNode *node,
PinosDirection direction) PinosDirection direction)
{ {
unsigned int n_ports, max_ports; uint32_t n_ports, max_ports;
SpaList *ports; SpaList *ports;
PinosPort *port = NULL, *p; PinosPort *port = NULL, *p;

View file

@ -81,8 +81,8 @@ struct _PinosNode {
PinosPort **input_port_map; PinosPort **input_port_map;
PinosPort **output_port_map; PinosPort **output_port_map;
unsigned int n_used_output_links; uint32_t n_used_output_links;
unsigned int n_used_input_links; uint32_t n_used_input_links;
PinosTransport *transport; PinosTransport *transport;
PINOS_SIGNAL (transport_changed, (PinosListener *listener, PINOS_SIGNAL (transport_changed, (PinosListener *listener,

View file

@ -49,7 +49,7 @@ struct _PinosPort {
bool allocated; bool allocated;
PinosMemblock buffer_mem; PinosMemblock buffer_mem;
SpaBuffer **buffers; SpaBuffer **buffers;
unsigned int n_buffers; uint32_t n_buffers;
SpaList links; SpaList links;

View file

@ -27,8 +27,8 @@ typedef struct {
PinosConnection *connection; PinosConnection *connection;
} Builder; } Builder;
static off_t static uint32_t
write_pod (SpaPODBuilder *b, off_t ref, const void *data, size_t size) write_pod (SpaPODBuilder *b, uint32_t ref, const void *data, uint32_t size)
{ {
if (ref == -1) if (ref == -1)
ref = b->offset; ref = b->offset;
@ -512,7 +512,7 @@ static void
client_node_marshal_set_property (void *object, client_node_marshal_set_property (void *object,
uint32_t seq, uint32_t seq,
uint32_t id, uint32_t id,
size_t size, uint32_t size,
const void *value) const void *value)
{ {
PinosResource *resource = object; PinosResource *resource = object;
@ -537,8 +537,8 @@ client_node_marshal_add_mem (void *object,
SpaDataType type, SpaDataType type,
int memfd, int memfd,
uint32_t flags, uint32_t flags,
off_t offset, uint32_t offset,
size_t size) uint32_t size)
{ {
PinosResource *resource = object; PinosResource *resource = object;
PinosConnection *connection = resource->client->protocol_private; PinosConnection *connection = resource->client->protocol_private;
@ -564,7 +564,7 @@ client_node_marshal_use_buffers (void *object,
uint32_t seq, uint32_t seq,
SpaDirection direction, SpaDirection direction,
uint32_t port_id, uint32_t port_id,
unsigned int n_buffers, uint32_t n_buffers,
PinosClientNodeBuffer *buffers) PinosClientNodeBuffer *buffers)
{ {
PinosResource *resource = object; PinosResource *resource = object;
@ -645,8 +645,8 @@ client_node_marshal_port_command (void *object,
static void static void
client_node_marshal_transport (void *object, client_node_marshal_transport (void *object,
int memfd, int memfd,
off_t offset, uint32_t offset,
size_t size) uint32_t size)
{ {
PinosResource *resource = object; PinosResource *resource = object;
PinosConnection *connection = resource->client->protocol_private; PinosConnection *connection = resource->client->protocol_private;

View file

@ -109,8 +109,8 @@ typedef struct {
* @height * @height
*/ */
typedef struct { typedef struct {
int x, y; int32_t x, y;
int width, height; int32_t width, height;
} SpaMetaVideoCrop; } SpaMetaVideoCrop;
/** /**
@ -130,10 +130,10 @@ typedef struct {
*/ */
typedef struct { typedef struct {
SpaDataType type; SpaDataType type;
int flags; int32_t flags;
int fd; int fd;
off_t offset; int32_t offset;
size_t size; uint32_t size;
} SpaMetaShared; } SpaMetaShared;
/** /**
@ -145,7 +145,7 @@ typedef struct {
typedef struct { typedef struct {
SpaMetaType type; SpaMetaType type;
void *data; void *data;
size_t size; uint32_t size;
} SpaMeta; } SpaMeta;
/** /**
@ -155,9 +155,9 @@ typedef struct {
* @stride: stride of data if applicable * @stride: stride of data if applicable
*/ */
typedef struct { typedef struct {
off_t offset; uint32_t offset;
size_t size; uint32_t size;
ssize_t stride; int32_t stride;
} SpaChunk; } SpaChunk;
/** /**
@ -172,10 +172,10 @@ typedef struct {
*/ */
typedef struct { typedef struct {
SpaDataType type; SpaDataType type;
int flags; uint32_t flags;
int fd; int fd;
off_t mapoffset; uint32_t mapoffset;
size_t maxsize; uint32_t maxsize;
void *data; void *data;
SpaChunk *chunk; SpaChunk *chunk;
} SpaData; } SpaData;
@ -190,22 +190,17 @@ typedef struct {
*/ */
struct _SpaBuffer { struct _SpaBuffer {
uint32_t id; uint32_t id;
unsigned int n_metas; uint32_t n_metas;
SpaMeta *metas; SpaMeta *metas;
unsigned int n_datas; uint32_t n_datas;
SpaData *datas; SpaData *datas;
}; };
typedef struct {
unsigned int n_buffers;
SpaBuffer **buffers;
} SpaBufferArray;
static inline void * static inline void *
spa_buffer_find_meta (SpaBuffer *b, SpaMetaType type) spa_buffer_find_meta (SpaBuffer *b, SpaMetaType type)
{ {
unsigned int i; uint32_t i;
for (i = 0; i < b->n_metas; i++) for (i = 0; i < b->n_metas; i++)
if (b->metas[i].type == type) if (b->metas[i].type == type)
@ -213,10 +208,10 @@ spa_buffer_find_meta (SpaBuffer *b, SpaMetaType type)
return NULL; return NULL;
} }
static inline size_t static inline uint32_t
spa_meta_type_get_size (SpaMetaType type) spa_meta_type_get_size (SpaMetaType type)
{ {
static const size_t header_sizes[] = { static const uint32_t header_sizes[] = {
0, 0,
sizeof (SpaMetaHeader), sizeof (SpaMetaHeader),
sizeof (SpaMetaPointer), sizeof (SpaMetaPointer),

View file

@ -36,7 +36,7 @@ typedef struct {
} SpaDictItem; } SpaDictItem;
struct _SpaDict { struct _SpaDict {
unsigned int n_items; uint32_t n_items;
SpaDictItem *items; SpaDictItem *items;
}; };

View file

@ -29,7 +29,7 @@ extern "C" {
#include <spa/format.h> #include <spa/format.h>
#include <spa/pod-builder.h> #include <spa/pod-builder.h>
static inline off_t static inline uint32_t
spa_pod_builder_push_format (SpaPODBuilder *builder, spa_pod_builder_push_format (SpaPODBuilder *builder,
SpaPODFrame *frame, SpaPODFrame *frame,
uint32_t media_type, uint32_t media_type,
@ -43,7 +43,7 @@ spa_pod_builder_push_format (SpaPODBuilder *builder,
spa_pod_builder_raw (builder, &p, sizeof(p), false)); spa_pod_builder_raw (builder, &p, sizeof(p), false));
} }
static inline off_t static inline uint32_t
spa_pod_builder_format (SpaPODBuilder *builder, spa_pod_builder_format (SpaPODBuilder *builder,
uint32_t media_type, uint32_t media_type,
uint32_t media_subtype, uint32_t media_subtype,
@ -51,7 +51,7 @@ spa_pod_builder_format (SpaPODBuilder *builder,
{ {
SpaPODFrame f; SpaPODFrame f;
va_list args; va_list args;
off_t off; uint32_t off;
off = spa_pod_builder_push_format (builder, &f, media_type, media_subtype); off = spa_pod_builder_push_format (builder, &f, media_type, media_subtype);

View file

@ -39,7 +39,7 @@ typedef struct _SpaIDMap SpaIDMap;
struct _SpaIDMap { struct _SpaIDMap {
/* the total size of this structure. This can be used to expand this /* the total size of this structure. This can be used to expand this
* structure in the future */ * structure in the future */
size_t size; const size_t size;
/** /**
* SpaIDMap::info * SpaIDMap::info
* *

View file

@ -49,7 +49,7 @@ typedef enum {
typedef struct { typedef struct {
SpaMonitorEventType type; SpaMonitorEventType type;
size_t size; uint32_t size;
} SpaMonitorEvent; } SpaMonitorEvent;
typedef enum { typedef enum {
@ -126,7 +126,7 @@ struct _SpaMonitor {
SpaResult (*enum_items) (SpaMonitor *monitor, SpaResult (*enum_items) (SpaMonitor *monitor,
SpaMonitorItem **item, SpaMonitorItem **item,
unsigned int index); uint32_t index);
}; };

View file

@ -51,7 +51,7 @@ typedef enum {
struct _SpaNodeCommand { struct _SpaNodeCommand {
SpaNodeCommandType type; SpaNodeCommandType type;
size_t size; uint32_t size;
}; };
/** /**

View file

@ -67,7 +67,7 @@ typedef enum {
struct _SpaNodeEvent { struct _SpaNodeEvent {
SpaNodeEventType type; SpaNodeEventType type;
size_t size; uint32_t size;
}; };
typedef struct { typedef struct {

View file

@ -270,10 +270,10 @@ struct _SpaNode {
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL * #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
*/ */
SpaResult (*get_n_ports) (SpaNode *node, SpaResult (*get_n_ports) (SpaNode *node,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports); uint32_t *max_output_ports);
/** /**
* SpaNode::get_port_ids: * SpaNode::get_port_ids:
* @node: a #SpaNode * @node: a #SpaNode
@ -290,9 +290,9 @@ struct _SpaNode {
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL * #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
*/ */
SpaResult (*get_port_ids) (SpaNode *node, SpaResult (*get_port_ids) (SpaNode *node,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids); uint32_t *output_ids);
/** /**
@ -350,7 +350,7 @@ struct _SpaNode {
uint32_t port_id, uint32_t port_id,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index); uint32_t index);
/** /**
* SpaNode::port_set_format: * SpaNode::port_set_format:
* @node: a #SpaNode * @node: a #SpaNode
@ -459,7 +459,7 @@ struct _SpaNode {
SpaDirection direction, SpaDirection direction,
uint32_t port_id, uint32_t port_id,
SpaBuffer **buffers, SpaBuffer **buffers,
unsigned int n_buffers); uint32_t n_buffers);
/** /**
* SpaNode::port_alloc_buffers: * SpaNode::port_alloc_buffers:
* @node: a #SpaNode * @node: a #SpaNode
@ -499,9 +499,9 @@ struct _SpaNode {
SpaDirection direction, SpaDirection direction,
uint32_t port_id, uint32_t port_id,
SpaAllocParam **params, SpaAllocParam **params,
unsigned int n_params, uint32_t n_params,
SpaBuffer **buffers, SpaBuffer **buffers,
unsigned int *n_buffers); uint32_t *n_buffers);
/** /**
* SpaNode::port_set_input: * SpaNode::port_set_input:

View file

@ -130,7 +130,7 @@ struct _SpaHandleFactory {
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support); uint32_t n_support);
/** /**
* SpaHandle::enum_interface_info: * SpaHandle::enum_interface_info:
@ -147,7 +147,7 @@ struct _SpaHandleFactory {
*/ */
SpaResult (*enum_interface_info) (const SpaHandleFactory *factory, SpaResult (*enum_interface_info) (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info, const SpaInterfaceInfo **info,
unsigned int index); uint32_t index);
}; };
#define spa_handle_factory_init(h,...) (h)->init((h),__VA_ARGS__) #define spa_handle_factory_init(h,...) (h)->init((h),__VA_ARGS__)
@ -165,7 +165,7 @@ struct _SpaHandleFactory {
* #SPA_RESULT_ENUM_END when there are no more factories * #SPA_RESULT_ENUM_END when there are no more factories
*/ */
typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory, typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory,
unsigned int index); uint32_t index);
/** /**
* spa_enum_handle_factory: * spa_enum_handle_factory:
@ -179,7 +179,7 @@ typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory,
* #SPA_RESULT_ENUM_END when there are no more factories * #SPA_RESULT_ENUM_END when there are no more factories
*/ */
SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory, SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory,
unsigned int index); uint32_t index);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View file

@ -30,15 +30,15 @@ extern "C" {
typedef struct _SpaPODFrame { typedef struct _SpaPODFrame {
struct _SpaPODFrame *parent; struct _SpaPODFrame *parent;
SpaPOD pod; SpaPOD pod;
off_t ref; uint32_t ref;
} SpaPODFrame; } SpaPODFrame;
typedef struct _SpaPODBuilder { typedef struct _SpaPODBuilder {
void *data; void *data;
size_t size; uint32_t size;
off_t offset; uint32_t offset;
SpaPODFrame *stack; SpaPODFrame *stack;
off_t (*write) (struct _SpaPODBuilder *builder, off_t ref, const void *data, size_t size); uint32_t (*write) (struct _SpaPODBuilder *builder, uint32_t ref, const void *data, uint32_t size);
} SpaPODBuilder; } SpaPODBuilder;
#define SPA_POD_BUILDER_DEREF(b,ref,type) SPA_MEMBER ((b)->data, (ref), type) #define SPA_POD_BUILDER_DEREF(b,ref,type) SPA_MEMBER ((b)->data, (ref), type)
@ -46,7 +46,7 @@ typedef struct _SpaPODBuilder {
static inline void static inline void
spa_pod_builder_init (SpaPODBuilder *builder, spa_pod_builder_init (SpaPODBuilder *builder,
void *data, void *data,
size_t size) uint32_t size)
{ {
builder->data = data; builder->data = data;
builder->size = size; builder->size = size;
@ -71,11 +71,11 @@ spa_pod_builder_in_array (SpaPODBuilder *builder, bool *first)
return false; return false;
} }
static inline off_t static inline uint32_t
spa_pod_builder_push (SpaPODBuilder *builder, spa_pod_builder_push (SpaPODBuilder *builder,
SpaPODFrame *frame, SpaPODFrame *frame,
const SpaPOD *pod, const SpaPOD *pod,
off_t ref) uint32_t ref)
{ {
frame->parent = builder->stack; frame->parent = builder->stack;
frame->pod = *pod; frame->pod = *pod;
@ -113,10 +113,10 @@ spa_pod_builder_pop (SpaPODBuilder *builder,
spa_pod_builder_advance (builder, SPA_ROUND_UP_N(builder->offset, 8) - builder->offset, false); spa_pod_builder_advance (builder, SPA_ROUND_UP_N(builder->offset, 8) - builder->offset, false);
} }
static inline off_t static inline uint32_t
spa_pod_builder_raw (SpaPODBuilder *builder, const void *data, uint32_t size, bool pad) spa_pod_builder_raw (SpaPODBuilder *builder, const void *data, uint32_t size, bool pad)
{ {
off_t ref; uint32_t ref;
if (builder->write) { if (builder->write) {
ref = builder->write (builder, -1, data, size); ref = builder->write (builder, -1, data, size);
@ -132,29 +132,29 @@ spa_pod_builder_raw (SpaPODBuilder *builder, const void *data, uint32_t size, bo
return ref; return ref;
} }
static inline off_t static inline uint32_t
spa_pod_builder_string_body (SpaPODBuilder *builder, spa_pod_builder_string_body (SpaPODBuilder *builder,
const char *str, const char *str,
uint32_t len) uint32_t len)
{ {
off_t out = spa_pod_builder_raw (builder, str, len + 1 , true); uint32_t out = spa_pod_builder_raw (builder, str, len + 1 , true);
if (out != -1) if (out != -1)
*SPA_MEMBER (builder->data, out + len, char) = '\0'; *SPA_MEMBER (builder->data, out + len, char) = '\0';
return out; return out;
} }
static inline off_t static inline uint32_t
spa_pod_builder_pod (SpaPODBuilder *builder, uint32_t size, uint32_t type) spa_pod_builder_pod (SpaPODBuilder *builder, uint32_t size, uint32_t type)
{ {
const SpaPOD p = { size, type }; const SpaPOD p = { size, type };
return spa_pod_builder_raw (builder, &p, sizeof (p), false); return spa_pod_builder_raw (builder, &p, sizeof (p), false);
} }
static inline off_t static inline uint32_t
spa_pod_builder_primitive (SpaPODBuilder *builder, const SpaPOD *p) spa_pod_builder_primitive (SpaPODBuilder *builder, const SpaPOD *p)
{ {
const void *data; const void *data;
size_t size; uint32_t size;
bool in_array, first = false; bool in_array, first = false;
in_array = spa_pod_builder_in_array (builder, &first); in_array = spa_pod_builder_in_array (builder, &first);
@ -168,90 +168,90 @@ spa_pod_builder_primitive (SpaPODBuilder *builder, const SpaPOD *p)
return spa_pod_builder_raw (builder, data, size, !in_array); return spa_pod_builder_raw (builder, data, size, !in_array);
} }
static inline off_t static inline uint32_t
spa_pod_builder_bool (SpaPODBuilder *builder, bool val) spa_pod_builder_bool (SpaPODBuilder *builder, bool val)
{ {
const SpaPODBool p = { { sizeof (uint32_t), SPA_POD_TYPE_BOOL }, val ? 1 : 0 }; const SpaPODBool p = { { sizeof (uint32_t), SPA_POD_TYPE_BOOL }, val ? 1 : 0 };
return spa_pod_builder_primitive (builder, &p.pod); return spa_pod_builder_primitive (builder, &p.pod);
} }
static inline off_t static inline uint32_t
spa_pod_builder_uri (SpaPODBuilder *builder, uint32_t val) spa_pod_builder_uri (SpaPODBuilder *builder, uint32_t val)
{ {
const SpaPODURI p = { { sizeof (uint32_t), SPA_POD_TYPE_URI }, val }; const SpaPODURI p = { { sizeof (uint32_t), SPA_POD_TYPE_URI }, val };
return spa_pod_builder_primitive (builder, &p.pod); return spa_pod_builder_primitive (builder, &p.pod);
} }
static inline off_t static inline uint32_t
spa_pod_builder_int (SpaPODBuilder *builder, int32_t val) spa_pod_builder_int (SpaPODBuilder *builder, int32_t val)
{ {
const SpaPODInt p = { { sizeof (uint32_t), SPA_POD_TYPE_INT }, val }; const SpaPODInt p = { { sizeof (uint32_t), SPA_POD_TYPE_INT }, val };
return spa_pod_builder_primitive (builder, &p.pod); return spa_pod_builder_primitive (builder, &p.pod);
} }
static inline off_t static inline uint32_t
spa_pod_builder_long (SpaPODBuilder *builder, int64_t val) spa_pod_builder_long (SpaPODBuilder *builder, int64_t val)
{ {
const SpaPODLong p = { { sizeof (val), SPA_POD_TYPE_LONG }, val }; const SpaPODLong p = { { sizeof (val), SPA_POD_TYPE_LONG }, val };
return spa_pod_builder_primitive (builder, &p.pod); return spa_pod_builder_primitive (builder, &p.pod);
} }
static inline off_t static inline uint32_t
spa_pod_builder_float (SpaPODBuilder *builder, float val) spa_pod_builder_float (SpaPODBuilder *builder, float val)
{ {
const SpaPODFloat p = { { sizeof (val), SPA_POD_TYPE_FLOAT }, val }; const SpaPODFloat p = { { sizeof (val), SPA_POD_TYPE_FLOAT }, val };
return spa_pod_builder_primitive (builder, &p.pod); return spa_pod_builder_primitive (builder, &p.pod);
} }
static inline off_t static inline uint32_t
spa_pod_builder_double (SpaPODBuilder *builder, double val) spa_pod_builder_double (SpaPODBuilder *builder, double val)
{ {
const SpaPODDouble p = { { sizeof (val), SPA_POD_TYPE_DOUBLE }, val }; const SpaPODDouble p = { { sizeof (val), SPA_POD_TYPE_DOUBLE }, val };
return spa_pod_builder_primitive (builder, &p.pod); return spa_pod_builder_primitive (builder, &p.pod);
} }
static inline off_t static inline uint32_t
spa_pod_builder_string_len (SpaPODBuilder *builder, const char *str, uint32_t len) spa_pod_builder_string_len (SpaPODBuilder *builder, const char *str, uint32_t len)
{ {
const SpaPODString p = { { len + 1, SPA_POD_TYPE_STRING } }; const SpaPODString p = { { len + 1, SPA_POD_TYPE_STRING } };
off_t out = spa_pod_builder_raw (builder, &p, sizeof (p) , false); uint32_t out = spa_pod_builder_raw (builder, &p, sizeof (p) , false);
if (spa_pod_builder_string_body (builder, str, len) == -1) if (spa_pod_builder_string_body (builder, str, len) == -1)
out = -1; out = -1;
return out; return out;
} }
static inline off_t static inline uint32_t
spa_pod_builder_string (SpaPODBuilder *builder, const char *str) spa_pod_builder_string (SpaPODBuilder *builder, const char *str)
{ {
uint32_t len = str ? strlen (str) : 0; uint32_t len = str ? strlen (str) : 0;
return spa_pod_builder_string_len (builder, str ? str : "", len); return spa_pod_builder_string_len (builder, str ? str : "", len);
} }
static inline off_t static inline uint32_t
spa_pod_builder_bytes (SpaPODBuilder *builder, const void *bytes, uint32_t len) spa_pod_builder_bytes (SpaPODBuilder *builder, const void *bytes, uint32_t len)
{ {
const SpaPODBytes p = { { len, SPA_POD_TYPE_BYTES } }; const SpaPODBytes p = { { len, SPA_POD_TYPE_BYTES } };
off_t out = spa_pod_builder_raw (builder, &p, sizeof (p) , false); uint32_t out = spa_pod_builder_raw (builder, &p, sizeof (p) , false);
if (spa_pod_builder_raw (builder, bytes, len, true) == -1) if (spa_pod_builder_raw (builder, bytes, len, true) == -1)
out = -1; out = -1;
return out; return out;
} }
static inline off_t static inline uint32_t
spa_pod_builder_rectangle (SpaPODBuilder *builder, uint32_t width, uint32_t height) spa_pod_builder_rectangle (SpaPODBuilder *builder, uint32_t width, uint32_t height)
{ {
const SpaPODRectangle p = { { sizeof (SpaRectangle), SPA_POD_TYPE_RECTANGLE }, { width, height } }; const SpaPODRectangle p = { { sizeof (SpaRectangle), SPA_POD_TYPE_RECTANGLE }, { width, height } };
return spa_pod_builder_primitive (builder, &p.pod); return spa_pod_builder_primitive (builder, &p.pod);
} }
static inline off_t static inline uint32_t
spa_pod_builder_fraction (SpaPODBuilder *builder, uint32_t num, uint32_t denom) spa_pod_builder_fraction (SpaPODBuilder *builder, uint32_t num, uint32_t denom)
{ {
const SpaPODFraction p = { { sizeof (SpaFraction), SPA_POD_TYPE_FRACTION }, { num, denom } }; const SpaPODFraction p = { { sizeof (SpaFraction), SPA_POD_TYPE_FRACTION }, { num, denom } };
return spa_pod_builder_primitive (builder, &p.pod); return spa_pod_builder_primitive (builder, &p.pod);
} }
static inline off_t static inline uint32_t
spa_pod_builder_push_array (SpaPODBuilder *builder, spa_pod_builder_push_array (SpaPODBuilder *builder,
SpaPODFrame *frame) SpaPODFrame *frame)
{ {
@ -260,7 +260,7 @@ spa_pod_builder_push_array (SpaPODBuilder *builder,
spa_pod_builder_raw (builder, &p, sizeof(p) - sizeof(SpaPOD), false)); spa_pod_builder_raw (builder, &p, sizeof(p) - sizeof(SpaPOD), false));
} }
static inline off_t static inline uint32_t
spa_pod_builder_array (SpaPODBuilder *builder, spa_pod_builder_array (SpaPODBuilder *builder,
uint32_t child_size, uint32_t child_size,
uint32_t child_type, uint32_t child_type,
@ -271,13 +271,13 @@ spa_pod_builder_array (SpaPODBuilder *builder,
{ (uint32_t)(sizeof (SpaPODArrayBody) + n_elems * child_size), SPA_POD_TYPE_ARRAY }, { (uint32_t)(sizeof (SpaPODArrayBody) + n_elems * child_size), SPA_POD_TYPE_ARRAY },
{ { child_size, child_type } } { { child_size, child_type } }
}; };
off_t out = spa_pod_builder_raw (builder, &p, sizeof(p), true); uint32_t out = spa_pod_builder_raw (builder, &p, sizeof(p), true);
if (spa_pod_builder_raw (builder, elems, child_size * n_elems, true) == -1) if (spa_pod_builder_raw (builder, elems, child_size * n_elems, true) == -1)
out = -1; out = -1;
return out; return out;
} }
static inline off_t static inline uint32_t
spa_pod_builder_push_struct (SpaPODBuilder *builder, spa_pod_builder_push_struct (SpaPODBuilder *builder,
SpaPODFrame *frame) SpaPODFrame *frame)
{ {
@ -286,7 +286,7 @@ spa_pod_builder_push_struct (SpaPODBuilder *builder,
spa_pod_builder_raw (builder, &p, sizeof(p), false)); spa_pod_builder_raw (builder, &p, sizeof(p), false));
} }
static inline off_t static inline uint32_t
spa_pod_builder_push_object (SpaPODBuilder *builder, spa_pod_builder_push_object (SpaPODBuilder *builder,
SpaPODFrame *frame, SpaPODFrame *frame,
uint32_t id, uint32_t id,
@ -297,7 +297,7 @@ spa_pod_builder_push_object (SpaPODBuilder *builder,
spa_pod_builder_raw (builder, &p, sizeof(p), false)); spa_pod_builder_raw (builder, &p, sizeof(p), false));
} }
static inline off_t static inline uint32_t
spa_pod_builder_push_prop (SpaPODBuilder *builder, spa_pod_builder_push_prop (SpaPODBuilder *builder,
SpaPODFrame *frame, SpaPODFrame *frame,
uint32_t key, uint32_t key,
@ -315,10 +315,10 @@ spa_pod_builder_propv (SpaPODBuilder *builder,
va_list args) va_list args)
{ {
while (propid != 0) { while (propid != 0) {
int type, n_alternatives = -1; uint32_t type, n_alternatives = -1;
SpaPODProp *prop = NULL; SpaPODProp *prop = NULL;
SpaPODFrame f; SpaPODFrame f;
off_t off; uint32_t off;
if ((off = spa_pod_builder_push_prop (builder, &f, propid, SPA_POD_PROP_FLAG_READWRITE)) != -1) if ((off = spa_pod_builder_push_prop (builder, &f, propid, SPA_POD_PROP_FLAG_READWRITE)) != -1)
prop = SPA_MEMBER (builder->data, off, SpaPODProp); prop = SPA_MEMBER (builder->data, off, SpaPODProp);

177
spa/include/spa/pod-iter.h Normal file
View file

@ -0,0 +1,177 @@
/* Simple Plugin API
* Copyright (C) 2017 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_POD_ITER_H__
#define __SPA_POD_ITER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#include <spa/defs.h>
#include <spa/pod.h>
typedef struct {
const void *data;
uint32_t size;
uint32_t offset;
} SpaPODIter;
static inline void
spa_pod_iter_contents (SpaPODIter *iter, const void *data, uint32_t size)
{
iter->data = data;
iter->size = size;
iter->offset = 0;
}
static inline bool
spa_pod_iter_struct (SpaPODIter *iter, const void *data, uint32_t size)
{
if (data == NULL || size < 8 || SPA_POD_SIZE (data) > size || SPA_POD_TYPE (data) != SPA_POD_TYPE_STRUCT)
return false;
spa_pod_iter_contents (iter, SPA_POD_CONTENTS (SpaPODStruct, data),
SPA_POD_CONTENTS_SIZE (SpaPODStruct, data));
return true;
}
static inline bool
spa_pod_iter_object (SpaPODIter *iter, const void *data, uint32_t size)
{
if (data == NULL || SPA_POD_SIZE (data) > size || SPA_POD_TYPE (data) != SPA_POD_TYPE_OBJECT)
return false;
spa_pod_iter_contents (iter, SPA_POD_CONTENTS (SpaPODObject, data),
SPA_POD_CONTENTS_SIZE (SpaPODObject, data));
return true;
}
static inline bool
spa_pod_iter_pod (SpaPODIter *iter, SpaPOD *pod)
{
void *data;
uint32_t size;
switch (SPA_POD_TYPE (pod)) {
case SPA_POD_TYPE_STRUCT:
data = SPA_POD_CONTENTS (SpaPODStruct, pod);
size = SPA_POD_CONTENTS_SIZE (SpaPODStruct, pod);
break;
case SPA_POD_TYPE_OBJECT:
data = SPA_POD_CONTENTS (SpaPODObject, pod);
size = SPA_POD_CONTENTS_SIZE (SpaPODObject, pod);
break;
default:
return false;
}
spa_pod_iter_contents (iter, data, size);
return true;
}
static inline bool
spa_pod_iter_has_next (SpaPODIter *iter)
{
return (iter->offset + 8 <= iter->size &&
SPA_POD_SIZE (SPA_MEMBER (iter->data, iter->offset, SpaPOD)) <= iter->size);
}
static inline SpaPOD *
spa_pod_iter_next (SpaPODIter *iter)
{
SpaPOD *res = SPA_MEMBER (iter->data, iter->offset, SpaPOD);
iter->offset += SPA_ROUND_UP_N (SPA_POD_SIZE (res), 8);
return res;
}
static inline bool
spa_pod_iter_getv (SpaPODIter *iter,
uint32_t type,
va_list args)
{
while (type && spa_pod_iter_has_next (iter)) {
SpaPOD *pod = spa_pod_iter_next (iter);
if (pod->type != type)
return false;
switch (type) {
case SPA_POD_TYPE_BOOL:
case SPA_POD_TYPE_URI:
case SPA_POD_TYPE_INT:
*(va_arg (args, int32_t*)) = ((SpaPODInt *)(pod))->value;
break;
case SPA_POD_TYPE_LONG:
*(va_arg (args, int64_t*)) = ((SpaPODLong *)(pod))->value;
break;
case SPA_POD_TYPE_FLOAT:
*(va_arg (args, float*)) = ((SpaPODFloat *)(pod))->value;
break;
case SPA_POD_TYPE_DOUBLE:
*(va_arg (args, double*)) = ((SpaPODDouble *)(pod))->value;
break;
case SPA_POD_TYPE_STRING:
*(va_arg (args, char **)) = SPA_POD_CONTENTS (SpaPODString, pod);
break;
case SPA_POD_TYPE_RECTANGLE:
*(va_arg (args, SpaRectangle *)) = ((SpaPODRectangle *)(pod))->value;
break;
case SPA_POD_TYPE_FRACTION:
*(va_arg (args, SpaFraction *)) = ((SpaPODFraction *)(pod))->value;
break;
case SPA_POD_TYPE_BITMASK:
*(va_arg (args, uint32_t **)) = SPA_POD_CONTENTS (SpaPOD, pod);
break;
case SPA_POD_TYPE_ARRAY:
case SPA_POD_TYPE_STRUCT:
case SPA_POD_TYPE_OBJECT:
case SPA_POD_TYPE_PROP:
*(va_arg (args, SpaPOD **)) = pod;
break;
case SPA_POD_TYPE_BYTES:
*(va_arg (args, void **)) = SPA_POD_CONTENTS (SpaPODBytes, pod);
*(va_arg (args, uint32_t *)) = SPA_POD_BODY_SIZE (pod);
break;
default:
case SPA_POD_TYPE_INVALID:
return false;
}
type = va_arg (args, uint32_t);
}
return true;
}
static inline bool
spa_pod_iter_get (SpaPODIter *iter, uint32_t type, ...)
{
va_list args;
bool res;
va_start (args, type);
res = spa_pod_iter_getv (iter, type, args);
va_end (args);
return res;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_POD_H__ */

View file

@ -57,6 +57,7 @@ typedef struct {
} SpaPOD; } SpaPOD;
#define SPA_POD_BODY_SIZE(pod) (((SpaPOD*)(pod))->size) #define SPA_POD_BODY_SIZE(pod) (((SpaPOD*)(pod))->size)
#define SPA_POD_TYPE(pod) (((SpaPOD*)(pod))->type)
#define SPA_POD_SIZE(pod) (sizeof(SpaPOD) + SPA_POD_BODY_SIZE(pod)) #define SPA_POD_SIZE(pod) (sizeof(SpaPOD) + SPA_POD_BODY_SIZE(pod))
#define SPA_POD_CONTENTS_SIZE(type,pod) (SPA_POD_SIZE(pod)-sizeof(type)) #define SPA_POD_CONTENTS_SIZE(type,pod) (SPA_POD_SIZE(pod)-sizeof(type))
@ -228,10 +229,10 @@ spa_pod_get_bytes (SpaPOD **pod, const void **val, uint32_t *size)
} }
#define SPA_POD_ARRAY_BODY_FOREACH(body, size, iter) \ #define SPA_POD_ARRAY_BODY_FOREACH(body, _size, iter) \
for ((iter) = SPA_MEMBER (body, sizeof(SpaPODArrayBody), __typeof__(*iter)); \ for ((iter) = SPA_MEMBER ((body), sizeof(SpaPODArrayBody), __typeof__(*(iter))); \
(iter) < SPA_MEMBER (body, (size), __typeof__(*iter)); \ (iter) < SPA_MEMBER ((body), (_size), __typeof__(*(iter))); \
(iter) = SPA_MEMBER ((iter), (body)->child.size, __typeof__(*iter))) (iter) = SPA_MEMBER ((iter), (body)->child.size, __typeof__(*(iter))))
#define SPA_POD_FOREACH(pod, size, iter) \ #define SPA_POD_FOREACH(pod, size, iter) \
for ((iter) = (pod); \ for ((iter) = (pod); \
@ -255,7 +256,7 @@ spa_pod_get_bytes (SpaPOD **pod, const void **val, uint32_t *size)
(iter) = SPA_MEMBER ((iter), (body)->value.size, __typeof__(*iter))) (iter) = SPA_MEMBER ((iter), (body)->value.size, __typeof__(*iter)))
static inline SpaPODProp * static inline SpaPODProp *
spa_pod_contents_find_prop (const SpaPOD *pod, off_t offset, uint32_t key) spa_pod_contents_find_prop (const SpaPOD *pod, uint32_t offset, uint32_t key)
{ {
SpaPOD *res; SpaPOD *res;
SPA_POD_CONTENTS_FOREACH (pod, offset, res) { SPA_POD_CONTENTS_FOREACH (pod, offset, res) {

View file

@ -53,13 +53,13 @@ typedef enum {
struct _SpaAllocParam { struct _SpaAllocParam {
uint32_t type; uint32_t type;
size_t size; uint32_t size;
}; };
typedef struct { typedef struct {
SpaAllocParam param; SpaAllocParam param;
size_t minsize; uint32_t minsize;
size_t stride; int32_t stride;
uint32_t min_buffers; uint32_t min_buffers;
uint32_t max_buffers; uint32_t max_buffers;
uint32_t align; uint32_t align;
@ -73,19 +73,19 @@ typedef struct {
typedef struct { typedef struct {
SpaAllocParam param; SpaAllocParam param;
SpaMetaType type; SpaMetaType type;
size_t minsize; uint32_t minsize;
size_t stride; int32_t stride;
size_t blocks; uint32_t blocks;
uint32_t align; uint32_t align;
} SpaAllocParamMetaEnableRingbuffer; } SpaAllocParamMetaEnableRingbuffer;
typedef struct { typedef struct {
SpaAllocParam param; SpaAllocParam param;
unsigned int padding_top; uint32_t padding_top;
unsigned int padding_bottom; uint32_t padding_bottom;
unsigned int padding_left; uint32_t padding_left;
unsigned int padding_right; uint32_t padding_right;
unsigned int stride_align[4]; uint32_t stride_align[4];
} SpaAllocParamVideoPadding; } SpaAllocParamVideoPadding;
/** /**
@ -128,7 +128,7 @@ typedef struct {
uint64_t maxbuffering; uint64_t maxbuffering;
uint64_t latency; uint64_t latency;
SpaAllocParam **params; SpaAllocParam **params;
unsigned int n_params; uint32_t n_params;
SpaDict *extra; SpaDict *extra;
} SpaPortInfo; } SpaPortInfo;

View file

@ -33,20 +33,20 @@ typedef SpaPODObject SpaProps;
#define SPA_PROPS_PREFIX SPA_PROPS_URI "#" #define SPA_PROPS_PREFIX SPA_PROPS_URI "#"
static inline off_t static inline uint32_t
spa_pod_builder_push_props (SpaPODBuilder *builder, spa_pod_builder_push_props (SpaPODBuilder *builder,
SpaPODFrame *frame) SpaPODFrame *frame)
{ {
return spa_pod_builder_push_object (builder, frame, 0, 0); return spa_pod_builder_push_object (builder, frame, 0, 0);
} }
static inline off_t static inline uint32_t
spa_pod_builder_props (SpaPODBuilder *builder, spa_pod_builder_props (SpaPODBuilder *builder,
uint32_t propid, ...) uint32_t propid, ...)
{ {
SpaPODFrame f; SpaPODFrame f;
va_list args; va_list args;
off_t off; uint32_t off;
off = spa_pod_builder_push_props (builder, &f); off = spa_pod_builder_push_props (builder, &f);

View file

@ -35,8 +35,8 @@ typedef struct _SpaRingbuffer SpaRingbuffer;
#include <spa/barrier.h> #include <spa/barrier.h>
typedef struct { typedef struct {
off_t offset; uint32_t offset;
size_t len; uint32_t len;
} SpaRingbufferArea; } SpaRingbufferArea;
/** /**
@ -47,11 +47,11 @@ typedef struct {
* @size_mask: mask if @size is power of 2 * @size_mask: mask if @size is power of 2
*/ */
struct _SpaRingbuffer { struct _SpaRingbuffer {
volatile size_t readindex; volatile uint32_t readindex;
volatile size_t writeindex; volatile uint32_t writeindex;
size_t size; uint32_t size;
size_t mask; uint32_t mask;
size_t mask2; uint32_t mask2;
}; };
/** /**
@ -67,7 +67,7 @@ struct _SpaRingbuffer {
*/ */
static inline SpaResult static inline SpaResult
spa_ringbuffer_init (SpaRingbuffer *rbuf, spa_ringbuffer_init (SpaRingbuffer *rbuf,
size_t size) uint32_t size)
{ {
if (SPA_UNLIKELY ((size & (size - 1)) != 0)) if (SPA_UNLIKELY ((size & (size - 1)) != 0))
return SPA_RESULT_ERROR; return SPA_RESULT_ERROR;
@ -94,11 +94,11 @@ spa_ringbuffer_clear (SpaRingbuffer *rbuf)
rbuf->writeindex = 0; rbuf->writeindex = 0;
} }
static inline size_t static inline uint32_t
spa_ringbuffer_get_read_offset (SpaRingbuffer *rbuf, spa_ringbuffer_get_read_offset (SpaRingbuffer *rbuf,
size_t *offset) uint32_t *offset)
{ {
size_t avail, r; uint32_t avail, r;
r = rbuf->readindex; r = rbuf->readindex;
*offset = r & rbuf->mask; *offset = r & rbuf->mask;
@ -117,11 +117,11 @@ spa_ringbuffer_get_read_offset (SpaRingbuffer *rbuf,
* Fill @areas with pointers to read from. The total amount of * Fill @areas with pointers to read from. The total amount of
* bytes that can be read can be obtained by summing the areas len fields. * bytes that can be read can be obtained by summing the areas len fields.
*/ */
static inline size_t static inline uint32_t
spa_ringbuffer_get_read_areas (SpaRingbuffer *rbuf, spa_ringbuffer_get_read_areas (SpaRingbuffer *rbuf,
SpaRingbufferArea areas[2]) SpaRingbufferArea areas[2])
{ {
size_t avail, end, r; uint32_t avail, end, r;
avail = spa_ringbuffer_get_read_offset (rbuf, &r); avail = spa_ringbuffer_get_read_offset (rbuf, &r);
end = r + avail; end = r + avail;
@ -144,7 +144,7 @@ spa_ringbuffer_read_data (SpaRingbuffer *rbuf,
void *buffer, void *buffer,
SpaRingbufferArea areas[2], SpaRingbufferArea areas[2],
void *data, void *data,
size_t size) uint32_t size)
{ {
if (SPA_LIKELY (size < areas[0].len)) if (SPA_LIKELY (size < areas[0].len))
memcpy (data, buffer + areas[0].offset, size); memcpy (data, buffer + areas[0].offset, size);
@ -163,17 +163,17 @@ spa_ringbuffer_read_data (SpaRingbuffer *rbuf,
*/ */
static inline void static inline void
spa_ringbuffer_read_advance (SpaRingbuffer *rbuf, spa_ringbuffer_read_advance (SpaRingbuffer *rbuf,
ssize_t len) int32_t len)
{ {
spa_barrier_full(); spa_barrier_full();
rbuf->readindex = (rbuf->readindex + len) & rbuf->mask2; rbuf->readindex = (rbuf->readindex + len) & rbuf->mask2;
} }
static inline size_t static inline uint32_t
spa_ringbuffer_get_write_offset (SpaRingbuffer *rbuf, spa_ringbuffer_get_write_offset (SpaRingbuffer *rbuf,
size_t *offset) uint32_t *offset)
{ {
size_t avail, w; uint32_t avail, w;
w = rbuf->writeindex; w = rbuf->writeindex;
*offset = w & rbuf->mask; *offset = w & rbuf->mask;
@ -191,11 +191,11 @@ spa_ringbuffer_get_write_offset (SpaRingbuffer *rbuf,
* Fill @areas with pointers to write to. The total amount of * Fill @areas with pointers to write to. The total amount of
* bytes that can be written can be obtained by summing the areas len fields. * bytes that can be written can be obtained by summing the areas len fields.
*/ */
static inline size_t static inline uint32_t
spa_ringbuffer_get_write_areas (SpaRingbuffer *rbuf, spa_ringbuffer_get_write_areas (SpaRingbuffer *rbuf,
SpaRingbufferArea areas[2]) SpaRingbufferArea areas[2])
{ {
size_t avail, end, w; uint32_t avail, end, w;
avail = spa_ringbuffer_get_write_offset (rbuf, &w); avail = spa_ringbuffer_get_write_offset (rbuf, &w);
end = w + avail; end = w + avail;
@ -218,7 +218,7 @@ spa_ringbuffer_write_data (SpaRingbuffer *rbuf,
void *buffer, void *buffer,
SpaRingbufferArea areas[2], SpaRingbufferArea areas[2],
void *data, void *data,
size_t size) uint32_t size)
{ {
if (SPA_LIKELY (size < areas[0].len)) if (SPA_LIKELY (size < areas[0].len))
memcpy (buffer + areas[0].offset, data, size); memcpy (buffer + areas[0].offset, data, size);
@ -238,7 +238,7 @@ spa_ringbuffer_write_data (SpaRingbuffer *rbuf,
*/ */
static inline void static inline void
spa_ringbuffer_write_advance (SpaRingbuffer *rbuf, spa_ringbuffer_write_advance (SpaRingbuffer *rbuf,
ssize_t len) int32_t len)
{ {
spa_barrier_write(); spa_barrier_write();
rbuf->writeindex = (rbuf->writeindex + len) & rbuf->mask2; rbuf->writeindex = (rbuf->writeindex + len) & rbuf->mask2;

View file

@ -171,7 +171,7 @@ struct _SpaVideoInfoRaw {
SpaRectangle size; SpaRectangle size;
SpaFraction framerate; SpaFraction framerate;
SpaFraction max_framerate; SpaFraction max_framerate;
unsigned int views; uint32_t views;
SpaVideoInterlaceMode interlace_mode; SpaVideoInterlaceMode interlace_mode;
SpaFraction pixel_aspect_ratio; SpaFraction pixel_aspect_ratio;
SpaVideoMultiviewMode multiview_mode; SpaVideoMultiviewMode multiview_mode;

View file

@ -61,7 +61,7 @@ spa_debug_port_info (const SpaPortInfo *info)
fprintf (stderr, " n_params: \t%d\n", info->n_params); fprintf (stderr, " n_params: \t%d\n", info->n_params);
for (i = 0; i < info->n_params; i++) { for (i = 0; i < info->n_params; i++) {
SpaAllocParam *param = info->params[i]; SpaAllocParam *param = info->params[i];
fprintf (stderr, " param %d, type %d, size %zd:\n", i, param->type, param->size); fprintf (stderr, " param %d, type %d, size %u:\n", i, param->type, param->size);
switch (param->type) { switch (param->type) {
case SPA_ALLOC_PARAM_TYPE_INVALID: case SPA_ALLOC_PARAM_TYPE_INVALID:
fprintf (stderr, " INVALID\n"); fprintf (stderr, " INVALID\n");
@ -70,8 +70,8 @@ spa_debug_port_info (const SpaPortInfo *info)
{ {
SpaAllocParamBuffers *p = (SpaAllocParamBuffers *)param; SpaAllocParamBuffers *p = (SpaAllocParamBuffers *)param;
fprintf (stderr, " SpaAllocParamBuffers:\n"); fprintf (stderr, " SpaAllocParamBuffers:\n");
fprintf (stderr, " minsize: \t\t%zd\n", p->minsize); fprintf (stderr, " minsize: \t\t%d\n", p->minsize);
fprintf (stderr, " stride: \t\t%zd\n", p->stride); fprintf (stderr, " stride: \t\t%d\n", p->stride);
fprintf (stderr, " min_buffers: \t%d\n", p->min_buffers); fprintf (stderr, " min_buffers: \t%d\n", p->min_buffers);
fprintf (stderr, " max_buffers: \t%d\n", p->max_buffers); fprintf (stderr, " max_buffers: \t%d\n", p->max_buffers);
fprintf (stderr, " align: \t\t%d\n", p->align); fprintf (stderr, " align: \t\t%d\n", p->align);
@ -86,9 +86,9 @@ spa_debug_port_info (const SpaPortInfo *info)
case SPA_META_TYPE_RINGBUFFER: case SPA_META_TYPE_RINGBUFFER:
{ {
SpaAllocParamMetaEnableRingbuffer *rb = (SpaAllocParamMetaEnableRingbuffer *)p; SpaAllocParamMetaEnableRingbuffer *rb = (SpaAllocParamMetaEnableRingbuffer *)p;
fprintf (stderr, " minsize: \t\t%zd\n", rb->minsize); fprintf (stderr, " minsize: \t\t%d\n", rb->minsize);
fprintf (stderr, " stride: \t\t%zd\n", rb->stride); fprintf (stderr, " stride: \t\t%d\n", rb->stride);
fprintf (stderr, " blocks: \t\t%zd\n", rb->blocks); fprintf (stderr, " blocks: \t\t%d\n", rb->blocks);
fprintf (stderr, " align: \t\t%d\n", rb->align); fprintf (stderr, " align: \t\t%d\n", rb->align);
break; break;
} }
@ -130,7 +130,7 @@ spa_debug_buffer (const SpaBuffer *buffer)
fprintf (stderr, " n_metas: %u (at %p)\n", buffer->n_metas, buffer->metas); fprintf (stderr, " n_metas: %u (at %p)\n", buffer->n_metas, buffer->metas);
for (i = 0; i < buffer->n_metas; i++) { for (i = 0; i < buffer->n_metas; i++) {
SpaMeta *m = &buffer->metas[i]; SpaMeta *m = &buffer->metas[i];
fprintf (stderr, " meta %d: type %d (%s), data %p, size %zd:\n", i, m->type, META_TYPE_NAME (m->type), m->data, m->size); fprintf (stderr, " meta %d: type %d (%s), data %p, size %d:\n", i, m->type, META_TYPE_NAME (m->type), m->data, m->size);
switch (m->type) { switch (m->type) {
case SPA_META_TYPE_HEADER: case SPA_META_TYPE_HEADER:
{ {
@ -165,11 +165,11 @@ spa_debug_buffer (const SpaBuffer *buffer)
{ {
SpaMetaRingbuffer *h = m->data; SpaMetaRingbuffer *h = m->data;
fprintf (stderr, " SpaMetaRingbuffer:\n"); fprintf (stderr, " SpaMetaRingbuffer:\n");
fprintf (stderr, " readindex: %zd\n", h->ringbuffer.readindex); fprintf (stderr, " readindex: %d\n", h->ringbuffer.readindex);
fprintf (stderr, " writeindex: %zd\n", h->ringbuffer.writeindex); fprintf (stderr, " writeindex: %d\n", h->ringbuffer.writeindex);
fprintf (stderr, " size: %zd\n", h->ringbuffer.size); fprintf (stderr, " size: %d\n", h->ringbuffer.size);
fprintf (stderr, " mask: %zd\n", h->ringbuffer.mask); fprintf (stderr, " mask: %d\n", h->ringbuffer.mask);
fprintf (stderr, " mask2: %zd\n", h->ringbuffer.mask2); fprintf (stderr, " mask2: %d\n", h->ringbuffer.mask2);
break; break;
} }
case SPA_META_TYPE_SHARED: case SPA_META_TYPE_SHARED:
@ -179,8 +179,8 @@ spa_debug_buffer (const SpaBuffer *buffer)
fprintf (stderr, " type: %d\n", h->type); fprintf (stderr, " type: %d\n", h->type);
fprintf (stderr, " flags: %d\n", h->flags); fprintf (stderr, " flags: %d\n", h->flags);
fprintf (stderr, " fd: %d\n", h->fd); fprintf (stderr, " fd: %d\n", h->fd);
fprintf (stderr, " offset: %zd\n", h->offset); fprintf (stderr, " offset: %d\n", h->offset);
fprintf (stderr, " size: %zd\n", h->size); fprintf (stderr, " size: %d\n", h->size);
break; break;
} }
default: default:
@ -195,12 +195,12 @@ spa_debug_buffer (const SpaBuffer *buffer)
fprintf (stderr, " flags: %d\n", d->flags); fprintf (stderr, " flags: %d\n", d->flags);
fprintf (stderr, " data: %p\n", d->data); fprintf (stderr, " data: %p\n", d->data);
fprintf (stderr, " fd: %d\n", d->fd); fprintf (stderr, " fd: %d\n", d->fd);
fprintf (stderr, " offset: %zd\n", d->mapoffset); fprintf (stderr, " offset: %d\n", d->mapoffset);
fprintf (stderr, " maxsize: %zu\n", d->maxsize); fprintf (stderr, " maxsize: %u\n", d->maxsize);
fprintf (stderr, " chunk: %p\n", d->chunk); fprintf (stderr, " chunk: %p\n", d->chunk);
fprintf (stderr, " offset: %zd\n", d->chunk->offset); fprintf (stderr, " offset: %d\n", d->chunk->offset);
fprintf (stderr, " size: %zu\n", d->chunk->size); fprintf (stderr, " size: %u\n", d->chunk->size);
fprintf (stderr, " stride: %zd\n", d->chunk->stride); fprintf (stderr, " stride: %d\n", d->chunk->stride);
} }
return SPA_RESULT_OK; return SPA_RESULT_OK;
} }

View file

@ -24,89 +24,6 @@
#include <spa/props.h> #include <spa/props.h>
#if 0
SpaResult
spa_props_set_value (SpaProps *props,
unsigned int index,
const SpaPropValue *value)
{
const SpaPropInfo *info;
if (props == NULL || value == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
if (index >= props->n_prop_info)
return SPA_RESULT_INVALID_PROPERTY_INDEX;
info = &props->prop_info[index];
if ((info->flags & SPA_PROP_FLAG_WRITABLE) == 0)
return SPA_RESULT_INVALID_PROPERTY_ACCESS;
if (info->maxsize < value->size)
return SPA_RESULT_WRONG_PROPERTY_SIZE;
memcpy (SPA_MEMBER (props, info->offset, void), value->value, value->size);
SPA_PROPS_INDEX_SET (props, index);
return SPA_RESULT_OK;
}
SpaResult
spa_props_get_value (const SpaProps *props,
unsigned int index,
SpaPropValue *value)
{
const SpaPropInfo *info;
if (props == NULL || value == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
if (index >= props->n_prop_info)
return SPA_RESULT_INVALID_PROPERTY_INDEX;
info = &props->prop_info[index];
if ((info->flags & SPA_PROP_FLAG_READABLE) == 0)
return SPA_RESULT_INVALID_PROPERTY_ACCESS;
if (SPA_PROPS_INDEX_IS_UNSET (props, index))
return SPA_RESULT_PROPERTY_UNSET;
value->size = info->maxsize;
value->value = SPA_MEMBER (props, info->offset, void);
return SPA_RESULT_OK;
}
SpaResult
spa_props_copy_values (const SpaProps *src,
SpaProps *dest)
{
int i;
if (src == dest)
return SPA_RESULT_OK;
for (i = 0; i < dest->n_prop_info; i++) {
const SpaPropInfo *dinfo = &dest->prop_info[i];
const SpaPropInfo *sinfo;
unsigned int idx;
if (!(dinfo->flags & SPA_PROP_FLAG_WRITABLE))
continue;
if ((idx = spa_props_index_for_id (src, dinfo->id)) == SPA_IDX_INVALID)
continue;
sinfo = &src->prop_info[idx];
if (sinfo->maxsize > dinfo->maxsize)
return SPA_RESULT_WRONG_PROPERTY_SIZE;
memcpy (SPA_MEMBER (dest, dinfo->offset, void), SPA_MEMBER (src, sinfo->offset, void), sinfo->maxsize);
if (!SPA_PROPS_INDEX_IS_UNSET (src, idx))
SPA_PROPS_INDEX_SET (dest, i);
}
return SPA_RESULT_OK;
}
#endif
static int static int
compare_value (SpaPODType type, const void *r1, const void *r2) compare_value (SpaPODType type, const void *r1, const void *r2)
{ {

View file

@ -64,7 +64,7 @@ struct _SpaALSAMonitor {
struct udev* udev; struct udev* udev;
struct udev_monitor *umonitor; struct udev_monitor *umonitor;
struct udev_enumerate *enumerate; struct udev_enumerate *enumerate;
unsigned int index; uint32_t index;
struct udev_list_entry *devices; struct udev_list_entry *devices;
ALSAItem uitem; ALSAItem uitem;
@ -107,7 +107,7 @@ static int
fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice) fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice)
{ {
int err; int err;
unsigned int i; uint32_t i;
const char *str; const char *str;
snd_pcm_t *hndl; snd_pcm_t *hndl;
char device[64]; char device[64];
@ -319,7 +319,7 @@ spa_alsa_monitor_set_event_callback (SpaMonitor *monitor,
static SpaResult static SpaResult
spa_alsa_monitor_enum_items (SpaMonitor *monitor, spa_alsa_monitor_enum_items (SpaMonitor *monitor,
SpaMonitorItem **item, SpaMonitorItem **item,
unsigned int index) uint32_t index)
{ {
SpaResult res; SpaResult res;
SpaALSAMonitor *this; SpaALSAMonitor *this;
@ -407,10 +407,10 @@ alsa_monitor_init (const SpaHandleFactory *factory,
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
SpaALSAMonitor *this; SpaALSAMonitor *this;
unsigned int i; uint32_t i;
if (factory == NULL || handle == NULL) if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -451,7 +451,7 @@ static const SpaInterfaceInfo alsa_monitor_interfaces[] =
static SpaResult static SpaResult
alsa_monitor_enum_interface_info (const SpaHandleFactory *factory, alsa_monitor_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info, const SpaInterfaceInfo **info,
unsigned int index) uint32_t index)
{ {
if (factory == NULL || info == NULL) if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -263,10 +263,10 @@ spa_alsa_sink_node_set_event_callback (SpaNode *node,
static SpaResult static SpaResult
spa_alsa_sink_node_get_n_ports (SpaNode *node, spa_alsa_sink_node_get_n_ports (SpaNode *node,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -285,9 +285,9 @@ spa_alsa_sink_node_get_n_ports (SpaNode *node,
static SpaResult static SpaResult
spa_alsa_sink_node_get_port_ids (SpaNode *node, spa_alsa_sink_node_get_port_ids (SpaNode *node,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
if (node == NULL) if (node == NULL)
@ -322,7 +322,7 @@ spa_alsa_sink_node_port_enum_formats (SpaNode *node,
uint32_t port_id, uint32_t port_id,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index) uint32_t index)
{ {
SpaALSASink *this; SpaALSASink *this;
SpaResult res; SpaResult res;
@ -795,10 +795,10 @@ alsa_sink_init (const SpaHandleFactory *factory,
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
SpaALSASink *this; SpaALSASink *this;
unsigned int i; uint32_t i;
if (factory == NULL || handle == NULL) if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -849,7 +849,7 @@ static const SpaInterfaceInfo alsa_sink_interfaces[] =
static SpaResult static SpaResult
alsa_sink_enum_interface_info (const SpaHandleFactory *factory, alsa_sink_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info, const SpaInterfaceInfo **info,
unsigned int index) uint32_t index)
{ {
if (factory == NULL || info == NULL) if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -298,10 +298,10 @@ spa_alsa_source_node_set_event_callback (SpaNode *node,
static SpaResult static SpaResult
spa_alsa_source_node_get_n_ports (SpaNode *node, spa_alsa_source_node_get_n_ports (SpaNode *node,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -320,9 +320,9 @@ spa_alsa_source_node_get_n_ports (SpaNode *node,
static SpaResult static SpaResult
spa_alsa_source_node_get_port_ids (SpaNode *node, spa_alsa_source_node_get_port_ids (SpaNode *node,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
if (node == NULL) if (node == NULL)
@ -357,7 +357,7 @@ spa_alsa_source_node_port_enum_formats (SpaNode *node,
uint32_t port_id, uint32_t port_id,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index) uint32_t index)
{ {
SpaALSASource *this; SpaALSASource *this;
SpaResult res; SpaResult res;
@ -859,10 +859,10 @@ alsa_source_init (const SpaHandleFactory *factory,
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
SpaALSASource *this; SpaALSASource *this;
unsigned int i; uint32_t i;
if (factory == NULL || handle == NULL) if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -917,7 +917,7 @@ static const SpaInterfaceInfo alsa_source_interfaces[] =
static SpaResult static SpaResult
alsa_source_enum_interface_info (const SpaHandleFactory *factory, alsa_source_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info, const SpaInterfaceInfo **info,
unsigned int index) uint32_t index)
{ {
if (factory == NULL || info == NULL) if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -339,7 +339,7 @@ pull_frames_ringbuffer (SpaALSAState *state,
avail = spa_ringbuffer_get_read_areas (&b->rb->ringbuffer, areas); avail = spa_ringbuffer_get_read_areas (&b->rb->ringbuffer, areas);
size = SPA_MIN (avail, frames * state->frame_size); size = SPA_MIN (avail, frames * state->frame_size);
spa_log_debug (state->log, "%zd %zd %zd %zd %zd %zd", spa_log_debug (state->log, "%u %u %u %u %zd %zd",
areas[0].offset, areas[0].len, areas[0].offset, areas[0].len,
areas[1].offset, areas[1].len, offset, size); areas[1].offset, areas[1].len, offset, size);

View file

@ -26,7 +26,7 @@ extern const SpaHandleFactory spa_alsa_monitor_factory;
SpaResult SpaResult
spa_enum_handle_factory (const SpaHandleFactory **factory, spa_enum_handle_factory (const SpaHandleFactory **factory,
unsigned int index) uint32_t index)
{ {
if (factory == NULL) if (factory == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -51,7 +51,7 @@ typedef struct {
MixerBuffer mix; MixerBuffer mix;
SpaBuffer **buffers; SpaBuffer **buffers;
unsigned int n_buffers; uint32_t n_buffers;
SpaBuffer *buffer; SpaBuffer *buffer;
void *io; void *io;
} SpaAudioMixerPort; } SpaAudioMixerPort;
@ -158,10 +158,10 @@ spa_audiomixer_node_set_event_callback (SpaNode *node,
static SpaResult static SpaResult
spa_audiomixer_node_get_n_ports (SpaNode *node, spa_audiomixer_node_get_n_ports (SpaNode *node,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -180,9 +180,9 @@ spa_audiomixer_node_get_n_ports (SpaNode *node,
static SpaResult static SpaResult
spa_audiomixer_node_get_port_ids (SpaNode *node, spa_audiomixer_node_get_port_ids (SpaNode *node,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
SpaAudioMixer *this; SpaAudioMixer *this;
@ -264,7 +264,7 @@ spa_audiomixer_node_port_enum_formats (SpaNode *node,
uint32_t port_id, uint32_t port_id,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index) uint32_t index)
{ {
SpaAudioMixer *this; SpaAudioMixer *this;
@ -472,7 +472,7 @@ static SpaResult
spa_audiomixer_node_process_input (SpaNode *node) spa_audiomixer_node_process_input (SpaNode *node)
{ {
SpaAudioMixer *this; SpaAudioMixer *this;
unsigned int i; uint32_t i;
bool have_error = false; bool have_error = false;
SpaPortOutput *output; SpaPortOutput *output;
@ -679,10 +679,10 @@ spa_audiomixer_init (const SpaHandleFactory *factory,
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
SpaAudioMixer *this; SpaAudioMixer *this;
unsigned int i; uint32_t i;
if (factory == NULL || handle == NULL) if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -721,7 +721,7 @@ static const SpaInterfaceInfo audiomixer_interfaces[] =
static SpaResult static SpaResult
audiomixer_enum_interface_info (const SpaHandleFactory *factory, audiomixer_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info, const SpaInterfaceInfo **info,
unsigned int index) uint32_t index)
{ {
if (factory == NULL || info == NULL) if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -24,7 +24,7 @@ extern const SpaHandleFactory spa_audiomixer_factory;
SpaResult SpaResult
spa_enum_handle_factory (const SpaHandleFactory **factory, spa_enum_handle_factory (const SpaHandleFactory **factory,
unsigned int index) uint32_t index)
{ {
if (factory == NULL) if (factory == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -94,7 +94,7 @@ struct _SpaAudioTestSrc {
size_t bpf; size_t bpf;
ATSBuffer buffers[MAX_BUFFERS]; ATSBuffer buffers[MAX_BUFFERS];
unsigned int n_buffers; uint32_t n_buffers;
bool started; bool started;
uint64_t start_time; uint64_t start_time;
@ -397,10 +397,10 @@ spa_audiotestsrc_node_set_event_callback (SpaNode *node,
static SpaResult static SpaResult
spa_audiotestsrc_node_get_n_ports (SpaNode *node, spa_audiotestsrc_node_get_n_ports (SpaNode *node,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -419,9 +419,9 @@ spa_audiotestsrc_node_get_n_ports (SpaNode *node,
static SpaResult static SpaResult
spa_audiotestsrc_node_get_port_ids (SpaNode *node, spa_audiotestsrc_node_get_port_ids (SpaNode *node,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
if (node == NULL) if (node == NULL)
@ -455,7 +455,7 @@ spa_audiotestsrc_node_port_enum_formats (SpaNode *node,
uint32_t port_id, uint32_t port_id,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index) uint32_t index)
{ {
SpaAudioTestSrc *this; SpaAudioTestSrc *this;
SpaResult res; SpaResult res;
@ -664,7 +664,7 @@ spa_audiotestsrc_node_port_use_buffers (SpaNode *node,
uint32_t n_buffers) uint32_t n_buffers)
{ {
SpaAudioTestSrc *this; SpaAudioTestSrc *this;
unsigned int i; uint32_t i;
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -943,10 +943,10 @@ audiotestsrc_init (const SpaHandleFactory *factory,
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
SpaAudioTestSrc *this; SpaAudioTestSrc *this;
unsigned int i; uint32_t i;
if (factory == NULL || handle == NULL) if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -1010,7 +1010,7 @@ static const SpaInterfaceInfo audiotestsrc_interfaces[] =
static SpaResult static SpaResult
audiotestsrc_enum_interface_info (const SpaHandleFactory *factory, audiotestsrc_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info, const SpaInterfaceInfo **info,
unsigned int index) uint32_t index)
{ {
if (factory == NULL || info == NULL) if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -24,7 +24,7 @@ extern const SpaHandleFactory spa_audiotestsrc_factory;
SpaResult SpaResult
spa_enum_handle_factory (const SpaHandleFactory **factory, spa_enum_handle_factory (const SpaHandleFactory **factory,
unsigned int index) uint32_t index)
{ {
if (factory == NULL) if (factory == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -147,10 +147,10 @@ spa_ffmpeg_dec_node_set_event_callback (SpaNode *node,
static SpaResult static SpaResult
spa_ffmpeg_dec_node_get_n_ports (SpaNode *node, spa_ffmpeg_dec_node_get_n_ports (SpaNode *node,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -169,9 +169,9 @@ spa_ffmpeg_dec_node_get_n_ports (SpaNode *node,
static SpaResult static SpaResult
spa_ffmpeg_dec_node_get_port_ids (SpaNode *node, spa_ffmpeg_dec_node_get_port_ids (SpaNode *node,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
if (node == NULL) if (node == NULL)
@ -208,10 +208,9 @@ spa_ffmpeg_dec_node_port_enum_formats (SpaNode *node,
uint32_t port_id, uint32_t port_id,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index) uint32_t index)
{ {
SpaFFMpegDec *this; SpaFFMpegDec *this;
SpaFFMpegPort *port;
if (node == NULL || format == NULL) if (node == NULL || format == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -221,8 +220,6 @@ spa_ffmpeg_dec_node_port_enum_formats (SpaNode *node,
if (!IS_VALID_PORT (this, direction, port_id)) if (!IS_VALID_PORT (this, direction, port_id))
return SPA_RESULT_INVALID_PORT; return SPA_RESULT_INVALID_PORT;
port = direction == SPA_DIRECTION_INPUT ? &this->in_ports[port_id] : &this->out_ports[port_id];
switch (index) { switch (index) {
case 0: case 0:
break; break;
@ -516,10 +513,10 @@ SpaResult
spa_ffmpeg_dec_init (SpaHandle *handle, spa_ffmpeg_dec_init (SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
SpaFFMpegDec *this; SpaFFMpegDec *this;
unsigned int i; uint32_t i;
handle->get_interface = spa_ffmpeg_dec_get_interface; handle->get_interface = spa_ffmpeg_dec_get_interface;

View file

@ -152,10 +152,10 @@ spa_ffmpeg_enc_node_set_event_callback (SpaNode *node,
static SpaResult static SpaResult
spa_ffmpeg_enc_node_get_n_ports (SpaNode *node, spa_ffmpeg_enc_node_get_n_ports (SpaNode *node,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -174,9 +174,9 @@ spa_ffmpeg_enc_node_get_n_ports (SpaNode *node,
static SpaResult static SpaResult
spa_ffmpeg_enc_node_get_port_ids (SpaNode *node, spa_ffmpeg_enc_node_get_port_ids (SpaNode *node,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
if (node == NULL) if (node == NULL)
@ -213,7 +213,7 @@ spa_ffmpeg_enc_node_port_enum_formats (SpaNode *node,
uint32_t port_id, uint32_t port_id,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index) uint32_t index)
{ {
SpaFFMpegEnc *this; SpaFFMpegEnc *this;
SpaFFMpegPort *port; SpaFFMpegPort *port;
@ -524,10 +524,10 @@ SpaResult
spa_ffmpeg_enc_init (SpaHandle *handle, spa_ffmpeg_enc_init (SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
SpaFFMpegEnc *this; SpaFFMpegEnc *this;
unsigned int i; uint32_t i;
handle->get_interface = spa_ffmpeg_enc_get_interface; handle->get_interface = spa_ffmpeg_enc_get_interface;

View file

@ -25,15 +25,15 @@
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
SpaResult spa_ffmpeg_dec_init (SpaHandle *handle, const SpaDict *info, const SpaSupport *support, unsigned int n_support); SpaResult spa_ffmpeg_dec_init (SpaHandle *handle, const SpaDict *info, const SpaSupport *support, uint32_t n_support);
SpaResult spa_ffmpeg_enc_init (SpaHandle *handle, const SpaDict *info, const SpaSupport *support, unsigned int n_support); SpaResult spa_ffmpeg_enc_init (SpaHandle *handle, const SpaDict *info, const SpaSupport *support, uint32_t n_support);
static SpaResult static SpaResult
ffmpeg_dec_init (const SpaHandleFactory *factory, ffmpeg_dec_init (const SpaHandleFactory *factory,
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
if (factory == NULL || handle == NULL) if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -46,7 +46,7 @@ ffmpeg_enc_init (const SpaHandleFactory *factory,
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
if (factory == NULL || handle == NULL) if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -63,7 +63,7 @@ static const SpaInterfaceInfo ffmpeg_interfaces[] =
static SpaResult static SpaResult
ffmpeg_enum_interface_info (const SpaHandleFactory *factory, ffmpeg_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info, const SpaInterfaceInfo **info,
unsigned int index) uint32_t index)
{ {
if (factory == NULL || info == NULL) if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -78,7 +78,7 @@ ffmpeg_enum_interface_info (const SpaHandleFactory *factory,
SpaResult SpaResult
spa_enum_handle_factory (const SpaHandleFactory **factory, spa_enum_handle_factory (const SpaHandleFactory **factory,
unsigned int index) uint32_t index)
{ {
static const AVCodec *c = NULL; static const AVCodec *c = NULL;
static int ci = 0; static int ci = 0;

View file

@ -189,10 +189,10 @@ spa_libva_dec_node_set_event_callback (SpaHandle *handle,
static SpaResult static SpaResult
spa_libva_dec_node_get_n_ports (SpaHandle *handle, spa_libva_dec_node_get_n_ports (SpaHandle *handle,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
if (handle == NULL) if (handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -211,9 +211,9 @@ spa_libva_dec_node_get_n_ports (SpaHandle *handle,
static SpaResult static SpaResult
spa_libva_dec_node_get_port_ids (SpaHandle *handle, spa_libva_dec_node_get_port_ids (SpaHandle *handle,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
if (handle == NULL) if (handle == NULL)
@ -246,7 +246,7 @@ spa_libva_dec_node_remove_port (SpaHandle *handle,
static SpaResult static SpaResult
spa_libva_dec_node_port_enum_formats (SpaHandle *handle, spa_libva_dec_node_port_enum_formats (SpaHandle *handle,
uint32_t port_id, uint32_t port_id,
unsigned int index, uint32_t index,
SpaFormat **format) SpaFormat **format)
{ {
SpaLibvaDec *this = (SpaLibvaDec *) handle; SpaLibvaDec *this = (SpaLibvaDec *) handle;
@ -423,7 +423,7 @@ spa_libva_dec_node_port_alloc_buffers (SpaHandle *handle,
static SpaResult static SpaResult
spa_libva_dec_node_port_push_input (SpaHandle *handle, spa_libva_dec_node_port_push_input (SpaHandle *handle,
unsigned int n_info, uint32_t n_info,
SpaInputInfo *info) SpaInputInfo *info)
{ {
return SPA_RESULT_INVALID_PORT; return SPA_RESULT_INVALID_PORT;
@ -431,12 +431,12 @@ spa_libva_dec_node_port_push_input (SpaHandle *handle,
static SpaResult static SpaResult
spa_libva_dec_node_port_pull_output (SpaHandle *handle, spa_libva_dec_node_port_pull_output (SpaHandle *handle,
unsigned int n_info, uint32_t n_info,
SpaOutputInfo *info) SpaOutputInfo *info)
{ {
SpaLibvaDec *this = (SpaLibvaDec *) handle; SpaLibvaDec *this = (SpaLibvaDec *) handle;
SpaLibvaState *state; SpaLibvaState *state;
unsigned int i; uint32_t i;
bool have_error = false; bool have_error = false;
if (handle == NULL || n_info == 0 || info == NULL) if (handle == NULL || n_info == 0 || info == NULL)

View file

@ -189,10 +189,10 @@ spa_libva_enc_node_set_event_callback (SpaHandle *handle,
static SpaResult static SpaResult
spa_libva_enc_node_get_n_ports (SpaHandle *handle, spa_libva_enc_node_get_n_ports (SpaHandle *handle,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
if (handle == NULL) if (handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -211,9 +211,9 @@ spa_libva_enc_node_get_n_ports (SpaHandle *handle,
static SpaResult static SpaResult
spa_libva_enc_node_get_port_ids (SpaHandle *handle, spa_libva_enc_node_get_port_ids (SpaHandle *handle,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
if (handle == NULL) if (handle == NULL)
@ -246,7 +246,7 @@ spa_libva_enc_node_remove_port (SpaHandle *handle,
static SpaResult static SpaResult
spa_libva_enc_node_port_enum_formats (SpaHandle *handle, spa_libva_enc_node_port_enum_formats (SpaHandle *handle,
uint32_t port_id, uint32_t port_id,
unsigned int index, uint32_t index,
SpaFormat **format) SpaFormat **format)
{ {
SpaLibvaEnc *this = (SpaLibvaEnc *) handle; SpaLibvaEnc *this = (SpaLibvaEnc *) handle;
@ -423,7 +423,7 @@ spa_libva_enc_node_port_alloc_buffers (SpaHandle *handle,
static SpaResult static SpaResult
spa_libva_enc_node_port_push_input (SpaHandle *handle, spa_libva_enc_node_port_push_input (SpaHandle *handle,
unsigned int n_info, uint32_t n_info,
SpaInputInfo *info) SpaInputInfo *info)
{ {
return SPA_RESULT_INVALID_PORT; return SPA_RESULT_INVALID_PORT;
@ -431,12 +431,12 @@ spa_libva_enc_node_port_push_input (SpaHandle *handle,
static SpaResult static SpaResult
spa_libva_enc_node_port_pull_output (SpaHandle *handle, spa_libva_enc_node_port_pull_output (SpaHandle *handle,
unsigned int n_info, uint32_t n_info,
SpaOutputInfo *info) SpaOutputInfo *info)
{ {
SpaLibvaEnc *this = (SpaLibvaEnc *) handle; SpaLibvaEnc *this = (SpaLibvaEnc *) handle;
SpaLibvaState *state; SpaLibvaState *state;
unsigned int i; uint32_t i;
bool have_error = false; bool have_error = false;
if (handle == NULL || n_info == 0 || info == NULL) if (handle == NULL || n_info == 0 || info == NULL)

View file

@ -58,7 +58,7 @@ static const SpaInterfaceInfo libva_interfaces[] =
static SpaResult static SpaResult
libva_enum_interface_info (const SpaHandleFactory *factory, libva_enum_interface_info (const SpaHandleFactory *factory,
unsigned int index, uint32_t index,
const SpaInterfaceInfo **info) const SpaInterfaceInfo **info)
{ {
if (index >= 1) if (index >= 1)
@ -84,7 +84,7 @@ static const SpaHandleFactory factories[] =
}; };
SpaResult SpaResult
spa_enum_handle_factory (unsigned int index, spa_enum_handle_factory (uint32_t index,
const SpaHandleFactory **factory) const SpaHandleFactory **factory)
{ {
if (index >= 2) if (index >= 2)

View file

@ -61,7 +61,7 @@ struct _SpaV4l2Monitor {
struct udev* udev; struct udev* udev;
struct udev_monitor *umonitor; struct udev_monitor *umonitor;
struct udev_enumerate *enumerate; struct udev_enumerate *enumerate;
unsigned int index; uint32_t index;
struct udev_list_entry *devices; struct udev_list_entry *devices;
V4l2Item uitem; V4l2Item uitem;
@ -83,7 +83,7 @@ v4l2_udev_open (SpaV4l2Monitor *this)
static void static void
fill_item (V4l2Item *item, struct udev_device *udevice) fill_item (V4l2Item *item, struct udev_device *udevice)
{ {
unsigned int i; uint32_t i;
const char *str; const char *str;
if (item->udevice) if (item->udevice)
@ -253,7 +253,7 @@ spa_v4l2_monitor_set_event_callback (SpaMonitor *monitor,
static SpaResult static SpaResult
spa_v4l2_monitor_enum_items (SpaMonitor *monitor, spa_v4l2_monitor_enum_items (SpaMonitor *monitor,
SpaMonitorItem **item, SpaMonitorItem **item,
unsigned int index) uint32_t index)
{ {
SpaResult res; SpaResult res;
SpaV4l2Monitor *this; SpaV4l2Monitor *this;
@ -340,10 +340,10 @@ v4l2_monitor_init (const SpaHandleFactory *factory,
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
SpaV4l2Monitor *this; SpaV4l2Monitor *this;
unsigned int i; uint32_t i;
if (factory == NULL || handle == NULL) if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -384,7 +384,7 @@ static const SpaInterfaceInfo v4l2_monitor_interfaces[] =
static SpaResult static SpaResult
v4l2_monitor_enum_interface_info (const SpaHandleFactory *factory, v4l2_monitor_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info, const SpaInterfaceInfo **info,
unsigned int index) uint32_t index)
{ {
if (factory == NULL || info == NULL) if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -93,7 +93,7 @@ typedef struct {
enum v4l2_memory memtype; enum v4l2_memory memtype;
V4l2Buffer buffers[MAX_BUFFERS]; V4l2Buffer buffers[MAX_BUFFERS];
unsigned int n_buffers; uint32_t n_buffers;
bool source_enabled; bool source_enabled;
SpaSource source; SpaSource source;
@ -415,10 +415,10 @@ spa_v4l2_source_node_set_event_callback (SpaNode *node,
static SpaResult static SpaResult
spa_v4l2_source_node_get_n_ports (SpaNode *node, spa_v4l2_source_node_get_n_ports (SpaNode *node,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -437,9 +437,9 @@ spa_v4l2_source_node_get_n_ports (SpaNode *node,
static SpaResult static SpaResult
spa_v4l2_source_node_get_port_ids (SpaNode *node, spa_v4l2_source_node_get_port_ids (SpaNode *node,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
if (node == NULL) if (node == NULL)
@ -474,7 +474,7 @@ spa_v4l2_source_node_port_enum_formats (SpaNode *node,
uint32_t port_id, uint32_t port_id,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index) uint32_t index)
{ {
SpaV4l2Source *this; SpaV4l2Source *this;
SpaResult res; SpaResult res;
@ -726,9 +726,9 @@ spa_v4l2_source_node_port_alloc_buffers (SpaNode *node,
SpaDirection direction, SpaDirection direction,
uint32_t port_id, uint32_t port_id,
SpaAllocParam **params, SpaAllocParam **params,
unsigned int n_params, uint32_t n_params,
SpaBuffer **buffers, SpaBuffer **buffers,
unsigned int *n_buffers) uint32_t *n_buffers)
{ {
SpaV4l2Source *this; SpaV4l2Source *this;
SpaV4l2State *state; SpaV4l2State *state;
@ -965,10 +965,10 @@ v4l2_source_init (const SpaHandleFactory *factory,
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
SpaV4l2Source *this; SpaV4l2Source *this;
unsigned int i; uint32_t i;
const char *str; const char *str;
if (factory == NULL || handle == NULL) if (factory == NULL || handle == NULL)
@ -1032,7 +1032,7 @@ static const SpaInterfaceInfo v4l2_source_interfaces[] =
static SpaResult static SpaResult
v4l2_source_enum_interface_info (const SpaHandleFactory *factory, v4l2_source_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info, const SpaInterfaceInfo **info,
unsigned int index) uint32_t index)
{ {
if (factory == NULL || info == NULL) if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -322,7 +322,7 @@ find_format_info_by_media_type (SpaMediaType type,
} }
static SpaVideoFormat static SpaVideoFormat
enum_filter_format (const SpaFormat *filter, unsigned int index) enum_filter_format (const SpaFormat *filter, uint32_t index)
{ {
SpaVideoFormat video_format = SPA_VIDEO_FORMAT_UNKNOWN; SpaVideoFormat video_format = SPA_VIDEO_FORMAT_UNKNOWN;
@ -330,7 +330,7 @@ enum_filter_format (const SpaFormat *filter, unsigned int index)
filter->body.media_type.value == SPA_MEDIA_TYPE_IMAGE)) { filter->body.media_type.value == SPA_MEDIA_TYPE_IMAGE)) {
if (filter->body.media_subtype.value == SPA_MEDIA_SUBTYPE_RAW) { if (filter->body.media_subtype.value == SPA_MEDIA_SUBTYPE_RAW) {
SpaPODProp *p; SpaPODProp *p;
unsigned int n_values; uint32_t n_values;
const uint32_t *values; const uint32_t *values;
if (!(p = spa_format_find_prop (filter, SPA_PROP_ID_VIDEO_FORMAT))) if (!(p = spa_format_find_prop (filter, SPA_PROP_ID_VIDEO_FORMAT)))
@ -449,7 +449,7 @@ static SpaResult
spa_v4l2_enum_format (SpaV4l2Source *this, spa_v4l2_enum_format (SpaV4l2Source *this,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index) uint32_t index)
{ {
SpaV4l2State *state = &this->state[0]; SpaV4l2State *state = &this->state[0];
int res, n_fractions; int res, n_fractions;
@ -547,7 +547,7 @@ do_frmsize:
SpaPODProp *p; SpaPODProp *p;
const SpaRectangle step = { 1, 1 }, *values; const SpaRectangle step = { 1, 1 }, *values;
uint32_t range; uint32_t range;
unsigned int i, n_values; uint32_t i, n_values;
/* check if we have a fixed frame size */ /* check if we have a fixed frame size */
if (!(p = spa_format_find_prop (filter, SPA_PROP_ID_VIDEO_SIZE))) if (!(p = spa_format_find_prop (filter, SPA_PROP_ID_VIDEO_SIZE)))
@ -650,7 +650,7 @@ have_size:
if (filter) { if (filter) {
SpaPODProp *p; SpaPODProp *p;
uint32_t range; uint32_t range;
unsigned int i, n_values; uint32_t i, n_values;
const SpaFraction step = { 1, 1 }, *values; const SpaFraction step = { 1, 1 }, *values;
if (!(p = spa_format_find_prop (filter, SPA_PROP_ID_VIDEO_FRAMERATE))) if (!(p = spa_format_find_prop (filter, SPA_PROP_ID_VIDEO_FRAMERATE)))
@ -1024,9 +1024,9 @@ spa_v4l2_use_buffers (SpaV4l2Source *this, SpaBuffer **buffers, uint32_t n_buffe
static SpaResult static SpaResult
mmap_init (SpaV4l2Source *this, mmap_init (SpaV4l2Source *this,
SpaAllocParam **params, SpaAllocParam **params,
unsigned int n_params, uint32_t n_params,
SpaBuffer **buffers, SpaBuffer **buffers,
unsigned int *n_buffers) uint32_t *n_buffers)
{ {
SpaV4l2State *state = &this->state[0]; SpaV4l2State *state = &this->state[0];
struct v4l2_requestbuffers reqbuf; struct v4l2_requestbuffers reqbuf;
@ -1136,9 +1136,9 @@ read_init (SpaV4l2Source *this)
static SpaResult static SpaResult
spa_v4l2_alloc_buffers (SpaV4l2Source *this, spa_v4l2_alloc_buffers (SpaV4l2Source *this,
SpaAllocParam **params, SpaAllocParam **params,
unsigned int n_params, uint32_t n_params,
SpaBuffer **buffers, SpaBuffer **buffers,
unsigned int *n_buffers) uint32_t *n_buffers)
{ {
SpaResult res; SpaResult res;
SpaV4l2State *state = &this->state[0]; SpaV4l2State *state = &this->state[0];

View file

@ -25,7 +25,7 @@ extern const SpaHandleFactory spa_v4l2_monitor_factory;
SpaResult SpaResult
spa_enum_handle_factory (const SpaHandleFactory **factory, spa_enum_handle_factory (const SpaHandleFactory **factory,
unsigned int index) uint32_t index)
{ {
if (factory == NULL) if (factory == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -24,7 +24,7 @@ extern const SpaHandleFactory spa_videotestsrc_factory;
SpaResult SpaResult
spa_enum_handle_factory (const SpaHandleFactory **factory, spa_enum_handle_factory (const SpaHandleFactory **factory,
unsigned int index) uint32_t index)
{ {
if (factory == NULL) if (factory == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -92,7 +92,7 @@ struct _SpaVideoTestSrc {
size_t bpp; size_t bpp;
VTSBuffer buffers[MAX_BUFFERS]; VTSBuffer buffers[MAX_BUFFERS];
unsigned int n_buffers; uint32_t n_buffers;
bool started; bool started;
uint64_t start_time; uint64_t start_time;
@ -366,10 +366,10 @@ spa_videotestsrc_node_set_event_callback (SpaNode *node,
static SpaResult static SpaResult
spa_videotestsrc_node_get_n_ports (SpaNode *node, spa_videotestsrc_node_get_n_ports (SpaNode *node,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -388,9 +388,9 @@ spa_videotestsrc_node_get_n_ports (SpaNode *node,
static SpaResult static SpaResult
spa_videotestsrc_node_get_port_ids (SpaNode *node, spa_videotestsrc_node_get_port_ids (SpaNode *node,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
if (node == NULL) if (node == NULL)
@ -424,7 +424,7 @@ spa_videotestsrc_node_port_enum_formats (SpaNode *node,
uint32_t port_id, uint32_t port_id,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index) uint32_t index)
{ {
SpaVideoTestSrc *this; SpaVideoTestSrc *this;
SpaResult res; SpaResult res;
@ -648,7 +648,7 @@ spa_videotestsrc_node_port_use_buffers (SpaNode *node,
uint32_t n_buffers) uint32_t n_buffers)
{ {
SpaVideoTestSrc *this; SpaVideoTestSrc *this;
unsigned int i; uint32_t i;
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -927,10 +927,10 @@ videotestsrc_init (const SpaHandleFactory *factory,
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
SpaVideoTestSrc *this; SpaVideoTestSrc *this;
unsigned int i; uint32_t i;
if (factory == NULL || handle == NULL) if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -994,7 +994,7 @@ static const SpaInterfaceInfo videotestsrc_interfaces[] =
static SpaResult static SpaResult
videotestsrc_enum_interface_info (const SpaHandleFactory *factory, videotestsrc_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info, const SpaInterfaceInfo **info,
unsigned int index) uint32_t index)
{ {
if (factory == NULL || info == NULL) if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -24,7 +24,7 @@ extern const SpaHandleFactory spa_volume_factory;
SpaResult SpaResult
spa_enum_handle_factory (const SpaHandleFactory **factory, spa_enum_handle_factory (const SpaHandleFactory **factory,
unsigned int index) uint32_t index)
{ {
if (factory == NULL) if (factory == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -55,7 +55,7 @@ typedef struct {
SpaAllocParamMetaEnable param_meta; SpaAllocParamMetaEnable param_meta;
SpaVolumeBuffer buffers[MAX_BUFFERS]; SpaVolumeBuffer buffers[MAX_BUFFERS];
unsigned int n_buffers; uint32_t n_buffers;
void *io; void *io;
@ -225,10 +225,10 @@ spa_volume_node_set_event_callback (SpaNode *node,
static SpaResult static SpaResult
spa_volume_node_get_n_ports (SpaNode *node, spa_volume_node_get_n_ports (SpaNode *node,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -247,9 +247,9 @@ spa_volume_node_get_n_ports (SpaNode *node,
static SpaResult static SpaResult
spa_volume_node_get_port_ids (SpaNode *node, spa_volume_node_get_port_ids (SpaNode *node,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
if (node == NULL) if (node == NULL)
@ -286,7 +286,7 @@ spa_volume_node_port_enum_formats (SpaNode *node,
uint32_t port_id, uint32_t port_id,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index) uint32_t index)
{ {
SpaVolume *this; SpaVolume *this;
SpaResult res; SpaResult res;
@ -487,7 +487,7 @@ spa_volume_node_port_use_buffers (SpaNode *node,
{ {
SpaVolume *this; SpaVolume *this;
SpaVolumePort *port; SpaVolumePort *port;
unsigned int i; uint32_t i;
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -665,7 +665,7 @@ release_buffer (SpaVolume *this, SpaBuffer *buffer)
static void static void
do_volume (SpaVolume *this, SpaBuffer *dbuf, SpaBuffer *sbuf) do_volume (SpaVolume *this, SpaBuffer *dbuf, SpaBuffer *sbuf)
{ {
unsigned int si, di, i, n_samples, n_bytes, soff, doff ; uint32_t si, di, i, n_samples, n_bytes, soff, doff ;
SpaData *sd, *dd; SpaData *sd, *dd;
uint16_t *src, *dst; uint16_t *src, *dst;
double volume; double volume;
@ -825,10 +825,10 @@ volume_init (const SpaHandleFactory *factory,
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
SpaVolume *this; SpaVolume *this;
unsigned int i; uint32_t i;
if (factory == NULL || handle == NULL) if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -872,7 +872,7 @@ static const SpaInterfaceInfo volume_interfaces[] =
static SpaResult static SpaResult
volume_enum_interface_info (const SpaHandleFactory *factory, volume_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info, const SpaInterfaceInfo **info,
unsigned int index) uint32_t index)
{ {
if (factory == NULL || info == NULL) if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -231,10 +231,10 @@ spa_xv_sink_node_set_event_callback (SpaNode *node,
static SpaResult static SpaResult
spa_xv_sink_node_get_n_ports (SpaNode *node, spa_xv_sink_node_get_n_ports (SpaNode *node,
unsigned int *n_input_ports, uint32_t *n_input_ports,
unsigned int *max_input_ports, uint32_t *max_input_ports,
unsigned int *n_output_ports, uint32_t *n_output_ports,
unsigned int *max_output_ports) uint32_t *max_output_ports)
{ {
if (node == NULL) if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -253,9 +253,9 @@ spa_xv_sink_node_get_n_ports (SpaNode *node,
static SpaResult static SpaResult
spa_xv_sink_node_get_port_ids (SpaNode *node, spa_xv_sink_node_get_port_ids (SpaNode *node,
unsigned int n_input_ports, uint32_t n_input_ports,
uint32_t *input_ids, uint32_t *input_ids,
unsigned int n_output_ports, uint32_t n_output_ports,
uint32_t *output_ids) uint32_t *output_ids)
{ {
if (node == NULL) if (node == NULL)
@ -290,7 +290,7 @@ spa_xv_sink_node_port_enum_formats (SpaNode *node,
uint32_t port_id, uint32_t port_id,
SpaFormat **format, SpaFormat **format,
const SpaFormat *filter, const SpaFormat *filter,
unsigned int index) uint32_t index)
{ {
SpaXvSink *this; SpaXvSink *this;
@ -558,10 +558,10 @@ xv_sink_init (const SpaHandleFactory *factory,
SpaHandle *handle, SpaHandle *handle,
const SpaDict *info, const SpaDict *info,
const SpaSupport *support, const SpaSupport *support,
unsigned int n_support) uint32_t n_support)
{ {
SpaXvSink *this; SpaXvSink *this;
unsigned int i; uint32_t i;
if (factory == NULL || handle == NULL) if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;
@ -599,7 +599,7 @@ static const SpaInterfaceInfo xv_sink_interfaces[] =
static SpaResult static SpaResult
xv_sink_enum_interface_info (const SpaHandleFactory *factory, xv_sink_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info, const SpaInterfaceInfo **info,
unsigned int index) uint32_t index)
{ {
if (factory == NULL || info == NULL) if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -24,7 +24,7 @@ extern const SpaHandleFactory spa_xv_sink_factory;
SpaResult SpaResult
spa_enum_handle_factory (const SpaHandleFactory **factory, spa_enum_handle_factory (const SpaHandleFactory **factory,
unsigned int index) uint32_t index)
{ {
if (factory == NULL) if (factory == NULL)
return SPA_RESULT_INVALID_ARGUMENTS; return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -50,7 +50,7 @@ typedef struct {
SpaPollItem poll; SpaPollItem poll;
SpaSupport support[2]; SpaSupport support[2];
unsigned int n_support; uint32_t n_support;
SpaIDMap *map; SpaIDMap *map;
SpaLog *log; SpaLog *log;
SpaPoll data_loop; SpaPoll data_loop;

View file

@ -26,6 +26,7 @@
#include <spa/pod.h> #include <spa/pod.h>
#include <spa/pod-builder.h> #include <spa/pod-builder.h>
#include <spa/pod-iter.h>
#include <spa/id-map.h> #include <spa/id-map.h>
#include <spa/log.h> #include <spa/log.h>
@ -40,11 +41,12 @@ main (int argc, char *argv[])
SpaPODFrame frame[4]; SpaPODFrame frame[4];
uint8_t buffer[1024]; uint8_t buffer[1024];
SpaPOD *obj; SpaPOD *obj;
SpaPODIter i;
b.data = buffer; b.data = buffer;
b.size = 1024; b.size = 1024;
obj = SPA_MEMBER (buffer, spa_pod_builder_push_object (&b, &frame[0], 0, 0), SpaPOD); spa_pod_builder_push_object (&b, &frame[0], 0, 0);
uint32_t formats[] = { 1, 2 }; uint32_t formats[] = { 1, 2 };
spa_pod_builder_push_prop (&b, &frame[1], spa_pod_builder_push_prop (&b, &frame[1],
@ -84,11 +86,40 @@ main (int argc, char *argv[])
spa_pod_builder_pop (&b, &frame[1]); spa_pod_builder_pop (&b, &frame[1]);
spa_pod_builder_pop (&b, &frame[0]); spa_pod_builder_pop (&b, &frame[0]);
obj = SPA_POD_BUILDER_DEREF (&b, frame[0].ref, SpaPOD);
spa_debug_pod (obj); spa_debug_pod (obj);
SpaPODProp *p = spa_pod_object_find_prop ((SpaPODObject *)obj, 4); SpaPODProp *p = spa_pod_object_find_prop ((SpaPODObject *)obj, 4);
printf ("%d %d\n", p->body.key, p->body.flags); printf ("%d %d\n", p->body.key, p->body.flags);
spa_debug_pod (&p->body.value); spa_debug_pod (&p->body.value);
obj = SPA_POD_BUILDER_DEREF (&b, frame[2].ref, SpaPOD);
int32_t vi, *pi;
int64_t vl;
float vf;
double vd;
char *vs;
SpaRectangle vr;
SpaFraction vfr;
SpaPODArray *va;
spa_pod_iter_pod (&i, obj);
spa_pod_iter_get (&i, SPA_POD_TYPE_INT, &vi,
SPA_POD_TYPE_LONG, &vl,
SPA_POD_TYPE_FLOAT, &vf,
SPA_POD_TYPE_DOUBLE, &vd,
SPA_POD_TYPE_STRING, &vs,
SPA_POD_TYPE_RECTANGLE, &vr,
SPA_POD_TYPE_FRACTION, &vfr,
SPA_POD_TYPE_ARRAY, &va,
0);
printf ("%u %lu %f %g %s %ux%u %u/%u\n", vi, vl, vf, vd, vs, vr.width, vr.height, vfr.num, vfr.denom);
SPA_POD_ARRAY_BODY_FOREACH (&va->body, SPA_POD_BODY_SIZE (va), pi) {
printf ("%d\n", *pi);
}
return 0; return 0;
} }

View file

@ -71,7 +71,7 @@ typedef struct {
unsigned int n_buffers; unsigned int n_buffers;
SpaSupport support[2]; SpaSupport support[2];
unsigned int n_support; uint32_t n_support;
SpaIDMap *map; SpaIDMap *map;
SpaLog *log; SpaLog *log;
SpaPoll data_loop; SpaPoll data_loop;

View file

@ -39,7 +39,7 @@ typedef struct {
URI uri; URI uri;
SpaSupport support[4]; SpaSupport support[4];
unsigned int n_support; uint32_t n_support;
SpaIDMap *map; SpaIDMap *map;
SpaLog *log; SpaLog *log;
SpaLoop loop; SpaLoop loop;
@ -50,7 +50,7 @@ inspect_port (SpaNode *node, SpaDirection direction, uint32_t port_id)
{ {
SpaResult res; SpaResult res;
SpaFormat *format; SpaFormat *format;
unsigned int index = 0; uint32_t index = 0;
SpaProps *props; SpaProps *props;
while (true) { while (true) {
@ -73,7 +73,7 @@ static void
inspect_node (SpaNode *node) inspect_node (SpaNode *node)
{ {
SpaResult res; SpaResult res;
unsigned int i, n_input, max_input, n_output, max_output; uint32_t i, n_input, max_input, n_output, max_output;
uint32_t *in_ports, *out_ports; uint32_t *in_ports, *out_ports;
SpaProps *props; SpaProps *props;
@ -114,7 +114,7 @@ inspect_factory (AppData *data, const SpaHandleFactory *factory)
SpaResult res; SpaResult res;
SpaHandle *handle; SpaHandle *handle;
void *interface; void *interface;
unsigned int index = 0; uint32_t index = 0;
printf ("factory name:\t\t'%s'\n", factory->name); printf ("factory name:\t\t'%s'\n", factory->name);
printf ("factory info:\n"); printf ("factory info:\n");
@ -181,7 +181,7 @@ main (int argc, char *argv[])
SpaResult res; SpaResult res;
void *handle; void *handle;
SpaEnumHandleFactoryFunc enum_func; SpaEnumHandleFactoryFunc enum_func;
unsigned int index = 0; uint32_t index = 0;
if (argc < 2) { if (argc < 2) {
printf ("usage: %s <plugin.so>\n", argv[0]); printf ("usage: %s <plugin.so>\n", argv[0]);

View file

@ -44,7 +44,7 @@ typedef struct {
SpaLoop main_loop; SpaLoop main_loop;
SpaSupport support[3]; SpaSupport support[3];
unsigned int n_support; uint32_t n_support;
unsigned int n_sources; unsigned int n_sources;
SpaSource sources[16]; SpaSource sources[16];
@ -123,7 +123,7 @@ static void
handle_monitor (AppData *data, SpaMonitor *monitor) handle_monitor (AppData *data, SpaMonitor *monitor)
{ {
SpaResult res; SpaResult res;
unsigned int index; uint32_t index;
if (monitor->info) if (monitor->info)
spa_debug_dict (monitor->info); spa_debug_dict (monitor->info);
@ -181,7 +181,7 @@ main (int argc, char *argv[])
SpaResult res; SpaResult res;
void *handle; void *handle;
SpaEnumHandleFactoryFunc enum_func; SpaEnumHandleFactoryFunc enum_func;
unsigned int fidx; uint32_t fidx;
data.map = spa_id_map_get_default (); data.map = spa_id_map_get_default ();
data.log = NULL; data.log = NULL;
@ -216,7 +216,7 @@ main (int argc, char *argv[])
for (fidx = 0;; fidx++) { for (fidx = 0;; fidx++) {
const SpaHandleFactory *factory; const SpaHandleFactory *factory;
unsigned int iidx; uint32_t iidx;
if ((res = enum_func (&factory, fidx)) < 0) { if ((res = enum_func (&factory, fidx)) < 0) {
if (res != SPA_RESULT_ENUM_END) if (res != SPA_RESULT_ENUM_END)