mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
spa: don't use typedef for struct and enum
This commit is contained in:
parent
83964cec87
commit
11f23a3ffa
163 changed files with 6510 additions and 8264 deletions
136
spa/lib/debug.c
136
spa/lib/debug.c
|
|
@ -26,31 +26,31 @@
|
|||
#include <spa/loop.h>
|
||||
#include "debug.h"
|
||||
|
||||
SpaResult
|
||||
spa_debug_port_info (const SpaPortInfo *info, const SpaTypeMap *map)
|
||||
int
|
||||
spa_debug_port_info (const struct spa_port_info *info, const struct spa_type_map *map)
|
||||
{
|
||||
if (info == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
fprintf (stderr, "SpaPortInfo %p:\n", info);
|
||||
fprintf (stderr, "struct spa_port_info %p:\n", info);
|
||||
fprintf (stderr, " flags: \t%08x\n", info->flags);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
SpaResult
|
||||
spa_debug_buffer (const SpaBuffer *buffer, const SpaTypeMap *map)
|
||||
int
|
||||
spa_debug_buffer (const struct spa_buffer *buffer, const struct spa_type_map *map)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (buffer == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
fprintf (stderr, "SpaBuffer %p:\n", buffer);
|
||||
fprintf (stderr, "spa_buffer %p:\n", buffer);
|
||||
fprintf (stderr, " id: %08X\n", buffer->id);
|
||||
fprintf (stderr, " n_metas: %u (at %p)\n", buffer->n_metas, buffer->metas);
|
||||
for (i = 0; i < buffer->n_metas; i++) {
|
||||
SpaMeta *m = &buffer->metas[i];
|
||||
struct spa_meta *m = &buffer->metas[i];
|
||||
const char *type_name;
|
||||
|
||||
type_name = spa_type_map_get_type (map, m->type);
|
||||
|
|
@ -58,38 +58,38 @@ spa_debug_buffer (const SpaBuffer *buffer, const SpaTypeMap *map)
|
|||
type_name, m->data, m->size);
|
||||
|
||||
if (!strcmp (type_name, SPA_TYPE_META__Header)) {
|
||||
SpaMetaHeader *h = m->data;
|
||||
fprintf (stderr, " SpaMetaHeader:\n");
|
||||
struct spa_meta_header *h = m->data;
|
||||
fprintf (stderr, " struct spa_meta_header:\n");
|
||||
fprintf (stderr, " flags: %08x\n", h->flags);
|
||||
fprintf (stderr, " seq: %u\n", h->seq);
|
||||
fprintf (stderr, " pts: %"PRIi64"\n", h->pts);
|
||||
fprintf (stderr, " dts_offset: %"PRIi64"\n", h->dts_offset);
|
||||
}
|
||||
else if (!strcmp (type_name, SPA_TYPE_META__Pointer)) {
|
||||
SpaMetaPointer *h = m->data;
|
||||
fprintf (stderr, " SpaMetaPointer:\n");
|
||||
struct spa_meta_pointer *h = m->data;
|
||||
fprintf (stderr, " struct spa_meta_pointer:\n");
|
||||
fprintf (stderr, " type: %s\n", spa_type_map_get_type (map, h->type));
|
||||
fprintf (stderr, " ptr: %p\n", h->ptr);
|
||||
}
|
||||
else if (!strcmp (type_name, SPA_TYPE_META__VideoCrop)) {
|
||||
SpaMetaVideoCrop *h = m->data;
|
||||
fprintf (stderr, " SpaMetaVideoCrop:\n");
|
||||
struct spa_meta_video_crop *h = m->data;
|
||||
fprintf (stderr, " struct spa_meta_video_crop:\n");
|
||||
fprintf (stderr, " x: %d\n", h->x);
|
||||
fprintf (stderr, " y: %d\n", h->y);
|
||||
fprintf (stderr, " width: %d\n", h->width);
|
||||
fprintf (stderr, " height: %d\n", h->height);
|
||||
}
|
||||
else if (!strcmp (type_name, SPA_TYPE_META__Ringbuffer)) {
|
||||
SpaMetaRingbuffer *h = m->data;
|
||||
fprintf (stderr, " SpaMetaRingbuffer:\n");
|
||||
struct spa_meta_ringbuffer *h = m->data;
|
||||
fprintf (stderr, " struct spa_meta_ringbuffer:\n");
|
||||
fprintf (stderr, " readindex: %d\n", h->ringbuffer.readindex);
|
||||
fprintf (stderr, " writeindex: %d\n", h->ringbuffer.writeindex);
|
||||
fprintf (stderr, " size: %d\n", h->ringbuffer.size);
|
||||
fprintf (stderr, " mask: %d\n", h->ringbuffer.mask);
|
||||
}
|
||||
else if (!strcmp (type_name, SPA_TYPE_META__Shared)) {
|
||||
SpaMetaShared *h = m->data;
|
||||
fprintf (stderr, " SpaMetaShared:\n");
|
||||
struct spa_meta_shared *h = m->data;
|
||||
fprintf (stderr, " struct spa_meta_shared:\n");
|
||||
fprintf (stderr, " flags: %d\n", h->flags);
|
||||
fprintf (stderr, " fd: %d\n", h->fd);
|
||||
fprintf (stderr, " offset: %d\n", h->offset);
|
||||
|
|
@ -102,7 +102,7 @@ spa_debug_buffer (const SpaBuffer *buffer, const SpaTypeMap *map)
|
|||
}
|
||||
fprintf (stderr, " n_datas: \t%u (at %p)\n", buffer->n_datas, buffer->datas);
|
||||
for (i = 0; i < buffer->n_datas; i++) {
|
||||
SpaData *d = &buffer->datas[i];
|
||||
struct spa_data *d = &buffer->datas[i];
|
||||
fprintf (stderr, " type: %d (%s)\n", d->type, spa_type_map_get_type (map, d->type));
|
||||
fprintf (stderr, " flags: %d\n", d->flags);
|
||||
fprintf (stderr, " data: %p\n", d->data);
|
||||
|
|
@ -117,7 +117,7 @@ spa_debug_buffer (const SpaBuffer *buffer, const SpaTypeMap *map)
|
|||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
SpaResult
|
||||
int
|
||||
spa_debug_dump_mem (const void *mem, size_t size)
|
||||
{
|
||||
const uint8_t *t = mem;
|
||||
|
|
@ -136,17 +136,17 @@ spa_debug_dump_mem (const void *mem, size_t size)
|
|||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
SpaResult
|
||||
spa_debug_props (const SpaProps *props, const SpaTypeMap *map)
|
||||
int
|
||||
spa_debug_props (const struct spa_props *props, const struct spa_type_map *map)
|
||||
{
|
||||
spa_debug_pod (&props->pod, map);
|
||||
spa_debug_pod (&props->object.pod, map);
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
SpaResult
|
||||
spa_debug_param (const SpaParam *param, const SpaTypeMap *map)
|
||||
int
|
||||
spa_debug_param (const struct spa_param *param, const struct spa_type_map *map)
|
||||
{
|
||||
spa_debug_pod (¶m->pod, map);
|
||||
spa_debug_pod (¶m->object.pod, map);
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ struct pod_type_name {
|
|||
};
|
||||
|
||||
static void
|
||||
print_pod_value (const SpaTypeMap *map, uint32_t size, uint32_t type, void *body, int prefix)
|
||||
print_pod_value (const struct spa_type_map *map, uint32_t size, uint32_t type, void *body, int prefix)
|
||||
{
|
||||
switch (type) {
|
||||
case SPA_POD_TYPE_BOOL:
|
||||
|
|
@ -202,20 +202,20 @@ print_pod_value (const SpaTypeMap *map, uint32_t size, uint32_t type, void *body
|
|||
break;
|
||||
case SPA_POD_TYPE_POINTER:
|
||||
{
|
||||
SpaPODPointerBody *b = body;
|
||||
struct spa_pod_pointer_body *b = body;
|
||||
printf ("%-*sPointer %s %p\n", prefix, "",
|
||||
spa_type_map_get_type (map, b->type), b->value);
|
||||
break;
|
||||
}
|
||||
case SPA_POD_TYPE_RECTANGLE:
|
||||
{
|
||||
SpaRectangle *r = body;
|
||||
struct spa_rectangle *r = body;
|
||||
printf ("%-*sRectangle %dx%d\n", prefix, "", r->width, r->height);
|
||||
break;
|
||||
}
|
||||
case SPA_POD_TYPE_FRACTION:
|
||||
{
|
||||
SpaFraction *f = body;
|
||||
struct spa_fraction *f = body;
|
||||
printf ("%-*sFraction %d/%d\n", prefix, "", f->num, f->denom);
|
||||
break;
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ print_pod_value (const SpaTypeMap *map, uint32_t size, uint32_t type, void *body
|
|||
break;
|
||||
case SPA_POD_TYPE_ARRAY:
|
||||
{
|
||||
SpaPODArrayBody *b = body;
|
||||
struct spa_pod_array_body *b = body;
|
||||
void *p;
|
||||
printf ("%-*sArray: child.size %d, child.type %d\n", prefix, "", b->child.size, b->child.type);
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ print_pod_value (const SpaTypeMap *map, uint32_t size, uint32_t type, void *body
|
|||
}
|
||||
case SPA_POD_TYPE_STRUCT:
|
||||
{
|
||||
SpaPOD *b = body, *p;
|
||||
struct spa_pod *b = body, *p;
|
||||
printf ("%-*sStruct: size %d\n", prefix, "", size);
|
||||
SPA_POD_FOREACH (b, size, p)
|
||||
print_pod_value (map, p->size, p->type, SPA_POD_BODY (p), prefix + 2);
|
||||
|
|
@ -242,8 +242,8 @@ print_pod_value (const SpaTypeMap *map, uint32_t size, uint32_t type, void *body
|
|||
}
|
||||
case SPA_POD_TYPE_OBJECT:
|
||||
{
|
||||
SpaPODObjectBody *b = body;
|
||||
SpaPOD *p;
|
||||
struct spa_pod_object_body *b = body;
|
||||
struct spa_pod *p;
|
||||
|
||||
printf ("%-*sObject: size %d, id %d, type %s\n", prefix, "", size, b->id,
|
||||
spa_type_map_get_type (map, b->type));
|
||||
|
|
@ -253,7 +253,7 @@ print_pod_value (const SpaTypeMap *map, uint32_t size, uint32_t type, void *body
|
|||
}
|
||||
case SPA_POD_TYPE_PROP:
|
||||
{
|
||||
SpaPODPropBody *b = body;
|
||||
struct spa_pod_prop_body *b = body;
|
||||
void *alt;
|
||||
int i;
|
||||
|
||||
|
|
@ -288,8 +288,8 @@ print_pod_value (const SpaTypeMap *map, uint32_t size, uint32_t type, void *body
|
|||
}
|
||||
}
|
||||
|
||||
SpaResult
|
||||
spa_debug_pod (const SpaPOD *pod, const SpaTypeMap *map)
|
||||
int
|
||||
spa_debug_pod (const struct spa_pod *pod, const struct spa_type_map *map)
|
||||
{
|
||||
map = map ? map : spa_type_map_get_default ();
|
||||
print_pod_value (map, pod->size, pod->type, SPA_POD_BODY (pod), 0);
|
||||
|
|
@ -297,7 +297,7 @@ spa_debug_pod (const SpaPOD *pod, const SpaTypeMap *map)
|
|||
}
|
||||
|
||||
static void
|
||||
print_format_value (const SpaTypeMap *map, uint32_t size, uint32_t type, void *body)
|
||||
print_format_value (const struct spa_type_map *map, uint32_t size, uint32_t type, void *body)
|
||||
{
|
||||
switch (type) {
|
||||
case SPA_POD_TYPE_BOOL:
|
||||
|
|
@ -333,13 +333,13 @@ print_format_value (const SpaTypeMap *map, uint32_t size, uint32_t type, void *b
|
|||
break;
|
||||
case SPA_POD_TYPE_RECTANGLE:
|
||||
{
|
||||
SpaRectangle *r = body;
|
||||
struct spa_rectangle *r = body;
|
||||
fprintf (stderr, "%"PRIu32"x%"PRIu32, r->width, r->height);
|
||||
break;
|
||||
}
|
||||
case SPA_POD_TYPE_FRACTION:
|
||||
{
|
||||
SpaFraction *f = body;
|
||||
struct spa_fraction *f = body;
|
||||
fprintf (stderr, "%"PRIu32"/%"PRIu32, f->num, f->denom);
|
||||
break;
|
||||
}
|
||||
|
|
@ -354,13 +354,13 @@ print_format_value (const SpaTypeMap *map, uint32_t size, uint32_t type, void *b
|
|||
}
|
||||
}
|
||||
|
||||
SpaResult
|
||||
spa_debug_format (const SpaFormat *format, const SpaTypeMap *map)
|
||||
int
|
||||
spa_debug_format (const struct spa_format *format, const struct spa_type_map *map)
|
||||
{
|
||||
int i;
|
||||
const char *media_type;
|
||||
const char *media_subtype;
|
||||
SpaPODProp *prop;
|
||||
struct spa_pod_prop *prop;
|
||||
uint32_t mtype, mstype;
|
||||
|
||||
if (format == NULL)
|
||||
|
|
@ -427,8 +427,8 @@ spa_debug_format (const SpaFormat *format, const SpaTypeMap *map)
|
|||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
SpaResult
|
||||
spa_debug_dict (const SpaDict *dict)
|
||||
int
|
||||
spa_debug_dict (const struct spa_dict *dict)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
|
@ -446,23 +446,23 @@ spa_debug_dict (const SpaDict *dict)
|
|||
|
||||
#define TRACE_BUFFER 4096
|
||||
|
||||
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[512], location[1024];
|
||||
static const char *levels[] = { "-", "E", "W", "I", "D", "T", "*T*" };
|
||||
int size;
|
||||
|
|
@ -491,12 +491,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);
|
||||
|
|
@ -504,8 +504,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,
|
||||
|
|
@ -514,14 +514,14 @@ static DebugLog log = {
|
|||
{ 0, 0, TRACE_BUFFER, TRACE_BUFFER - 1 },
|
||||
};
|
||||
|
||||
SpaLog *
|
||||
struct spa_log *
|
||||
spa_log_get_default (void)
|
||||
{
|
||||
return &log.log;
|
||||
}
|
||||
|
||||
static void
|
||||
on_trace_event (SpaSource *source)
|
||||
on_trace_event (struct spa_source *source)
|
||||
{
|
||||
int32_t avail;
|
||||
uint32_t index;
|
||||
|
|
@ -549,7 +549,7 @@ on_trace_event (SpaSource *source)
|
|||
}
|
||||
|
||||
void
|
||||
spa_log_default_set_trace_event (SpaSource *source)
|
||||
spa_log_default_set_trace_event (struct spa_source *source)
|
||||
{
|
||||
log.source = source;
|
||||
log.source->func = on_trace_event;
|
||||
|
|
|
|||
|
|
@ -33,17 +33,17 @@ extern "C" {
|
|||
#include <spa/dict.h>
|
||||
#include <spa/log.h>
|
||||
|
||||
SpaResult spa_debug_port_info (const SpaPortInfo *info, const SpaTypeMap *map);
|
||||
SpaResult spa_debug_buffer (const SpaBuffer *buffer, const SpaTypeMap *map);
|
||||
SpaResult spa_debug_props (const SpaProps *props, const SpaTypeMap *map);
|
||||
SpaResult spa_debug_param (const SpaParam *param, const SpaTypeMap *map);
|
||||
SpaResult spa_debug_pod (const SpaPOD *pod, const SpaTypeMap *map);
|
||||
SpaResult spa_debug_format (const SpaFormat *format, const SpaTypeMap *map);
|
||||
SpaResult spa_debug_dump_mem (const void *data, size_t size);
|
||||
SpaResult spa_debug_dict (const SpaDict *dict);
|
||||
int spa_debug_port_info (const struct spa_port_info *info, const struct spa_type_map *map);
|
||||
int spa_debug_buffer (const struct spa_buffer *buffer, const struct spa_type_map *map);
|
||||
int spa_debug_props (const struct spa_props *props, const struct spa_type_map *map);
|
||||
int spa_debug_param (const struct spa_param *param, const struct spa_type_map *map);
|
||||
int spa_debug_pod (const struct spa_pod *pod, const struct spa_type_map *map);
|
||||
int spa_debug_format (const struct spa_format *format, const struct spa_type_map *map);
|
||||
int spa_debug_dump_mem (const void *data, size_t size);
|
||||
int spa_debug_dict (const struct spa_dict *dict);
|
||||
|
||||
SpaLog * spa_log_get_default (void);
|
||||
void spa_log_default_trace_purge (void);
|
||||
struct spa_log* spa_log_get_default (void);
|
||||
void spa_log_default_trace_purge (void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@
|
|||
#include <lib/props.h>
|
||||
#include <lib/mapper.h>
|
||||
|
||||
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)
|
||||
{
|
||||
SpaPODFrame f;
|
||||
SpaResult res;
|
||||
struct spa_pod_frame f;
|
||||
int res;
|
||||
|
||||
if (format == NULL || result == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
|
@ -51,10 +51,10 @@ spa_format_filter (const SpaFormat *format,
|
|||
SPA_FORMAT_MEDIA_TYPE (filter),
|
||||
SPA_FORMAT_MEDIA_SUBTYPE (filter));
|
||||
res = spa_props_filter (result,
|
||||
SPA_POD_CONTENTS (SpaFormat, format),
|
||||
SPA_POD_CONTENTS_SIZE (SpaFormat, format),
|
||||
SPA_POD_CONTENTS (SpaFormat, filter),
|
||||
SPA_POD_CONTENTS_SIZE (SpaFormat, filter));
|
||||
SPA_POD_CONTENTS (struct spa_format, format),
|
||||
SPA_POD_CONTENTS_SIZE (struct spa_format, format),
|
||||
SPA_POD_CONTENTS (struct spa_format, filter),
|
||||
SPA_POD_CONTENTS_SIZE (struct spa_format, filter));
|
||||
spa_pod_builder_pop (result, &f);
|
||||
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -28,16 +28,16 @@
|
|||
|
||||
#define MAX_TYPES 4096
|
||||
|
||||
typedef struct {
|
||||
SpaTypeMap map;
|
||||
struct type_map{
|
||||
struct spa_type_map map;
|
||||
char *types[MAX_TYPES];
|
||||
unsigned int n_types;
|
||||
} 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 type_map *this = SPA_CONTAINER_OF (map, struct type_map, map);
|
||||
unsigned int i = 0;
|
||||
|
||||
if (type != NULL) {
|
||||
|
|
@ -52,9 +52,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 type_map *this = SPA_CONTAINER_OF (map, struct type_map, map);
|
||||
|
||||
if (id <= this->n_types)
|
||||
return this->types[id];
|
||||
|
|
@ -63,14 +63,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 type_map *this = SPA_CONTAINER_OF (map, struct type_map, map);
|
||||
return this->n_types;
|
||||
}
|
||||
|
||||
static TypeMap default_type_map = {
|
||||
{ sizeof (SpaTypeMap),
|
||||
static struct type_map default_type_map = {
|
||||
{ sizeof (struct spa_type_map),
|
||||
NULL,
|
||||
type_map_get_id,
|
||||
type_map_get_type,
|
||||
|
|
@ -80,16 +80,16 @@ static TypeMap default_type_map = {
|
|||
0
|
||||
};
|
||||
|
||||
static SpaTypeMap *default_map = &default_type_map.map;
|
||||
static struct spa_type_map *default_map = &default_type_map.map;
|
||||
|
||||
SpaTypeMap *
|
||||
struct spa_type_map *
|
||||
spa_type_map_get_default (void)
|
||||
{
|
||||
return default_map;
|
||||
}
|
||||
|
||||
void
|
||||
spa_type_map_set_default (SpaTypeMap *map)
|
||||
spa_type_map_set_default (struct spa_type_map *map)
|
||||
{
|
||||
default_map = map;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ extern "C" {
|
|||
|
||||
#include <spa/type-map.h>
|
||||
|
||||
void spa_type_map_set_default (SpaTypeMap *map);
|
||||
SpaTypeMap * spa_type_map_get_default (void);
|
||||
void spa_type_map_set_default (struct spa_type_map *map);
|
||||
struct spa_type_map * spa_type_map_get_default (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <spa/props.h>
|
||||
|
||||
static int
|
||||
compare_value (SpaPODType type, const void *r1, const void *r2)
|
||||
compare_value (enum spa_pod_type type, const void *r1, const void *r2)
|
||||
{
|
||||
switch (type) {
|
||||
case SPA_POD_TYPE_INVALID:
|
||||
|
|
@ -45,8 +45,8 @@ compare_value (SpaPODType type, const void *r1, const void *r2)
|
|||
return strcmp (r1, r2);
|
||||
case SPA_POD_TYPE_RECTANGLE:
|
||||
{
|
||||
const SpaRectangle *rec1 = (SpaRectangle*)r1,
|
||||
*rec2 = (SpaRectangle*)r2;
|
||||
const struct spa_rectangle *rec1 = (struct spa_rectangle*)r1,
|
||||
*rec2 = (struct spa_rectangle*)r2;
|
||||
if (rec1->width == rec2->width && rec1->height == rec2->height)
|
||||
return 0;
|
||||
else if (rec1->width < rec2->width || rec1->height < rec2->height)
|
||||
|
|
@ -56,8 +56,8 @@ compare_value (SpaPODType type, const void *r1, const void *r2)
|
|||
}
|
||||
case SPA_POD_TYPE_FRACTION:
|
||||
{
|
||||
const SpaFraction *f1 = (SpaFraction*)r1,
|
||||
*f2 = (SpaFraction*)r2;
|
||||
const struct spa_fraction *f1 = (struct spa_fraction*)r1,
|
||||
*f2 = (struct spa_fraction*)r2;
|
||||
uint64_t n1, n2;
|
||||
n1 = ((int64_t) f1->num) * f2->denom;
|
||||
n2 = ((int64_t) f2->num) * f1->denom;
|
||||
|
|
@ -75,9 +75,9 @@ compare_value (SpaPODType type, const void *r1, const void *r2)
|
|||
}
|
||||
|
||||
static void
|
||||
fix_default (SpaPODProp *prop)
|
||||
fix_default (struct spa_pod_prop *prop)
|
||||
{
|
||||
void *val = SPA_MEMBER (prop, sizeof (SpaPODProp), void),
|
||||
void *val = SPA_MEMBER (prop, sizeof (struct spa_pod_prop), void),
|
||||
*alt = SPA_MEMBER (val, prop->body.value.size, void);
|
||||
int i, nalt = SPA_POD_PROP_N_VALUES (prop) - 1;
|
||||
|
||||
|
|
@ -120,30 +120,30 @@ fix_default (SpaPODProp *prop)
|
|||
}
|
||||
}
|
||||
|
||||
static inline SpaPODProp *
|
||||
find_prop (const SpaPOD *pod, uint32_t size, uint32_t key)
|
||||
static inline struct spa_pod_prop *
|
||||
find_prop (const struct spa_pod *pod, uint32_t size, uint32_t key)
|
||||
{
|
||||
const SpaPOD *res;
|
||||
const struct spa_pod *res;
|
||||
SPA_POD_FOREACH (pod, size, res) {
|
||||
if (res->type == SPA_POD_TYPE_PROP && ((SpaPODProp*)res)->body.key == key)
|
||||
return (SpaPODProp *)res;
|
||||
if (res->type == SPA_POD_TYPE_PROP && ((struct spa_pod_prop*)res)->body.key == key)
|
||||
return (struct spa_pod_prop *)res;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SpaResult
|
||||
spa_props_filter (SpaPODBuilder *b,
|
||||
const SpaPOD *props,
|
||||
uint32_t props_size,
|
||||
const SpaPOD *filter,
|
||||
uint32_t filter_size)
|
||||
int
|
||||
spa_props_filter (struct spa_pod_builder *b,
|
||||
const struct spa_pod *props,
|
||||
uint32_t props_size,
|
||||
const struct spa_pod *filter,
|
||||
uint32_t filter_size)
|
||||
{
|
||||
int j, k;
|
||||
const SpaPOD *pr;
|
||||
const struct spa_pod *pr;
|
||||
|
||||
SPA_POD_FOREACH (props, props_size, pr) {
|
||||
SpaPODFrame f;
|
||||
SpaPODProp *p1, *p2, *np;
|
||||
struct spa_pod_frame f;
|
||||
struct spa_pod_prop *p1, *p2, *np;
|
||||
int nalt1, nalt2;
|
||||
void *alt1, *alt2, *a1, *a2;
|
||||
uint32_t rt1, rt2;
|
||||
|
|
@ -151,7 +151,7 @@ spa_props_filter (SpaPODBuilder *b,
|
|||
if (pr->type != SPA_POD_TYPE_PROP)
|
||||
continue;
|
||||
|
||||
p1 = (SpaPODProp *) pr;
|
||||
p1 = (struct spa_pod_prop *) pr;
|
||||
|
||||
if (filter == NULL || (p2 = find_prop (filter, filter_size, p1->body.key)) == NULL) {
|
||||
/* no filter, copy the complete property */
|
||||
|
|
@ -168,14 +168,14 @@ spa_props_filter (SpaPODBuilder *b,
|
|||
|
||||
/* else we filter. start with copying the property */
|
||||
spa_pod_builder_push_prop (b, &f, p1->body.key, 0),
|
||||
np = SPA_POD_BUILDER_DEREF (b, f.ref, SpaPODProp);
|
||||
np = SPA_POD_BUILDER_DEREF (b, f.ref, struct spa_pod_prop);
|
||||
|
||||
/* default value */
|
||||
spa_pod_builder_raw (b, &p1->body.value, sizeof (p1->body.value) + p1->body.value.size);
|
||||
|
||||
alt1 = SPA_MEMBER (p1, sizeof (SpaPODProp), void);
|
||||
alt1 = SPA_MEMBER (p1, sizeof (struct spa_pod_prop), void);
|
||||
nalt1 = SPA_POD_PROP_N_VALUES (p1);
|
||||
alt2 = SPA_MEMBER (p2, sizeof (SpaPODProp), void);
|
||||
alt2 = SPA_MEMBER (p2, sizeof (struct spa_pod_prop), void);
|
||||
nalt2 = SPA_POD_PROP_N_VALUES (p2);
|
||||
|
||||
if (p1->body.flags & SPA_POD_PROP_FLAG_UNSET) {
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ extern "C" {
|
|||
|
||||
#include <spa/props.h>
|
||||
|
||||
SpaResult
|
||||
spa_props_filter (SpaPODBuilder *b,
|
||||
const SpaPOD *props,
|
||||
uint32_t props_size,
|
||||
const SpaPOD *filter,
|
||||
uint32_t filter_size);
|
||||
int
|
||||
spa_props_filter (struct spa_pod_builder *b,
|
||||
const struct spa_pod *props,
|
||||
uint32_t props_size,
|
||||
const struct spa_pod *filter,
|
||||
uint32_t filter_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue