spa: don't use typedef for struct and enum

This commit is contained in:
Wim Taymans 2017-05-25 13:28:15 +02:00
parent 83964cec87
commit 11f23a3ffa
163 changed files with 6510 additions and 8264 deletions

View file

@ -38,11 +38,11 @@ struct context {
int fd;
struct pw_connection *connection;
SpaSource *source;
struct spa_source *source;
bool disconnecting;
struct pw_listener need_flush;
SpaSource *flush_event;
struct spa_source *flush_event;
};
/**
@ -140,7 +140,7 @@ core_event_done (void *object,
static void
core_event_error (void *object,
uint32_t id,
SpaResult res,
int res,
const char *error, ...)
{
struct pw_proxy *proxy = object;
@ -174,7 +174,7 @@ core_event_update_types (void *object,
int i;
for (i = 0; i < n_types; i++, first_id++) {
SpaType this_id = spa_type_map_get_id (this->type.map, types[i]);
uint32_t this_id = spa_type_map_get_id (this->type.map, types[i]);
if (!pw_map_insert_at (&this->types, first_id, PW_MAP_ID_TO_PTR (this_id)))
pw_log_error ("can't add type for client");
}
@ -383,8 +383,8 @@ static const struct pw_registry_events registry_events = {
typedef bool (*demarshal_func_t) (void *object, void *data, size_t size);
static void
do_flush_event (SpaLoopUtils *utils,
SpaSource *source,
do_flush_event (struct spa_loop_utils *utils,
struct spa_source *source,
void *data)
{
struct context *impl = data;
@ -403,10 +403,10 @@ on_need_flush (struct pw_listener *listener,
}
static void
on_context_data (SpaLoopUtils *utils,
SpaSource *source,
on_context_data (struct spa_loop_utils *utils,
struct spa_source *source,
int fd,
SpaIO mask,
enum spa_io mask,
void *data)
{
struct context *impl = data;
@ -742,7 +742,7 @@ pw_context_get_core_info (struct pw_context *context,
cb (context, SPA_RESULT_ENUM_END, NULL, user_data);
}
typedef void (*list_func_t) (struct pw_context *, SpaResult, void *, void *);
typedef void (*list_func_t) (struct pw_context *, int, void *, void *);
static void
do_list (struct pw_context *context,

View file

@ -75,9 +75,9 @@ struct pw_context {
uint32_t n_types;
struct pw_map types;
SpaList global_list;
SpaList stream_list;
SpaList proxy_list;
struct spa_list global_list;
struct spa_list stream_list;
struct spa_list proxy_list;
void *protocol_private;

View file

@ -42,7 +42,7 @@ extern "C" {
struct pw_core_methods {
void (*client_update) (void *object,
const SpaDict *props);
const struct spa_dict *props);
void (*sync) (void *object,
uint32_t seq);
void (*get_registry) (void *object,
@ -50,11 +50,11 @@ struct pw_core_methods {
void (*create_node) (void *object,
const char *factory_name,
const char *name,
const SpaDict *props,
const struct spa_dict *props,
uint32_t new_id);
void (*create_client_node) (void *object,
const char *name,
const SpaDict *props,
const struct spa_dict *props,
uint32_t new_id);
void (*update_types) (void *object,
uint32_t first_id,
@ -83,7 +83,7 @@ struct pw_core_events {
uint32_t seq);
void (*error) (void *object,
uint32_t id,
SpaResult res,
int res,
const char *error, ...);
void (*remove_id) (void *object,
uint32_t id);
@ -147,10 +147,10 @@ struct pw_node_events {
#define pw_node_notify_info(r,...) ((struct pw_node_events*)r->iface->events)->info(r,__VA_ARGS__)
struct pw_client_node_buffer {
uint32_t mem_id;
uint32_t offset;
uint32_t size;
SpaBuffer *buffer;
uint32_t mem_id;
uint32_t offset;
uint32_t size;
struct spa_buffer *buffer;
};
#define PW_CLIENT_NODE_METHOD_UPDATE 0
@ -167,10 +167,10 @@ struct pw_client_node_methods {
uint32_t change_mask,
uint32_t max_input_ports,
uint32_t max_output_ports,
const SpaProps *props);
const struct spa_props *props);
void (*port_update) (void *object,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
#define PW_MESSAGE_PORT_UPDATE_POSSIBLE_FORMATS (1 << 0)
#define PW_MESSAGE_PORT_UPDATE_FORMAT (1 << 1)
@ -178,13 +178,13 @@ struct pw_client_node_methods {
#define PW_MESSAGE_PORT_UPDATE_INFO (1 << 3)
uint32_t change_mask,
uint32_t n_possible_formats,
const SpaFormat **possible_formats,
const SpaFormat *format,
const struct spa_format **possible_formats,
const struct spa_format *format,
uint32_t n_params,
const SpaParam **params,
const SpaPortInfo *info);
const struct spa_param **params,
const struct spa_port_info *info);
void (*event) (void *object,
SpaEvent *event);
struct spa_event *event);
void (*destroy) (void *object);
};
@ -211,28 +211,28 @@ struct pw_client_node_events {
int readfd,
int writefd);
void (*event) (void *object,
const SpaEvent *event);
const struct spa_event *event);
void (*add_port) (void *object,
uint32_t seq,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id);
void (*remove_port) (void *object,
uint32_t seq,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id);
void (*set_format) (void *object,
uint32_t seq,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
uint32_t flags,
const SpaFormat *format);
const struct spa_format *format);
void (*set_property) (void *object,
uint32_t seq,
uint32_t id,
uint32_t size,
const void *value);
void (*add_mem) (void *object,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
uint32_t mem_id,
uint32_t type,
@ -242,16 +242,16 @@ struct pw_client_node_events {
uint32_t size);
void (*use_buffers) (void *object,
uint32_t seq,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
uint32_t n_buffers,
struct pw_client_node_buffer *buffers);
void (*node_command) (void *object,
uint32_t seq,
const SpaCommand *command);
const struct spa_command *command);
void (*port_command) (void *object,
uint32_t port_id,
const SpaCommand *command);
const struct spa_command *command);
void (*transport) (void *object,
int memfd,
uint32_t offset,

View file

@ -103,9 +103,9 @@ pw_link_state_as_string (enum pw_link_state state)
}
static void
pw_spa_dict_destroy (SpaDict *dict)
pw_spa_dict_destroy (struct spa_dict *dict)
{
SpaDictItem *item;
struct spa_dict_item *item;
spa_dict_for_each (item, dict) {
free ((void *)item->key);
@ -115,19 +115,19 @@ pw_spa_dict_destroy (SpaDict *dict)
free (dict);
}
static SpaDict *
pw_spa_dict_copy (SpaDict *dict)
static struct spa_dict *
pw_spa_dict_copy (struct spa_dict *dict)
{
SpaDict *copy;
struct spa_dict *copy;
uint32_t i;
if (dict == NULL)
return NULL;
copy = calloc (1, sizeof (SpaDict));
copy = calloc (1, sizeof (struct spa_dict));
if (copy == NULL)
goto no_mem;
copy->items = calloc (dict->n_items, sizeof (SpaDictItem));
copy->items = calloc (dict->n_items, sizeof (struct spa_dict_item));
if (copy->items == NULL)
goto no_items;
copy->n_items = dict->n_items;
@ -246,7 +246,7 @@ pw_node_info_update (struct pw_node_info *info,
free (info->input_formats[i]);
info->n_input_formats = update->n_input_formats;
if (info->n_input_formats)
info->input_formats = realloc (info->input_formats, info->n_input_formats * sizeof (SpaFormat *));
info->input_formats = realloc (info->input_formats, info->n_input_formats * sizeof (struct spa_format *));
else {
free (info->input_formats);
info->input_formats = NULL;
@ -262,7 +262,7 @@ pw_node_info_update (struct pw_node_info *info,
free (info->output_formats[i]);
info->n_output_formats = update->n_output_formats;
if (info->n_output_formats)
info->output_formats = realloc (info->output_formats, info->n_output_formats * sizeof (SpaFormat *));
info->output_formats = realloc (info->output_formats, info->n_output_formats * sizeof (struct spa_format *));
else {
free (info->output_formats);
info->output_formats = NULL;

View file

@ -122,7 +122,7 @@ struct pw_core_info {
const char *version;
const char *name;
uint32_t cookie;
SpaDict *props;
struct spa_dict *props;
};
struct pw_core_info * pw_core_info_update (struct pw_core_info *info,
@ -138,7 +138,7 @@ void pw_core_info_free (struct pw_core_info *info);
* Callback with information about the PipeWire core in @info.
*/
typedef void (*pw_core_info_cb_t) (struct pw_context *c,
SpaResult res,
int res,
const struct pw_core_info *info,
void *user_data);
@ -161,7 +161,7 @@ struct pw_module_info {
const char *name;
const char *filename;
const char *args;
SpaDict *props;
struct spa_dict *props;
};
struct pw_module_info * pw_module_info_update (struct pw_module_info *info,
@ -178,7 +178,7 @@ void pw_module_info_free (struct pw_module_info *inf
* Callback with information about the PipeWire module in @info.
*/
typedef void (*pw_module_info_cb_t) (struct pw_context *c,
SpaResult res,
int res,
const struct pw_module_info *info,
void *user_data);
@ -202,7 +202,7 @@ void pw_context_get_module_info_by_id (struct pw_context *context,
struct pw_client_info {
uint32_t id;
uint64_t change_mask;
SpaDict *props;
struct spa_dict *props;
};
struct pw_client_info * pw_client_info_update (struct pw_client_info *info,
@ -219,7 +219,7 @@ void pw_client_info_free (struct pw_client_info *inf
* Callback with information about the PipeWire client in @info.
*/
typedef void (*pw_client_info_cb_t) (struct pw_context *c,
SpaResult res,
int res,
const struct pw_client_info *info,
void *user_data);
@ -250,14 +250,14 @@ struct pw_node_info {
uint32_t max_inputs;
uint32_t n_inputs;
uint32_t n_input_formats;
SpaFormat **input_formats;
struct spa_format **input_formats;
uint32_t max_outputs;
uint32_t n_outputs;
uint32_t n_output_formats;
SpaFormat **output_formats;
struct spa_format **output_formats;
enum pw_node_state state;
const char *error;
SpaDict *props;
struct spa_dict *props;
};
struct pw_node_info * pw_node_info_update (struct pw_node_info *info,
@ -273,7 +273,7 @@ void pw_node_info_free (struct pw_node_info *info);
* Callback with information about the PipeWire node in @info.
*/
typedef void (*pw_node_info_cb_t) (struct pw_context *c,
SpaResult res,
int res,
const struct pw_node_info *info,
void *user_data);
@ -321,7 +321,7 @@ void pw_link_info_free (struct pw_link_info *info);
* Callback with information about the PipeWire link in @info.
*/
typedef void (*pw_link_info_cb_t) (struct pw_context *c,
SpaResult res,
int res,
const struct pw_link_info *info,
void *user_data);

View file

@ -27,27 +27,27 @@
#define DEFAULT_LOG_LEVEL SPA_LOG_LEVEL_ERROR
SpaLogLevel pw_log_level = DEFAULT_LOG_LEVEL;
enum spa_log_level pw_log_level = DEFAULT_LOG_LEVEL;
#define TRACE_BUFFER (16*1024)
typedef struct {
SpaLog log;
SpaRingbuffer trace_rb;
struct debug_log {
struct spa_log log;
struct spa_ringbuffer trace_rb;
uint8_t trace_data[TRACE_BUFFER];
SpaSource *source;
} DebugLog;
struct spa_source *source;
};
static void
do_logv (SpaLog *log,
SpaLogLevel level,
const char *file,
int line,
const char *func,
const char *fmt,
va_list args)
do_logv (struct spa_log *log,
enum spa_log_level level,
const char *file,
int line,
const char *func,
const char *fmt,
va_list args)
{
DebugLog *l = SPA_CONTAINER_OF (log, DebugLog, log);
struct debug_log *l = SPA_CONTAINER_OF (log, struct debug_log, log);
char text[1024], location[1024];
static const char *levels[] = { "-", "E", "W", "I", "D", "T", "*T*"};
int size;
@ -77,12 +77,12 @@ do_logv (SpaLog *log,
}
static void
do_log (SpaLog *log,
SpaLogLevel level,
const char *file,
int line,
const char *func,
const char *fmt, ...)
do_log (struct spa_log *log,
enum spa_log_level level,
const char *file,
int line,
const char *func,
const char *fmt, ...)
{
va_list args;
va_start (args, fmt);
@ -90,8 +90,8 @@ do_log (SpaLog *log,
va_end (args);
}
static DebugLog log = {
{ sizeof (SpaLog),
static struct debug_log log = {
{ sizeof (struct spa_log),
NULL,
DEFAULT_LOG_LEVEL,
do_log,
@ -100,21 +100,21 @@ static DebugLog log = {
{ 0, 0, TRACE_BUFFER, TRACE_BUFFER - 1 },
};
SpaLog *
struct spa_log *
pw_log_get (void)
{
return &log.log;
}
void
pw_log_set_level (SpaLogLevel level)
pw_log_set_level (enum spa_log_level level)
{
pw_log_level = level;
log.log.level = level;
}
static void
on_trace_event (SpaSource *source)
on_trace_event (struct spa_source *source)
{
int32_t avail;
uint32_t index;
@ -143,7 +143,7 @@ on_trace_event (SpaSource *source)
}
void
pw_log_set_trace_event (SpaSource *source)
pw_log_set_trace_event (struct spa_source *source)
{
log.source = source;
log.source->func = on_trace_event;
@ -151,11 +151,11 @@ pw_log_set_trace_event (SpaSource *source)
}
void
pw_log_log (SpaLogLevel level,
const char *file,
int line,
const char *func,
const char *fmt, ...)
pw_log_log (enum spa_log_level level,
const char *file,
int line,
const char *func,
const char *fmt, ...)
{
if (SPA_UNLIKELY (pw_log_level_enabled (level))) {
va_list args;
@ -166,12 +166,12 @@ pw_log_log (SpaLogLevel level,
}
void
pw_log_logv (SpaLogLevel level,
const char *file,
int line,
const char *func,
const char *fmt,
va_list args)
pw_log_logv (enum spa_log_level level,
const char *file,
int line,
const char *func,
const char *fmt,
va_list args)
{
if (SPA_UNLIKELY (pw_log_level_enabled (level))) {
do_logv (&log.log, level, file, line, func, fmt, args);

View file

@ -27,25 +27,25 @@
extern "C" {
#endif
extern SpaLogLevel pw_log_level;
extern enum spa_log_level pw_log_level;
SpaLog * pw_log_get (void);
struct spa_log* pw_log_get (void);
void pw_log_set_level (SpaLogLevel level);
void pw_log_set_trace_event (SpaSource *source);
void pw_log_set_level (enum spa_log_level level);
void pw_log_set_trace_event (struct spa_source *source);
void pw_log_log (SpaLogLevel level,
const char *file,
int line,
const char *func,
const char *fmt, ...) SPA_PRINTF_FUNC(5, 6);
void pw_log_logv (SpaLogLevel level,
const char *file,
int line,
const char *func,
const char *fmt,
va_list args) SPA_PRINTF_FUNC(5, 0);
void pw_log_log (enum spa_log_level level,
const char *file,
int line,
const char *func,
const char *fmt, ...) SPA_PRINTF_FUNC(5, 6);
void pw_log_logv (enum spa_log_level level,
const char *file,
int line,
const char *func,
const char *fmt,
va_list args) SPA_PRINTF_FUNC(5, 0);
#define pw_log_level_enabled(lev) (pw_log_level >= (lev))

View file

@ -38,56 +38,56 @@
#define DATAS_SIZE (4096 * 8)
struct invoke_item {
size_t item_size;
SpaInvokeFunc func;
uint32_t seq;
size_t size;
void *data;
void *user_data;
size_t item_size;
spa_invoke_func_t func;
uint32_t seq;
size_t size;
void *data;
void *user_data;
};
struct loop {
struct impl {
struct pw_loop this;
SpaList source_list;
struct spa_list source_list;
SpaLoopHook pre_func;
SpaLoopHook post_func;
spa_loop_hook_t pre_func;
spa_loop_hook_t post_func;
void *hook_data;
int epoll_fd;
pthread_t thread;
SpaLoop loop;
SpaLoopControl control;
SpaLoopUtils utils;
struct spa_loop loop;
struct spa_loop_control control;
struct spa_loop_utils utils;
SpaSource *event;
struct spa_source *event;
SpaRingbuffer buffer;
struct spa_ringbuffer buffer;
uint8_t buffer_data[DATAS_SIZE];
};
typedef struct {
SpaSource source;
struct source_impl {
struct spa_source source;
struct loop *impl;
SpaList link;
struct impl *impl;
struct spa_list link;
bool close;
union {
SpaSourceIOFunc io;
SpaSourceIdleFunc idle;
SpaSourceEventFunc event;
SpaSourceTimerFunc timer;
SpaSourceSignalFunc signal;
spa_source_io_func_t io;
spa_source_idle_func_t idle;
spa_source_event_func_t event;
spa_source_timer_func_t timer;
spa_source_signal_func_t signal;
} func;
int signal_number;
bool enabled;
} SpaSourceImpl;
};
static inline uint32_t
spa_io_to_epoll (SpaIO mask)
spa_io_to_epoll (enum spa_io mask)
{
uint32_t events = 0;
@ -103,10 +103,10 @@ spa_io_to_epoll (SpaIO mask)
return events;
}
static inline SpaIO
static inline enum spa_io
spa_epoll_to_io (uint32_t events)
{
SpaIO mask = 0;
enum spa_io mask = 0;
if (events & EPOLLIN)
mask |= SPA_IO_IN;
@ -120,11 +120,11 @@ spa_epoll_to_io (uint32_t events)
return mask;
}
static SpaResult
loop_add_source (SpaLoop *loop,
SpaSource *source)
static int
loop_add_source (struct spa_loop *loop,
struct spa_source *source)
{
struct loop *impl = SPA_CONTAINER_OF (loop, struct loop, loop);
struct impl *impl = SPA_CONTAINER_OF (loop, struct impl, loop);
source->loop = loop;
@ -141,11 +141,11 @@ loop_add_source (SpaLoop *loop,
return SPA_RESULT_OK;
}
static SpaResult
loop_update_source (SpaSource *source)
static int
loop_update_source (struct spa_source *source)
{
SpaLoop *loop = source->loop;
struct loop *impl = SPA_CONTAINER_OF (loop, struct loop, loop);
struct spa_loop *loop = source->loop;
struct impl *impl = SPA_CONTAINER_OF (loop, struct impl, loop);
if (source->fd != -1) {
struct epoll_event ep;
@ -161,10 +161,10 @@ loop_update_source (SpaSource *source)
}
static void
loop_remove_source (SpaSource *source)
loop_remove_source (struct spa_source *source)
{
SpaLoop *loop = source->loop;
struct loop *impl = SPA_CONTAINER_OF (loop, struct loop, loop);
struct spa_loop *loop = source->loop;
struct impl *impl = SPA_CONTAINER_OF (loop, struct impl, loop);
if (source->fd != -1)
epoll_ctl (impl->epoll_fd, EPOLL_CTL_DEL, source->fd, NULL);
@ -172,18 +172,18 @@ loop_remove_source (SpaSource *source)
source->loop = NULL;
}
static SpaResult
loop_invoke (SpaLoop *loop,
SpaInvokeFunc func,
uint32_t seq,
size_t size,
void *data,
void *user_data)
static int
loop_invoke (struct spa_loop *loop,
spa_invoke_func_t func,
uint32_t seq,
size_t size,
void *data,
void *user_data)
{
struct loop *impl = SPA_CONTAINER_OF (loop, struct loop, loop);
struct impl *impl = SPA_CONTAINER_OF (loop, struct impl, loop);
bool in_thread = pthread_equal (impl->thread, pthread_self());
struct invoke_item *item;
SpaResult res;
int res;
if (in_thread) {
res = func (loop, false, seq, size, data, user_data);
@ -237,11 +237,11 @@ loop_invoke (SpaLoop *loop,
}
static void
event_func (SpaLoopUtils *utils,
SpaSource *source,
event_func (struct spa_loop_utils *utils,
struct spa_source *source,
void *data)
{
struct loop *impl = data;
struct impl *impl = data;
uint32_t index;
while (spa_ringbuffer_get_read_index (&impl->buffer, &index) > 0) {
@ -252,20 +252,20 @@ event_func (SpaLoopUtils *utils,
}
static int
loop_get_fd (SpaLoopControl *ctrl)
loop_get_fd (struct spa_loop_control *ctrl)
{
struct loop *impl = SPA_CONTAINER_OF (ctrl, struct loop, control);
struct impl *impl = SPA_CONTAINER_OF (ctrl, struct impl, control);
return impl->epoll_fd;
}
static void
loop_set_hooks (SpaLoopControl *ctrl,
SpaLoopHook pre_func,
SpaLoopHook post_func,
loop_set_hooks (struct spa_loop_control *ctrl,
spa_loop_hook_t pre_func,
spa_loop_hook_t post_func,
void *data)
{
struct loop *impl = SPA_CONTAINER_OF (ctrl, struct loop, control);
struct impl *impl = SPA_CONTAINER_OF (ctrl, struct impl, control);
impl->pre_func = pre_func;
impl->post_func = post_func;
@ -273,24 +273,24 @@ loop_set_hooks (SpaLoopControl *ctrl,
}
static void
loop_enter (SpaLoopControl *ctrl)
loop_enter (struct spa_loop_control *ctrl)
{
struct loop *impl = SPA_CONTAINER_OF (ctrl, struct loop, control);
struct impl *impl = SPA_CONTAINER_OF (ctrl, struct impl, control);
impl->thread = pthread_self();
}
static void
loop_leave (SpaLoopControl *ctrl)
loop_leave (struct spa_loop_control *ctrl)
{
struct loop *impl = SPA_CONTAINER_OF (ctrl, struct loop, control);
struct impl *impl = SPA_CONTAINER_OF (ctrl, struct impl, control);
impl->thread = 0;
}
static SpaResult
loop_iterate (SpaLoopControl *ctrl,
static int
loop_iterate (struct spa_loop_control *ctrl,
int timeout)
{
struct loop *impl = SPA_CONTAINER_OF (ctrl, struct loop, control);
struct impl *impl = SPA_CONTAINER_OF (ctrl, struct impl, control);
struct pw_loop *loop = &impl->this;
struct epoll_event ep[32];
int i, nfds, save_errno;
@ -315,11 +315,11 @@ loop_iterate (SpaLoopControl *ctrl,
* some callback might also want to look at other sources it manages and
* can then reset the rmask to suppress the callback */
for (i = 0; i < nfds; i++) {
SpaSource *source = ep[i].data.ptr;
struct spa_source *source = ep[i].data.ptr;
source->rmask = spa_epoll_to_io (ep[i].events);
}
for (i = 0; i < nfds; i++) {
SpaSource *source = ep[i].data.ptr;
struct spa_source *source = ep[i].data.ptr;
if (source->rmask) {
source->func (source);
}
@ -328,24 +328,24 @@ loop_iterate (SpaLoopControl *ctrl,
}
static void
source_io_func (SpaSource *source)
source_io_func (struct spa_source *source)
{
SpaSourceImpl *impl = SPA_CONTAINER_OF (source, SpaSourceImpl, source);
struct source_impl *impl = SPA_CONTAINER_OF (source, struct source_impl, source);
impl->func.io (&impl->impl->utils, source, source->fd, source->rmask, source->data);
}
static SpaSource *
loop_add_io (SpaLoopUtils *utils,
static struct spa_source *
loop_add_io (struct spa_loop_utils *utils,
int fd,
SpaIO mask,
enum spa_io mask,
bool close,
SpaSourceIOFunc func,
spa_source_io_func_t func,
void *data)
{
struct loop *impl = SPA_CONTAINER_OF (utils, struct loop, utils);
SpaSourceImpl *source;
struct impl *impl = SPA_CONTAINER_OF (utils, struct impl, utils);
struct source_impl *source;
source = calloc (1, sizeof (SpaSourceImpl));
source = calloc (1, sizeof (struct source_impl));
if (source == NULL)
return NULL;
@ -365,9 +365,9 @@ loop_add_io (SpaLoopUtils *utils,
return &source->source;
}
static SpaResult
loop_update_io (SpaSource *source,
SpaIO mask)
static int
loop_update_io (struct spa_source *source,
enum spa_io mask)
{
source->mask = mask;
return spa_loop_update_source (source->loop, source);
@ -375,22 +375,22 @@ loop_update_io (SpaSource *source,
static void
source_idle_func (SpaSource *source)
source_idle_func (struct spa_source *source)
{
SpaSourceImpl *impl = SPA_CONTAINER_OF (source, SpaSourceImpl, source);
struct source_impl *impl = SPA_CONTAINER_OF (source, struct source_impl, source);
impl->func.idle (&impl->impl->utils, source, source->data);
}
static SpaSource *
loop_add_idle (SpaLoopUtils *utils,
static struct spa_source *
loop_add_idle (struct spa_loop_utils *utils,
bool enabled,
SpaSourceIdleFunc func,
spa_source_idle_func_t func,
void *data)
{
struct loop *impl = SPA_CONTAINER_OF (utils, struct loop, utils);
SpaSourceImpl *source;
struct impl *impl = SPA_CONTAINER_OF (utils, struct impl, utils);
struct source_impl *source;
source = calloc (1, sizeof (SpaSourceImpl));
source = calloc (1, sizeof (struct source_impl));
if (source == NULL)
return NULL;
@ -414,10 +414,10 @@ loop_add_idle (SpaLoopUtils *utils,
}
static void
loop_enable_idle (SpaSource *source,
loop_enable_idle (struct spa_source *source,
bool enabled)
{
SpaSourceImpl *impl = SPA_CONTAINER_OF (source, SpaSourceImpl, source);
struct source_impl *impl = SPA_CONTAINER_OF (source, struct source_impl, source);
uint64_t count;
if (enabled && !impl->enabled) {
@ -432,9 +432,9 @@ loop_enable_idle (SpaSource *source,
}
static void
source_event_func (SpaSource *source)
source_event_func (struct spa_source *source)
{
SpaSourceImpl *impl = SPA_CONTAINER_OF (source, SpaSourceImpl, source);
struct source_impl *impl = SPA_CONTAINER_OF (source, struct source_impl, source);
uint64_t count;
if (read (source->fd, &count, sizeof (uint64_t)) != sizeof (uint64_t))
@ -443,15 +443,15 @@ source_event_func (SpaSource *source)
impl->func.event (&impl->impl->utils, source, source->data);
}
static SpaSource *
loop_add_event (SpaLoopUtils *utils,
SpaSourceEventFunc func,
static struct spa_source *
loop_add_event (struct spa_loop_utils *utils,
spa_source_event_func_t func,
void *data)
{
struct loop *impl = SPA_CONTAINER_OF (utils, struct loop, utils);
SpaSourceImpl *source;
struct impl *impl = SPA_CONTAINER_OF (utils, struct impl, utils);
struct source_impl *source;
source = calloc (1, sizeof (SpaSourceImpl));
source = calloc (1, sizeof (struct source_impl));
if (source == NULL)
return NULL;
@ -472,7 +472,7 @@ loop_add_event (SpaLoopUtils *utils,
}
static void
loop_signal_event (SpaSource *source)
loop_signal_event (struct spa_source *source)
{
uint64_t count = 1;
@ -481,9 +481,9 @@ loop_signal_event (SpaSource *source)
}
static void
source_timer_func (SpaSource *source)
source_timer_func (struct spa_source *source)
{
SpaSourceImpl *impl = SPA_CONTAINER_OF (source, SpaSourceImpl, source);
struct source_impl *impl = SPA_CONTAINER_OF (source, struct source_impl, source);
uint64_t expires;
if (read (source->fd, &expires, sizeof (uint64_t)) != sizeof (uint64_t))
@ -492,15 +492,15 @@ source_timer_func (SpaSource *source)
impl->func.timer (&impl->impl->utils, source, source->data);
}
static SpaSource *
loop_add_timer (SpaLoopUtils *utils,
SpaSourceTimerFunc func,
static struct spa_source *
loop_add_timer (struct spa_loop_utils *utils,
spa_source_timer_func_t func,
void *data)
{
struct loop *impl = SPA_CONTAINER_OF (utils, struct loop, utils);
SpaSourceImpl *source;
struct impl *impl = SPA_CONTAINER_OF (utils, struct impl, utils);
struct source_impl *source;
source = calloc (1, sizeof (SpaSourceImpl));
source = calloc (1, sizeof (struct source_impl));
if (source == NULL)
return NULL;
@ -520,8 +520,8 @@ loop_add_timer (SpaLoopUtils *utils,
return &source->source;
}
static SpaResult
loop_update_timer (SpaSource *source,
static int
loop_update_timer (struct spa_source *source,
struct timespec *value,
struct timespec *interval,
bool absolute)
@ -549,9 +549,9 @@ loop_update_timer (SpaSource *source,
}
static void
source_signal_func (SpaSource *source)
source_signal_func (struct spa_source *source)
{
SpaSourceImpl *impl = SPA_CONTAINER_OF (source, SpaSourceImpl, source);
struct source_impl *impl = SPA_CONTAINER_OF (source, struct source_impl, source);
struct signalfd_siginfo signal_info;
if (read (source->fd, &signal_info, sizeof (signal_info)) != sizeof (signal_info))
@ -560,17 +560,17 @@ source_signal_func (SpaSource *source)
impl->func.signal (&impl->impl->utils, source, impl->signal_number, source->data);
}
static SpaSource *
loop_add_signal (SpaLoopUtils *utils,
static struct spa_source *
loop_add_signal (struct spa_loop_utils *utils,
int signal_number,
SpaSourceSignalFunc func,
spa_source_signal_func_t func,
void *data)
{
struct loop *impl = SPA_CONTAINER_OF (utils, struct loop, utils);
SpaSourceImpl *source;
struct impl *impl = SPA_CONTAINER_OF (utils, struct impl, utils);
struct source_impl *source;
sigset_t mask;
source = calloc (1, sizeof (SpaSourceImpl));
source = calloc (1, sizeof (struct source_impl));
if (source == NULL)
return NULL;
@ -595,9 +595,9 @@ loop_add_signal (SpaLoopUtils *utils,
}
static void
loop_destroy_source (SpaSource *source)
loop_destroy_source (struct spa_source *source)
{
SpaSourceImpl *impl = SPA_CONTAINER_OF (source, SpaSourceImpl, source);
struct source_impl *impl = SPA_CONTAINER_OF (source, struct source_impl, source);
spa_list_remove (&impl->link);
@ -611,10 +611,10 @@ loop_destroy_source (SpaSource *source)
struct pw_loop *
pw_loop_new (void)
{
struct loop *impl;
struct impl *impl;
struct pw_loop *this;
impl = calloc (1, sizeof (struct loop));
impl = calloc (1, sizeof (struct impl));
if (impl == NULL)
return NULL;
@ -629,14 +629,14 @@ pw_loop_new (void)
pw_signal_init (&this->before_iterate);
pw_signal_init (&this->destroy_signal);
impl->loop.size = sizeof (SpaLoop);
impl->loop.size = sizeof (struct spa_loop);
impl->loop.add_source = loop_add_source;
impl->loop.update_source = loop_update_source;
impl->loop.remove_source = loop_remove_source;
impl->loop.invoke = loop_invoke;
this->loop = &impl->loop;
impl->control.size = sizeof (SpaLoopControl);
impl->control.size = sizeof (struct spa_loop_control);
impl->control.get_fd = loop_get_fd;
impl->control.set_hooks = loop_set_hooks;
impl->control.enter = loop_enter;
@ -644,7 +644,7 @@ pw_loop_new (void)
impl->control.iterate = loop_iterate;
this->control = &impl->control;
impl->utils.size = sizeof (SpaLoopUtils);
impl->utils.size = sizeof (struct spa_loop_utils);
impl->utils.add_io = loop_add_io;
impl->utils.update_io = loop_update_io;
impl->utils.add_idle = loop_add_idle;
@ -673,8 +673,8 @@ no_epoll:
void
pw_loop_destroy (struct pw_loop *loop)
{
struct loop *impl = SPA_CONTAINER_OF (loop, struct loop, this);
SpaSourceImpl *source, *tmp;
struct impl *impl = SPA_CONTAINER_OF (loop, struct impl, this);
struct source_impl *source, *tmp;
pw_signal_emit (&loop->destroy_signal, loop);

View file

@ -34,9 +34,9 @@ extern "C" {
* PipeWire loop interface.
*/
struct pw_loop {
SpaLoop *loop;
SpaLoopControl *control;
SpaLoopUtils *utils;
struct spa_loop *loop;
struct spa_loop_control *control;
struct spa_loop_utils *utils;
PW_SIGNAL (before_iterate, (struct pw_listener *listener,
struct pw_loop *loop));

View file

@ -27,16 +27,16 @@
#include <pipewire/client/map.h>
typedef struct {
SpaTypeMap map;
struct impl {
struct spa_type_map map;
struct pw_map types;
struct pw_array strings;
} TypeMap;
};
static uint32_t
type_map_get_id (SpaTypeMap *map, const char *type)
type_map_get_id (struct spa_type_map *map, const char *type)
{
TypeMap *this = SPA_CONTAINER_OF (map, TypeMap, map);
struct impl *this = SPA_CONTAINER_OF (map, struct impl, map);
uint32_t i = 0, len;
void *p;
off_t o;
@ -57,9 +57,9 @@ type_map_get_id (SpaTypeMap *map, const char *type)
}
static const char *
type_map_get_type (const SpaTypeMap *map, uint32_t id)
type_map_get_type (const struct spa_type_map *map, uint32_t id)
{
TypeMap *this = SPA_CONTAINER_OF (map, TypeMap, map);
struct impl *this = SPA_CONTAINER_OF (map, struct impl, map);
if (id == SPA_ID_INVALID)
return NULL;
@ -72,14 +72,14 @@ type_map_get_type (const SpaTypeMap *map, uint32_t id)
}
static size_t
type_map_get_size (const SpaTypeMap *map)
type_map_get_size (const struct spa_type_map *map)
{
TypeMap *this = SPA_CONTAINER_OF (map, TypeMap, map);
struct impl *this = SPA_CONTAINER_OF (map, struct impl, map);
return pw_map_get_size (&this->types);
}
static TypeMap default_type_map = {
{ sizeof (SpaTypeMap),
static struct impl default_type_map = {
{ sizeof (struct spa_type_map),
NULL,
type_map_get_id,
type_map_get_type,
@ -89,7 +89,7 @@ static TypeMap default_type_map = {
PW_ARRAY_INIT (4096)
};
SpaTypeMap *
struct spa_type_map *
pw_type_map_get_default (void)
{
spa_type_map_set_default (&default_type_map.map);

View file

@ -75,7 +75,7 @@ static inline int memfd_create(const char *name, unsigned int flags) {
#undef USE_MEMFD
SpaResult
int
pw_memblock_map (struct pw_memblock *mem)
{
if (mem->ptr != NULL)
@ -118,7 +118,7 @@ pw_memblock_map (struct pw_memblock *mem)
return SPA_RESULT_OK;
}
SpaResult
int
pw_memblock_alloc (enum pw_memblock_flags flags,
size_t size,
struct pw_memblock *mem)

View file

@ -45,10 +45,10 @@ struct pw_memblock {
size_t size;
};
SpaResult pw_memblock_alloc (enum pw_memblock_flags flags,
int pw_memblock_alloc (enum pw_memblock_flags flags,
size_t size,
struct pw_memblock *mem);
SpaResult pw_memblock_map (struct pw_memblock *mem);
int pw_memblock_map (struct pw_memblock *mem);
void pw_memblock_free (struct pw_memblock *mem);
#ifdef __cplusplus

View file

@ -51,7 +51,7 @@ void pw_fill_stream_properties (struct pw_properties *properties);
enum pw_direction pw_direction_reverse (enum pw_direction direction);
SpaTypeMap * pw_type_map_get_default (void);
struct spa_type_map * pw_type_map_get_default (void);
#ifdef __cplusplus
}

View file

@ -29,19 +29,19 @@ struct properties {
static void
add_func (struct pw_properties *this, char *key, char *value)
{
SpaDictItem *item;
struct spa_dict_item *item;
struct properties *impl = SPA_CONTAINER_OF (this, struct properties, this);
item = pw_array_add (&impl->items, sizeof (SpaDictItem));
item = pw_array_add (&impl->items, sizeof (struct spa_dict_item));
item->key = key;
item->value = value;
this->dict.items = impl->items.data;
this->dict.n_items = pw_array_get_len (&impl->items, SpaDictItem);
this->dict.n_items = pw_array_get_len (&impl->items, struct spa_dict_item);
}
static void
clear_item (SpaDictItem *item)
clear_item (struct spa_dict_item *item)
{
free ((char*)item->key);
free ((char*)item->value);
@ -51,10 +51,10 @@ static int
find_index (struct pw_properties *this, const char *key)
{
struct properties *impl = SPA_CONTAINER_OF (this, struct properties, this);
int i, len = pw_array_get_len (&impl->items, SpaDictItem);
int i, len = pw_array_get_len (&impl->items, struct spa_dict_item);
for (i = 0; i < len; i++) {
SpaDictItem *item = pw_array_get_unchecked (&impl->items, i, SpaDictItem);
struct spa_dict_item *item = pw_array_get_unchecked (&impl->items, i, struct spa_dict_item);
if (strcmp (item->key, key) == 0)
return i;
}
@ -103,7 +103,7 @@ pw_properties_new (const char *key, ...)
* Returns: a new #struct pw_properties
*/
struct pw_properties *
pw_properties_new_dict (const SpaDict *dict)
pw_properties_new_dict (const struct spa_dict *dict)
{
uint32_t i;
struct properties *impl;
@ -133,7 +133,7 @@ pw_properties_copy (struct pw_properties *properties)
{
struct properties *impl = SPA_CONTAINER_OF (properties, struct properties, this);
struct pw_properties *copy;
SpaDictItem *item;
struct spa_dict_item *item;
copy = pw_properties_new (NULL, NULL);
if (copy == NULL)
@ -185,7 +185,7 @@ void
pw_properties_free (struct pw_properties *properties)
{
struct properties *impl = SPA_CONTAINER_OF (properties, struct properties, this);
SpaDictItem *item;
struct spa_dict_item *item;
pw_array_for_each (item, &impl->items)
clear_item (item);
@ -205,16 +205,16 @@ do_replace (struct pw_properties *properties,
if (index == -1) {
add_func (properties, key, value);
} else {
SpaDictItem *item = pw_array_get_unchecked (&impl->items, index, SpaDictItem);
struct spa_dict_item *item = pw_array_get_unchecked (&impl->items, index, struct spa_dict_item);
clear_item (item);
if (value == NULL) {
SpaDictItem *other = pw_array_get_unchecked (&impl->items,
pw_array_get_len (&impl->items, SpaDictItem) - 1,
SpaDictItem);
struct spa_dict_item *other = pw_array_get_unchecked (&impl->items,
pw_array_get_len (&impl->items, struct spa_dict_item) - 1,
struct spa_dict_item);
item->key = other->key;
item->value = other->value;
impl->items.size -= sizeof (SpaDictItem);
impl->items.size -= sizeof (struct spa_dict_item);
} else {
item->key = key;
item->value = value;
@ -285,7 +285,7 @@ pw_properties_get (struct pw_properties *properties,
if (index == -1)
return NULL;
return pw_array_get_unchecked (&impl->items, index, SpaDictItem)->value;
return pw_array_get_unchecked (&impl->items, index, struct spa_dict_item)->value;
}
/**
@ -314,10 +314,10 @@ pw_properties_iterate (struct pw_properties *properties,
else
index = SPA_PTR_TO_INT (*state);
if (!pw_array_check_index (&impl->items, index, SpaDictItem))
if (!pw_array_check_index (&impl->items, index, struct spa_dict_item))
return NULL;
*state = SPA_INT_TO_PTR (index + 1);
return pw_array_get_unchecked (&impl->items, index, SpaDictItem)->key;
return pw_array_get_unchecked (&impl->items, index, struct spa_dict_item)->key;
}

View file

@ -27,11 +27,11 @@ extern "C" {
#include <spa/dict.h>
struct pw_properties {
SpaDict dict;
struct spa_dict dict;
};
struct pw_properties * pw_properties_new (const char *key, ...);
struct pw_properties * pw_properties_new_dict (const SpaDict *dict);
struct pw_properties * pw_properties_new_dict (const struct spa_dict *dict);
struct pw_properties * pw_properties_copy (struct pw_properties *properties);
struct pw_properties * pw_properties_merge (struct pw_properties *oldprops,
struct pw_properties *newprops);

View file

@ -27,14 +27,14 @@
#include "pipewire/client/connection.h"
struct builder {
SpaPODBuilder b;
struct spa_pod_builder b;
struct pw_connection *connection;
};
typedef bool (*demarshal_func_t) (void *object, void *data, size_t size);
static uint32_t
write_pod (SpaPODBuilder *b, uint32_t ref, const void *data, uint32_t size)
write_pod (struct spa_pod_builder *b, uint32_t ref, const void *data, uint32_t size)
{
if (ref == -1)
ref = b->offset;
@ -71,12 +71,12 @@ core_update_map (struct pw_context *context)
static void
core_marshal_client_update (void *object,
const SpaDict *props)
const struct spa_dict *props)
{
struct pw_proxy *proxy = object;
struct pw_connection *connection = proxy->context->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
int i, n_items;
if (connection == NULL)
@ -108,7 +108,7 @@ core_marshal_sync (void *object,
struct pw_proxy *proxy = object;
struct pw_connection *connection = proxy->context->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
if (connection == NULL)
return;
@ -128,7 +128,7 @@ core_marshal_get_registry (void *object,
struct pw_proxy *proxy = object;
struct pw_connection *connection = proxy->context->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
if (connection == NULL)
return;
@ -145,13 +145,13 @@ static void
core_marshal_create_node (void *object,
const char *factory_name,
const char *name,
const SpaDict *props,
const struct spa_dict *props,
uint32_t new_id)
{
struct pw_proxy *proxy = object;
struct pw_connection *connection = proxy->context->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
uint32_t i, n_items;
if (connection == NULL)
@ -183,13 +183,13 @@ core_marshal_create_node (void *object,
static void
core_marshal_create_client_node (void *object,
const char *name,
const SpaDict *props,
const struct spa_dict *props,
uint32_t new_id)
{
struct pw_proxy *proxy = object;
struct pw_connection *connection = proxy->context->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
uint32_t i, n_items;
if (connection == NULL)
@ -226,7 +226,7 @@ core_marshal_update_types (void *object,
struct pw_proxy *proxy = object;
struct pw_connection *connection = proxy->context->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
uint32_t i;
if (connection == NULL)
@ -253,9 +253,9 @@ core_demarshal_info (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaDict props;
struct spa_dict props;
struct pw_core_info info;
SpaPODIter it;
struct spa_pod_iter it;
int i;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -272,7 +272,7 @@ core_demarshal_info (void *object,
return false;
info.props = &props;
props.items = alloca (props.n_items * sizeof (SpaDictItem));
props.items = alloca (props.n_items * sizeof (struct spa_dict_item));
for (i = 0; i < props.n_items; i++) {
if (!spa_pod_iter_get (&it,
SPA_POD_TYPE_STRING, &props.items[i].key,
@ -290,7 +290,7 @@ core_demarshal_done (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t seq;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -309,7 +309,7 @@ core_demarshal_error (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t id, res;
const char *error;
@ -331,7 +331,7 @@ core_demarshal_remove_id (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t id;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -350,7 +350,7 @@ core_demarshal_update_types (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t first_id, n_types;
const char **types;
int i;
@ -377,8 +377,8 @@ module_demarshal_info (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
SpaDict props;
struct spa_pod_iter it;
struct spa_dict props;
struct pw_module_info info;
int i;
@ -394,7 +394,7 @@ module_demarshal_info (void *object,
return false;
info.props = &props;
props.items = alloca (props.n_items * sizeof (SpaDictItem));
props.items = alloca (props.n_items * sizeof (struct spa_dict_item));
for (i = 0; i < props.n_items; i++) {
if (!spa_pod_iter_get (&it,
SPA_POD_TYPE_STRING, &props.items[i].key,
@ -412,8 +412,8 @@ node_demarshal_info (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
SpaDict props;
struct spa_pod_iter it;
struct spa_dict props;
struct pw_node_info info;
int i;
@ -429,7 +429,7 @@ node_demarshal_info (void *object,
0))
return false;
info.input_formats = alloca (info.n_input_formats * sizeof (SpaFormat*));
info.input_formats = alloca (info.n_input_formats * sizeof (struct spa_format*));
for (i = 0; i < info.n_input_formats; i++)
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &info.input_formats[i], 0))
return false;
@ -441,7 +441,7 @@ node_demarshal_info (void *object,
0))
return false;
info.output_formats = alloca (info.n_output_formats * sizeof (SpaFormat*));
info.output_formats = alloca (info.n_output_formats * sizeof (struct spa_format*));
for (i = 0; i < info.n_output_formats; i++)
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &info.output_formats[i], 0))
return false;
@ -454,7 +454,7 @@ node_demarshal_info (void *object,
return false;
info.props = &props;
props.items = alloca (props.n_items * sizeof (SpaDictItem));
props.items = alloca (props.n_items * sizeof (struct spa_dict_item));
for (i = 0; i < props.n_items; i++) {
if (!spa_pod_iter_get (&it,
SPA_POD_TYPE_STRING, &props.items[i].key,
@ -471,12 +471,12 @@ client_node_marshal_update (void *object,
uint32_t change_mask,
uint32_t max_input_ports,
uint32_t max_output_ports,
const SpaProps *props)
const struct spa_props *props)
{
struct pw_proxy *proxy = object;
struct pw_connection *connection = proxy->context->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
if (connection == NULL)
return;
@ -494,20 +494,20 @@ client_node_marshal_update (void *object,
static void
client_node_marshal_port_update (void *object,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
uint32_t change_mask,
uint32_t n_possible_formats,
const SpaFormat **possible_formats,
const SpaFormat *format,
const struct spa_format **possible_formats,
const struct spa_format *format,
uint32_t n_params,
const SpaParam **params,
const SpaPortInfo *info)
const struct spa_param **params,
const struct spa_port_info *info)
{
struct pw_proxy *proxy = object;
struct pw_connection *connection = proxy->context->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f[2];
struct spa_pod_frame f[2];
int i;
if (connection == NULL)
@ -532,7 +532,7 @@ client_node_marshal_port_update (void *object,
0);
for (i = 0; i < n_params; i++) {
const SpaParam *p = params[i];
const struct spa_param *p = params[i];
spa_pod_builder_add (&b.b, SPA_POD_TYPE_POD, p, 0);
}
@ -553,12 +553,12 @@ client_node_marshal_port_update (void *object,
static void
client_node_marshal_event (void *object,
SpaEvent *event)
struct spa_event *event)
{
struct pw_proxy *proxy = object;
struct pw_connection *connection = proxy->context->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
if (connection == NULL)
return;
@ -577,7 +577,7 @@ client_node_marshal_destroy (void *object)
struct pw_proxy *proxy = object;
struct pw_connection *connection = proxy->context->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
if (connection == NULL)
return;
@ -595,7 +595,7 @@ client_node_demarshal_done (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
struct pw_connection *connection = proxy->context->protocol_private;
int32_t ridx, widx;
int readfd, writefd;
@ -622,8 +622,8 @@ client_node_demarshal_event (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
const SpaEvent *event;
struct spa_pod_iter it;
const struct spa_event *event;
if (!spa_pod_iter_struct (&it, data, size) ||
!pw_pod_remap_data (SPA_POD_TYPE_STRUCT, data, size, &proxy->context->types) ||
@ -642,7 +642,7 @@ client_node_demarshal_add_port (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
int32_t seq, direction, port_id;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -663,7 +663,7 @@ client_node_demarshal_remove_port (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
int32_t seq, direction, port_id;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -684,9 +684,9 @@ client_node_demarshal_set_format (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t seq, direction, port_id, flags;
const SpaFormat *format = NULL;
const struct spa_format *format = NULL;
if (!spa_pod_iter_struct (&it, data, size) ||
!pw_pod_remap_data (SPA_POD_TYPE_STRUCT, data, size, &proxy->context->types) ||
@ -710,7 +710,7 @@ client_node_demarshal_set_property (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t seq, id;
const void *value;
uint32_t s;
@ -733,7 +733,7 @@ client_node_demarshal_add_mem (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
struct pw_connection *connection = proxy->context->protocol_private;
uint32_t direction, port_id, mem_id, type, memfd_idx, flags, offset, sz;
int memfd;
@ -772,7 +772,7 @@ client_node_demarshal_use_buffers (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t seq, direction, port_id, n_buffers, data_id;
struct pw_client_node_buffer *buffers;
int i, j;
@ -789,7 +789,7 @@ client_node_demarshal_use_buffers (void *object,
buffers = alloca (sizeof (struct pw_client_node_buffer) * n_buffers);
for (i = 0; i < n_buffers; i++) {
SpaBuffer *buf = buffers[i].buffer = alloca (sizeof (SpaBuffer));
struct spa_buffer *buf = buffers[i].buffer = alloca (sizeof (struct spa_buffer));
if (!spa_pod_iter_get (&it,
SPA_POD_TYPE_INT, &buffers[i].mem_id,
@ -799,9 +799,9 @@ client_node_demarshal_use_buffers (void *object,
SPA_POD_TYPE_INT, &buf->n_metas, 0))
return false;
buf->metas = alloca (sizeof (SpaMeta) * buf->n_metas);
buf->metas = alloca (sizeof (struct spa_meta) * buf->n_metas);
for (j = 0; j < buf->n_metas; j++) {
SpaMeta *m = &buf->metas[j];
struct spa_meta *m = &buf->metas[j];
if (!spa_pod_iter_get (&it,
SPA_POD_TYPE_ID, &m->type,
@ -811,9 +811,9 @@ client_node_demarshal_use_buffers (void *object,
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_INT, &buf->n_datas, 0))
return false;
buf->datas = alloca (sizeof (SpaData) * buf->n_datas);
buf->datas = alloca (sizeof (struct spa_data) * buf->n_datas);
for (j = 0; j < buf->n_datas; j++) {
SpaData *d = &buf->datas[j];
struct spa_data *d = &buf->datas[j];
if (!spa_pod_iter_get (&it,
SPA_POD_TYPE_ID, &d->type,
@ -842,8 +842,8 @@ client_node_demarshal_node_command (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
const SpaCommand *command;
struct spa_pod_iter it;
const struct spa_command *command;
uint32_t seq;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -864,8 +864,8 @@ client_node_demarshal_port_command (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
const SpaCommand *command;
struct spa_pod_iter it;
const struct spa_command *command;
uint32_t port_id;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -886,7 +886,7 @@ client_node_demarshal_transport (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
struct pw_connection *connection = proxy->context->protocol_private;
uint32_t memfd_idx, offset, sz;
int memfd;
@ -910,8 +910,8 @@ client_demarshal_info (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
SpaDict props;
struct spa_pod_iter it;
struct spa_dict props;
struct pw_client_info info;
uint32_t i;
@ -924,7 +924,7 @@ client_demarshal_info (void *object,
return false;
info.props = &props;
props.items = alloca (props.n_items * sizeof (SpaDictItem));
props.items = alloca (props.n_items * sizeof (struct spa_dict_item));
for (i = 0; i < props.n_items; i++) {
if (!spa_pod_iter_get (&it,
SPA_POD_TYPE_STRING, &props.items[i].key,
@ -942,7 +942,7 @@ link_demarshal_info (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
struct pw_link_info info;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -966,7 +966,7 @@ registry_demarshal_global (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t id;
const char *type;
@ -987,7 +987,7 @@ registry_demarshal_global_remove (void *object,
size_t size)
{
struct pw_proxy *proxy = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t id;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -1008,7 +1008,7 @@ registry_marshal_bind (void *object,
struct pw_proxy *proxy = object;
struct pw_connection *connection = proxy->context->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
if (connection == NULL)
return;

View file

@ -30,7 +30,7 @@ extern "C" {
struct pw_proxy {
struct pw_context *context;
SpaList link;
struct spa_list link;
uint32_t id;
uint32_t type;

View file

@ -27,13 +27,13 @@ extern "C" {
#endif
struct pw_listener {
SpaList link;
struct spa_list link;
void (*notify) (void *);
};
#define PW_SIGNAL(name,func) \
union { \
SpaList listeners; \
struct spa_list listeners; \
void (*notify) func; \
} name;

View file

@ -51,25 +51,25 @@ struct mem_id {
};
struct buffer_id {
SpaList link;
struct spa_list link;
uint32_t id;
bool used;
void *buf_ptr;
SpaBuffer *buf;
struct spa_buffer *buf;
};
struct stream {
struct pw_stream this;
uint32_t n_possible_formats;
SpaFormat **possible_formats;
struct spa_format **possible_formats;
uint32_t n_params;
SpaParam **params;
struct spa_param **params;
SpaFormat *format;
SpaPortInfo port_info;
SpaDirection direction;
struct spa_format *format;
struct spa_port_info port_info;
enum spa_direction direction;
uint32_t port_id;
uint32_t pending_seq;
@ -77,7 +77,7 @@ struct stream {
int rtreadfd;
int rtwritefd;
SpaSource *rtsocket_source;
struct spa_source *rtsocket_source;
struct pw_proxy *node_proxy;
bool disconnecting;
@ -85,13 +85,13 @@ struct stream {
struct pw_transport *trans;
SpaSource *timeout_source;
struct spa_source *timeout_source;
struct pw_array mem_ids;
struct pw_array buffer_ids;
bool in_order;
SpaList free;
struct spa_list free;
bool in_need_buffer;
int64_t last_ticks;
@ -272,7 +272,7 @@ unhandle_socket (struct pw_stream *stream)
static void
set_possible_formats (struct pw_stream *stream,
int n_possible_formats,
SpaFormat **possible_formats)
struct spa_format **possible_formats)
{
struct stream *impl = SPA_CONTAINER_OF (stream, struct stream, this);
int i;
@ -285,7 +285,7 @@ set_possible_formats (struct pw_stream *stream,
}
impl->n_possible_formats = n_possible_formats;
if (n_possible_formats > 0) {
impl->possible_formats = malloc (n_possible_formats * sizeof (SpaFormat *));
impl->possible_formats = malloc (n_possible_formats * sizeof (struct spa_format *));
for (i = 0; i < n_possible_formats; i++)
impl->possible_formats[i] = spa_format_copy (possible_formats[i]);
}
@ -294,7 +294,7 @@ set_possible_formats (struct pw_stream *stream,
static void
set_params (struct pw_stream *stream,
int n_params,
SpaParam **params)
struct spa_param **params)
{
struct stream *impl = SPA_CONTAINER_OF (stream, struct stream, this);
int i;
@ -307,7 +307,7 @@ set_params (struct pw_stream *stream,
}
impl->n_params = n_params;
if (n_params > 0) {
impl->params = malloc (n_params * sizeof (SpaParam *));
impl->params = malloc (n_params * sizeof (struct spa_param *));
for (i = 0; i < n_params; i++)
impl->params[i] = spa_param_copy (params[i]);
}
@ -384,10 +384,10 @@ add_port_update (struct pw_stream *stream, uint32_t change_mask)
impl->port_id,
change_mask,
impl->n_possible_formats,
(const SpaFormat **) impl->possible_formats,
(const struct spa_format **) impl->possible_formats,
impl->format,
impl->n_params,
(const SpaParam **)impl->params,
(const struct spa_param **)impl->params,
&impl->port_info);
}
@ -396,14 +396,10 @@ send_need_input (struct pw_stream *stream)
{
#if 0
struct stream *impl = SPA_CONTAINER_OF (stream, struct stream, this);
SpaEventNodeNeedInput ni;
uint64_t cmd = 1;
pw_log_debug ("stream %p: need input", stream);
ni.event.type = SPA_EVENT_NODE_NEED_INPUT;
ni.event.size = sizeof (ni);
pw_transport_add_event (impl->trans, &ni.event);
pw_transport_add_event (impl->trans,
&SPA_EVENT_INIT (stream->context->type.event_transport.NeedInput));
write (impl->rtwritefd, &cmd, 8);
#endif
}
@ -424,7 +420,7 @@ add_request_clock_update (struct pw_stream *stream)
{
struct stream *impl = SPA_CONTAINER_OF (stream, struct stream, this);
pw_client_node_do_event (impl->node_proxy, (SpaEvent*)
pw_client_node_do_event (impl->node_proxy, (struct spa_event*)
&SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_INIT (stream->context->type.event_node.RequestClockUpdate,
SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_TIME, 0, 0));
}
@ -432,11 +428,11 @@ add_request_clock_update (struct pw_stream *stream)
static void
add_async_complete (struct pw_stream *stream,
uint32_t seq,
SpaResult res)
int res)
{
struct stream *impl = SPA_CONTAINER_OF (stream, struct stream, this);
pw_client_node_do_event (impl->node_proxy, (SpaEvent*)
pw_client_node_do_event (impl->node_proxy, (struct spa_event*)
&SPA_EVENT_NODE_ASYNC_COMPLETE_INIT (stream->context->type.event_node.AsyncComplete,
seq, res));
@ -457,8 +453,8 @@ do_node_init (struct pw_stream *stream)
}
static void
on_timeout (SpaLoopUtils *utils,
SpaSource *source,
on_timeout (struct spa_loop_utils *utils,
struct spa_source *source,
void *data)
{
struct pw_stream *stream = data;
@ -512,7 +508,7 @@ reuse_buffer (struct pw_stream *stream, uint32_t id)
static void
handle_rtnode_event (struct pw_stream *stream,
SpaEvent *event)
struct spa_event *event)
{
struct stream *impl = SPA_CONTAINER_OF (stream, struct stream, this);
struct pw_context *context = impl->this.context;
@ -521,7 +517,7 @@ handle_rtnode_event (struct pw_stream *stream,
int i;
for (i = 0; i < impl->trans->area->n_inputs; i++) {
SpaPortIO *input = &impl->trans->inputs[i];
struct spa_port_io *input = &impl->trans->inputs[i];
pw_log_trace ("stream %p: have output %d %d", stream, input->status, input->buffer_id);
if (input->buffer_id == SPA_ID_INVALID)
@ -536,7 +532,7 @@ handle_rtnode_event (struct pw_stream *stream,
int i;
for (i = 0; i < impl->trans->area->n_outputs; i++) {
SpaPortIO *output = &impl->trans->outputs[i];
struct spa_port_io *output = &impl->trans->outputs[i];
if (output->buffer_id == SPA_ID_INVALID)
continue;
@ -565,10 +561,10 @@ handle_rtnode_event (struct pw_stream *stream,
}
static void
on_rtsocket_condition (SpaLoopUtils *utils,
SpaSource *source,
on_rtsocket_condition (struct spa_loop_utils *utils,
struct spa_source *source,
int fd,
SpaIO mask,
enum spa_io mask,
void *data)
{
struct pw_stream *stream = data;
@ -581,13 +577,13 @@ on_rtsocket_condition (SpaLoopUtils *utils,
}
if (mask & SPA_IO_IN) {
SpaEvent event;
struct spa_event event;
uint64_t cmd;
read (impl->rtreadfd, &cmd, 8);
while (pw_transport_next_event (impl->trans, &event) == SPA_RESULT_OK) {
SpaEvent *ev = alloca (SPA_POD_SIZE (&event));
struct spa_event *ev = alloca (SPA_POD_SIZE (&event));
pw_transport_parse_event (impl->trans, ev);
handle_rtnode_event (stream, ev);
}
@ -624,7 +620,7 @@ handle_socket (struct pw_stream *stream, int rtreadfd, int rtwritefd)
static void
handle_node_event (struct pw_stream *stream,
const SpaEvent *event)
const struct spa_event *event)
{
pw_log_warn ("unhandled node event %d", SPA_EVENT_TYPE (event));
}
@ -632,7 +628,7 @@ handle_node_event (struct pw_stream *stream,
static bool
handle_node_command (struct pw_stream *stream,
uint32_t seq,
const SpaCommand *command)
const struct spa_command *command)
{
struct stream *impl = SPA_CONTAINER_OF (stream, struct stream, this);
struct pw_context *context = stream->context;
@ -671,7 +667,7 @@ handle_node_command (struct pw_stream *stream,
}
}
else if (SPA_COMMAND_TYPE (command) == context->type.command_node.ClockUpdate) {
SpaCommandNodeClockUpdate *cu = (SpaCommandNodeClockUpdate *) command;
struct spa_command_node_clock_update *cu = (struct spa_command_node_clock_update *) command;
if (cu->body.flags.value & SPA_COMMAND_NODE_CLOCK_UPDATE_FLAG_LIVE) {
pw_properties_set (stream->properties,
"pipewire.latency.is-live", "1");
@ -706,7 +702,7 @@ client_node_done (void *object,
static void
client_node_event (void *object,
const SpaEvent *event)
const struct spa_event *event)
{
struct pw_proxy *proxy = object;
struct pw_stream *stream = proxy->user_data;
@ -716,7 +712,7 @@ client_node_event (void *object,
static void
client_node_add_port (void *object,
uint32_t seq,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id)
{
pw_log_warn ("add port not supported");
@ -725,7 +721,7 @@ client_node_add_port (void *object,
static void
client_node_remove_port (void *object,
uint32_t seq,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id)
{
pw_log_warn ("remove port not supported");
@ -734,10 +730,10 @@ client_node_remove_port (void *object,
static void
client_node_set_format (void *object,
uint32_t seq,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
uint32_t flags,
const SpaFormat *format)
const struct spa_format *format)
{
struct pw_proxy *proxy = object;
struct pw_stream *stream = proxy->user_data;
@ -768,7 +764,7 @@ client_node_set_property (void *object,
static void
client_node_add_mem (void *object,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
uint32_t mem_id,
uint32_t type,
@ -803,7 +799,7 @@ client_node_add_mem (void *object,
static void
client_node_use_buffers (void *object,
uint32_t seq,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
uint32_t n_buffers,
struct pw_client_node_buffer *buffers)
@ -813,7 +809,7 @@ client_node_use_buffers (void *object,
struct stream *impl = SPA_CONTAINER_OF (stream, struct stream, this);
struct buffer_id *bid;
uint32_t i, j, len;
SpaBuffer *b;
struct spa_buffer *b;
/* clear previous buffers */
clear_buffers (stream);
@ -852,17 +848,17 @@ client_node_use_buffers (void *object,
{
size_t size;
size = sizeof (SpaBuffer);
size = sizeof (struct spa_buffer);
for (j = 0; j < buffers[i].buffer->n_metas; j++)
size += sizeof (SpaMeta);
size += sizeof (struct spa_meta);
for (j = 0; j < buffers[i].buffer->n_datas; j++)
size += sizeof (SpaData);
size += sizeof (struct spa_data);
b = bid->buf = malloc (size);
memcpy (b, buffers[i].buffer, sizeof (SpaBuffer));
memcpy (b, buffers[i].buffer, sizeof (struct spa_buffer));
b->metas = SPA_MEMBER (b, sizeof (SpaBuffer), SpaMeta);
b->datas = SPA_MEMBER (b->metas, sizeof(SpaMeta) * b->n_metas, SpaData);
b->metas = SPA_MEMBER (b, sizeof (struct spa_buffer), struct spa_meta);
b->datas = SPA_MEMBER (b->metas, sizeof(struct spa_meta) * b->n_metas, struct spa_data);
}
bid->id = b->id;
@ -874,17 +870,17 @@ client_node_use_buffers (void *object,
offset = 0;
for (j = 0; j < b->n_metas; j++) {
SpaMeta *m = &b->metas[j];
memcpy (m, &buffers[i].buffer->metas[j], sizeof (SpaMeta));
struct spa_meta *m = &b->metas[j];
memcpy (m, &buffers[i].buffer->metas[j], sizeof (struct spa_meta));
m->data = SPA_MEMBER (bid->buf_ptr, offset, void);
offset += m->size;
}
for (j = 0; j < b->n_datas; j++) {
SpaData *d = &b->datas[j];
struct spa_data *d = &b->datas[j];
memcpy (d, &buffers[i].buffer->datas[j], sizeof (SpaData));
d->chunk = SPA_MEMBER (bid->buf_ptr, offset + sizeof (SpaChunk) * j, SpaChunk);
memcpy (d, &buffers[i].buffer->datas[j], sizeof (struct spa_data));
d->chunk = SPA_MEMBER (bid->buf_ptr, offset + sizeof (struct spa_chunk) * j, struct spa_chunk);
if (d->type == stream->context->type.data.Id) {
struct mem_id *bmid = find_mem (stream, SPA_PTR_TO_UINT32 (d->data));
@ -918,7 +914,7 @@ client_node_use_buffers (void *object,
static void
client_node_node_command (void *object,
uint32_t seq,
const SpaCommand *command)
const struct spa_command *command)
{
struct pw_proxy *proxy = object;
struct pw_stream *stream = proxy->user_data;
@ -928,7 +924,7 @@ client_node_node_command (void *object,
static void
client_node_port_command (void *object,
uint32_t port_id,
const SpaCommand *command)
const struct spa_command *command)
{
pw_log_warn ("port command not supported");
}
@ -1009,7 +1005,7 @@ pw_stream_connect (struct pw_stream *stream,
const char *port_path,
enum pw_stream_flags flags,
uint32_t n_possible_formats,
SpaFormat **possible_formats)
struct spa_format **possible_formats)
{
struct stream *impl = SPA_CONTAINER_OF (stream, struct stream, this);
@ -1053,8 +1049,8 @@ pw_stream_connect (struct pw_stream *stream,
/**
* pw_stream_finish_format:
* @stream: a #struct pw_stream
* @res: a #SpaResult
* @params: an array of pointers to #SpaParam
* @res: a #int
* @params: an array of pointers to #struct spa_param
* @n_params: number of elements in @params
*
* Complete the negotiation process with result code @res.
@ -1068,8 +1064,8 @@ pw_stream_connect (struct pw_stream *stream,
*/
bool
pw_stream_finish_format (struct pw_stream *stream,
SpaResult res,
SpaParam **params,
int res,
struct spa_param **params,
uint32_t n_params)
{
struct stream *impl = SPA_CONTAINER_OF (stream, struct stream, this);
@ -1180,7 +1176,7 @@ pw_stream_recycle_buffer (struct pw_stream *stream,
bid->used = false;
spa_list_insert (impl->free.prev, &bid->link);
pw_transport_add_event (impl->trans, (SpaEvent *)&rb);
pw_transport_add_event (impl->trans, (struct spa_event *)&rb);
write (impl->rtwritefd, &cmd, 8);
return true;
@ -1194,9 +1190,9 @@ pw_stream_recycle_buffer (struct pw_stream *stream,
* Get the buffer with @id from @stream. This function should be called from
* the new-buffer signal callback.
*
* Returns: a #SpaBuffer or %NULL when there is no buffer.
* Returns: a #struct spa_buffer or %NULL when there is no buffer.
*/
SpaBuffer *
struct spa_buffer *
pw_stream_peek_buffer (struct pw_stream *stream,
uint32_t id)
{

View file

@ -65,7 +65,7 @@ struct pw_time{
*/
struct pw_stream {
struct pw_context *context;
SpaList link;
struct spa_list link;
char *name;
struct pw_properties *properties;
@ -80,7 +80,7 @@ struct pw_stream {
PW_SIGNAL (format_changed, (struct pw_listener *listener,
struct pw_stream *stream,
SpaFormat *format));
struct spa_format *format));
PW_SIGNAL (add_buffer, (struct pw_listener *listener,
struct pw_stream *stream,
@ -106,12 +106,12 @@ bool pw_stream_connect (struct pw_stream *stream,
const char *port_path,
enum pw_stream_flags flags,
uint32_t n_possible_formats,
SpaFormat **possible_formats);
struct spa_format **possible_formats);
bool pw_stream_disconnect (struct pw_stream *stream);
bool pw_stream_finish_format (struct pw_stream *stream,
SpaResult res,
SpaParam **params,
int res,
struct spa_param **params,
uint32_t n_params);
bool pw_stream_get_time (struct pw_stream *stream,
@ -120,7 +120,7 @@ bool pw_stream_get_time (struct pw_stream *stream,
uint32_t pw_stream_get_empty_buffer (struct pw_stream *stream);
bool pw_stream_recycle_buffer (struct pw_stream *stream,
uint32_t id);
SpaBuffer * pw_stream_peek_buffer (struct pw_stream *stream,
struct spa_buffer *pw_stream_peek_buffer (struct pw_stream *stream,
uint32_t id);
bool pw_stream_send_buffer (struct pw_stream *stream,
uint32_t id);

View file

@ -34,14 +34,14 @@ struct thread_main_loop {
bool running;
pthread_t thread;
SpaSource *event;
struct spa_source *event;
int n_waiting;
int n_waiting_for_accept;
};
static void
pre_hook (SpaLoopControl *ctrl,
pre_hook (struct spa_loop_control *ctrl,
void *data)
{
struct thread_main_loop *impl = data;
@ -49,7 +49,7 @@ pre_hook (SpaLoopControl *ctrl,
}
static void
post_hook (SpaLoopControl *ctrl,
post_hook (struct spa_loop_control *ctrl,
void *data)
{
struct thread_main_loop *impl = data;
@ -57,8 +57,8 @@ post_hook (SpaLoopControl *ctrl,
}
static void
do_stop (SpaLoopUtils *utils,
SpaSource *source,
do_stop (struct spa_loop_utils *utils,
struct spa_source *source,
void *data)
{
struct thread_main_loop *impl = data;
@ -136,7 +136,7 @@ do_loop (void *user_data)
{
struct thread_main_loop *impl = user_data;
struct pw_thread_main_loop *this = &impl->this;
SpaResult res;
int res;
pthread_mutex_lock (&impl->lock);
pw_log_debug ("thread-mainloop %p: enter thread", this);
@ -161,7 +161,7 @@ do_loop (void *user_data)
*
* Returns: %SPA_RESULT_OK on success.
*/
SpaResult
int
pw_thread_main_loop_start (struct pw_thread_main_loop *loop)
{
struct thread_main_loop *impl = SPA_CONTAINER_OF (loop, struct thread_main_loop, this);

View file

@ -43,7 +43,7 @@ struct pw_thread_main_loop * pw_thread_main_loop_new (struct pw_loo
const char *name);
void pw_thread_main_loop_destroy (struct pw_thread_main_loop *loop);
SpaResult pw_thread_main_loop_start (struct pw_thread_main_loop *loop);
int pw_thread_main_loop_start (struct pw_thread_main_loop *loop);
void pw_thread_main_loop_stop (struct pw_thread_main_loop *loop);
void pw_thread_main_loop_lock (struct pw_thread_main_loop *loop);

View file

@ -38,7 +38,7 @@ struct transport {
struct pw_memblock mem;
size_t offset;
SpaEvent current;
struct spa_event current;
uint32_t current_index;
};
@ -47,11 +47,11 @@ transport_area_get_size (struct pw_transport_area *area)
{
size_t size;
size = sizeof (struct pw_transport_area);
size += area->max_inputs * sizeof (SpaPortIO);
size += area->max_outputs * sizeof (SpaPortIO);
size += sizeof (SpaRingbuffer);
size += area->max_inputs * sizeof (struct spa_port_io);
size += area->max_outputs * sizeof (struct spa_port_io);
size += sizeof (struct spa_ringbuffer);
size += INPUT_BUFFER_SIZE;
size += sizeof (SpaRingbuffer);
size += sizeof (struct spa_ringbuffer);
size += OUTPUT_BUFFER_SIZE;
return size;
}
@ -62,22 +62,22 @@ transport_setup_area (void *p, struct pw_transport *trans)
struct pw_transport_area *a;
trans->area = a = p;
p = SPA_MEMBER (p, sizeof (struct pw_transport_area), SpaPortIO);
p = SPA_MEMBER (p, sizeof (struct pw_transport_area), struct spa_port_io);
trans->inputs = p;
p = SPA_MEMBER (p, a->max_inputs * sizeof (SpaPortIO), void);
p = SPA_MEMBER (p, a->max_inputs * sizeof (struct spa_port_io), void);
trans->outputs = p;
p = SPA_MEMBER (p, a->max_outputs * sizeof (SpaPortIO), void);
p = SPA_MEMBER (p, a->max_outputs * sizeof (struct spa_port_io), void);
trans->input_buffer = p;
p = SPA_MEMBER (p, sizeof (SpaRingbuffer), void);
p = SPA_MEMBER (p, sizeof (struct spa_ringbuffer), void);
trans->input_data = p;
p = SPA_MEMBER (p, INPUT_BUFFER_SIZE, void);
trans->output_buffer = p;
p = SPA_MEMBER (p, sizeof (SpaRingbuffer), void);
p = SPA_MEMBER (p, sizeof (struct spa_ringbuffer), void);
trans->output_data = p;
p = SPA_MEMBER (p, OUTPUT_BUFFER_SIZE, void);
@ -193,7 +193,7 @@ pw_transport_destroy (struct pw_transport *trans)
free (impl);
}
SpaResult
int
pw_transport_get_info (struct pw_transport *trans,
struct pw_transport_info *info)
{
@ -206,9 +206,9 @@ pw_transport_get_info (struct pw_transport *trans,
return SPA_RESULT_OK;
}
SpaResult
int
pw_transport_add_event (struct pw_transport *trans,
SpaEvent *event)
struct spa_event *event)
{
struct transport *impl = (struct transport *) trans;
int32_t filled, avail;
@ -233,9 +233,9 @@ pw_transport_add_event (struct pw_transport *trans,
return SPA_RESULT_OK;
}
SpaResult
int
pw_transport_next_event (struct pw_transport *trans,
SpaEvent *event)
struct spa_event *event)
{
struct transport *impl = (struct transport *) trans;
int32_t avail;
@ -244,21 +244,21 @@ pw_transport_next_event (struct pw_transport *trans,
return SPA_RESULT_INVALID_ARGUMENTS;
avail = spa_ringbuffer_get_read_index (trans->input_buffer, &impl->current_index);
if (avail < sizeof (SpaEvent))
if (avail < sizeof (struct spa_event))
return SPA_RESULT_ENUM_END;
spa_ringbuffer_read_data (trans->input_buffer,
trans->input_data,
impl->current_index & trans->input_buffer->mask,
&impl->current,
sizeof (SpaEvent));
sizeof (struct spa_event));
*event = impl->current;
return SPA_RESULT_OK;
}
SpaResult
int
pw_transport_parse_event (struct pw_transport *trans,
void *event)
{

View file

@ -55,12 +55,12 @@ struct pw_transport {
struct pw_transport *trans));
struct pw_transport_area *area;
SpaPortIO *inputs;
SpaPortIO *outputs;
struct spa_port_io *inputs;
struct spa_port_io *outputs;
void *input_data;
SpaRingbuffer *input_buffer;
struct spa_ringbuffer *input_buffer;
void *output_data;
SpaRingbuffer *output_buffer;
struct spa_ringbuffer *output_buffer;
};
struct pw_transport * pw_transport_new (uint32_t max_inputs,
@ -69,15 +69,15 @@ struct pw_transport * pw_transport_new_from_info (struct pw_transport_info *inf
void pw_transport_destroy (struct pw_transport *trans);
SpaResult pw_transport_get_info (struct pw_transport *trans,
int pw_transport_get_info (struct pw_transport *trans,
struct pw_transport_info *info);
SpaResult pw_transport_add_event (struct pw_transport *trans,
SpaEvent *event);
int pw_transport_add_event (struct pw_transport *trans,
struct spa_event *event);
SpaResult pw_transport_next_event (struct pw_transport *trans,
SpaEvent *event);
SpaResult pw_transport_parse_event (struct pw_transport *trans,
int pw_transport_next_event (struct pw_transport *trans,
struct spa_event *event);
int pw_transport_parse_event (struct pw_transport *trans,
void *event);
#define PIPEWIRE_TYPE_EVENT__Transport SPA_TYPE_EVENT_BASE "Transport"
@ -94,7 +94,7 @@ struct pw_type_event_transport {
};
static inline void
pw_type_event_transport_map (SpaTypeMap *map, struct pw_type_event_transport *type)
pw_type_event_transport_map (struct spa_type_map *map, struct pw_type_event_transport *type)
{
if (type->HaveOutput == 0) {
type->HaveOutput = spa_type_map_get_id (map, PIPEWIRE_TYPE_EVENT_TRANSPORT__HaveOutput);
@ -104,13 +104,13 @@ pw_type_event_transport_map (SpaTypeMap *map, struct pw_type_event_transport *ty
}
struct pw_event_transport_reuse_buffer_body {
SpaPODObjectBody body;
SpaPODInt port_id;
SpaPODInt buffer_id;
struct spa_pod_object_body body;
struct spa_pod_int port_id;
struct spa_pod_int buffer_id;
};
struct pw_event_transport_reuse_buffer {
SpaPOD pod;
struct spa_pod pod;
struct pw_event_transport_reuse_buffer_body body;
};

View file

@ -76,7 +76,7 @@ pw_pod_remap_data (uint32_t type, void * body, uint32_t size, struct pw_map *typ
case SPA_POD_TYPE_PROP:
{
SpaPODPropBody *b = body;
struct spa_pod_prop_body *b = body;
if ((t = pw_map_lookup (types, b->key)) == NULL)
return false;
@ -95,8 +95,8 @@ pw_pod_remap_data (uint32_t type, void * body, uint32_t size, struct pw_map *typ
}
case SPA_POD_TYPE_OBJECT:
{
SpaPODObjectBody *b = body;
SpaPOD *p;
struct spa_pod_object_body *b = body;
struct spa_pod *p;
if ((t = pw_map_lookup (types, b->type)) == NULL)
return false;
@ -109,7 +109,7 @@ pw_pod_remap_data (uint32_t type, void * body, uint32_t size, struct pw_map *typ
}
case SPA_POD_TYPE_STRUCT:
{
SpaPOD *b = body, *p;
struct spa_pod *b = body, *p;
SPA_POD_FOREACH (b, size, p)
if (!pw_pod_remap_data (p->type, SPA_POD_BODY (p), p->size, types))

View file

@ -46,31 +46,31 @@ struct pw_interface {
* PipeWire Type support struct.
*/
struct pw_type {
SpaTypeMap *map;
struct spa_type_map *map;
SpaType core;
SpaType registry;
SpaType node;
SpaType node_factory;
SpaType link;
SpaType client;
SpaType client_node;
SpaType module;
uint32_t core;
uint32_t registry;
uint32_t node;
uint32_t node_factory;
uint32_t link;
uint32_t client;
uint32_t client_node;
uint32_t module;
SpaType spa_node;
SpaType spa_clock;
SpaType spa_monitor;
SpaType spa_format;
SpaType spa_props;
uint32_t spa_node;
uint32_t spa_clock;
uint32_t spa_monitor;
uint32_t spa_format;
uint32_t spa_props;
SpaTypeMeta meta;
SpaTypeData data;
SpaTypeEventNode event_node;
SpaTypeCommandNode command_node;
SpaTypeMonitor monitor;
SpaTypeParamAllocBuffers param_alloc_buffers;
SpaTypeParamAllocMetaEnable param_alloc_meta_enable;
SpaTypeParamAllocVideoPadding param_alloc_video_padding;
struct spa_type_meta meta;
struct spa_type_data data;
struct spa_type_event_node event_node;
struct spa_type_command_node command_node;
struct spa_type_monitor monitor;
struct spa_type_param_alloc_buffers param_alloc_buffers;
struct spa_type_param_alloc_meta_enable param_alloc_meta_enable;
struct spa_type_param_alloc_video_padding param_alloc_video_padding;
struct pw_type_event_transport event_transport;
};
@ -79,7 +79,7 @@ void pw_type_init (struct pw_type *type);
bool pw_pod_remap_data (uint32_t type, void *body, uint32_t size, struct pw_map *types);
static inline bool
pw_pod_remap (SpaPOD *pod, struct pw_map *types)
pw_pod_remap (struct spa_pod *pod, struct pw_map *types)
{
return pw_pod_remap_data (pod->type, SPA_POD_BODY (pod), pod->size, types);
}

View file

@ -40,15 +40,15 @@ void pw_free_strv (char **str);
char * pw_strip (char *str,
const char *whitespace);
static inline SpaPOD *
pw_spa_pod_copy (const SpaPOD *pod)
static inline struct spa_pod *
pw_spa_pod_copy (const struct spa_pod *pod)
{
return pod ? memcpy (malloc (SPA_POD_SIZE (pod)), pod, SPA_POD_SIZE (pod)) : NULL;
}
#define spa_format_copy(f) ((SpaFormat*)pw_spa_pod_copy(&(f)->pod))
#define spa_props_copy(p) ((SpaProps*)pw_spa_pod_copy(&(p)->pod))
#define spa_param_copy(p) ((SpaParam*)pw_spa_pod_copy(&(p)->pod))
#define spa_format_copy(f) ((struct spa_format*)pw_spa_pod_copy(&(f)->pod))
#define spa_props_copy(p) ((struct spa_prop*)pw_spa_pod_copy(&(p)->object.pod))
#define spa_param_copy(p) ((struct spa_param*)pw_spa_pod_copy(&(p)->object.pod))
#ifdef __cplusplus
} /* extern "C" */

View file

@ -28,7 +28,7 @@ extern "C" {
#include <pipewire/server/core.h>
struct pw_daemon_config {
SpaList commands;
struct spa_list commands;
};
struct pw_daemon_config * pw_daemon_config_new (void);

View file

@ -44,7 +44,7 @@ main (int argc, char *argv[])
loop = pw_main_loop_new ();
#if 1
{
SpaSource *source;
struct spa_source *source;
source = pw_loop_add_event (loop->loop, NULL, NULL);
pw_log_set_trace_event (source);
}

View file

@ -32,19 +32,19 @@
#include <pipewire/client/sig.h>
#include <spa/lib/debug.h>
typedef struct {
struct type {
uint32_t format;
uint32_t props;
SpaTypeMeta meta;
SpaTypeData data;
SpaTypeMediaType media_type;
SpaTypeMediaSubtype media_subtype;
SpaTypeFormatVideo format_video;
SpaTypeVideoFormat video_format;
} Type;
struct spa_type_meta meta;
struct spa_type_data data;
struct spa_type_media_type media_type;
struct spa_type_media_subtype media_subtype;
struct spa_type_format_video format_video;
struct spa_type_video_format video_format;
};
static inline void
init_type (Type *type, SpaTypeMap *map)
init_type (struct type *type, struct spa_type_map *map)
{
type->format = spa_type_map_get_id (map, SPA_TYPE__Format);
type->props = spa_type_map_get_id (map, SPA_TYPE__Props);
@ -61,7 +61,7 @@ init_type (Type *type, SpaTypeMap *map)
#define BPP 3
struct data {
Type type;
struct type type;
const char *path;
@ -71,7 +71,7 @@ struct data {
bool running;
struct pw_loop *loop;
SpaSource *timer;
struct spa_source *timer;
struct pw_context *context;
struct pw_listener on_state_changed;
@ -81,7 +81,7 @@ struct data {
struct pw_listener on_stream_format_changed;
struct pw_listener on_stream_new_buffer;
SpaVideoInfoRaw format;
struct spa_video_info_raw format;
int32_t stride;
uint8_t params_buffer[1024];
@ -107,7 +107,7 @@ on_stream_new_buffer (struct pw_listener *listener,
uint32_t id)
{
struct data *data = SPA_CONTAINER_OF (listener, struct data, on_stream_new_buffer);
SpaBuffer *buf;
struct spa_buffer *buf;
uint8_t *map;
void *sdata, *ddata;
int sstride, dstride, ostride;
@ -166,46 +166,46 @@ static struct {
Uint32 format;
uint32_t id;
} video_formats[] = {
{ SDL_PIXELFORMAT_UNKNOWN, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_INDEX1LSB, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_UNKNOWN, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_INDEX1LSB, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_INDEX1MSB, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_INDEX4LSB, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_INDEX4MSB, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_INDEX8, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_RGB332, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_RGB444, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_RGB555, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_BGR555, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_ARGB4444, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_RGBA4444, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_ABGR4444, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_BGRA4444, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_ARGB1555, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_RGBA5551, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_ABGR1555, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_BGRA5551, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_RGB565, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_BGR565, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_RGB24, offsetof (SpaTypeVideoFormat, RGB), },
{ SDL_PIXELFORMAT_RGB888, offsetof (SpaTypeVideoFormat, RGB), },
{ SDL_PIXELFORMAT_RGBX8888, offsetof (SpaTypeVideoFormat, RGBx), },
{ SDL_PIXELFORMAT_BGR24, offsetof (SpaTypeVideoFormat, BGR), },
{ SDL_PIXELFORMAT_BGR888, offsetof (SpaTypeVideoFormat, BGR), },
{ SDL_PIXELFORMAT_BGRX8888, offsetof (SpaTypeVideoFormat, BGRx), },
{ SDL_PIXELFORMAT_ARGB2101010, offsetof (SpaTypeVideoFormat, UNKNOWN), },
{ SDL_PIXELFORMAT_RGBA8888, offsetof (SpaTypeVideoFormat, RGBA), },
{ SDL_PIXELFORMAT_ARGB8888, offsetof (SpaTypeVideoFormat, ARGB), },
{ SDL_PIXELFORMAT_BGRA8888, offsetof (SpaTypeVideoFormat, BGRA), },
{ SDL_PIXELFORMAT_ABGR8888, offsetof (SpaTypeVideoFormat, ABGR), },
{ SDL_PIXELFORMAT_YV12, offsetof (SpaTypeVideoFormat, YV12), },
{ SDL_PIXELFORMAT_IYUV, offsetof (SpaTypeVideoFormat, I420), },
{ SDL_PIXELFORMAT_YUY2, offsetof (SpaTypeVideoFormat, YUY2), },
{ SDL_PIXELFORMAT_UYVY, offsetof (SpaTypeVideoFormat, UYVY), },
{ SDL_PIXELFORMAT_YVYU, offsetof (SpaTypeVideoFormat, YVYU), },
{ SDL_PIXELFORMAT_NV12, offsetof (SpaTypeVideoFormat, NV12), },
{ SDL_PIXELFORMAT_NV21, offsetof (SpaTypeVideoFormat, NV21), }
{ SDL_PIXELFORMAT_UNKNOWN, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_INDEX1LSB, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_UNKNOWN, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_INDEX1LSB, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_INDEX1MSB, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_INDEX4LSB, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_INDEX4MSB, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_INDEX8, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_RGB332, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_RGB444, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_RGB555, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_BGR555, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_ARGB4444, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_RGBA4444, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_ABGR4444, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_BGRA4444, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_ARGB1555, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_RGBA5551, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_ABGR1555, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_BGRA5551, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_RGB565, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_BGR565, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_RGB24, offsetof (struct spa_type_video_format, RGB), },
{ SDL_PIXELFORMAT_RGB888, offsetof (struct spa_type_video_format, RGB), },
{ SDL_PIXELFORMAT_RGBX8888, offsetof (struct spa_type_video_format, RGBx), },
{ SDL_PIXELFORMAT_BGR24, offsetof (struct spa_type_video_format, BGR), },
{ SDL_PIXELFORMAT_BGR888, offsetof (struct spa_type_video_format, BGR), },
{ SDL_PIXELFORMAT_BGRX8888, offsetof (struct spa_type_video_format, BGRx), },
{ SDL_PIXELFORMAT_ARGB2101010, offsetof (struct spa_type_video_format, UNKNOWN), },
{ SDL_PIXELFORMAT_RGBA8888, offsetof (struct spa_type_video_format, RGBA), },
{ SDL_PIXELFORMAT_ARGB8888, offsetof (struct spa_type_video_format, ARGB), },
{ SDL_PIXELFORMAT_BGRA8888, offsetof (struct spa_type_video_format, BGRA), },
{ SDL_PIXELFORMAT_ABGR8888, offsetof (struct spa_type_video_format, ABGR), },
{ SDL_PIXELFORMAT_YV12, offsetof (struct spa_type_video_format, YV12), },
{ SDL_PIXELFORMAT_IYUV, offsetof (struct spa_type_video_format, I420), },
{ SDL_PIXELFORMAT_YUY2, offsetof (struct spa_type_video_format, YUY2), },
{ SDL_PIXELFORMAT_UYVY, offsetof (struct spa_type_video_format, UYVY), },
{ SDL_PIXELFORMAT_YVYU, offsetof (struct spa_type_video_format, YVYU), },
{ SDL_PIXELFORMAT_NV12, offsetof (struct spa_type_video_format, NV12), },
{ SDL_PIXELFORMAT_NV21, offsetof (struct spa_type_video_format, NV21), }
};
static uint32_t
@ -241,13 +241,13 @@ id_to_sdl_format (struct data *data, uint32_t id)
static void
on_stream_format_changed (struct pw_listener *listener,
struct pw_stream *stream,
SpaFormat *format)
struct spa_format *format)
{
struct data *data = SPA_CONTAINER_OF (listener, struct data, on_stream_format_changed);
struct pw_context *ctx = stream->context;
SpaPODBuilder b = { NULL };
SpaPODFrame f[2];
SpaParam *params[2];
struct spa_pod_builder b = { NULL };
struct spa_pod_frame f[2];
struct spa_param *params[2];
if (format) {
Uint32 sdl_format;
@ -278,12 +278,12 @@ on_stream_format_changed (struct pw_listener *listener,
PROP (&f[1], ctx->type.param_alloc_buffers.stride, SPA_POD_TYPE_INT, data->stride),
PROP_U_MM (&f[1], ctx->type.param_alloc_buffers.buffers, SPA_POD_TYPE_INT, 32, 2, 32),
PROP (&f[1], ctx->type.param_alloc_buffers.align, SPA_POD_TYPE_INT, 16));
params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, struct spa_param);
spa_pod_builder_object (&b, &f[0], 0, ctx->type.param_alloc_meta_enable.MetaEnable,
PROP (&f[1], ctx->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, ctx->type.meta.Header),
PROP (&f[1], ctx->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
PROP (&f[1], ctx->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (struct spa_meta_header)));
params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, struct spa_param);
pw_stream_finish_format (stream, SPA_RESULT_OK, params, 2);
}
@ -305,10 +305,10 @@ on_state_changed (struct pw_listener *listener,
case PW_CONTEXT_STATE_CONNECTED:
{
SpaFormat *formats[1];
struct spa_format *formats[1];
uint8_t buffer[1024];
SpaPODBuilder b = SPA_POD_BUILDER_INIT (buffer, sizeof (buffer));
SpaPODFrame f[2];
struct spa_pod_builder b = SPA_POD_BUILDER_INIT (buffer, sizeof (buffer));
struct spa_pod_frame f[2];
SDL_RendererInfo info;
int i, c;
@ -350,7 +350,7 @@ on_state_changed (struct pw_listener *listener,
0);
spa_pod_builder_pop (&b, &f[0]);
formats[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaFormat);
formats[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, struct spa_format);
printf ("supported formats:\n");
spa_debug_format (formats[0], data->context->type.map);

View file

@ -35,16 +35,16 @@
struct type {
uint32_t format;
uint32_t props;
SpaTypeMeta meta;
SpaTypeData data;
SpaTypeMediaType media_type;
SpaTypeMediaSubtype media_subtype;
SpaTypeFormatVideo format_video;
SpaTypeVideoFormat video_format;
struct spa_type_meta meta;
struct spa_type_data data;
struct spa_type_media_type media_type;
struct spa_type_media_subtype media_subtype;
struct spa_type_format_video format_video;
struct spa_type_video_format video_format;
};
static inline void
init_type (struct type *type, SpaTypeMap *map)
init_type (struct type *type, struct spa_type_map *map)
{
type->format = spa_type_map_get_id (map, SPA_TYPE__Format);
type->props = spa_type_map_get_id (map, SPA_TYPE__Props);
@ -63,7 +63,7 @@ struct data {
bool running;
struct pw_loop *loop;
SpaSource *timer;
struct spa_source *timer;
struct pw_context *context;
struct pw_listener on_state_changed;
@ -72,7 +72,7 @@ struct data {
struct pw_listener on_stream_state_changed;
struct pw_listener on_stream_format_changed;
SpaVideoInfoRaw format;
struct spa_video_info_raw format;
int32_t stride;
uint8_t params_buffer[1024];
@ -81,16 +81,16 @@ struct data {
};
static void
on_timeout (SpaLoopUtils *utils,
SpaSource *source,
on_timeout (struct spa_loop_utils *utils,
struct spa_source *source,
void *userdata)
{
struct data *data = userdata;
uint32_t id;
SpaBuffer *buf;
struct spa_buffer *buf;
int i, j;
uint8_t *p, *map;
SpaMetaHeader *h;
struct spa_meta_header *h;
id = pw_stream_get_empty_buffer (data->stream);
if (id == SPA_ID_INVALID)
@ -183,13 +183,13 @@ on_stream_state_changed (struct pw_listener *listener,
static void
on_stream_format_changed (struct pw_listener *listener,
struct pw_stream *stream,
SpaFormat *format)
struct spa_format *format)
{
struct data *data = SPA_CONTAINER_OF (listener, struct data, on_stream_format_changed);
struct pw_context *ctx = stream->context;
SpaPODBuilder b = { NULL };
SpaPODFrame f[2];
SpaParam *params[2];
struct spa_pod_builder b = { NULL };
struct spa_pod_frame f[2];
struct spa_param *params[2];
if (format) {
spa_format_video_raw_parse (format, &data->format, &data->type.format_video);
@ -203,12 +203,12 @@ on_stream_format_changed (struct pw_listener *listener,
PROP (&f[1], ctx->type.param_alloc_buffers.stride, SPA_POD_TYPE_INT, data->stride),
PROP_U_MM (&f[1], ctx->type.param_alloc_buffers.buffers, SPA_POD_TYPE_INT, 32, 2, 32),
PROP (&f[1], ctx->type.param_alloc_buffers.align, SPA_POD_TYPE_INT, 16));
params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, struct spa_param);
spa_pod_builder_object (&b, &f[0], 0, ctx->type.param_alloc_meta_enable.MetaEnable,
PROP (&f[1], ctx->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, ctx->type.meta.Header),
PROP (&f[1], ctx->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
PROP (&f[1], ctx->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (struct spa_meta_header)));
params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, struct spa_param);
pw_stream_finish_format (stream, SPA_RESULT_OK, params, 2);
}
@ -231,10 +231,10 @@ on_state_changed (struct pw_listener *listener,
case PW_CONTEXT_STATE_CONNECTED:
{
SpaFormat *formats[1];
struct spa_format *formats[1];
uint8_t buffer[1024];
SpaPODBuilder b = SPA_POD_BUILDER_INIT (buffer, sizeof (buffer));
SpaPODFrame f[2];
struct spa_pod_builder b = SPA_POD_BUILDER_INIT (buffer, sizeof (buffer));
struct spa_pod_frame f[2];
printf ("context state: \"%s\"\n", pw_context_state_as_string (context->state));
@ -247,7 +247,7 @@ on_state_changed (struct pw_listener *listener,
1, 1,
4096, 4096),
PROP (&f[1], data->type.format_video.framerate, SPA_POD_TYPE_FRACTION, 25, 1));
formats[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaFormat);
formats[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, struct spa_format);
pw_signal_add (&data->stream->state_changed,
&data->on_stream_state_changed,

File diff suppressed because it is too large Load diff

View file

@ -1,305 +0,0 @@
/* GStreamer
* Copyright (C) <2012> 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 __GST_BURST_CACHE_H__
#define __GST_BURST_CACHE_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_BURST_CACHE \
(gst_burst_cache_get_type())
#define GST_BURST_CACHE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BURST_CACHE,GstBurstCache))
#define GST_BURST_CACHE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BURST_CACHE,GstBurstCacheClass))
#define GST_IS_BURST_CACHE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BURST_CACHE))
#define GST_IS_BURST_CACHE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BURST_CACHE))
#define GST_BURST_CACHE_GET_CLASS(klass) \
(G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_BURST_CACHE, GstBurstCacheClass))
typedef struct _GstBurstCache GstBurstCache;
typedef struct _GstBurstCacheClass GstBurstCacheClass;
typedef struct _GstBurstCacheReader GstBurstCacheReader;
/**
* GstBurstCacheRecover:
* @GST_BURST_CACHE_RECOVER_NONE : no recovering is done
* @GST_BURST_CACHE_RECOVER_RESYNC_LATEST : reader is moved to last buffer
* @GST_BURST_CACHE_RECOVER_RESYNC_SOFT_LIMIT: reader is moved to the soft limit
* @GST_BURST_CACHE_RECOVER_RESYNC_KEYFRAME : reader is moved to latest keyframe
*
* Possible values for the recovery procedure to use when a reader consumes
* data too slowly and has a backlog of more that soft-limit buffers.
*/
typedef enum
{
GST_BURST_CACHE_RECOVER_NONE,
GST_BURST_CACHE_RECOVER_RESYNC_LATEST,
GST_BURST_CACHE_RECOVER_RESYNC_SOFT_LIMIT,
GST_BURST_CACHE_RECOVER_RESYNC_KEYFRAME
} GstBurstCacheRecover;
/**
* GstBurstCacheStart:
* @GST_BURST_CACHE_START_LATEST : reader receives most recent buffer
* @GST_BURST_CACHE_START_NEXT_KEYFRAME : reader receives next keyframe
* @GST_BURST_CACHE_START_LATEST_KEYFRAME : reader receives latest keyframe (burst)
* @GST_BURST_CACHE_START_BURST : reader receives specific amount of data
* @GST_BURST_CACHE_START_BURST_KEYFRAME : reader receives specific amount of data
* starting from latest keyframe
* @GST_BURST_CACHE_START_BURST_WITH_KEYFRAME : reader receives specific amount of data from
* a keyframe, or if there is not enough data after
* the keyframe, starting before the keyframe
*
* This enum defines the selection of the first buffer that is sent
* to a new reader.
*/
typedef enum
{
GST_BURST_CACHE_START_LATEST,
GST_BURST_CACHE_START_NEXT_KEYFRAME,
GST_BURST_CACHE_START_LATEST_KEYFRAME,
GST_BURST_CACHE_START_BURST,
GST_BURST_CACHE_START_BURST_KEYFRAME,
GST_BURST_CACHE_START_BURST_WITH_KEYFRAME
} GstBurstCacheStart;
/**
* GstBurstCacheError:
* @GST_BURST_CACHE_ERROR_NONE : No error
* @GST_BURST_CACHE_ERROR_SLOW : reader is too slow
* @GST_BURST_CACHE_ERROR_ERROR : reader is in error
* @GST_BURST_CACHE_ERROR_DUPLICATE: same reader added twice
*
* Error codes used in the reason GError.
*/
typedef enum
{
GST_BURST_CACHE_ERROR_NONE = 0,
GST_BURST_CACHE_ERROR_SLOW = 1,
GST_BURST_CACHE_ERROR_ERROR = 2,
GST_BURST_CACHE_ERROR_DUPLICATE = 3,
} GstBurstCacheError;
GQuark gst_burst_cache_error_quark (void);
#define GST_BURST_CACHE_ERROR gst_burst_cache_error_quark()
/**
* GstBurstCacheResult:
* @GST_BURST_CACHE_RESULT_ERROR : An error occured
* @GST_BURST_CACHE_RESULT_OK : No error
* @GST_BURST_CACHE_RESULT_WAIT : Wait for more buffers
* @GST_BURST_CACHE_RESULT_EOS : No more buffers
*
* Error codes used in the reason GError.
*/
typedef enum
{
GST_BURST_CACHE_RESULT_ERROR = 0,
GST_BURST_CACHE_RESULT_OK = 1,
GST_BURST_CACHE_RESULT_WAIT = 2,
GST_BURST_CACHE_RESULT_EOS = 3,
} GstBurstCacheResult;
/**
* GstBurstCacheReaderCallback:
* @cache: a #GstBurstCache
* @reader: a #GstBurstCacheReader
* @user_data: user data given when creating @reader
*
* Called when @reader in @cache has data. You can get the new data with
* gst_burst_cache_get_buffer() from this callback or any other thread.
*/
typedef void (*GstBurstCacheReaderCallback) (GstBurstCache *cache,
GstBurstCacheReader *reader,
gpointer user_data);
/**
* GstBurstCacheReader:
* @object: parent miniobject
* @bufpos: position of this reader in the global queue
* @draincount: the remaining number of buffers to drain or -1 if the
* reader is not draining.
* @new_reader: this is a new reader
* @discont: is the next buffer was discont
* @reason: the reason why the reader is being removed
*
* structure for a reader
*/
struct _GstBurstCacheReader {
GHook hook;
gint bufpos;
gint draincount;
GstBurstCacheReaderCallback callback;
gpointer user_data;
GDestroyNotify notify;
gboolean new_reader;
gboolean discont;
GError *reason;
/* method to sync reader when connecting */
GstBurstCacheStart start_method;
GstFormat min_format;
guint64 min_value;
GstFormat max_format;
guint64 max_value;
/* stats */
guint64 bytes_sent;
guint64 dropped_buffers;
guint64 avg_queue_size;
guint64 first_buffer_ts;
guint64 last_buffer_ts;
guint64 add_time;
guint64 remove_time;
guint64 last_activity_time;
guint64 timeout;
gchar debug[30]; /* a debug string used in debug calls to
identify the reader */
};
/**
* GstBurstCache:
* @parent: parent GObject
* @lock: lock to protect @readers
* @bufqueue: global queue of buffers
* @readers: list of readers we are serving
* @readers_cookie: Cookie to detect changes to @readers
* @limit_format: the format of @limit_max and @@limit_soft_max
* @limit_max: max units to queue for a reader
* @limit_soft_max: max units a reader can lag before recovery starts
* @recover: how to recover a lagging reader
* @bytes_min: min number of bytes to queue
* @time_min: min time to queue
* @buffers_min: min number of buffers to queue
* @bytes_to_serve: how much bytes we must serve
* @bytes_served: how much bytes have we served
* @bytes_queued: number of queued bytes
* @time_queued: amount of queued time
* @buffers_queued: number of queued buffers
*/
struct _GstBurstCache {
GObject parent;
/*< private >*/
GRecMutex lock;
GPtrArray *bufqueue;
/* the readers */
GHookList readers;
guint readers_cookie;
/* these values are used to check if a reader is reading fast
* enough and to control recovery */
GstFormat limit_format;
gint64 limit_max;
gint64 limit_soft_max;
GstBurstCacheRecover recover;
/* these values are used to control the amount of data
* kept in the queues. It allows readers to perform a burst
* on connect. */
gint bytes_min;
gint64 time_min;
gint buffers_min;
/* stats */
gint bytes_queued;
gint64 time_queued;
gint buffers_queued;
};
/**
* GstBurstCacheClass:
* @parent_class: parent GObjectClass
* @reader_ready: called when a reader has a new buffer available
*
* The GstBurstCache class structure.
*/
struct _GstBurstCacheClass {
GObjectClass parent_class;
};
GType gst_burst_cache_get_type (void);
GType gst_burst_cache_reader_get_type (void);
GstBurstCache * gst_burst_cache_new (guint reader_size);
void gst_burst_cache_set_min_amount (GstBurstCache *cache,
gint bytes_min,
gint64 time_min,
gint buffers_min);
void gst_burst_cache_get_min_amount (GstBurstCache *cache,
gint *bytes_min,
gint64 *time_min,
gint *buffers_min);
void gst_burst_cache_set_limits (GstBurstCache *cache,
GstFormat format,
gint64 max,
gint64 soft_max,
GstBurstCacheRecover recover);
void gst_burst_cache_get_limits (GstBurstCache *cache,
GstFormat *format,
gint64 *max,
gint64 *soft_max,
GstBurstCacheRecover *recover);
void gst_burst_cache_queue_buffer (GstBurstCache *cache,
GstBuffer *buffer);
void gst_burst_cache_remove_buffers (GstBurstCache *cache);
GstBurstCacheReader * gst_burst_cache_reader_new (GstBurstCache *cache,
GstBurstCacheReaderCallback callback,
gpointer user_data,
GDestroyNotify notify);
gboolean gst_burst_cache_reader_set_burst (GstBurstCacheReader *reader,
GstBurstCacheStart start_method,
GstFormat min_format, guint64 min_value,
GstFormat max_format, guint64 max_value);
void gst_burst_cache_reader_destroy (GstBurstCacheReader *reader);
gboolean gst_burst_cache_add_reader (GstBurstCache *cache,
GstBurstCacheReader *reader);
gboolean gst_burst_cache_remove_reader (GstBurstCache *cache,
GstBurstCacheReader *reader,
gboolean drain);
gboolean gst_burst_cache_error_reader (GstBurstCache *cache,
GstBurstCacheReader *reader,
GError *error);
void gst_burst_cache_remove_readers (GstBurstCache * cache);
GstBurstCacheResult gst_burst_cache_get_buffer (GstBurstCache *cache,
GstBurstCacheReader *reader,
GstBuffer **buffer);
G_END_DECLS
#endif /* __GST_BURST_CACHE_H__ */

View file

@ -198,7 +198,7 @@ new_node (const struct pw_node_info *info)
GstCaps *caps = NULL;
GstStructure *props;
const gchar *klass = NULL;
SpaDictItem *item;
struct spa_dict_item *item;
GstPipeWireDeviceType type;
int i;
@ -243,7 +243,7 @@ new_node (const struct pw_node_info *info)
static void
get_node_info_cb (struct pw_context *context,
SpaResult res,
int res,
const struct pw_node_info *info,
gpointer user_data)
{
@ -316,7 +316,7 @@ typedef struct {
static void
list_node_info_cb (struct pw_context *c,
SpaResult res,
int res,
const struct pw_node_info *info,
void *user_data)
{
@ -330,7 +330,7 @@ list_node_info_cb (struct pw_context *c,
static void
get_core_info_cb (struct pw_context *c,
SpaResult res,
int res,
const struct pw_core_info *info,
void *user_data)
{

View file

@ -31,29 +31,29 @@
#include "gstpipewireformat.h"
typedef struct {
struct media_type {
const char *name;
uint32_t *media_type;
uint32_t *media_subtype;
} MediaType;
};
static struct {
SpaTypeMap *map;
struct spa_type_map *map;
uint32_t format;
SpaTypeMediaType media_type;
SpaTypeMediaSubtype media_subtype;
SpaTypeMediaSubtypeVideo media_subtype_video;
SpaTypeMediaSubtypeAudio media_subtype_audio;
SpaTypeFormatVideo format_video;
SpaTypeFormatAudio format_audio;
SpaTypeVideoFormat video_format;
SpaTypeAudioFormat audio_format;
struct spa_type_media_type media_type;
struct spa_type_media_subtype media_subtype;
struct spa_type_media_subtype_video media_subtype_video;
struct spa_type_media_subtype_audio media_subtype_audio;
struct spa_type_format_video format_video;
struct spa_type_format_audio format_audio;
struct spa_type_video_format video_format;
struct spa_type_audio_format audio_format;
} type = { NULL, };
static void
ensure_types (void)
{
SpaTypeMap *map = type.map = spa_type_map_get_default ();
struct spa_type_map *map = type.map = spa_type_map_get_default ();
type.format = spa_type_map_get_id (map, SPA_TYPE__Format);
spa_type_media_type_map (map, &type.media_type);
@ -66,7 +66,7 @@ ensure_types (void)
spa_type_audio_format_map (map, &type.audio_format);
}
static const MediaType media_type_map[] = {
static const struct media_type media_type_map[] = {
{ "video/x-raw", &type.media_type.video, &type.media_subtype.raw },
{ "audio/x-raw", &type.media_type.audio, &type.media_subtype.raw },
{ "image/jpeg", &type.media_type.video, &type.media_subtype_video.mjpg },
@ -199,13 +199,13 @@ static const uint32_t *audio_format_map[] = {
};
typedef struct {
SpaPODBuilder b;
const MediaType *type;
struct spa_pod_builder b;
const struct media_type *type;
const GstCapsFeatures *cf;
const GstStructure *cs;
} ConvertData;
static const MediaType *
static const struct media_type *
find_media_types (const char *name)
{
int i;
@ -266,7 +266,7 @@ get_nth_int (const GValue *val, int idx, int *res)
}
static gboolean
get_nth_fraction (const GValue *val, int idx, SpaFraction *f)
get_nth_fraction (const GValue *val, int idx, struct spa_fraction *f)
{
const GValue *v = NULL;
GType type = G_VALUE_TYPE (val);
@ -294,7 +294,7 @@ get_nth_fraction (const GValue *val, int idx, SpaFraction *f)
}
static gboolean
get_nth_rectangle (const GValue *width, const GValue *height, int idx, SpaRectangle *r)
get_nth_rectangle (const GValue *width, const GValue *height, int idx, struct spa_rectangle *r)
{
const GValue *w = NULL, *h = NULL;
GType wt = G_VALUE_TYPE (width);
@ -373,7 +373,7 @@ get_range_type2 (const GValue *v1, const GValue *v2)
static gboolean
handle_video_fields (ConvertData *d)
{
SpaPODFrame f;
struct spa_pod_frame f;
const GValue *value, *value2;
int i;
@ -392,13 +392,13 @@ handle_video_fields (ConvertData *d)
spa_pod_builder_id (&d->b, *video_format_map[idx]);
}
if (i > 1)
SPA_POD_BUILDER_DEREF (&d->b, f.ref, SpaPODProp)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
SPA_POD_BUILDER_DEREF (&d->b, f.ref, struct spa_pod_prop)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
spa_pod_builder_pop (&d->b, &f);
}
value = gst_structure_get_value (d->cs, "width");
value2 = gst_structure_get_value (d->cs, "height");
if (value || value2) {
SpaRectangle v;
struct spa_rectangle v;
for (i = 0; get_nth_rectangle (value, value2, i, &v); i++) {
if (i == 0)
spa_pod_builder_push_prop (&d->b, &f,
@ -408,13 +408,13 @@ handle_video_fields (ConvertData *d)
spa_pod_builder_rectangle (&d->b, v.width, v.height);
}
if (i > 1)
SPA_POD_BUILDER_DEREF (&d->b, f.ref, SpaPODProp)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
SPA_POD_BUILDER_DEREF (&d->b, f.ref, struct spa_pod_prop)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
spa_pod_builder_pop (&d->b, &f);
}
value = gst_structure_get_value (d->cs, "framerate");
if (value) {
SpaFraction v;
struct spa_fraction v;
for (i = 0; get_nth_fraction (value, i, &v); i++) {
if (i == 0)
spa_pod_builder_push_prop (&d->b, &f,
@ -424,13 +424,13 @@ handle_video_fields (ConvertData *d)
spa_pod_builder_fraction (&d->b, v.num, v.denom);
}
if (i > 1)
SPA_POD_BUILDER_DEREF (&d->b, f.ref, SpaPODProp)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
SPA_POD_BUILDER_DEREF (&d->b, f.ref, struct spa_pod_prop)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
spa_pod_builder_pop (&d->b, &f);
}
value = gst_structure_get_value (d->cs, "max-framerate");
if (value) {
SpaFraction v;
struct spa_fraction v;
for (i = 0; get_nth_fraction (value, i, &v); i++) {
if (i == 0)
spa_pod_builder_push_prop (&d->b, &f,
@ -440,7 +440,7 @@ handle_video_fields (ConvertData *d)
spa_pod_builder_fraction (&d->b, v.num, v.denom);
}
if (i > 1)
SPA_POD_BUILDER_DEREF (&d->b, f.ref, SpaPODProp)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
SPA_POD_BUILDER_DEREF (&d->b, f.ref, struct spa_pod_prop)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
spa_pod_builder_pop (&d->b, &f);
}
return TRUE;
@ -449,7 +449,7 @@ handle_video_fields (ConvertData *d)
static gboolean
handle_audio_fields (ConvertData *d)
{
SpaPODFrame f;
struct spa_pod_frame f;
const GValue *value;
int i = 0;
@ -468,7 +468,7 @@ handle_audio_fields (ConvertData *d)
spa_pod_builder_id (&d->b, *audio_format_map[idx]);
}
if (i > 1)
SPA_POD_BUILDER_DEREF (&d->b, f.ref, SpaPODProp)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
SPA_POD_BUILDER_DEREF (&d->b, f.ref, struct spa_pod_prop)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
spa_pod_builder_pop (&d->b, &f);
}
@ -476,7 +476,7 @@ handle_audio_fields (ConvertData *d)
if (value) {
const char *v;
for (i = 0; (v = get_nth_string (value, i)); i++) {
SpaAudioLayout layout;
enum spa_audio_layout layout;
if (!strcmp (v, "interleaved"))
layout = SPA_AUDIO_LAYOUT_INTERLEAVED;
@ -493,7 +493,7 @@ handle_audio_fields (ConvertData *d)
spa_pod_builder_int (&d->b, layout);
}
if (i > 1)
SPA_POD_BUILDER_DEREF (&d->b, f.ref, SpaPODProp)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
SPA_POD_BUILDER_DEREF (&d->b, f.ref, struct spa_pod_prop)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
spa_pod_builder_pop (&d->b, &f);
}
value = gst_structure_get_value (d->cs, "rate");
@ -508,7 +508,7 @@ handle_audio_fields (ConvertData *d)
spa_pod_builder_int (&d->b, v);
}
if (i > 1)
SPA_POD_BUILDER_DEREF (&d->b, f.ref, SpaPODProp)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
SPA_POD_BUILDER_DEREF (&d->b, f.ref, struct spa_pod_prop)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
spa_pod_builder_pop (&d->b, &f);
}
value = gst_structure_get_value (d->cs, "channels");
@ -523,14 +523,14 @@ handle_audio_fields (ConvertData *d)
spa_pod_builder_int (&d->b, v);
}
if (i > 1)
SPA_POD_BUILDER_DEREF (&d->b, f.ref, SpaPODProp)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
SPA_POD_BUILDER_DEREF (&d->b, f.ref, struct spa_pod_prop)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
spa_pod_builder_pop (&d->b, &f);
}
return TRUE;
}
static uint32_t
write_pod (SpaPODBuilder *b, uint32_t ref, const void *data, uint32_t size)
write_pod (struct spa_pod_builder *b, uint32_t ref, const void *data, uint32_t size)
{
if (ref == -1)
ref = b->offset;
@ -543,11 +543,11 @@ write_pod (SpaPODBuilder *b, uint32_t ref, const void *data, uint32_t size)
return ref;
}
static SpaFormat *
static struct spa_format *
convert_1 (GstCapsFeatures *cf, GstStructure *cs)
{
ConvertData d;
SpaPODFrame f;
struct spa_pod_frame f;
spa_zero (d);
d.cf = cf;
@ -569,15 +569,15 @@ convert_1 (GstCapsFeatures *cf, GstStructure *cs)
spa_pod_builder_pop (&d.b, &f);
return SPA_MEMBER (d.b.data, 0, SpaFormat);
return SPA_MEMBER (d.b.data, 0, struct spa_format);
}
SpaFormat *
struct spa_format *
gst_caps_to_format (GstCaps *caps, guint index)
{
GstCapsFeatures *f;
GstStructure *s;
SpaFormat *res;
struct spa_format *res;
g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
g_return_val_if_fail (gst_caps_is_fixed (caps), NULL);
@ -597,7 +597,7 @@ foreach_func (GstCapsFeatures *features,
GstStructure *structure,
GPtrArray *array)
{
SpaFormat *fmt;
struct spa_format *fmt;
if ((fmt = convert_1 (features, structure)))
g_ptr_array_insert (array, -1, fmt);
@ -620,10 +620,10 @@ gst_caps_to_format_all (GstCaps *caps)
}
static void
handle_id_prop (SpaPODProp *prop, const char *key, GstCaps *res)
handle_id_prop (struct spa_pod_prop *prop, const char *key, GstCaps *res)
{
const char * str;
uint32_t *id = SPA_POD_CONTENTS (SpaPODProp, prop);
uint32_t *id = SPA_POD_CONTENTS (struct spa_pod_prop, prop);
uint32_t i, n_items = SPA_POD_PROP_N_VALUES (prop);
uint32_t flags;
@ -660,9 +660,9 @@ handle_id_prop (SpaPODProp *prop, const char *key, GstCaps *res)
}
static void
handle_int_prop (SpaPODProp *prop, const char *key, GstCaps *res)
handle_int_prop (struct spa_pod_prop *prop, const char *key, GstCaps *res)
{
uint32_t *val = SPA_POD_CONTENTS (SpaPODProp, prop);
uint32_t *val = SPA_POD_CONTENTS (struct spa_pod_prop, prop);
uint32_t i, n_items = SPA_POD_PROP_N_VALUES (prop);
uint32_t flags;
@ -702,9 +702,9 @@ handle_int_prop (SpaPODProp *prop, const char *key, GstCaps *res)
}
static void
handle_rect_prop (SpaPODProp *prop, const char *width, const char *height, GstCaps *res)
handle_rect_prop (struct spa_pod_prop *prop, const char *width, const char *height, GstCaps *res)
{
SpaRectangle *rect = SPA_POD_CONTENTS (SpaPODProp, prop);
struct spa_rectangle *rect = SPA_POD_CONTENTS (struct spa_pod_prop, prop);
uint32_t i, n_items = SPA_POD_PROP_N_VALUES (prop);
uint32_t flags;
@ -753,9 +753,9 @@ handle_rect_prop (SpaPODProp *prop, const char *width, const char *height, GstCa
}
static void
handle_fraction_prop (SpaPODProp *prop, const char *key, GstCaps *res)
handle_fraction_prop (struct spa_pod_prop *prop, const char *key, GstCaps *res)
{
SpaFraction *fract = SPA_POD_CONTENTS (SpaPODProp, prop);
struct spa_fraction *fract = SPA_POD_CONTENTS (struct spa_pod_prop, prop);
uint32_t i, n_items = SPA_POD_PROP_N_VALUES (prop);
uint32_t flags;
@ -795,11 +795,11 @@ handle_fraction_prop (SpaPODProp *prop, const char *key, GstCaps *res)
}
}
GstCaps *
gst_caps_from_format (const SpaFormat *format)
gst_caps_from_format (const struct spa_format *format)
{
GstCaps *res = NULL;
uint32_t media_type, media_subtype;
SpaPODProp *prop;
struct spa_pod_prop *prop;
ensure_types();

View file

@ -26,10 +26,10 @@
G_BEGIN_DECLS
SpaFormat * gst_caps_to_format (GstCaps *caps, guint index);
struct spa_format * gst_caps_to_format (GstCaps *caps, guint index);
GPtrArray * gst_caps_to_format_all (GstCaps *caps);
GstCaps * gst_caps_from_format (const SpaFormat *format);
GstCaps * gst_caps_from_format (const struct spa_format *format);
G_END_DECLS

View file

@ -241,10 +241,10 @@ pool_activated (GstPipeWirePool *pool, GstPipeWireSink *sink)
guint size;
guint min_buffers;
guint max_buffers;
SpaParam *port_params[3];
SpaPODBuilder b = { NULL };
struct spa_param *port_params[3];
struct spa_pod_builder b = { NULL };
uint8_t buffer[1024];
SpaPODFrame f[2];
struct spa_pod_frame f[2];
config = gst_buffer_pool_get_config (GST_BUFFER_POOL (pool));
gst_buffer_pool_config_get_params (config, &caps, &size, &min_buffers, &max_buffers);
@ -264,23 +264,23 @@ pool_activated (GstPipeWirePool *pool, GstPipeWireSink *sink)
PROP (&f[1], ctx->type.param_alloc_buffers.align, SPA_POD_TYPE_INT, 16),
0);
spa_pod_builder_pop (&b, &f[0]);
port_params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
port_params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, struct spa_param);
spa_pod_builder_object (&b, &f[0], 0, ctx->type.param_alloc_meta_enable.MetaEnable,
PROP (&f[1], ctx->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, ctx->type.meta.Header),
PROP (&f[1], ctx->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
port_params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
PROP (&f[1], ctx->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (struct spa_meta_header)));
port_params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, struct spa_param);
spa_pod_builder_object (&b, &f[0], 0, ctx->type.param_alloc_meta_enable.MetaEnable,
PROP (&f[1], ctx->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, ctx->type.meta.Ringbuffer),
PROP (&f[1], ctx->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaRingbuffer)),
PROP (&f[1], ctx->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (struct spa_meta_ringbuffer)),
PROP (&f[1], ctx->type.param_alloc_meta_enable.ringbufferSize, SPA_POD_TYPE_INT,
size * SPA_MAX (4,
SPA_MAX (min_buffers, max_buffers))),
PROP (&f[1], ctx->type.param_alloc_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, 0),
PROP (&f[1], ctx->type.param_alloc_meta_enable.ringbufferBlocks, SPA_POD_TYPE_INT, 1),
PROP (&f[1], ctx->type.param_alloc_meta_enable.ringbufferAlign, SPA_POD_TYPE_INT, 16));
port_params[2] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
port_params[2] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, struct spa_param);
pw_stream_finish_format (sink->stream, SPA_RESULT_OK, port_params, 2);
}
@ -414,8 +414,8 @@ gst_pipewire_sink_get_property (GObject * object, guint prop_id,
typedef struct {
GstPipeWireSink *sink;
guint id;
SpaBuffer *buf;
SpaMetaHeader *header;
struct spa_buffer *buf;
struct spa_meta_header *header;
guint flags;
goffset offset;
} ProcessMemData;
@ -435,7 +435,7 @@ on_add_buffer (struct pw_listener *listener,
uint32_t id)
{
GstPipeWireSink *pwsink = SPA_CONTAINER_OF (listener, GstPipeWireSink, stream_add_buffer);
SpaBuffer *b;
struct spa_buffer *b;
GstBuffer *buf;
uint32_t i;
ProcessMemData data;
@ -455,7 +455,7 @@ on_add_buffer (struct pw_listener *listener,
data.header = spa_buffer_find_meta (b, stream->context->type.meta.Header);
for (i = 0; i < b->n_datas; i++) {
SpaData *d = &b->datas[i];
struct spa_data *d = &b->datas[i];
GstMemory *gmem = NULL;
if (d->type == stream->context->type.data.MemFd ||
@ -548,7 +548,7 @@ do_send_buffer (GstPipeWireSink *pwsink)
data->header->dts_offset = GST_BUFFER_DTS (buffer);
}
for (i = 0; i < data->buf->n_datas; i++) {
SpaData *d = &data->buf->datas[i];
struct spa_data *d = &data->buf->datas[i];
GstMemory *mem = gst_buffer_peek_memory (buffer, i);
d->chunk->offset = mem->offset - data->offset;
d->chunk->size = mem->size;
@ -604,7 +604,7 @@ on_state_changed (struct pw_listener *listener,
static void
on_format_changed (struct pw_listener *listener,
struct pw_stream *stream,
SpaFormat *format)
struct spa_format *format)
{
GstPipeWireSink *pwsink = SPA_CONTAINER_OF (listener, GstPipeWireSink, stream_format_changed);
@ -642,7 +642,7 @@ gst_pipewire_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
pwsink->path,
flags,
possible->len,
(SpaFormat **) possible->pdata);
(struct spa_format **) possible->pdata);
while (TRUE) {
state = pwsink->stream->state;

View file

@ -364,8 +364,8 @@ gst_pipewire_src_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
typedef struct {
GstPipeWireSrc *src;
guint id;
SpaBuffer *buf;
SpaMetaHeader *header;
struct spa_buffer *buf;
struct spa_meta_header *header;
guint flags;
goffset offset;
} ProcessMemData;
@ -405,7 +405,7 @@ on_add_buffer (struct pw_listener *listener,
guint id)
{
GstPipeWireSrc *pwsrc = SPA_CONTAINER_OF (listener, GstPipeWireSrc, stream_add_buffer);
SpaBuffer *b;
struct spa_buffer *b;
GstBuffer *buf;
uint32_t i;
ProcessMemData data;
@ -427,7 +427,7 @@ on_add_buffer (struct pw_listener *listener,
data.header = spa_buffer_find_meta (b, ctx->type.meta.Header);
for (i = 0; i < b->n_datas; i++) {
SpaData *d = &b->datas[i];
struct spa_data *d = &b->datas[i];
GstMemory *gmem = NULL;
if (d->type == ctx->type.data.MemFd || d->type == ctx->type.data.DmaBuf) {
@ -490,7 +490,7 @@ on_new_buffer (struct pw_listener *listener,
GstPipeWireSrc *pwsrc = SPA_CONTAINER_OF (listener, GstPipeWireSrc, stream_new_buffer);
GstBuffer *buf;
ProcessMemData *data;
SpaMetaHeader *h;
struct spa_meta_header *h;
guint i;
buf = g_hash_table_lookup (pwsrc->buf_ids, GINT_TO_POINTER (id));
@ -514,7 +514,7 @@ on_new_buffer (struct pw_listener *listener,
GST_BUFFER_OFFSET (buf) = h->seq;
}
for (i = 0; i < data->buf->n_datas; i++) {
SpaData *d = &data->buf->datas[i];
struct spa_data *d = &data->buf->datas[i];
GstMemory *mem = gst_buffer_peek_memory (buf, i);
mem->offset = d->chunk->offset + data->offset;
mem->size = d->chunk->size;
@ -714,7 +714,7 @@ gst_pipewire_src_negotiate (GstBaseSrc * basesrc)
pwsrc->path,
PW_STREAM_FLAG_AUTOCONNECT,
possible->len,
(SpaFormat **)possible->pdata);
(struct spa_format **)possible->pdata);
while (TRUE) {
enum pw_stream_state state = pwsrc->stream->state;
@ -781,7 +781,7 @@ connect_error:
static void
on_format_changed (struct pw_listener *listener,
struct pw_stream *stream,
SpaFormat *format)
struct spa_format *format)
{
GstPipeWireSrc *pwsrc = SPA_CONTAINER_OF (listener, GstPipeWireSrc, stream_format_changed);
GstCaps *caps;
@ -800,10 +800,10 @@ on_format_changed (struct pw_listener *listener,
gst_caps_unref (caps);
if (res) {
SpaParam *params[2];
SpaPODBuilder b = { NULL };
struct spa_param *params[2];
struct spa_pod_builder b = { NULL };
uint8_t buffer[512];
SpaPODFrame f[2];
struct spa_pod_frame f[2];
spa_pod_builder_init (&b, buffer, sizeof (buffer));
spa_pod_builder_object (&b, &f[0], 0, ctx->type.param_alloc_buffers.Buffers,
@ -811,12 +811,12 @@ on_format_changed (struct pw_listener *listener,
PROP_U_MM (&f[1], ctx->type.param_alloc_buffers.stride, SPA_POD_TYPE_INT, 0, 0, INT32_MAX),
PROP_U_MM (&f[1], ctx->type.param_alloc_buffers.buffers, SPA_POD_TYPE_INT, 16, 0, INT32_MAX),
PROP (&f[1], ctx->type.param_alloc_buffers.align, SPA_POD_TYPE_INT, 16));
params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, struct spa_param);
spa_pod_builder_object (&b, &f[0], 0, ctx->type.param_alloc_meta_enable.MetaEnable,
PROP (&f[1], ctx->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, ctx->type.meta.Header),
PROP (&f[1], ctx->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
PROP (&f[1], ctx->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (struct spa_meta_header)));
params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, struct spa_param);
GST_DEBUG_OBJECT (pwsrc, "doing finish format");
pw_stream_finish_format (pwsrc->stream, SPA_RESULT_OK, params, 2);

View file

@ -35,16 +35,16 @@ struct impl {
struct pw_listener global_added;
struct pw_listener global_removed;
SpaList client_list;
struct spa_list client_list;
};
struct client_info {
struct impl *impl;
struct pw_client *client;
SpaList link;
struct spa_list link;
struct pw_listener resource_added;
struct pw_listener resource_removed;
SpaList node_list;
struct spa_list node_list;
};
struct node_info {
@ -52,7 +52,7 @@ struct node_info {
struct client_info *info;
struct pw_node *node;
struct pw_resource *resource;
SpaList link;
struct spa_list link;
struct pw_listener state_changed;
struct pw_listener port_added;
struct pw_listener port_removed;

View file

@ -42,25 +42,25 @@ struct impl {
struct pw_listener global_added;
struct pw_listener global_removed;
SpaList client_list;
struct spa_list client_list;
struct pw_access access;
SpaSource *dispatch_event;
struct spa_source *dispatch_event;
};
struct client_info {
struct impl *impl;
SpaList link;
struct impl *impl;
struct spa_list link;
struct pw_client *client;
bool is_sandboxed;
SpaList async_pending;
bool is_sandboxed;
struct spa_list async_pending;
};
struct async_pending {
SpaList link;
bool handled;
struct client_info *info;
char *handle;
struct spa_list link;
bool handled;
struct client_info *info;
char *handle;
struct pw_access_data *access_data;
};
@ -232,7 +232,7 @@ check_global_owner (struct pw_core *core,
return false;
}
static SpaResult
static int
do_view_global (struct pw_access *access,
struct pw_client *client,
struct pw_global *global)
@ -253,7 +253,7 @@ do_view_global (struct pw_access *access,
return SPA_RESULT_OK;
}
static SpaResult
static int
do_create_node (struct pw_access *access,
struct pw_access_data *data,
const char *factory_name,
@ -310,7 +310,7 @@ portal_response (DBusConnection *connection, DBusMessage *msg, void *user_data)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
static SpaResult
static int
do_create_client_node (struct pw_access *access,
struct pw_access_data *data,
const char *name,
@ -453,7 +453,7 @@ on_global_removed (struct pw_listener *listener,
}
static void
dispatch_cb (SpaLoopUtils *utils, SpaSource *source, void *userdata)
dispatch_cb (struct spa_loop_utils *utils, struct spa_source *source, void *userdata)
{
struct impl *impl = userdata;
@ -471,10 +471,10 @@ dispatch_status (DBusConnection *conn, DBusDispatchStatus status, void *userdata
status == DBUS_DISPATCH_COMPLETE ? false : true);
}
static inline SpaIO
static inline enum spa_io
dbus_to_io (DBusWatch *watch)
{
SpaIO mask;
enum spa_io mask;
unsigned int flags;
/* no watch flags for disabled watches */
@ -493,7 +493,7 @@ dbus_to_io (DBusWatch *watch)
}
static inline unsigned int
io_to_dbus (SpaIO mask)
io_to_dbus (enum spa_io mask)
{
unsigned int flags = 0;
@ -509,10 +509,10 @@ io_to_dbus (SpaIO mask)
}
static void
handle_io_event (SpaLoopUtils *utils,
SpaSource *source,
handle_io_event (struct spa_loop_utils *utils,
struct spa_source *source,
int fd,
SpaIO mask,
enum spa_io mask,
void *userdata)
{
DBusWatch *watch = userdata;
@ -528,7 +528,7 @@ static dbus_bool_t
add_watch (DBusWatch *watch, void *userdata)
{
struct impl *impl = userdata;
SpaSource *source;
struct spa_source *source;
pw_log_debug ("add watch %p %d", watch, dbus_watch_get_unix_fd (watch));
@ -549,7 +549,7 @@ static void
remove_watch (DBusWatch *watch, void *userdata)
{
struct impl *impl = userdata;
SpaSource *source;
struct spa_source *source;
if ((source = dbus_watch_get_data (watch)))
pw_loop_destroy_source (impl->core->main_loop->loop, source);
@ -559,7 +559,7 @@ static void
toggle_watch (DBusWatch *watch, void *userdata)
{
struct impl *impl = userdata;
SpaSource *source;
struct spa_source *source;
source = dbus_watch_get_data (watch);
@ -569,7 +569,7 @@ toggle_watch (DBusWatch *watch, void *userdata)
}
static void
handle_timer_event (SpaLoopUtils *utils, SpaSource *source, void *userdata)
handle_timer_event (struct spa_loop_utils *utils, struct spa_source *source, void *userdata)
{
DBusTimeout *timeout = userdata;
uint64_t t;
@ -589,7 +589,7 @@ static dbus_bool_t
add_timeout (DBusTimeout *timeout, void *userdata)
{
struct impl *impl = userdata;
SpaSource *source;
struct spa_source *source;
struct timespec ts;
uint64_t t;
@ -617,7 +617,7 @@ static void
remove_timeout (DBusTimeout *timeout, void *userdata)
{
struct impl *impl = userdata;
SpaSource *source;
struct spa_source *source;
if ((source = dbus_timeout_get_data (timeout)))
pw_loop_destroy_source (impl->core->main_loop->loop, source);
@ -627,7 +627,7 @@ static void
toggle_timeout (DBusTimeout *timeout, void *userdata)
{
struct impl *impl = userdata;
SpaSource *source;
struct spa_source *source;
struct timespec ts, *tsp;
source = dbus_timeout_get_data (timeout);

View file

@ -34,22 +34,22 @@ struct impl {
struct pw_properties *properties;
void *hnd;
const SpaHandleFactory *factory;
const struct spa_handle_factory *factory;
};
static const SpaHandleFactory *
static const struct spa_handle_factory *
find_factory (struct impl *impl)
{
SpaEnumHandleFactoryFunc enum_func;
spa_handle_factory_enum_func_t enum_func;
uint32_t index;
const SpaHandleFactory *factory = NULL;
SpaResult res;
const struct spa_handle_factory *factory = NULL;
int res;
if ((impl->hnd = dlopen (AUDIOMIXER_LIB, RTLD_NOW)) == NULL) {
pw_log_error ("can't load %s: %s", AUDIOMIXER_LIB, dlerror());
return NULL;
}
if ((enum_func = dlsym (impl->hnd, "spa_enum_handle_factory")) == NULL) {
if ((enum_func = dlsym (impl->hnd, SPA_HANDLE_FACTORY_ENUM_FUNC_NAME)) == NULL) {
pw_log_error ("can't find enum function");
goto no_symbol;
}
@ -75,11 +75,11 @@ no_symbol:
static struct pw_node *
make_node (struct impl *impl)
{
SpaHandle *handle;
SpaResult res;
struct spa_handle *handle;
int res;
void *iface;
SpaNode *spa_node;
SpaClock *spa_clock;
struct spa_node *spa_node;
struct spa_clock *spa_clock;
struct pw_node *node;
handle = calloc (1, impl->factory->size);

View file

@ -52,15 +52,15 @@
struct impl {
struct pw_core *core;
SpaList link;
struct spa_list link;
struct pw_properties *properties;
GDBusConnection *connection;
GDBusObjectManagerServer *server_manager;
SpaList client_list;
SpaList object_list;
struct spa_list client_list;
struct spa_list object_list;
struct pw_listener global_added;
struct pw_listener global_removed;
@ -68,7 +68,7 @@ struct impl {
struct object {
struct impl *impl;
SpaList link;
struct spa_list link;
struct pw_global *global;
void *iface;
PipeWireObjectSkeleton *skel;
@ -78,15 +78,15 @@ struct object {
struct server {
struct object parent;
SpaList link;
struct spa_list link;
guint id;
};
struct client {
struct object parent;
SpaList link;
gchar *sender;
guint id;
struct object parent;
struct spa_list link;
gchar *sender;
guint id;
};
struct node {
@ -389,7 +389,7 @@ handle_create_client_node (PipeWireDaemon1 *interface,
struct impl *impl = user_data;
struct pw_client_node *node;
struct pw_client *client;
SpaResult res;
int res;
const char *sender, *object_path, *target_node;
struct pw_properties *props;
GError *error = NULL;

View file

@ -59,30 +59,31 @@ struct socket {
int fd_lock;
struct sockaddr_un addr;
char lock_addr[UNIX_PATH_MAX + LOCK_SUFFIXLEN];
struct pw_loop *loop;
SpaSource *source;
char *core_name;
SpaList link;
struct pw_loop *loop;
struct spa_source *source;
char *core_name;
struct spa_list link;
};
struct impl {
struct pw_core *core;
SpaList link;
struct spa_list link;
struct pw_properties *properties;
SpaList socket_list;
SpaList client_list;
struct spa_list socket_list;
struct spa_list client_list;
struct pw_listener before_iterate;
};
struct native_client {
struct impl *impl;
SpaList link;
struct impl *impl;
struct spa_list link;
struct pw_client *client;
int fd;
SpaSource *source;
struct spa_source *source;
struct pw_connection *connection;
struct pw_listener resource_added;
};
@ -120,11 +121,11 @@ on_before_iterate (struct pw_listener *listener,
}
static void
connection_data (SpaLoopUtils *utils,
SpaSource *source,
int fd,
SpaIO mask,
void *data)
connection_data (struct spa_loop_utils *utils,
struct spa_source *source,
int fd,
enum spa_io mask,
void *data)
{
struct native_client *client = data;
struct pw_connection *conn = client->connection;
@ -331,10 +332,10 @@ err:
}
static void
socket_data (SpaLoopUtils *utils,
SpaSource *source,
socket_data (struct spa_loop_utils *utils,
struct spa_source *source,
int fd,
SpaIO mask,
enum spa_io mask,
void *data)
{
struct impl *impl = data;

View file

@ -33,22 +33,22 @@ struct impl {
struct pw_listener global_added;
struct pw_listener global_removed;
SpaList node_list;
struct spa_list node_list;
};
typedef struct {
struct node_info {
struct impl *impl;
struct pw_node *node;
SpaList link;
struct spa_list link;
struct pw_listener node_state_request;
struct pw_listener node_state_changed;
SpaSource *idle_timeout;
} NodeInfo;
struct spa_source *idle_timeout;
};
static NodeInfo *
static struct node_info *
find_node_info (struct impl *impl, struct pw_node *node)
{
NodeInfo *info;
struct node_info *info;
spa_list_for_each (info, &impl->node_list, link) {
if (info->node == node)
@ -58,7 +58,7 @@ find_node_info (struct impl *impl, struct pw_node *node)
}
static void
remove_idle_timeout (NodeInfo *info)
remove_idle_timeout (struct node_info *info)
{
if (info->idle_timeout) {
pw_loop_destroy_source (info->impl->core->main_loop->loop, info->idle_timeout);
@ -67,7 +67,7 @@ remove_idle_timeout (NodeInfo *info)
}
static void
node_info_free (NodeInfo *info)
node_info_free (struct node_info *info)
{
spa_list_remove (&info->link);
remove_idle_timeout (info);
@ -77,11 +77,11 @@ node_info_free (NodeInfo *info)
}
static void
idle_timeout (SpaLoopUtils *utils,
SpaSource *source,
idle_timeout (struct spa_loop_utils *utils,
struct spa_source *source,
void *data)
{
NodeInfo *info = data;
struct node_info *info = data;
pw_log_debug ("module %p: node %p idle timeout", info->impl, info->node);
remove_idle_timeout (info);
@ -93,7 +93,7 @@ on_node_state_request (struct pw_listener *listener,
struct pw_node *node,
enum pw_node_state state)
{
NodeInfo *info = SPA_CONTAINER_OF (listener, NodeInfo, node_state_request);
struct node_info *info = SPA_CONTAINER_OF (listener, struct node_info, node_state_request);
remove_idle_timeout (info);
}
@ -103,7 +103,7 @@ on_node_state_changed (struct pw_listener *listener,
enum pw_node_state old,
enum pw_node_state state)
{
NodeInfo *info = SPA_CONTAINER_OF (listener, NodeInfo, node_state_changed);
struct node_info *info = SPA_CONTAINER_OF (listener, struct node_info, node_state_changed);
struct impl *impl = info->impl;
if (state != PW_NODE_STATE_IDLE) {
@ -134,9 +134,9 @@ on_global_added (struct pw_listener *listener,
if (global->type == impl->core->type.node) {
struct pw_node *node = global->object;
NodeInfo *info;
struct node_info *info;
info = calloc (1, sizeof (NodeInfo));
info = calloc (1, sizeof (struct node_info));
info->impl = impl;
info->node = node;
spa_list_insert (impl->node_list.prev, &info->link);
@ -156,7 +156,7 @@ on_global_removed (struct pw_listener *listener,
if (global->type == impl->core->type.node) {
struct pw_node *node = global->object;
NodeInfo *info;
struct node_info *info;
if ((info = find_node_info (impl, node)))
node_info_free (info);

View file

@ -30,11 +30,11 @@
#include "spa-monitor.h"
#include "spa-node.h"
static SpaResult
setup_video_node (struct pw_core *core, SpaNode *spa_node, struct pw_properties *pw_props) {
SpaResult res;
SpaProps *props;
SpaPODProp *prop;
static int
setup_video_node (struct pw_core *core, struct spa_node *spa_node, struct pw_properties *pw_props) {
int res;
struct spa_props *props;
struct spa_pod_prop *prop;
const char *pattern, *pattern_type;
/* Retrieve pattern property */
@ -53,9 +53,9 @@ setup_video_node (struct pw_core *core, SpaNode *spa_node, struct pw_properties
return SPA_RESULT_ERROR;
}
if ((prop = spa_pod_object_find_prop (props, spa_type_map_get_id (core->type.map, SPA_TYPE_PROPS__patternType)))) {
if ((prop = spa_pod_object_find_prop (&props->object, spa_type_map_get_id (core->type.map, SPA_TYPE_PROPS__patternType)))) {
if (prop->body.value.type == SPA_POD_TYPE_ID)
SPA_POD_VALUE (SpaPODId, &prop->body.value) = spa_type_map_get_id (core->type.map, pattern_type);
SPA_POD_VALUE (struct spa_pod_id, &prop->body.value) = spa_type_map_get_id (core->type.map, pattern_type);
}
if ((res = spa_node_set_props (spa_node, props)) != SPA_RESULT_OK) {

View file

@ -36,9 +36,9 @@
struct monitor_item
{
char *id;
SpaList link;
struct pw_node *node;
char *id;
struct spa_list link;
struct pw_node *node;
};
struct impl {
@ -48,24 +48,24 @@ struct impl {
void *hnd;
SpaList item_list;
struct spa_list item_list;
};
static void
add_item (struct pw_spa_monitor *this, SpaMonitorItem *item)
add_item (struct pw_spa_monitor *this, struct spa_monitor_item *item)
{
struct impl *impl = SPA_CONTAINER_OF (this, struct impl, this);
SpaResult res;
SpaHandle *handle;
int res;
struct spa_handle *handle;
struct monitor_item *mitem;
void *node_iface;
void *clock_iface;
struct pw_properties *props = NULL;
const char *name, *id, *klass;
SpaHandleFactory *factory;
SpaPOD *info = NULL;
struct spa_handle_factory *factory;
struct spa_pod *info = NULL;
spa_pod_object_query (item,
spa_pod_object_query (&item->object,
impl->core->type.monitor.name, SPA_POD_TYPE_STRING, &name,
impl->core->type.monitor.id, SPA_POD_TYPE_STRING, &id,
impl->core->type.monitor.klass, SPA_POD_TYPE_STRING, &klass,
@ -78,7 +78,7 @@ add_item (struct pw_spa_monitor *this, SpaMonitorItem *item)
props = pw_properties_new (NULL, NULL);
if (info) {
SpaPODIter it;
struct spa_pod_iter it;
spa_pod_iter_pod (&it, info);
while (true) {
@ -146,13 +146,13 @@ destroy_item (struct monitor_item *mitem)
}
static void
remove_item (struct pw_spa_monitor *this, SpaMonitorItem *item)
remove_item (struct pw_spa_monitor *this, struct spa_monitor_item *item)
{
struct impl *impl = SPA_CONTAINER_OF (this, struct impl, this);
struct monitor_item *mitem;
const char *name, *id;
spa_pod_object_query (item,
spa_pod_object_query (&item->object,
impl->core->type.monitor.name, SPA_POD_TYPE_STRING, &name,
impl->core->type.monitor.id, SPA_POD_TYPE_STRING, &id,
0);
@ -164,26 +164,26 @@ remove_item (struct pw_spa_monitor *this, SpaMonitorItem *item)
}
static void
on_monitor_event (SpaMonitor *monitor,
SpaEventMonitor *event,
void *user_data)
on_monitor_event (struct spa_monitor *monitor,
struct spa_event *event,
void *user_data)
{
struct pw_spa_monitor *this = user_data;
struct impl *impl = SPA_CONTAINER_OF (this, struct impl, this);
if (SPA_EVENT_TYPE (event) == impl->core->type.monitor.Added) {
SpaMonitorItem *item = SPA_POD_CONTENTS (SpaEvent, event);
struct spa_monitor_item *item = SPA_POD_CONTENTS (struct spa_event, event);
add_item (this, item);
}
else if (SPA_EVENT_TYPE (event) == impl->core->type.monitor.Removed) {
SpaMonitorItem *item = SPA_POD_CONTENTS (SpaEvent, event);
struct spa_monitor_item *item = SPA_POD_CONTENTS (struct spa_event, event);
remove_item (this, item);
}
else if (SPA_EVENT_TYPE (event) == impl->core->type.monitor.Changed) {
SpaMonitorItem *item = SPA_POD_CONTENTS (SpaEvent, event);
struct spa_monitor_item *item = SPA_POD_CONTENTS (struct spa_event, event);
const char *name;
spa_pod_object_query (item,
spa_pod_object_query (&item->object,
impl->core->type.monitor.name, SPA_POD_TYPE_STRING, &name,
0);
@ -196,8 +196,8 @@ update_monitor (struct pw_core *core,
const char *name)
{
const char *monitors;
SpaDictItem item;
SpaDict dict = SPA_DICT_INIT(1, &item);
struct spa_dict_item item;
struct spa_dict dict = SPA_DICT_INIT(1, &item);
if (core->properties)
monitors = pw_properties_get (core->properties, "monitors");
@ -216,6 +216,10 @@ update_monitor (struct pw_core *core,
free ((void*)item.value);
}
static const struct spa_monitor_callbacks callbacks = {
on_monitor_event,
};
struct pw_spa_monitor *
pw_spa_monitor_load (struct pw_core *core,
const char *lib,
@ -224,19 +228,19 @@ pw_spa_monitor_load (struct pw_core *core,
{
struct impl *impl;
struct pw_spa_monitor *this;
SpaHandle *handle;
SpaResult res;
struct spa_handle *handle;
int res;
void *iface;
void *hnd;
uint32_t index;
SpaEnumHandleFactoryFunc enum_func;
const SpaHandleFactory *factory;
spa_handle_factory_enum_func_t enum_func;
const struct spa_handle_factory *factory;
if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) {
pw_log_error ("can't load %s: %s", lib, dlerror());
return NULL;
}
if ((enum_func = dlsym (hnd, "spa_enum_handle_factory")) == NULL) {
if ((enum_func = dlsym (hnd, SPA_HANDLE_FACTORY_ENUM_FUNC_NAME)) == NULL) {
pw_log_error ("can't find enum function");
goto no_symbol;
}
@ -284,8 +288,8 @@ pw_spa_monitor_load (struct pw_core *core,
spa_list_init (&impl->item_list);
for (index = 0;; index++) {
SpaMonitorItem *item;
SpaResult res;
struct spa_monitor_item *item;
int res;
if ((res = spa_monitor_enum_items (this->monitor, &item, index)) < 0) {
if (res != SPA_RESULT_ENUM_END)
@ -294,7 +298,7 @@ pw_spa_monitor_load (struct pw_core *core,
}
add_item (this, item);
}
spa_monitor_set_event_callback (this->monitor, on_monitor_event, this);
spa_monitor_set_callbacks (this->monitor, &callbacks, sizeof (callbacks), this);
return this;

View file

@ -28,12 +28,12 @@ extern "C" {
#endif
struct pw_spa_monitor {
SpaMonitor *monitor;
struct spa_monitor *monitor;
char *lib;
char *factory_name;
char *system_name;
SpaHandle *handle;
struct spa_handle *handle;
PW_SIGNAL (destroy_signal, (struct pw_listener *listener, struct pw_spa_monitor *monitor));
};

View file

@ -42,21 +42,21 @@ pw_spa_node_load (struct pw_core *core,
{
struct pw_spa_node *this;
struct impl *impl;
SpaNode *spa_node;
SpaClock *spa_clock;
SpaResult res;
SpaHandle *handle;
struct spa_node *spa_node;
struct spa_clock *spa_clock;
int res;
struct spa_handle *handle;
void *hnd;
uint32_t index;
SpaEnumHandleFactoryFunc enum_func;
const SpaHandleFactory *factory;
spa_handle_factory_enum_func_t enum_func;
const struct spa_handle_factory *factory;
void *iface;
if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) {
pw_log_error ("can't load %s: %s", lib, dlerror());
return NULL;
}
if ((enum_func = dlsym (hnd, "spa_enum_handle_factory")) == NULL) {
if ((enum_func = dlsym (hnd, SPA_HANDLE_FACTORY_ENUM_FUNC_NAME)) == NULL) {
pw_log_error ("can't find enum function");
goto no_symbol;
}

View file

@ -32,13 +32,13 @@ struct pw_spa_node {
char *lib;
char *factory_name;
SpaHandle *handle;
struct spa_handle *handle;
PW_SIGNAL (destroy_signal, (struct pw_listener *listener,
struct pw_spa_node *node));
};
typedef SpaResult (*setup_node_t) (struct pw_core *core,
SpaNode *spa_node,
typedef int (*setup_node_t) (struct pw_core *core,
struct spa_node *spa_node,
struct pw_properties *pw_props);
struct pw_spa_node * pw_spa_node_load (struct pw_core *core,

View file

@ -32,7 +32,7 @@ extern "C" {
#include <pipewire/server/resource.h>
struct pw_access_data {
SpaResult res;
int res;
struct pw_resource *resource;
void * (*async_copy) (struct pw_access_data *data, size_t size);
@ -48,15 +48,15 @@ struct pw_access_data {
* PipeWire Access support struct.
*/
struct pw_access {
SpaResult (*view_global) (struct pw_access *access,
int (*view_global) (struct pw_access *access,
struct pw_client *client,
struct pw_global *global);
SpaResult (*create_node) (struct pw_access *access,
int (*create_node) (struct pw_access *access,
struct pw_access_data *data,
const char *factory_name,
const char *name,
struct pw_properties *properties);
SpaResult (*create_client_node) (struct pw_access *access,
int (*create_client_node) (struct pw_access *access,
struct pw_access_data *data,
const char *name,
struct pw_properties *properties);

View file

@ -56,24 +56,24 @@
#define CHECK_PORT_BUFFER(this,b,p) (b < p->n_buffers)
struct proxy_buffer {
SpaBuffer *outbuf;
SpaBuffer buffer;
SpaMeta metas[4];
SpaData datas[4];
off_t offset;
size_t size;
bool outstanding;
struct spa_buffer *outbuf;
struct spa_buffer buffer;
struct spa_meta metas[4];
struct spa_data datas[4];
off_t offset;
size_t size;
bool outstanding;
};
struct proxy_port {
bool valid;
SpaPortInfo info;
SpaFormat *format;
struct spa_port_info info;
struct spa_format *format;
uint32_t n_formats;
SpaFormat **formats;
struct spa_format **formats;
uint32_t n_params;
SpaParam **params;
SpaPortIO *io;
struct spa_param **params;
struct spa_port_io *io;
uint32_t n_buffers;
struct proxy_buffer buffers[MAX_BUFFERS];
@ -84,21 +84,21 @@ struct proxy_port {
struct proxy
{
SpaNode node;
struct spa_node node;
struct impl *impl;
SpaTypeMap *map;
SpaLog *log;
SpaLoop *main_loop;
SpaLoop *data_loop;
struct spa_type_map *map;
struct spa_log *log;
struct spa_loop *main_loop;
struct spa_loop *data_loop;
SpaNodeCallbacks callbacks;
struct spa_node_callbacks callbacks;
void *user_data;
struct pw_resource *resource;
SpaSource data_source;
struct spa_source data_source;
int writefd;
uint32_t max_inputs;
@ -130,7 +130,7 @@ struct impl {
int other_fds[2];
};
static SpaResult
static int
clear_buffers (struct proxy *this, struct proxy_port *port)
{
if (port->n_buffers) {
@ -143,16 +143,16 @@ clear_buffers (struct proxy *this, struct proxy_port *port)
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_get_props (SpaNode *node,
SpaProps **props)
static int
spa_proxy_node_get_props (struct spa_node *node,
struct spa_props **props)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}
static SpaResult
spa_proxy_node_set_props (SpaNode *node,
const SpaProps *props)
static int
spa_proxy_node_set_props (struct spa_node *node,
const struct spa_props *props)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}
@ -184,12 +184,12 @@ send_have_output (struct proxy *this)
do_flush (this);
}
static SpaResult
spa_proxy_node_send_command (SpaNode *node,
SpaCommand *command)
static int
spa_proxy_node_send_command (struct spa_node *node,
struct spa_command *command)
{
struct proxy *this;
SpaResult res = SPA_RESULT_OK;
int res = SPA_RESULT_OK;
struct pw_core *core;
if (node == NULL || command == NULL)
@ -220,9 +220,9 @@ spa_proxy_node_send_command (SpaNode *node,
return res;
}
static SpaResult
spa_proxy_node_set_callbacks (SpaNode *node,
const SpaNodeCallbacks *callbacks,
static int
spa_proxy_node_set_callbacks (struct spa_node *node,
const struct spa_node_callbacks *callbacks,
size_t callbacks_size,
void *user_data)
{
@ -238,8 +238,8 @@ spa_proxy_node_set_callbacks (SpaNode *node,
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_get_n_ports (SpaNode *node,
static int
spa_proxy_node_get_n_ports (struct spa_node *node,
uint32_t *n_input_ports,
uint32_t *max_input_ports,
uint32_t *n_output_ports,
@ -264,8 +264,8 @@ spa_proxy_node_get_n_ports (SpaNode *node,
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_get_port_ids (SpaNode *node,
static int
spa_proxy_node_get_port_ids (struct spa_node *node,
uint32_t n_input_ports,
uint32_t *input_ids,
uint32_t n_output_ports,
@ -296,15 +296,15 @@ spa_proxy_node_get_port_ids (SpaNode *node,
static void
do_update_port (struct proxy *this,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
uint32_t change_mask,
uint32_t n_possible_formats,
const SpaFormat **possible_formats,
const SpaFormat *format,
const struct spa_format **possible_formats,
const struct spa_format *format,
uint32_t n_params,
const SpaParam **params,
const SpaPortInfo *info)
const struct spa_param **params,
const struct spa_port_info *info)
{
struct proxy_port *port;
uint32_t i;
@ -319,7 +319,7 @@ do_update_port (struct proxy *this,
for (i = 0; i < port->n_formats; i++)
free (port->formats[i]);
port->n_formats = n_possible_formats;
port->formats = realloc (port->formats, port->n_formats * sizeof (SpaFormat *));
port->formats = realloc (port->formats, port->n_formats * sizeof (struct spa_format *));
for (i = 0; i < port->n_formats; i++)
port->formats[i] = spa_format_copy (possible_formats[i]);
}
@ -333,7 +333,7 @@ do_update_port (struct proxy *this,
for (i = 0; i < port->n_params; i++)
free (port->params[i]);
port->n_params = n_params;
port->params = realloc (port->params, port->n_params * sizeof (SpaParam *));
port->params = realloc (port->params, port->n_params * sizeof (struct spa_param *));
for (i = 0; i < port->n_params; i++)
port->params[i] = spa_param_copy (params[i]);
}
@ -356,7 +356,7 @@ do_update_port (struct proxy *this,
static void
clear_port (struct proxy *this,
struct proxy_port *port,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id)
{
do_update_port (this,
@ -377,7 +377,7 @@ clear_port (struct proxy *this,
static void
do_uninit_port (struct proxy *this,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id)
{
struct proxy_port *port;
@ -394,9 +394,9 @@ do_uninit_port (struct proxy *this,
port->valid = false;
}
static SpaResult
spa_proxy_node_add_port (SpaNode *node,
SpaDirection direction,
static int
spa_proxy_node_add_port (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id)
{
struct proxy *this;
@ -416,9 +416,9 @@ spa_proxy_node_add_port (SpaNode *node,
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_remove_port (SpaNode *node,
SpaDirection direction,
static int
spa_proxy_node_remove_port (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id)
{
struct proxy *this;
@ -436,19 +436,19 @@ spa_proxy_node_remove_port (SpaNode *node,
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_port_enum_formats (SpaNode *node,
SpaDirection direction,
static int
spa_proxy_node_port_enum_formats (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
SpaFormat **format,
const SpaFormat *filter,
struct spa_format **format,
const struct spa_format *filter,
uint32_t index)
{
struct proxy *this;
struct proxy_port *port;
SpaFormat *fmt;
SpaPODBuilder b = { NULL, };
SpaResult res;
struct spa_format *fmt;
struct spa_pod_builder b = { NULL, };
int res;
uint32_t count, match = 0;
if (node == NULL || format == NULL)
@ -474,17 +474,17 @@ next:
if ((res = spa_format_filter (fmt, filter, &b)) != SPA_RESULT_OK || match++ != index)
goto next;
*format = SPA_POD_BUILDER_DEREF (&b, 0, SpaFormat);
*format = SPA_POD_BUILDER_DEREF (&b, 0, struct spa_format);
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_port_set_format (SpaNode *node,
SpaDirection direction,
static int
spa_proxy_node_port_set_format (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
uint32_t flags,
const SpaFormat *format)
const struct spa_format *format)
{
struct proxy *this;
@ -509,11 +509,11 @@ spa_proxy_node_port_set_format (SpaNode *node,
return SPA_RESULT_RETURN_ASYNC (this->seq++);
}
static SpaResult
spa_proxy_node_port_get_format (SpaNode *node,
SpaDirection direction,
static int
spa_proxy_node_port_get_format (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const SpaFormat **format)
const struct spa_format **format)
{
struct proxy *this;
struct proxy_port *port;
@ -536,11 +536,11 @@ spa_proxy_node_port_get_format (SpaNode *node,
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_port_get_info (SpaNode *node,
SpaDirection direction,
static int
spa_proxy_node_port_get_info (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const SpaPortInfo **info)
const struct spa_port_info **info)
{
struct proxy *this;
struct proxy_port *port;
@ -560,12 +560,12 @@ spa_proxy_node_port_get_info (SpaNode *node,
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_port_enum_params (SpaNode *node,
SpaDirection direction,
static int
spa_proxy_node_port_enum_params (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
uint32_t index,
SpaParam **param)
struct spa_param **param)
{
struct proxy *this;
struct proxy_port *port;
@ -587,20 +587,20 @@ spa_proxy_node_port_enum_params (SpaNode *node,
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_port_set_param (SpaNode *node,
SpaDirection direction,
static int
spa_proxy_node_port_set_param (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const SpaParam *param)
const struct spa_param *param)
{
return SPA_RESULT_NOT_IMPLEMENTED;
}
static SpaResult
spa_proxy_node_port_set_io (SpaNode *node,
SpaDirection direction,
static int
spa_proxy_node_port_set_io (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
SpaPortIO *io)
struct spa_port_io *io)
{
struct proxy *this;
struct proxy_port *port;
@ -619,12 +619,12 @@ spa_proxy_node_port_set_io (SpaNode *node,
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_port_use_buffers (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaBuffer **buffers,
uint32_t n_buffers)
static int
spa_proxy_node_port_use_buffers (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_buffer **buffers,
uint32_t n_buffers)
{
struct proxy *this;
struct impl *impl;
@ -632,7 +632,7 @@ spa_proxy_node_port_use_buffers (SpaNode *node,
uint32_t i, j;
size_t n_mem;
struct pw_client_node_buffer *mb;
SpaMetaShared *msh;
struct spa_meta_shared *msh;
this = SPA_CONTAINER_OF (node, struct proxy, node);
impl = this->impl;
@ -670,7 +670,7 @@ spa_proxy_node_port_use_buffers (SpaNode *node,
}
b->outbuf = buffers[i];
memcpy (&b->buffer, buffers[i], sizeof (SpaBuffer));
memcpy (&b->buffer, buffers[i], sizeof (struct spa_buffer));
b->buffer.datas = b->datas;
b->buffer.metas = b->metas;
@ -690,13 +690,13 @@ spa_proxy_node_port_use_buffers (SpaNode *node,
msh->size);
for (j = 0; j < buffers[i]->n_metas; j++) {
memcpy (&b->buffer.metas[j], &buffers[i]->metas[j], sizeof (SpaMeta));
memcpy (&b->buffer.metas[j], &buffers[i]->metas[j], sizeof (struct spa_meta));
}
for (j = 0; j < buffers[i]->n_datas; j++) {
SpaData *d = &buffers[i]->datas[j];
struct spa_data *d = &buffers[i]->datas[j];
memcpy (&b->buffer.datas[j], d, sizeof (SpaData));
memcpy (&b->buffer.datas[j], d, sizeof (struct spa_data));
if (d->type == impl->core->type.data.DmaBuf ||
d->type == impl->core->type.data.MemFd) {
@ -735,14 +735,14 @@ spa_proxy_node_port_use_buffers (SpaNode *node,
return SPA_RESULT_RETURN_ASYNC (this->seq++);
}
static SpaResult
spa_proxy_node_port_alloc_buffers (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaParam **params,
uint32_t n_params,
SpaBuffer **buffers,
uint32_t *n_buffers)
static int
spa_proxy_node_port_alloc_buffers (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_param **params,
uint32_t n_params,
struct spa_buffer **buffers,
uint32_t *n_buffers)
{
struct proxy *this;
struct proxy_port *port;
@ -763,8 +763,8 @@ spa_proxy_node_port_alloc_buffers (SpaNode *node,
return SPA_RESULT_NOT_IMPLEMENTED;
}
static SpaResult
spa_proxy_node_port_reuse_buffer (SpaNode *node,
static int
spa_proxy_node_port_reuse_buffer (struct spa_node *node,
uint32_t port_id,
uint32_t buffer_id)
{
@ -784,17 +784,17 @@ spa_proxy_node_port_reuse_buffer (SpaNode *node,
{
struct pw_event_transport_reuse_buffer rb = PW_EVENT_TRANSPORT_REUSE_BUFFER_INIT
(impl->core->type.event_transport.ReuseBuffer, port_id, buffer_id);
pw_transport_add_event (impl->transport, (SpaEvent *)&rb);
pw_transport_add_event (impl->transport, (struct spa_event *)&rb);
}
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_port_send_command (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaCommand *command)
static int
spa_proxy_node_port_send_command (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_command *command)
{
struct proxy *this;
@ -807,8 +807,8 @@ spa_proxy_node_port_send_command (SpaNode *node,
return SPA_RESULT_NOT_IMPLEMENTED;
}
static SpaResult
spa_proxy_node_process_input (SpaNode *node)
static int
spa_proxy_node_process_input (struct spa_node *node)
{
struct impl *impl;
struct proxy *this;
@ -821,7 +821,7 @@ spa_proxy_node_process_input (SpaNode *node)
impl = this->impl;
for (i = 0; i < MAX_INPUTS; i++) {
SpaPortIO *io = this->in_ports[i].io;
struct spa_port_io *io = this->in_ports[i].io;
if (!io)
continue;
@ -836,8 +836,8 @@ spa_proxy_node_process_input (SpaNode *node)
return SPA_RESULT_OK;
}
static SpaResult
spa_proxy_node_process_output (SpaNode *node)
static int
spa_proxy_node_process_output (struct spa_node *node)
{
struct proxy *this;
struct impl *impl;
@ -848,7 +848,7 @@ spa_proxy_node_process_output (SpaNode *node)
impl = this->impl;
for (i = 0; i < MAX_OUTPUTS; i++) {
SpaPortIO *io = this->out_ports[i].io, tmp;
struct spa_port_io *io = this->out_ports[i].io, tmp;
if (!io)
continue;
@ -859,7 +859,7 @@ spa_proxy_node_process_output (SpaNode *node)
spa_log_trace (this->log, "reuse buffer %d", io->buffer_id);
pw_transport_add_event (impl->transport, (SpaEvent *)&rb);
pw_transport_add_event (impl->transport, (struct spa_event *)&rb);
io->buffer_id = SPA_ID_INVALID;
flush = true;
}
@ -882,16 +882,16 @@ spa_proxy_node_process_output (SpaNode *node)
return SPA_RESULT_HAVE_BUFFER;
}
static SpaResult
static int
handle_node_event (struct proxy *this,
SpaEvent *event)
struct spa_event *event)
{
struct impl *impl = SPA_CONTAINER_OF (this, struct impl, proxy);
int i;
if (SPA_EVENT_TYPE (event) == impl->core->type.event_transport.HaveOutput) {
for (i = 0; i < MAX_OUTPUTS; i++) {
SpaPortIO *io = this->out_ports[i].io;
struct spa_port_io *io = this->out_ports[i].io;
if (!io)
continue;
@ -916,7 +916,7 @@ client_node_update (void *object,
uint32_t change_mask,
uint32_t max_input_ports,
uint32_t max_output_ports,
const SpaProps *props)
const struct spa_props *props)
{
struct pw_resource *resource = object;
struct pw_client_node *node = resource->object;
@ -934,15 +934,15 @@ client_node_update (void *object,
static void
client_node_port_update (void *object,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
uint32_t change_mask,
uint32_t n_possible_formats,
const SpaFormat **possible_formats,
const SpaFormat *format,
const struct spa_format **possible_formats,
const struct spa_format *format,
uint32_t n_params,
const SpaParam **params,
const SpaPortInfo *info)
const struct spa_param **params,
const struct spa_port_info *info)
{
struct pw_resource *resource = object;
struct pw_client_node *node = resource->object;
@ -974,7 +974,7 @@ client_node_port_update (void *object,
static void
client_node_event (void *object,
SpaEvent *event)
struct spa_event *event)
{
struct pw_resource *resource = object;
struct pw_client_node *node = resource->object;
@ -1000,7 +1000,7 @@ static struct pw_client_node_methods client_node_methods = {
};
static void
proxy_on_data_fd_events (SpaSource *source)
proxy_on_data_fd_events (struct spa_source *source)
{
struct proxy *this = source->data;
struct impl *impl = this->impl;
@ -1011,21 +1011,21 @@ proxy_on_data_fd_events (SpaSource *source)
}
if (source->rmask & SPA_IO_IN) {
SpaEvent event;
struct spa_event event;
uint64_t cmd;
read (this->data_source.fd, &cmd, 8);
while (pw_transport_next_event (impl->transport, &event) == SPA_RESULT_OK) {
SpaEvent *ev = alloca (SPA_POD_SIZE (&event));
struct spa_event *ev = alloca (SPA_POD_SIZE (&event));
pw_transport_parse_event (impl->transport, ev);
handle_node_event (this, ev);
}
}
}
static const SpaNode proxy_node = {
sizeof (SpaNode),
static const struct spa_node proxy_node = {
sizeof (struct spa_node),
NULL,
spa_proxy_node_get_props,
spa_proxy_node_set_props,
@ -1050,11 +1050,11 @@ static const SpaNode proxy_node = {
spa_proxy_node_process_output,
};
static SpaResult
proxy_init (struct proxy *this,
SpaDict *info,
const SpaSupport *support,
uint32_t n_support)
static int
proxy_init (struct proxy *this,
struct spa_dict *info,
const struct spa_support *support,
uint32_t n_support)
{
uint32_t i;
@ -1126,7 +1126,7 @@ on_global_added (struct pw_listener *listener,
global->owner = impl->this.client;
}
static SpaResult
static int
proxy_clear (struct proxy *this)
{
uint32_t i;
@ -1287,7 +1287,7 @@ pw_client_node_destroy (struct pw_client_node * this)
*
* Returns: %SPA_RESULT_OK on success
*/
SpaResult
int
pw_client_node_get_fds (struct pw_client_node *this,
int *readfd,
int *writefd)

View file

@ -50,7 +50,7 @@ struct pw_client_node * pw_client_node_new (struct pw_client *cl
struct pw_properties *properties);
void pw_client_node_destroy (struct pw_client_node *node);
SpaResult pw_client_node_get_fds (struct pw_client_node *node,
int pw_client_node_get_fds (struct pw_client_node *node,
int *readfd,
int *writefd);

View file

@ -37,7 +37,7 @@ client_unbind_func (void *data)
spa_list_remove (&resource->link);
}
static SpaResult
static int
client_bind_func (struct pw_global *global,
struct pw_client *client,
uint32_t version,
@ -166,8 +166,8 @@ pw_client_destroy (struct pw_client * client)
}
void
pw_client_update_properties (struct pw_client *client,
const SpaDict *dict)
pw_client_update_properties (struct pw_client *client,
const struct spa_dict *dict)
{
struct pw_resource *resource;

View file

@ -40,7 +40,7 @@ extern "C" {
*/
struct pw_client {
struct pw_core *core;
SpaList link;
struct spa_list link;
struct pw_global *global;
struct pw_properties *properties;
@ -59,7 +59,7 @@ struct pw_client {
uint32_t n_types;
struct pw_map types;
SpaList resource_list;
struct spa_list resource_list;
PW_SIGNAL (resource_added, (struct pw_listener *listener,
struct pw_client *client,
struct pw_resource *resource));
@ -77,7 +77,7 @@ struct pw_client * pw_client_new (struct pw_core *core,
void pw_client_destroy (struct pw_client *client);
void pw_client_update_properties (struct pw_client *client,
const SpaDict *dict);
const struct spa_dict *dict);
#ifdef __cplusplus
}

View file

@ -28,7 +28,7 @@ extern "C" {
#include <pipewire/server/core.h>
struct pw_command {
SpaList link;
struct spa_list link;
const char *name;
};

View file

@ -34,7 +34,7 @@ struct global_impl {
struct impl {
struct pw_core this;
SpaSupport support[4];
struct spa_support support[4];
};
#define ACCESS_VIEW_GLOBAL(client,global) (client->core->access == NULL || \
@ -88,8 +88,8 @@ destroy_registry_resource (void *object)
}
static void
core_client_update (void *object,
const SpaDict *props)
core_client_update (void *object,
const struct spa_dict *props)
{
struct pw_resource *resource = object;
@ -148,7 +148,7 @@ static void
core_create_node (void *object,
const char *factory_name,
const char *name,
const SpaDict *props,
const struct spa_dict *props,
uint32_t new_id)
{
struct pw_resource *resource = object;
@ -201,7 +201,7 @@ async_create_client_node_complete (struct pw_access_data *data)
struct pw_resource *resource = d->data.resource;
struct pw_client *client = resource->client;
struct pw_client_node *node;
SpaResult res;
int res;
int readfd, writefd;
if (data->res != SPA_RESULT_OK)
@ -248,7 +248,7 @@ done:
static void
core_create_client_node (void *object,
const char *name,
const SpaDict *props,
const struct spa_dict *props,
uint32_t new_id)
{
struct pw_resource *resource = object;
@ -256,7 +256,7 @@ core_create_client_node (void *object,
int i;
struct pw_properties *properties;
struct access_create_client_node access_data;
SpaResult res;
int res;
properties = pw_properties_new (NULL, NULL);
if (properties == NULL)
@ -333,7 +333,7 @@ core_unbind_func (void *data)
spa_list_remove (&resource->link);
}
static SpaResult
static int
core_bind_func (struct pw_global *global,
struct pw_client *client,
uint32_t version,
@ -501,13 +501,13 @@ pw_core_add_global (struct pw_core *core,
return true;
}
SpaResult
int
pw_global_bind (struct pw_global *global,
struct pw_client *client,
uint32_t version,
uint32_t id)
{
SpaResult res;
int res;
struct global_impl *impl = SPA_CONTAINER_OF (global, struct global_impl, this);
if (impl->bind) {
@ -546,7 +546,7 @@ pw_global_destroy (struct pw_global *global)
void
pw_core_update_properties (struct pw_core *core,
const SpaDict *dict)
const struct spa_dict *dict)
{
struct pw_resource *resource;
@ -576,7 +576,7 @@ pw_core_find_port (struct pw_core *core,
uint32_t id,
struct pw_properties *props,
uint32_t n_format_filters,
SpaFormat **format_filters,
struct spa_format **format_filters,
char **error)
{
struct pw_port *best = NULL;
@ -634,18 +634,18 @@ pw_core_find_port (struct pw_core *core,
return best;
}
SpaFormat *
struct spa_format *
pw_core_find_format (struct pw_core *core,
struct pw_port *output,
struct pw_port *input,
struct pw_properties *props,
uint32_t n_format_filters,
SpaFormat **format_filterss,
struct spa_format **format_filterss,
char **error)
{
uint32_t out_state, in_state;
SpaResult res;
SpaFormat *filter = NULL, *format;
int res;
struct spa_format *filter = NULL, *format;
uint32_t iidx = 0, oidx = 0;
out_state = output->state;
@ -663,7 +663,7 @@ pw_core_find_format (struct pw_core *core,
if ((res = spa_node_port_get_format (output->node->node,
SPA_DIRECTION_OUTPUT,
output->port_id,
(const SpaFormat **)&format)) < 0) {
(const struct spa_format **)&format)) < 0) {
asprintf (error, "error get output format: %d", res);
goto error;
}
@ -672,7 +672,7 @@ pw_core_find_format (struct pw_core *core,
if ((res = spa_node_port_get_format (input->node->node,
SPA_DIRECTION_INPUT,
input->port_id,
(const SpaFormat **)&format)) < 0) {
(const struct spa_format **)&format)) < 0) {
asprintf (error, "error get input format: %d", res);
goto error;
}

View file

@ -36,7 +36,7 @@ struct pw_global;
#include <pipewire/server/link.h>
#include <pipewire/server/node-factory.h>
typedef SpaResult (*pw_bind_func_t) (struct pw_global *global,
typedef int (*pw_bind_func_t) (struct pw_global *global,
struct pw_client *client,
uint32_t version,
uint32_t id);
@ -45,7 +45,7 @@ struct pw_global {
struct pw_core *core;
struct pw_client *owner;
SpaList link;
struct spa_list link;
uint32_t id;
uint32_t type;
uint32_t version;
@ -72,18 +72,18 @@ struct pw_core {
struct pw_map objects;
SpaList resource_list;
SpaList registry_resource_list;
SpaList global_list;
SpaList client_list;
SpaList node_list;
SpaList node_factory_list;
SpaList link_list;
struct spa_list resource_list;
struct spa_list registry_resource_list;
struct spa_list global_list;
struct spa_list client_list;
struct spa_list node_list;
struct spa_list node_factory_list;
struct spa_list link_list;
struct pw_main_loop *main_loop;
struct pw_data_loop *data_loop;
SpaSupport *support;
struct spa_support *support;
uint32_t n_support;
PW_SIGNAL (destroy_signal, (struct pw_listener *listener,
@ -101,8 +101,8 @@ struct pw_core * pw_core_new (struct pw_main_loop *main_loop,
struct pw_properties *props);
void pw_core_destroy (struct pw_core *core);
void pw_core_update_properties (struct pw_core *core,
const SpaDict *dict);
void pw_core_update_properties (struct pw_core *core,
const struct spa_dict *dict);
bool pw_core_add_global (struct pw_core *core,
struct pw_client *owner,
@ -112,18 +112,18 @@ bool pw_core_add_global (struct pw_core *core,
pw_bind_func_t bind,
struct pw_global **global);
SpaResult pw_global_bind (struct pw_global *global,
int pw_global_bind (struct pw_global *global,
struct pw_client *client,
uint32_t version,
uint32_t id);
void pw_global_destroy (struct pw_global *global);
SpaFormat * pw_core_find_format (struct pw_core *core,
struct spa_format * pw_core_find_format (struct pw_core *core,
struct pw_port *output,
struct pw_port *input,
struct pw_properties *props,
uint32_t n_format_filters,
SpaFormat **format_filters,
struct spa_format **format_filters,
char **error);
struct pw_port * pw_core_find_port (struct pw_core *core,
@ -131,7 +131,7 @@ struct pw_port * pw_core_find_port (struct pw_core *core,
uint32_t id,
struct pw_properties *props,
uint32_t n_format_filters,
SpaFormat **format_filters,
struct spa_format **format_filters,
char **error);
struct pw_node_factory * pw_core_find_node_factory (struct pw_core *core,

View file

@ -36,7 +36,7 @@ struct impl
{
struct pw_data_loop this;
SpaSource *event;
struct spa_source *event;
bool running;
pthread_t thread;
@ -91,7 +91,7 @@ do_loop (void *user_data)
{
struct impl *impl = user_data;
struct pw_data_loop *this = &impl->this;
SpaResult res;
int res;
make_realtime (this);
@ -110,9 +110,9 @@ do_loop (void *user_data)
static void
do_stop (SpaLoopUtils *utils,
SpaSource *source,
void *data)
do_stop (struct spa_loop_utils *utils,
struct spa_source *source,
void *data)
{
struct impl *impl = data;
impl->running = false;
@ -169,7 +169,7 @@ pw_data_loop_destroy (struct pw_data_loop *loop)
free (impl);
}
SpaResult
int
pw_data_loop_start (struct pw_data_loop *loop)
{
struct impl *impl = SPA_CONTAINER_OF (loop, struct impl, this);
@ -187,7 +187,7 @@ pw_data_loop_start (struct pw_data_loop *loop)
return SPA_RESULT_OK;
}
SpaResult
int
pw_data_loop_stop (struct pw_data_loop *loop)
{
struct impl *impl = SPA_CONTAINER_OF (loop, struct impl, this);

View file

@ -41,8 +41,8 @@ struct pw_data_loop {
struct pw_data_loop * pw_data_loop_new (void);
void pw_data_loop_destroy (struct pw_data_loop *loop);
SpaResult pw_data_loop_start (struct pw_data_loop *loop);
SpaResult pw_data_loop_stop (struct pw_data_loop *loop);
int pw_data_loop_start (struct pw_data_loop *loop);
int pw_data_loop_stop (struct pw_data_loop *loop);
bool pw_data_loop_in_thread (struct pw_data_loop *loop);

View file

@ -40,7 +40,7 @@ struct impl {
struct pw_work_queue *work;
SpaFormat **format_filter;
struct spa_format **format_filter;
struct pw_properties *properties;
struct pw_listener input_port_destroy;
@ -50,7 +50,7 @@ struct impl {
void *buffer_owner;
struct pw_memblock buffer_mem;
SpaBuffer **buffers;
struct spa_buffer **buffers;
uint32_t n_buffers;
};
@ -79,7 +79,7 @@ pw_link_update_state (struct pw_link *link,
static void
complete_ready (void *obj,
void *data,
SpaResult res,
int res,
uint32_t id)
{
struct pw_port *port = data;
@ -94,7 +94,7 @@ complete_ready (void *obj,
static void
complete_paused (void *obj,
void *data,
SpaResult res,
int res,
uint32_t id)
{
struct pw_port *port = data;
@ -109,7 +109,7 @@ complete_paused (void *obj,
static void
complete_streaming (void *obj,
void *data,
SpaResult res,
int res,
uint32_t id)
{
struct pw_port *port = data;
@ -121,12 +121,12 @@ complete_streaming (void *obj,
pw_log_warn ("port %p: failed to go to STREAMING", port);
}
static SpaResult
static int
do_negotiate (struct pw_link *this, uint32_t in_state, uint32_t out_state)
{
struct impl *impl = SPA_CONTAINER_OF (this, struct impl, this);
SpaResult res = SPA_RESULT_ERROR, res2;
SpaFormat *format;
int res = SPA_RESULT_ERROR, res2;
struct spa_format *format;
char *error = NULL;
if (in_state != PW_PORT_STATE_CONFIGURE && out_state != PW_PORT_STATE_CONFIGURE)
@ -191,25 +191,25 @@ error:
}
}
static SpaParam *
find_param (SpaParam **params, int n_params, uint32_t type)
static struct spa_param *
find_param (struct spa_param **params, int n_params, uint32_t type)
{
uint32_t i;
for (i = 0; i < n_params; i++) {
if (spa_pod_is_object_type (&params[i]->pod, type))
if (spa_pod_is_object_type (&params[i]->object.pod, type))
return params[i];
}
return NULL;
}
static SpaParam *
find_meta_enable (struct pw_core *core, SpaParam **params, int n_params, uint32_t type)
static struct spa_param *
find_meta_enable (struct pw_core *core, struct spa_param **params, int n_params, uint32_t type)
{
uint32_t i;
for (i = 0; i < n_params; i++) {
if (spa_pod_is_object_type (&params[i]->pod, core->type.param_alloc_meta_enable.MetaEnable)) {
if (spa_pod_is_object_type (&params[i]->object.pod, core->type.param_alloc_meta_enable.MetaEnable)) {
uint32_t qtype;
if (spa_param_query (params[i],
@ -223,41 +223,41 @@ find_meta_enable (struct pw_core *core, SpaParam **params, int n_params, uint32_
return NULL;
}
static SpaBuffer **
static struct spa_buffer **
alloc_buffers (struct pw_link *this,
uint32_t n_buffers,
uint32_t n_params,
SpaParam **params,
struct spa_param **params,
uint32_t n_datas,
size_t *data_sizes,
ssize_t *data_strides,
struct pw_memblock *mem)
{
SpaBuffer **buffers, *bp;
struct spa_buffer **buffers, *bp;
uint32_t i;
size_t skel_size, data_size, meta_size;
SpaChunk *cdp;
struct spa_chunk *cdp;
void *ddp;
uint32_t n_metas;
SpaMeta *metas;
struct spa_meta *metas;
n_metas = data_size = meta_size = 0;
/* each buffer */
skel_size = sizeof (SpaBuffer);
skel_size = sizeof (struct spa_buffer);
metas = alloca (sizeof (SpaMeta) * n_params + 1);
metas = alloca (sizeof (struct spa_meta) * n_params + 1);
/* add shared metadata */
metas[n_metas].type = this->core->type.meta.Shared;
metas[n_metas].size = sizeof (SpaMetaShared);
metas[n_metas].size = sizeof (struct spa_meta_shared);
meta_size += metas[n_metas].size;
n_metas++;
skel_size += sizeof (SpaMeta);
skel_size += sizeof (struct spa_meta);
/* collect metadata */
for (i = 0; i < n_params; i++) {
if (spa_pod_is_object_type (&params[i]->pod, this->core->type.param_alloc_meta_enable.MetaEnable)) {
if (spa_pod_is_object_type (&params[i]->object.pod, this->core->type.param_alloc_meta_enable.MetaEnable)) {
uint32_t type, size;
if (spa_param_query (params[i],
@ -272,21 +272,21 @@ alloc_buffers (struct pw_link *this,
metas[n_metas].size = size;
meta_size += metas[n_metas].size;
n_metas++;
skel_size += sizeof (SpaMeta);
skel_size += sizeof (struct spa_meta);
}
}
data_size += meta_size;
/* data */
for (i = 0; i < n_datas; i++) {
data_size += sizeof (SpaChunk);
data_size += sizeof (struct spa_chunk);
data_size += data_sizes[i];
skel_size += sizeof (SpaData);
skel_size += sizeof (struct spa_data);
}
buffers = calloc (n_buffers, skel_size + sizeof (SpaBuffer *));
buffers = calloc (n_buffers, skel_size + sizeof (struct spa_buffer *));
/* pointer to buffer structures */
bp = SPA_MEMBER (buffers, n_buffers * sizeof (SpaBuffer *), SpaBuffer);
bp = SPA_MEMBER (buffers, n_buffers * sizeof (struct spa_buffer *), struct spa_buffer);
pw_memblock_alloc (PW_MEMBLOCK_FLAG_WITH_FD |
PW_MEMBLOCK_FLAG_MAP_READWRITE |
@ -296,25 +296,25 @@ alloc_buffers (struct pw_link *this,
for (i = 0; i < n_buffers; i++) {
int j;
SpaBuffer *b;
struct spa_buffer *b;
void *p;
buffers[i] = b = SPA_MEMBER (bp, skel_size * i, SpaBuffer);
buffers[i] = b = SPA_MEMBER (bp, skel_size * i, struct spa_buffer);
p = SPA_MEMBER (mem->ptr, data_size * i, void);
b->id = i;
b->n_metas = n_metas;
b->metas = SPA_MEMBER (b, sizeof (SpaBuffer), SpaMeta);
b->metas = SPA_MEMBER (b, sizeof (struct spa_buffer), struct spa_meta);
for (j = 0; j < n_metas; j++) {
SpaMeta *m = &b->metas[j];
struct spa_meta *m = &b->metas[j];
m->type = metas[j].type;
m->data = p;
m->size = metas[j].size;
if (m->type == this->core->type.meta.Shared) {
SpaMetaShared *msh = p;
struct spa_meta_shared *msh = p;
msh->flags = 0;
msh->fd = mem->fd;
@ -322,20 +322,20 @@ alloc_buffers (struct pw_link *this,
msh->size = data_size;
}
else if (m->type == this->core->type.meta.Ringbuffer) {
SpaMetaRingbuffer *rb = p;
struct spa_meta_ringbuffer *rb = p;
spa_ringbuffer_init (&rb->ringbuffer, data_sizes[0]);
}
p += m->size;
}
/* pointer to data structure */
b->n_datas = n_datas;
b->datas = SPA_MEMBER (b->metas, n_metas * sizeof (SpaMeta), SpaData);
b->datas = SPA_MEMBER (b->metas, n_metas * sizeof (struct spa_meta), struct spa_data);
cdp = p;
ddp = SPA_MEMBER (cdp, sizeof (SpaChunk) * n_datas, void);
ddp = SPA_MEMBER (cdp, sizeof (struct spa_chunk) * n_datas, void);
for (j = 0; j < n_datas; j++) {
SpaData *d = &b->datas[j];
struct spa_data *d = &b->datas[j];
d->chunk = &cdp[j];
if (data_sizes[j] > 0) {
@ -360,14 +360,14 @@ alloc_buffers (struct pw_link *this,
static int
spa_node_param_filter (struct pw_link *this,
SpaNode *in_node,
struct spa_node *in_node,
uint32_t in_port,
SpaNode *out_node,
struct spa_node *out_node,
uint32_t out_port,
SpaPODBuilder *result)
struct spa_pod_builder *result)
{
SpaResult res;
SpaParam *oparam, *iparam;
int res;
struct spa_param *oparam, *iparam;
int iidx, oidx, num = 0;
for (iidx = 0; ; iidx++) {
@ -378,7 +378,7 @@ spa_node_param_filter (struct pw_link *this,
spa_debug_param (iparam, this->core->type.map);
for (oidx = 0; ; oidx++) {
SpaPODFrame f;
struct spa_pod_frame f;
uint32_t offset;
if (spa_node_port_enum_params (out_node, SPA_DIRECTION_OUTPUT, out_port, oidx, &oparam) < 0)
@ -387,16 +387,16 @@ spa_node_param_filter (struct pw_link *this,
if (pw_log_level_enabled (SPA_LOG_LEVEL_DEBUG))
spa_debug_param (oparam, this->core->type.map);
if (iparam->body.body.type != oparam->body.body.type)
if (iparam->object.body.type != oparam->object.body.type)
continue;
offset = result->offset;
spa_pod_builder_push_object (result, &f, 0, iparam->body.body.type);
spa_pod_builder_push_object (result, &f, 0, iparam->object.body.type);
if ((res = spa_props_filter (result,
SPA_POD_CONTENTS (SpaParam, iparam),
SPA_POD_CONTENTS_SIZE (SpaParam, iparam),
SPA_POD_CONTENTS (SpaParam, oparam),
SPA_POD_CONTENTS_SIZE (SpaParam, oparam))) < 0) {
SPA_POD_CONTENTS (struct spa_param, iparam),
SPA_POD_CONTENTS_SIZE (struct spa_param, iparam),
SPA_POD_CONTENTS (struct spa_param, oparam),
SPA_POD_CONTENTS_SIZE (struct spa_param, oparam))) < 0) {
result->offset = offset;
result->stack = NULL;
continue;
@ -408,12 +408,12 @@ spa_node_param_filter (struct pw_link *this,
return num;
}
static SpaResult
static int
do_allocation (struct pw_link *this, uint32_t in_state, uint32_t out_state)
{
struct impl *impl = SPA_CONTAINER_OF (this, struct impl, this);
SpaResult res;
const SpaPortInfo *iinfo, *oinfo;
int res;
const struct spa_port_info *iinfo, *oinfo;
uint32_t in_flags, out_flags;
char *error = NULL;
@ -487,9 +487,9 @@ do_allocation (struct pw_link *this, uint32_t in_state, uint32_t out_state)
}
if (impl->buffers == NULL) {
SpaParam **params, *param;
struct spa_param **params, *param;
uint8_t buffer[4096];
SpaPODBuilder b = SPA_POD_BUILDER_INIT (buffer, sizeof (buffer));
struct spa_pod_builder b = SPA_POD_BUILDER_INIT (buffer, sizeof (buffer));
int i, offset, n_params;
uint32_t max_buffers;
size_t minsize = 1024, stride = 0;
@ -501,9 +501,9 @@ do_allocation (struct pw_link *this, uint32_t in_state, uint32_t out_state)
this->output->port_id,
&b);
params = alloca (n_params * sizeof (SpaParam *));
params = alloca (n_params * sizeof (struct spa_param *));
for (i = 0, offset = 0; i < n_params; i++) {
params[i] = SPA_MEMBER (buffer, offset, SpaParam);
params[i] = SPA_MEMBER (buffer, offset, struct spa_param);
spa_param_fixate (params[i]);
spa_debug_param (params[i], this->core->type.map);
offset += SPA_ROUND_UP_N (SPA_POD_SIZE (params[i]), 8);
@ -666,10 +666,10 @@ error:
}
}
static SpaResult
static int
do_start (struct pw_link *this, uint32_t in_state, uint32_t out_state)
{
SpaResult res = SPA_RESULT_OK;
int res = SPA_RESULT_OK;
struct impl *impl = SPA_CONTAINER_OF (this, struct impl, this);
if (in_state < PW_PORT_STATE_PAUSED || out_state < PW_PORT_STATE_PAUSED)
@ -691,10 +691,10 @@ do_start (struct pw_link *this, uint32_t in_state, uint32_t out_state)
return res;
}
static SpaResult
static int
check_states (struct pw_link *this,
void *user_data,
SpaResult res)
int res)
{
struct impl *impl = SPA_CONTAINER_OF (this, struct impl, this);
uint32_t in_state, out_state;
@ -745,7 +745,7 @@ static void
on_input_async_complete_notify (struct pw_listener *listener,
struct pw_node *node,
uint32_t seq,
SpaResult res)
int res)
{
struct impl *impl = SPA_CONTAINER_OF (listener, struct impl, input_async_complete);
@ -757,7 +757,7 @@ static void
on_output_async_complete_notify (struct pw_listener *listener,
struct pw_node *node,
uint32_t seq,
SpaResult res)
int res)
{
struct impl *impl = SPA_CONTAINER_OF (listener, struct impl, output_async_complete);
@ -868,7 +868,7 @@ link_unbind_func (void *data)
pw_link_free (this);
}
static SpaResult
static int
link_bind_func (struct pw_global *global,
struct pw_client *client,
uint32_t version,
@ -917,7 +917,7 @@ struct pw_link *
pw_link_new (struct pw_core *core,
struct pw_port *output,
struct pw_port *input,
SpaFormat **format_filter,
struct spa_format **format_filter,
struct pw_properties *properties)
{
struct impl *impl;
@ -998,13 +998,13 @@ clear_port_buffers (struct pw_link *link, struct pw_port *port)
}
}
static SpaResult
do_link_remove_done (SpaLoop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
static int
do_link_remove_done (struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
{
struct pw_link *this = user_data;
struct impl *impl = SPA_CONTAINER_OF (this, struct impl, this);
@ -1041,15 +1041,15 @@ do_link_remove_done (SpaLoop *loop,
return SPA_RESULT_OK;
}
static SpaResult
do_link_remove (SpaLoop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
static int
do_link_remove (struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
{
SpaResult res;
int res;
struct pw_link *this = user_data;
if (this->rt.input) {

View file

@ -39,7 +39,7 @@ extern "C" {
*/
struct pw_link {
struct pw_core *core;
SpaList link;
struct spa_list link;
struct pw_global *global;
struct pw_properties *properties;
@ -56,22 +56,22 @@ struct pw_link {
PW_SIGNAL (free_signal, (struct pw_listener *,
struct pw_link *));
SpaList resource_list;
struct spa_list resource_list;
struct pw_port *output;
SpaList output_link;
struct pw_port *input;
SpaList input_link;
struct pw_port *output;
struct spa_list output_link;
struct pw_port *input;
struct spa_list input_link;
PW_SIGNAL (port_unlinked, (struct pw_listener *listener,
struct pw_link *link,
struct pw_port *port));
struct {
uint32_t in_ready;
struct pw_port *input;
struct pw_port *output;
SpaList input_link;
SpaList output_link;
uint32_t in_ready;
struct pw_port *input;
struct pw_port *output;
struct spa_list input_link;
struct spa_list output_link;
} rt;
};
@ -79,7 +79,7 @@ struct pw_link {
struct pw_link * pw_link_new (struct pw_core *core,
struct pw_port *output,
struct pw_port *input,
SpaFormat **format_filter,
struct spa_format **format_filter,
struct pw_properties *properties);
void pw_link_destroy (struct pw_link *link);

View file

@ -89,7 +89,7 @@ find_module (const char * path, const char *name)
return filename;
}
static SpaResult
static int
module_bind_func (struct pw_global *global,
struct pw_client *client,
uint32_t version,

View file

@ -29,7 +29,7 @@ extern "C" {
struct pw_module {
struct pw_core *core;
SpaList link;
struct spa_list link;
struct pw_global *global;
struct pw_module_info info;

View file

@ -37,7 +37,7 @@ extern "C" {
*/
struct pw_node_factory {
struct pw_core *core;
SpaList link;
struct spa_list link;
struct pw_global *global;
const char *name;

View file

@ -46,8 +46,8 @@ update_port_ids (struct pw_node *node)
uint32_t *input_port_ids, *output_port_ids;
uint32_t n_input_ports, n_output_ports, max_input_ports, max_output_ports;
uint32_t i;
SpaList *ports;
SpaResult res;
struct spa_list *ports;
int res;
if (node->node == NULL)
return;
@ -158,10 +158,10 @@ update_port_ids (struct pw_node *node)
pw_signal_emit (&node->initialized, node);
}
static SpaResult
static int
pause_node (struct pw_node *this)
{
SpaResult res;
int res;
if (this->state <= PW_NODE_STATE_IDLE)
return SPA_RESULT_OK;
@ -175,10 +175,10 @@ pause_node (struct pw_node *this)
return res;
}
static SpaResult
static int
start_node (struct pw_node *this)
{
SpaResult res;
int res;
pw_log_debug ("node %p: start node", this);
@ -189,10 +189,10 @@ start_node (struct pw_node *this)
return res;
}
static SpaResult
static int
suspend_node (struct pw_node *this)
{
SpaResult res = SPA_RESULT_OK;
int res = SPA_RESULT_OK;
struct pw_port *p;
pw_log_debug ("node %p: suspend node", this);
@ -224,8 +224,8 @@ suspend_node (struct pw_node *this)
static void
send_clock_update (struct pw_node *this)
{
SpaResult res;
SpaCommandNodeClockUpdate cu =
int res;
struct spa_command_node_clock_update cu =
SPA_COMMAND_NODE_CLOCK_UPDATE_INIT(
this->core->type.command_node.ClockUpdate,
SPA_COMMAND_NODE_CLOCK_UPDATE_TIME |
@ -249,22 +249,22 @@ send_clock_update (struct pw_node *this)
&cu.body.monotonic_time.value);
}
if ((res = spa_node_send_command (this->node, (SpaCommand *)&cu)) < 0)
if ((res = spa_node_send_command (this->node, (struct spa_command *)&cu)) < 0)
pw_log_debug ("got error %d", res);
}
static SpaResult
static int
do_pull (struct pw_node *this)
{
SpaResult res = SPA_RESULT_OK;
int res = SPA_RESULT_OK;
struct pw_port *inport;
bool have_output = false;
spa_list_for_each (inport, &this->input_ports, link) {
struct pw_link *link;
struct pw_port *outport;
SpaPortIO *pi;
SpaPortIO *po;
struct spa_port_io *pi;
struct spa_port_io *po;
pi = &inport->io;
pw_log_trace ("node %p: need input port %d, %d %d", this,
@ -311,13 +311,13 @@ do_pull (struct pw_node *this)
}
static void
on_node_event (SpaNode *node, SpaEvent *event, void *user_data)
on_node_event (struct spa_node *node, struct spa_event *event, void *user_data)
{
struct pw_node *this = user_data;
struct impl *impl = SPA_CONTAINER_OF (this, struct impl, this);
if (SPA_EVENT_TYPE (event) == this->core->type.event_node.AsyncComplete) {
SpaEventNodeAsyncComplete *ac = (SpaEventNodeAsyncComplete *) event;
struct spa_event_node_async_complete *ac = (struct spa_event_node_async_complete *) event;
pw_log_debug ("node %p: async complete event %d %d", this, ac->body.seq.value, ac->body.res.value);
pw_work_queue_complete (impl->work, this, ac->body.seq.value, ac->body.res.value);
@ -329,7 +329,7 @@ on_node_event (SpaNode *node, SpaEvent *event, void *user_data)
}
static void
on_node_need_input (SpaNode *node, void *user_data)
on_node_need_input (struct spa_node *node, void *user_data)
{
struct pw_node *this = user_data;
@ -337,15 +337,15 @@ on_node_need_input (SpaNode *node, void *user_data)
}
static void
on_node_have_output (SpaNode *node, void *user_data)
on_node_have_output (struct spa_node *node, void *user_data)
{
struct pw_node *this = user_data;
SpaResult res;
int res;
struct pw_port *outport;
spa_list_for_each (outport, &this->output_ports, link) {
struct pw_link *link;
SpaPortIO *po;
struct spa_port_io *po;
po = &outport->io;
if (po->buffer_id == SPA_ID_INVALID)
@ -374,7 +374,7 @@ on_node_have_output (SpaNode *node, void *user_data)
}
static void
on_node_reuse_buffer (SpaNode *node, uint32_t port_id, uint32_t buffer_id, void *user_data)
on_node_reuse_buffer (struct spa_node *node, uint32_t port_id, uint32_t buffer_id, void *user_data)
{
struct pw_node *this = user_data;
struct pw_port *inport;
@ -402,7 +402,7 @@ node_unbind_func (void *data)
spa_list_remove (&resource->link);
}
static SpaResult
static int
node_bind_func (struct pw_global *global,
struct pw_client *client,
uint32_t version,
@ -432,7 +432,7 @@ node_bind_func (struct pw_global *global,
info.n_inputs = this->n_input_ports;
info.input_formats = NULL;
for (info.n_input_formats = 0; ; info.n_input_formats++) {
SpaFormat *fmt;
struct spa_format *fmt;
if (spa_node_port_enum_formats (this->node,
SPA_DIRECTION_INPUT,
@ -442,14 +442,14 @@ node_bind_func (struct pw_global *global,
info.n_input_formats) < 0)
break;
info.input_formats = realloc (info.input_formats, sizeof (SpaFormat*) * (info.n_input_formats + 1));
info.input_formats = realloc (info.input_formats, sizeof (struct spa_format*) * (info.n_input_formats + 1));
info.input_formats[info.n_input_formats] = spa_format_copy (fmt);
}
info.max_outputs = this->max_output_ports;
info.n_outputs = this->n_output_ports;
info.output_formats = NULL;
for (info.n_output_formats = 0; ; info.n_output_formats++) {
SpaFormat *fmt;
struct spa_format *fmt;
if (spa_node_port_enum_formats (this->node,
SPA_DIRECTION_OUTPUT,
@ -459,7 +459,7 @@ node_bind_func (struct pw_global *global,
info.n_output_formats) < 0)
break;
info.output_formats = realloc (info.output_formats, sizeof (SpaFormat*) * (info.n_output_formats + 1));
info.output_formats = realloc (info.output_formats, sizeof (struct spa_format*) * (info.n_output_formats + 1));
info.output_formats[info.n_output_formats] = spa_format_copy (fmt);
}
info.state = this->state;
@ -520,7 +520,7 @@ pw_node_set_data_loop (struct pw_node *node,
pw_signal_emit (&node->loop_changed, node);
}
static const SpaNodeCallbacks node_callbacks = {
static const struct spa_node_callbacks node_callbacks = {
&on_node_event,
&on_node_need_input,
&on_node_have_output,
@ -532,8 +532,8 @@ pw_node_new (struct pw_core *core,
struct pw_client *owner,
const char *name,
bool async,
SpaNode *node,
SpaClock *clock,
struct spa_node *node,
struct spa_clock *clock,
struct pw_properties *properties)
{
struct impl *impl;
@ -611,13 +611,13 @@ no_mem:
return NULL;
}
static SpaResult
do_node_remove_done (SpaLoop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
static int
do_node_remove_done (struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
{
struct pw_node *this = user_data;
struct impl *impl = SPA_CONTAINER_OF (this, struct impl, this);
@ -649,17 +649,17 @@ do_node_remove_done (SpaLoop *loop,
return SPA_RESULT_OK;
}
static SpaResult
do_node_remove (SpaLoop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
static int
do_node_remove (struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
{
struct pw_node *this = user_data;
struct pw_port *port, *tmp;
SpaResult res;
int res;
pause_node (this);
@ -736,9 +736,9 @@ pw_node_get_free_port (struct pw_node *node,
enum pw_direction direction)
{
uint32_t *n_ports, max_ports;
SpaList *ports;
struct spa_list *ports;
struct pw_port *port = NULL, *p, **portmap;
SpaResult res;
int res;
int i;
if (direction == PW_DIRECTION_INPUT) {
@ -793,7 +793,7 @@ pw_node_get_free_port (struct pw_node *node,
static void
on_state_complete (struct pw_node *node,
void *data,
SpaResult res)
int res)
{
enum pw_node_state state = SPA_PTR_TO_INT (data);
char *error = NULL;
@ -829,13 +829,13 @@ node_activate (struct pw_node *this)
*
* Set the state of @node to @state.
*
* Returns: a #SpaResult
* Returns: a #int
*/
SpaResult
int
pw_node_set_state (struct pw_node *node,
enum pw_node_state state)
{
SpaResult res = SPA_RESULT_OK;
int res = SPA_RESULT_OK;
struct impl *impl = SPA_CONTAINER_OF (node, struct impl, this);
pw_signal_emit (&node->state_request, node, state);

View file

@ -46,7 +46,7 @@ extern "C" {
*/
struct pw_node {
struct pw_core *core;
SpaList link;
struct spa_list link;
struct pw_global *global;
struct pw_client *owner;
@ -62,25 +62,25 @@ struct pw_node {
enum pw_node_state old,
enum pw_node_state state));
SpaHandle *handle;
SpaNode *node;
struct spa_handle *handle;
struct spa_node *node;
bool live;
SpaClock *clock;
struct spa_clock *clock;
SpaList resource_list;
struct spa_list resource_list;
PW_SIGNAL (initialized, (struct pw_listener *listener,
struct pw_node *object));
uint32_t max_input_ports;
uint32_t n_input_ports;
SpaList input_ports;
struct spa_list input_ports;
struct pw_port **input_port_map;
uint32_t n_used_input_links;
uint32_t max_output_ports;
uint32_t n_output_ports;
SpaList output_ports;
struct spa_list output_ports;
struct pw_port **output_port_map;
uint32_t n_used_output_links;
@ -99,7 +99,7 @@ struct pw_node {
PW_SIGNAL (async_complete, (struct pw_listener *listener,
struct pw_node *node,
uint32_t seq,
SpaResult res));
int res));
struct pw_data_loop *data_loop;
PW_SIGNAL (loop_changed, (struct pw_listener *listener,
@ -110,8 +110,8 @@ struct pw_node * pw_node_new (struct pw_core *core,
struct pw_client *owner,
const char *name,
bool async,
SpaNode *node,
SpaClock *clock,
struct spa_node *node,
struct spa_clock *clock,
struct pw_properties *properties);
void pw_node_destroy (struct pw_node *node);
@ -122,7 +122,7 @@ void pw_node_set_data_loop (struct pw_node *node,
struct pw_port * pw_node_get_free_port (struct pw_node *node,
enum pw_direction direction);
SpaResult pw_node_set_state (struct pw_node *node,
int pw_node_set_state (struct pw_node *node,
enum pw_node_state state);
void pw_node_update_state (struct pw_node *node,
enum pw_node_state state,

View file

@ -71,8 +71,8 @@ pw_port_destroy (struct pw_port *port)
free (port);
}
static SpaResult
do_add_link (SpaLoop *loop,
static int
do_add_link (struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
@ -130,7 +130,7 @@ pw_port_get_link (struct pw_port *output_port,
struct pw_link *
pw_port_link (struct pw_port *output_port,
struct pw_port *input_port,
SpaFormat **format_filter,
struct spa_format **format_filter,
struct pw_properties *properties,
char **error)
{
@ -199,10 +199,10 @@ no_mem:
return NULL;
}
SpaResult
int
pw_port_pause_rt (struct pw_port *port)
{
SpaResult res;
int res;
if (port->state <= PW_PORT_STATE_PAUSED)
return SPA_RESULT_OK;
@ -216,13 +216,13 @@ pw_port_pause_rt (struct pw_port *port)
return res;
}
static SpaResult
do_remove_link_done (SpaLoop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
static int
do_remove_link_done (struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
{
struct pw_port *port = user_data;
struct pw_node *node = port->node;
@ -263,18 +263,18 @@ do_remove_link_done (SpaLoop *loop,
return SPA_RESULT_OK;
}
static SpaResult
do_remove_link (SpaLoop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
static int
do_remove_link (struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
{
struct pw_port *port = user_data;
struct pw_node *this = port->node;
struct pw_link *link = ((struct pw_link**)data)[0];
SpaResult res;
int res;
if (port->direction == PW_DIRECTION_INPUT) {
pw_port_pause_rt (link->rt.input);
@ -295,10 +295,10 @@ do_remove_link (SpaLoop *loop,
return res;
}
SpaResult
int
pw_port_unlink (struct pw_port *port, struct pw_link *link)
{
SpaResult res;
int res;
struct impl *impl = SPA_CONTAINER_OF (port, struct impl, this);
pw_log_debug ("port %p: start unlink %p", port, link);
@ -312,16 +312,16 @@ pw_port_unlink (struct pw_port *port, struct pw_link *link)
return res;
}
static SpaResult
do_clear_buffers_done (SpaLoop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
static int
do_clear_buffers_done (struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
{
struct pw_port *port = user_data;
SpaResult res;
int res;
if (port->state <= PW_PORT_STATE_READY)
return SPA_RESULT_OK;
@ -339,17 +339,17 @@ do_clear_buffers_done (SpaLoop *loop,
return res;
}
static SpaResult
do_clear_buffers (SpaLoop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
static int
do_clear_buffers (struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data)
{
struct pw_port *port = user_data;
struct pw_node *node = port->node;
SpaResult res;
int res;
pw_port_pause_rt (port);
@ -361,10 +361,10 @@ do_clear_buffers (SpaLoop *loop,
return res;
}
SpaResult
int
pw_port_clear_buffers (struct pw_port *port)
{
SpaResult res;
int res;
struct impl *impl = SPA_CONTAINER_OF (port, struct impl, this);
pw_log_debug ("port %p: clear buffers", port);

View file

@ -45,7 +45,7 @@ enum pw_port_state {
};
struct pw_port {
SpaList link;
struct spa_list link;
PW_SIGNAL (destroy_signal, (struct pw_listener *listener, struct pw_port *));
@ -53,17 +53,17 @@ struct pw_port {
enum pw_direction direction;
uint32_t port_id;
enum pw_port_state state;
SpaPortIO io;
struct spa_port_io io;
bool allocated;
struct pw_memblock buffer_mem;
SpaBuffer **buffers;
struct spa_buffer **buffers;
uint32_t n_buffers;
SpaList links;
struct spa_list links;
struct {
SpaList links;
struct spa_list links;
} rt;
};
@ -75,14 +75,14 @@ void pw_port_destroy (struct pw_port *port
struct pw_link * pw_port_link (struct pw_port *output_port,
struct pw_port *input_port,
SpaFormat **format_filter,
struct spa_format **format_filter,
struct pw_properties *properties,
char **error);
SpaResult pw_port_unlink (struct pw_port *port,
int pw_port_unlink (struct pw_port *port,
struct pw_link *link);
SpaResult pw_port_pause_rt (struct pw_port *port);
SpaResult pw_port_clear_buffers (struct pw_port *port);
int pw_port_pause_rt (struct pw_port *port);
int pw_port_clear_buffers (struct pw_port *port);
#ifdef __cplusplus

View file

@ -27,12 +27,12 @@
typedef bool (*demarshal_func_t) (void *object, void *data, size_t size);
struct builder {
SpaPODBuilder b;
struct spa_pod_builder b;
struct pw_connection *connection;
};
static uint32_t
write_pod (SpaPODBuilder *b, uint32_t ref, const void *data, uint32_t size)
write_pod (struct spa_pod_builder *b, uint32_t ref, const void *data, uint32_t size)
{
if (ref == -1)
ref = b->offset;
@ -75,7 +75,7 @@ core_marshal_info (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
uint32_t i, n_items;
core_update_map (resource->client);
@ -111,7 +111,7 @@ core_marshal_done (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -124,14 +124,14 @@ core_marshal_done (void *object,
static void
core_marshal_error (void *object,
uint32_t id,
SpaResult res,
int res,
const char *error, ...)
{
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
char buffer[128];
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
va_list ap;
core_update_map (resource->client);
@ -155,7 +155,7 @@ core_marshal_remove_id (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -174,7 +174,7 @@ core_marshal_update_types (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
uint32_t i;
spa_pod_builder_add (&b.b,
@ -198,8 +198,8 @@ core_demarshal_client_update (void *object,
size_t size)
{
struct pw_resource *resource = object;
SpaDict props;
SpaPODIter it;
struct spa_dict props;
struct spa_pod_iter it;
uint32_t i;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -208,7 +208,7 @@ core_demarshal_client_update (void *object,
0))
return false;
props.items = alloca (props.n_items * sizeof (SpaDictItem));
props.items = alloca (props.n_items * sizeof (struct spa_dict_item));
for (i = 0; i < props.n_items; i++) {
if (!spa_pod_iter_get (&it,
SPA_POD_TYPE_STRING, &props.items[i].key,
@ -226,7 +226,7 @@ core_demarshal_sync (void *object,
size_t size)
{
struct pw_resource *resource = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t seq;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -245,7 +245,7 @@ core_demarshal_get_registry (void *object,
size_t size)
{
struct pw_resource *resource = object;
SpaPODIter it;
struct spa_pod_iter it;
int32_t new_id;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -264,10 +264,10 @@ core_demarshal_create_node (void *object,
size_t size)
{
struct pw_resource *resource = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t new_id, i;
const char *factory_name, *name;
SpaDict props;
struct spa_dict props;
if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_iter_get (&it,
@ -277,7 +277,7 @@ core_demarshal_create_node (void *object,
0))
return false;
props.items = alloca (props.n_items * sizeof (SpaDictItem));
props.items = alloca (props.n_items * sizeof (struct spa_dict_item));
for (i = 0; i < props.n_items; i++) {
if (!spa_pod_iter_get (&it,
SPA_POD_TYPE_STRING, &props.items[i].key,
@ -302,10 +302,10 @@ core_demarshal_create_client_node (void *object,
size_t size)
{
struct pw_resource *resource = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t new_id, i;
const char *name;
SpaDict props;
struct spa_dict props;
if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_iter_get (&it,
@ -314,7 +314,7 @@ core_demarshal_create_client_node (void *object,
0))
return false;
props.items = alloca (props.n_items * sizeof (SpaDictItem));
props.items = alloca (props.n_items * sizeof (struct spa_dict_item));
for (i = 0; i < props.n_items; i++) {
if (!spa_pod_iter_get (&it,
SPA_POD_TYPE_STRING, &props.items[i].key,
@ -338,7 +338,7 @@ core_demarshal_update_types (void *object,
size_t size)
{
struct pw_resource *resource = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t first_id, n_types;
const char **types;
int i;
@ -367,7 +367,7 @@ registry_marshal_global (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -385,7 +385,7 @@ registry_marshal_global_remove (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -401,7 +401,7 @@ registry_demarshal_bind (void *object,
size_t size)
{
struct pw_resource *resource = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t id, new_id;
if (!spa_pod_iter_struct (&it, data, size) ||
@ -422,7 +422,7 @@ module_marshal_info (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
uint32_t i, n_items;
core_update_map (resource->client);
@ -456,7 +456,7 @@ node_marshal_info (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
uint32_t i, n_items;
core_update_map (resource->client);
@ -505,7 +505,7 @@ client_marshal_info (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
uint32_t i, n_items;
core_update_map (resource->client);
@ -536,7 +536,7 @@ client_node_marshal_done (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -549,12 +549,12 @@ client_node_marshal_done (void *object,
static void
client_node_marshal_event (void *object,
const SpaEvent *event)
const struct spa_event *event)
{
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -567,13 +567,13 @@ client_node_marshal_event (void *object,
static void
client_node_marshal_add_port (void *object,
uint32_t seq,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id)
{
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -588,13 +588,13 @@ client_node_marshal_add_port (void *object,
static void
client_node_marshal_remove_port (void *object,
uint32_t seq,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id)
{
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -609,15 +609,15 @@ client_node_marshal_remove_port (void *object,
static void
client_node_marshal_set_format (void *object,
uint32_t seq,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
uint32_t flags,
const SpaFormat *format)
const struct spa_format *format)
{
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -641,7 +641,7 @@ client_node_marshal_set_property (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -655,7 +655,7 @@ client_node_marshal_set_property (void *object,
static void
client_node_marshal_add_mem (void *object,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
uint32_t mem_id,
uint32_t type,
@ -667,7 +667,7 @@ client_node_marshal_add_mem (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -687,7 +687,7 @@ client_node_marshal_add_mem (void *object,
static void
client_node_marshal_use_buffers (void *object,
uint32_t seq,
SpaDirection direction,
enum spa_direction direction,
uint32_t port_id,
uint32_t n_buffers,
struct pw_client_node_buffer *buffers)
@ -695,7 +695,7 @@ client_node_marshal_use_buffers (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
uint32_t i, j;
core_update_map (resource->client);
@ -708,7 +708,7 @@ client_node_marshal_use_buffers (void *object,
SPA_POD_TYPE_INT, n_buffers, 0);
for (i = 0; i < n_buffers; i++) {
SpaBuffer *buf = buffers[i].buffer;
struct spa_buffer *buf = buffers[i].buffer;
spa_pod_builder_add (&b.b,
SPA_POD_TYPE_INT, buffers[i].mem_id,
@ -718,14 +718,14 @@ client_node_marshal_use_buffers (void *object,
SPA_POD_TYPE_INT, buf->n_metas, 0);
for (j = 0; j < buf->n_metas; j++) {
SpaMeta *m = &buf->metas[j];
struct spa_meta *m = &buf->metas[j];
spa_pod_builder_add (&b.b,
SPA_POD_TYPE_ID, m->type,
SPA_POD_TYPE_INT, m->size, 0);
}
spa_pod_builder_add (&b.b, SPA_POD_TYPE_INT, buf->n_datas, 0);
for (j = 0; j < buf->n_datas; j++) {
SpaData *d = &buf->datas[j];
struct spa_data *d = &buf->datas[j];
spa_pod_builder_add (&b.b,
SPA_POD_TYPE_ID, d->type,
SPA_POD_TYPE_INT, SPA_PTR_TO_UINT32 (d->data),
@ -742,12 +742,12 @@ client_node_marshal_use_buffers (void *object,
static void
client_node_marshal_node_command (void *object,
uint32_t seq,
const SpaCommand *command)
const struct spa_command *command)
{
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -761,12 +761,12 @@ client_node_marshal_node_command (void *object,
static void
client_node_marshal_port_command (void *object,
uint32_t port_id,
const SpaCommand *command)
const struct spa_command *command)
{
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -786,7 +786,7 @@ client_node_marshal_transport (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);
@ -804,9 +804,9 @@ client_node_demarshal_update (void *object,
size_t size)
{
struct pw_resource *resource = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t change_mask, max_input_ports, max_output_ports;
const SpaProps *props;
const struct spa_props *props;
if (!spa_pod_iter_struct (&it, data, size) ||
!pw_pod_remap_data (SPA_POD_TYPE_STRUCT, data, size, &resource->client->types) ||
@ -828,12 +828,12 @@ client_node_demarshal_port_update (void *object,
size_t size)
{
struct pw_resource *resource = object;
SpaPODIter it;
struct spa_pod_iter it;
uint32_t i, direction, port_id, change_mask, n_possible_formats, n_params;
const SpaParam **params = NULL;
const SpaFormat **possible_formats = NULL, *format = NULL;
SpaPortInfo info, *infop = NULL;
SpaPOD *ipod;
const struct spa_param **params = NULL;
const struct spa_format **possible_formats = NULL, *format = NULL;
struct spa_port_info info, *infop = NULL;
struct spa_pod *ipod;
if (!spa_pod_iter_struct (&it, data, size) ||
!pw_pod_remap_data (SPA_POD_TYPE_STRUCT, data, size, &resource->client->types) ||
@ -845,7 +845,7 @@ client_node_demarshal_port_update (void *object,
0))
return false;
possible_formats = alloca (n_possible_formats * sizeof (SpaFormat*));
possible_formats = alloca (n_possible_formats * sizeof (struct spa_format*));
for (i = 0; i < n_possible_formats; i++)
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &possible_formats[i], 0))
return false;
@ -856,7 +856,7 @@ client_node_demarshal_port_update (void *object,
0))
return false;
params = alloca (n_params * sizeof (SpaParam*));
params = alloca (n_params * sizeof (struct spa_param*));
for (i = 0; i < n_params; i++)
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &params[i], 0))
return false;
@ -867,7 +867,7 @@ client_node_demarshal_port_update (void *object,
return false;
if (ipod) {
SpaPODIter it2;
struct spa_pod_iter it2;
infop = &info;
if (!spa_pod_iter_pod (&it2, ipod) ||
@ -897,8 +897,8 @@ client_node_demarshal_event (void *object,
size_t size)
{
struct pw_resource *resource = object;
SpaPODIter it;
SpaEvent *event;
struct spa_pod_iter it;
struct spa_event *event;
if (!spa_pod_iter_struct (&it, data, size) ||
!pw_pod_remap_data (SPA_POD_TYPE_STRUCT, data, size, &resource->client->types) ||
@ -915,7 +915,7 @@ client_node_demarshal_destroy (void *object,
size_t size)
{
struct pw_resource *resource = object;
SpaPODIter it;
struct spa_pod_iter it;
if (!spa_pod_iter_struct (&it, data, size))
return false;
@ -931,7 +931,7 @@ link_marshal_info (void *object,
struct pw_resource *resource = object;
struct pw_connection *connection = resource->client->protocol_private;
struct builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
struct spa_pod_frame f;
core_update_map (resource->client);

View file

@ -36,7 +36,7 @@ typedef void (*pw_destroy_t) (void *object);
struct pw_resource {
struct pw_core *core;
SpaList link;
struct spa_list link;
struct pw_client *client;

View file

@ -27,28 +27,28 @@ struct work_item {
uint32_t id;
void *obj;
uint32_t seq;
SpaResult res;
int res;
pw_work_func_t func;
void *data;
SpaList link;
struct spa_list link;
};
struct impl {
struct pw_work_queue this;
SpaSource *wakeup;
struct spa_source *wakeup;
uint32_t counter;
SpaList work_list;
SpaList free_list;
int n_queued;
struct spa_list work_list;
struct spa_list free_list;
int n_queued;
};
static void
process_work_queue (SpaLoopUtils *utils,
SpaSource *source,
void *data)
process_work_queue (struct spa_loop_utils *utils,
struct spa_source *source,
void *data)
{
struct impl *impl = data;
struct pw_work_queue *this = &impl->this;
@ -135,7 +135,7 @@ pw_work_queue_destroy (struct pw_work_queue * queue)
uint32_t
pw_work_queue_add (struct pw_work_queue *queue,
void *obj,
SpaResult res,
int res,
pw_work_func_t func,
void *data)
{
@ -205,7 +205,7 @@ bool
pw_work_queue_complete (struct pw_work_queue *queue,
void *obj,
uint32_t seq,
SpaResult res)
int res)
{
struct work_item *item;
struct impl *impl = SPA_CONTAINER_OF (queue, struct impl, this);

View file

@ -28,7 +28,7 @@ extern "C" {
typedef void (*pw_work_func_t) (void *obj,
void *data,
SpaResult res,
int res,
uint32_t id);
/**
@ -48,7 +48,7 @@ void pw_work_queue_destroy (struct pw_work_queue *que
uint32_t pw_work_queue_add (struct pw_work_queue *queue,
void *obj,
SpaResult res,
int res,
pw_work_func_t func,
void *data);
void pw_work_queue_cancel (struct pw_work_queue *queue,
@ -57,7 +57,7 @@ void pw_work_queue_cancel (struct pw_work_queue *que
bool pw_work_queue_complete (struct pw_work_queue *queue,
void *obj,
uint32_t seq,
SpaResult res);
int res);
#ifdef __cplusplus
}

View file

@ -33,9 +33,9 @@ struct data {
};
static void
print_properties (SpaDict *props, char mark)
print_properties (struct spa_dict *props, char mark)
{
SpaDictItem *item;
struct spa_dict_item *item;
if (props == NULL)
return;
@ -55,7 +55,7 @@ struct dumpdata {
static void
dump_core_info (struct pw_context *c,
SpaResult res,
int res,
const struct pw_core_info *info,
void *user_data)
{
@ -78,7 +78,7 @@ dump_core_info (struct pw_context *c,
static void
dump_client_info (struct pw_context *c,
SpaResult res,
int res,
const struct pw_client_info *info,
void *user_data)
{
@ -96,7 +96,7 @@ dump_client_info (struct pw_context *c,
static void
dump_node_info (struct pw_context *c,
SpaResult res,
int res,
const struct pw_node_info *info,
void *user_data)
{
@ -135,7 +135,7 @@ dump_node_info (struct pw_context *c,
static void
dump_module_info (struct pw_context *c,
SpaResult res,
int res,
const struct pw_module_info *info,
void *user_data)
{
@ -159,7 +159,7 @@ dump_module_info (struct pw_context *c,
static void
dump_link_info (struct pw_context *c,
SpaResult res,
int res,
const struct pw_link_info *info,
void *user_data)
{

View file

@ -28,17 +28,17 @@ extern "C" {
#include <spa/audio/format.h>
#include <spa/audio/raw-utils.h>
typedef struct {
struct spa_type_format_audio {
uint32_t format;
uint32_t flags;
uint32_t layout;
uint32_t rate;
uint32_t channels;
uint32_t channel_mask;
} SpaTypeFormatAudio;
};
static inline void
spa_type_format_audio_map (SpaTypeMap *map, SpaTypeFormatAudio *type)
spa_type_format_audio_map (struct spa_type_map *map, struct spa_type_format_audio *type)
{
if (type->format == 0) {
type->format = spa_type_map_get_id (map, SPA_TYPE_FORMAT_AUDIO__format);
@ -51,9 +51,9 @@ spa_type_format_audio_map (SpaTypeMap *map, SpaTypeFormatAudio *type)
}
static inline bool
spa_format_audio_raw_parse (const SpaFormat *format,
SpaAudioInfoRaw *info,
SpaTypeFormatAudio *type)
spa_format_audio_raw_parse (const struct spa_format *format,
struct spa_audio_info_raw *info,
struct spa_type_format_audio *type)
{
spa_format_query (format,
type->format, SPA_POD_TYPE_ID, &info->format,

View file

@ -27,8 +27,6 @@ extern "C" {
#include <spa/format.h>
#include <spa/audio/raw.h>
typedef struct _SpaAudioInfo SpaAudioInfo;
#define SPA_TYPE_FORMAT__Audio SPA_TYPE_FORMAT_BASE "Audio"
#define SPA_TYPE_FORMAT_AUDIO_BASE SPA_TYPE_FORMAT__Audio ":"
@ -39,11 +37,11 @@ typedef struct _SpaAudioInfo SpaAudioInfo;
#define SPA_TYPE_FORMAT_AUDIO__channels SPA_TYPE_FORMAT_AUDIO_BASE "channels"
#define SPA_TYPE_FORMAT_AUDIO__channelMask SPA_TYPE_FORMAT_AUDIO_BASE "channel-mask"
struct _SpaAudioInfo {
struct spa_audio_info {
uint32_t media_type;
uint32_t media_subtype;
union {
SpaAudioInfoRaw raw;
struct spa_audio_info_raw raw;
} info;
};

View file

@ -35,7 +35,7 @@ extern "C" {
#define _SPA_TYPE_AUDIO_FORMAT_OE(fmt) SPA_TYPE_AUDIO_FORMAT_BASE fmt "BE"
#endif
typedef struct {
struct spa_type_audio_format {
uint32_t UNKNOWN;
uint32_t ENCODED;
uint32_t S8;
@ -68,10 +68,10 @@ typedef struct {
uint32_t U18_OE;
uint32_t F32_OE;
uint32_t F64_OE;
} SpaTypeAudioFormat;
};
static inline void
spa_type_audio_format_map (SpaTypeMap *map, SpaTypeAudioFormat *type)
spa_type_audio_format_map (struct spa_type_map *map, struct spa_type_audio_format *type)
{
if (type->ENCODED == 0) {
type->UNKNOWN = 0;

View file

@ -24,8 +24,6 @@
extern "C" {
#endif
typedef struct _SpaAudioInfoRaw SpaAudioInfoRaw;
#include <endian.h>
#define SPA_TYPE__AudioFormat SPA_TYPE_ENUM_BASE "AudioFormat"
@ -65,32 +63,32 @@ typedef struct _SpaAudioInfoRaw SpaAudioInfoRaw;
#define SPA_TYPE_AUDIO_FORMAT__F64BE SPA_TYPE_AUDIO_FORMAT_BASE "F64BE"
/**
* SpaAudioFlags:
* spa_audio_flags:
* @SPA_AUDIO_FLAG_NONE: no valid flag
* @SPA_AUDIO_FLAG_UNPOSITIONED: the position array explicitly
* contains unpositioned channels.
*
* Extra audio flags
*/
typedef enum {
enum spa_audio_flags {
SPA_AUDIO_FLAG_NONE = 0,
SPA_AUDIO_FLAG_UNPOSITIONED = (1 << 0)
} SpaAudioFlags;
};
/**
* SpaAudioLayout:
* spa_audio_layout:
* @SPA_AUDIO_LAYOUT_INTERLEAVED: interleaved audio
* @SPA_AUDIO_LAYOUT_NON_INTERLEAVED: non-interleaved audio
*
* Layout of the audio samples for the different channels.
*/
typedef enum {
enum spa_audio_layout {
SPA_AUDIO_LAYOUT_INTERLEAVED = 0,
SPA_AUDIO_LAYOUT_NON_INTERLEAVED
} SpaAudioLayout;
};
/**
* SpaAudioInfoRaw:
* spa_audio_info_raw:
* @format: the format
* @flags: extra flags
* @layout: the sample layout
@ -98,13 +96,13 @@ typedef enum {
* @channels: the number of channels
* @channel_mask: the channel mask
*/
struct _SpaAudioInfoRaw {
uint32_t format;
SpaAudioFlags flags;
SpaAudioLayout layout;
uint32_t rate;
uint32_t channels;
uint32_t channel_mask;
struct spa_audio_info_raw {
uint32_t format;
enum spa_audio_flags flags;
enum spa_audio_layout layout;
uint32_t rate;
uint32_t channels;
uint32_t channel_mask;
};
#ifdef __cplusplus

View file

@ -24,8 +24,6 @@
extern "C" {
#endif
typedef struct _SpaBuffer SpaBuffer;
#include <spa/defs.h>
#include <spa/meta.h>
#include <spa/type-map.h>
@ -41,15 +39,15 @@ typedef struct _SpaBuffer SpaBuffer;
#define SPA_TYPE_DATA__DmaBuf SPA_TYPE_DATA_BASE "DmaBuf"
#define SPA_TYPE_DATA__Id SPA_TYPE_DATA_BASE "Id"
typedef struct {
struct spa_type_data {
uint32_t MemPtr;
uint32_t MemFd;
uint32_t DmaBuf;
uint32_t Id;
} SpaTypeData;
};
static inline void
spa_type_data_map (SpaTypeMap *map, SpaTypeData *type)
spa_type_data_map (struct spa_type_map *map, struct spa_type_data *type)
{
if (type->MemPtr == 0) {
type->MemPtr = spa_type_map_get_id (map, SPA_TYPE_DATA__MemPtr);
@ -60,19 +58,19 @@ spa_type_data_map (SpaTypeMap *map, SpaTypeData *type)
}
/**
* SpaChunk:
* spa_chunk:
* @offset: offset of valid data
* @size: size of valid data
* @stride: stride of data if applicable
*/
typedef struct {
struct spa_chunk {
uint32_t offset;
uint32_t size;
int32_t stride;
} SpaChunk;
};
/**
* SpaData:
* spa_data:
* @type: memory type
* @flags: memory flags
* @fd: file descriptor
@ -81,34 +79,34 @@ typedef struct {
* @data: pointer to memory
* @chunk: pointer to chunk with valid offset
*/
typedef struct {
uint32_t type;
uint32_t flags;
int fd;
uint32_t mapoffset;
uint32_t maxsize;
void *data;
SpaChunk *chunk;
} SpaData;
struct spa_data {
uint32_t type;
uint32_t flags;
int fd;
uint32_t mapoffset;
uint32_t maxsize;
void *data;
struct spa_chunk *chunk;
};
/**
* SpaBuffer:
* spa_buffer:
* @id: buffer id
* @n_metas: number of metadata
* @metas: offset of array of @n_metas metadata
* @n_datas: number of data pointers
* @datas: offset of array of @n_datas data pointers
*/
struct _SpaBuffer {
uint32_t id;
uint32_t n_metas;
SpaMeta *metas;
uint32_t n_datas;
SpaData *datas;
struct spa_buffer {
uint32_t id;
uint32_t n_metas;
struct spa_meta *metas;
uint32_t n_datas;
struct spa_data *datas;
};
static inline void *
spa_buffer_find_meta (SpaBuffer *b, uint32_t type)
spa_buffer_find_meta (struct spa_buffer *b, uint32_t type)
{
uint32_t i;

View file

@ -24,76 +24,74 @@
extern "C" {
#endif
typedef struct _SpaClock SpaClock;
#define SPA_TYPE__Clock SPA_TYPE_INTERFACE_BASE "Clock"
#define SPA_TYPE_CLOCK_BASE SPA_TYPE__Clock ":"
/**
* SpaClockState:
* spa_clock_state:
* @SPA_CLOCK_STATE_STOPPED: the clock is stopped
* @SPA_CLOCK_STATE_PAUSED: the clock is paused
* @SPA_CLOCK_STATE_RUNNING: the clock is running
*/
typedef enum {
enum spa_clock_state {
SPA_CLOCK_STATE_STOPPED,
SPA_CLOCK_STATE_PAUSED,
SPA_CLOCK_STATE_RUNNING,
} SpaClockState;
};
#include <spa/defs.h>
#include <spa/plugin.h>
#include <spa/props.h>
/**
* SpaClock:
* spa_clock:
*
* A time provider.
*/
struct _SpaClock {
struct spa_clock {
/* the total size of this clock. This can be used to expand this
* structure in the future */
size_t size;
/**
* SpaClock::info
* spa_clock::info
*
* Extra information about the clock
*/
const SpaDict *info;
const struct spa_dict *info;
/**
* SpaClock::state:
* spa_clock::state:
*
* The current state of the clock
*/
SpaClockState state;
enum spa_clock_state state;
/**
* SpaClock::get_props:
* @clock: a #SpaClock
* @props: a location for a #SpaProps pointer
* spa_clock::get_props:
* @clock: a #spa_clock
* @props: a location for a #struct spa_props pointer
*
* Get the configurable properties of @clock.
*
* The returned @props is a snapshot of the current configuration and
* can be modified. The modifications will take effect after a call
* to SpaClock::set_props.
* to spa_clock::set_props.
*
* Returns: #SPA_RESULT_OK on success
* #SPA_RESULT_INVALID_ARGUMENTS when clock or props are %NULL
* #SPA_RESULT_NOT_IMPLEMENTED when there are no properties
* implemented on @clock
*/
SpaResult (*get_props) (SpaClock *clock,
SpaProps **props);
int (*get_props) (struct spa_clock *clock,
struct spa_props **props);
/**
* SpaClock::set_props:
* @clock: a #SpaClock
* @props: a #SpaProps
* spa_clock::set_props:
* @clock: a #spa_clock
* @props: a #struct spa_props
*
* Set the configurable properties in @clock.
*
* Usually, @props will be obtained from SpaClock::get_props and then
* modified but it is also possible to set another #SpaProps object
* as long as its keys and types match those of SpaProps::get_props.
* Usually, @props will be obtained from spa_clock::get_props and then
* modified but it is also possible to set another #struct spa_props object
* as long as its keys and types match those of struct spa_props::get_props.
*
* Properties with keys that are not known are ignored.
*
@ -106,13 +104,13 @@ struct _SpaClock {
* #SPA_RESULT_WRONG_PROPERTY_TYPE when a property has the wrong
* type.
*/
SpaResult (*set_props) (SpaClock *clock,
const SpaProps *props);
int (*set_props) (struct spa_clock *clock,
const struct spa_props *props);
SpaResult (*get_time) (SpaClock *clock,
int32_t *rate,
int64_t *ticks,
int64_t *monotonic_time);
int (*get_time) (struct spa_clock *clock,
int32_t *rate,
int64_t *ticks,
int64_t *monotonic_time);
};
#define spa_clock_get_props(n,...) (n)->get_props((n),__VA_ARGS__)

View file

@ -37,17 +37,17 @@ extern "C" {
#define SPA_TYPE_COMMAND_NODE__Marker SPA_TYPE_COMMAND_NODE_BASE "Marker"
#define SPA_TYPE_COMMAND_NODE__ClockUpdate SPA_TYPE_COMMAND_NODE_BASE "ClockUpdate"
typedef struct {
struct spa_type_command_node {
uint32_t Pause;
uint32_t Start;
uint32_t Flush;
uint32_t Drain;
uint32_t Marker;
uint32_t ClockUpdate;
} SpaTypeCommandNode;
};
static inline void
spa_type_command_node_map (SpaTypeMap *map, SpaTypeCommandNode *type)
spa_type_command_node_map (struct spa_type_map *map, struct spa_type_command_node *type)
{
if (type->Pause == 0) {
type->Pause = spa_type_map_get_id (map, SPA_TYPE_COMMAND_NODE__Pause);
@ -60,7 +60,7 @@ spa_type_command_node_map (SpaTypeMap *map, SpaTypeCommandNode *type)
}
/**
* SpaCommandNodeClockUpdate:
* spa_command_node_clock_update:
* @change_mask: marks which fields are updated
* @rate: the number of @ticks per second
* @ticks: the new ticks, when @change_mask = 1<<0
@ -71,40 +71,40 @@ spa_type_command_node_map (SpaTypeMap *map, SpaTypeCommandNode *type)
* @scale: update to the speed stored as Q16.16, @change_mask = 1<<1
* @state: the new clock state, when @change_mask = 1<<2
*/
typedef struct {
SpaPODObjectBody body;
struct spa_command_node_clock_update_body {
struct spa_pod_object_body body;
#define SPA_COMMAND_NODE_CLOCK_UPDATE_TIME (1 << 0)
#define SPA_COMMAND_NODE_CLOCK_UPDATE_SCALE (1 << 1)
#define SPA_COMMAND_NODE_CLOCK_UPDATE_STATE (1 << 2)
#define SPA_COMMAND_NODE_CLOCK_UPDATE_LATENCY (1 << 3)
SpaPODInt change_mask SPA_ALIGNED (8);
SpaPODInt rate SPA_ALIGNED (8);
SpaPODLong ticks SPA_ALIGNED (8);
SpaPODLong monotonic_time SPA_ALIGNED (8);
SpaPODLong offset SPA_ALIGNED (8);
SpaPODInt scale SPA_ALIGNED (8);
SpaPODInt state SPA_ALIGNED (8);
struct spa_pod_int change_mask SPA_ALIGNED (8);
struct spa_pod_int rate SPA_ALIGNED (8);
struct spa_pod_long ticks SPA_ALIGNED (8);
struct spa_pod_long monotonic_time SPA_ALIGNED (8);
struct spa_pod_long offset SPA_ALIGNED (8);
struct spa_pod_int scale SPA_ALIGNED (8);
struct spa_pod_int state SPA_ALIGNED (8);
#define SPA_COMMAND_NODE_CLOCK_UPDATE_FLAG_LIVE (1 << 0)
SpaPODInt flags SPA_ALIGNED (8);
SpaPODLong latency SPA_ALIGNED (8);
} SpaCommandNodeClockUpdateBody;
struct spa_pod_int flags SPA_ALIGNED (8);
struct spa_pod_long latency SPA_ALIGNED (8);
};
typedef struct {
SpaPOD pod;
SpaCommandNodeClockUpdateBody body;
} SpaCommandNodeClockUpdate;
struct spa_command_node_clock_update {
struct spa_pod pod;
struct spa_command_node_clock_update_body body;
};
#define SPA_COMMAND_NODE_CLOCK_UPDATE_INIT(type,change_mask,rate,ticks,monotonic_time,offset,scale,state,flags,latency) \
SPA_COMMAND_INIT_COMPLEX (SpaCommandNodeClockUpdate, \
sizeof (SpaCommandNodeClockUpdateBody), type, \
SPA_POD_INT_INIT (change_mask), \
SPA_POD_INT_INIT (rate), \
SPA_POD_LONG_INIT (ticks), \
SPA_POD_LONG_INIT (monotonic_time), \
SPA_POD_LONG_INIT (offset), \
SPA_POD_INT_INIT (scale), \
SPA_POD_INT_INIT (state), \
SPA_POD_INT_INIT (flags), \
SPA_COMMAND_INIT_COMPLEX (struct spa_command_node_clock_update, \
sizeof (struct spa_command_node_clock_update_body), type, \
SPA_POD_INT_INIT (change_mask), \
SPA_POD_INT_INIT (rate), \
SPA_POD_LONG_INIT (ticks), \
SPA_POD_LONG_INIT (monotonic_time), \
SPA_POD_LONG_INIT (offset), \
SPA_POD_INT_INIT (scale), \
SPA_POD_INT_INIT (state), \
SPA_POD_INT_INIT (flags), \
SPA_POD_LONG_INIT (latency))
#ifdef __cplusplus

View file

@ -24,27 +24,25 @@
extern "C" {
#endif
typedef struct _SpaCommand SpaCommand;
#include <spa/defs.h>
#include <spa/pod.h>
#define SPA_TYPE__Command SPA_TYPE_POD_OBJECT_BASE "Command"
#define SPA_TYPE_COMMAND_BASE SPA_TYPE__Command ":"
typedef struct {
SpaPODObjectBody body;
} SpaCommandBody;
struct spa_command_body {
struct spa_pod_object_body body;
};
struct _SpaCommand {
SpaPOD pod;
SpaCommandBody body;
struct spa_command {
struct spa_pod pod;
struct spa_command_body body;
};
#define SPA_COMMAND_TYPE(cmd) ((cmd)->body.body.type)
#define SPA_COMMAND_INIT(type) (SpaCommand) \
{ { sizeof (SpaCommandBody), SPA_POD_TYPE_OBJECT }, \
#define SPA_COMMAND_INIT(type) (struct spa_command) \
{ { sizeof (struct spa_command_body), SPA_POD_TYPE_OBJECT }, \
{ { 0, type } } } \
#define SPA_COMMAND_INIT_COMPLEX(t,size,type,...) (t) \

View file

@ -30,7 +30,7 @@ extern "C" {
#include <string.h>
#include <stddef.h>
typedef enum {
enum {
SPA_RESULT_ASYNC = (1 << 30),
SPA_RESULT_WAIT_SYNC = 2,
SPA_RESULT_MODIFIED = 1,
@ -71,7 +71,7 @@ typedef enum {
SPA_RESULT_SKIPPED = -34,
SPA_RESULT_OUT_OF_BUFFERS = -35,
SPA_RESULT_INCOMPATIBLE_PROPS = -36,
} SpaResult;
};
#define SPA_ASYNC_MASK (3 << 30)
#define SPA_ASYNC_SEQ_MASK (SPA_RESULT_ASYNC - 1)
@ -83,22 +83,20 @@ typedef enum {
#define SPA_RESULT_ASYNC_SEQ(res) ((res) & SPA_ASYNC_SEQ_MASK)
#define SPA_RESULT_RETURN_ASYNC(seq) (SPA_RESULT_ASYNC | ((seq) & SPA_ASYNC_SEQ_MASK))
typedef enum {
enum spa_direction {
SPA_DIRECTION_INPUT = 0,
SPA_DIRECTION_OUTPUT = 1,
} SpaDirection;
};
typedef struct {
struct spa_rectangle {
uint32_t width;
uint32_t height;
} SpaRectangle;
};
typedef struct {
struct spa_fraction {
uint32_t num;
uint32_t denom;
} SpaFraction;
typedef void (*SpaNotify) (void *data);
};
#define SPA_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
#define SPA_MIN(a,b) ((a)<(b) ? (a) : (b))

View file

@ -24,8 +24,6 @@
extern "C" {
#endif
typedef struct _SpaDict SpaDict;
#define SPA_TYPE__Dict SPA_TYPE_POINTER_BASE "Dict"
#define SPA_TYPE_DICT_BASE SPA_TYPE__Dict ":"
@ -33,14 +31,14 @@ typedef struct _SpaDict SpaDict;
#include <spa/defs.h>
typedef struct {
struct spa_dict_item {
const char *key;
const char *value;
} SpaDictItem;
};
struct _SpaDict {
uint32_t n_items;
SpaDictItem *items;
struct spa_dict {
uint32_t n_items;
struct spa_dict_item *items;
};
#define SPA_DICT_INIT(n_items,items) { n_items, items }
@ -50,10 +48,10 @@ struct _SpaDict {
(item) < &(dict)->items[(dict)->n_items]; \
(item)++)
static inline SpaDictItem *
spa_dict_lookup_item (const SpaDict *dict, const char *key)
static inline struct spa_dict_item *
spa_dict_lookup_item (const struct spa_dict *dict, const char *key)
{
SpaDictItem *item;
struct spa_dict_item *item;
spa_dict_for_each (item, dict) {
if (!strcmp (item->key, key))
return item;
@ -62,9 +60,9 @@ spa_dict_lookup_item (const SpaDict *dict, const char *key)
}
static inline const char *
spa_dict_lookup (const SpaDict *dict, const char *key)
spa_dict_lookup (const struct spa_dict *dict, const char *key)
{
SpaDictItem *item = spa_dict_lookup_item (dict, key);
struct spa_dict_item *item = spa_dict_lookup_item (dict, key);
return item ? item->value : NULL;
}

View file

@ -38,16 +38,16 @@ extern "C" {
#define SPA_TYPE_EVENT_NODE__RequestRefresh SPA_TYPE_EVENT_NODE_BASE "RequestRefresh"
#define SPA_TYPE_EVENT_NODE__RequestClockUpdate SPA_TYPE_EVENT_NODE_BASE "RequestClockUpdate"
typedef struct {
struct spa_type_event_node {
uint32_t AsyncComplete;
uint32_t Error;
uint32_t Buffering;
uint32_t RequestRefresh;
uint32_t RequestClockUpdate;
} SpaTypeEventNode;
};
static inline void
spa_type_event_node_map (SpaTypeMap *map, SpaTypeEventNode *type)
spa_type_event_node_map (struct spa_type_map *map, struct spa_type_event_node *type)
{
if (type->AsyncComplete == 0) {
type->AsyncComplete = spa_type_map_get_id (map, SPA_TYPE_EVENT_NODE__AsyncComplete);
@ -58,43 +58,43 @@ spa_type_event_node_map (SpaTypeMap *map, SpaTypeEventNode *type)
}
}
typedef struct {
SpaPODObjectBody body;
SpaPODInt seq SPA_ALIGNED (8);
SpaPODInt res SPA_ALIGNED (8);
} SpaEventNodeAsyncCompleteBody;
struct spa_event_node_async_complete_body {
struct spa_pod_object_body body;
struct spa_pod_int seq SPA_ALIGNED (8);
struct spa_pod_int res SPA_ALIGNED (8);
};
typedef struct {
SpaPOD pod;
SpaEventNodeAsyncCompleteBody body;
} SpaEventNodeAsyncComplete;
struct spa_event_node_async_complete {
struct spa_pod pod;
struct spa_event_node_async_complete_body body;
};
#define SPA_EVENT_NODE_ASYNC_COMPLETE_INIT(type,seq,res) \
SPA_EVENT_INIT_COMPLEX (SpaEventNodeAsyncComplete, \
sizeof (SpaEventNodeAsyncCompleteBody), type, \
SPA_POD_INT_INIT (seq), \
#define SPA_EVENT_NODE_ASYNC_COMPLETE_INIT(type,seq,res) \
SPA_EVENT_INIT_COMPLEX (struct spa_event_node_async_complete, \
sizeof (struct spa_event_node_async_complete_body), type, \
SPA_POD_INT_INIT (seq), \
SPA_POD_INT_INIT (res))
typedef struct {
SpaPODObjectBody body;
struct spa_event_node_request_clock_update_body {
struct spa_pod_object_body body;
#define SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_TIME (1 << 0)
#define SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_SCALE (1 << 1)
#define SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_STATE (1 << 2)
SpaPODInt update_mask SPA_ALIGNED (8);
SpaPODLong timestamp SPA_ALIGNED (8);
SpaPODLong offset SPA_ALIGNED (8);
} SpaEventNodeRequestClockUpdateBody;
struct spa_pod_int update_mask SPA_ALIGNED (8);
struct spa_pod_long timestamp SPA_ALIGNED (8);
struct spa_pod_long offset SPA_ALIGNED (8);
};
typedef struct {
SpaPOD pod;
SpaEventNodeRequestClockUpdateBody body;
} SpaEventNodeRequestClockUpdate;
struct spa_event_node_request_clock_update {
struct spa_pod pod;
struct spa_event_node_request_clock_update_body body;
};
#define SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_INIT(type,update_mask,timestamp,offset) \
SPA_EVENT_INIT_COMPLEX (SpaEventNodeRequestClockUpdate, \
sizeof (SpaEventNodeRequestClockUpdateBody), type, \
SPA_POD_INT_INIT (update_mask), \
SPA_POD_LONG_INIT (timestamp), \
#define SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_INIT(type,update_mask,timestamp,offset) \
SPA_EVENT_INIT_COMPLEX (struct spa_event_node_request_clock_update, \
sizeof (struct spa_event_node_request_clock_update_body), type, \
SPA_POD_INT_INIT (update_mask), \
SPA_POD_LONG_INIT (timestamp), \
SPA_POD_LONG_INIT (offset))
#ifdef __cplusplus

View file

@ -24,32 +24,30 @@
extern "C" {
#endif
typedef struct _SpaEvent SpaEvent;
#include <spa/defs.h>
#include <spa/pod.h>
#define SPA_TYPE__Event SPA_TYPE_POD_OBJECT_BASE "Event"
#define SPA_TYPE_EVENT_BASE SPA_TYPE__Event ":"
typedef struct {
SpaPODObjectBody body;
} SpaEventBody;
struct spa_event_body {
struct spa_pod_object_body body;
};
struct _SpaEvent {
SpaPOD pod;
SpaEventBody body;
struct spa_event {
struct spa_pod pod;
struct spa_event_body body;
};
#define SPA_EVENT_TYPE(ev) ((ev)->body.body.type)
#define SPA_EVENT_INIT(type) (SpaEvent) \
{ { sizeof (SpaEventBody), SPA_POD_TYPE_OBJECT }, \
{ { 0, type } } } \
#define SPA_EVENT_INIT(type) (struct spa_event) \
{ { sizeof (struct spa_event_body), SPA_POD_TYPE_OBJECT }, \
{ { 0, type } } } \
#define SPA_EVENT_INIT_COMPLEX(t,size,type,...) (t) \
{ { size, SPA_POD_TYPE_OBJECT }, \
{ { 0, type }, __VA_ARGS__ } } \
#define SPA_EVENT_INIT_COMPLEX(t,size,type,...) (t) \
{ { size, SPA_POD_TYPE_OBJECT }, \
{ { 0, type }, __VA_ARGS__ } } \
#ifdef __cplusplus
} /* extern "C" */

View file

@ -30,13 +30,13 @@ extern "C" {
#include <spa/pod-builder.h>
static inline uint32_t
spa_pod_builder_push_format (SpaPODBuilder *builder,
SpaPODFrame *frame,
uint32_t format_type,
uint32_t media_type,
uint32_t media_subtype)
spa_pod_builder_push_format (struct spa_pod_builder *builder,
struct spa_pod_frame *frame,
uint32_t format_type,
uint32_t media_type,
uint32_t media_subtype)
{
const SpaFormat p = { { sizeof (SpaFormatBody), SPA_POD_TYPE_OBJECT },
const struct spa_format p = { { sizeof (struct spa_format_body), SPA_POD_TYPE_OBJECT },
{ { 0, format_type },
{ { sizeof (uint32_t), SPA_POD_TYPE_ID }, media_type },
{ { sizeof (uint32_t), SPA_POD_TYPE_ID }, media_subtype } } };
@ -50,10 +50,10 @@ spa_pod_builder_push_format (SpaPODBuilder *builder,
SPA_POD_TYPE_ID,media_subtype, \
__VA_ARGS__)
SpaResult
spa_format_filter (const SpaFormat *format,
const SpaFormat *filter,
SpaPODBuilder *result);
int
spa_format_filter (const struct spa_format *format,
const struct spa_format *filter,
struct spa_pod_builder *result);
#ifdef __cplusplus
} /* extern "C" */

View file

@ -30,16 +30,16 @@ extern "C" {
#include <spa/pod-utils.h>
#include <spa/type-map.h>
typedef struct {
struct spa_type_media_type {
uint32_t audio;
uint32_t video;
uint32_t image;
uint32_t binary;
uint32_t stream;
} SpaTypeMediaType;
};
static inline void
spa_type_media_type_map (SpaTypeMap *map, SpaTypeMediaType *type)
spa_type_media_type_map (struct spa_type_map *map, struct spa_type_media_type *type)
{
if (type->audio == 0) {
type->audio = spa_type_map_get_id (map, SPA_TYPE_MEDIA_TYPE__audio);
@ -50,19 +50,19 @@ spa_type_media_type_map (SpaTypeMap *map, SpaTypeMediaType *type)
}
}
typedef struct {
struct spa_type_media_subtype {
uint32_t raw;
} SpaTypeMediaSubtype;
};
static inline void
spa_type_media_subtype_map (SpaTypeMap *map, SpaTypeMediaSubtype *type)
spa_type_media_subtype_map (struct spa_type_map *map, struct spa_type_media_subtype *type)
{
if (type->raw == 0) {
type->raw = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__raw);
}
}
typedef struct {
struct spa_type_media_subtype_video {
uint32_t h264;
uint32_t mjpg;
uint32_t dv;
@ -77,30 +77,30 @@ typedef struct {
uint32_t vp9;
uint32_t jpeg;
uint32_t bayer;
} SpaTypeMediaSubtypeVideo;
};
static inline void
spa_type_media_subtype_video_map (SpaTypeMap *map, SpaTypeMediaSubtypeVideo *type)
spa_type_media_subtype_video_map (struct spa_type_map *map, struct spa_type_media_subtype_video *type)
{
if (type->h264 == 0) {
type->h264 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__h264);
type->mjpg = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mjpg);
type->dv = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__dv);
type->h264 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__h264);
type->mjpg = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mjpg);
type->dv = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__dv);
type->mpegts = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mpegts);
type->h263 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__h263);
type->mpeg1 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mpeg1);
type->mpeg2 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mpeg2);
type->mpeg4 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mpeg4);
type->xvid = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__xvid);
type->vc1 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__vc1);
type->vp8 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__vp8);
type->vp9 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__vp9);
type->jpeg = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__jpeg);
type->bayer = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__bayer);
type->h263 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__h263);
type->mpeg1 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mpeg1);
type->mpeg2 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mpeg2);
type->mpeg4 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mpeg4);
type->xvid = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__xvid);
type->vc1 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__vc1);
type->vp8 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__vp8);
type->vp9 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__vp9);
type->jpeg = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__jpeg);
type->bayer = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__bayer);
}
}
typedef struct {
struct spa_type_media_subtype_audio {
uint32_t mp3;
uint32_t aac;
uint32_t vorbis;
@ -113,24 +113,24 @@ typedef struct {
uint32_t g729;
uint32_t amr;
uint32_t gsm;
} SpaTypeMediaSubtypeAudio;
};
static inline void
spa_type_media_subtype_audio_map (SpaTypeMap *map, SpaTypeMediaSubtypeAudio *type)
spa_type_media_subtype_audio_map (struct spa_type_map *map, struct spa_type_media_subtype_audio *type)
{
if (type->mp3 == 0) {
type->mp3 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mp3);
type->aac = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__aac);
type->mp3 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mp3);
type->aac = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__aac);
type->vorbis = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__vorbis);
type->wma = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__wma);
type->ra = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__ra);
type->sbc = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__sbc);
type->adpcm = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__adpcm);
type->g723 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__g723);
type->g726 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__g726);
type->g729 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__g729);
type->amr = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__amr);
type->gsm = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__gsm);
type->wma = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__wma);
type->ra = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__ra);
type->sbc = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__sbc);
type->adpcm = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__adpcm);
type->g723 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__g723);
type->g726 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__g726);
type->g729 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__g729);
type->amr = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__amr);
type->gsm = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__gsm);
}
}
@ -141,39 +141,39 @@ spa_type_media_subtype_audio_map (SpaTypeMap *map, SpaTypeMediaSubtypeAudio *typ
SPA_POD_ID_INIT (media_subtype) } }
#define SPA_FORMAT_BODY_FOREACH(body, size, iter) \
for ((iter) = SPA_MEMBER ((body), sizeof (SpaFormatBody), SpaPODProp); \
(iter) < SPA_MEMBER ((body), (size), SpaPODProp); \
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), SpaPODProp))
for ((iter) = SPA_MEMBER ((body), sizeof (struct spa_format_body), struct spa_pod_prop); \
(iter) < SPA_MEMBER ((body), (size), struct spa_pod_prop); \
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), struct spa_pod_prop))
#define SPA_FORMAT_FOREACH(format, iter) \
SPA_FORMAT_BODY_FOREACH(&format->body, SPA_POD_BODY_SIZE(format), iter)
#define SPA_FORMAT_MEDIA_TYPE(f) SPA_POD_VALUE (SpaPODId, &f->body.media_type)
#define SPA_FORMAT_MEDIA_SUBTYPE(f) SPA_POD_VALUE (SpaPODId, &f->body.media_subtype)
#define SPA_FORMAT_MEDIA_TYPE(f) SPA_POD_VALUE (struct spa_pod_id, &f->body.media_type)
#define SPA_FORMAT_MEDIA_SUBTYPE(f) SPA_POD_VALUE (struct spa_pod_id, &f->body.media_subtype)
static inline SpaPODProp *
spa_format_find_prop (const SpaFormat *format, uint32_t key)
static inline struct spa_pod_prop *
spa_format_find_prop (const struct spa_format *format, uint32_t key)
{
return spa_pod_contents_find_prop (&format->pod, sizeof (SpaFormat), key);
return spa_pod_contents_find_prop (&format->pod, sizeof (struct spa_format), key);
}
static inline uint32_t
spa_format_query (const SpaFormat *format, uint32_t key, ...)
spa_format_query (const struct spa_format *format, uint32_t key, ...)
{
uint32_t count;
va_list args;
va_start (args, key);
count = spa_pod_contents_queryv (&format->pod, sizeof (SpaFormat), key, args);
count = spa_pod_contents_queryv (&format->pod, sizeof (struct spa_format), key, args);
va_end (args);
return count;
}
static inline SpaResult
spa_format_fixate (SpaFormat *format)
static inline int
spa_format_fixate (struct spa_format *format)
{
SpaPODProp *prop;
struct spa_pod_prop *prop;
SPA_FORMAT_FOREACH (format, prop)
prop->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;

View file

@ -24,11 +24,10 @@
extern "C" {
#endif
struct spa_format;
#define SPA_TYPE__Format SPA_TYPE_POD_OBJECT_BASE "Format"
#define SPA_TYPE_FORMAT_BASE SPA_TYPE__Format ":"
typedef struct _SpaFormat SpaFormat;
#include <spa/defs.h>
#include <spa/pod.h>
@ -77,22 +76,22 @@ typedef struct _SpaFormat SpaFormat;
#define SPA_TYPE_MEDIA_SUBTYPE__amr SPA_TYPE_MEDIA_SUBTYPE_BASE "amr"
#define SPA_TYPE_MEDIA_SUBTYPE__gsm SPA_TYPE_MEDIA_SUBTYPE_BASE "gsm"
typedef struct {
SpaPODObjectBody obj_body;
SpaPODId media_type SPA_ALIGNED (8);
SpaPODId media_subtype SPA_ALIGNED (8);
/* contents follow, series of SpaPODProp */
} SpaFormatBody;
struct spa_format_body {
struct spa_pod_object_body obj_body;
struct spa_pod_id media_type SPA_ALIGNED (8);
struct spa_pod_id media_subtype SPA_ALIGNED (8);
/* contents follow, series of spa_pod_prop */
};
/**
* SpaFormat:
* spa_format:
* @media_type: media type
* @media_subtype: subtype
* @pod: POD object with properties
*/
struct _SpaFormat {
SpaPOD pod;
SpaFormatBody body;
struct spa_format {
struct spa_pod pod;
struct spa_format_body body;
};
#ifdef __cplusplus

View file

@ -27,56 +27,56 @@ extern "C" {
#include <spa/defs.h>
#include <spa/list.h>
typedef struct SpaGraph SpaGraph;
typedef struct SpaGraphNode SpaGraphNode;
typedef struct SpaGraphPort SpaGraphPort;
struct spa_graph;
struct spa_graph_node;
struct spa_graph_port;
struct SpaGraph {
SpaList nodes;
SpaList ready;
struct spa_graph {
struct spa_list nodes;
struct spa_list ready;
};
typedef SpaResult (*SpaGraphNodeFunc) (SpaGraphNode *node);
typedef int (*spa_graph_node_func_t) (struct spa_graph_node *node);
struct SpaGraphNode {
SpaList link;
SpaList ready_link;
SpaList ports[2];
struct spa_graph_node {
struct spa_list link;
struct spa_list ready_link;
struct spa_list ports[2];
#define SPA_GRAPH_NODE_FLAG_ASYNC (1 << 0)
uint32_t flags;
SpaResult state;
int state;
#define SPA_GRAPH_ACTION_CHECK 0
#define SPA_GRAPH_ACTION_IN 1
#define SPA_GRAPH_ACTION_OUT 2
uint32_t action;
SpaGraphNodeFunc schedule;
spa_graph_node_func_t schedule;
void *user_data;
uint32_t max_in;
uint32_t required_in;
uint32_t ready_in;
};
struct SpaGraphPort {
SpaList link;
SpaGraphNode *node;
SpaDirection direction;
uint32_t port_id;
uint32_t flags;
SpaPortIO *io;
SpaGraphPort *peer;
struct spa_graph_port {
struct spa_list link;
struct spa_graph_node *node;
enum spa_direction direction;
uint32_t port_id;
uint32_t flags;
struct spa_port_io *io;
struct spa_graph_port *peer;
};
static inline void
spa_graph_init (SpaGraph *graph)
spa_graph_init (struct spa_graph *graph)
{
spa_list_init (&graph->nodes);
spa_list_init (&graph->ready);
}
static inline SpaResult
spa_graph_node_schedule_default (SpaGraphNode *node)
static inline int
spa_graph_node_schedule_default (struct spa_graph_node *node)
{
SpaNode *n = node->user_data;
struct spa_node *n = node->user_data;
if (node->action == SPA_GRAPH_ACTION_IN)
return spa_node_process_input (n);
@ -87,7 +87,7 @@ spa_graph_node_schedule_default (SpaGraphNode *node)
}
static inline void
spa_graph_node_add (SpaGraph *graph, SpaGraphNode *node, SpaGraphNodeFunc schedule, void *user_data)
spa_graph_node_add (struct spa_graph *graph, struct spa_graph_node *node, spa_graph_node_func_t schedule, void *user_data)
{
spa_list_init (&node->ports[SPA_DIRECTION_INPUT]);
spa_list_init (&node->ports[SPA_DIRECTION_OUTPUT]);
@ -101,10 +101,10 @@ spa_graph_node_add (SpaGraph *graph, SpaGraphNode *node, SpaGraphNodeFunc schedu
}
static inline void
spa_graph_port_check (SpaGraph *graph,
SpaGraphPort *port)
spa_graph_port_check (struct spa_graph *graph,
struct spa_graph_port *port)
{
SpaGraphNode *node = port->node;
struct spa_graph_node *node = port->node;
if (port->io->status == SPA_RESULT_HAVE_BUFFER)
node->ready_in++;
@ -120,13 +120,13 @@ spa_graph_port_check (SpaGraph *graph,
}
static inline void
spa_graph_port_add (SpaGraph *graph,
SpaGraphNode *node,
SpaGraphPort *port,
SpaDirection direction,
uint32_t port_id,
uint32_t flags,
SpaPortIO *io)
spa_graph_port_add (struct spa_graph *graph,
struct spa_graph_node *node,
struct spa_graph_port *port,
enum spa_direction direction,
uint32_t port_id,
uint32_t flags,
struct spa_port_io *io)
{
port->node = node;
port->direction = direction;
@ -142,41 +142,41 @@ spa_graph_port_add (SpaGraph *graph,
}
static inline void
spa_graph_node_remove (SpaGraph *graph, SpaGraphNode *node)
spa_graph_node_remove (struct spa_graph *graph, struct spa_graph_node *node)
{
spa_list_remove (&node->link);
}
static inline void
spa_graph_port_remove (SpaGraph *graph, SpaGraphPort *port)
spa_graph_port_remove (struct spa_graph *graph, struct spa_graph_port *port)
{
spa_list_remove (&port->link);
}
static inline void
spa_graph_port_link (SpaGraph *graph, SpaGraphPort *out, SpaGraphPort *in)
spa_graph_port_link (struct spa_graph *graph, struct spa_graph_port *out, struct spa_graph_port *in)
{
out->peer = in;
in->peer = out;
}
static inline void
spa_graph_port_unlink (SpaGraph *graph, SpaGraphPort *out, SpaGraphPort *in)
spa_graph_port_unlink (struct spa_graph *graph, struct spa_graph_port *out, struct spa_graph_port *in)
{
out->peer = NULL;
in->peer = NULL;
}
static inline void
spa_graph_node_schedule (SpaGraph *graph, SpaGraphNode *node)
spa_graph_node_schedule (struct spa_graph *graph, struct spa_graph_node *node)
{
SpaGraphPort *p;
struct spa_graph_port *p;
if (node->ready_link.next == NULL)
spa_list_insert (graph->ready.prev, &node->ready_link);
while (!spa_list_is_empty (&graph->ready)) {
SpaGraphNode *n = spa_list_first (&graph->ready, SpaGraphNode, ready_link);
struct spa_graph_node *n = spa_list_first (&graph->ready, struct spa_graph_node, ready_link);
spa_list_remove (&n->ready_link);
n->ready_link.next = NULL;
@ -195,7 +195,7 @@ spa_graph_node_schedule (SpaGraph *graph, SpaGraphNode *node)
if (n->state == SPA_RESULT_NEED_BUFFER) {
n->ready_in = 0;
spa_list_for_each (p, &n->ports[SPA_DIRECTION_INPUT], link) {
SpaGraphNode *pn = p->peer->node;
struct spa_graph_node *pn = p->peer->node;
if (p->io->status == SPA_RESULT_NEED_BUFFER) {
if (pn != node || pn->flags & SPA_GRAPH_NODE_FLAG_ASYNC) {
pn->action = SPA_GRAPH_ACTION_OUT;

View file

@ -24,25 +24,23 @@
extern "C" {
#endif
typedef struct _SpaList SpaList;
#include <spa/defs.h>
struct _SpaList {
SpaList *next;
SpaList *prev;
struct spa_list {
struct spa_list *next;
struct spa_list *prev;
};
static inline void
spa_list_init (SpaList *list)
spa_list_init (struct spa_list *list)
{
list->next = list;
list->prev = list;
}
static inline void
spa_list_insert (SpaList *list,
SpaList *elem)
spa_list_insert (struct spa_list *list,
struct spa_list *elem)
{
elem->prev = list;
elem->next = list->next;
@ -51,7 +49,7 @@ spa_list_insert (SpaList *list,
}
static inline void
spa_list_remove (SpaList *elem)
spa_list_remove (struct spa_list *elem)
{
elem->prev->next = elem->next;
elem->next->prev = elem->prev;

View file

@ -24,8 +24,6 @@
extern "C" {
#endif
typedef struct _SpaLog SpaLog;
#define SPA_TYPE__Log SPA_TYPE_INTERFACE_BASE "Log"
#define SPA_TYPE_LOG_BASE SPA_TYPE__Log ":"
@ -34,43 +32,42 @@ typedef struct _SpaLog SpaLog;
#include <spa/defs.h>
#include <spa/plugin.h>
typedef enum
{
enum spa_log_level {
SPA_LOG_LEVEL_NONE = 0,
SPA_LOG_LEVEL_ERROR,
SPA_LOG_LEVEL_WARN,
SPA_LOG_LEVEL_INFO,
SPA_LOG_LEVEL_DEBUG,
SPA_LOG_LEVEL_TRACE,
} SpaLogLevel;
};
/**
* SpaLog:
* struct spa_log:
*
* The Log interface
*/
struct _SpaLog {
struct spa_log {
/* the total size of this log. This can be used to expand this
* structure in the future */
size_t size;
/**
* SpaLog::info
* struct spa_log::info
*
* Extra information about the log
*/
const SpaDict *info;
const struct spa_dict *info;
/**
* SpaLog::level
* struct spa_log::level
*
* Logging level, everything above this level is not logged
*/
SpaLogLevel level;
enum spa_log_level level;
/**
* SpaLog::log
* @log: a #SpaLog
* @level: a #SpaLogLevel
* struct spa_log::log
* @log: a #struct spa_log
* @level: a #enum spa_log_level
* @file: the file name
* @line: the line number
* @func: the function name
@ -79,17 +76,17 @@ struct _SpaLog {
*
* Log a message with the given log level.
*/
void (*log) (SpaLog *log,
SpaLogLevel level,
const char *file,
int line,
const char *func,
const char *fmt, ...) SPA_PRINTF_FUNC(6, 7);
void (*log) (struct spa_log *log,
enum spa_log_level level,
const char *file,
int line,
const char *func,
const char *fmt, ...) SPA_PRINTF_FUNC(6, 7);
/**
* SpaLog::logv
* @log: a #SpaLog
* @level: a #SpaLogLevel
* struct spa_log::logv
* @log: a #struct spa_log
* @level: a #enum spa_log_level
* @file: the file name
* @line: the line number
* @func: the function name
@ -98,13 +95,13 @@ struct _SpaLog {
*
* Log a message with the given log level.
*/
void (*logv) (SpaLog *log,
SpaLogLevel level,
const char *file,
int line,
const char *func,
const char *fmt,
va_list args) SPA_PRINTF_FUNC(6, 0);
void (*logv) (struct spa_log *log,
enum spa_log_level level,
const char *file,
int line,
const char *func,
const char *fmt,
va_list args) SPA_PRINTF_FUNC(6, 0);
};
#define spa_log_level_enabled(l,lev) ((l) && (l)->level >= (lev))
@ -124,7 +121,7 @@ struct _SpaLog {
#else
#define SPA_LOG_FUNC(name,lev) \
static inline void spa_log_##name (SpaLog *l, const char *format, ...) \
static inline void spa_log_##name (struct spa_log *l, const char *format, ...) \
{ \
if (SPA_UNLIKELY (spa_log_level_enabled (l, lev))) { \
va_list varargs; \

View file

@ -24,15 +24,13 @@
extern "C" {
#endif
typedef struct _SpaLoop SpaLoop;
typedef struct _SpaSource SpaSource;
typedef struct _SpaLoopControl SpaLoopControl;
typedef struct _SpaLoopUtils SpaLoopUtils;
struct spa_loop;
#define SPA_TYPE__Loop SPA_TYPE_INTERFACE_BASE "Loop"
#define SPA_TYPE_LOOP_BASE SPA_TYPE__Loop ":"
struct spa_loop_control;
#define SPA_TYPE__LoopControl SPA_TYPE_INTERFACE_BASE "LoopControl"
struct spa_loop_utils;
#define SPA_TYPE__LoopUtils SPA_TYPE_INTERFACE_BASE "LoopUtils"
#define SPA_TYPE_LOOP__MainLoop SPA_TYPE_LOOP_BASE "MainLoop"
@ -40,52 +38,54 @@ typedef struct _SpaLoopUtils SpaLoopUtils;
#include <spa/defs.h>
typedef void (*SpaSourceFunc) (SpaSource *source);
typedef enum {
enum spa_io {
SPA_IO_IN = (1 << 0),
SPA_IO_OUT = (1 << 1),
SPA_IO_HUP = (1 << 2),
SPA_IO_ERR = (1 << 3),
} SpaIO;
struct _SpaSource {
SpaLoop *loop;
SpaSourceFunc func;
void *data;
int fd;
SpaIO mask;
SpaIO rmask;
};
typedef SpaResult (*SpaInvokeFunc) (SpaLoop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data);
struct spa_source;
typedef void (*spa_source_func_t) (struct spa_source *source);
struct spa_source {
struct spa_loop *loop;
spa_source_func_t func;
void *data;
int fd;
enum spa_io mask;
enum spa_io rmask;
};
typedef int (*spa_invoke_func_t) (struct spa_loop *loop,
bool async,
uint32_t seq,
size_t size,
void *data,
void *user_data);
/**
* SpaLoop:
* spa_loop:
*
* Register sources and work items to an event loop
*/
struct _SpaLoop {
struct spa_loop {
/* the total size of this structure. This can be used to expand this
* structure in the future */
size_t size;
SpaResult (*add_source) (SpaLoop *loop,
SpaSource *source);
SpaResult (*update_source) (SpaSource *source);
int (*add_source) (struct spa_loop *loop,
struct spa_source *source);
int (*update_source) (struct spa_source *source);
void (*remove_source) (SpaSource *source);
void (*remove_source) (struct spa_source *source);
SpaResult (*invoke) (SpaLoop *loop,
SpaInvokeFunc func,
uint32_t seq,
size_t size,
void *data,
void *user_data);
int (*invoke) (struct spa_loop *loop,
spa_invoke_func_t func,
uint32_t seq,
size_t size,
void *data,
void *user_data);
};
#define spa_loop_add_source(l,...) (l)->add_source((l),__VA_ARGS__)
@ -93,30 +93,30 @@ struct _SpaLoop {
#define spa_loop_remove_source(l,...) (l)->remove_source(__VA_ARGS__)
#define spa_loop_invoke(l,...) (l)->invoke((l),__VA_ARGS__)
typedef void (*SpaLoopHook) (SpaLoopControl *ctrl,
void *data);
typedef void (*spa_loop_hook_t) (struct spa_loop_control *ctrl,
void *data);
/**
* SpaLoopControl:
* spa_loop_control:
*
* Control an event loop
*/
struct _SpaLoopControl {
struct spa_loop_control {
/* the total size of this structure. This can be used to expand this
* structure in the future */
size_t size;
int (*get_fd) (SpaLoopControl *ctrl);
int (*get_fd) (struct spa_loop_control *ctrl);
void (*set_hooks) (SpaLoopControl *ctrl,
SpaLoopHook pre_hook,
SpaLoopHook post_hook,
void *data);
void (*set_hooks) (struct spa_loop_control *ctrl,
spa_loop_hook_t pre_hook,
spa_loop_hook_t post_hook,
void *data);
void (*enter) (SpaLoopControl *ctrl);
void (*leave) (SpaLoopControl *ctrl);
void (*enter) (struct spa_loop_control *ctrl);
void (*leave) (struct spa_loop_control *ctrl);
SpaResult (*iterate) (SpaLoopControl *ctrl,
int timeout);
int (*iterate) (struct spa_loop_control *ctrl,
int timeout);
};
#define spa_loop_control_get_fd(l) (l)->get_fd(l)
@ -126,69 +126,69 @@ struct _SpaLoopControl {
#define spa_loop_control_leave(l) (l)->leave(l)
typedef void (*SpaSourceIOFunc) (SpaLoopUtils *utils,
SpaSource *source,
int fd,
SpaIO mask,
void *data);
typedef void (*SpaSourceIdleFunc) (SpaLoopUtils *utils,
SpaSource *source,
void *data);
typedef void (*SpaSourceEventFunc) (SpaLoopUtils *utils,
SpaSource *source,
void *data);
typedef void (*SpaSourceTimerFunc) (SpaLoopUtils *utils,
SpaSource *source,
void *data);
typedef void (*SpaSourceSignalFunc) (SpaLoopUtils *utils,
SpaSource *source,
int signal_number,
void *data);
typedef void (*spa_source_io_func_t) (struct spa_loop_utils *utils,
struct spa_source *source,
int fd,
enum spa_io mask,
void *data);
typedef void (*spa_source_idle_func_t) (struct spa_loop_utils *utils,
struct spa_source *source,
void *data);
typedef void (*spa_source_event_func_t) (struct spa_loop_utils *utils,
struct spa_source *source,
void *data);
typedef void (*spa_source_timer_func_t) (struct spa_loop_utils *utils,
struct spa_source *source,
void *data);
typedef void (*spa_source_signal_func_t) (struct spa_loop_utils *utils,
struct spa_source *source,
int signal_number,
void *data);
/**
* SpaLoopUtils:
* struct spa_loop_utils:
*
* Create sources for an event loop
*/
struct _SpaLoopUtils {
struct spa_loop_utils {
/* the total size of this structure. This can be used to expand this
* structure in the future */
size_t size;
SpaSource * (*add_io) (SpaLoopUtils *utils,
int fd,
SpaIO mask,
bool close,
SpaSourceIOFunc func,
void *data);
SpaResult (*update_io) (SpaSource *source,
SpaIO mask);
struct spa_source * (*add_io) (struct spa_loop_utils *utils,
int fd,
enum spa_io mask,
bool close,
spa_source_io_func_t func,
void *data);
int (*update_io) (struct spa_source *source,
enum spa_io mask);
SpaSource * (*add_idle) (SpaLoopUtils *utils,
bool enabled,
SpaSourceIdleFunc func,
void *data);
void (*enable_idle) (SpaSource *source,
bool enabled);
struct spa_source * (*add_idle) (struct spa_loop_utils *utils,
bool enabled,
spa_source_idle_func_t func,
void *data);
void (*enable_idle) (struct spa_source *source,
bool enabled);
SpaSource * (*add_event) (SpaLoopUtils *utils,
SpaSourceEventFunc func,
void *data);
void (*signal_event) (SpaSource *source);
struct spa_source * (*add_event) (struct spa_loop_utils *utils,
spa_source_event_func_t func,
void *data);
void (*signal_event) (struct spa_source *source);
SpaSource * (*add_timer) (SpaLoopUtils *utils,
SpaSourceTimerFunc func,
void *data);
SpaResult (*update_timer) (SpaSource *source,
struct timespec *value,
struct timespec *interval,
bool absolute);
SpaSource * (*add_signal) (SpaLoopUtils *utils,
int signal_number,
SpaSourceSignalFunc func,
void *data);
struct spa_source * (*add_timer) (struct spa_loop_utils *utils,
spa_source_timer_func_t func,
void *data);
int (*update_timer) (struct spa_source *source,
struct timespec *value,
struct timespec *interval,
bool absolute);
struct spa_source * (*add_signal) (struct spa_loop_utils *utils,
int signal_number,
spa_source_signal_func_t func,
void *data);
void (*destroy_source) (SpaSource *source);
void (*destroy_source) (struct spa_source *source);
};
#define spa_loop_utils_add_io(l,...) (l)->add_io(l,__VA_ARGS__)

View file

@ -37,16 +37,16 @@ extern "C" {
#define SPA_TYPE_META__Ringbuffer SPA_TYPE_META_BASE "Ringbuffer"
#define SPA_TYPE_META__Shared SPA_TYPE_META_BASE "Shared"
typedef struct {
struct spa_type_meta {
uint32_t Header;
uint32_t Pointer;
uint32_t VideoCrop;
uint32_t Ringbuffer;
uint32_t Shared;
} SpaTypeMeta;
};
static inline void
spa_type_meta_map (SpaTypeMap *map, SpaTypeMeta *type)
spa_type_meta_map (struct spa_type_map *map, struct spa_type_meta *type)
{
if (type->Header == 0) {
type->Header = spa_type_map_get_id (map, SPA_TYPE_META__Header);
@ -58,14 +58,14 @@ spa_type_meta_map (SpaTypeMap *map, SpaTypeMeta *type)
}
/**
* SpaMetaHeader:
* spa_meta_header:
* @flags: extra flags
* @seq: sequence number. This monotonically increments and with the rate,
* it can be used to derive a media time.
* @pts: The MONOTONIC time for @seq.
* @dts_offset: offset relative to @pts to start decoding this buffer.
*/
typedef struct {
struct spa_meta_header {
#define SPA_META_HEADER_FLAG_DISCONT (1 << 0) /* data is not continous with previous buffer */
#define SPA_META_HEADER_FLAG_CORRUPTED (1 << 1) /* data might be corrupted */
#define SPA_META_HEADER_FLAG_MARKER (1 << 2) /* media specific marker */
@ -76,58 +76,58 @@ typedef struct {
uint32_t seq;
int64_t pts;
int64_t dts_offset;
} SpaMetaHeader;
};
typedef struct {
struct spa_meta_pointer {
uint32_t type;
void *ptr;
} SpaMetaPointer;
};
/**
* SpaMetaVideoCrop:
* spa_meta_video_crop:
* @x:
* @y:
* @width:
* @height
*/
typedef struct {
struct spa_meta_video_crop {
int32_t x, y;
int32_t width, height;
} SpaMetaVideoCrop;
};
/**
* SpaMetaRingbuffer:
* spa_meta_ringbuffer:
* @ringbuffer:
*/
typedef struct {
SpaRingbuffer ringbuffer;
} SpaMetaRingbuffer;
struct spa_meta_ringbuffer {
struct spa_ringbuffer ringbuffer;
};
/**
* SpaMetaShared:
* spa_meta_shared:
* @flags: flags
* @fd: the fd of the memory
* @offset: start offset of memory
* @size: size of the memory
*/
typedef struct {
struct spa_meta_shared {
int32_t flags;
int fd;
int32_t offset;
uint32_t size;
} SpaMetaShared;
};
/**
* SpaMeta:
* spa_meta:
* @type: metadata type
* @data: pointer to metadata
* @size: size of metadata
*/
typedef struct {
struct spa_meta {
uint32_t type;
void *data;
uint32_t size;
} SpaMeta;
};
#ifdef __cplusplus
} /* extern "C" */

View file

@ -24,8 +24,7 @@
extern "C" {
#endif
typedef struct _SpaMonitor SpaMonitor;
struct spa_monitor;
#define SPA_TYPE__Monitor SPA_TYPE_INTERFACE_BASE "Monitor"
#define SPA_TYPE_MONITOR_BASE SPA_TYPE__Monitor ":"
@ -33,7 +32,6 @@ typedef struct _SpaMonitor SpaMonitor;
#include <spa/dict.h>
#include <spa/event.h>
typedef SpaEvent SpaEventMonitor;
#define SPA_TYPE_EVENT__Monitor SPA_TYPE_EVENT_BASE "Monitor"
#define SPA_TYPE_EVENT_MONITOR_BASE SPA_TYPE_EVENT__Monitor ":"
@ -41,7 +39,9 @@ typedef SpaEvent SpaEventMonitor;
#define SPA_TYPE_EVENT_MONITOR__Removed SPA_TYPE_EVENT_MONITOR_BASE "Removed"
#define SPA_TYPE_EVENT_MONITOR__Changed SPA_TYPE_EVENT_MONITOR_BASE "Changed"
typedef SpaPODObject SpaMonitorItem;
struct spa_monitor_item {
struct spa_pod_object object;
};
#define SPA_TYPE__MonitorItem SPA_TYPE_POD_OBJECT_BASE "MonitorItem"
#define SPA_TYPE_MONITOR_ITEM_BASE SPA_TYPE__MonitorItem ":"
@ -53,7 +53,7 @@ typedef SpaPODObject SpaMonitorItem;
#define SPA_TYPE_MONITOR_ITEM__info SPA_TYPE_MONITOR_ITEM_BASE "info"
#define SPA_TYPE_MONITOR_ITEM__factory SPA_TYPE_MONITOR_ITEM_BASE "factory"
typedef struct {
struct spa_type_monitor {
uint32_t Monitor;
uint32_t Added;
@ -68,10 +68,10 @@ typedef struct {
uint32_t klass;
uint32_t info;
uint32_t factory;
} SpaTypeMonitor;
};
static inline void
spa_type_monitor_map (SpaTypeMap *map, SpaTypeMonitor *type)
spa_type_monitor_map (struct spa_type_map *map, struct spa_type_monitor *type)
{
if (type->Added == 0) {
type->Monitor = spa_type_map_get_id (map, SPA_TYPE__Monitor);
@ -89,75 +89,72 @@ spa_type_monitor_map (SpaTypeMap *map, SpaTypeMonitor *type)
}
}
typedef enum {
enum spa_monitor_item_flags {
SPA_MONITOR_ITEM_FLAG_NONE = 0,
} SpaMonitorItemFlags;
};
/**
* SpaMonitorItemState:
* spa_monitor_item_state:
* @SPA_MONITOR_ITEM_STATE_AVAILABLE: The item is available
* @SPA_MONITOR_ITEM_STATE_DISABLED: the item is disabled
* @SPA_MONITOR_ITEM_STATE_UNAVAILABLE: the item is unavailable
*/
typedef enum {
enum spa_monitor_item_state {
SPA_MONITOR_ITEM_STATE_AVAILABLE,
SPA_MONITOR_ITEM_STATE_DISABLED,
SPA_MONITOR_ITEM_STATE_UNAVAILABLE,
} SpaMonitorItemState;
};
/**
* SpaMonitorCallback:
* @node: a #SpaMonitor emiting the event
* @event: the event that was emited
* @user_data: user data provided when registering the callback
*
* This will be called when a monitor event is notified
* on @monitor.
* spa_monitor_callbacks:
*/
typedef void (*SpaEventMonitorCallback) (SpaMonitor *monitor,
SpaEventMonitor *event,
void *user_data);
struct spa_monitor_callbacks {
void (*event) (struct spa_monitor *monitor,
struct spa_event *event,
void *user_data);
};
/**
* SpaMonitor:
* spa_monitor:
*
* The device monitor interface.
*/
struct _SpaMonitor {
struct spa_monitor {
/**
* SpaMonitor::info
* spa_monitor::info
*
* Extra information about the monitor
*/
const SpaDict * info;
const struct spa_dict* info;
/* the total size of this monitor. This can be used to expand this
* structure in the future */
size_t size;
/**
* SpaMonitor::set_event_callback:
* @monitor: a #SpaMonitor
* @callback: a #SpaEventMonitorCallback
* spa_monitor::set_callbacks:
* @monitor: a #spa_monitor
* @callback: a #callbacks
* @user_data: extra user data
*
* Set an event callback to receive asynchronous notifications from
* Set callbacks to receive asynchronous notifications from
* the monitor.
*
* Returns: #SPA_RESULT_OK on success
*/
SpaResult (*set_event_callback) (SpaMonitor *monitor,
SpaEventMonitorCallback callback,
void *user_data);
int (*set_callbacks) (struct spa_monitor *monitor,
const struct spa_monitor_callbacks *callbacks,
size_t callbacks_size,
void *user_data);
SpaResult (*enum_items) (SpaMonitor *monitor,
SpaMonitorItem **item,
uint32_t index);
int (*enum_items) (struct spa_monitor *monitor,
struct spa_monitor_item **item,
uint32_t index);
};
#define spa_monitor_set_event_callback(m,...) (m)->set_event_callback((m),__VA_ARGS__)
#define spa_monitor_enum_items(m,...) (m)->enum_items((m),__VA_ARGS__)
#define spa_monitor_set_callbacks(m,...) (m)->set_callbacks((m),__VA_ARGS__)
#define spa_monitor_enum_items(m,...) (m)->enum_items((m),__VA_ARGS__)
#ifdef __cplusplus
} /* extern "C" */

View file

@ -24,11 +24,11 @@
extern "C" {
#endif
typedef struct _SpaNode SpaNode;
#define SPA_TYPE__Node SPA_TYPE_INTERFACE_BASE "Node"
#define SPA_TYPE_NODE_BASE SPA_TYPE__Node ":"
struct spa_node;
#include <spa/defs.h>
#include <spa/plugin.h>
#include <spa/props.h>
@ -38,14 +38,14 @@ typedef struct _SpaNode SpaNode;
#include <spa/buffer.h>
#include <spa/format.h>
typedef struct {
uint64_t offset;
uint32_t min_size;
uint32_t max_size;
} SpaRange;
struct spa_range {
uint64_t offset;
uint32_t min_size;
uint32_t max_size;
};
/**
* SpaPortIO:
* struct spa_port_io:
* @status: the status
* @buffer_id: a buffer id
* @range: requested range
@ -53,20 +53,20 @@ typedef struct {
* IO information for a port on a node. This is allocated
* by the host and configured on all ports for which IO is requested.
*/
typedef struct {
uint32_t status;
uint32_t buffer_id;
SpaRange range;
} SpaPortIO;
struct spa_port_io {
uint32_t status;
uint32_t buffer_id;
struct spa_range range;
};
#define SPA_PORT_IO_INIT (SpaPortIO) { SPA_RESULT_NEED_BUFFER, SPA_ID_INVALID, }
#define SPA_PORT_IO_INIT (struct spa_port_io) { SPA_RESULT_NEED_BUFFER, SPA_ID_INVALID, }
/**
* SpaPortInfo
* struct spa_port_info
* @flags: extra port flags
* @rate: rate of sequence number increment per second of media data
*/
typedef struct {
struct spa_port_info {
#define SPA_PORT_INFO_FLAG_REMOVABLE (1<<0) /* port can be removed */
#define SPA_PORT_INFO_FLAG_OPTIONAL (1<<1) /* processing on port is optional */
#define SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS (1<<2) /* the port can allocate buffer data */
@ -76,27 +76,27 @@ typedef struct {
#define SPA_PORT_INFO_FLAG_NO_REF (1<<5) /* the port does not keep a ref on the buffer */
#define SPA_PORT_INFO_FLAG_LIVE (1<<6) /* output buffers from this port are timestamped against
* a live clock. */
uint32_t flags;
uint32_t rate;
} SpaPortInfo;
uint32_t flags;
uint32_t rate;
};
typedef struct {
struct spa_node_callbacks {
/**
* SpaNodeCallbacks::event:
* @node: a #SpaNode
* struct spa_node_callbacks::event:
* @node: a #struct spa_node
* @event: the event that was emited
* @user_data: user data provided when registering the callbacks
*
* This will be called when an out-of-bound event is notified
* on @node. the callback can be called from any thread.
*/
void (*event) (SpaNode *node,
SpaEvent *event,
void *user_data);
void (*event) (struct spa_node *node,
struct spa_event *event,
void *user_data);
/**
* SpaNodeCallbacks::need_input:
* @node: a #SpaNode
* struct spa_node_callbacks::need_input:
* @node: a #struct spa_node
* @user_data: user data provided when registering the callbacks
*
* The node needs more input. This callback is called from the
@ -105,11 +105,11 @@ typedef struct {
* When this function is NULL, synchronous operation is requested
* on the input ports.
*/
void (*need_input) (SpaNode *node,
void *user_data);
void (*need_input) (struct spa_node *node,
void *user_data);
/**
* SpaNodeCallbacks::have_output:
* @node: a #SpaNode
* struct spa_node_callbacks::have_output:
* @node: a #struct spa_node
* @user_data: user data provided when registering the callbacks
*
* The node has output input. This callback is called from the
@ -118,11 +118,11 @@ typedef struct {
* When this function is NULL, synchronous operation is requested
* on the output ports.
*/
void (*have_output) (SpaNode *node,
void *user_data);
void (*have_output) (struct spa_node *node,
void *user_data);
/**
* SpaNodeCallbacks::reuse_buffer:
* @node: a #SpaNode
* struct spa_node_callbacks::reuse_buffer:
* @node: a #struct spa_node
* @port_id: an input port_id
* @buffer_id: the buffer id to be reused
* @user_data: user data provided when registering the callbacks
@ -133,40 +133,40 @@ typedef struct {
* When this function is NULL, the buffers to reuse will be set in
* the io area or the input ports.
*/
void (*reuse_buffer) (SpaNode *node,
uint32_t port_id,
uint32_t buffer_id,
void *user_data);
} SpaNodeCallbacks;
void (*reuse_buffer) (struct spa_node *node,
uint32_t port_id,
uint32_t buffer_id,
void *user_data);
};
/**
* SpaNode:
* struct spa_node:
*
* A SpaNode is a component that can comsume and produce buffers.
* A struct spa_node is a component that can comsume and produce buffers.
*
*
*
*/
struct _SpaNode {
struct spa_node {
/* the total size of this node. This can be used to expand this
* structure in the future */
size_t size;
/**
* SpaNode::info
* spa_node::info
*
* Extra information about the node
*/
const SpaDict * info;
const struct spa_dict *info;
/**
* SpaNode::get_props:
* @node: a #SpaNode
* @props: a location for a #SpaProps pointer
* spa_node::get_props:
* @node: a #spa_node
* @props: a location for a #struct spa_props pointer
*
* Get the configurable properties of @node.
*
* The returned @props is a snapshot of the current configuration and
* can be modified. The modifications will take effect after a call
* to SpaNode::set_props.
* to spa_node::set_props.
*
* This function must be called from the main thread.
*
@ -175,18 +175,18 @@ struct _SpaNode {
* #SPA_RESULT_NOT_IMPLEMENTED when there are no properties
* implemented on @node
*/
SpaResult (*get_props) (SpaNode *node,
SpaProps **props);
int (*get_props) (struct spa_node *node,
struct spa_props **props);
/**
* SpaNode::set_props:
* @node: a #SpaNode
* @props: a #SpaProps
* struct spa_node::set_props:
* @node: a #struct spa_node
* @props: a #struct spa_props
*
* Set the configurable properties in @node.
*
* Usually, @props will be obtained from SpaNode::get_props and then
* modified but it is also possible to set another #SpaProps object
* as long as its keys and types match those of SpaProps::get_props.
* Usually, @props will be obtained from struct spa_node::get_props and then
* modified but it is also possible to set another #struct spa_props object
* as long as its keys and types match those of struct spa_props::get_props.
*
* Properties with keys that are not known are ignored.
*
@ -201,12 +201,12 @@ struct _SpaNode {
* #SPA_RESULT_WRONG_PROPERTY_TYPE when a property has the wrong
* type.
*/
SpaResult (*set_props) (SpaNode *node,
const SpaProps *props);
int (*set_props) (struct spa_node *node,
const struct spa_props *props);
/**
* SpaNode::send_command:
* @node: a #SpaNode
* @command: a #SpaCommand
* struct spa_node::send_command:
* @node: a #struct spa_node
* @command: a #spa_command
*
* Send a command to @node.
*
@ -220,11 +220,11 @@ struct _SpaNode {
* #SPA_RESULT_INVALID_COMMAND @command is an invalid command
* #SPA_RESULT_ASYNC @command is executed asynchronously
*/
SpaResult (*send_command) (SpaNode *node,
SpaCommand *command);
int (*send_command) (struct spa_node *node,
struct spa_command *command);
/**
* SpaNode::set_event_callback:
* @node: a #SpaNode
* struct spa_node::set_event_callback:
* @node: a #struct spa_node
* @callbacks: callbacks to set
* @callbacks_size: size of the callbacks structure
* @user_data: user data passed to the callback functions
@ -237,13 +237,13 @@ struct _SpaNode {
* Returns: #SPA_RESULT_OK on success
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
*/
SpaResult (*set_callbacks) (SpaNode *node,
const SpaNodeCallbacks *callbacks,
size_t callbacks_size,
void *user_data);
int (*set_callbacks) (struct spa_node *node,
const struct spa_node_callbacks *callbacks,
size_t callbacks_size,
void *user_data);
/**
* SpaNode::get_n_ports:
* @node: a #SpaNode
* struct spa_node::get_n_ports:
* @node: a #struct spa_node
* @n_input_ports: location to hold the number of input ports or %NULL
* @max_input_ports: location to hold the maximum number of input ports or %NULL
* @n_output_ports: location to hold the number of output ports or %NULL
@ -257,14 +257,14 @@ struct _SpaNode {
* Returns: #SPA_RESULT_OK on success
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
*/
SpaResult (*get_n_ports) (SpaNode *node,
uint32_t *n_input_ports,
uint32_t *max_input_ports,
uint32_t *n_output_ports,
uint32_t *max_output_ports);
int (*get_n_ports) (struct spa_node *node,
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
* struct spa_node::get_port_ids:
* @node: a #struct spa_node
* @n_input_ports: size of the @input_ids array
* @input_ids: array to store the input stream ids
* @n_output_ports: size of the @output_ids array
@ -277,16 +277,16 @@ struct _SpaNode {
* Returns: #SPA_RESULT_OK on success
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
*/
SpaResult (*get_port_ids) (SpaNode *node,
uint32_t n_input_ports,
uint32_t *input_ids,
uint32_t n_output_ports,
uint32_t *output_ids);
int (*get_port_ids) (struct spa_node *node,
uint32_t n_input_ports,
uint32_t *input_ids,
uint32_t n_output_ports,
uint32_t *output_ids);
/**
* SpaNode::add_port:
* @node: a #SpaNode
* @direction: a #SpaDirection
* struct spa_node::add_port:
* @node: a #struct spa_node
* @direction: a #enum spa_direction
* @port_id: an unused port id
*
* Make a new port with @port_id. The called should use get_port_ids() to
@ -299,17 +299,17 @@ struct _SpaNode {
* Returns: #SPA_RESULT_OK on success
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
*/
SpaResult (*add_port) (SpaNode *node,
SpaDirection direction,
uint32_t port_id);
SpaResult (*remove_port) (SpaNode *node,
SpaDirection direction,
uint32_t port_id);
int (*add_port) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id);
int (*remove_port) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id);
/**
* SpaNode::port_enum_formats:
* @node: a #SpaNode
* @direction: a #SpaDirection
* struct spa_node::port_enum_formats:
* @node: a #struct spa_node
* @direction: a #enum spa_direction
* @port_id: the port to query
* @format: pointer to a format
* @filter: a format filter
@ -324,7 +324,7 @@ struct _SpaNode {
* returns #SPA_RESULT_ENUM_END.
*
* The result format can be queried and modified and ultimately be used
* to call SpaNode::port_set_format.
* to call struct spa_node::port_set_format.
*
* This function must be called from the main thread.
*
@ -333,19 +333,19 @@ struct _SpaNode {
* #SPA_RESULT_INVALID_PORT when port_id is not valid
* #SPA_RESULT_ENUM_END when no format exists
*/
SpaResult (*port_enum_formats) (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaFormat **format,
const SpaFormat *filter,
uint32_t index);
int (*port_enum_formats) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_format **format,
const struct spa_format *filter,
uint32_t index);
/**
* SpaNode::port_set_format:
* @node: a #SpaNode
* @direction: a #SpaDirection
* struct spa_node::port_set_format:
* @node: a #struct spa_node
* @direction: a #enum spa_direction
* @port_id: the port to configure
* @flags: flags
* @format: a #SpaFormat with the format
* @format: a #struct spa_format with the format
*
* Set a format on @port_id of @node.
*
@ -361,7 +361,7 @@ struct _SpaNode {
* Returns: #SPA_RESULT_OK on success
* #SPA_RESULT_OK_RECHECK on success, the value of @format might have been
* changed depending on @flags and the final value can be found by
* doing SpaNode::get_format.
* doing struct spa_node::get_format.
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
* #SPA_RESULT_INVALID_PORT when port_id is not valid
* #SPA_RESULT_INVALID_MEDIA_TYPE when the media type is not valid
@ -376,19 +376,19 @@ struct _SpaNode {
#define SPA_PORT_FORMAT_FLAG_FIXATE (1 << 1) /* fixate the non-optional unset fields */
#define SPA_PORT_FORMAT_FLAG_NEAREST (1 << 2) /* allow set fields to be rounded to the
* nearest allowed field value. */
SpaResult (*port_set_format) (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
uint32_t flags,
const SpaFormat *format);
int (*port_set_format) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
uint32_t flags,
const struct spa_format *format);
/**
* SpaNode::port_get_format:
* @node: a #SpaNode
* @direction: a #SpaDirection
* struct spa_node::port_get_format:
* @node: a #struct spa_node
* @direction: a #enum spa_direction
* @port_id: the port to query
* @format: a pointer to a location to hold the #SpaFormat
* @format: a pointer to a location to hold the #struct spa_format
*
* Get the format on @port_id of @node. The result #SpaFormat can
* Get the format on @port_id of @node. The result #struct spa_format can
* not be modified.
*
* This function must be called from the main thread.
@ -398,30 +398,30 @@ struct _SpaNode {
* #SPA_RESULT_INVALID_PORT when @port_id is not valid
* #SPA_RESULT_INVALID_NO_FORMAT when no format was set
*/
SpaResult (*port_get_format) (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
const SpaFormat **format);
int (*port_get_format) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_format **format);
SpaResult (*port_get_info) (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
const SpaPortInfo **info);
int (*port_get_info) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_port_info **info);
SpaResult (*port_enum_params) (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
uint32_t index,
SpaParam **param);
SpaResult (*port_set_param) (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
const SpaParam *param);
int (*port_enum_params) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
uint32_t index,
struct spa_param **param);
int (*port_set_param) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
const struct spa_param *param);
/**
* SpaNode::port_use_buffers:
* @node: a #SpaNode
* @direction: a #SpaDirection
* struct spa_node::port_use_buffers:
* @node: a #struct spa_node
* @direction: a #enum spa_direction
* @port_id: a port id
* @buffers: an array of buffer pointers
* @n_buffers: number of elements in @buffers
@ -448,15 +448,15 @@ struct _SpaNode {
* Returns: #SPA_RESULT_OK on success
* #SPA_RESULT_ASYNC the function is executed asynchronously
*/
SpaResult (*port_use_buffers) (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaBuffer **buffers,
uint32_t n_buffers);
int (*port_use_buffers) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_buffer **buffers,
uint32_t n_buffers);
/**
* SpaNode::port_alloc_buffers:
* @node: a #SpaNode
* @direction: a #SpaDirection
* struct spa_node::port_alloc_buffers:
* @node: a #struct spa_node
* @direction: a #enum spa_direction
* @port_id: a port id
* @params: allocation parameters
* @n_params: number of elements in @params
@ -480,7 +480,7 @@ struct _SpaNode {
* node to PAUSED, when the node has enough buffers on all ports.
*
* Once the port has allocated buffers, the memory of the buffers can be
* released again by calling SpaNode::port_use_buffers with %NULL.
* released again by calling struct spa_node::port_use_buffers with %NULL.
*
* This function must be called from the main thread.
*
@ -488,19 +488,19 @@ struct _SpaNode {
* #SPA_RESULT_ERROR when the node already has allocated buffers.
* #SPA_RESULT_ASYNC the function is executed asynchronously
*/
SpaResult (*port_alloc_buffers) (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaParam **params,
uint32_t n_params,
SpaBuffer **buffers,
uint32_t *n_buffers);
int (*port_alloc_buffers) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_param **params,
uint32_t n_params,
struct spa_buffer **buffers,
uint32_t *n_buffers);
/**
* SpaNode::port_set_io:
* @direction: a #SpaDirection
* struct spa_node::port_set_io:
* @direction: a #enum spa_direction
* @port_id: a port id
* @io: a #SpaPortIO
* @io: a #struct spa_port_io
*
* Configure the given io structure on @port_id. This
* structure is allocated by the host and is used to query the state
@ -510,14 +510,14 @@ struct _SpaNode {
*
* Returns: #SPA_RESULT_OK on success
*/
SpaResult (*port_set_io) (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaPortIO *io);
int (*port_set_io) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_port_io *io);
/**
* SpaNode::port_reuse_buffer:
* @node: a #SpaNode
* struct spa_node::port_reuse_buffer:
* @node: a #struct spa_node
* @port_id: a port id
* @buffer_id: a buffer id to reuse
*
@ -528,74 +528,87 @@ struct _SpaNode {
* Returns: #SPA_RESULT_OK on success
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
*/
SpaResult (*port_reuse_buffer) (SpaNode *node,
uint32_t port_id,
uint32_t buffer_id);
int (*port_reuse_buffer) (struct spa_node *node,
uint32_t port_id,
uint32_t buffer_id);
SpaResult (*port_send_command) (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaCommand *command);
int (*port_send_command) (struct spa_node *node,
enum spa_direction direction,
uint32_t port_id,
struct spa_command *command);
/**
* SpaNode::process_input:
* @node: a #SpaNode
* struct spa_node::process_input:
* @node: a #struct spa_node
*
* Process the input area of the node.
*
* For synchronous nodes, this function is called to start processing data
* or when process_output returned SPA_RESULT_NEED_MORE_INPUT
* or when process_output returned SPA_RESULT_NEED_BUFFER
*
* For Asynchronous node, this function is called when a NEED_INPUT event
* is received from the node.
*
* Before calling this function, you must configure SpaPortInput structures
* Before calling this function, you must configure spa_port_io structures
* configured on the input ports.
*
* The node will loop through all SpaPortInput structures and will
* process the buffers. For each port, the port info will be updated as:
* The node will loop through all spa_port_io structures and will
* process the buffers. For each port, the port io will be used as:
*
* - The buffer_id is set to SPA_ID_INVALID and the status is set to
* SPA_RESULT_OK when the buffer was successfully consumed
* - if status is set to HAVE_BUFFER, buffer_id is read and processed.
*
* - The buffer_id is untouched and the status is set to an error when
* the buffer was invalid.
* The spa_port_io of the port is then updated as follows.
*
* - The buffer_id is untouched and the status is set to SPA_RESULT_OK
* when no input was consumed. This can happen when the node does not
* need input on this port.
* - buffer_id is set to a buffer id that should be reused. SPA_ID_INVALID
* is set when there is no buffer to reuse
*
* - status is set to SPA_RESULT_OK when no new buffer is needed
*
* - status is set to SPA_RESULT_NEED_BUFFER when a new buffer is needed
* on the pad.
*
* - status is set to an error code when the buffer_id was invalid or any
* processing error happened on the port.
*
* Returns: #SPA_RESULT_OK on success or when the node is asynchronous
* #SPA_RESULT_HAVE_OUTPUT for synchronous nodes when output
* #SPA_RESULT_HAVE_BUFFER for synchronous nodes when output
* can be consumed.
* #SPA_RESULT_OUT_OF_BUFFERS for synchronous nodes when buffers
* should be released with port_reuse_buffer
* #SPA_RESULT_ERROR when one of the inputs is in error
*/
SpaResult (*process_input) (SpaNode *node);
int (*process_input) (struct spa_node *node);
/**
* SpaNode::process_output:
* @node: a #SpaNode
* struct spa_node::process_output:
* @node: a #struct spa_node
*
* Tell the node to produce more output.
*
* Before calling this function you must process the buffers and events
* in the SpaPortOutput structure and set the buffer_id to SPA_ID_INVALID
* for all consumed buffers. Buffers that you do not want to consume should
* be returned to the node with port_reuse_buffer.
* Tell the node that output is consumed.
*
* For synchronous nodes, this function can be called when process_input
* returned #SPA_RESULT_HAVE_ENOUGH_INPUT.
* returned #SPA_RESULT_HAVE_BUFFER.
*
* For Asynchronous node, this function is called when a HAVE_OUTPUT event
* is received from the node.
*
* Before calling this function you must process the buffers
* in each of the output ports spa_port_io structure as follows:
*
* - use the buffer_id from the io for all the ports where the status is
* SPA_RESULT_HAVE_BUFFER
*
* - set buffer_id to a buffer_id you would like to reuse or SPA_ID_INVALID
* when no buffer is to be reused.
*
* - set the status to SPA_RESULT_NEED_BUFFER for all port you want more
* output from
*
* - set the status to SPA_RESULT_OK for the port you don't want more
* buffer from.
*
* Returns: #SPA_RESULT_OK on success or when the node is asynchronous
* #SPA_RESULT_NEED_INPUT for synchronous nodes when input
* #SPA_RESULT_NEED_BUFFER for synchronous nodes when input
* is needed.
* #SPA_RESULT_ERROR when one of the outputs is in error
*/
SpaResult (*process_output) (SpaNode *node);
int (*process_output) (struct spa_node *node);
};
#define spa_node_get_props(n,...) (n)->get_props((n),__VA_ARGS__)

View file

@ -39,16 +39,17 @@ extern "C" {
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__buffers SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "buffers"
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__align SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "align"
typedef struct {
struct spa_type_param_alloc_buffers {
uint32_t Buffers;
uint32_t size;
uint32_t stride;
uint32_t buffers;
uint32_t align;
} SpaTypeParamAllocBuffers;
};
static inline void
spa_type_param_alloc_buffers_map (SpaTypeMap *map, SpaTypeParamAllocBuffers *type)
spa_type_param_alloc_buffers_map (struct spa_type_map *map,
struct spa_type_param_alloc_buffers *type)
{
if (type->Buffers == 0) {
type->Buffers = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC__Buffers);
@ -69,7 +70,7 @@ spa_type_param_alloc_buffers_map (SpaTypeMap *map, SpaTypeParamAllocBuffers *typ
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferBlocks SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferBlocks"
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferAlign SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferAlign"
typedef struct {
struct spa_type_param_alloc_meta_enable {
uint32_t MetaEnable;
uint32_t type;
uint32_t size;
@ -77,19 +78,20 @@ typedef struct {
uint32_t ringbufferStride;
uint32_t ringbufferBlocks;
uint32_t ringbufferAlign;
} SpaTypeParamAllocMetaEnable;
};
static inline void
spa_type_param_alloc_meta_enable_map (SpaTypeMap *map, SpaTypeParamAllocMetaEnable *type)
spa_type_param_alloc_meta_enable_map (struct spa_type_map *map,
struct spa_type_param_alloc_meta_enable *type)
{
if (type->MetaEnable == 0) {
type->MetaEnable = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC__MetaEnable);
type->type = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__type);
type->size = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__size);
type->ringbufferSize = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferSize);
type->ringbufferStride = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferStride);
type->ringbufferBlocks = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferBlocks);
type->ringbufferAlign = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferAlign);
type->MetaEnable = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC__MetaEnable);
type->type = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__type);
type->size = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__size);
type->ringbufferSize = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferSize);
type->ringbufferStride = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferStride);
type->ringbufferBlocks = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferBlocks);
type->ringbufferAlign = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferAlign);
}
}
@ -105,28 +107,29 @@ spa_type_param_alloc_meta_enable_map (SpaTypeMap *map, SpaTypeParamAllocMetaEnab
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign2 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign2"
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign3 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign3"
typedef struct {
struct spa_type_param_alloc_video_padding {
uint32_t VideoPadding;
uint32_t top;
uint32_t bottom;
uint32_t left;
uint32_t right;
uint32_t strideAlign[4];
} SpaTypeParamAllocVideoPadding;
};
static inline void
spa_type_param_alloc_video_padding_map (SpaTypeMap *map, SpaTypeParamAllocVideoPadding *type)
spa_type_param_alloc_video_padding_map (struct spa_type_map *map,
struct spa_type_param_alloc_video_padding *type)
{
if (type->VideoPadding == 0) {
type->VideoPadding = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC__VideoPadding);
type->top = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__top);
type->bottom = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__bottom);
type->left = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__left);
type->right = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__right);
type->strideAlign[0] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign0);
type->strideAlign[1] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign1);
type->strideAlign[2] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign2);
type->strideAlign[3] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign3);
type->VideoPadding = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC__VideoPadding);
type->top = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__top);
type->bottom = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__bottom);
type->left = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__left);
type->right = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__right);
type->strideAlign[0] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign0);
type->strideAlign[1] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign1);
type->strideAlign[2] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign2);
type->strideAlign[3] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign3);
}
}

View file

@ -24,49 +24,43 @@
extern "C" {
#endif
typedef struct _SpaParam SpaParam;
#include <spa/defs.h>
#include <spa/pod-utils.h>
struct spa_param;
#define SPA_TYPE__Param SPA_TYPE_POD_OBJECT_BASE "Param"
#define SPA_TYPE_PARAM_BASE SPA_TYPE__Param ":"
typedef struct {
SpaPODObjectBody body;
/* SpaPODProp follow */
} SpaParamBody;
struct _SpaParam {
SpaPOD pod;
SpaParamBody body;
struct spa_param {
struct spa_pod_object object;
};
static inline uint32_t
spa_param_query (const SpaParam *param, uint32_t key, ...)
spa_param_query (const struct spa_param *param, uint32_t key, ...)
{
uint32_t count;
va_list args;
va_start (args, key);
count = spa_pod_contents_queryv (&param->pod, sizeof (SpaParam), key, args);
count = spa_pod_contents_queryv (&param->object.pod, sizeof (struct spa_param), key, args);
va_end (args);
return count;
}
#define SPA_PARAM_BODY_FOREACH(body, size, iter) \
for ((iter) = SPA_MEMBER ((body), sizeof (SpaParamBody), SpaPODProp); \
(iter) < SPA_MEMBER ((body), (size), SpaPODProp); \
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), SpaPODProp))
for ((iter) = SPA_MEMBER ((body), sizeof (struct spa_pod_object_body), struct spa_pod_prop); \
(iter) < SPA_MEMBER ((body), (size), struct spa_pod_prop); \
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), struct spa_pod_prop))
#define SPA_PARAM_FOREACH(param, iter) \
SPA_PARAM_BODY_FOREACH(&param->body, SPA_POD_BODY_SIZE(param), iter)
SPA_PARAM_BODY_FOREACH(&param->object.body, SPA_POD_BODY_SIZE(param), iter)
static inline SpaResult
spa_param_fixate (SpaParam *param)
static inline int
spa_param_fixate (struct spa_param *param)
{
SpaPODProp *prop;
struct spa_pod_prop *prop;
SPA_PARAM_FOREACH (param, prop)
prop->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;

View file

@ -30,15 +30,12 @@ extern "C" {
#define SPA_TYPE__Handle SPA_TYPE_INTERFACE_BASE "Handle"
#define SPA_TYPE__HandleFactory SPA_TYPE_INTERFACE_BASE "HandleFactory"
typedef struct _SpaHandle SpaHandle;
typedef struct _SpaHandleFactory SpaHandleFactory;
struct _SpaHandle {
struct spa_handle {
/* user_data that can be set by the application */
void * user_data;
/**
* SpaHandle::get_interface:
* @handle: a #SpaHandle
* spa_handle::get_interface:
* @handle: a #spa_handle
* @interface_id: the interface id
* @interface: result to hold the interface.
*
@ -48,11 +45,11 @@ struct _SpaHandle {
* #SPA_RESULT_NOT_IMPLEMENTED when there are no extensions
* #SPA_RESULT_INVALID_ARGUMENTS when handle or info is %NULL
*/
SpaResult (*get_interface) (SpaHandle *handle,
uint32_t interface_id,
void **interface);
int (*get_interface) (struct spa_handle *handle,
uint32_t interface_id,
void **interface);
/**
* SpaHandle::clear
* spa_handle::clear
* @handle: a pointer to memory
*
* Clean up the memory of @handle. After this, @handle should not be used
@ -60,67 +57,67 @@ struct _SpaHandle {
*
* Returns: #SPA_RESULT_OK on success
*/
SpaResult (*clear) (SpaHandle *handle);
int (*clear) (struct spa_handle *handle);
};
#define spa_handle_get_interface(h,...) (h)->get_interface((h),__VA_ARGS__)
#define spa_handle_clear(h) (h)->clear((h))
/**
* SpaInterfaceInfo:
* struct spa_interface_info:
* @type: the type of the interface, can be used to get the interface
*
* This structure lists the information about available interfaces on
* handles.
*/
typedef struct {
struct spa_interface_info {
const char *type;
} SpaInterfaceInfo;
};
/**
* SpaSupport:
* struct spa_support:
* @type: the type of the support item
* @data: specific data for the item
*
* Extra supporting infrastructure passed to the init() function of
* a factory. It can be extra information or interfaces such as logging.
*/
typedef struct {
struct spa_support {
const char *type;
void *data;
} SpaSupport;
};
struct _SpaHandleFactory {
struct spa_handle_factory {
/**
* SpaHandleFactory::name
* spa_handle_factory::name
*
* The name
*/
const char * name;
/**
* SpaHandleFactory::info
* spa_handle_factory::info
*
* Extra information about the handles of this factory.
*/
const SpaDict * info;
const struct spa_dict * info;
/**
* SpaHandleFactory::size
* spa_handle_factory::size
*
* The size of handles from this factory
*/
const size_t size;
/**
* SpaHandleFactory::init
* @factory: a #SpaHandleFactory
* spa_handle_factory::init
* @factory: a #spa_handle_factory
* @handle: a pointer to memory
* @info: extra handle specific information, usually obtained
* from a #SpaMonitor. This can be used to configure the handle.
* from a #spa_monitor. This can be used to configure the handle.
* @support: support items
* @n_support: number of elements in @support
*
* Initialize an instance of this factory. The caller should allocate
* memory at least SpaHandleFactory::size bytes and pass this as @handle.
* memory at least spa_handle_factory::size bytes and pass this as @handle.
*
* @support can optionally contain extra interfaces or data ites that the
* plugin can use such as a logger.
@ -129,16 +126,16 @@ struct _SpaHandleFactory {
* #SPA_RESULT_NOT_IMPLEMENTED when an instance can't be made
* #SPA_RESULT_INVALID_ARGUMENTS when factory or handle are %NULL
*/
SpaResult (*init) (const SpaHandleFactory *factory,
SpaHandle *handle,
const SpaDict *info,
const SpaSupport *support,
uint32_t n_support);
int (*init) (const struct spa_handle_factory *factory,
struct spa_handle *handle,
const struct spa_dict *info,
const struct spa_support *support,
uint32_t n_support);
/**
* SpaHandle::enum_interface_info:
* @factory: a #SpaHandleFactory
* @info: result to hold SpaInterfaceInfo.
* spa_handle_factory::enum_interface_info:
* @factory: a #spa_handle_factory
* @info: result to hold spa_interface_info.
* @index: index to keep track of the enumeration, 0 for first item
*
* Enumerate the interface information for @factory.
@ -148,16 +145,16 @@ struct _SpaHandleFactory {
* #SPA_RESULT_INVALID_ARGUMENTS when handle or info is %NULL
* #SPA_RESULT_ENUM_END when there are no more infos
*/
SpaResult (*enum_interface_info) (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info,
uint32_t index);
int (*enum_interface_info) (const struct spa_handle_factory *factory,
const struct spa_interface_info **info,
uint32_t index);
};
#define spa_handle_factory_init(h,...) (h)->init((h),__VA_ARGS__)
#define spa_handle_factory_enum_interface_info(h,...) (h)->enum_interface_info((h),__VA_ARGS__)
/**
* SpaEnumHandleFactoryFunc:
* spa_handle_factory_enum_func_t:
* @factory: a location to hold the factory result
* @index: index to keep track of the enumeration
*
@ -167,11 +164,13 @@ struct _SpaHandleFactory {
* #SPA_RESULT_INVALID_ARGUMENTS when factory is %NULL
* #SPA_RESULT_ENUM_END when there are no more factories
*/
typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory,
uint32_t index);
typedef int (*spa_handle_factory_enum_func_t) (const struct spa_handle_factory **factory,
uint32_t index);
#define SPA_HANDLE_FACTORY_ENUM_FUNC_NAME "spa_handle_factory_enum"
/**
* spa_enum_handle_factory:
* spa_handle_factory_enum:
* @factory: a location to hold the factory result
* @index: index to keep track of the enumeration
*
@ -181,8 +180,8 @@ typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory,
* #SPA_RESULT_INVALID_ARGUMENTS when factory is %NULL
* #SPA_RESULT_ENUM_END when there are no more factories
*/
SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory,
uint32_t index);
int spa_handle_factory_enum (const struct spa_handle_factory **factory,
uint32_t index);
#ifdef __cplusplus
} /* extern "C" */

View file

@ -28,30 +28,30 @@ extern "C" {
#include <stdio.h>
#include <spa/pod-utils.h>
typedef struct _SpaPODFrame {
struct _SpaPODFrame *parent;
SpaPOD pod;
uint32_t ref;
} SpaPODFrame;
struct spa_pod_frame {
struct spa_pod_frame *parent;
struct spa_pod pod;
uint32_t ref;
};
typedef struct _SpaPODBuilder {
struct spa_pod_builder {
void *data;
uint32_t size;
uint32_t offset;
SpaPODFrame *stack;
uint32_t (*write) (struct _SpaPODBuilder *builder, uint32_t ref, const void *data, uint32_t size);
struct spa_pod_frame *stack;
uint32_t (*write) (struct spa_pod_builder *builder, uint32_t ref, const void *data, uint32_t size);
bool in_array;
bool first;
} SpaPODBuilder;
};
#define SPA_POD_BUILDER_INIT(buffer,size) { buffer, size, }
#define SPA_POD_BUILDER_DEREF(b,ref,type) SPA_MEMBER ((b)->data, (ref), type)
static inline void
spa_pod_builder_init (SpaPODBuilder *builder,
void *data,
uint32_t size)
spa_pod_builder_init (struct spa_pod_builder *builder,
void *data,
uint32_t size)
{
builder->data = data;
builder->size = size;
@ -60,10 +60,10 @@ spa_pod_builder_init (SpaPODBuilder *builder,
}
static inline uint32_t
spa_pod_builder_push (SpaPODBuilder *builder,
SpaPODFrame *frame,
const SpaPOD *pod,
uint32_t ref)
spa_pod_builder_push (struct spa_pod_builder *builder,
struct spa_pod_frame *frame,
const struct spa_pod *pod,
uint32_t ref)
{
frame->parent = builder->stack;
frame->pod = *pod;
@ -75,10 +75,10 @@ spa_pod_builder_push (SpaPODBuilder *builder,
}
static inline uint32_t
spa_pod_builder_raw (SpaPODBuilder *builder, const void *data, uint32_t size)
spa_pod_builder_raw (struct spa_pod_builder *builder, const void *data, uint32_t size)
{
uint32_t ref;
SpaPODFrame *f;
struct spa_pod_frame *f;
if (builder->write) {
ref = builder->write (builder, -1, data, size);
@ -98,7 +98,7 @@ spa_pod_builder_raw (SpaPODBuilder *builder, const void *data, uint32_t size)
}
static void
spa_pod_builder_pad (SpaPODBuilder *builder, uint32_t size)
spa_pod_builder_pad (struct spa_pod_builder *builder, uint32_t size)
{
uint64_t zeroes = 0;
size = SPA_ROUND_UP_N (size, 8) - size;
@ -107,7 +107,7 @@ spa_pod_builder_pad (SpaPODBuilder *builder, uint32_t size)
}
static inline uint32_t
spa_pod_builder_raw_padded (SpaPODBuilder *builder, const void *data, uint32_t size)
spa_pod_builder_raw_padded (struct spa_pod_builder *builder, const void *data, uint32_t size)
{
uint32_t ref = size ? spa_pod_builder_raw (builder, data, size) : -1;
spa_pod_builder_pad (builder, size);
@ -115,14 +115,14 @@ spa_pod_builder_raw_padded (SpaPODBuilder *builder, const void *data, uint32_t s
}
static inline void
spa_pod_builder_pop (SpaPODBuilder *builder,
SpaPODFrame *frame)
spa_pod_builder_pop (struct spa_pod_builder *builder,
struct spa_pod_frame *frame)
{
if (frame->ref != -1) {
if (builder->write)
builder->write (builder, frame->ref, &frame->pod, sizeof(SpaPOD));
builder->write (builder, frame->ref, &frame->pod, sizeof(struct spa_pod));
else
memcpy (builder->data + frame->ref, &frame->pod, sizeof(SpaPOD));
memcpy (builder->data + frame->ref, &frame->pod, sizeof(struct spa_pod));
}
builder->stack = frame->parent;
builder->in_array = (builder->stack && (builder->stack->pod.type == SPA_POD_TYPE_ARRAY ||
@ -131,7 +131,7 @@ spa_pod_builder_pop (SpaPODBuilder *builder,
}
static inline uint32_t
spa_pod_builder_primitive (SpaPODBuilder *builder, const SpaPOD *p)
spa_pod_builder_primitive (struct spa_pod_builder *builder, const struct spa_pod *p)
{
const void *data;
uint32_t size, ref;
@ -153,63 +153,63 @@ spa_pod_builder_primitive (SpaPODBuilder *builder, const SpaPOD *p)
#define SPA_POD_BOOL_INIT(val) { { sizeof (uint32_t), SPA_POD_TYPE_BOOL }, val ? 1 : 0 }
static inline uint32_t
spa_pod_builder_bool (SpaPODBuilder *builder, bool val)
spa_pod_builder_bool (struct spa_pod_builder *builder, bool val)
{
const SpaPODBool p = SPA_POD_BOOL_INIT (val);
const struct spa_pod_bool p = SPA_POD_BOOL_INIT (val);
return spa_pod_builder_primitive (builder, &p.pod);
}
#define SPA_POD_ID_INIT(val) { { sizeof (uint32_t), SPA_POD_TYPE_ID }, val }
static inline uint32_t
spa_pod_builder_id (SpaPODBuilder *builder, uint32_t val)
spa_pod_builder_id (struct spa_pod_builder *builder, uint32_t val)
{
const SpaPODId p = SPA_POD_ID_INIT (val);
const struct spa_pod_id p = SPA_POD_ID_INIT (val);
return spa_pod_builder_primitive (builder, &p.pod);
}
#define SPA_POD_INT_INIT(val) { { sizeof (uint32_t), SPA_POD_TYPE_INT }, val }
static inline uint32_t
spa_pod_builder_int (SpaPODBuilder *builder, int32_t val)
spa_pod_builder_int (struct spa_pod_builder *builder, int32_t val)
{
const SpaPODInt p = SPA_POD_INT_INIT (val);
const struct spa_pod_int p = SPA_POD_INT_INIT (val);
return spa_pod_builder_primitive (builder, &p.pod);
}
#define SPA_POD_LONG_INIT(val) { { sizeof (uint64_t), SPA_POD_TYPE_LONG }, val }
static inline uint32_t
spa_pod_builder_long (SpaPODBuilder *builder, int64_t val)
spa_pod_builder_long (struct spa_pod_builder *builder, int64_t val)
{
const SpaPODLong p = SPA_POD_LONG_INIT (val);
const struct spa_pod_long p = SPA_POD_LONG_INIT (val);
return spa_pod_builder_primitive (builder, &p.pod);
}
#define SPA_POD_FLOAT_INIT(val) { { sizeof (float), SPA_POD_TYPE_FLOAT }, val }
static inline uint32_t
spa_pod_builder_float (SpaPODBuilder *builder, float val)
spa_pod_builder_float (struct spa_pod_builder *builder, float val)
{
const SpaPODFloat p = SPA_POD_FLOAT_INIT (val);
const struct spa_pod_float p = SPA_POD_FLOAT_INIT (val);
return spa_pod_builder_primitive (builder, &p.pod);
}
#define SPA_POD_DOUBLE_INIT(val) { { sizeof (double), SPA_POD_TYPE_DOUBLE }, val }
static inline uint32_t
spa_pod_builder_double (SpaPODBuilder *builder, double val)
spa_pod_builder_double (struct spa_pod_builder *builder, double val)
{
const SpaPODDouble p = SPA_POD_DOUBLE_INIT (val);
const struct spa_pod_double p = SPA_POD_DOUBLE_INIT (val);
return spa_pod_builder_primitive (builder, &p.pod);
}
#define SPA_POD_STRING_INIT(len) { { len, SPA_POD_TYPE_STRING } }
static inline uint32_t
spa_pod_builder_string_len (SpaPODBuilder *builder, const char *str, uint32_t len)
spa_pod_builder_string_len (struct spa_pod_builder *builder, const char *str, uint32_t len)
{
const SpaPODString p = SPA_POD_STRING_INIT (len);
const struct spa_pod_string p = SPA_POD_STRING_INIT (len);
uint32_t ref = spa_pod_builder_raw (builder, &p, sizeof (p));
if (spa_pod_builder_raw_padded (builder, str, len) == -1)
ref = -1;
@ -217,7 +217,7 @@ spa_pod_builder_string_len (SpaPODBuilder *builder, const char *str, uint32_t le
}
static inline uint32_t
spa_pod_builder_string (SpaPODBuilder *builder, const char *str)
spa_pod_builder_string (struct spa_pod_builder *builder, const char *str)
{
uint32_t len = str ? strlen (str) : 0;
return spa_pod_builder_string_len (builder, str ? str : "", len + 1);
@ -226,60 +226,60 @@ spa_pod_builder_string (SpaPODBuilder *builder, const char *str)
#define SPA_POD_BYTES_INIT(len) { { len, SPA_POD_TYPE_BYTES } }
static inline uint32_t
spa_pod_builder_bytes (SpaPODBuilder *builder, const void *bytes, uint32_t len)
spa_pod_builder_bytes (struct spa_pod_builder *builder, const void *bytes, uint32_t len)
{
const SpaPODBytes p = SPA_POD_BYTES_INIT (len);
const struct spa_pod_bytes p = SPA_POD_BYTES_INIT (len);
uint32_t ref = spa_pod_builder_raw (builder, &p, sizeof (p));
if (spa_pod_builder_raw_padded (builder, bytes, len) == -1)
ref = -1;
return ref;
}
#define SPA_POD_POINTER_INIT(type,value) { { sizeof (SpaPODPointerBody), SPA_POD_TYPE_POINTER }, { type, value } }
#define SPA_POD_POINTER_INIT(type,value) { { sizeof (struct spa_pod_pointer_body), SPA_POD_TYPE_POINTER }, { type, value } }
static inline uint32_t
spa_pod_builder_pointer (SpaPODBuilder *builder, uint32_t type, void *val)
spa_pod_builder_pointer (struct spa_pod_builder *builder, uint32_t type, void *val)
{
const SpaPODPointer p = SPA_POD_POINTER_INIT (type, val);
const struct spa_pod_pointer p = SPA_POD_POINTER_INIT (type, val);
return spa_pod_builder_primitive (builder, &p.pod);
}
#define SPA_POD_RECTANGLE_INIT(width,height) { { sizeof (SpaRectangle), SPA_POD_TYPE_RECTANGLE }, { width, height } }
#define SPA_POD_RECTANGLE_INIT(width,height) { { sizeof (struct spa_rectangle), SPA_POD_TYPE_RECTANGLE }, { width, height } }
static inline uint32_t
spa_pod_builder_rectangle (SpaPODBuilder *builder, uint32_t width, uint32_t height)
spa_pod_builder_rectangle (struct spa_pod_builder *builder, uint32_t width, uint32_t height)
{
const SpaPODRectangle p = SPA_POD_RECTANGLE_INIT (width, height);
const struct spa_pod_rectangle p = SPA_POD_RECTANGLE_INIT (width, height);
return spa_pod_builder_primitive (builder, &p.pod);
}
#define SPA_POD_FRACTION_INIT(num,denom) { { sizeof (SpaFraction), SPA_POD_TYPE_FRACTION }, { num, denom } }
#define SPA_POD_FRACTION_INIT(num,denom) { { sizeof (struct spa_fraction), SPA_POD_TYPE_FRACTION }, { num, denom } }
static inline uint32_t
spa_pod_builder_fraction (SpaPODBuilder *builder, uint32_t num, uint32_t denom)
spa_pod_builder_fraction (struct spa_pod_builder *builder, uint32_t num, uint32_t denom)
{
const SpaPODFraction p = SPA_POD_FRACTION_INIT (num, denom);
const struct spa_pod_fraction p = SPA_POD_FRACTION_INIT (num, denom);
return spa_pod_builder_primitive (builder, &p.pod);
}
static inline uint32_t
spa_pod_builder_push_array (SpaPODBuilder *builder,
SpaPODFrame *frame)
spa_pod_builder_push_array (struct spa_pod_builder *builder,
struct spa_pod_frame *frame)
{
const SpaPODArray p = { { sizeof (SpaPODArrayBody) - sizeof (SpaPOD), SPA_POD_TYPE_ARRAY }, { { 0, 0 } } };
const struct spa_pod_array p = { { sizeof (struct spa_pod_array_body) - sizeof (struct spa_pod), SPA_POD_TYPE_ARRAY }, { { 0, 0 } } };
return spa_pod_builder_push (builder, frame, &p.pod,
spa_pod_builder_raw (builder, &p, sizeof(p) - sizeof(SpaPOD)));
spa_pod_builder_raw (builder, &p, sizeof(p) - sizeof(struct spa_pod)));
}
static inline uint32_t
spa_pod_builder_array (SpaPODBuilder *builder,
spa_pod_builder_array (struct spa_pod_builder *builder,
uint32_t child_size,
uint32_t child_type,
uint32_t n_elems,
const void *elems)
{
const SpaPODArray p = {
{ sizeof (SpaPODArrayBody) + n_elems * child_size, SPA_POD_TYPE_ARRAY },
const struct spa_pod_array p = {
{ sizeof (struct spa_pod_array_body) + n_elems * child_size, SPA_POD_TYPE_ARRAY },
{ { child_size, child_type } }
};
uint32_t ref = spa_pod_builder_raw (builder, &p, sizeof(p));
@ -291,10 +291,10 @@ spa_pod_builder_array (SpaPODBuilder *builder,
#define SPA_POD_STRUCT_INIT(size) { { size, SPA_POD_TYPE_STRUCT } }
static inline uint32_t
spa_pod_builder_push_struct (SpaPODBuilder *builder,
SpaPODFrame *frame)
spa_pod_builder_push_struct (struct spa_pod_builder *builder,
struct spa_pod_frame *frame)
{
const SpaPODStruct p = SPA_POD_STRUCT_INIT (0);
const struct spa_pod_struct p = SPA_POD_STRUCT_INIT (0);
return spa_pod_builder_push (builder, frame, &p.pod,
spa_pod_builder_raw (builder, &p, sizeof(p)));
}
@ -303,51 +303,52 @@ spa_pod_builder_push_struct (SpaPODBuilder *builder,
#define SPA_POD_OBJECT_INIT_COMPLEX(size,id,type,...) { { size, SPA_POD_TYPE_OBJECT }, { id, type }, __VA_ARGS__ }
static inline uint32_t
spa_pod_builder_push_object (SpaPODBuilder *builder,
SpaPODFrame *frame,
spa_pod_builder_push_object (struct spa_pod_builder *builder,
struct spa_pod_frame *frame,
uint32_t id,
uint32_t type)
{
const SpaPODObject p = SPA_POD_OBJECT_INIT (sizeof (SpaPODObjectBody), id, type);
const struct spa_pod_object p = SPA_POD_OBJECT_INIT (sizeof (struct spa_pod_object_body), id, type);
return spa_pod_builder_push (builder, frame, &p.pod,
spa_pod_builder_raw (builder, &p, sizeof(p)));
}
static inline uint32_t
spa_pod_builder_push_prop (SpaPODBuilder *builder,
SpaPODFrame *frame,
spa_pod_builder_push_prop (struct spa_pod_builder *builder,
struct spa_pod_frame *frame,
uint32_t key,
uint32_t flags)
{
const SpaPODProp p = { { sizeof (SpaPODPropBody) - sizeof(SpaPOD), SPA_POD_TYPE_PROP},
{ key, flags, { 0, 0 } } };
const struct spa_pod_prop p = { { sizeof (struct spa_pod_prop_body) -
sizeof(struct spa_pod), SPA_POD_TYPE_PROP},
{ key, flags, { 0, 0 } } };
return spa_pod_builder_push (builder, frame, &p.pod,
spa_pod_builder_raw (builder, &p, sizeof(p) - sizeof(SpaPOD)));
spa_pod_builder_raw (builder, &p, sizeof(p) - sizeof(struct spa_pod)));
}
static inline void
spa_pod_builder_addv (SpaPODBuilder *builder,
spa_pod_builder_addv (struct spa_pod_builder *builder,
uint32_t type,
va_list args)
{
uint32_t n_values = 0;
union {
SpaPOD pod;
SpaPODBool bool_pod;
SpaPODId id_pod;
SpaPODInt int_pod;
SpaPODLong long_pod;
SpaPODFloat float_pod;
SpaPODDouble double_pod;
SpaPODString string_pod;
SpaPODBytes bytes_pod;
SpaPODPointer pointer_pod;
SpaPODRectangle rectangle_pod;
SpaPODFraction fraction_pod;
SpaPODArray array_pod;
SpaPODStruct struct_pod;
SpaPODObject object_pod;
SpaPODProp prop_pod;
struct spa_pod pod;
struct spa_pod_bool bool_pod;
struct spa_pod_id id_pod;
struct spa_pod_int int_pod;
struct spa_pod_long long_pod;
struct spa_pod_float float_pod;
struct spa_pod_double double_pod;
struct spa_pod_string string_pod;
struct spa_pod_bytes bytes_pod;
struct spa_pod_pointer pointer_pod;
struct spa_pod_rectangle rectangle_pod;
struct spa_pod_fraction fraction_pod;
struct spa_pod_array array_pod;
struct spa_pod_struct struct_pod;
struct spa_pod_object object_pod;
struct spa_pod_prop prop_pod;
} head;
uint32_t head_size;
const void *body;
@ -355,7 +356,7 @@ spa_pod_builder_addv (SpaPODBuilder *builder,
static const uint64_t zeroes = 0;
while (type != SPA_POD_TYPE_INVALID) {
SpaPODFrame *f = NULL;
struct spa_pod_frame *f = NULL;
const void *data[3];
uint32_t size[3], ref, i, n_sizes = 0;
@ -368,28 +369,28 @@ spa_pod_builder_addv (SpaPODBuilder *builder,
head.int_pod.pod.type = type;
head.int_pod.pod.size = body_size = sizeof (uint32_t);
head.int_pod.value = va_arg (args, int);
head_size = sizeof (SpaPOD);
head_size = sizeof (struct spa_pod);
body = &head.int_pod.value;
goto primitive;
case SPA_POD_TYPE_LONG:
head.long_pod.pod.type = SPA_POD_TYPE_LONG;
head.long_pod.pod.size = body_size = sizeof (uint32_t);
head.long_pod.value = va_arg (args, int64_t);
head_size = sizeof (SpaPOD);
head_size = sizeof (struct spa_pod);
body = &head.long_pod.value;
goto primitive;
case SPA_POD_TYPE_FLOAT:
head.float_pod.pod.type = SPA_POD_TYPE_FLOAT;
head.float_pod.pod.size = body_size = sizeof (float);
head.float_pod.value = va_arg (args, double);
head_size = sizeof (SpaPOD);
head_size = sizeof (struct spa_pod);
body = &head.float_pod.value;
goto primitive;
case SPA_POD_TYPE_DOUBLE:
head.double_pod.pod.type = SPA_POD_TYPE_DOUBLE;
head.double_pod.pod.size = body_size = sizeof (double);
head.double_pod.value = va_arg (args, double);
head_size = sizeof (SpaPOD);
head_size = sizeof (struct spa_pod);
body = &head.double_pod.value;
goto primitive;
case SPA_POD_TYPE_STRING:
@ -397,94 +398,94 @@ spa_pod_builder_addv (SpaPODBuilder *builder,
body_size = body ? strlen (body) + 1 : (body = "", 1);
head.string_pod.pod.type = SPA_POD_TYPE_STRING;
head.string_pod.pod.size = body_size;
head_size = sizeof (SpaPOD);
head_size = sizeof (struct spa_pod);
goto primitive;
case -SPA_POD_TYPE_STRING:
body = va_arg (args, const char *);
body_size = va_arg (args, uint32_t);
head.string_pod.pod.type = SPA_POD_TYPE_STRING;
head.string_pod.pod.size = body_size;
head_size = sizeof (SpaPOD);
head_size = sizeof (struct spa_pod);
goto primitive;
case SPA_POD_TYPE_BYTES:
body = va_arg (args, void *);
body_size = va_arg (args, uint32_t);
head.bytes_pod.pod.type = SPA_POD_TYPE_BYTES;
head.bytes_pod.pod.size = body_size;
head_size = sizeof (SpaPOD);
head_size = sizeof (struct spa_pod);
goto primitive;
case SPA_POD_TYPE_POINTER:
head.pointer_pod.pod.type = SPA_POD_TYPE_POINTER;
head.pointer_pod.pod.size = body_size = sizeof (SpaPODPointerBody);
head.pointer_pod.pod.size = body_size = sizeof (struct spa_pod_pointer_body);
head.pointer_pod.body.type = va_arg (args, uint32_t);
head.pointer_pod.body.value = va_arg (args, void *);
head_size = sizeof (SpaPOD);
head_size = sizeof (struct spa_pod);
body = &head.pointer_pod.body;
goto primitive;
case SPA_POD_TYPE_RECTANGLE:
head.rectangle_pod.pod.type = SPA_POD_TYPE_RECTANGLE;
head.rectangle_pod.pod.size = body_size = sizeof (SpaRectangle);
head.rectangle_pod.pod.size = body_size = sizeof (struct spa_rectangle);
head.rectangle_pod.value.width = va_arg (args, uint32_t);
head.rectangle_pod.value.height = va_arg (args, uint32_t);
head_size = sizeof (SpaPOD);
head_size = sizeof (struct spa_pod);
body = &head.rectangle_pod.value;
goto primitive;
case -SPA_POD_TYPE_RECTANGLE:
head.rectangle_pod.pod.type = SPA_POD_TYPE_RECTANGLE;
head.rectangle_pod.pod.size = body_size = sizeof (SpaRectangle);
head.rectangle_pod.value = *va_arg (args, SpaRectangle *);
head_size = sizeof (SpaPOD);
head.rectangle_pod.pod.size = body_size = sizeof (struct spa_rectangle);
head.rectangle_pod.value = *va_arg (args, struct spa_rectangle *);
head_size = sizeof (struct spa_pod);
body = &head.rectangle_pod.value;
goto primitive;
case SPA_POD_TYPE_FRACTION:
head.fraction_pod.pod.type = SPA_POD_TYPE_FRACTION;
head.fraction_pod.pod.size = body_size = sizeof (SpaFraction);
head.fraction_pod.pod.size = body_size = sizeof (struct spa_fraction);
head.fraction_pod.value.num = va_arg (args, uint32_t);
head.fraction_pod.value.denom = va_arg (args, uint32_t);
head_size = sizeof (SpaPOD);
head_size = sizeof (struct spa_pod);
body = &head.fraction_pod.value;
goto primitive;
case -SPA_POD_TYPE_FRACTION:
head.fraction_pod.pod.type = SPA_POD_TYPE_FRACTION;
head.fraction_pod.pod.size = body_size = sizeof (SpaFraction);
head.fraction_pod.value = *va_arg (args, SpaFraction *);
head_size = sizeof (SpaPOD);
head.fraction_pod.pod.size = body_size = sizeof (struct spa_fraction);
head.fraction_pod.value = *va_arg (args, struct spa_fraction *);
head_size = sizeof (struct spa_pod);
body = &head.fraction_pod.value;
goto primitive;
case SPA_POD_TYPE_BITMASK:
break;
case SPA_POD_TYPE_ARRAY:
f = va_arg (args, SpaPODFrame *);
f = va_arg (args, struct spa_pod_frame *);
type = va_arg (args, uint32_t);
n_values = va_arg (args, uint32_t);
head.array_pod.pod.type = SPA_POD_TYPE_ARRAY;
head.array_pod.pod.size = 0;
head_size = sizeof(SpaPOD);
head_size = sizeof(struct spa_pod);
body = NULL;
goto primitive;
case SPA_POD_TYPE_STRUCT:
f = va_arg (args, SpaPODFrame *);
f = va_arg (args, struct spa_pod_frame *);
head.struct_pod.pod.type = SPA_POD_TYPE_STRUCT;
head.struct_pod.pod.size = 0;
head_size = sizeof(SpaPOD);
head_size = sizeof(struct spa_pod);
body = NULL;
goto primitive;
case SPA_POD_TYPE_OBJECT:
f = va_arg (args, SpaPODFrame *);
f = va_arg (args, struct spa_pod_frame *);
head.object_pod.pod.type = SPA_POD_TYPE_OBJECT;
head.object_pod.pod.size = sizeof (SpaPODObjectBody);
head.object_pod.pod.size = sizeof (struct spa_pod_object_body);
head.object_pod.body.id = va_arg (args, uint32_t);
head.object_pod.body.type = va_arg (args, uint32_t);
head_size = sizeof(SpaPODObject);
head_size = sizeof(struct spa_pod_object);
body = NULL;
goto primitive;
case SPA_POD_TYPE_PROP:
f = va_arg (args, SpaPODFrame *);
f = va_arg (args, struct spa_pod_frame *);
head.prop_pod.pod.type = SPA_POD_TYPE_PROP;
head.prop_pod.pod.size = sizeof (SpaPODPropBody) - sizeof(SpaPOD);
head.prop_pod.pod.size = sizeof (struct spa_pod_prop_body) - sizeof(struct spa_pod);
head.prop_pod.body.key = va_arg (args, uint32_t);
head.prop_pod.body.flags = va_arg (args, uint32_t);
head_size = sizeof (SpaPODProp) - sizeof(SpaPOD);
head_size = sizeof (struct spa_pod_prop) - sizeof(struct spa_pod);
body = NULL;
type = va_arg (args, uint32_t);
n_values = va_arg (args, uint32_t);
@ -493,7 +494,7 @@ spa_pod_builder_addv (SpaPODBuilder *builder,
case -SPA_POD_TYPE_STRUCT:
case -SPA_POD_TYPE_OBJECT:
case -SPA_POD_TYPE_PROP:
f = va_arg (args, SpaPODFrame *);
f = va_arg (args, struct spa_pod_frame *);
spa_pod_builder_pop (builder, f);
break;
case SPA_POD_TYPE_POD:
@ -535,8 +536,8 @@ extra:
}
static inline void
spa_pod_builder_add (SpaPODBuilder *builder,
uint32_t type, ...)
spa_pod_builder_add (struct spa_pod_builder *builder,
uint32_t type, ...)
{
va_list args;

View file

@ -29,14 +29,14 @@ extern "C" {
#include <spa/defs.h>
#include <spa/pod-utils.h>
typedef struct {
struct spa_pod_iter {
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)
spa_pod_iter_contents (struct spa_pod_iter *iter, const void *data, uint32_t size)
{
iter->data = data;
iter->size = size;
@ -44,40 +44,40 @@ spa_pod_iter_contents (SpaPODIter *iter, const void *data, uint32_t size)
}
static inline bool
spa_pod_iter_struct (SpaPODIter *iter, const void *data, uint32_t size)
spa_pod_iter_struct (struct spa_pod_iter *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));
spa_pod_iter_contents (iter, SPA_POD_CONTENTS (struct spa_pod_struct, data),
SPA_POD_CONTENTS_SIZE (struct spa_pod_struct, data));
return true;
}
static inline bool
spa_pod_iter_object (SpaPODIter *iter, const void *data, uint32_t size)
spa_pod_iter_object (struct spa_pod_iter *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));
spa_pod_iter_contents (iter, SPA_POD_CONTENTS (struct spa_pod_object, data),
SPA_POD_CONTENTS_SIZE (struct spa_pod_object, data));
return true;
}
static inline bool
spa_pod_iter_pod (SpaPODIter *iter, SpaPOD *pod)
spa_pod_iter_pod (struct spa_pod_iter *iter, struct spa_pod *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);
data = SPA_POD_CONTENTS (struct spa_pod_struct, pod);
size = SPA_POD_CONTENTS_SIZE (struct spa_pod_struct, pod);
break;
case SPA_POD_TYPE_OBJECT:
data = SPA_POD_CONTENTS (SpaPODObject, pod);
size = SPA_POD_CONTENTS_SIZE (SpaPODObject, pod);
data = SPA_POD_CONTENTS (struct spa_pod_object, pod);
size = SPA_POD_CONTENTS_SIZE (struct spa_pod_object, pod);
break;
default:
spa_pod_iter_contents (iter, NULL, 0);
@ -88,22 +88,22 @@ spa_pod_iter_pod (SpaPODIter *iter, SpaPOD *pod)
}
static inline bool
spa_pod_iter_has_next (SpaPODIter *iter)
spa_pod_iter_has_next (struct spa_pod_iter *iter)
{
return (iter->offset + 8 <= iter->size &&
SPA_POD_SIZE (SPA_MEMBER (iter->data, iter->offset, SpaPOD)) <= iter->size);
SPA_POD_SIZE (SPA_MEMBER (iter->data, iter->offset, struct spa_pod)) <= iter->size);
}
static inline SpaPOD *
spa_pod_iter_next (SpaPODIter *iter)
static inline struct spa_pod *
spa_pod_iter_next (struct spa_pod_iter *iter)
{
SpaPOD *res = SPA_MEMBER (iter->data, iter->offset, SpaPOD);
struct spa_pod *res = SPA_MEMBER (iter->data, iter->offset, struct spa_pod);
iter->offset += SPA_ROUND_UP_N (SPA_POD_SIZE (res), 8);
return res;
}
static inline SpaPOD *
spa_pod_iter_first (SpaPODIter *iter, SpaPOD *pod)
static inline struct spa_pod *
spa_pod_iter_first (struct spa_pod_iter *iter, struct spa_pod *pod)
{
if (!spa_pod_iter_pod (iter, pod) ||
!spa_pod_iter_has_next (iter))
@ -112,14 +112,14 @@ spa_pod_iter_first (SpaPODIter *iter, SpaPOD *pod)
}
static inline bool
spa_pod_iter_getv (SpaPODIter *iter,
spa_pod_iter_getv (struct spa_pod_iter *iter,
uint32_t type,
va_list args)
{
bool res = true;
while (type && (res = spa_pod_iter_has_next (iter))) {
SpaPOD *pod = spa_pod_iter_next (iter);
struct spa_pod *pod = spa_pod_iter_next (iter);
SPA_POD_COLLECT (pod, type, args, error);
@ -131,7 +131,7 @@ error:
}
static inline bool
spa_pod_iter_get (SpaPODIter *iter, uint32_t type, ...)
spa_pod_iter_get (struct spa_pod_iter *iter, uint32_t type, ...)
{
va_list args;
bool res;

Some files were not shown because too many files have changed in this diff Show more