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

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

View file

@ -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),

View file

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

View file

@ -29,7 +29,7 @@ extern "C" {
#include <spa/format.h>
#include <spa/pod-builder.h>
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);

View file

@ -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
*

View file

@ -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);
};

View file

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

View file

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

View file

@ -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:

View file

@ -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" */

View file

@ -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);

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

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

View file

@ -57,6 +57,7 @@ typedef struct {
} SpaPOD;
#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) {

View file

@ -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;

View file

@ -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);

View file

@ -35,8 +35,8 @@ typedef struct _SpaRingbuffer SpaRingbuffer;
#include <spa/barrier.h>
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;

View file

@ -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;

View file

@ -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;
}

View file

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

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -25,15 +25,15 @@
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
SpaResult spa_ffmpeg_dec_init (SpaHandle *handle, const SpaDict *info, const SpaSupport *support, unsigned int n_support);
SpaResult spa_ffmpeg_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;

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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;

View file

@ -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;

View file

@ -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];

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -26,6 +26,7 @@
#include <spa/pod.h>
#include <spa/pod-builder.h>
#include <spa/pod-iter.h>
#include <spa/id-map.h>
#include <spa/log.h>
@ -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;
}

View file

@ -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;

View file

@ -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 <plugin.so>\n", argv[0]);

View file

@ -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)