diff --git a/pinos/client/connection.c b/pinos/client/connection.c index 3c1f2da0e..8a506dbe1 100644 --- a/pinos/client/connection.c +++ b/pinos/client/connection.c @@ -36,7 +36,7 @@ typedef struct { size_t buffer_size; size_t buffer_maxsize; int fds[MAX_FDS]; - unsigned int n_fds; + uint32_t n_fds; off_t offset; void *data; @@ -52,7 +52,7 @@ struct _PinosConnection { int pinos_connection_get_fd (PinosConnection *conn, - int index) + uint32_t index) { if (index < 0 || index >= conn->in.n_fds) return -1; @@ -60,11 +60,11 @@ pinos_connection_get_fd (PinosConnection *conn, return conn->in.fds[index]; } -int +uint32_t pinos_connection_add_fd (PinosConnection *conn, int fd) { - int index, i; + uint32_t index, i; for (i = 0; i < conn->out.n_fds; i++) { if (conn->out.fds[i] == fd) @@ -202,7 +202,7 @@ pinos_connection_get_next (PinosConnection *conn, uint8_t *opcode, uint32_t *dest_id, void **dt, - size_t *sz) + uint32_t *sz) { size_t len, size; uint8_t *data; @@ -265,7 +265,7 @@ again: void * pinos_connection_begin_write (PinosConnection *conn, - size_t size) + uint32_t size) { uint32_t *p; ConnectionBuffer *buf = &conn->out; @@ -278,7 +278,7 @@ void pinos_connection_end_write (PinosConnection *conn, uint32_t dest_id, uint8_t opcode, - size_t size) + uint32_t size) { uint32_t *p; ConnectionBuffer *buf = &conn->out; diff --git a/pinos/client/connection.h b/pinos/client/connection.h index 7cbf94632..1ca229028 100644 --- a/pinos/client/connection.h +++ b/pinos/client/connection.h @@ -31,23 +31,23 @@ typedef struct _PinosConnection PinosConnection; PinosConnection * pinos_connection_new (int fd); void pinos_connection_destroy (PinosConnection *conn); -int pinos_connection_add_fd (PinosConnection *conn, +uint32_t pinos_connection_add_fd (PinosConnection *conn, int fd); int pinos_connection_get_fd (PinosConnection *conn, - int index); + uint32_t index); bool pinos_connection_get_next (PinosConnection *conn, uint8_t *opcode, uint32_t *dest_id, void **data, - size_t *size); + uint32_t *size); void * pinos_connection_begin_write (PinosConnection *conn, - size_t size); + uint32_t size); void pinos_connection_end_write (PinosConnection *conn, uint32_t dest_id, uint8_t opcode, - size_t size); + uint32_t size); bool pinos_connection_flush (PinosConnection *conn); bool pinos_connection_clear (PinosConnection *conn); diff --git a/pinos/client/context.c b/pinos/client/context.c index d76443909..c20f66860 100644 --- a/pinos/client/context.c +++ b/pinos/client/context.c @@ -387,7 +387,7 @@ on_context_data (SpaSource *source, PinosConnection *conn = impl->connection; uint8_t opcode; uint32_t id; - size_t size; + uint32_t size; void *message; while (pinos_connection_get_next (conn, &opcode, &id, &message, &size)) { diff --git a/pinos/client/interfaces.h b/pinos/client/interfaces.h index f30cda02c..dcf0cac2a 100644 --- a/pinos/client/interfaces.h +++ b/pinos/client/interfaces.h @@ -117,8 +117,8 @@ typedef struct { struct _PinosClientNodeBuffer { uint32_t mem_id; - off_t offset; - size_t size; + uint32_t offset; + uint32_t size; SpaBuffer *buffer; }; @@ -128,8 +128,8 @@ typedef struct { #define PINOS_MESSAGE_NODE_UPDATE_MAX_OUTPUTS (1 << 1) #define PINOS_MESSAGE_NODE_UPDATE_PROPS (1 << 2) uint32_t change_mask, - unsigned int max_input_ports, - unsigned int max_output_ports, + uint32_t max_input_ports, + uint32_t max_output_ports, const SpaProps *props); void (*port_update) (void *object, @@ -140,7 +140,7 @@ typedef struct { #define PINOS_MESSAGE_PORT_UPDATE_PROPS (1 << 2) #define PINOS_MESSAGE_PORT_UPDATE_INFO (1 << 3) uint32_t change_mask, - unsigned int n_possible_formats, + uint32_t n_possible_formats, const SpaFormat **possible_formats, const SpaFormat *format, const SpaProps *props, @@ -182,7 +182,7 @@ typedef struct { void (*set_property) (void *object, uint32_t seq, uint32_t id, - size_t size, + uint32_t size, const void *value); void (*add_mem) (void *object, SpaDirection direction, @@ -191,13 +191,13 @@ typedef struct { SpaDataType type, int memfd, uint32_t flags, - off_t offset, - size_t size); + uint32_t offset, + uint32_t size); void (*use_buffers) (void *object, uint32_t seq, SpaDirection direction, uint32_t port_id, - unsigned int n_buffers, + uint32_t n_buffers, PinosClientNodeBuffer *buffers); void (*node_command) (void *object, uint32_t seq, @@ -207,8 +207,8 @@ typedef struct { const SpaNodeCommand *command); void (*transport) (void *object, int memfd, - off_t offset, - size_t size); + uint32_t offset, + uint32_t size); } PinosClientNodeEvent; #define pinos_client_node_notify_done(r,...) ((PinosClientNodeEvent*)r->event)->done(r,__VA_ARGS__) diff --git a/pinos/client/introspect.c b/pinos/client/introspect.c index 05cedb681..107f83c88 100644 --- a/pinos/client/introspect.c +++ b/pinos/client/introspect.c @@ -119,7 +119,7 @@ static SpaDict * pinos_spa_dict_copy (SpaDict *dict) { SpaDict *copy; - unsigned int i; + uint32_t i; if (dict == NULL) return NULL; diff --git a/pinos/client/introspect.h b/pinos/client/introspect.h index a69a09f01..2ed05e6d0 100644 --- a/pinos/client/introspect.h +++ b/pinos/client/introspect.h @@ -256,13 +256,13 @@ struct _PinosNodeInfo { uint32_t id; uint64_t change_mask; const char *name; - unsigned int max_inputs; - unsigned int n_inputs; - unsigned int n_input_formats; + uint32_t max_inputs; + uint32_t n_inputs; + uint32_t n_input_formats; SpaFormat **input_formats; - unsigned int max_outputs; - unsigned int n_outputs; - unsigned int n_output_formats; + uint32_t max_outputs; + uint32_t n_outputs; + uint32_t n_output_formats; SpaFormat **output_formats; PinosNodeState state; const char *error; diff --git a/pinos/client/loop.c b/pinos/client/loop.c index 0cbf695bf..099b1d74c 100644 --- a/pinos/client/loop.c +++ b/pinos/client/loop.c @@ -225,7 +225,7 @@ event_func (SpaSource *source, void *data) { PinosLoopImpl *impl = data; - size_t offset; + uint32_t offset; while (spa_ringbuffer_get_read_offset (&impl->buffer, &offset) > 0) { InvokeItem *item = SPA_MEMBER (impl->buffer_data, offset, InvokeItem); diff --git a/pinos/client/properties.c b/pinos/client/properties.c index 30d2e4acb..668d1f02a 100644 --- a/pinos/client/properties.c +++ b/pinos/client/properties.c @@ -105,7 +105,7 @@ pinos_properties_new (const char *key, ...) PinosProperties * pinos_properties_new_dict (const SpaDict *dict) { - unsigned int i; + uint32_t i; PinosPropertiesImpl *impl; impl = calloc (1, sizeof (PinosPropertiesImpl)); @@ -307,7 +307,7 @@ pinos_properties_iterate (PinosProperties *properties, void **state) { PinosPropertiesImpl *impl = SPA_CONTAINER_OF (properties, PinosPropertiesImpl, this); - unsigned int index; + uint32_t index; if (*state == NULL) index = 0; diff --git a/pinos/client/protocol-native.c b/pinos/client/protocol-native.c index 22c56b491..cdc8ae4c8 100644 --- a/pinos/client/protocol-native.c +++ b/pinos/client/protocol-native.c @@ -19,6 +19,7 @@ #include +#include "spa/pod-iter.h" #include "pinos/client/pinos.h" #include "pinos/client/protocol-native.h" @@ -30,8 +31,8 @@ typedef struct { PinosConnection *connection; } Builder; -static off_t -write_pod (SpaPODBuilder *b, off_t ref, const void *data, size_t size) +static uint32_t +write_pod (SpaPODBuilder *b, uint32_t ref, const void *data, uint32_t size) { if (ref == -1) ref = b->offset; @@ -165,31 +166,30 @@ core_demarshal_info (void *object, { PinosProxy *proxy = object; SpaDict props; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); PinosCoreInfo info; - int32_t i1, i2, i3; - int64_t l1; + SpaPODIter it; int i; - if (!spa_pod_get_int (&p, &i1) || - !spa_pod_get_long (&p, &l1) || - !spa_pod_get_string (&p, &info.user_name) || - !spa_pod_get_string (&p, &info.host_name) || - !spa_pod_get_string (&p, &info.version) || - !spa_pod_get_string (&p, &info.name) || - !spa_pod_get_int (&p, &i3) || - !spa_pod_get_int (&p, &i2)) + if (!spa_pod_iter_struct (&it, data, size) || + !spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &info.id, + SPA_POD_TYPE_LONG, &info.change_mask, + SPA_POD_TYPE_STRING, &info.user_name, + SPA_POD_TYPE_STRING, &info.host_name, + SPA_POD_TYPE_STRING, &info.version, + SPA_POD_TYPE_STRING, &info.name, + SPA_POD_TYPE_INT, &info.cookie, + SPA_POD_TYPE_INT, &props.n_items, + 0)) return; - info.id = i1; - info.change_mask = l1; - info.cookie = i3; info.props = &props; - props.n_items = i2; props.items = alloca (props.n_items * sizeof (SpaDictItem)); for (i = 0; i < props.n_items; i++) { - if (!spa_pod_get_string (&p, &props.items[i].key) || - !spa_pod_get_string (&p, &props.items[i].value)) + if (!spa_pod_iter_get (&it, + SPA_POD_TYPE_STRING, &props.items[i].key, + SPA_POD_TYPE_STRING, &props.items[i].value, + 0)) return; } pinos_core_notify_info (proxy, &info); @@ -201,13 +201,16 @@ core_demarshal_done (void *object, size_t size) { PinosProxy *proxy = object; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); - int32_t i32; + SpaPODIter it; + 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; - pinos_core_notify_done (proxy, i32); + pinos_core_notify_done (proxy, seq); } static void @@ -216,16 +219,19 @@ core_demarshal_error (void *object, size_t size) { PinosProxy *proxy = object; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); - int32_t i1, i2; + SpaPODIter it; + uint32_t id, res; const char *error; - if (!spa_pod_get_int (&p, &i1) || - !spa_pod_get_int (&p, &i2) || - !spa_pod_get_string (&p, &error)) + if (!spa_pod_iter_struct (&it, data, size) || + !spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &id, + SPA_POD_TYPE_INT, &res, + SPA_POD_TYPE_STRING, &error, + 0)) return; - pinos_core_notify_error (proxy, i1, i2, error); + pinos_core_notify_error (proxy, id, res, error); } static void @@ -234,13 +240,16 @@ core_demarshal_remove_id (void *object, size_t size) { PinosProxy *proxy = object; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); - int32_t i1; + SpaPODIter it; + 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; - pinos_core_notify_remove_id (proxy, i1); + pinos_core_notify_remove_id (proxy, id); } static void @@ -249,29 +258,29 @@ module_demarshal_info (void *object, size_t size) { PinosProxy *proxy = object; + SpaPODIter it; SpaDict props; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); PinosModuleInfo info; - int32_t i1, i2; - int64_t l1; int i; - if (!spa_pod_get_int (&p, &i1) || - !spa_pod_get_long (&p, &l1) || - !spa_pod_get_string (&p, &info.name) || - !spa_pod_get_string (&p, &info.filename) || - !spa_pod_get_string (&p, &info.args) || - !spa_pod_get_int (&p, &i2)) + if (!spa_pod_iter_struct (&it, data, size) || + !spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &info.id, + SPA_POD_TYPE_LONG, &info.change_mask, + SPA_POD_TYPE_STRING, &info.name, + SPA_POD_TYPE_STRING, &info.filename, + SPA_POD_TYPE_STRING, &info.args, + SPA_POD_TYPE_INT, &props.n_items, + 0)) return; - info.id = i1; - info.change_mask = l1; info.props = &props; - props.n_items = i2; props.items = alloca (props.n_items * sizeof (SpaDictItem)); for (i = 0; i < props.n_items; i++) { - if (!spa_pod_get_string (&p, &props.items[i].key) || - !spa_pod_get_string (&p, &props.items[i].value)) + if (!spa_pod_iter_get (&it, + SPA_POD_TYPE_STRING, &props.items[i].key, + SPA_POD_TYPE_STRING, &props.items[i].value, + 0)) return; } pinos_module_notify_info (proxy, &info); @@ -283,13 +292,16 @@ node_demarshal_done (void *object, size_t size) { PinosProxy *proxy = object; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); - int32_t i1; + SpaPODIter it; + 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; - pinos_node_notify_done (proxy, i1); + pinos_node_notify_done (proxy, seq); } static void @@ -298,54 +310,52 @@ node_demarshal_info (void *object, size_t size) { PinosProxy *proxy = object; + SpaPODIter it; SpaDict props; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); PinosNodeInfo info; - int32_t i1, i2, i3, i4; - int64_t l1; int i; - if (!spa_pod_get_int (&p, &i1) || - !spa_pod_get_long (&p, &l1) || - !spa_pod_get_string (&p, &info.name) || - !spa_pod_get_int (&p, &i2) || - !spa_pod_get_int (&p, &i3) || - !spa_pod_get_int (&p, &i4)) + if (!spa_pod_iter_struct (&it, data, size) || + !spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &info.id, + SPA_POD_TYPE_LONG, &info.change_mask, + SPA_POD_TYPE_STRING, &info.name, + SPA_POD_TYPE_INT, &info.max_inputs, + SPA_POD_TYPE_INT, &info.n_inputs, + SPA_POD_TYPE_INT, &info.n_input_formats, + 0)) 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*)); 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) || - !spa_pod_get_int (&p, &i3) || - !spa_pod_get_int (&p, &i4)) + if (!spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &info.max_outputs, + SPA_POD_TYPE_INT, &info.n_outputs, + SPA_POD_TYPE_INT, &info.n_output_formats, + 0)) return; - info.max_outputs = i2; - info.n_outputs = i3; - info.n_output_formats = i4; info.output_formats = alloca (info.n_output_formats * sizeof (SpaFormat*)); 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) || - !spa_pod_get_string (&p, &info.error) || - !spa_pod_get_int (&p, &i2)) + if (!spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &info.state, + SPA_POD_TYPE_STRING, &info.error, + SPA_POD_TYPE_INT, &props.n_items, + 0)) return; - info.state = i1; info.props = &props; - props.n_items = i2; props.items = alloca (props.n_items * sizeof (SpaDictItem)); for (i = 0; i < props.n_items; i++) { - if (!spa_pod_get_string (&p, &props.items[i].key) || - !spa_pod_get_string (&p, &props.items[i].value)) + if (!spa_pod_iter_get (&it, + SPA_POD_TYPE_STRING, &props.items[i].key, + SPA_POD_TYPE_STRING, &props.items[i].value, + 0)) return; } pinos_node_notify_info (proxy, &info); @@ -354,8 +364,8 @@ node_demarshal_info (void *object, static void client_node_marshal_update (void *object, uint32_t change_mask, - unsigned int max_input_ports, - unsigned int max_output_ports, + uint32_t max_input_ports, + uint32_t max_output_ports, const SpaProps *props) { PinosProxy *proxy = object; @@ -380,7 +390,7 @@ client_node_marshal_port_update (void *object, SpaDirection direction, uint32_t port_id, uint32_t change_mask, - unsigned int n_possible_formats, + uint32_t n_possible_formats, const SpaFormat **possible_formats, const SpaFormat *format, const SpaProps *props, @@ -481,17 +491,20 @@ client_node_demarshal_done (void *object, size_t size) { PinosProxy *proxy = object; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); + SpaPODIter it; PinosConnection *connection = proxy->context->protocol_private; - int32_t i1, i2; + int32_t seq, idx; int fd; - if (!spa_pod_get_int (&p, &i1) || - !spa_pod_get_int (&p, &i2)) + if (!spa_pod_iter_struct (&it, data, size) || + !spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &seq, + SPA_POD_TYPE_INT, &idx, + 0)) return; - fd = pinos_connection_get_fd (connection, i2); - pinos_client_node_notify_done (proxy, i1, fd); + fd = pinos_connection_get_fd (connection, idx); + pinos_client_node_notify_done (proxy, seq, fd); } static void @@ -500,11 +513,14 @@ client_node_demarshal_event (void *object, size_t size) { PinosProxy *proxy = object; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); + SpaPODIter it; const SpaNodeEvent *event; 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; pinos_client_node_notify_event (proxy, event); @@ -516,15 +532,18 @@ client_node_demarshal_add_port (void *object, size_t size) { PinosProxy *proxy = object; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); - int32_t i1, i2, i3; + SpaPODIter it; + int32_t seq, direction, port_id; - if (!spa_pod_get_int (&p, &i1) || - !spa_pod_get_int (&p, &i2) || - !spa_pod_get_int (&p, &i3)) + if (!spa_pod_iter_struct (&it, data, size) || + !spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &seq, + SPA_POD_TYPE_INT, &direction, + SPA_POD_TYPE_INT, &port_id, + 0)) return; - pinos_client_node_notify_add_port (proxy, i1, i2, i3); + pinos_client_node_notify_add_port (proxy, seq, direction, port_id); } static void @@ -533,15 +552,18 @@ client_node_demarshal_remove_port (void *object, size_t size) { PinosProxy *proxy = object; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); - int32_t i1, i2, i3; + SpaPODIter it; + int32_t seq, direction, port_id; - if (!spa_pod_get_int (&p, &i1) || - !spa_pod_get_int (&p, &i2) || - !spa_pod_get_int (&p, &i3)) + if (!spa_pod_iter_struct (&it, data, size) || + !spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &seq, + SPA_POD_TYPE_INT, &direction, + SPA_POD_TYPE_INT, &port_id, + 0)) return; - pinos_client_node_notify_remove_port (proxy, i1, i2, i3); + pinos_client_node_notify_remove_port (proxy, seq, direction, port_id); } static void @@ -550,18 +572,21 @@ client_node_demarshal_set_format (void *object, size_t size) { PinosProxy *proxy = object; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); - int32_t seq, direction, port_id, flags, have_format; + SpaPODIter it; + uint32_t seq, direction, port_id, flags, have_format; const SpaFormat *format = NULL; - if (!spa_pod_get_int (&p, &seq) || - !spa_pod_get_int (&p, &direction) || - !spa_pod_get_int (&p, &port_id) || - !spa_pod_get_int (&p, &flags) || - !spa_pod_get_int (&p, &have_format)) + if (!spa_pod_iter_struct (&it, data, size) || + !spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &seq, + SPA_POD_TYPE_INT, &direction, + SPA_POD_TYPE_INT, &port_id, + SPA_POD_TYPE_INT, &flags, + SPA_POD_TYPE_INT, &have_format, + 0)) 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; 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) { PinosProxy *proxy = object; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); - int32_t seq, id; + SpaPODIter it; + uint32_t seq, id; const void *value; uint32_t s; - if (!spa_pod_get_int (&p, &seq) || - !spa_pod_get_int (&p, &id) || - !spa_pod_get_bytes (&p, &value, &s)) + if (!spa_pod_iter_struct (&it, data, size) || + !spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &seq, + SPA_POD_TYPE_INT, &id, + SPA_POD_TYPE_BYTES, &value, &s, + 0)) return; 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) { PinosProxy *proxy = object; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); + SpaPODIter it; 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) || - !spa_pod_get_int (&p, &port_id) || - !spa_pod_get_int (&p, &mem_id) || - !spa_pod_get_int (&p, &type) || - !spa_pod_get_int (&p, &memfd) || - !spa_pod_get_int (&p, &flags) || - !spa_pod_get_int (&p, &offset) || - !spa_pod_get_int (&p, &sz)) + if (!spa_pod_iter_struct (&it, data, size) || + !spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &direction, + SPA_POD_TYPE_INT, &port_id, + SPA_POD_TYPE_INT, &mem_id, + SPA_POD_TYPE_INT, &type, + SPA_POD_TYPE_INT, &memfd_idx, + SPA_POD_TYPE_INT, &flags, + SPA_POD_TYPE_INT, &offset, + SPA_POD_TYPE_INT, &sz, + 0)) return; - memfd = pinos_connection_get_fd (connection, memfd); + memfd = pinos_connection_get_fd (connection, memfd_idx); pinos_client_node_notify_add_mem (proxy, direction, @@ -626,66 +658,60 @@ client_node_demarshal_use_buffers (void *object, size_t size) { PinosProxy *proxy = object; - SpaPOD *p = SPA_POD_CONTENTS (SpaPODStruct, data); - int32_t seq, direction, port_id, n_buffers; + SpaPODIter it; + uint32_t seq, direction, port_id, n_buffers, data_id; PinosClientNodeBuffer *buffers; int i, j; - if (!spa_pod_get_int (&p, &seq) || - !spa_pod_get_int (&p, &direction) || - !spa_pod_get_int (&p, &port_id) || - !spa_pod_get_int (&p, &n_buffers)) + if (!spa_pod_iter_struct (&it, data, size) || + !spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &seq, + SPA_POD_TYPE_INT, &direction, + SPA_POD_TYPE_INT, &port_id, + SPA_POD_TYPE_INT, &n_buffers, + 0)) return; buffers = alloca (sizeof (PinosClientNodeBuffer) * n_buffers); for (i = 0; i < n_buffers; i++) { SpaBuffer *buf = buffers[i].buffer = alloca (sizeof (SpaBuffer)); - int32_t i1, i2, i3, i4, i5; - if (!spa_pod_get_int (&p, &i1) || - !spa_pod_get_int (&p, &i2) || - !spa_pod_get_int (&p, &i3) || - !spa_pod_get_int (&p, &i4) || - !spa_pod_get_int (&p, &i5)) + if (!spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &buffers[i].mem_id, + SPA_POD_TYPE_INT, &buffers[i].offset, + SPA_POD_TYPE_INT, &buffers[i].size, + SPA_POD_TYPE_INT, &buf->id, + SPA_POD_TYPE_INT, &buf->n_metas, 0)) 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); for (j = 0; j < buf->n_metas; j++) { SpaMeta *m = &buf->metas[j]; - if (!spa_pod_get_int (&p, &i1) || - !spa_pod_get_int (&p, &i2)) + if (!spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &m->type, + SPA_POD_TYPE_INT, &size, 0)) return; - m->type = i1; - m->size = i2; + m->size = size; } - if (!spa_pod_get_int (&p, &i1)) + if (!spa_pod_iter_get (&it, SPA_POD_TYPE_INT, &buf->n_datas, 0)) return; - buf->n_datas = i1; buf->datas = alloca (sizeof (SpaData) * buf->n_datas); for (j = 0; j < buf->n_datas; j++) { SpaData *d = &buf->datas[j]; - if (!spa_pod_get_int (&p, &i1) || - !spa_pod_get_int (&p, &i2) || - !spa_pod_get_int (&p, &i3) || - !spa_pod_get_int (&p, &i4) || - !spa_pod_get_int (&p, &i5)) + if (!spa_pod_iter_get (&it, + SPA_POD_TYPE_INT, &d->type, + SPA_POD_TYPE_INT, &data_id, + SPA_POD_TYPE_INT, &d->flags, + SPA_POD_TYPE_INT, &d->mapoffset, + SPA_POD_TYPE_INT, &d->maxsize, + 0)) return; - d->type = i1; - d->data = SPA_UINT32_TO_PTR (i2); - d->flags = i3; - d->mapoffset = i4; - d->maxsize = i5; + d->data = SPA_UINT32_TO_PTR (data_id); } } pinos_client_node_notify_use_buffers (proxy, diff --git a/pinos/client/stream.c b/pinos/client/stream.c index dbf20a6af..5bfd97f8b 100644 --- a/pinos/client/stream.c +++ b/pinos/client/stream.c @@ -47,8 +47,8 @@ typedef struct { int fd; uint32_t flags; void *ptr; - off_t offset; - size_t size; + uint32_t offset; + uint32_t size; } MemId; typedef struct { @@ -66,7 +66,7 @@ typedef struct uint32_t seq; - unsigned int n_possible_formats; + uint32_t n_possible_formats; SpaFormat **possible_formats; SpaFormat *format; @@ -310,7 +310,7 @@ static void add_node_update (PinosStream *stream, uint32_t change_mask, bool flush) { 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) max_input_ports = impl->direction == SPA_DIRECTION_INPUT ? 1 : 0; @@ -724,7 +724,7 @@ static void client_node_set_property (void *object, uint32_t seq, uint32_t id, - size_t size, + uint32_t size, const void *value) { pinos_log_warn ("set property not implemented"); @@ -738,8 +738,8 @@ client_node_add_mem (void *object, SpaDataType type, int memfd, uint32_t flags, - off_t offset, - size_t size) + uint32_t offset, + uint32_t size) { PinosProxy *proxy = object; PinosStream *stream = proxy->user_data; @@ -748,12 +748,12 @@ client_node_add_mem (void *object, m = find_mem (stream, mem_id); 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); clear_memid (m); } else { 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); } m->id = mem_id; @@ -769,14 +769,14 @@ client_node_use_buffers (void *object, uint32_t seq, SpaDirection direction, uint32_t port_id, - unsigned int n_buffers, + uint32_t n_buffers, PinosClientNodeBuffer *buffers) { PinosProxy *proxy = object; PinosStream *stream = proxy->user_data; PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this); BufferId *bid; - unsigned int i, j, len; + uint32_t i, j, len; SpaBuffer *b; /* 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); if (mid->ptr == MAP_FAILED) { 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; } 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); 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++) { SpaMeta *m = &b->metas[j]; @@ -893,8 +893,8 @@ client_node_port_command (void *object, static void client_node_transport (void *object, int memfd, - off_t offset, - size_t size) + uint32_t offset, + uint32_t size) { PinosProxy *proxy = object; PinosStream *stream = proxy->user_data; @@ -964,7 +964,7 @@ pinos_stream_connect (PinosStream *stream, PinosStreamMode mode, const char *port_path, PinosStreamFlags flags, - unsigned int n_possible_formats, + uint32_t n_possible_formats, SpaFormat **possible_formats) { PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this); @@ -1030,7 +1030,7 @@ bool pinos_stream_finish_format (PinosStream *stream, SpaResult res, SpaAllocParam **params, - unsigned int n_params) + uint32_t n_params) { PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this); diff --git a/pinos/client/stream.h b/pinos/client/stream.h index 22a319251..d87dd2274 100644 --- a/pinos/client/stream.h +++ b/pinos/client/stream.h @@ -105,14 +105,14 @@ bool pinos_stream_connect (PinosStream *stream, PinosStreamMode mode, const char *port_path, PinosStreamFlags flags, - unsigned int n_possible_formats, + uint32_t n_possible_formats, SpaFormat **possible_formats); bool pinos_stream_disconnect (PinosStream *stream); bool pinos_stream_finish_format (PinosStream *stream, SpaResult res, SpaAllocParam **params, - unsigned int n_params); + uint32_t n_params); diff --git a/pinos/client/transport.c b/pinos/client/transport.c index a73a7cdb3..76206210d 100644 --- a/pinos/client/transport.c +++ b/pinos/client/transport.c @@ -99,8 +99,8 @@ transport_setup_area (void *p, PinosTransport *trans) } PinosTransport * -pinos_transport_new (unsigned int max_inputs, - unsigned int max_outputs) +pinos_transport_new (uint32_t max_inputs, + uint32_t max_outputs) { PinosTransportImpl *impl; PinosTransport *trans; diff --git a/pinos/client/transport.h b/pinos/client/transport.h index 2f415097a..7d6581273 100644 --- a/pinos/client/transport.h +++ b/pinos/client/transport.h @@ -37,9 +37,9 @@ typedef struct _PinosTransportArea PinosTransportArea; #include typedef struct { - int memfd; - off_t offset; - size_t size; + int memfd; + uint32_t offset; + uint32_t size; } PinosTransportInfo; /** @@ -48,10 +48,10 @@ typedef struct { * Shared structure between client and server */ struct _PinosTransportArea { - unsigned int max_inputs; - unsigned int n_inputs; - unsigned int max_outputs; - unsigned int n_outputs; + uint32_t max_inputs; + uint32_t n_inputs; + uint32_t max_outputs; + uint32_t n_outputs; }; struct _PinosTransport { @@ -67,8 +67,8 @@ struct _PinosTransport { SpaRingbuffer *output_buffer; }; -PinosTransport * pinos_transport_new (unsigned int max_inputs, - unsigned int max_outputs); +PinosTransport * pinos_transport_new (uint32_t max_inputs, + uint32_t max_outputs); PinosTransport * pinos_transport_new_from_info (PinosTransportInfo *info); void pinos_transport_destroy (PinosTransport *trans); diff --git a/pinos/gst/gstpinosformat.c b/pinos/gst/gstpinosformat.c index c4cfdd84c..5428ce66f 100644 --- a/pinos/gst/gstpinosformat.c +++ b/pinos/gst/gstpinosformat.c @@ -353,8 +353,8 @@ handle_audio_fields (ConvertData *d) return TRUE; } -static off_t -write_pod (SpaPODBuilder *b, off_t ref, const void *data, size_t size) +static uint32_t +write_pod (SpaPODBuilder *b, uint32_t ref, const void *data, uint32_t size) { if (ref == -1) ref = b->offset; diff --git a/pinos/gst/gstpinossink.c b/pinos/gst/gstpinossink.c index ce5f02b2c..e6df83acd 100644 --- a/pinos/gst/gstpinossink.c +++ b/pinos/gst/gstpinossink.c @@ -369,7 +369,7 @@ on_add_buffer (PinosListener *listener, GstPinosSink *pinossink = SPA_CONTAINER_OF (listener, GstPinosSink, stream_add_buffer); SpaBuffer *b; GstBuffer *buf; - unsigned int i; + uint32_t i; ProcessMemData data; GST_LOG_OBJECT (pinossink, "add buffer"); diff --git a/pinos/gst/gstpinossrc.c b/pinos/gst/gstpinossrc.c index 372d50bfd..5197ed80e 100644 --- a/pinos/gst/gstpinossrc.c +++ b/pinos/gst/gstpinossrc.c @@ -386,7 +386,7 @@ on_add_buffer (PinosListener *listener, GstPinosSrc *pinossrc = SPA_CONTAINER_OF (listener, GstPinosSrc, stream_add_buffer); SpaBuffer *b; GstBuffer *buf; - unsigned int i; + uint32_t i; ProcessMemData data; GST_LOG_OBJECT (pinossrc, "add buffer"); diff --git a/pinos/modules/module-protocol-native.c b/pinos/modules/module-protocol-native.c index e30312135..aa1c320f0 100644 --- a/pinos/modules/module-protocol-native.c +++ b/pinos/modules/module-protocol-native.c @@ -141,7 +141,7 @@ connection_data (SpaSource *source, PinosConnection *conn = client->connection; uint8_t opcode; uint32_t id; - size_t size; + uint32_t size; PinosClient *c = client->client; void *message; diff --git a/pinos/modules/spa/spa-monitor.c b/pinos/modules/spa/spa-monitor.c index e743bc2d9..88fc36ceb 100644 --- a/pinos/modules/spa/spa-monitor.c +++ b/pinos/modules/spa/spa-monitor.c @@ -84,7 +84,7 @@ add_item (PinosSpaMonitor *this, SpaMonitorItem *item) props = pinos_properties_new (NULL, NULL); if (item->info) { - unsigned int i; + uint32_t i; for (i = 0; i < item->info->n_items; i++) { pinos_properties_set (props, @@ -203,7 +203,7 @@ pinos_spa_monitor_load (PinosCore *core, SpaResult res; void *iface; void *hnd; - unsigned int index; + uint32_t index; SpaEnumHandleFactoryFunc enum_func; const SpaHandleFactory *factory; diff --git a/pinos/modules/spa/spa-node.c b/pinos/modules/spa/spa-node.c index a4099f182..94979db85 100644 --- a/pinos/modules/spa/spa-node.c +++ b/pinos/modules/spa/spa-node.c @@ -47,7 +47,7 @@ pinos_spa_node_load (PinosCore *core, SpaResult res; SpaHandle *handle; void *hnd; - unsigned int index; + uint32_t index; SpaEnumHandleFactoryFunc enum_func; const SpaHandleFactory *factory; void *iface; diff --git a/pinos/server/client-node.c b/pinos/server/client-node.c index 603196196..27dda088c 100644 --- a/pinos/server/client-node.c +++ b/pinos/server/client-node.c @@ -72,11 +72,11 @@ typedef struct { bool valid; SpaPortInfo *info; SpaFormat *format; - unsigned int n_formats; + uint32_t n_formats; SpaFormat **formats; void *io; - unsigned int n_buffers; + uint32_t n_buffers; ProxyBuffer buffers[MAX_BUFFERS]; uint32_t buffer_mem_id; @@ -101,10 +101,10 @@ struct _SpaProxy SpaSource data_source; - unsigned int max_inputs; - unsigned int n_inputs; - unsigned int max_outputs; - unsigned int n_outputs; + uint32_t max_inputs; + uint32_t n_inputs; + uint32_t max_outputs; + uint32_t n_outputs; SpaProxyPort in_ports[MAX_INPUTS]; SpaProxyPort out_ports[MAX_OUTPUTS]; @@ -254,10 +254,10 @@ spa_proxy_node_set_event_callback (SpaNode *node, static SpaResult spa_proxy_node_get_n_ports (SpaNode *node, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { SpaProxy *this; @@ -280,9 +280,9 @@ spa_proxy_node_get_n_ports (SpaNode *node, static SpaResult spa_proxy_node_get_port_ids (SpaNode *node, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { SpaProxy *this; @@ -313,14 +313,14 @@ do_update_port (SpaProxy *this, SpaDirection direction, uint32_t port_id, uint32_t change_mask, - unsigned int n_possible_formats, + uint32_t n_possible_formats, const SpaFormat **possible_formats, const SpaFormat *format, const SpaProps *props, const SpaPortInfo *info) { SpaProxyPort *port; - unsigned int i; + uint32_t i; size_t size; if (direction == SPA_DIRECTION_INPUT) { @@ -459,7 +459,7 @@ spa_proxy_node_port_enum_formats (SpaNode *node, uint32_t port_id, SpaFormat **format, const SpaFormat *filter, - unsigned int index) + uint32_t index) { SpaProxy *this; SpaProxyPort *port; @@ -630,7 +630,7 @@ spa_proxy_node_port_use_buffers (SpaNode *node, { SpaProxy *this; SpaProxyPort *port; - unsigned int i, j; + uint32_t i, j; size_t n_mem; PinosClientNodeBuffer *mb; SpaMetaShared *msh; @@ -886,8 +886,8 @@ handle_node_event (SpaProxy *this, static void client_node_update (void *object, uint32_t change_mask, - unsigned int max_input_ports, - unsigned int max_output_ports, + uint32_t max_input_ports, + uint32_t max_output_ports, const SpaProps *props) { PinosResource *resource = object; @@ -909,7 +909,7 @@ client_node_port_update (void *object, SpaDirection direction, uint32_t port_id, uint32_t change_mask, - unsigned int n_possible_formats, + uint32_t n_possible_formats, const SpaFormat **possible_formats, const SpaFormat *format, const SpaProps *props, @@ -1044,9 +1044,9 @@ static SpaResult proxy_init (SpaProxy *this, SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { - unsigned int i; + uint32_t i; for (i = 0; i < n_support; i++) { if (strcmp (support[i].uri, SPA_LOG_URI) == 0) @@ -1114,7 +1114,7 @@ on_global_added (PinosListener *listener, static SpaResult proxy_clear (SpaProxy *this) { - unsigned int i; + uint32_t i; for (i = 0; i < MAX_INPUTS; i++) { if (this->in_ports[i].valid) diff --git a/pinos/server/client.c b/pinos/server/client.c index 01d7d3fec..57f09f0f6 100644 --- a/pinos/server/client.c +++ b/pinos/server/client.c @@ -171,7 +171,7 @@ pinos_client_update_properties (PinosClient *client, if (dict) client->properties = pinos_properties_new_dict (dict); } else { - unsigned int i; + uint32_t i; for (i = 0; i < dict->n_items; i++) pinos_properties_set (client->properties, diff --git a/pinos/server/core.c b/pinos/server/core.c index d937b6bc9..e55fa8f53 100644 --- a/pinos/server/core.c +++ b/pinos/server/core.c @@ -435,7 +435,7 @@ pinos_core_update_properties (PinosCore *core, if (dict) core->properties = pinos_properties_new_dict (dict); } else if (dict != &core->properties->dict) { - unsigned int i; + uint32_t i; for (i = 0; i < dict->n_items; i++) pinos_properties_set (core->properties, @@ -456,7 +456,7 @@ pinos_core_find_port (PinosCore *core, PinosPort *other_port, uint32_t id, PinosProperties *props, - unsigned int n_format_filters, + uint32_t n_format_filters, SpaFormat **format_filters, char **error) { @@ -520,14 +520,14 @@ pinos_core_find_format (PinosCore *core, PinosPort *output, PinosPort *input, PinosProperties *props, - unsigned int n_format_filters, + uint32_t n_format_filters, SpaFormat **format_filterss, char **error) { SpaNodeState out_state, in_state; SpaResult res; SpaFormat *filter = NULL, *format; - unsigned int iidx = 0, oidx = 0; + uint32_t iidx = 0, oidx = 0; out_state = output->node->node->state; in_state = input->node->node->state; diff --git a/pinos/server/core.h b/pinos/server/core.h index 82f1a8b7f..93788902e 100644 --- a/pinos/server/core.h +++ b/pinos/server/core.h @@ -85,7 +85,7 @@ struct _PinosCore { PinosDataLoop *data_loop; SpaSupport *support; - unsigned int n_support; + uint32_t n_support; PINOS_SIGNAL (destroy_signal, (PinosListener *listener, PinosCore *core)); @@ -122,7 +122,7 @@ SpaFormat * pinos_core_find_format (PinosCore *core, PinosPort *output, PinosPort *input, PinosProperties *props, - unsigned int n_format_filters, + uint32_t n_format_filters, SpaFormat **format_filters, char **error); @@ -130,7 +130,7 @@ PinosPort * pinos_core_find_port (PinosCore *core, PinosPort *other_port, uint32_t id, PinosProperties *props, - unsigned int n_format_filters, + uint32_t n_format_filters, SpaFormat **format_filters, char **error); diff --git a/pinos/server/link.c b/pinos/server/link.c index 61630533b..39b6e0b38 100644 --- a/pinos/server/link.c +++ b/pinos/server/link.c @@ -49,7 +49,7 @@ typedef struct bool allocated; PinosMemblock buffer_mem; SpaBuffer **buffers; - unsigned int n_buffers; + uint32_t n_buffers; } PinosLinkImpl; static void @@ -142,7 +142,7 @@ error: static void * find_param (const SpaPortInfo *info, SpaAllocParamType type) { - unsigned int i; + uint32_t i; for (i = 0; i < info->n_params; i++) { if (info->params[i]->type == type) @@ -154,7 +154,7 @@ find_param (const SpaPortInfo *info, SpaAllocParamType type) static void * find_meta_enable (const SpaPortInfo *info, SpaMetaType type) { - unsigned int i; + uint32_t i; for (i = 0; i < info->n_params; i++) { 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 ** alloc_buffers (PinosLink *this, - unsigned int n_buffers, - unsigned int n_params, + uint32_t n_buffers, + uint32_t n_params, SpaAllocParam **params, - unsigned int n_datas, + uint32_t n_datas, size_t *data_sizes, ssize_t *data_strides, PinosMemblock *mem) { SpaBuffer **buffers, *bp; - unsigned int i; + uint32_t i; size_t skel_size, data_size, meta_size; SpaChunk *cdp; void *ddp; - unsigned int n_metas; + uint32_t n_metas; SpaMeta *metas; 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) { SpaAllocParamBuffers *in_alloc, *out_alloc; SpaAllocParamMetaEnableRingbuffer *in_me, *out_me; - unsigned int max_buffers; + uint32_t max_buffers; size_t minsize, stride, blocks; in_me = find_meta_enable (iinfo, SPA_META_TYPE_RINGBUFFER); diff --git a/pinos/server/link.h b/pinos/server/link.h index c9eb161f4..d8699b362 100644 --- a/pinos/server/link.h +++ b/pinos/server/link.h @@ -69,7 +69,7 @@ struct _PinosLink { PinosPort *port)); struct { - unsigned int in_ready; + uint32_t in_ready; PinosPort *input; PinosPort *output; SpaList input_link; diff --git a/pinos/server/node.c b/pinos/server/node.c index ccb8689e7..64a05ce23 100644 --- a/pinos/server/node.c +++ b/pinos/server/node.c @@ -45,8 +45,8 @@ update_port_ids (PinosNode *node, bool create) { PinosNodeImpl *impl = SPA_CONTAINER_OF (node, PinosNodeImpl, this); uint32_t *input_port_ids, *output_port_ids; - unsigned int n_input_ports, n_output_ports, max_input_ports, max_output_ports; - unsigned int i; + uint32_t n_input_ports, n_output_ports, max_input_ports, max_output_ports; + uint32_t i; SpaList *ports; if (node->node == NULL) @@ -524,7 +524,7 @@ pinos_node_new (PinosCore *core, spa_list_init (&this->output_ports); if (this->node->info) { - unsigned int i; + uint32_t i; if (this->properties == NULL) this->properties = pinos_properties_new (NULL, NULL); @@ -681,7 +681,7 @@ PinosPort * pinos_node_get_free_port (PinosNode *node, PinosDirection direction) { - unsigned int n_ports, max_ports; + uint32_t n_ports, max_ports; SpaList *ports; PinosPort *port = NULL, *p; diff --git a/pinos/server/node.h b/pinos/server/node.h index 1fd0ea8f0..c03b4a2a5 100644 --- a/pinos/server/node.h +++ b/pinos/server/node.h @@ -81,8 +81,8 @@ struct _PinosNode { PinosPort **input_port_map; PinosPort **output_port_map; - unsigned int n_used_output_links; - unsigned int n_used_input_links; + uint32_t n_used_output_links; + uint32_t n_used_input_links; PinosTransport *transport; PINOS_SIGNAL (transport_changed, (PinosListener *listener, diff --git a/pinos/server/port.h b/pinos/server/port.h index 12925523e..bf97850b1 100644 --- a/pinos/server/port.h +++ b/pinos/server/port.h @@ -49,7 +49,7 @@ struct _PinosPort { bool allocated; PinosMemblock buffer_mem; SpaBuffer **buffers; - unsigned int n_buffers; + uint32_t n_buffers; SpaList links; diff --git a/pinos/server/protocol-native.c b/pinos/server/protocol-native.c index 2f7e69016..239d926b4 100644 --- a/pinos/server/protocol-native.c +++ b/pinos/server/protocol-native.c @@ -27,8 +27,8 @@ typedef struct { PinosConnection *connection; } Builder; -static off_t -write_pod (SpaPODBuilder *b, off_t ref, const void *data, size_t size) +static uint32_t +write_pod (SpaPODBuilder *b, uint32_t ref, const void *data, uint32_t size) { if (ref == -1) ref = b->offset; @@ -512,7 +512,7 @@ static void client_node_marshal_set_property (void *object, uint32_t seq, uint32_t id, - size_t size, + uint32_t size, const void *value) { PinosResource *resource = object; @@ -537,8 +537,8 @@ client_node_marshal_add_mem (void *object, SpaDataType type, int memfd, uint32_t flags, - off_t offset, - size_t size) + uint32_t offset, + uint32_t size) { PinosResource *resource = object; PinosConnection *connection = resource->client->protocol_private; @@ -564,7 +564,7 @@ client_node_marshal_use_buffers (void *object, uint32_t seq, SpaDirection direction, uint32_t port_id, - unsigned int n_buffers, + uint32_t n_buffers, PinosClientNodeBuffer *buffers) { PinosResource *resource = object; @@ -645,8 +645,8 @@ client_node_marshal_port_command (void *object, static void client_node_marshal_transport (void *object, int memfd, - off_t offset, - size_t size) + uint32_t offset, + uint32_t size) { PinosResource *resource = object; PinosConnection *connection = resource->client->protocol_private; diff --git a/spa/include/spa/buffer.h b/spa/include/spa/buffer.h index 34d5b7a8b..c39913578 100644 --- a/spa/include/spa/buffer.h +++ b/spa/include/spa/buffer.h @@ -109,8 +109,8 @@ typedef struct { * @height */ typedef struct { - int x, y; - int width, height; + int32_t x, y; + int32_t width, height; } SpaMetaVideoCrop; /** @@ -130,10 +130,10 @@ typedef struct { */ typedef struct { SpaDataType type; - int flags; + int32_t flags; int fd; - off_t offset; - size_t size; + int32_t offset; + uint32_t size; } SpaMetaShared; /** @@ -145,7 +145,7 @@ typedef struct { typedef struct { SpaMetaType type; void *data; - size_t size; + uint32_t size; } SpaMeta; /** @@ -155,9 +155,9 @@ typedef struct { * @stride: stride of data if applicable */ typedef struct { - off_t offset; - size_t size; - ssize_t stride; + uint32_t offset; + uint32_t size; + int32_t stride; } SpaChunk; /** @@ -172,10 +172,10 @@ typedef struct { */ typedef struct { SpaDataType type; - int flags; + uint32_t flags; int fd; - off_t mapoffset; - size_t maxsize; + uint32_t mapoffset; + uint32_t maxsize; void *data; SpaChunk *chunk; } SpaData; @@ -190,22 +190,17 @@ typedef struct { */ struct _SpaBuffer { uint32_t id; - unsigned int n_metas; + uint32_t n_metas; SpaMeta *metas; - unsigned int n_datas; + uint32_t n_datas; SpaData *datas; }; -typedef struct { - unsigned int n_buffers; - SpaBuffer **buffers; -} SpaBufferArray; - static inline void * spa_buffer_find_meta (SpaBuffer *b, SpaMetaType type) { - unsigned int i; + uint32_t i; for (i = 0; i < b->n_metas; i++) if (b->metas[i].type == type) @@ -213,10 +208,10 @@ spa_buffer_find_meta (SpaBuffer *b, SpaMetaType type) return NULL; } -static inline size_t +static inline uint32_t spa_meta_type_get_size (SpaMetaType type) { - static const size_t header_sizes[] = { + static const uint32_t header_sizes[] = { 0, sizeof (SpaMetaHeader), sizeof (SpaMetaPointer), diff --git a/spa/include/spa/dict.h b/spa/include/spa/dict.h index 18c221208..924786df4 100644 --- a/spa/include/spa/dict.h +++ b/spa/include/spa/dict.h @@ -36,7 +36,7 @@ typedef struct { } SpaDictItem; struct _SpaDict { - unsigned int n_items; + uint32_t n_items; SpaDictItem *items; }; diff --git a/spa/include/spa/format-builder.h b/spa/include/spa/format-builder.h index b295e37dd..252e7ddf4 100644 --- a/spa/include/spa/format-builder.h +++ b/spa/include/spa/format-builder.h @@ -29,7 +29,7 @@ extern "C" { #include #include -static inline off_t +static inline uint32_t spa_pod_builder_push_format (SpaPODBuilder *builder, SpaPODFrame *frame, uint32_t media_type, @@ -43,7 +43,7 @@ spa_pod_builder_push_format (SpaPODBuilder *builder, spa_pod_builder_raw (builder, &p, sizeof(p), false)); } -static inline off_t +static inline uint32_t spa_pod_builder_format (SpaPODBuilder *builder, uint32_t media_type, uint32_t media_subtype, @@ -51,7 +51,7 @@ spa_pod_builder_format (SpaPODBuilder *builder, { SpaPODFrame f; va_list args; - off_t off; + uint32_t off; off = spa_pod_builder_push_format (builder, &f, media_type, media_subtype); diff --git a/spa/include/spa/id-map.h b/spa/include/spa/id-map.h index 1549f1459..5dfb08c23 100644 --- a/spa/include/spa/id-map.h +++ b/spa/include/spa/id-map.h @@ -39,7 +39,7 @@ typedef struct _SpaIDMap SpaIDMap; struct _SpaIDMap { /* the total size of this structure. This can be used to expand this * structure in the future */ - size_t size; + const size_t size; /** * SpaIDMap::info * diff --git a/spa/include/spa/monitor.h b/spa/include/spa/monitor.h index 8c990921c..864ef26c2 100644 --- a/spa/include/spa/monitor.h +++ b/spa/include/spa/monitor.h @@ -49,7 +49,7 @@ typedef enum { typedef struct { SpaMonitorEventType type; - size_t size; + uint32_t size; } SpaMonitorEvent; typedef enum { @@ -126,7 +126,7 @@ struct _SpaMonitor { SpaResult (*enum_items) (SpaMonitor *monitor, SpaMonitorItem **item, - unsigned int index); + uint32_t index); }; diff --git a/spa/include/spa/node-command.h b/spa/include/spa/node-command.h index 77d243ded..9bc7b0eeb 100644 --- a/spa/include/spa/node-command.h +++ b/spa/include/spa/node-command.h @@ -51,7 +51,7 @@ typedef enum { struct _SpaNodeCommand { SpaNodeCommandType type; - size_t size; + uint32_t size; }; /** diff --git a/spa/include/spa/node-event.h b/spa/include/spa/node-event.h index dff1f8f57..6256a21b4 100644 --- a/spa/include/spa/node-event.h +++ b/spa/include/spa/node-event.h @@ -67,7 +67,7 @@ typedef enum { struct _SpaNodeEvent { SpaNodeEventType type; - size_t size; + uint32_t size; }; typedef struct { diff --git a/spa/include/spa/node.h b/spa/include/spa/node.h index dcd3edffc..1675ac843 100644 --- a/spa/include/spa/node.h +++ b/spa/include/spa/node.h @@ -270,10 +270,10 @@ struct _SpaNode { * #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL */ SpaResult (*get_n_ports) (SpaNode *node, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports); + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports); /** * SpaNode::get_port_ids: * @node: a #SpaNode @@ -290,9 +290,9 @@ struct _SpaNode { * #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL */ SpaResult (*get_port_ids) (SpaNode *node, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids); /** @@ -350,7 +350,7 @@ struct _SpaNode { uint32_t port_id, SpaFormat **format, const SpaFormat *filter, - unsigned int index); + uint32_t index); /** * SpaNode::port_set_format: * @node: a #SpaNode @@ -459,7 +459,7 @@ struct _SpaNode { SpaDirection direction, uint32_t port_id, SpaBuffer **buffers, - unsigned int n_buffers); + uint32_t n_buffers); /** * SpaNode::port_alloc_buffers: * @node: a #SpaNode @@ -499,9 +499,9 @@ struct _SpaNode { SpaDirection direction, uint32_t port_id, SpaAllocParam **params, - unsigned int n_params, + uint32_t n_params, SpaBuffer **buffers, - unsigned int *n_buffers); + uint32_t *n_buffers); /** * SpaNode::port_set_input: diff --git a/spa/include/spa/plugin.h b/spa/include/spa/plugin.h index 05a12eaf3..eb1f08901 100644 --- a/spa/include/spa/plugin.h +++ b/spa/include/spa/plugin.h @@ -130,7 +130,7 @@ struct _SpaHandleFactory { SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support); + uint32_t n_support); /** * SpaHandle::enum_interface_info: @@ -147,7 +147,7 @@ struct _SpaHandleFactory { */ SpaResult (*enum_interface_info) (const SpaHandleFactory *factory, const SpaInterfaceInfo **info, - unsigned int index); + uint32_t index); }; #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 */ typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory, - unsigned int index); + uint32_t index); /** * spa_enum_handle_factory: @@ -179,7 +179,7 @@ typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory, * #SPA_RESULT_ENUM_END when there are no more factories */ SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory, - unsigned int index); + uint32_t index); #ifdef __cplusplus } /* extern "C" */ diff --git a/spa/include/spa/pod-builder.h b/spa/include/spa/pod-builder.h index 79c2cfa6f..b781ace57 100644 --- a/spa/include/spa/pod-builder.h +++ b/spa/include/spa/pod-builder.h @@ -30,15 +30,15 @@ extern "C" { typedef struct _SpaPODFrame { struct _SpaPODFrame *parent; SpaPOD pod; - off_t ref; + uint32_t ref; } SpaPODFrame; typedef struct _SpaPODBuilder { void *data; - size_t size; - off_t offset; + uint32_t size; + uint32_t offset; 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; #define SPA_POD_BUILDER_DEREF(b,ref,type) SPA_MEMBER ((b)->data, (ref), type) @@ -46,7 +46,7 @@ typedef struct _SpaPODBuilder { static inline void spa_pod_builder_init (SpaPODBuilder *builder, void *data, - size_t size) + uint32_t size) { builder->data = data; builder->size = size; @@ -71,11 +71,11 @@ spa_pod_builder_in_array (SpaPODBuilder *builder, bool *first) return false; } -static inline off_t +static inline uint32_t spa_pod_builder_push (SpaPODBuilder *builder, SpaPODFrame *frame, const SpaPOD *pod, - off_t ref) + uint32_t ref) { frame->parent = builder->stack; 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); } -static inline off_t +static inline uint32_t spa_pod_builder_raw (SpaPODBuilder *builder, const void *data, uint32_t size, bool pad) { - off_t ref; + uint32_t ref; if (builder->write) { 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; } -static inline off_t +static inline uint32_t spa_pod_builder_string_body (SpaPODBuilder *builder, const char *str, 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) *SPA_MEMBER (builder->data, out + len, char) = '\0'; return out; } -static inline off_t +static inline uint32_t spa_pod_builder_pod (SpaPODBuilder *builder, uint32_t size, uint32_t type) { const SpaPOD p = { size, type }; 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) { const void *data; - size_t size; + uint32_t size; bool in_array, first = false; 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); } -static inline off_t +static inline uint32_t spa_pod_builder_bool (SpaPODBuilder *builder, bool val) { const SpaPODBool p = { { sizeof (uint32_t), SPA_POD_TYPE_BOOL }, val ? 1 : 0 }; 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) { const SpaPODURI p = { { sizeof (uint32_t), SPA_POD_TYPE_URI }, val }; 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) { const SpaPODInt p = { { sizeof (uint32_t), SPA_POD_TYPE_INT }, val }; 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) { const SpaPODLong p = { { sizeof (val), SPA_POD_TYPE_LONG }, val }; return spa_pod_builder_primitive (builder, &p.pod); } -static inline off_t +static inline uint32_t spa_pod_builder_float (SpaPODBuilder *builder, float val) { const SpaPODFloat p = { { sizeof (val), SPA_POD_TYPE_FLOAT }, val }; return spa_pod_builder_primitive (builder, &p.pod); } -static inline off_t +static inline uint32_t spa_pod_builder_double (SpaPODBuilder *builder, double val) { const SpaPODDouble p = { { sizeof (val), SPA_POD_TYPE_DOUBLE }, val }; 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) { 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) out = -1; return out; } -static inline off_t +static inline uint32_t spa_pod_builder_string (SpaPODBuilder *builder, const char *str) { uint32_t len = str ? strlen (str) : 0; 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) { 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) out = -1; return out; } -static inline off_t +static inline uint32_t spa_pod_builder_rectangle (SpaPODBuilder *builder, uint32_t width, uint32_t height) { const SpaPODRectangle p = { { sizeof (SpaRectangle), SPA_POD_TYPE_RECTANGLE }, { width, height } }; 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) { const SpaPODFraction p = { { sizeof (SpaFraction), SPA_POD_TYPE_FRACTION }, { num, denom } }; return spa_pod_builder_primitive (builder, &p.pod); } -static inline off_t +static inline uint32_t spa_pod_builder_push_array (SpaPODBuilder *builder, SpaPODFrame *frame) { @@ -260,7 +260,7 @@ spa_pod_builder_push_array (SpaPODBuilder *builder, 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, uint32_t child_size, 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 }, { { 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) out = -1; return out; } -static inline off_t +static inline uint32_t spa_pod_builder_push_struct (SpaPODBuilder *builder, SpaPODFrame *frame) { @@ -286,7 +286,7 @@ spa_pod_builder_push_struct (SpaPODBuilder *builder, spa_pod_builder_raw (builder, &p, sizeof(p), false)); } -static inline off_t +static inline uint32_t spa_pod_builder_push_object (SpaPODBuilder *builder, SpaPODFrame *frame, uint32_t id, @@ -297,7 +297,7 @@ spa_pod_builder_push_object (SpaPODBuilder *builder, spa_pod_builder_raw (builder, &p, sizeof(p), false)); } -static inline off_t +static inline uint32_t spa_pod_builder_push_prop (SpaPODBuilder *builder, SpaPODFrame *frame, uint32_t key, @@ -315,10 +315,10 @@ spa_pod_builder_propv (SpaPODBuilder *builder, va_list args) { while (propid != 0) { - int type, n_alternatives = -1; + uint32_t type, n_alternatives = -1; SpaPODProp *prop = NULL; SpaPODFrame f; - off_t off; + uint32_t off; if ((off = spa_pod_builder_push_prop (builder, &f, propid, SPA_POD_PROP_FLAG_READWRITE)) != -1) prop = SPA_MEMBER (builder->data, off, SpaPODProp); diff --git a/spa/include/spa/pod-iter.h b/spa/include/spa/pod-iter.h new file mode 100644 index 000000000..765f1b293 --- /dev/null +++ b/spa/include/spa/pod-iter.h @@ -0,0 +1,177 @@ +/* Simple Plugin API + * Copyright (C) 2017 Wim Taymans + * + * 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 + +#include +#include + +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__ */ diff --git a/spa/include/spa/pod.h b/spa/include/spa/pod.h index 12b4d85c8..cff87fca6 100644 --- a/spa/include/spa/pod.h +++ b/spa/include/spa/pod.h @@ -57,6 +57,7 @@ typedef struct { } SpaPOD; #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_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) \ - for ((iter) = SPA_MEMBER (body, sizeof(SpaPODArrayBody), __typeof__(*iter)); \ - (iter) < SPA_MEMBER (body, (size), __typeof__(*iter)); \ - (iter) = SPA_MEMBER ((iter), (body)->child.size, __typeof__(*iter))) +#define SPA_POD_ARRAY_BODY_FOREACH(body, _size, iter) \ + for ((iter) = SPA_MEMBER ((body), sizeof(SpaPODArrayBody), __typeof__(*(iter))); \ + (iter) < SPA_MEMBER ((body), (_size), __typeof__(*(iter))); \ + (iter) = SPA_MEMBER ((iter), (body)->child.size, __typeof__(*(iter)))) #define SPA_POD_FOREACH(pod, size, iter) \ 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))) 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; SPA_POD_CONTENTS_FOREACH (pod, offset, res) { diff --git a/spa/include/spa/port.h b/spa/include/spa/port.h index f5b36580b..a5909f10f 100644 --- a/spa/include/spa/port.h +++ b/spa/include/spa/port.h @@ -53,13 +53,13 @@ typedef enum { struct _SpaAllocParam { uint32_t type; - size_t size; + uint32_t size; }; typedef struct { SpaAllocParam param; - size_t minsize; - size_t stride; + uint32_t minsize; + int32_t stride; uint32_t min_buffers; uint32_t max_buffers; uint32_t align; @@ -73,19 +73,19 @@ typedef struct { typedef struct { SpaAllocParam param; SpaMetaType type; - size_t minsize; - size_t stride; - size_t blocks; + uint32_t minsize; + int32_t stride; + uint32_t blocks; uint32_t align; } SpaAllocParamMetaEnableRingbuffer; typedef struct { SpaAllocParam param; - unsigned int padding_top; - unsigned int padding_bottom; - unsigned int padding_left; - unsigned int padding_right; - unsigned int stride_align[4]; + uint32_t padding_top; + uint32_t padding_bottom; + uint32_t padding_left; + uint32_t padding_right; + uint32_t stride_align[4]; } SpaAllocParamVideoPadding; /** @@ -128,7 +128,7 @@ typedef struct { uint64_t maxbuffering; uint64_t latency; SpaAllocParam **params; - unsigned int n_params; + uint32_t n_params; SpaDict *extra; } SpaPortInfo; diff --git a/spa/include/spa/props.h b/spa/include/spa/props.h index d14768a05..daf114ef0 100644 --- a/spa/include/spa/props.h +++ b/spa/include/spa/props.h @@ -33,20 +33,20 @@ typedef SpaPODObject SpaProps; #define SPA_PROPS_PREFIX SPA_PROPS_URI "#" -static inline off_t +static inline uint32_t spa_pod_builder_push_props (SpaPODBuilder *builder, SpaPODFrame *frame) { return spa_pod_builder_push_object (builder, frame, 0, 0); } -static inline off_t +static inline uint32_t spa_pod_builder_props (SpaPODBuilder *builder, uint32_t propid, ...) { SpaPODFrame f; va_list args; - off_t off; + uint32_t off; off = spa_pod_builder_push_props (builder, &f); diff --git a/spa/include/spa/ringbuffer.h b/spa/include/spa/ringbuffer.h index f206dd7b9..941bb684d 100644 --- a/spa/include/spa/ringbuffer.h +++ b/spa/include/spa/ringbuffer.h @@ -35,8 +35,8 @@ typedef struct _SpaRingbuffer SpaRingbuffer; #include typedef struct { - off_t offset; - size_t len; + uint32_t offset; + uint32_t len; } SpaRingbufferArea; /** @@ -47,11 +47,11 @@ typedef struct { * @size_mask: mask if @size is power of 2 */ struct _SpaRingbuffer { - volatile size_t readindex; - volatile size_t writeindex; - size_t size; - size_t mask; - size_t mask2; + volatile uint32_t readindex; + volatile uint32_t writeindex; + uint32_t size; + uint32_t mask; + uint32_t mask2; }; /** @@ -67,7 +67,7 @@ struct _SpaRingbuffer { */ static inline SpaResult spa_ringbuffer_init (SpaRingbuffer *rbuf, - size_t size) + uint32_t size) { if (SPA_UNLIKELY ((size & (size - 1)) != 0)) return SPA_RESULT_ERROR; @@ -94,11 +94,11 @@ spa_ringbuffer_clear (SpaRingbuffer *rbuf) rbuf->writeindex = 0; } -static inline size_t +static inline uint32_t spa_ringbuffer_get_read_offset (SpaRingbuffer *rbuf, - size_t *offset) + uint32_t *offset) { - size_t avail, r; + uint32_t avail, r; r = rbuf->readindex; *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 * 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, SpaRingbufferArea areas[2]) { - size_t avail, end, r; + uint32_t avail, end, r; avail = spa_ringbuffer_get_read_offset (rbuf, &r); end = r + avail; @@ -144,7 +144,7 @@ spa_ringbuffer_read_data (SpaRingbuffer *rbuf, void *buffer, SpaRingbufferArea areas[2], void *data, - size_t size) + uint32_t size) { if (SPA_LIKELY (size < areas[0].len)) memcpy (data, buffer + areas[0].offset, size); @@ -163,17 +163,17 @@ spa_ringbuffer_read_data (SpaRingbuffer *rbuf, */ static inline void spa_ringbuffer_read_advance (SpaRingbuffer *rbuf, - ssize_t len) + int32_t len) { spa_barrier_full(); rbuf->readindex = (rbuf->readindex + len) & rbuf->mask2; } -static inline size_t +static inline uint32_t spa_ringbuffer_get_write_offset (SpaRingbuffer *rbuf, - size_t *offset) + uint32_t *offset) { - size_t avail, w; + uint32_t avail, w; w = rbuf->writeindex; *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 * 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, SpaRingbufferArea areas[2]) { - size_t avail, end, w; + uint32_t avail, end, w; avail = spa_ringbuffer_get_write_offset (rbuf, &w); end = w + avail; @@ -218,7 +218,7 @@ spa_ringbuffer_write_data (SpaRingbuffer *rbuf, void *buffer, SpaRingbufferArea areas[2], void *data, - size_t size) + uint32_t size) { if (SPA_LIKELY (size < areas[0].len)) memcpy (buffer + areas[0].offset, data, size); @@ -238,7 +238,7 @@ spa_ringbuffer_write_data (SpaRingbuffer *rbuf, */ static inline void spa_ringbuffer_write_advance (SpaRingbuffer *rbuf, - ssize_t len) + int32_t len) { spa_barrier_write(); rbuf->writeindex = (rbuf->writeindex + len) & rbuf->mask2; diff --git a/spa/include/spa/video/raw.h b/spa/include/spa/video/raw.h index 4e468c356..e7b56e66e 100644 --- a/spa/include/spa/video/raw.h +++ b/spa/include/spa/video/raw.h @@ -171,7 +171,7 @@ struct _SpaVideoInfoRaw { SpaRectangle size; SpaFraction framerate; SpaFraction max_framerate; - unsigned int views; + uint32_t views; SpaVideoInterlaceMode interlace_mode; SpaFraction pixel_aspect_ratio; SpaVideoMultiviewMode multiview_mode; diff --git a/spa/lib/debug.c b/spa/lib/debug.c index 5959688cd..95bfc0ad8 100644 --- a/spa/lib/debug.c +++ b/spa/lib/debug.c @@ -61,7 +61,7 @@ spa_debug_port_info (const SpaPortInfo *info) fprintf (stderr, " n_params: \t%d\n", info->n_params); for (i = 0; i < info->n_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) { case SPA_ALLOC_PARAM_TYPE_INVALID: fprintf (stderr, " INVALID\n"); @@ -70,8 +70,8 @@ spa_debug_port_info (const SpaPortInfo *info) { SpaAllocParamBuffers *p = (SpaAllocParamBuffers *)param; fprintf (stderr, " SpaAllocParamBuffers:\n"); - fprintf (stderr, " minsize: \t\t%zd\n", p->minsize); - fprintf (stderr, " stride: \t\t%zd\n", p->stride); + fprintf (stderr, " minsize: \t\t%d\n", p->minsize); + fprintf (stderr, " stride: \t\t%d\n", p->stride); fprintf (stderr, " min_buffers: \t%d\n", p->min_buffers); fprintf (stderr, " max_buffers: \t%d\n", p->max_buffers); 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: { SpaAllocParamMetaEnableRingbuffer *rb = (SpaAllocParamMetaEnableRingbuffer *)p; - fprintf (stderr, " minsize: \t\t%zd\n", rb->minsize); - fprintf (stderr, " stride: \t\t%zd\n", rb->stride); - fprintf (stderr, " blocks: \t\t%zd\n", rb->blocks); + fprintf (stderr, " minsize: \t\t%d\n", rb->minsize); + fprintf (stderr, " stride: \t\t%d\n", rb->stride); + fprintf (stderr, " blocks: \t\t%d\n", rb->blocks); fprintf (stderr, " align: \t\t%d\n", rb->align); break; } @@ -130,7 +130,7 @@ spa_debug_buffer (const SpaBuffer *buffer) fprintf (stderr, " n_metas: %u (at %p)\n", buffer->n_metas, buffer->metas); for (i = 0; i < buffer->n_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) { case SPA_META_TYPE_HEADER: { @@ -165,11 +165,11 @@ spa_debug_buffer (const SpaBuffer *buffer) { SpaMetaRingbuffer *h = m->data; fprintf (stderr, " SpaMetaRingbuffer:\n"); - fprintf (stderr, " readindex: %zd\n", h->ringbuffer.readindex); - fprintf (stderr, " writeindex: %zd\n", h->ringbuffer.writeindex); - fprintf (stderr, " size: %zd\n", h->ringbuffer.size); - fprintf (stderr, " mask: %zd\n", h->ringbuffer.mask); - fprintf (stderr, " mask2: %zd\n", h->ringbuffer.mask2); + fprintf (stderr, " readindex: %d\n", h->ringbuffer.readindex); + fprintf (stderr, " writeindex: %d\n", h->ringbuffer.writeindex); + fprintf (stderr, " size: %d\n", h->ringbuffer.size); + fprintf (stderr, " mask: %d\n", h->ringbuffer.mask); + fprintf (stderr, " mask2: %d\n", h->ringbuffer.mask2); break; } case SPA_META_TYPE_SHARED: @@ -179,8 +179,8 @@ spa_debug_buffer (const SpaBuffer *buffer) fprintf (stderr, " type: %d\n", h->type); fprintf (stderr, " flags: %d\n", h->flags); fprintf (stderr, " fd: %d\n", h->fd); - fprintf (stderr, " offset: %zd\n", h->offset); - fprintf (stderr, " size: %zd\n", h->size); + fprintf (stderr, " offset: %d\n", h->offset); + fprintf (stderr, " size: %d\n", h->size); break; } default: @@ -195,12 +195,12 @@ spa_debug_buffer (const SpaBuffer *buffer) fprintf (stderr, " flags: %d\n", d->flags); fprintf (stderr, " data: %p\n", d->data); fprintf (stderr, " fd: %d\n", d->fd); - fprintf (stderr, " offset: %zd\n", d->mapoffset); - fprintf (stderr, " maxsize: %zu\n", d->maxsize); + fprintf (stderr, " offset: %d\n", d->mapoffset); + fprintf (stderr, " maxsize: %u\n", d->maxsize); fprintf (stderr, " chunk: %p\n", d->chunk); - fprintf (stderr, " offset: %zd\n", d->chunk->offset); - fprintf (stderr, " size: %zu\n", d->chunk->size); - fprintf (stderr, " stride: %zd\n", d->chunk->stride); + fprintf (stderr, " offset: %d\n", d->chunk->offset); + fprintf (stderr, " size: %u\n", d->chunk->size); + fprintf (stderr, " stride: %d\n", d->chunk->stride); } return SPA_RESULT_OK; } diff --git a/spa/lib/props.c b/spa/lib/props.c index 80f10acfb..65afa6e62 100644 --- a/spa/lib/props.c +++ b/spa/lib/props.c @@ -24,89 +24,6 @@ #include -#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 compare_value (SpaPODType type, const void *r1, const void *r2) { diff --git a/spa/plugins/alsa/alsa-monitor.c b/spa/plugins/alsa/alsa-monitor.c index 2a1d045b2..bd557e0a9 100644 --- a/spa/plugins/alsa/alsa-monitor.c +++ b/spa/plugins/alsa/alsa-monitor.c @@ -64,7 +64,7 @@ struct _SpaALSAMonitor { struct udev* udev; struct udev_monitor *umonitor; struct udev_enumerate *enumerate; - unsigned int index; + uint32_t index; struct udev_list_entry *devices; ALSAItem uitem; @@ -107,7 +107,7 @@ static int fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice) { int err; - unsigned int i; + uint32_t i; const char *str; snd_pcm_t *hndl; char device[64]; @@ -319,7 +319,7 @@ spa_alsa_monitor_set_event_callback (SpaMonitor *monitor, static SpaResult spa_alsa_monitor_enum_items (SpaMonitor *monitor, SpaMonitorItem **item, - unsigned int index) + uint32_t index) { SpaResult res; SpaALSAMonitor *this; @@ -407,10 +407,10 @@ alsa_monitor_init (const SpaHandleFactory *factory, SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { SpaALSAMonitor *this; - unsigned int i; + uint32_t i; if (factory == NULL || handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -451,7 +451,7 @@ static const SpaInterfaceInfo alsa_monitor_interfaces[] = static SpaResult alsa_monitor_enum_interface_info (const SpaHandleFactory *factory, const SpaInterfaceInfo **info, - unsigned int index) + uint32_t index) { if (factory == NULL || info == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/alsa/alsa-sink.c b/spa/plugins/alsa/alsa-sink.c index 79be2d8d4..1212747b8 100644 --- a/spa/plugins/alsa/alsa-sink.c +++ b/spa/plugins/alsa/alsa-sink.c @@ -263,10 +263,10 @@ spa_alsa_sink_node_set_event_callback (SpaNode *node, static SpaResult spa_alsa_sink_node_get_n_ports (SpaNode *node, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -285,9 +285,9 @@ spa_alsa_sink_node_get_n_ports (SpaNode *node, static SpaResult spa_alsa_sink_node_get_port_ids (SpaNode *node, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { if (node == NULL) @@ -322,7 +322,7 @@ spa_alsa_sink_node_port_enum_formats (SpaNode *node, uint32_t port_id, SpaFormat **format, const SpaFormat *filter, - unsigned int index) + uint32_t index) { SpaALSASink *this; SpaResult res; @@ -795,10 +795,10 @@ alsa_sink_init (const SpaHandleFactory *factory, SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { SpaALSASink *this; - unsigned int i; + uint32_t i; if (factory == NULL || handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -849,7 +849,7 @@ static const SpaInterfaceInfo alsa_sink_interfaces[] = static SpaResult alsa_sink_enum_interface_info (const SpaHandleFactory *factory, const SpaInterfaceInfo **info, - unsigned int index) + uint32_t index) { if (factory == NULL || info == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/alsa/alsa-source.c b/spa/plugins/alsa/alsa-source.c index 92c82a562..983e1789c 100644 --- a/spa/plugins/alsa/alsa-source.c +++ b/spa/plugins/alsa/alsa-source.c @@ -298,10 +298,10 @@ spa_alsa_source_node_set_event_callback (SpaNode *node, static SpaResult spa_alsa_source_node_get_n_ports (SpaNode *node, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -320,9 +320,9 @@ spa_alsa_source_node_get_n_ports (SpaNode *node, static SpaResult spa_alsa_source_node_get_port_ids (SpaNode *node, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { if (node == NULL) @@ -357,7 +357,7 @@ spa_alsa_source_node_port_enum_formats (SpaNode *node, uint32_t port_id, SpaFormat **format, const SpaFormat *filter, - unsigned int index) + uint32_t index) { SpaALSASource *this; SpaResult res; @@ -859,10 +859,10 @@ alsa_source_init (const SpaHandleFactory *factory, SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { SpaALSASource *this; - unsigned int i; + uint32_t i; if (factory == NULL || handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -917,7 +917,7 @@ static const SpaInterfaceInfo alsa_source_interfaces[] = static SpaResult alsa_source_enum_interface_info (const SpaHandleFactory *factory, const SpaInterfaceInfo **info, - unsigned int index) + uint32_t index) { if (factory == NULL || info == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/alsa/alsa-utils.c b/spa/plugins/alsa/alsa-utils.c index d4e62107b..ce5840740 100644 --- a/spa/plugins/alsa/alsa-utils.c +++ b/spa/plugins/alsa/alsa-utils.c @@ -339,7 +339,7 @@ pull_frames_ringbuffer (SpaALSAState *state, avail = spa_ringbuffer_get_read_areas (&b->rb->ringbuffer, areas); 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[1].offset, areas[1].len, offset, size); diff --git a/spa/plugins/alsa/alsa.c b/spa/plugins/alsa/alsa.c index d450c21eb..ed83560ab 100644 --- a/spa/plugins/alsa/alsa.c +++ b/spa/plugins/alsa/alsa.c @@ -26,7 +26,7 @@ extern const SpaHandleFactory spa_alsa_monitor_factory; SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory, - unsigned int index) + uint32_t index) { if (factory == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/audiomixer/audiomixer.c b/spa/plugins/audiomixer/audiomixer.c index 3531bfbb2..add4555bb 100644 --- a/spa/plugins/audiomixer/audiomixer.c +++ b/spa/plugins/audiomixer/audiomixer.c @@ -51,7 +51,7 @@ typedef struct { MixerBuffer mix; SpaBuffer **buffers; - unsigned int n_buffers; + uint32_t n_buffers; SpaBuffer *buffer; void *io; } SpaAudioMixerPort; @@ -158,10 +158,10 @@ spa_audiomixer_node_set_event_callback (SpaNode *node, static SpaResult spa_audiomixer_node_get_n_ports (SpaNode *node, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -180,9 +180,9 @@ spa_audiomixer_node_get_n_ports (SpaNode *node, static SpaResult spa_audiomixer_node_get_port_ids (SpaNode *node, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { SpaAudioMixer *this; @@ -264,7 +264,7 @@ spa_audiomixer_node_port_enum_formats (SpaNode *node, uint32_t port_id, SpaFormat **format, const SpaFormat *filter, - unsigned int index) + uint32_t index) { SpaAudioMixer *this; @@ -472,7 +472,7 @@ static SpaResult spa_audiomixer_node_process_input (SpaNode *node) { SpaAudioMixer *this; - unsigned int i; + uint32_t i; bool have_error = false; SpaPortOutput *output; @@ -679,10 +679,10 @@ spa_audiomixer_init (const SpaHandleFactory *factory, SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { SpaAudioMixer *this; - unsigned int i; + uint32_t i; if (factory == NULL || handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -721,7 +721,7 @@ static const SpaInterfaceInfo audiomixer_interfaces[] = static SpaResult audiomixer_enum_interface_info (const SpaHandleFactory *factory, const SpaInterfaceInfo **info, - unsigned int index) + uint32_t index) { if (factory == NULL || info == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/audiomixer/plugin.c b/spa/plugins/audiomixer/plugin.c index 1d9f892b4..8d14a75a7 100644 --- a/spa/plugins/audiomixer/plugin.c +++ b/spa/plugins/audiomixer/plugin.c @@ -24,7 +24,7 @@ extern const SpaHandleFactory spa_audiomixer_factory; SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory, - unsigned int index) + uint32_t index) { if (factory == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/audiotestsrc/audiotestsrc.c b/spa/plugins/audiotestsrc/audiotestsrc.c index acda6cad9..222d86264 100644 --- a/spa/plugins/audiotestsrc/audiotestsrc.c +++ b/spa/plugins/audiotestsrc/audiotestsrc.c @@ -94,7 +94,7 @@ struct _SpaAudioTestSrc { size_t bpf; ATSBuffer buffers[MAX_BUFFERS]; - unsigned int n_buffers; + uint32_t n_buffers; bool started; uint64_t start_time; @@ -397,10 +397,10 @@ spa_audiotestsrc_node_set_event_callback (SpaNode *node, static SpaResult spa_audiotestsrc_node_get_n_ports (SpaNode *node, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -419,9 +419,9 @@ spa_audiotestsrc_node_get_n_ports (SpaNode *node, static SpaResult spa_audiotestsrc_node_get_port_ids (SpaNode *node, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { if (node == NULL) @@ -455,7 +455,7 @@ spa_audiotestsrc_node_port_enum_formats (SpaNode *node, uint32_t port_id, SpaFormat **format, const SpaFormat *filter, - unsigned int index) + uint32_t index) { SpaAudioTestSrc *this; SpaResult res; @@ -664,7 +664,7 @@ spa_audiotestsrc_node_port_use_buffers (SpaNode *node, uint32_t n_buffers) { SpaAudioTestSrc *this; - unsigned int i; + uint32_t i; if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -943,10 +943,10 @@ audiotestsrc_init (const SpaHandleFactory *factory, SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { SpaAudioTestSrc *this; - unsigned int i; + uint32_t i; if (factory == NULL || handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -1010,7 +1010,7 @@ static const SpaInterfaceInfo audiotestsrc_interfaces[] = static SpaResult audiotestsrc_enum_interface_info (const SpaHandleFactory *factory, const SpaInterfaceInfo **info, - unsigned int index) + uint32_t index) { if (factory == NULL || info == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/audiotestsrc/plugin.c b/spa/plugins/audiotestsrc/plugin.c index aa4881853..803ade562 100644 --- a/spa/plugins/audiotestsrc/plugin.c +++ b/spa/plugins/audiotestsrc/plugin.c @@ -24,7 +24,7 @@ extern const SpaHandleFactory spa_audiotestsrc_factory; SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory, - unsigned int index) + uint32_t index) { if (factory == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/ffmpeg/ffmpeg-dec.c b/spa/plugins/ffmpeg/ffmpeg-dec.c index 840e24090..3ae4936bd 100644 --- a/spa/plugins/ffmpeg/ffmpeg-dec.c +++ b/spa/plugins/ffmpeg/ffmpeg-dec.c @@ -147,10 +147,10 @@ spa_ffmpeg_dec_node_set_event_callback (SpaNode *node, static SpaResult spa_ffmpeg_dec_node_get_n_ports (SpaNode *node, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -169,9 +169,9 @@ spa_ffmpeg_dec_node_get_n_ports (SpaNode *node, static SpaResult spa_ffmpeg_dec_node_get_port_ids (SpaNode *node, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { if (node == NULL) @@ -208,10 +208,9 @@ spa_ffmpeg_dec_node_port_enum_formats (SpaNode *node, uint32_t port_id, SpaFormat **format, const SpaFormat *filter, - unsigned int index) + uint32_t index) { SpaFFMpegDec *this; - SpaFFMpegPort *port; if (node == NULL || format == NULL) 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)) return SPA_RESULT_INVALID_PORT; - port = direction == SPA_DIRECTION_INPUT ? &this->in_ports[port_id] : &this->out_ports[port_id]; - switch (index) { case 0: break; @@ -516,10 +513,10 @@ SpaResult spa_ffmpeg_dec_init (SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { SpaFFMpegDec *this; - unsigned int i; + uint32_t i; handle->get_interface = spa_ffmpeg_dec_get_interface; diff --git a/spa/plugins/ffmpeg/ffmpeg-enc.c b/spa/plugins/ffmpeg/ffmpeg-enc.c index 4ed669e2e..6388412aa 100644 --- a/spa/plugins/ffmpeg/ffmpeg-enc.c +++ b/spa/plugins/ffmpeg/ffmpeg-enc.c @@ -152,10 +152,10 @@ spa_ffmpeg_enc_node_set_event_callback (SpaNode *node, static SpaResult spa_ffmpeg_enc_node_get_n_ports (SpaNode *node, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -174,9 +174,9 @@ spa_ffmpeg_enc_node_get_n_ports (SpaNode *node, static SpaResult spa_ffmpeg_enc_node_get_port_ids (SpaNode *node, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { if (node == NULL) @@ -213,7 +213,7 @@ spa_ffmpeg_enc_node_port_enum_formats (SpaNode *node, uint32_t port_id, SpaFormat **format, const SpaFormat *filter, - unsigned int index) + uint32_t index) { SpaFFMpegEnc *this; SpaFFMpegPort *port; @@ -524,10 +524,10 @@ SpaResult spa_ffmpeg_enc_init (SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { SpaFFMpegEnc *this; - unsigned int i; + uint32_t i; handle->get_interface = spa_ffmpeg_enc_get_interface; diff --git a/spa/plugins/ffmpeg/ffmpeg.c b/spa/plugins/ffmpeg/ffmpeg.c index 49dd525f3..f110c884e 100644 --- a/spa/plugins/ffmpeg/ffmpeg.c +++ b/spa/plugins/ffmpeg/ffmpeg.c @@ -25,15 +25,15 @@ #include #include -SpaResult spa_ffmpeg_dec_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, 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, uint32_t n_support); static SpaResult ffmpeg_dec_init (const SpaHandleFactory *factory, SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { if (factory == NULL || handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -46,7 +46,7 @@ ffmpeg_enc_init (const SpaHandleFactory *factory, SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { if (factory == NULL || handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -63,7 +63,7 @@ static const SpaInterfaceInfo ffmpeg_interfaces[] = static SpaResult ffmpeg_enum_interface_info (const SpaHandleFactory *factory, const SpaInterfaceInfo **info, - unsigned int index) + uint32_t index) { if (factory == NULL || info == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -78,7 +78,7 @@ ffmpeg_enum_interface_info (const SpaHandleFactory *factory, SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory, - unsigned int index) + uint32_t index) { static const AVCodec *c = NULL; static int ci = 0; diff --git a/spa/plugins/libva/libva-dec.c b/spa/plugins/libva/libva-dec.c index 711202a04..e75cfb47c 100644 --- a/spa/plugins/libva/libva-dec.c +++ b/spa/plugins/libva/libva-dec.c @@ -189,10 +189,10 @@ spa_libva_dec_node_set_event_callback (SpaHandle *handle, static SpaResult spa_libva_dec_node_get_n_ports (SpaHandle *handle, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { if (handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -211,9 +211,9 @@ spa_libva_dec_node_get_n_ports (SpaHandle *handle, static SpaResult spa_libva_dec_node_get_port_ids (SpaHandle *handle, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { if (handle == NULL) @@ -246,7 +246,7 @@ spa_libva_dec_node_remove_port (SpaHandle *handle, static SpaResult spa_libva_dec_node_port_enum_formats (SpaHandle *handle, uint32_t port_id, - unsigned int index, + uint32_t index, SpaFormat **format) { SpaLibvaDec *this = (SpaLibvaDec *) handle; @@ -423,7 +423,7 @@ spa_libva_dec_node_port_alloc_buffers (SpaHandle *handle, static SpaResult spa_libva_dec_node_port_push_input (SpaHandle *handle, - unsigned int n_info, + uint32_t n_info, SpaInputInfo *info) { return SPA_RESULT_INVALID_PORT; @@ -431,12 +431,12 @@ spa_libva_dec_node_port_push_input (SpaHandle *handle, static SpaResult spa_libva_dec_node_port_pull_output (SpaHandle *handle, - unsigned int n_info, + uint32_t n_info, SpaOutputInfo *info) { SpaLibvaDec *this = (SpaLibvaDec *) handle; SpaLibvaState *state; - unsigned int i; + uint32_t i; bool have_error = false; if (handle == NULL || n_info == 0 || info == NULL) diff --git a/spa/plugins/libva/libva-enc.c b/spa/plugins/libva/libva-enc.c index 13134f807..4e5171061 100644 --- a/spa/plugins/libva/libva-enc.c +++ b/spa/plugins/libva/libva-enc.c @@ -189,10 +189,10 @@ spa_libva_enc_node_set_event_callback (SpaHandle *handle, static SpaResult spa_libva_enc_node_get_n_ports (SpaHandle *handle, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { if (handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -211,9 +211,9 @@ spa_libva_enc_node_get_n_ports (SpaHandle *handle, static SpaResult spa_libva_enc_node_get_port_ids (SpaHandle *handle, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { if (handle == NULL) @@ -246,7 +246,7 @@ spa_libva_enc_node_remove_port (SpaHandle *handle, static SpaResult spa_libva_enc_node_port_enum_formats (SpaHandle *handle, uint32_t port_id, - unsigned int index, + uint32_t index, SpaFormat **format) { SpaLibvaEnc *this = (SpaLibvaEnc *) handle; @@ -423,7 +423,7 @@ spa_libva_enc_node_port_alloc_buffers (SpaHandle *handle, static SpaResult spa_libva_enc_node_port_push_input (SpaHandle *handle, - unsigned int n_info, + uint32_t n_info, SpaInputInfo *info) { return SPA_RESULT_INVALID_PORT; @@ -431,12 +431,12 @@ spa_libva_enc_node_port_push_input (SpaHandle *handle, static SpaResult spa_libva_enc_node_port_pull_output (SpaHandle *handle, - unsigned int n_info, + uint32_t n_info, SpaOutputInfo *info) { SpaLibvaEnc *this = (SpaLibvaEnc *) handle; SpaLibvaState *state; - unsigned int i; + uint32_t i; bool have_error = false; if (handle == NULL || n_info == 0 || info == NULL) diff --git a/spa/plugins/libva/libva.c b/spa/plugins/libva/libva.c index 8397e0c1c..fca53f6c0 100644 --- a/spa/plugins/libva/libva.c +++ b/spa/plugins/libva/libva.c @@ -58,7 +58,7 @@ static const SpaInterfaceInfo libva_interfaces[] = static SpaResult libva_enum_interface_info (const SpaHandleFactory *factory, - unsigned int index, + uint32_t index, const SpaInterfaceInfo **info) { if (index >= 1) @@ -84,7 +84,7 @@ static const SpaHandleFactory factories[] = }; SpaResult -spa_enum_handle_factory (unsigned int index, +spa_enum_handle_factory (uint32_t index, const SpaHandleFactory **factory) { if (index >= 2) diff --git a/spa/plugins/v4l2/v4l2-monitor.c b/spa/plugins/v4l2/v4l2-monitor.c index e9bc8ab36..767b84d10 100644 --- a/spa/plugins/v4l2/v4l2-monitor.c +++ b/spa/plugins/v4l2/v4l2-monitor.c @@ -61,7 +61,7 @@ struct _SpaV4l2Monitor { struct udev* udev; struct udev_monitor *umonitor; struct udev_enumerate *enumerate; - unsigned int index; + uint32_t index; struct udev_list_entry *devices; V4l2Item uitem; @@ -83,7 +83,7 @@ v4l2_udev_open (SpaV4l2Monitor *this) static void fill_item (V4l2Item *item, struct udev_device *udevice) { - unsigned int i; + uint32_t i; const char *str; if (item->udevice) @@ -253,7 +253,7 @@ spa_v4l2_monitor_set_event_callback (SpaMonitor *monitor, static SpaResult spa_v4l2_monitor_enum_items (SpaMonitor *monitor, SpaMonitorItem **item, - unsigned int index) + uint32_t index) { SpaResult res; SpaV4l2Monitor *this; @@ -340,10 +340,10 @@ v4l2_monitor_init (const SpaHandleFactory *factory, SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { SpaV4l2Monitor *this; - unsigned int i; + uint32_t i; if (factory == NULL || handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -384,7 +384,7 @@ static const SpaInterfaceInfo v4l2_monitor_interfaces[] = static SpaResult v4l2_monitor_enum_interface_info (const SpaHandleFactory *factory, const SpaInterfaceInfo **info, - unsigned int index) + uint32_t index) { if (factory == NULL || info == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/v4l2/v4l2-source.c b/spa/plugins/v4l2/v4l2-source.c index 2478363b0..d25f04a30 100644 --- a/spa/plugins/v4l2/v4l2-source.c +++ b/spa/plugins/v4l2/v4l2-source.c @@ -93,7 +93,7 @@ typedef struct { enum v4l2_memory memtype; V4l2Buffer buffers[MAX_BUFFERS]; - unsigned int n_buffers; + uint32_t n_buffers; bool source_enabled; SpaSource source; @@ -415,10 +415,10 @@ spa_v4l2_source_node_set_event_callback (SpaNode *node, static SpaResult spa_v4l2_source_node_get_n_ports (SpaNode *node, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -437,9 +437,9 @@ spa_v4l2_source_node_get_n_ports (SpaNode *node, static SpaResult spa_v4l2_source_node_get_port_ids (SpaNode *node, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { if (node == NULL) @@ -474,7 +474,7 @@ spa_v4l2_source_node_port_enum_formats (SpaNode *node, uint32_t port_id, SpaFormat **format, const SpaFormat *filter, - unsigned int index) + uint32_t index) { SpaV4l2Source *this; SpaResult res; @@ -726,9 +726,9 @@ spa_v4l2_source_node_port_alloc_buffers (SpaNode *node, SpaDirection direction, uint32_t port_id, SpaAllocParam **params, - unsigned int n_params, + uint32_t n_params, SpaBuffer **buffers, - unsigned int *n_buffers) + uint32_t *n_buffers) { SpaV4l2Source *this; SpaV4l2State *state; @@ -965,10 +965,10 @@ v4l2_source_init (const SpaHandleFactory *factory, SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { SpaV4l2Source *this; - unsigned int i; + uint32_t i; const char *str; if (factory == NULL || handle == NULL) @@ -1032,7 +1032,7 @@ static const SpaInterfaceInfo v4l2_source_interfaces[] = static SpaResult v4l2_source_enum_interface_info (const SpaHandleFactory *factory, const SpaInterfaceInfo **info, - unsigned int index) + uint32_t index) { if (factory == NULL || info == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/v4l2/v4l2-utils.c b/spa/plugins/v4l2/v4l2-utils.c index 5c210b70a..fbca4ccd5 100644 --- a/spa/plugins/v4l2/v4l2-utils.c +++ b/spa/plugins/v4l2/v4l2-utils.c @@ -322,7 +322,7 @@ find_format_info_by_media_type (SpaMediaType type, } 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; @@ -330,7 +330,7 @@ enum_filter_format (const SpaFormat *filter, unsigned int index) filter->body.media_type.value == SPA_MEDIA_TYPE_IMAGE)) { if (filter->body.media_subtype.value == SPA_MEDIA_SUBTYPE_RAW) { SpaPODProp *p; - unsigned int n_values; + uint32_t n_values; const uint32_t *values; if (!(p = spa_format_find_prop (filter, SPA_PROP_ID_VIDEO_FORMAT))) @@ -449,7 +449,7 @@ static SpaResult spa_v4l2_enum_format (SpaV4l2Source *this, SpaFormat **format, const SpaFormat *filter, - unsigned int index) + uint32_t index) { SpaV4l2State *state = &this->state[0]; int res, n_fractions; @@ -547,7 +547,7 @@ do_frmsize: SpaPODProp *p; const SpaRectangle step = { 1, 1 }, *values; uint32_t range; - unsigned int i, n_values; + uint32_t i, n_values; /* check if we have a fixed frame size */ if (!(p = spa_format_find_prop (filter, SPA_PROP_ID_VIDEO_SIZE))) @@ -650,7 +650,7 @@ have_size: if (filter) { SpaPODProp *p; uint32_t range; - unsigned int i, n_values; + uint32_t i, n_values; const SpaFraction step = { 1, 1 }, *values; 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 mmap_init (SpaV4l2Source *this, SpaAllocParam **params, - unsigned int n_params, + uint32_t n_params, SpaBuffer **buffers, - unsigned int *n_buffers) + uint32_t *n_buffers) { SpaV4l2State *state = &this->state[0]; struct v4l2_requestbuffers reqbuf; @@ -1136,9 +1136,9 @@ read_init (SpaV4l2Source *this) static SpaResult spa_v4l2_alloc_buffers (SpaV4l2Source *this, SpaAllocParam **params, - unsigned int n_params, + uint32_t n_params, SpaBuffer **buffers, - unsigned int *n_buffers) + uint32_t *n_buffers) { SpaResult res; SpaV4l2State *state = &this->state[0]; diff --git a/spa/plugins/v4l2/v4l2.c b/spa/plugins/v4l2/v4l2.c index 67493f79e..56ec01f04 100644 --- a/spa/plugins/v4l2/v4l2.c +++ b/spa/plugins/v4l2/v4l2.c @@ -25,7 +25,7 @@ extern const SpaHandleFactory spa_v4l2_monitor_factory; SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory, - unsigned int index) + uint32_t index) { if (factory == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/videotestsrc/plugin.c b/spa/plugins/videotestsrc/plugin.c index 5b1c5b9aa..2159bd980 100644 --- a/spa/plugins/videotestsrc/plugin.c +++ b/spa/plugins/videotestsrc/plugin.c @@ -24,7 +24,7 @@ extern const SpaHandleFactory spa_videotestsrc_factory; SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory, - unsigned int index) + uint32_t index) { if (factory == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/videotestsrc/videotestsrc.c b/spa/plugins/videotestsrc/videotestsrc.c index ad5375efb..96ae7d2a4 100644 --- a/spa/plugins/videotestsrc/videotestsrc.c +++ b/spa/plugins/videotestsrc/videotestsrc.c @@ -92,7 +92,7 @@ struct _SpaVideoTestSrc { size_t bpp; VTSBuffer buffers[MAX_BUFFERS]; - unsigned int n_buffers; + uint32_t n_buffers; bool started; uint64_t start_time; @@ -366,10 +366,10 @@ spa_videotestsrc_node_set_event_callback (SpaNode *node, static SpaResult spa_videotestsrc_node_get_n_ports (SpaNode *node, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -388,9 +388,9 @@ spa_videotestsrc_node_get_n_ports (SpaNode *node, static SpaResult spa_videotestsrc_node_get_port_ids (SpaNode *node, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { if (node == NULL) @@ -424,7 +424,7 @@ spa_videotestsrc_node_port_enum_formats (SpaNode *node, uint32_t port_id, SpaFormat **format, const SpaFormat *filter, - unsigned int index) + uint32_t index) { SpaVideoTestSrc *this; SpaResult res; @@ -648,7 +648,7 @@ spa_videotestsrc_node_port_use_buffers (SpaNode *node, uint32_t n_buffers) { SpaVideoTestSrc *this; - unsigned int i; + uint32_t i; if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -927,10 +927,10 @@ videotestsrc_init (const SpaHandleFactory *factory, SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { SpaVideoTestSrc *this; - unsigned int i; + uint32_t i; if (factory == NULL || handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -994,7 +994,7 @@ static const SpaInterfaceInfo videotestsrc_interfaces[] = static SpaResult videotestsrc_enum_interface_info (const SpaHandleFactory *factory, const SpaInterfaceInfo **info, - unsigned int index) + uint32_t index) { if (factory == NULL || info == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/volume/plugin.c b/spa/plugins/volume/plugin.c index a224f3079..bcebdbc7c 100644 --- a/spa/plugins/volume/plugin.c +++ b/spa/plugins/volume/plugin.c @@ -24,7 +24,7 @@ extern const SpaHandleFactory spa_volume_factory; SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory, - unsigned int index) + uint32_t index) { if (factory == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/volume/volume.c b/spa/plugins/volume/volume.c index 0a08deebb..5b0952530 100644 --- a/spa/plugins/volume/volume.c +++ b/spa/plugins/volume/volume.c @@ -55,7 +55,7 @@ typedef struct { SpaAllocParamMetaEnable param_meta; SpaVolumeBuffer buffers[MAX_BUFFERS]; - unsigned int n_buffers; + uint32_t n_buffers; void *io; @@ -225,10 +225,10 @@ spa_volume_node_set_event_callback (SpaNode *node, static SpaResult spa_volume_node_get_n_ports (SpaNode *node, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -247,9 +247,9 @@ spa_volume_node_get_n_ports (SpaNode *node, static SpaResult spa_volume_node_get_port_ids (SpaNode *node, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { if (node == NULL) @@ -286,7 +286,7 @@ spa_volume_node_port_enum_formats (SpaNode *node, uint32_t port_id, SpaFormat **format, const SpaFormat *filter, - unsigned int index) + uint32_t index) { SpaVolume *this; SpaResult res; @@ -487,7 +487,7 @@ spa_volume_node_port_use_buffers (SpaNode *node, { SpaVolume *this; SpaVolumePort *port; - unsigned int i; + uint32_t i; if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -665,7 +665,7 @@ release_buffer (SpaVolume *this, SpaBuffer *buffer) static void 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; uint16_t *src, *dst; double volume; @@ -825,10 +825,10 @@ volume_init (const SpaHandleFactory *factory, SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { SpaVolume *this; - unsigned int i; + uint32_t i; if (factory == NULL || handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -872,7 +872,7 @@ static const SpaInterfaceInfo volume_interfaces[] = static SpaResult volume_enum_interface_info (const SpaHandleFactory *factory, const SpaInterfaceInfo **info, - unsigned int index) + uint32_t index) { if (factory == NULL || info == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/xv/xv-sink.c b/spa/plugins/xv/xv-sink.c index 6c240ff39..528b89df7 100644 --- a/spa/plugins/xv/xv-sink.c +++ b/spa/plugins/xv/xv-sink.c @@ -231,10 +231,10 @@ spa_xv_sink_node_set_event_callback (SpaNode *node, static SpaResult spa_xv_sink_node_get_n_ports (SpaNode *node, - unsigned int *n_input_ports, - unsigned int *max_input_ports, - unsigned int *n_output_ports, - unsigned int *max_output_ports) + uint32_t *n_input_ports, + uint32_t *max_input_ports, + uint32_t *n_output_ports, + uint32_t *max_output_ports) { if (node == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -253,9 +253,9 @@ spa_xv_sink_node_get_n_ports (SpaNode *node, static SpaResult spa_xv_sink_node_get_port_ids (SpaNode *node, - unsigned int n_input_ports, + uint32_t n_input_ports, uint32_t *input_ids, - unsigned int n_output_ports, + uint32_t n_output_ports, uint32_t *output_ids) { if (node == NULL) @@ -290,7 +290,7 @@ spa_xv_sink_node_port_enum_formats (SpaNode *node, uint32_t port_id, SpaFormat **format, const SpaFormat *filter, - unsigned int index) + uint32_t index) { SpaXvSink *this; @@ -558,10 +558,10 @@ xv_sink_init (const SpaHandleFactory *factory, SpaHandle *handle, const SpaDict *info, const SpaSupport *support, - unsigned int n_support) + uint32_t n_support) { SpaXvSink *this; - unsigned int i; + uint32_t i; if (factory == NULL || handle == NULL) return SPA_RESULT_INVALID_ARGUMENTS; @@ -599,7 +599,7 @@ static const SpaInterfaceInfo xv_sink_interfaces[] = static SpaResult xv_sink_enum_interface_info (const SpaHandleFactory *factory, const SpaInterfaceInfo **info, - unsigned int index) + uint32_t index) { if (factory == NULL || info == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/plugins/xv/xv.c b/spa/plugins/xv/xv.c index 2d73d84dc..b8242e498 100644 --- a/spa/plugins/xv/xv.c +++ b/spa/plugins/xv/xv.c @@ -24,7 +24,7 @@ extern const SpaHandleFactory spa_xv_sink_factory; SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory, - unsigned int index) + uint32_t index) { if (factory == NULL) return SPA_RESULT_INVALID_ARGUMENTS; diff --git a/spa/tests/test-mixer.c b/spa/tests/test-mixer.c index 64d6224bc..c6544452c 100644 --- a/spa/tests/test-mixer.c +++ b/spa/tests/test-mixer.c @@ -50,7 +50,7 @@ typedef struct { SpaPollItem poll; SpaSupport support[2]; - unsigned int n_support; + uint32_t n_support; SpaIDMap *map; SpaLog *log; SpaPoll data_loop; diff --git a/spa/tests/test-props2.c b/spa/tests/test-props2.c index 39ba3558a..bcbd2d3e3 100644 --- a/spa/tests/test-props2.c +++ b/spa/tests/test-props2.c @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -40,11 +41,12 @@ main (int argc, char *argv[]) SpaPODFrame frame[4]; uint8_t buffer[1024]; SpaPOD *obj; + SpaPODIter i; b.data = buffer; 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 }; 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[0]); + obj = SPA_POD_BUILDER_DEREF (&b, frame[0].ref, SpaPOD); spa_debug_pod (obj); SpaPODProp *p = spa_pod_object_find_prop ((SpaPODObject *)obj, 4); printf ("%d %d\n", p->body.key, p->body.flags); 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; } diff --git a/spa/tests/test-v4l2.c b/spa/tests/test-v4l2.c index 662227df0..ebc073620 100644 --- a/spa/tests/test-v4l2.c +++ b/spa/tests/test-v4l2.c @@ -71,7 +71,7 @@ typedef struct { unsigned int n_buffers; SpaSupport support[2]; - unsigned int n_support; + uint32_t n_support; SpaIDMap *map; SpaLog *log; SpaPoll data_loop; diff --git a/spa/tools/spa-inspect.c b/spa/tools/spa-inspect.c index 98d9df73c..68cea4c52 100644 --- a/spa/tools/spa-inspect.c +++ b/spa/tools/spa-inspect.c @@ -39,7 +39,7 @@ typedef struct { URI uri; SpaSupport support[4]; - unsigned int n_support; + uint32_t n_support; SpaIDMap *map; SpaLog *log; SpaLoop loop; @@ -50,7 +50,7 @@ inspect_port (SpaNode *node, SpaDirection direction, uint32_t port_id) { SpaResult res; SpaFormat *format; - unsigned int index = 0; + uint32_t index = 0; SpaProps *props; while (true) { @@ -73,7 +73,7 @@ static void inspect_node (SpaNode *node) { 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; SpaProps *props; @@ -114,7 +114,7 @@ inspect_factory (AppData *data, const SpaHandleFactory *factory) SpaResult res; SpaHandle *handle; void *interface; - unsigned int index = 0; + uint32_t index = 0; printf ("factory name:\t\t'%s'\n", factory->name); printf ("factory info:\n"); @@ -181,7 +181,7 @@ main (int argc, char *argv[]) SpaResult res; void *handle; SpaEnumHandleFactoryFunc enum_func; - unsigned int index = 0; + uint32_t index = 0; if (argc < 2) { printf ("usage: %s \n", argv[0]); diff --git a/spa/tools/spa-monitor.c b/spa/tools/spa-monitor.c index 857b0fceb..2097f7c12 100644 --- a/spa/tools/spa-monitor.c +++ b/spa/tools/spa-monitor.c @@ -44,7 +44,7 @@ typedef struct { SpaLoop main_loop; SpaSupport support[3]; - unsigned int n_support; + uint32_t n_support; unsigned int n_sources; SpaSource sources[16]; @@ -123,7 +123,7 @@ static void handle_monitor (AppData *data, SpaMonitor *monitor) { SpaResult res; - unsigned int index; + uint32_t index; if (monitor->info) spa_debug_dict (monitor->info); @@ -181,7 +181,7 @@ main (int argc, char *argv[]) SpaResult res; void *handle; SpaEnumHandleFactoryFunc enum_func; - unsigned int fidx; + uint32_t fidx; data.map = spa_id_map_get_default (); data.log = NULL; @@ -216,7 +216,7 @@ main (int argc, char *argv[]) for (fidx = 0;; fidx++) { const SpaHandleFactory *factory; - unsigned int iidx; + uint32_t iidx; if ((res = enum_func (&factory, fidx)) < 0) { if (res != SPA_RESULT_ENUM_END)