mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
remove spalib
This commit is contained in:
parent
d3b9a52ec4
commit
9d36b85dd6
49 changed files with 566 additions and 1162 deletions
|
|
@ -1,10 +1,7 @@
|
||||||
prefix=@prefix@
|
prefix=@prefix@
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@/
|
includedir=@includedir@/
|
||||||
|
|
||||||
Name: libspa
|
Name: libspa
|
||||||
Description: Simple Plugin API
|
Description: Simple Plugin API
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Libs: -L${libdir} -lspa-lib
|
|
||||||
Cflags: -I${includedir} -D_REENTRANT
|
Cflags: -I${includedir} -D_REENTRANT
|
||||||
|
|
|
||||||
91
spa/include/spa/debug/buffer.h
Normal file
91
spa/include/spa/debug/buffer.h
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
/* Simple Plugin API
|
||||||
|
* Copyright (C) 2018 Wim Taymans <wim.taymans@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SPA_DEBUG_BUFFER_H__
|
||||||
|
#define __SPA_DEBUG_BUFFER_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <spa/support/type-map.h>
|
||||||
|
#include <spa/debug/debug-mem.h>
|
||||||
|
|
||||||
|
#ifndef spa_debug
|
||||||
|
#define spa_debug(...) ({ fprintf(stderr, __VA_ARGS__);fputc('\n', stderr); })
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline int spa_debug_buffer(int indent,
|
||||||
|
struct spa_type_map *map, const struct spa_buffer *buffer)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
spa_debug("%*s" "struct spa_buffer %p:", indent, "", buffer);
|
||||||
|
spa_debug("%*s" " id: %08X", indent, "", buffer->id);
|
||||||
|
spa_debug("%*s" " n_metas: %u (at %p)", indent, "", buffer->n_metas, buffer->metas);
|
||||||
|
for (i = 0; i < buffer->n_metas; i++) {
|
||||||
|
struct spa_meta *m = &buffer->metas[i];
|
||||||
|
const char *type_name;
|
||||||
|
|
||||||
|
type_name = spa_type_map_get_type(map, m->type);
|
||||||
|
spa_debug("%*s" " meta %d: type %d (%s), data %p, size %d:", indent, "", i, m->type,
|
||||||
|
type_name, m->data, m->size);
|
||||||
|
|
||||||
|
if (!strcmp(type_name, SPA_TYPE_META__Header)) {
|
||||||
|
struct spa_meta_header *h = m->data;
|
||||||
|
spa_debug("%*s" " struct spa_meta_header:", indent, "");
|
||||||
|
spa_debug("%*s" " flags: %08x", indent, "", h->flags);
|
||||||
|
spa_debug("%*s" " seq: %u", indent, "", h->seq);
|
||||||
|
spa_debug("%*s" " pts: %" PRIi64, indent, "", h->pts);
|
||||||
|
spa_debug("%*s" " dts_offset: %" PRIi64, indent, "", h->dts_offset);
|
||||||
|
} else if (!strcmp(type_name, SPA_TYPE_META__VideoCrop)) {
|
||||||
|
struct spa_meta_video_crop *h = m->data;
|
||||||
|
spa_debug("%*s" " struct spa_meta_video_crop:", indent, "");
|
||||||
|
spa_debug("%*s" " x: %d", indent, "", h->x);
|
||||||
|
spa_debug("%*s" " y: %d", indent, "", h->y);
|
||||||
|
spa_debug("%*s" " width: %d", indent, "", h->width);
|
||||||
|
spa_debug("%*s" " height: %d", indent, "", h->height);
|
||||||
|
} else {
|
||||||
|
spa_debug("%*s" " Unknown:", indent, "");
|
||||||
|
spa_debug_mem(5, m->data, m->size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spa_debug("%*s" " n_datas: \t%u (at %p)", indent, "", buffer->n_datas, buffer->datas);
|
||||||
|
for (i = 0; i < buffer->n_datas; i++) {
|
||||||
|
struct spa_data *d = &buffer->datas[i];
|
||||||
|
spa_debug("%*s" " type: %d (%s)", indent, "", d->type,
|
||||||
|
spa_type_map_get_type(map, d->type));
|
||||||
|
spa_debug("%*s" " flags: %d", indent, "", d->flags);
|
||||||
|
spa_debug("%*s" " data: %p", indent, "", d->data);
|
||||||
|
spa_debug("%*s" " fd: %d", indent, "", d->fd);
|
||||||
|
spa_debug("%*s" " offset: %d", indent, "", d->mapoffset);
|
||||||
|
spa_debug("%*s" " maxsize: %u", indent, "", d->maxsize);
|
||||||
|
spa_debug("%*s" " chunk: %p", indent, "", d->chunk);
|
||||||
|
spa_debug("%*s" " offset: %d", indent, "", d->chunk->offset);
|
||||||
|
spa_debug("%*s" " size: %u", indent, "", d->chunk->size);
|
||||||
|
spa_debug("%*s" " stride: %d", indent, "", d->chunk->stride);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __SPA_DEBUG_BUFFER_H__ */
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* Simple Plugin API
|
/* Simple Plugin API
|
||||||
* Copyright (C) 2017 Wim Taymans <wim.taymans@gmail.com>
|
* Copyright (C) 2018 Wim Taymans <wim.taymans@gmail.com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
@ -17,26 +17,30 @@
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __SPA_LIBPOD_H__
|
#ifndef __SPA_DEBUG_DICT_H__
|
||||||
#define __SPA_LIBPOD_H__
|
#define __SPA_DEBUG_DICT_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spa/param/props.h>
|
#include <spa/utils/dict.h>
|
||||||
#include <spa/pod/builder.h>
|
|
||||||
|
|
||||||
int spa_pod_filter(struct spa_pod_builder *b,
|
#ifndef spa_debug
|
||||||
struct spa_pod **result,
|
#define spa_debug(...) ({ fprintf(stderr, __VA_ARGS__);fputc('\n', stderr); })
|
||||||
const struct spa_pod *pod,
|
|
||||||
const struct spa_pod *filter);
|
|
||||||
|
|
||||||
int spa_pod_compare(const struct spa_pod *pod1,
|
|
||||||
const struct spa_pod *pod2);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __SPA_LIBPOD_H__ */
|
static inline int spa_debug_dict(int indent, const struct spa_dict *dict)
|
||||||
|
{
|
||||||
|
const struct spa_dict_item *item;
|
||||||
|
spa_dict_for_each(item, dict) {
|
||||||
|
spa_debug("%*s%s = \"%s\"", indent, "", item->key, item->value);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __SPA_DEBUG_DICT_H__ */
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* Simple Plugin API
|
/* Simple Plugin API
|
||||||
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
|
* Copyright (C) 2018 Wim Taymans <wim.taymans@gmail.com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
@ -17,26 +17,32 @@
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __SPA_LIBDEBUG_H__
|
#ifndef __SPA_DEBUG_FORMAT_H__
|
||||||
#define __SPA_LIBDEBUG_H__
|
#define __SPA_DEBUG_FORMAT_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <spa/node/node.h>
|
#include <spa/support/type-map.h>
|
||||||
#include <spa/pod/pod.h>
|
#include <spa/debug/mem.h>
|
||||||
|
#include <spa/debug/pod.h>
|
||||||
|
|
||||||
void spa_debug_set_type_map(const struct spa_type_map *map);
|
#ifndef spa_debug
|
||||||
|
#define spa_debug(...) ({ fprintf(stderr, __VA_ARGS__);fputc('\n', stderr); })
|
||||||
|
#endif
|
||||||
|
|
||||||
int spa_debug_port_info(const struct spa_port_info *info);
|
static inline int spa_debug_format(int indent,
|
||||||
int spa_debug_buffer(const struct spa_buffer *buffer);
|
struct spa_type_map *map, const struct spa_pod *pod)
|
||||||
#define SPA_DEBUG_FLAG_FORMAT (1 << 0)
|
{
|
||||||
int spa_debug_pod(const struct spa_pod *pod, uint32_t flags);
|
return spa_debug_pod_value(indent, map,
|
||||||
int spa_debug_dump_mem(const void *data, size_t size);
|
SPA_POD_TYPE(pod),
|
||||||
int spa_debug_dict(const struct spa_dict *dict);
|
SPA_POD_BODY(pod),
|
||||||
|
SPA_POD_BODY_SIZE(pod));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
#endif /* __SPA_LIBDEBUG_H__ */
|
|
||||||
|
#endif /* __SPA_DEBUG_FORMAT_H__ */
|
||||||
54
spa/include/spa/debug/mem.h
Normal file
54
spa/include/spa/debug/mem.h
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
/* Simple Plugin API
|
||||||
|
* Copyright (C) 2018 Wim Taymans <wim.taymans@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SPA_DEBUG_MEM_H__
|
||||||
|
#define __SPA_DEBUG_MEM_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <spa/utils/dict.h>
|
||||||
|
|
||||||
|
#ifndef spa_debug
|
||||||
|
#define spa_debug(...) ({ fprintf(stderr, __VA_ARGS__);fputc('\n', stderr); })
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline int spa_debug_mem(int indent, const void *data, size_t size)
|
||||||
|
{
|
||||||
|
const uint8_t *t = data;
|
||||||
|
char buffer[512];
|
||||||
|
int i, pos = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++) {
|
||||||
|
if (i % 16 == 0)
|
||||||
|
pos = sprintf(buffer, "%p: ", &t[i]);
|
||||||
|
pos += sprintf(buffer + pos, "%02x ", t[i]);
|
||||||
|
if (i % 16 == 15 || i == size - 1) {
|
||||||
|
spa_debug("%*s" "%s", indent, "", buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __SPA_DEBUG_MEM_H__ */
|
||||||
52
spa/include/spa/debug/node.h
Normal file
52
spa/include/spa/debug/node.h
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
/* Simple Plugin API
|
||||||
|
* Copyright (C) 2018 Wim Taymans <wim.taymans@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SPA_DEBUG_NODE_H__
|
||||||
|
#define __SPA_DEBUG_NODE_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <spa/node/node.h>
|
||||||
|
#include <spa/debug/dict.h>
|
||||||
|
|
||||||
|
#ifndef spa_debug
|
||||||
|
#define spa_debug(...) ({ fprintf(stderr, __VA_ARGS__);fputc('\n', stderr); })
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int spa_debug_port_info(int indent, const struct spa_port_info *info)
|
||||||
|
{
|
||||||
|
spa_debug("%*s" "struct spa_port_info %p:", indent, "", info);
|
||||||
|
spa_debug("%*s" " flags: \t%08x", indent, "", info->flags);
|
||||||
|
spa_debug("%*s" " rate: \t%u", indent, "", info->rate);
|
||||||
|
spa_debug("%*s" " props:", indent, "");
|
||||||
|
if (info->props)
|
||||||
|
spa_debug_dict(indent + 2, info->props);
|
||||||
|
else
|
||||||
|
spa_debug("%*s" " none", indent, "");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __SPA_DEBUG_NODE_H__ */
|
||||||
206
spa/include/spa/debug/pod.h
Normal file
206
spa/include/spa/debug/pod.h
Normal file
|
|
@ -0,0 +1,206 @@
|
||||||
|
/* Simple Plugin API
|
||||||
|
* Copyright (C) 2018 Wim Taymans <wim.taymans@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SPA_DEBUG_POD_H__
|
||||||
|
#define __SPA_DEBUG_POD_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <spa/support/type-map.h>
|
||||||
|
#include <spa/debug/mem.h>
|
||||||
|
#include <spa/pod/pod.h>
|
||||||
|
#include <spa/pod/iter.h>
|
||||||
|
|
||||||
|
#ifndef spa_debug
|
||||||
|
#define spa_debug(...) ({ fprintf(stderr, __VA_ARGS__);fputc('\n', stderr); })
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
spa_debug_pod_value(int indent, struct spa_type_map *map,
|
||||||
|
uint32_t type, void *body, uint32_t size)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case SPA_POD_TYPE_BOOL:
|
||||||
|
spa_debug("%*s" "Bool %d", indent, "", *(int32_t *) body);
|
||||||
|
break;
|
||||||
|
case SPA_POD_TYPE_ID:
|
||||||
|
spa_debug("%*s" "Id %d %s", indent, "", *(int32_t *) body,
|
||||||
|
spa_type_map_get_type(map, *(int32_t *) body));
|
||||||
|
break;
|
||||||
|
case SPA_POD_TYPE_INT:
|
||||||
|
spa_debug("%*s" "Int %d", indent, "", *(int32_t *) body);
|
||||||
|
break;
|
||||||
|
case SPA_POD_TYPE_LONG:
|
||||||
|
spa_debug("%*s" "Long %" PRIi64 "", indent, "", *(int64_t *) body);
|
||||||
|
break;
|
||||||
|
case SPA_POD_TYPE_FLOAT:
|
||||||
|
spa_debug("%*s" "Float %f", indent, "", *(float *) body);
|
||||||
|
break;
|
||||||
|
case SPA_POD_TYPE_DOUBLE:
|
||||||
|
spa_debug("%*s" "Double %f", indent, "", *(double *) body);
|
||||||
|
break;
|
||||||
|
case SPA_POD_TYPE_STRING:
|
||||||
|
spa_debug("%*s" "String \"%s\"", indent, "", (char *) body);
|
||||||
|
break;
|
||||||
|
case SPA_POD_TYPE_FD:
|
||||||
|
spa_debug("%*s" "Fd %d", indent, "", *(int *) body);
|
||||||
|
break;
|
||||||
|
case SPA_POD_TYPE_POINTER:
|
||||||
|
{
|
||||||
|
struct spa_pod_pointer_body *b = body;
|
||||||
|
spa_debug("%*s" "Pointer %s %p", indent, "",
|
||||||
|
map ? spa_type_map_get_type(map, b->type) : "*no map*", b->value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SPA_POD_TYPE_RECTANGLE:
|
||||||
|
{
|
||||||
|
struct spa_rectangle *r = body;
|
||||||
|
spa_debug("%*s" "Rectangle %dx%d", indent, "", r->width, r->height);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SPA_POD_TYPE_FRACTION:
|
||||||
|
{
|
||||||
|
struct spa_fraction *f = body;
|
||||||
|
spa_debug("%*s" "Fraction %d/%d", indent, "", f->num, f->denom);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SPA_POD_TYPE_BITMAP:
|
||||||
|
spa_debug("%*s" "Bitmap", indent, "");
|
||||||
|
break;
|
||||||
|
case SPA_POD_TYPE_ARRAY:
|
||||||
|
{
|
||||||
|
struct spa_pod_array_body *b = body;
|
||||||
|
void *p;
|
||||||
|
spa_debug("%*s" "Array: child.size %d, child.type %d", indent, "",
|
||||||
|
b->child.size, b->child.type);
|
||||||
|
|
||||||
|
SPA_POD_ARRAY_BODY_FOREACH(b, size, p)
|
||||||
|
spa_debug_pod_value(indent + 2, map, b->child.type, p, b->child.size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SPA_POD_TYPE_STRUCT:
|
||||||
|
{
|
||||||
|
struct spa_pod *b = body, *p;
|
||||||
|
spa_debug("%*s" "Struct: size %d", indent, "", size);
|
||||||
|
SPA_POD_FOREACH(b, size, p)
|
||||||
|
spa_debug_pod_value(indent + 2, map, p->type, SPA_POD_BODY(p), p->size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SPA_POD_TYPE_OBJECT:
|
||||||
|
{
|
||||||
|
struct spa_pod_object_body *b = body;
|
||||||
|
struct spa_pod *p;
|
||||||
|
|
||||||
|
spa_debug("%*s" "Object: size %d, id %s, type %s", indent, "", size,
|
||||||
|
map ? spa_type_map_get_type(map, b->id) : "*no map*",
|
||||||
|
map ? spa_type_map_get_type(map, b->type) : "*no map*");
|
||||||
|
SPA_POD_OBJECT_BODY_FOREACH(b, size, p)
|
||||||
|
spa_debug_pod_value(indent + 2, map, p->type, SPA_POD_BODY(p), p->size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SPA_POD_TYPE_PROP:
|
||||||
|
{
|
||||||
|
struct spa_pod_prop_body *b = body;
|
||||||
|
void *alt;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
spa_debug("%*s" "Prop: key %s, flags %d", indent, "",
|
||||||
|
map ? spa_type_map_get_type(map, b->key) : "*no map*", b->flags);
|
||||||
|
if (b->flags & SPA_POD_PROP_FLAG_UNSET)
|
||||||
|
spa_debug("%*s" "Unset (Default):", indent + 2, "");
|
||||||
|
else
|
||||||
|
spa_debug("%*s" "Value: size %u", indent + 2, "", b->value.size);
|
||||||
|
spa_debug_pod_value(indent + 4, map, b->value.type, SPA_POD_BODY(&b->value),
|
||||||
|
b->value.size);
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
switch (b->flags & SPA_POD_PROP_RANGE_MASK) {
|
||||||
|
case SPA_POD_PROP_RANGE_NONE:
|
||||||
|
break;
|
||||||
|
case SPA_POD_PROP_RANGE_MIN_MAX:
|
||||||
|
SPA_POD_PROP_ALTERNATIVE_FOREACH(b, size, alt) {
|
||||||
|
if (i == 0)
|
||||||
|
spa_debug("%*s" "Min: ", indent + 2, "");
|
||||||
|
else if (i == 1)
|
||||||
|
spa_debug("%*s" "Max: ", indent + 2, "");
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
spa_debug_pod_value(indent + 4, map, b->value.type, alt, b->value.size);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SPA_POD_PROP_RANGE_STEP:
|
||||||
|
SPA_POD_PROP_ALTERNATIVE_FOREACH(b, size, alt) {
|
||||||
|
if (i == 0)
|
||||||
|
spa_debug("%*s" "Min: ", indent + 2, "");
|
||||||
|
else if (i == 1)
|
||||||
|
spa_debug("%*s" "Max: ", indent + 2, "");
|
||||||
|
else if (i == 2)
|
||||||
|
spa_debug("%*s" "Step: ", indent + 2, "");
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
spa_debug_pod_value(indent + 4, map, b->value.type, alt, b->value.size);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SPA_POD_PROP_RANGE_ENUM:
|
||||||
|
SPA_POD_PROP_ALTERNATIVE_FOREACH(b, size, alt) {
|
||||||
|
if (i == 0) {
|
||||||
|
spa_debug("%*s" "Enum:", indent + 2, "");
|
||||||
|
}
|
||||||
|
spa_debug_pod_value(indent + 4, map, b->value.type, alt, b->value.size);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SPA_POD_PROP_RANGE_FLAGS:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SPA_POD_TYPE_BYTES:
|
||||||
|
spa_debug("%*s" "Bytes", indent, "");
|
||||||
|
spa_debug_mem(indent + 2, body, size);
|
||||||
|
break;
|
||||||
|
case SPA_POD_TYPE_NONE:
|
||||||
|
spa_debug("%*s" "None", indent, "");
|
||||||
|
spa_debug_mem(indent + 2, body, size);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
spa_debug("%*s" "unhandled POD type %d", indent, "", type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int spa_debug_pod(int indent,
|
||||||
|
struct spa_type_map *map, const struct spa_pod *pod)
|
||||||
|
{
|
||||||
|
return spa_debug_pod_value(indent, map,
|
||||||
|
SPA_POD_TYPE(pod),
|
||||||
|
SPA_POD_BODY(pod),
|
||||||
|
SPA_POD_BODY_SIZE(pod));
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __SPA_DEBUG_POD_H__ */
|
||||||
|
|
@ -102,8 +102,10 @@ struct spa_log {
|
||||||
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
|
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
|
||||||
|
|
||||||
#define spa_log_log(l,lev,...) \
|
#define spa_log_log(l,lev,...) \
|
||||||
|
({ \
|
||||||
if (SPA_UNLIKELY (spa_log_level_enabled (l, lev))) \
|
if (SPA_UNLIKELY (spa_log_level_enabled (l, lev))) \
|
||||||
(l)->log((l),lev,__VA_ARGS__)
|
(l)->log((l),lev,__VA_ARGS__); \
|
||||||
|
})
|
||||||
|
|
||||||
#define spa_log_error(l,...) spa_log_log(l,SPA_LOG_LEVEL_ERROR,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
#define spa_log_error(l,...) spa_log_log(l,SPA_LOG_LEVEL_ERROR,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||||
#define spa_log_warn(l,...) spa_log_log(l,SPA_LOG_LEVEL_WARN,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
#define spa_log_warn(l,...) spa_log_log(l,SPA_LOG_LEVEL_WARN,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||||
|
|
|
||||||
460
spa/lib/debug.c
460
spa/lib/debug.c
|
|
@ -1,460 +0,0 @@
|
||||||
/* Simple Plugin API
|
|
||||||
* Copyright (C) 2016 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/eventfd.h>
|
|
||||||
|
|
||||||
#include <spa/support/loop.h>
|
|
||||||
#include <spa/pod/parser.h>
|
|
||||||
|
|
||||||
#include "debug.h"
|
|
||||||
|
|
||||||
static const struct spa_type_map *map;
|
|
||||||
|
|
||||||
void spa_debug_set_type_map(const struct spa_type_map *m)
|
|
||||||
{
|
|
||||||
map = m;
|
|
||||||
}
|
|
||||||
|
|
||||||
int spa_debug_port_info(const struct spa_port_info *info)
|
|
||||||
{
|
|
||||||
if (info == NULL)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
fprintf(stderr, "struct spa_port_info %p:\n", info);
|
|
||||||
fprintf(stderr, " flags: \t%08x\n", info->flags);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int spa_debug_buffer(const struct spa_buffer *buffer)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (buffer == NULL)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
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++) {
|
|
||||||
struct spa_meta *m = &buffer->metas[i];
|
|
||||||
const char *type_name;
|
|
||||||
|
|
||||||
type_name = spa_type_map_get_type(map, m->type);
|
|
||||||
fprintf(stderr, " meta %d: type %d (%s), data %p, size %d:\n", i, m->type,
|
|
||||||
type_name, m->data, m->size);
|
|
||||||
|
|
||||||
if (!strcmp(type_name, SPA_TYPE_META__Header)) {
|
|
||||||
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__VideoCrop)) {
|
|
||||||
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 {
|
|
||||||
fprintf(stderr, " Unknown:\n");
|
|
||||||
spa_debug_dump_mem(m->data, m->size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf(stderr, " n_datas: \t%u (at %p)\n", buffer->n_datas, buffer->datas);
|
|
||||||
for (i = 0; i < buffer->n_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);
|
|
||||||
fprintf(stderr, " fd: %d\n", d->fd);
|
|
||||||
fprintf(stderr, " offset: %d\n", d->mapoffset);
|
|
||||||
fprintf(stderr, " maxsize: %u\n", d->maxsize);
|
|
||||||
fprintf(stderr, " chunk: %p\n", d->chunk);
|
|
||||||
fprintf(stderr, " offset: %d\n", d->chunk->offset);
|
|
||||||
fprintf(stderr, " size: %u\n", d->chunk->size);
|
|
||||||
fprintf(stderr, " stride: %d\n", d->chunk->stride);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int spa_debug_dump_mem(const void *mem, size_t size)
|
|
||||||
{
|
|
||||||
const uint8_t *t = mem;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (mem == NULL)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
for (i = 0; i < size; i++) {
|
|
||||||
if (i % 16 == 0)
|
|
||||||
fprintf(stderr,"%p: ", &t[i]);
|
|
||||||
fprintf(stderr,"%02x ", t[i]);
|
|
||||||
if (i % 16 == 15 || i == size - 1)
|
|
||||||
fprintf(stderr,"\n");
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *pod_type_names[] = {
|
|
||||||
[SPA_POD_TYPE_INVALID] = "invalid",
|
|
||||||
[SPA_POD_TYPE_NONE] = "none",
|
|
||||||
[SPA_POD_TYPE_BOOL] = "bool",
|
|
||||||
[SPA_POD_TYPE_ID] = "id",
|
|
||||||
[SPA_POD_TYPE_INT] = "int",
|
|
||||||
[SPA_POD_TYPE_LONG] = "long",
|
|
||||||
[SPA_POD_TYPE_FLOAT] = "float",
|
|
||||||
[SPA_POD_TYPE_DOUBLE] = "double",
|
|
||||||
[SPA_POD_TYPE_STRING] = "string",
|
|
||||||
[SPA_POD_TYPE_BYTES] = "bytes",
|
|
||||||
[SPA_POD_TYPE_RECTANGLE] = "rectangle",
|
|
||||||
[SPA_POD_TYPE_FRACTION] = "fraction",
|
|
||||||
[SPA_POD_TYPE_BITMAP] = "bitmap",
|
|
||||||
[SPA_POD_TYPE_ARRAY] = "array",
|
|
||||||
[SPA_POD_TYPE_STRUCT] = "struct",
|
|
||||||
[SPA_POD_TYPE_OBJECT] = "object",
|
|
||||||
[SPA_POD_TYPE_POINTER] = "pointer",
|
|
||||||
[SPA_POD_TYPE_FD] = "fd",
|
|
||||||
[SPA_POD_TYPE_PROP] = "prop",
|
|
||||||
[SPA_POD_TYPE_POD] = "pod"
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_pod_value(uint32_t size, uint32_t type, void *body, int prefix)
|
|
||||||
{
|
|
||||||
switch (type) {
|
|
||||||
case SPA_POD_TYPE_BOOL:
|
|
||||||
fprintf(stderr,"%-*sBool %d\n", prefix, "", *(int32_t *) body);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_ID:
|
|
||||||
fprintf(stderr,"%-*sId %d %s\n", prefix, "", *(int32_t *) body,
|
|
||||||
spa_type_map_get_type(map, *(int32_t *) body));
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_INT:
|
|
||||||
fprintf(stderr,"%-*sInt %d\n", prefix, "", *(int32_t *) body);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_LONG:
|
|
||||||
fprintf(stderr,"%-*sLong %" PRIi64 "\n", prefix, "", *(int64_t *) body);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_FLOAT:
|
|
||||||
fprintf(stderr,"%-*sFloat %f\n", prefix, "", *(float *) body);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_DOUBLE:
|
|
||||||
fprintf(stderr,"%-*sDouble %f\n", prefix, "", *(double *) body);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_STRING:
|
|
||||||
fprintf(stderr,"%-*sString \"%s\"\n", prefix, "", (char *) body);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_FD:
|
|
||||||
fprintf(stderr,"%-*sFd %d\n", prefix, "", *(int *) body);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_POINTER:
|
|
||||||
{
|
|
||||||
struct spa_pod_pointer_body *b = body;
|
|
||||||
fprintf(stderr,"%-*sPointer %s %p\n", prefix, "",
|
|
||||||
map ? spa_type_map_get_type(map, b->type) : "*no map*", b->value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPA_POD_TYPE_RECTANGLE:
|
|
||||||
{
|
|
||||||
struct spa_rectangle *r = body;
|
|
||||||
fprintf(stderr,"%-*sRectangle %dx%d\n", prefix, "", r->width, r->height);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPA_POD_TYPE_FRACTION:
|
|
||||||
{
|
|
||||||
struct spa_fraction *f = body;
|
|
||||||
fprintf(stderr,"%-*sFraction %d/%d\n", prefix, "", f->num, f->denom);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPA_POD_TYPE_BITMAP:
|
|
||||||
fprintf(stderr,"%-*sBitmap\n", prefix, "");
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_ARRAY:
|
|
||||||
{
|
|
||||||
struct spa_pod_array_body *b = body;
|
|
||||||
void *p;
|
|
||||||
fprintf(stderr,"%-*sArray: child.size %d, child.type %d\n", prefix, "",
|
|
||||||
b->child.size, b->child.type);
|
|
||||||
|
|
||||||
SPA_POD_ARRAY_BODY_FOREACH(b, size, p)
|
|
||||||
print_pod_value(b->child.size, b->child.type, p, prefix + 2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPA_POD_TYPE_STRUCT:
|
|
||||||
{
|
|
||||||
struct spa_pod *b = body, *p;
|
|
||||||
fprintf(stderr,"%-*sStruct: size %d\n", prefix, "", size);
|
|
||||||
SPA_POD_FOREACH(b, size, p)
|
|
||||||
print_pod_value(p->size, p->type, SPA_POD_BODY(p), prefix + 2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPA_POD_TYPE_OBJECT:
|
|
||||||
{
|
|
||||||
struct spa_pod_object_body *b = body;
|
|
||||||
struct spa_pod *p;
|
|
||||||
|
|
||||||
fprintf(stderr,"%-*sObject: size %d, id %s, type %s\n", prefix, "", size,
|
|
||||||
map ? spa_type_map_get_type(map, b->id) : "*no map*",
|
|
||||||
map ? spa_type_map_get_type(map, b->type) : "*no map*");
|
|
||||||
SPA_POD_OBJECT_BODY_FOREACH(b, size, p)
|
|
||||||
print_pod_value(p->size, p->type, SPA_POD_BODY(p), prefix + 2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPA_POD_TYPE_PROP:
|
|
||||||
{
|
|
||||||
struct spa_pod_prop_body *b = body;
|
|
||||||
void *alt;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
fprintf(stderr,"%-*sProp: key %s, flags %d\n", prefix, "",
|
|
||||||
map ? spa_type_map_get_type(map, b->key) : "*no map*", b->flags);
|
|
||||||
if (b->flags & SPA_POD_PROP_FLAG_UNSET)
|
|
||||||
fprintf(stderr,"%-*sUnset (Default):\n", prefix + 2, "");
|
|
||||||
else
|
|
||||||
fprintf(stderr,"%-*sValue: size %u\n", prefix + 2, "", b->value.size);
|
|
||||||
print_pod_value(b->value.size, b->value.type, SPA_POD_BODY(&b->value),
|
|
||||||
prefix + 4);
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
switch (b->flags & SPA_POD_PROP_RANGE_MASK) {
|
|
||||||
case SPA_POD_PROP_RANGE_NONE:
|
|
||||||
break;
|
|
||||||
case SPA_POD_PROP_RANGE_MIN_MAX:
|
|
||||||
SPA_POD_PROP_ALTERNATIVE_FOREACH(b, size, alt) {
|
|
||||||
if (i == 0)
|
|
||||||
fprintf(stderr,"%-*sMin: ", prefix + 2, "");
|
|
||||||
else if (i == 1)
|
|
||||||
fprintf(stderr,"%-*sMax: ", prefix + 2, "");
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
print_pod_value(b->value.size, b->value.type, alt, 0);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SPA_POD_PROP_RANGE_STEP:
|
|
||||||
SPA_POD_PROP_ALTERNATIVE_FOREACH(b, size, alt) {
|
|
||||||
if (i == 0)
|
|
||||||
fprintf(stderr,"%-*sMin: ", prefix + 2, "");
|
|
||||||
else if (i == 1)
|
|
||||||
fprintf(stderr,"%-*sMax: ", prefix + 2, "");
|
|
||||||
else if (i == 2)
|
|
||||||
fprintf(stderr,"%-*sStep: ", prefix + 2, "");
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
print_pod_value(b->value.size, b->value.type, alt, 0);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SPA_POD_PROP_RANGE_ENUM:
|
|
||||||
SPA_POD_PROP_ALTERNATIVE_FOREACH(b, size, alt) {
|
|
||||||
if (i == 0)
|
|
||||||
fprintf(stderr,"%-*sEnum:\n", prefix + 2, "");
|
|
||||||
print_pod_value(b->value.size, b->value.type, alt, prefix + 4);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SPA_POD_PROP_RANGE_FLAGS:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPA_POD_TYPE_BYTES:
|
|
||||||
fprintf(stderr,"%-*sBytes\n", prefix, "");
|
|
||||||
spa_debug_dump_mem(body, size);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_NONE:
|
|
||||||
fprintf(stderr,"%-*sNone\n", prefix, "");
|
|
||||||
spa_debug_dump_mem(body, size);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr,"unhandled POD type %d\n", type);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_format_value(uint32_t size, uint32_t type, void *body)
|
|
||||||
{
|
|
||||||
switch (type) {
|
|
||||||
case SPA_POD_TYPE_BOOL:
|
|
||||||
fprintf(stderr, "%s", *(int32_t *) body ? "true" : "false");
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_ID:
|
|
||||||
{
|
|
||||||
const char *str = map ? spa_type_map_get_type(map, *(int32_t *) body) : NULL;
|
|
||||||
if (str) {
|
|
||||||
const char *h = rindex(str, ':');
|
|
||||||
if (h)
|
|
||||||
str = h + 1;
|
|
||||||
} else {
|
|
||||||
str = "unknown";
|
|
||||||
}
|
|
||||||
fprintf(stderr, "%s", str);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPA_POD_TYPE_INT:
|
|
||||||
fprintf(stderr, "%" PRIi32, *(int32_t *) body);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_LONG:
|
|
||||||
fprintf(stderr, "%" PRIi64, *(int64_t *) body);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_FLOAT:
|
|
||||||
fprintf(stderr, "%f", *(float *) body);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_DOUBLE:
|
|
||||||
fprintf(stderr, "%g", *(double *) body);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_STRING:
|
|
||||||
fprintf(stderr, "%s", (char *) body);
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_RECTANGLE:
|
|
||||||
{
|
|
||||||
struct spa_rectangle *r = body;
|
|
||||||
fprintf(stderr, "%" PRIu32 "x%" PRIu32, r->width, r->height);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPA_POD_TYPE_FRACTION:
|
|
||||||
{
|
|
||||||
struct spa_fraction *f = body;
|
|
||||||
fprintf(stderr, "%" PRIu32 "/%" PRIu32, f->num, f->denom);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPA_POD_TYPE_BITMAP:
|
|
||||||
fprintf(stderr, "Bitmap");
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_BYTES:
|
|
||||||
fprintf(stderr, "Bytes");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int spa_debug_format(const struct spa_pod *format)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
const char *media_type;
|
|
||||||
const char *media_subtype;
|
|
||||||
struct spa_pod *pod;
|
|
||||||
uint32_t mtype, mstype;
|
|
||||||
|
|
||||||
if (format == NULL || SPA_POD_TYPE(format) != SPA_POD_TYPE_OBJECT)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (spa_pod_object_parse(format, "I", &mtype,
|
|
||||||
"I", &mstype) < 0)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
media_type = spa_type_map_get_type(map, mtype);
|
|
||||||
media_subtype = spa_type_map_get_type(map, mstype);
|
|
||||||
|
|
||||||
fprintf(stderr, "%-6s %s/%s\n", "", rindex(media_type, ':') + 1,
|
|
||||||
rindex(media_subtype, ':') + 1);
|
|
||||||
|
|
||||||
SPA_POD_OBJECT_FOREACH((struct spa_pod_object*)format, pod) {
|
|
||||||
struct spa_pod_prop *prop;
|
|
||||||
const char *key;
|
|
||||||
|
|
||||||
if (pod->type != SPA_POD_TYPE_PROP)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
prop = (struct spa_pod_prop *)pod;
|
|
||||||
|
|
||||||
if ((prop->body.flags & SPA_POD_PROP_FLAG_UNSET) &&
|
|
||||||
(prop->body.flags & SPA_POD_PROP_FLAG_OPTIONAL))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
key = spa_type_map_get_type(map, prop->body.key);
|
|
||||||
|
|
||||||
fprintf(stderr, " %20s : (%s) ", rindex(key, ':') + 1,
|
|
||||||
pod_type_names[prop->body.value.type]);
|
|
||||||
|
|
||||||
if (!(prop->body.flags & SPA_POD_PROP_FLAG_UNSET)) {
|
|
||||||
print_format_value(prop->body.value.size,
|
|
||||||
prop->body.value.type, SPA_POD_BODY(&prop->body.value));
|
|
||||||
} else {
|
|
||||||
const char *ssep, *esep, *sep;
|
|
||||||
void *alt;
|
|
||||||
|
|
||||||
switch (prop->body.flags & SPA_POD_PROP_RANGE_MASK) {
|
|
||||||
case SPA_POD_PROP_RANGE_MIN_MAX:
|
|
||||||
case SPA_POD_PROP_RANGE_STEP:
|
|
||||||
ssep = "[ ";
|
|
||||||
sep = ", ";
|
|
||||||
esep = " ]";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case SPA_POD_PROP_RANGE_ENUM:
|
|
||||||
case SPA_POD_PROP_RANGE_FLAGS:
|
|
||||||
ssep = "{ ";
|
|
||||||
sep = ", ";
|
|
||||||
esep = " }";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, "%s", ssep);
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
SPA_POD_PROP_ALTERNATIVE_FOREACH(&prop->body, prop->pod.size, alt) {
|
|
||||||
if (i > 0)
|
|
||||||
fprintf(stderr, "%s", sep);
|
|
||||||
print_format_value(prop->body.value.size,
|
|
||||||
prop->body.value.type, alt);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
fprintf(stderr, "%s", esep);
|
|
||||||
}
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int spa_debug_pod(const struct spa_pod *pod, uint32_t flags)
|
|
||||||
{
|
|
||||||
int res = 0;
|
|
||||||
|
|
||||||
if (flags & SPA_DEBUG_FLAG_FORMAT)
|
|
||||||
res = spa_debug_format(pod);
|
|
||||||
else
|
|
||||||
print_pod_value(pod->size, pod->type, SPA_POD_BODY(pod), 0);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int spa_debug_dict(const struct spa_dict *dict)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
if (dict == NULL)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
for (i = 0; i < dict->n_items; i++)
|
|
||||||
fprintf(stderr, " %s = \"%s\"\n", dict->items[i].key,
|
|
||||||
dict->items[i].value);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
spalib_headers = [
|
|
||||||
'debug.h',
|
|
||||||
]
|
|
||||||
|
|
||||||
install_headers(spalib_headers, subdir : 'spa/lib')
|
|
||||||
|
|
||||||
spalib_sources = ['debug.c' ]
|
|
||||||
|
|
||||||
spalib = shared_library('spa-lib-@0@'.format(spaversion),
|
|
||||||
spalib_sources,
|
|
||||||
version : libversion,
|
|
||||||
soversion : soversion,
|
|
||||||
include_directories : [ spa_inc, spa_libinc ],
|
|
||||||
install : true)
|
|
||||||
|
|
||||||
spalib_dep = declare_dependency(link_with : spalib,
|
|
||||||
include_directories : spa_inc,
|
|
||||||
)
|
|
||||||
491
spa/lib/pod.c
491
spa/lib/pod.c
|
|
@ -1,491 +0,0 @@
|
||||||
/* Simple Plugin API
|
|
||||||
* Copyright (C) 2016 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <spa/param/props.h>
|
|
||||||
#include <spa/pod/iter.h>
|
|
||||||
#include <spa/pod/builder.h>
|
|
||||||
|
|
||||||
static int compare_value(enum spa_pod_type type, const void *r1, const void *r2)
|
|
||||||
{
|
|
||||||
switch (type) {
|
|
||||||
case SPA_POD_TYPE_INVALID:
|
|
||||||
return 0;
|
|
||||||
case SPA_POD_TYPE_BOOL:
|
|
||||||
case SPA_POD_TYPE_ID:
|
|
||||||
return *(int32_t *) r1 == *(uint32_t *) r2 ? 0 : 1;
|
|
||||||
case SPA_POD_TYPE_INT:
|
|
||||||
return *(int32_t *) r1 - *(int32_t *) r2;
|
|
||||||
case SPA_POD_TYPE_LONG:
|
|
||||||
return *(int64_t *) r1 - *(int64_t *) r2;
|
|
||||||
case SPA_POD_TYPE_FLOAT:
|
|
||||||
return *(float *) r1 - *(float *) r2;
|
|
||||||
case SPA_POD_TYPE_DOUBLE:
|
|
||||||
return *(double *) r1 - *(double *) r2;
|
|
||||||
case SPA_POD_TYPE_STRING:
|
|
||||||
return strcmp(r1, r2);
|
|
||||||
case SPA_POD_TYPE_RECTANGLE:
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
case SPA_POD_TYPE_FRACTION:
|
|
||||||
{
|
|
||||||
const struct spa_fraction *f1 = (struct spa_fraction *) r1,
|
|
||||||
*f2 = (struct spa_fraction *) r2;
|
|
||||||
int64_t n1, n2;
|
|
||||||
n1 = ((int64_t) f1->num) * f2->denom;
|
|
||||||
n2 = ((int64_t) f2->num) * f1->denom;
|
|
||||||
if (n1 < n2)
|
|
||||||
return -1;
|
|
||||||
else if (n1 > n2)
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void fix_default(struct spa_pod_prop *prop)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
switch (prop->body.flags & SPA_POD_PROP_RANGE_MASK) {
|
|
||||||
case SPA_POD_PROP_RANGE_NONE:
|
|
||||||
break;
|
|
||||||
case SPA_POD_PROP_RANGE_MIN_MAX:
|
|
||||||
case SPA_POD_PROP_RANGE_STEP:
|
|
||||||
if (compare_value(prop->body.value.type, val, alt) < 0)
|
|
||||||
memcpy(val, alt, prop->body.value.size);
|
|
||||||
alt = SPA_MEMBER(alt, prop->body.value.size, void);
|
|
||||||
if (compare_value(prop->body.value.type, val, alt) > 0)
|
|
||||||
memcpy(val, alt, prop->body.value.size);
|
|
||||||
break;
|
|
||||||
case SPA_POD_PROP_RANGE_ENUM:
|
|
||||||
{
|
|
||||||
void *best = NULL;
|
|
||||||
|
|
||||||
for (i = 0; i < nalt; i++) {
|
|
||||||
if (compare_value(prop->body.value.type, val, alt) == 0) {
|
|
||||||
best = alt;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (best == NULL)
|
|
||||||
best = alt;
|
|
||||||
alt = SPA_MEMBER(alt, prop->body.value.size, void);
|
|
||||||
}
|
|
||||||
if (best)
|
|
||||||
memcpy(val, best, prop->body.value.size);
|
|
||||||
|
|
||||||
if (nalt <= 1) {
|
|
||||||
prop->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;
|
|
||||||
prop->body.flags &= ~SPA_POD_PROP_RANGE_MASK;
|
|
||||||
prop->body.flags |= SPA_POD_PROP_RANGE_NONE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SPA_POD_PROP_RANGE_FLAGS:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct spa_pod_prop *find_prop(const struct spa_pod *pod, uint32_t size, uint32_t key)
|
|
||||||
{
|
|
||||||
const struct spa_pod *res;
|
|
||||||
SPA_POD_FOREACH(pod, size, res) {
|
|
||||||
if (res->type == SPA_POD_TYPE_PROP
|
|
||||||
&& ((struct spa_pod_prop *) res)->body.key == key)
|
|
||||||
return (struct spa_pod_prop *) res;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
filter_prop(struct spa_pod_builder *b,
|
|
||||||
const struct spa_pod_prop *p1,
|
|
||||||
const struct spa_pod_prop *p2)
|
|
||||||
{
|
|
||||||
struct spa_pod_prop *np;
|
|
||||||
int nalt1, nalt2;
|
|
||||||
void *alt1, *alt2, *a1, *a2;
|
|
||||||
uint32_t rt1, rt2;
|
|
||||||
int j, k;
|
|
||||||
|
|
||||||
/* incompatible property types */
|
|
||||||
if (p1->body.value.type != p2->body.value.type)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
rt1 = p1->body.flags & SPA_POD_PROP_RANGE_MASK;
|
|
||||||
rt2 = p2->body.flags & SPA_POD_PROP_RANGE_MASK;
|
|
||||||
|
|
||||||
alt1 = SPA_MEMBER(p1, sizeof(struct spa_pod_prop), void);
|
|
||||||
nalt1 = SPA_POD_PROP_N_VALUES(p1);
|
|
||||||
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) {
|
|
||||||
alt1 = SPA_MEMBER(alt1, p1->body.value.size, void);
|
|
||||||
nalt1--;
|
|
||||||
} else {
|
|
||||||
nalt1 = 1;
|
|
||||||
rt1 = SPA_POD_PROP_RANGE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p2->body.flags & SPA_POD_PROP_FLAG_UNSET) {
|
|
||||||
alt2 = SPA_MEMBER(alt2, p2->body.value.size, void);
|
|
||||||
nalt2--;
|
|
||||||
} else {
|
|
||||||
nalt2 = 1;
|
|
||||||
rt2 = SPA_POD_PROP_RANGE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* start with copying the property */
|
|
||||||
np = spa_pod_builder_deref(b, spa_pod_builder_push_prop(b, p1->body.key, 0));
|
|
||||||
|
|
||||||
/* default value */
|
|
||||||
spa_pod_builder_raw(b, &p1->body.value, sizeof(p1->body.value) + p1->body.value.size);
|
|
||||||
|
|
||||||
if ((rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_NONE) ||
|
|
||||||
(rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_ENUM) ||
|
|
||||||
(rt1 == SPA_POD_PROP_RANGE_ENUM && rt2 == SPA_POD_PROP_RANGE_NONE) ||
|
|
||||||
(rt1 == SPA_POD_PROP_RANGE_ENUM && rt2 == SPA_POD_PROP_RANGE_ENUM)) {
|
|
||||||
int n_copied = 0;
|
|
||||||
/* copy all equal values but don't copy the default value again */
|
|
||||||
for (j = 0, a1 = alt1; j < nalt1; j++, a1 += p1->body.value.size) {
|
|
||||||
for (k = 0, a2 = alt2; k < nalt2; k++, a2 += p2->body.value.size) {
|
|
||||||
if (compare_value(p1->body.value.type, a1, a2) == 0) {
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_ENUM || j > 0)
|
|
||||||
spa_pod_builder_raw(b, a1, p1->body.value.size);
|
|
||||||
n_copied++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (n_copied == 0)
|
|
||||||
return -EINVAL;
|
|
||||||
np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_MIN_MAX) ||
|
|
||||||
(rt1 == SPA_POD_PROP_RANGE_ENUM && rt2 == SPA_POD_PROP_RANGE_MIN_MAX)) {
|
|
||||||
int n_copied = 0;
|
|
||||||
/* copy all values inside the range */
|
|
||||||
for (j = 0, a1 = alt1, a2 = alt2; j < nalt1; j++, a1 += p1->body.value.size) {
|
|
||||||
if (compare_value(p1->body.value.type, a1, a2) < 0)
|
|
||||||
continue;
|
|
||||||
if (compare_value(p1->body.value.type, a1, a2 + p2->body.value.size) > 0)
|
|
||||||
continue;
|
|
||||||
spa_pod_builder_raw(b, a1, p1->body.value.size);
|
|
||||||
n_copied++;
|
|
||||||
}
|
|
||||||
if (n_copied == 0)
|
|
||||||
return -EINVAL;
|
|
||||||
np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_STEP) ||
|
|
||||||
(rt1 == SPA_POD_PROP_RANGE_ENUM && rt2 == SPA_POD_PROP_RANGE_STEP)) {
|
|
||||||
return -ENOTSUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((rt1 == SPA_POD_PROP_RANGE_MIN_MAX && rt2 == SPA_POD_PROP_RANGE_NONE) ||
|
|
||||||
(rt1 == SPA_POD_PROP_RANGE_MIN_MAX && rt2 == SPA_POD_PROP_RANGE_ENUM)) {
|
|
||||||
int n_copied = 0;
|
|
||||||
/* copy all values inside the range */
|
|
||||||
for (k = 0, a1 = alt1, a2 = alt2; k < nalt2; k++, a2 += p2->body.value.size) {
|
|
||||||
if (compare_value(p1->body.value.type, a2, a1) < 0)
|
|
||||||
continue;
|
|
||||||
if (compare_value(p1->body.value.type, a2, a1 + p1->body.value.size) > 0)
|
|
||||||
continue;
|
|
||||||
spa_pod_builder_raw(b, a2, p2->body.value.size);
|
|
||||||
n_copied++;
|
|
||||||
}
|
|
||||||
if (n_copied == 0)
|
|
||||||
return -EINVAL;
|
|
||||||
np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_MIN_MAX && rt2 == SPA_POD_PROP_RANGE_MIN_MAX) {
|
|
||||||
if (compare_value(p1->body.value.type, alt1, alt2) < 0)
|
|
||||||
spa_pod_builder_raw(b, alt2, p2->body.value.size);
|
|
||||||
else
|
|
||||||
spa_pod_builder_raw(b, alt1, p1->body.value.size);
|
|
||||||
|
|
||||||
alt1 += p1->body.value.size;
|
|
||||||
alt2 += p2->body.value.size;
|
|
||||||
|
|
||||||
if (compare_value(p1->body.value.type, alt1, alt2) < 0)
|
|
||||||
spa_pod_builder_raw(b, alt1, p1->body.value.size);
|
|
||||||
else
|
|
||||||
spa_pod_builder_raw(b, alt2, p2->body.value.size);
|
|
||||||
|
|
||||||
np->body.flags |= SPA_POD_PROP_RANGE_MIN_MAX | SPA_POD_PROP_FLAG_UNSET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_FLAGS)
|
|
||||||
return -ENOTSUP;
|
|
||||||
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_MIN_MAX && rt2 == SPA_POD_PROP_RANGE_STEP)
|
|
||||||
return -ENOTSUP;
|
|
||||||
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_MIN_MAX && rt2 == SPA_POD_PROP_RANGE_FLAGS)
|
|
||||||
return -ENOTSUP;
|
|
||||||
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_ENUM && rt2 == SPA_POD_PROP_RANGE_FLAGS)
|
|
||||||
return -ENOTSUP;
|
|
||||||
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_STEP && rt2 == SPA_POD_PROP_RANGE_NONE)
|
|
||||||
return -ENOTSUP;
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_STEP && rt2 == SPA_POD_PROP_RANGE_MIN_MAX)
|
|
||||||
return -ENOTSUP;
|
|
||||||
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_STEP && rt2 == SPA_POD_PROP_RANGE_STEP)
|
|
||||||
return -ENOTSUP;
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_STEP && rt2 == SPA_POD_PROP_RANGE_ENUM)
|
|
||||||
return -ENOTSUP;
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_STEP && rt2 == SPA_POD_PROP_RANGE_FLAGS)
|
|
||||||
return -ENOTSUP;
|
|
||||||
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_FLAGS && rt2 == SPA_POD_PROP_RANGE_NONE)
|
|
||||||
return -ENOTSUP;
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_FLAGS && rt2 == SPA_POD_PROP_RANGE_MIN_MAX)
|
|
||||||
return -ENOTSUP;
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_FLAGS && rt2 == SPA_POD_PROP_RANGE_STEP)
|
|
||||||
return -ENOTSUP;
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_FLAGS && rt2 == SPA_POD_PROP_RANGE_ENUM)
|
|
||||||
return -ENOTSUP;
|
|
||||||
if (rt1 == SPA_POD_PROP_RANGE_FLAGS && rt2 == SPA_POD_PROP_RANGE_FLAGS)
|
|
||||||
return -ENOTSUP;
|
|
||||||
|
|
||||||
spa_pod_builder_pop(b);
|
|
||||||
fix_default(np);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int pod_filter(struct spa_pod_builder *b,
|
|
||||||
const struct spa_pod *pod, uint32_t pod_size,
|
|
||||||
const struct spa_pod *filter, uint32_t filter_size)
|
|
||||||
{
|
|
||||||
const struct spa_pod *pp, *pf;
|
|
||||||
int res = 0;
|
|
||||||
|
|
||||||
pf = filter;
|
|
||||||
|
|
||||||
SPA_POD_FOREACH(pod, pod_size, pp) {
|
|
||||||
bool do_copy = false, do_advance = false;
|
|
||||||
uint32_t filter_offset = 0;
|
|
||||||
|
|
||||||
switch (SPA_POD_TYPE(pp)) {
|
|
||||||
case SPA_POD_TYPE_STRUCT:
|
|
||||||
case SPA_POD_TYPE_OBJECT:
|
|
||||||
if (pf != NULL) {
|
|
||||||
if (SPA_POD_TYPE(pf) != SPA_POD_TYPE(pp))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (SPA_POD_TYPE(pp) == SPA_POD_TYPE_STRUCT) {
|
|
||||||
filter_offset = sizeof(struct spa_pod_struct);
|
|
||||||
spa_pod_builder_push_struct(b);
|
|
||||||
} else {
|
|
||||||
struct spa_pod_object *p1 = (struct spa_pod_object *) pp;
|
|
||||||
filter_offset = sizeof(struct spa_pod_object);
|
|
||||||
spa_pod_builder_push_object(b, p1->body.id, p1->body.type);
|
|
||||||
}
|
|
||||||
do_advance = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
do_copy = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SPA_POD_TYPE_PROP:
|
|
||||||
{
|
|
||||||
struct spa_pod_prop *p1, *p2;
|
|
||||||
|
|
||||||
p1 = (struct spa_pod_prop *) pp;
|
|
||||||
p2 = find_prop(filter, filter_size, p1->body.key);
|
|
||||||
|
|
||||||
if (p2 != NULL)
|
|
||||||
res = filter_prop(b, p1, p2);
|
|
||||||
else
|
|
||||||
do_copy = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
if (pf != NULL) {
|
|
||||||
if (SPA_POD_SIZE(pp) != SPA_POD_SIZE(pf))
|
|
||||||
return -EINVAL;
|
|
||||||
if (memcmp(pp, pf, SPA_POD_SIZE(pp)) != 0)
|
|
||||||
return -EINVAL;
|
|
||||||
do_advance = true;
|
|
||||||
}
|
|
||||||
do_copy = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (do_copy)
|
|
||||||
spa_pod_builder_raw_padded(b, pp, SPA_POD_SIZE(pp));
|
|
||||||
else if (filter_offset) {
|
|
||||||
res = pod_filter(b,
|
|
||||||
SPA_MEMBER(pp,filter_offset,void),
|
|
||||||
SPA_POD_SIZE(pp) - filter_offset,
|
|
||||||
SPA_MEMBER(pf,filter_offset,void),
|
|
||||||
SPA_POD_SIZE(pf) - filter_offset);
|
|
||||||
spa_pod_builder_pop(b);
|
|
||||||
}
|
|
||||||
if (do_advance) {
|
|
||||||
pf = spa_pod_next(pf);
|
|
||||||
if (!spa_pod_is_inside(filter, filter_size, pf))
|
|
||||||
pf = NULL;
|
|
||||||
}
|
|
||||||
if (res < 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
spa_pod_filter(struct spa_pod_builder *b,
|
|
||||||
struct spa_pod **result,
|
|
||||||
const struct spa_pod *pod,
|
|
||||||
const struct spa_pod *filter)
|
|
||||||
{
|
|
||||||
int res;
|
|
||||||
struct spa_pod_builder_state state;
|
|
||||||
|
|
||||||
spa_return_val_if_fail(pod != NULL, -EINVAL);
|
|
||||||
spa_return_val_if_fail(b != NULL, -EINVAL);
|
|
||||||
|
|
||||||
if (filter == NULL) {
|
|
||||||
*result = spa_pod_builder_deref(b,
|
|
||||||
spa_pod_builder_raw_padded(b, pod, SPA_POD_SIZE(pod)));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
spa_pod_builder_get_state(b, &state);
|
|
||||||
if ((res = pod_filter(b, pod, SPA_POD_SIZE(pod), filter, SPA_POD_SIZE(filter))) < 0)
|
|
||||||
spa_pod_builder_reset(b, &state);
|
|
||||||
else
|
|
||||||
*result = spa_pod_builder_deref(b, state.offset);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
int pod_compare(const struct spa_pod *pod1, uint32_t pod1_size,
|
|
||||||
const struct spa_pod *pod2, uint32_t pod2_size)
|
|
||||||
{
|
|
||||||
const struct spa_pod *p1, *p2;
|
|
||||||
int res;
|
|
||||||
|
|
||||||
p2 = pod2;
|
|
||||||
|
|
||||||
SPA_POD_FOREACH(pod1, pod1_size, p1) {
|
|
||||||
bool do_advance = true;
|
|
||||||
uint32_t recurse_offset = 0;
|
|
||||||
|
|
||||||
if (p2 == NULL)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
switch (SPA_POD_TYPE(p1)) {
|
|
||||||
case SPA_POD_TYPE_STRUCT:
|
|
||||||
case SPA_POD_TYPE_OBJECT:
|
|
||||||
if (SPA_POD_TYPE(p2) != SPA_POD_TYPE(p1))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (SPA_POD_TYPE(p1) == SPA_POD_TYPE_STRUCT)
|
|
||||||
recurse_offset = sizeof(struct spa_pod_struct);
|
|
||||||
else
|
|
||||||
recurse_offset = sizeof(struct spa_pod_object);
|
|
||||||
|
|
||||||
do_advance = true;
|
|
||||||
break;
|
|
||||||
case SPA_POD_TYPE_PROP:
|
|
||||||
{
|
|
||||||
struct spa_pod_prop *pr1, *pr2;
|
|
||||||
void *a1, *a2;
|
|
||||||
|
|
||||||
pr1 = (struct spa_pod_prop *) p1;
|
|
||||||
pr2 = find_prop(pod2, pod2_size, pr1->body.key);
|
|
||||||
|
|
||||||
if (pr2 == NULL)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
/* incompatible property types */
|
|
||||||
if (pr1->body.value.type != pr2->body.value.type)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (pr1->body.flags & SPA_POD_PROP_FLAG_UNSET ||
|
|
||||||
pr2->body.flags & SPA_POD_PROP_FLAG_UNSET)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
a1 = SPA_MEMBER(pr1, sizeof(struct spa_pod_prop), void);
|
|
||||||
a2 = SPA_MEMBER(pr2, sizeof(struct spa_pod_prop), void);
|
|
||||||
|
|
||||||
res = compare_value(pr1->body.value.type, a1, a2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
if (SPA_POD_TYPE(p1) != SPA_POD_TYPE(p2))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
res = compare_value(SPA_POD_TYPE(p1), SPA_POD_BODY(p1), SPA_POD_BODY(p2));
|
|
||||||
do_advance = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (recurse_offset) {
|
|
||||||
res = pod_compare(SPA_MEMBER(p1,recurse_offset,void),
|
|
||||||
SPA_POD_SIZE(p1) - recurse_offset,
|
|
||||||
SPA_MEMBER(p2,recurse_offset,void),
|
|
||||||
SPA_POD_SIZE(p2) - recurse_offset);
|
|
||||||
}
|
|
||||||
if (do_advance) {
|
|
||||||
p2 = spa_pod_next(p2);
|
|
||||||
if (!spa_pod_is_inside(pod2, pod2_size, p2))
|
|
||||||
p2 = NULL;
|
|
||||||
}
|
|
||||||
if (res != 0)
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
if (p2 != NULL)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int spa_pod_compare(const struct spa_pod *pod1,
|
|
||||||
const struct spa_pod *pod2)
|
|
||||||
{
|
|
||||||
spa_return_val_if_fail(pod1 != NULL, -EINVAL);
|
|
||||||
spa_return_val_if_fail(pod2 != NULL, -EINVAL);
|
|
||||||
|
|
||||||
return pod_compare(pod1, SPA_POD_SIZE(pod1), pod2, SPA_POD_SIZE(pod2));
|
|
||||||
}
|
|
||||||
|
|
@ -19,10 +19,8 @@ threads_dep = dependency('threads')
|
||||||
#mathlib = cc.find_library('m', required : false)
|
#mathlib = cc.find_library('m', required : false)
|
||||||
|
|
||||||
spa_inc = include_directories('include')
|
spa_inc = include_directories('include')
|
||||||
spa_libinc = include_directories('.')
|
|
||||||
|
|
||||||
subdir('include')
|
subdir('include')
|
||||||
subdir('lib')
|
|
||||||
subdir('plugins')
|
subdir('plugins')
|
||||||
subdir('tools')
|
subdir('tools')
|
||||||
subdir('tests')
|
subdir('tests')
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ spa_alsa_sources = ['alsa.c',
|
||||||
|
|
||||||
spa_alsa = shared_library('spa-alsa',
|
spa_alsa = shared_library('spa-alsa',
|
||||||
spa_alsa_sources,
|
spa_alsa_sources,
|
||||||
include_directories : [spa_inc, spa_libinc],
|
include_directories : [spa_inc],
|
||||||
dependencies : [ alsa_dep, libudev_dep ],
|
dependencies : [ alsa_dep, libudev_dep ],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : '@0@/spa/alsa'.format(get_option('libdir')))
|
install_dir : '@0@/spa/alsa'.format(get_option('libdir')))
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@ audiomixer_sources = ['audiomixer.c', 'mix-ops.c', 'plugin.c']
|
||||||
|
|
||||||
audiomixerlib = shared_library('spa-audiomixer',
|
audiomixerlib = shared_library('spa-audiomixer',
|
||||||
audiomixer_sources,
|
audiomixer_sources,
|
||||||
include_directories : [spa_inc, spa_libinc],
|
include_directories : [spa_inc],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : '@0@/spa/audiomixer/'.format(get_option('libdir')))
|
install_dir : '@0@/spa/audiomixer/'.format(get_option('libdir')))
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ audiotestsrc_sources = ['audiotestsrc.c', 'plugin.c']
|
||||||
|
|
||||||
audiotestsrclib = shared_library('spa-audiotestsrc',
|
audiotestsrclib = shared_library('spa-audiotestsrc',
|
||||||
audiotestsrc_sources,
|
audiotestsrc_sources,
|
||||||
include_directories : [spa_inc, spa_libinc],
|
include_directories : [spa_inc],
|
||||||
dependencies : mathlib,
|
dependencies : mathlib,
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : '@0@/spa/audiotestsrc'.format(get_option('libdir')))
|
install_dir : '@0@/spa/audiotestsrc'.format(get_option('libdir')))
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ bluez5_sources = ['plugin.c',
|
||||||
|
|
||||||
bluez5lib = shared_library('spa-bluez5',
|
bluez5lib = shared_library('spa-bluez5',
|
||||||
bluez5_sources,
|
bluez5_sources,
|
||||||
include_directories : [ spa_inc, spa_libinc ],
|
include_directories : [ spa_inc ],
|
||||||
dependencies : [ dbus_dep, sbc_dep ],
|
dependencies : [ dbus_dep, sbc_dep ],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : '@0@/spa/bluez5'.format(get_option('libdir')))
|
install_dir : '@0@/spa/bluez5'.format(get_option('libdir')))
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ ffmpeg_sources = ['ffmpeg.c',
|
||||||
|
|
||||||
ffmpeglib = shared_library('spa-ffmpeg',
|
ffmpeglib = shared_library('spa-ffmpeg',
|
||||||
ffmpeg_sources,
|
ffmpeg_sources,
|
||||||
include_directories : [spa_inc, spa_libinc],
|
include_directories : [spa_inc],
|
||||||
dependencies : [ avcodec_dep, avformat_dep ],
|
dependencies : [ avcodec_dep, avformat_dep ],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : '@0@/spa/ffmpeg'.format(get_option('libdir')))
|
install_dir : '@0@/spa/ffmpeg'.format(get_option('libdir')))
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ spa_support_sources = ['mapper.c',
|
||||||
|
|
||||||
spa_support_lib = shared_library('spa-support',
|
spa_support_lib = shared_library('spa-support',
|
||||||
spa_support_sources,
|
spa_support_sources,
|
||||||
include_directories : [ spa_inc, spa_libinc],
|
include_directories : [ spa_inc],
|
||||||
dependencies : threads_dep,
|
dependencies : threads_dep,
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : '@0@/spa/support'.format(get_option('libdir')))
|
install_dir : '@0@/spa/support'.format(get_option('libdir')))
|
||||||
|
|
@ -14,7 +14,7 @@ spa_dbus_sources = ['dbus.c']
|
||||||
|
|
||||||
spa_dbus_lib = shared_library('spa-dbus',
|
spa_dbus_lib = shared_library('spa-dbus',
|
||||||
spa_dbus_sources,
|
spa_dbus_sources,
|
||||||
include_directories : [ spa_inc, spa_libinc],
|
include_directories : [ spa_inc],
|
||||||
dependencies : dbus_dep,
|
dependencies : dbus_dep,
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : '@0@/spa/support'.format(get_option('libdir')))
|
install_dir : '@0@/spa/support'.format(get_option('libdir')))
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ test_sources = ['fakesrc.c', 'fakesink.c', 'plugin.c']
|
||||||
|
|
||||||
testlib = shared_library('spa-test',
|
testlib = shared_library('spa-test',
|
||||||
test_sources,
|
test_sources,
|
||||||
include_directories : [ spa_inc, spa_libinc],
|
include_directories : [ spa_inc],
|
||||||
dependencies : threads_dep,
|
dependencies : threads_dep,
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : '@0@/spa/test'.format(get_option('libdir')))
|
install_dir : '@0@/spa/test'.format(get_option('libdir')))
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ v4l2_sources = ['v4l2.c',
|
||||||
|
|
||||||
v4l2lib = shared_library('spa-v4l2',
|
v4l2lib = shared_library('spa-v4l2',
|
||||||
v4l2_sources,
|
v4l2_sources,
|
||||||
include_directories : [ spa_inc, spa_libinc ],
|
include_directories : [ spa_inc ],
|
||||||
dependencies : [ v4l2_dep, libudev_dep ],
|
dependencies : [ v4l2_dep, libudev_dep ],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : '@0@/spa/v4l2'.format(get_option('libdir')))
|
install_dir : '@0@/spa/v4l2'.format(get_option('libdir')))
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ videotestsrc_sources = ['videotestsrc.c', 'plugin.c']
|
||||||
|
|
||||||
videotestsrclib = shared_library('spa-videotestsrc',
|
videotestsrclib = shared_library('spa-videotestsrc',
|
||||||
videotestsrc_sources,
|
videotestsrc_sources,
|
||||||
include_directories : [ spa_inc, spa_libinc],
|
include_directories : [ spa_inc],
|
||||||
dependencies : threads_dep,
|
dependencies : threads_dep,
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : '@0@/spa/videotestsrc'.format(get_option('libdir')))
|
install_dir : '@0@/spa/videotestsrc'.format(get_option('libdir')))
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@ volume_sources = ['volume.c', 'plugin.c']
|
||||||
|
|
||||||
volumelib = shared_library('spa-volume',
|
volumelib = shared_library('spa-volume',
|
||||||
volume_sources,
|
volume_sources,
|
||||||
include_directories : [spa_inc, spa_libinc],
|
include_directories : [spa_inc],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : '@0@/spa/volume'.format(get_option('libdir')))
|
install_dir : '@0@/spa/volume'.format(get_option('libdir')))
|
||||||
|
|
|
||||||
|
|
@ -1,67 +1,54 @@
|
||||||
executable('test-mixer', 'test-mixer.c',
|
executable('test-mixer', 'test-mixer.c',
|
||||||
include_directories : [spa_inc ],
|
include_directories : [spa_inc ],
|
||||||
dependencies : [dl_lib, pthread_lib, mathlib],
|
dependencies : [dl_lib, pthread_lib, mathlib],
|
||||||
link_with : spalib,
|
|
||||||
install : false)
|
install : false)
|
||||||
executable('test-bluez5', 'test-bluez5.c',
|
executable('test-bluez5', 'test-bluez5.c',
|
||||||
include_directories : [spa_inc, spa_libinc ],
|
include_directories : [spa_inc ],
|
||||||
dependencies : [dl_lib, pthread_lib, mathlib, dbus_dep],
|
dependencies : [dl_lib, pthread_lib, mathlib, dbus_dep],
|
||||||
link_with : spalib,
|
|
||||||
install : false)
|
install : false)
|
||||||
executable('test-ringbuffer', 'test-ringbuffer.c',
|
executable('test-ringbuffer', 'test-ringbuffer.c',
|
||||||
include_directories : [spa_inc, spa_libinc ],
|
include_directories : [spa_inc ],
|
||||||
dependencies : [dl_lib, pthread_lib],
|
dependencies : [dl_lib, pthread_lib],
|
||||||
link_with : spalib,
|
|
||||||
install : false)
|
install : false)
|
||||||
executable('test-graph', 'test-graph.c',
|
executable('test-graph', 'test-graph.c',
|
||||||
include_directories : [spa_inc, spa_libinc ],
|
include_directories : [spa_inc ],
|
||||||
dependencies : [dl_lib, pthread_lib],
|
dependencies : [dl_lib, pthread_lib],
|
||||||
link_with : spalib,
|
|
||||||
install : false)
|
install : false)
|
||||||
executable('test-graph2', 'test-graph2.c',
|
executable('test-graph2', 'test-graph2.c',
|
||||||
include_directories : [spa_inc ],
|
include_directories : [spa_inc ],
|
||||||
dependencies : [dl_lib, pthread_lib],
|
dependencies : [dl_lib, pthread_lib],
|
||||||
link_with : spalib,
|
|
||||||
install : false)
|
install : false)
|
||||||
executable('test-perf', 'test-perf.c',
|
executable('test-perf', 'test-perf.c',
|
||||||
include_directories : [spa_inc, spa_libinc ],
|
include_directories : [spa_inc ],
|
||||||
dependencies : [dl_lib, pthread_lib],
|
dependencies : [dl_lib, pthread_lib],
|
||||||
link_with : spalib,
|
|
||||||
install : false)
|
install : false)
|
||||||
executable('stress-ringbuffer', 'stress-ringbuffer.c',
|
executable('stress-ringbuffer', 'stress-ringbuffer.c',
|
||||||
include_directories : [spa_inc, spa_libinc ],
|
include_directories : [spa_inc ],
|
||||||
dependencies : [dl_lib, pthread_lib],
|
dependencies : [dl_lib, pthread_lib],
|
||||||
link_with : spalib,
|
|
||||||
install : false)
|
install : false)
|
||||||
if sdl_dep.found()
|
if sdl_dep.found()
|
||||||
executable('test-v4l2', 'test-v4l2.c',
|
executable('test-v4l2', 'test-v4l2.c',
|
||||||
include_directories : [spa_inc, spa_libinc ],
|
include_directories : [spa_inc ],
|
||||||
dependencies : [dl_lib, sdl_dep, pthread_lib],
|
dependencies : [dl_lib, sdl_dep, pthread_lib],
|
||||||
link_with : spalib,
|
|
||||||
install : false)
|
install : false)
|
||||||
endif
|
endif
|
||||||
executable('test-props', 'test-props.c',
|
executable('test-props', 'test-props.c',
|
||||||
include_directories : [spa_inc, spa_libinc ],
|
include_directories : [spa_inc ],
|
||||||
dependencies : [],
|
dependencies : [],
|
||||||
link_with : spalib,
|
|
||||||
install : false)
|
install : false)
|
||||||
executable('test-props2', 'test-props2.c',
|
executable('test-props2', 'test-props2.c',
|
||||||
include_directories : [spa_inc, spa_libinc ],
|
include_directories : [spa_inc ],
|
||||||
dependencies : [],
|
dependencies : [],
|
||||||
link_with : spalib,
|
|
||||||
install : false)
|
install : false)
|
||||||
#executable('test-props4', 'test-props4.c',
|
#executable('test-props4', 'test-props4.c',
|
||||||
# include_directories : [spa_inc, spa_libinc ],
|
# include_directories : [spa_inc ],
|
||||||
# dependencies : [],
|
# dependencies : [],
|
||||||
# link_with : spalib,
|
|
||||||
# install : false)
|
# install : false)
|
||||||
executable('test-props5', 'test-props5.c',
|
executable('test-props5', 'test-props5.c',
|
||||||
include_directories : [spa_inc, spa_libinc ],
|
include_directories : [spa_inc ],
|
||||||
dependencies : [],
|
dependencies : [],
|
||||||
link_with : spalib,
|
|
||||||
install : false)
|
install : false)
|
||||||
executable('test-control', 'test-control.c',
|
executable('test-control', 'test-control.c',
|
||||||
include_directories : [spa_inc, spa_libinc ],
|
include_directories : [spa_inc ],
|
||||||
dependencies : [dl_lib, pthread_lib, mathlib],
|
dependencies : [dl_lib, pthread_lib, mathlib],
|
||||||
link_with : spalib,
|
|
||||||
install : false)
|
install : false)
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ static struct spa_log *logger;
|
||||||
#include <spa/graph/graph.h>
|
#include <spa/graph/graph.h>
|
||||||
#include <spa/graph/graph-scheduler6.h>
|
#include <spa/graph/graph-scheduler6.h>
|
||||||
|
|
||||||
#include <lib/debug.h>
|
#include <spa/debug/pod.h>
|
||||||
|
|
||||||
struct type {
|
struct type {
|
||||||
uint32_t log;
|
uint32_t log;
|
||||||
|
|
@ -133,7 +133,7 @@ struct data {
|
||||||
|
|
||||||
static void inspect_item(struct data *data, struct spa_pod *item)
|
static void inspect_item(struct data *data, struct spa_pod *item)
|
||||||
{
|
{
|
||||||
spa_debug_pod(item, 0);
|
spa_debug_pod(0, data->map, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void monitor_event(void *_data, struct spa_event *event)
|
static void monitor_event(void *_data, struct spa_event *event)
|
||||||
|
|
@ -222,7 +222,6 @@ int main(int argc, char *argv[])
|
||||||
data.support[0].data = data.map;
|
data.support[0].data = data.map;
|
||||||
data.n_support = 1;
|
data.n_support = 1;
|
||||||
init_type(&data.type, data.map);
|
init_type(&data.type, data.map);
|
||||||
spa_debug_set_type_map(data.map);
|
|
||||||
|
|
||||||
if ((res = get_handle(&data, &handle,
|
if ((res = get_handle(&data, &handle,
|
||||||
"build/spa/plugins/support/libspa-support.so",
|
"build/spa/plugins/support/libspa-support.so",
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ static SPA_LOG_IMPL(default_log);
|
||||||
#include <spa/graph/graph.h>
|
#include <spa/graph/graph.h>
|
||||||
#include <spa/graph/graph-scheduler6.h>
|
#include <spa/graph/graph-scheduler6.h>
|
||||||
|
|
||||||
#include <lib/debug.h>
|
#include <spa/debug/pod.h>
|
||||||
|
|
||||||
struct type {
|
struct type {
|
||||||
uint32_t node;
|
uint32_t node;
|
||||||
|
|
@ -326,7 +326,7 @@ static int make_nodes(struct data *data, const char *device)
|
||||||
":", data->type.props_device, "s", device ? device : "hw:0",
|
":", data->type.props_device, "s", device ? device : "hw:0",
|
||||||
":", data->type.props_min_latency, "i", MIN_LATENCY);
|
":", data->type.props_min_latency, "i", MIN_LATENCY);
|
||||||
|
|
||||||
spa_debug_pod(props, 0);
|
spa_debug_pod(0, data->map, props);
|
||||||
|
|
||||||
if ((res = spa_node_set_param(data->sink, data->type.param.idProps, 0, props)) < 0)
|
if ((res = spa_node_set_param(data->sink, data->type.param.idProps, 0, props)) < 0)
|
||||||
printf("got set_props error %d\n", res);
|
printf("got set_props error %d\n", res);
|
||||||
|
|
@ -431,7 +431,7 @@ static int negotiate_formats(struct data *data)
|
||||||
":", data->type.format_audio.rate, "i", 44100,
|
":", data->type.format_audio.rate, "i", 44100,
|
||||||
":", data->type.format_audio.channels, "i", 2);
|
":", data->type.format_audio.channels, "i", 2);
|
||||||
|
|
||||||
spa_debug_pod(filter, 0);
|
spa_debug_pod(0, data->map, filter);
|
||||||
|
|
||||||
spa_log_debug(&default_log.log, "enum_params");
|
spa_log_debug(&default_log.log, "enum_params");
|
||||||
if ((res = spa_node_port_enum_params(data->sink,
|
if ((res = spa_node_port_enum_params(data->sink,
|
||||||
|
|
@ -440,7 +440,7 @@ static int negotiate_formats(struct data *data)
|
||||||
filter, &format, &b)) <= 0)
|
filter, &format, &b)) <= 0)
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
|
|
||||||
spa_debug_pod(format, 0);
|
spa_debug_pod(0, data->map, format);
|
||||||
|
|
||||||
spa_log_debug(&default_log.log, "sink set_param");
|
spa_log_debug(&default_log.log, "sink set_param");
|
||||||
if ((res = spa_node_port_set_param(data->sink,
|
if ((res = spa_node_port_set_param(data->sink,
|
||||||
|
|
@ -574,8 +574,6 @@ int main(int argc, char *argv[])
|
||||||
data.data_loop.remove_source = do_remove_source;
|
data.data_loop.remove_source = do_remove_source;
|
||||||
data.data_loop.invoke = do_invoke;
|
data.data_loop.invoke = do_invoke;
|
||||||
|
|
||||||
spa_debug_set_type_map(data.map);
|
|
||||||
|
|
||||||
if ((str = getenv("SPA_DEBUG")))
|
if ((str = getenv("SPA_DEBUG")))
|
||||||
data.log->level = atoi(str);
|
data.log->level = atoi(str);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ static SPA_LOG_IMPL(default_log);
|
||||||
#include <spa/graph/graph.h>
|
#include <spa/graph/graph.h>
|
||||||
#include <spa/graph/graph-scheduler6.h>
|
#include <spa/graph/graph-scheduler6.h>
|
||||||
|
|
||||||
#include <lib/debug.h>
|
#include <spa/debug/pod.h>
|
||||||
|
|
||||||
struct type {
|
struct type {
|
||||||
uint32_t node;
|
uint32_t node;
|
||||||
|
|
@ -305,7 +305,7 @@ static int make_nodes(struct data *data, const char *device)
|
||||||
":", data->type.props_device, "s", device ? device : "hw:0",
|
":", data->type.props_device, "s", device ? device : "hw:0",
|
||||||
":", data->type.props_min_latency, "i", MIN_LATENCY);
|
":", data->type.props_min_latency, "i", MIN_LATENCY);
|
||||||
|
|
||||||
spa_debug_pod(props, 0);
|
spa_debug_pod(0, data->map, props);
|
||||||
|
|
||||||
if ((res = spa_node_set_param(data->sink, data->type.param.idProps, 0, props)) < 0)
|
if ((res = spa_node_set_param(data->sink, data->type.param.idProps, 0, props)) < 0)
|
||||||
printf("got set_props error %d\n", res);
|
printf("got set_props error %d\n", res);
|
||||||
|
|
@ -399,7 +399,7 @@ static int negotiate_formats(struct data *data)
|
||||||
":", data->type.format_audio.rate, "i", 44100,
|
":", data->type.format_audio.rate, "i", 44100,
|
||||||
":", data->type.format_audio.channels, "i", 2);
|
":", data->type.format_audio.channels, "i", 2);
|
||||||
|
|
||||||
spa_debug_pod(filter, 0);
|
spa_debug_pod(0, data->map, filter);
|
||||||
|
|
||||||
spa_log_debug(&default_log.log, "enum_params");
|
spa_log_debug(&default_log.log, "enum_params");
|
||||||
if ((res = spa_node_port_enum_params(data->sink,
|
if ((res = spa_node_port_enum_params(data->sink,
|
||||||
|
|
@ -408,7 +408,7 @@ static int negotiate_formats(struct data *data)
|
||||||
filter, &format, &b)) <= 0)
|
filter, &format, &b)) <= 0)
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
|
|
||||||
spa_debug_pod(format, 0);
|
spa_debug_pod(0, data->map, format);
|
||||||
|
|
||||||
spa_log_debug(&default_log.log, "sink set_param");
|
spa_log_debug(&default_log.log, "sink set_param");
|
||||||
if ((res = spa_node_port_set_param(data->sink,
|
if ((res = spa_node_port_set_param(data->sink,
|
||||||
|
|
@ -566,8 +566,6 @@ int main(int argc, char *argv[])
|
||||||
data.data_loop.remove_source = do_remove_source;
|
data.data_loop.remove_source = do_remove_source;
|
||||||
data.data_loop.invoke = do_invoke;
|
data.data_loop.invoke = do_invoke;
|
||||||
|
|
||||||
spa_debug_set_type_map(data.map);
|
|
||||||
|
|
||||||
if ((str = getenv("SPA_DEBUG")))
|
if ((str = getenv("SPA_DEBUG")))
|
||||||
data.log->level = atoi(str);
|
data.log->level = atoi(str);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@
|
||||||
#include <spa/pod/builder.h>
|
#include <spa/pod/builder.h>
|
||||||
#include <spa/pod/parser.h>
|
#include <spa/pod/parser.h>
|
||||||
#include <spa/param/video/format-utils.h>
|
#include <spa/param/video/format-utils.h>
|
||||||
|
#include <spa/debug/pod.h>
|
||||||
#include <lib/debug.h>
|
#include <spa/debug/format.h>
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* { video/raw,
|
/* { video/raw,
|
||||||
|
|
@ -250,8 +250,8 @@ static void do_static_struct(struct spa_type_map *map)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
spa_debug_pod(&test_format.fmt.pod, 0);
|
spa_debug_pod(0, map, &test_format.fmt.pod);
|
||||||
spa_debug_pod(&test_format.fmt.pod, SPA_DEBUG_FLAG_FORMAT);
|
spa_debug_format(0, map, &test_format.fmt.pod);
|
||||||
|
|
||||||
{
|
{
|
||||||
uint32_t format = -1;
|
uint32_t format = -1;
|
||||||
|
|
@ -283,7 +283,6 @@ int main(int argc, char *argv[])
|
||||||
struct spa_type_map *map = &default_map.map;
|
struct spa_type_map *map = &default_map.map;
|
||||||
|
|
||||||
type_init(map);
|
type_init(map);
|
||||||
spa_debug_set_type_map(map);
|
|
||||||
|
|
||||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||||
|
|
||||||
|
|
@ -317,7 +316,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
fmt = spa_pod_builder_pop(&b);
|
fmt = spa_pod_builder_pop(&b);
|
||||||
|
|
||||||
spa_debug_pod(&fmt->pod, 0);
|
spa_debug_pod(0, map, &fmt->pod);
|
||||||
|
|
||||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||||
|
|
||||||
|
|
@ -335,8 +334,8 @@ int main(int argc, char *argv[])
|
||||||
2, &SPA_FRACTION(0,1),
|
2, &SPA_FRACTION(0,1),
|
||||||
&SPA_FRACTION(INT32_MAX,1));
|
&SPA_FRACTION(INT32_MAX,1));
|
||||||
|
|
||||||
spa_debug_pod(&fmt->pod, 0);
|
spa_debug_pod(0, map, &fmt->pod);
|
||||||
spa_debug_pod(&fmt->pod, SPA_DEBUG_FLAG_FORMAT);
|
spa_debug_format(0, map, &fmt->pod);
|
||||||
|
|
||||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||||
|
|
||||||
|
|
@ -365,8 +364,8 @@ int main(int argc, char *argv[])
|
||||||
&SPA_FRACTION(INT32_MAX,1),
|
&SPA_FRACTION(INT32_MAX,1),
|
||||||
">", NULL);
|
">", NULL);
|
||||||
|
|
||||||
spa_debug_pod(&fmt->pod, 0);
|
spa_debug_pod(0, map, &fmt->pod);
|
||||||
spa_debug_pod(&fmt->pod, SPA_DEBUG_FLAG_FORMAT);
|
spa_debug_format(0, map, &fmt->pod);
|
||||||
|
|
||||||
do_static_struct(map);
|
do_static_struct(map);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
#include <spa/pod/parser.h>
|
#include <spa/pod/parser.h>
|
||||||
#include <spa/param/video/format.h>
|
#include <spa/param/video/format.h>
|
||||||
|
|
||||||
#include <lib/debug.h>
|
#include <spa/debug/pod.h>
|
||||||
|
|
||||||
static SPA_TYPE_MAP_IMPL(default_map, 4096);
|
static SPA_TYPE_MAP_IMPL(default_map, 4096);
|
||||||
|
|
||||||
|
|
@ -43,8 +43,6 @@ int main(int argc, char *argv[])
|
||||||
struct spa_pod_parser prs;
|
struct spa_pod_parser prs;
|
||||||
struct spa_type_map *map = &default_map.map;
|
struct spa_type_map *map = &default_map.map;
|
||||||
|
|
||||||
spa_debug_set_type_map(map);
|
|
||||||
|
|
||||||
b.data = buffer;
|
b.data = buffer;
|
||||||
b.size = 1024;
|
b.size = 1024;
|
||||||
|
|
||||||
|
|
@ -86,11 +84,11 @@ int main(int argc, char *argv[])
|
||||||
spa_pod_builder_pop(&b);
|
spa_pod_builder_pop(&b);
|
||||||
obj = spa_pod_builder_pop(&b);
|
obj = spa_pod_builder_pop(&b);
|
||||||
|
|
||||||
spa_debug_pod(obj, 0);
|
spa_debug_pod(0, map, obj);
|
||||||
|
|
||||||
struct spa_pod_prop *p = spa_pod_find_prop(obj, 4);
|
struct spa_pod_prop *p = spa_pod_find_prop(obj, 4);
|
||||||
printf("%d %d\n", p->body.key, p->body.flags);
|
printf("%d %d\n", p->body.key, p->body.flags);
|
||||||
spa_debug_pod(&p->body.value, 0);
|
spa_debug_pod(0, map, &p->body.value);
|
||||||
|
|
||||||
obj = spa_pod_builder_deref(&b, ref);
|
obj = spa_pod_builder_deref(&b, ref);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,9 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <spa/pod/parser.h>
|
#include <spa/pod/parser.h>
|
||||||
|
#include <spa/pod/builder.h>
|
||||||
|
|
||||||
#include <lib/debug.h>
|
#include <spa/debug/pod.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
@ -52,7 +53,7 @@ int main(int argc, char *argv[])
|
||||||
2, &SPA_FRACTION(0,1),
|
2, &SPA_FRACTION(0,1),
|
||||||
&SPA_FRACTION(INT32_MAX, 1),
|
&SPA_FRACTION(INT32_MAX, 1),
|
||||||
">", NULL);
|
">", NULL);
|
||||||
spa_debug_pod(fmt, 0);
|
spa_debug_pod(0, NULL, fmt);
|
||||||
|
|
||||||
spa_pod_parser_pod(&prs, fmt);
|
spa_pod_parser_pod(&prs, fmt);
|
||||||
res = spa_pod_parser_get(&prs,
|
res = spa_pod_parser_get(&prs,
|
||||||
|
|
@ -67,7 +68,7 @@ int main(int argc, char *argv[])
|
||||||
printf("media-type:%d media-subtype:%d\n", media_type, media_subtype);
|
printf("media-type:%d media-subtype:%d\n", media_type, media_subtype);
|
||||||
printf("framerate:\n");
|
printf("framerate:\n");
|
||||||
if (pod)
|
if (pod)
|
||||||
spa_debug_pod(pod, 0);
|
spa_debug_pod(0, NULL, pod);
|
||||||
printf("format: %d\n", fmt_value);
|
printf("format: %d\n", fmt_value);
|
||||||
|
|
||||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||||
|
|
@ -76,7 +77,7 @@ int main(int argc, char *argv[])
|
||||||
" P", NULL,
|
" P", NULL,
|
||||||
" [ i", 44, "i",45,"]"
|
" [ i", 44, "i",45,"]"
|
||||||
">", NULL);
|
">", NULL);
|
||||||
spa_debug_pod(pod, 0);
|
spa_debug_pod(0, NULL, pod);
|
||||||
|
|
||||||
spa_pod_parser_pod(&prs, pod);
|
spa_pod_parser_pod(&prs, pod);
|
||||||
res = spa_pod_parser_get(&prs,
|
res = spa_pod_parser_get(&prs,
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,6 @@
|
||||||
#include <spa/param/audio/format-utils.h>
|
#include <spa/param/audio/format-utils.h>
|
||||||
#include <spa/param/format-utils.h>
|
#include <spa/param/format-utils.h>
|
||||||
|
|
||||||
#include <lib/debug.h>
|
|
||||||
|
|
||||||
static SPA_TYPE_MAP_IMPL(default_map, 4096);
|
static SPA_TYPE_MAP_IMPL(default_map, 4096);
|
||||||
static SPA_LOG_IMPL(default_log);
|
static SPA_LOG_IMPL(default_log);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,6 @@
|
||||||
#include <spa/param/video/format-utils.h>
|
#include <spa/param/video/format-utils.h>
|
||||||
#include <spa/param/format-utils.h>
|
#include <spa/param/format-utils.h>
|
||||||
|
|
||||||
#include <lib/debug.h>
|
|
||||||
|
|
||||||
static SPA_TYPE_MAP_IMPL(default_map, 4096);
|
static SPA_TYPE_MAP_IMPL(default_map, 4096);
|
||||||
static SPA_LOG_IMPL(default_log);
|
static SPA_LOG_IMPL(default_log);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
executable('spa-inspect', 'spa-inspect.c',
|
executable('spa-inspect', 'spa-inspect.c',
|
||||||
include_directories : [spa_inc, spa_libinc],
|
include_directories : [spa_inc],
|
||||||
dependencies : [dl_lib],
|
dependencies : [dl_lib],
|
||||||
link_with : spalib,
|
|
||||||
install : true)
|
install : true)
|
||||||
|
|
||||||
executable('spa-monitor', 'spa-monitor.c',
|
executable('spa-monitor', 'spa-monitor.c',
|
||||||
include_directories : [spa_inc, spa_libinc],
|
include_directories : [spa_inc],
|
||||||
dependencies : [dl_lib],
|
dependencies : [dl_lib],
|
||||||
link_with : spalib,
|
|
||||||
install : true)
|
install : true)
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@
|
||||||
#include <spa/pod/parser.h>
|
#include <spa/pod/parser.h>
|
||||||
#include <spa/param/param.h>
|
#include <spa/param/param.h>
|
||||||
#include <spa/param/format.h>
|
#include <spa/param/format.h>
|
||||||
|
#include <spa/debug/dict.h>
|
||||||
#include <lib/debug.h>
|
#include <spa/debug/format.h>
|
||||||
|
|
||||||
static SPA_TYPE_MAP_IMPL(default_map, 4096);
|
static SPA_TYPE_MAP_IMPL(default_map, 4096);
|
||||||
static SPA_LOG_IMPL(default_log);
|
static SPA_LOG_IMPL(default_log);
|
||||||
|
|
@ -82,8 +82,6 @@ inspect_node_params(struct data *data, struct spa_node *node)
|
||||||
|
|
||||||
printf("enumerating: %s:\n", spa_type_map_get_type(data->map, id));
|
printf("enumerating: %s:\n", spa_type_map_get_type(data->map, id));
|
||||||
for (idx2 = 0;;) {
|
for (idx2 = 0;;) {
|
||||||
uint32_t flags = 0;
|
|
||||||
|
|
||||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||||
if ((res = spa_node_enum_params(node,
|
if ((res = spa_node_enum_params(node,
|
||||||
id, &idx2,
|
id, &idx2,
|
||||||
|
|
@ -92,7 +90,7 @@ inspect_node_params(struct data *data, struct spa_node *node)
|
||||||
error(0, -res, "enum_params %d", id);
|
error(0, -res, "enum_params %d", id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
spa_debug_pod(param, flags);
|
spa_debug_pod(0, data->map, param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -125,8 +123,6 @@ inspect_port_params(struct data *data, struct spa_node *node,
|
||||||
|
|
||||||
printf("enumerating: %s:\n", spa_type_map_get_type(data->map, id));
|
printf("enumerating: %s:\n", spa_type_map_get_type(data->map, id));
|
||||||
for (idx2 = 0;;) {
|
for (idx2 = 0;;) {
|
||||||
uint32_t flags = 0;
|
|
||||||
|
|
||||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||||
if ((res = spa_node_port_enum_params(node,
|
if ((res = spa_node_port_enum_params(node,
|
||||||
direction, port_id,
|
direction, port_id,
|
||||||
|
|
@ -138,8 +134,9 @@ inspect_port_params(struct data *data, struct spa_node *node,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spa_pod_is_object_type(param, data->type.format))
|
if (spa_pod_is_object_type(param, data->type.format))
|
||||||
flags |= SPA_DEBUG_FLAG_FORMAT;
|
spa_debug_format(0, data->map, param);
|
||||||
spa_debug_pod(param, flags);
|
else
|
||||||
|
spa_debug_pod(0, data->map, param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -152,7 +149,7 @@ static void inspect_node(struct data *data, struct spa_node *node)
|
||||||
|
|
||||||
printf("node info:\n");
|
printf("node info:\n");
|
||||||
if (node->info)
|
if (node->info)
|
||||||
spa_debug_dict(node->info);
|
spa_debug_dict(2, node->info);
|
||||||
else
|
else
|
||||||
printf(" none\n");
|
printf(" none\n");
|
||||||
|
|
||||||
|
|
@ -195,7 +192,7 @@ static void inspect_factory(struct data *data, const struct spa_handle_factory *
|
||||||
printf("factory name:\t\t'%s'\n", factory->name);
|
printf("factory name:\t\t'%s'\n", factory->name);
|
||||||
printf("factory info:\n");
|
printf("factory info:\n");
|
||||||
if (factory->info)
|
if (factory->info)
|
||||||
spa_debug_dict(factory->info);
|
spa_debug_dict(2, factory->info);
|
||||||
else
|
else
|
||||||
printf(" none\n");
|
printf(" none\n");
|
||||||
|
|
||||||
|
|
@ -285,8 +282,6 @@ int main(int argc, char *argv[])
|
||||||
if ((str = getenv("SPA_DEBUG")))
|
if ((str = getenv("SPA_DEBUG")))
|
||||||
data.log->level = atoi(str);
|
data.log->level = atoi(str);
|
||||||
|
|
||||||
spa_debug_set_type_map(data.map);
|
|
||||||
|
|
||||||
data.support[0].type = SPA_TYPE__TypeMap;
|
data.support[0].type = SPA_TYPE__TypeMap;
|
||||||
data.support[0].data = data.map;
|
data.support[0].data = data.map;
|
||||||
data.support[1].type = SPA_TYPE__Log;
|
data.support[1].type = SPA_TYPE__Log;
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,11 @@
|
||||||
#include <spa/support/log-impl.h>
|
#include <spa/support/log-impl.h>
|
||||||
#include <spa/support/type-map-impl.h>
|
#include <spa/support/type-map-impl.h>
|
||||||
#include <spa/support/loop.h>
|
#include <spa/support/loop.h>
|
||||||
|
#include <spa/support/plugin.h>
|
||||||
#include <spa/monitor/monitor.h>
|
#include <spa/monitor/monitor.h>
|
||||||
|
|
||||||
#include <lib/debug.h>
|
#include <spa/debug/dict.h>
|
||||||
|
#include <spa/debug/pod.h>
|
||||||
|
|
||||||
static SPA_TYPE_MAP_IMPL(default_map, 4096);
|
static SPA_TYPE_MAP_IMPL(default_map, 4096);
|
||||||
static SPA_LOG_IMPL(default_log);
|
static SPA_LOG_IMPL(default_log);
|
||||||
|
|
@ -60,7 +62,7 @@ struct data {
|
||||||
|
|
||||||
static void inspect_item(struct data *data, struct spa_pod *item)
|
static void inspect_item(struct data *data, struct spa_pod *item)
|
||||||
{
|
{
|
||||||
spa_debug_pod(item, 0);
|
spa_debug_pod(0, data->map, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_monitor_event(void *_data, struct spa_event *event)
|
static void on_monitor_event(void *_data, struct spa_event *event)
|
||||||
|
|
@ -110,7 +112,7 @@ static void handle_monitor(struct data *data, struct spa_monitor *monitor)
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
|
|
||||||
if (monitor->info)
|
if (monitor->info)
|
||||||
spa_debug_dict(monitor->info);
|
spa_debug_dict(0, monitor->info);
|
||||||
|
|
||||||
for (index = 0;;) {
|
for (index = 0;;) {
|
||||||
struct spa_pod *item;
|
struct spa_pod *item;
|
||||||
|
|
@ -174,8 +176,6 @@ int main(int argc, char *argv[])
|
||||||
data.main_loop.update_source = do_update_source;
|
data.main_loop.update_source = do_update_source;
|
||||||
data.main_loop.remove_source = do_remove_source;
|
data.main_loop.remove_source = do_remove_source;
|
||||||
|
|
||||||
spa_debug_set_type_map(data.map);
|
|
||||||
|
|
||||||
data.support[0].type = SPA_TYPE__TypeMap;
|
data.support[0].type = SPA_TYPE__TypeMap;
|
||||||
data.support[0].data = data.map;
|
data.support[0].data = data.map;
|
||||||
data.support[1].type = SPA_TYPE__Log;
|
data.support[1].type = SPA_TYPE__Log;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include <spa/param/video/format-utils.h>
|
#include <spa/param/video/format-utils.h>
|
||||||
#include <spa/param/props.h>
|
#include <spa/param/props.h>
|
||||||
#include <spa/node/io.h>
|
#include <spa/node/io.h>
|
||||||
#include <spa/lib/debug.h>
|
#include <spa/debug/format.h>
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <pipewire/module.h>
|
#include <pipewire/module.h>
|
||||||
|
|
@ -445,7 +445,7 @@ static int port_set_format(struct spa_node *node,
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
spa_debug_pod(format, SPA_DEBUG_FLAG_FORMAT);
|
spa_debug_format(0, d->t->map, format);
|
||||||
|
|
||||||
spa_format_video_raw_parse(format, &d->format, &d->type.format_video);
|
spa_format_video_raw_parse(format, &d->format, &d->type.format_video);
|
||||||
|
|
||||||
|
|
@ -656,8 +656,6 @@ int main(int argc, char *argv[])
|
||||||
init_type(&data.type, data.t->map);
|
init_type(&data.type, data.t->map);
|
||||||
reset_props(&data.props);
|
reset_props(&data.props);
|
||||||
|
|
||||||
spa_debug_set_type_map(data.t->map);
|
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
printf("can't initialize SDL: %s\n", SDL_GetError());
|
printf("can't initialize SDL: %s\n", SDL_GetError());
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include <spa/param/audio/format-utils.h>
|
#include <spa/param/audio/format-utils.h>
|
||||||
#include <spa/param/props.h>
|
#include <spa/param/props.h>
|
||||||
#include <spa/node/io.h>
|
#include <spa/node/io.h>
|
||||||
#include <spa/lib/debug.h>
|
#include <spa/debug/format.h>
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
|
|
||||||
|
|
@ -351,7 +351,7 @@ static int port_set_format(struct spa_node *node,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_debug_pod(format, SPA_DEBUG_FLAG_FORMAT);
|
spa_debug_format(0, d->t->map, format);
|
||||||
|
|
||||||
if (spa_format_audio_raw_parse(format, &d->format, &d->type.format_audio) < 0)
|
if (spa_format_audio_raw_parse(format, &d->format, &d->type.format_audio) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
@ -592,7 +592,6 @@ int main(int argc, char *argv[])
|
||||||
spa_list_init(&data.empty);
|
spa_list_init(&data.empty);
|
||||||
init_type(&data.type, data.t->map);
|
init_type(&data.type, data.t->map);
|
||||||
reset_props(&data.props);
|
reset_props(&data.props);
|
||||||
spa_debug_set_type_map(data.t->map);
|
|
||||||
|
|
||||||
pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data);
|
pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,8 +140,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pw_module_load(data.core, "libpipewire-module-spa-node-factory", NULL, NULL, NULL, NULL);
|
pw_module_load(data.core, "libpipewire-module-spa-node-factory", NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
spa_debug_set_type_map(data.t->map);
|
|
||||||
|
|
||||||
pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data);
|
pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data);
|
||||||
|
|
||||||
pw_remote_connect(data.remote);
|
pw_remote_connect(data.remote);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include <spa/param/video/format-utils.h>
|
#include <spa/param/video/format-utils.h>
|
||||||
#include <spa/param/props.h>
|
#include <spa/param/props.h>
|
||||||
#include <spa/node/io.h>
|
#include <spa/node/io.h>
|
||||||
#include <spa/lib/debug.h>
|
#include <spa/debug/format.h>
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <pipewire/module.h>
|
#include <pipewire/module.h>
|
||||||
|
|
@ -337,7 +337,7 @@ static int port_set_format(struct spa_node *node, enum spa_direction direction,
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
spa_debug_pod(format, SPA_DEBUG_FLAG_FORMAT);
|
spa_debug_format(0, d->t->map, format);
|
||||||
|
|
||||||
spa_format_video_raw_parse(format, &d->format, &d->type.format_video);
|
spa_format_video_raw_parse(format, &d->format, &d->type.format_video);
|
||||||
|
|
||||||
|
|
@ -511,8 +511,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
init_type(&data.type, data.t->map);
|
init_type(&data.type, data.t->map);
|
||||||
|
|
||||||
spa_debug_set_type_map(data.t->map);
|
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
printf("can't initialize SDL: %s\n", SDL_GetError());
|
printf("can't initialize SDL: %s\n", SDL_GetError());
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include <spa/param/format-utils.h>
|
#include <spa/param/format-utils.h>
|
||||||
#include <spa/param/video/format-utils.h>
|
#include <spa/param/video/format-utils.h>
|
||||||
#include <spa/param/props.h>
|
#include <spa/param/props.h>
|
||||||
#include <spa/lib/debug.h>
|
#include <spa/debug/format.h>
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
|
|
||||||
|
|
@ -343,7 +343,7 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo
|
||||||
params[0] = spa_pod_builder_pop(&b);
|
params[0] = spa_pod_builder_pop(&b);
|
||||||
|
|
||||||
printf("supported formats:\n");
|
printf("supported formats:\n");
|
||||||
spa_debug_pod(params[0], SPA_DEBUG_FLAG_FORMAT);
|
spa_debug_format(2, data->t->map, params[0]);
|
||||||
|
|
||||||
pw_stream_add_listener(data->stream,
|
pw_stream_add_listener(data->stream,
|
||||||
&data->stream_listener,
|
&data->stream_listener,
|
||||||
|
|
@ -426,8 +426,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
init_type(&data.type, data.t->map);
|
init_type(&data.type, data.t->map);
|
||||||
|
|
||||||
spa_debug_set_type_map(data.t->map);
|
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
printf("can't initialize SDL: %s\n", SDL_GetError());
|
printf("can't initialize SDL: %s\n", SDL_GetError());
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ pipewire_module_link_factory = shared_library('pipewire-module-link-factory',
|
||||||
#pipewire_module_protocol_dbus = shared_library('pipewire-module-protocol-dbus', [ 'module-protocol-dbus.c', gdbus_target ],
|
#pipewire_module_protocol_dbus = shared_library('pipewire-module-protocol-dbus', [ 'module-protocol-dbus.c', gdbus_target ],
|
||||||
# c_args : pipewire_module_c_args,
|
# c_args : pipewire_module_c_args,
|
||||||
# include_directories : [configinc, spa_inc],
|
# include_directories : [configinc, spa_inc],
|
||||||
# link_with : spalib,
|
|
||||||
# install : true,
|
# install : true,
|
||||||
# install_dir : modules_install_dir,
|
# install_dir : modules_install_dir,
|
||||||
# dependencies : [glib_dep, gio_dep, mathlib, dl_lib, pipewire_dep],
|
# dependencies : [glib_dep, gio_dep, mathlib, dl_lib, pipewire_dep],
|
||||||
|
|
@ -80,7 +79,6 @@ pipewire_module_protocol_native = shared_library('pipewire-module-protocol-nativ
|
||||||
'module-protocol-native/connection.c' ],
|
'module-protocol-native/connection.c' ],
|
||||||
c_args : pipewire_module_c_args,
|
c_args : pipewire_module_c_args,
|
||||||
include_directories : [configinc, spa_inc],
|
include_directories : [configinc, spa_inc],
|
||||||
link_with : spalib,
|
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : modules_install_dir,
|
install_dir : modules_install_dir,
|
||||||
dependencies : [mathlib, dl_lib, pipewire_dep],
|
dependencies : [mathlib, dl_lib, pipewire_dep],
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
|
||||||
#include <spa/pod/iter.h>
|
#include <spa/pod/iter.h>
|
||||||
#include <spa/lib/debug.h>
|
#include <spa/debug/pod.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ process_messages(struct client_data *data)
|
||||||
|
|
||||||
if (debug_messages) {
|
if (debug_messages) {
|
||||||
printf("<<<<<<<<< in: %d %d %d\n", id, opcode, size);
|
printf("<<<<<<<<< in: %d %d %d\n", id, opcode, size);
|
||||||
spa_debug_pod((struct spa_pod *)message, 0);
|
spa_debug_pod(0, core->type.map, (struct spa_pod *)message);
|
||||||
}
|
}
|
||||||
if (demarshal[opcode].func(resource, message, size) < 0)
|
if (demarshal[opcode].func(resource, message, size) < 0)
|
||||||
goto invalid_message;
|
goto invalid_message;
|
||||||
|
|
@ -338,7 +338,7 @@ static struct pw_client *client_new(struct server *s, int fd)
|
||||||
if (this->source == NULL)
|
if (this->source == NULL)
|
||||||
goto no_source;
|
goto no_source;
|
||||||
|
|
||||||
this->connection = pw_protocol_native_connection_new(fd);
|
this->connection = pw_protocol_native_connection_new(protocol->core, fd);
|
||||||
if (this->connection == NULL)
|
if (this->connection == NULL)
|
||||||
goto no_connection;
|
goto no_connection;
|
||||||
|
|
||||||
|
|
@ -561,7 +561,7 @@ on_remote_data(void *data, int fd, enum spa_io mask)
|
||||||
}
|
}
|
||||||
if (debug_messages) {
|
if (debug_messages) {
|
||||||
printf("<<<<<<<<< in: %d %d %d\n", id, opcode, size);
|
printf("<<<<<<<<< in: %d %d %d\n", id, opcode, size);
|
||||||
spa_debug_pod((struct spa_pod *)message, 0);
|
spa_debug_pod(0, core->type.map, (struct spa_pod *)message);
|
||||||
}
|
}
|
||||||
if (demarshal[opcode].func(proxy, message, size) < 0) {
|
if (demarshal[opcode].func(proxy, message, size) < 0) {
|
||||||
pw_log_error ("protocol-native %p: invalid message received %u for %u", this,
|
pw_log_error ("protocol-native %p: invalid message received %u for %u", this,
|
||||||
|
|
@ -605,7 +605,7 @@ static int impl_connect_fd(struct pw_protocol_client *client, int fd)
|
||||||
|
|
||||||
impl->disconnecting = false;
|
impl->disconnecting = false;
|
||||||
|
|
||||||
impl->connection = pw_protocol_native_connection_new(fd);
|
impl->connection = pw_protocol_native_connection_new(remote->core, fd);
|
||||||
if (impl->connection == NULL)
|
if (impl->connection == NULL)
|
||||||
goto error_close;
|
goto error_close;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
#include <spa/lib/debug.h>
|
#include <spa/debug/pod.h>
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <pipewire/private.h>
|
#include <pipewire/private.h>
|
||||||
|
|
@ -59,6 +59,8 @@ struct impl {
|
||||||
uint32_t dest_id;
|
uint32_t dest_id;
|
||||||
uint8_t opcode;
|
uint8_t opcode;
|
||||||
struct spa_pod_builder builder;
|
struct spa_pod_builder builder;
|
||||||
|
|
||||||
|
struct pw_core *core;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \endcond */
|
/** \endcond */
|
||||||
|
|
@ -193,7 +195,7 @@ static void clear_buffer(struct buffer *buf)
|
||||||
*
|
*
|
||||||
* \memberof pw_protocol_native_connection
|
* \memberof pw_protocol_native_connection
|
||||||
*/
|
*/
|
||||||
struct pw_protocol_native_connection *pw_protocol_native_connection_new(int fd)
|
struct pw_protocol_native_connection *pw_protocol_native_connection_new(struct pw_core *core, int fd)
|
||||||
{
|
{
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
struct pw_protocol_native_connection *this;
|
struct pw_protocol_native_connection *this;
|
||||||
|
|
@ -216,6 +218,7 @@ struct pw_protocol_native_connection *pw_protocol_native_connection_new(int fd)
|
||||||
impl->in.buffer_data = malloc(MAX_BUFFER_SIZE);
|
impl->in.buffer_data = malloc(MAX_BUFFER_SIZE);
|
||||||
impl->in.buffer_maxsize = MAX_BUFFER_SIZE;
|
impl->in.buffer_maxsize = MAX_BUFFER_SIZE;
|
||||||
impl->in.update = true;
|
impl->in.update = true;
|
||||||
|
impl->core = core;
|
||||||
|
|
||||||
if (impl->out.buffer_data == NULL || impl->in.buffer_data == NULL)
|
if (impl->out.buffer_data == NULL || impl->in.buffer_data == NULL)
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
|
|
@ -432,7 +435,7 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn,
|
||||||
|
|
||||||
if (debug_messages) {
|
if (debug_messages) {
|
||||||
printf(">>>>>>>>> out: %d %d %d\n", impl->dest_id, impl->opcode, size);
|
printf(">>>>>>>>> out: %d %d %d\n", impl->dest_id, impl->opcode, size);
|
||||||
spa_debug_pod((struct spa_pod *)p, 0);
|
spa_debug_pod(0, impl->core->type.map, (struct spa_pod *)p);
|
||||||
}
|
}
|
||||||
spa_hook_list_call(&conn->listener_list, struct pw_protocol_native_connection_events, need_flush);
|
spa_hook_list_call(&conn->listener_list, struct pw_protocol_native_connection_events, need_flush);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ pw_protocol_native_connection_add_listener(struct pw_protocol_native_connection
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pw_protocol_native_connection *
|
struct pw_protocol_native_connection *
|
||||||
pw_protocol_native_connection_new(int fd);
|
pw_protocol_native_connection_new(struct pw_core *core, int fd);
|
||||||
|
|
||||||
void
|
void
|
||||||
pw_protocol_native_connection_destroy(struct pw_protocol_native_connection *conn);
|
pw_protocol_native_connection_destroy(struct pw_protocol_native_connection *conn);
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define spa_debug pw_log_trace
|
#include <pipewire/log.h>
|
||||||
|
|
||||||
#include <spa/lib/debug.h>
|
|
||||||
#include <spa/support/dbus.h>
|
#include <spa/support/dbus.h>
|
||||||
|
#include <spa/debug/format.h>
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <pipewire/private.h>
|
#include <pipewire/private.h>
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
#include <pipewire/core.h>
|
#include <pipewire/core.h>
|
||||||
#include <pipewire/data-loop.h>
|
#include <pipewire/data-loop.h>
|
||||||
|
|
||||||
|
#undef spa_debug
|
||||||
|
#define spa_debug pw_log_trace
|
||||||
#include <spa/graph/graph-scheduler6.h>
|
#include <spa/graph/graph-scheduler6.h>
|
||||||
|
|
||||||
/** \cond */
|
/** \cond */
|
||||||
|
|
@ -389,8 +391,6 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop, struct pw_properties *pro
|
||||||
spa_graph_init(&this->rt.graph);
|
spa_graph_init(&this->rt.graph);
|
||||||
spa_graph_set_callbacks(&this->rt.graph, &spa_graph_impl_default, NULL);
|
spa_graph_set_callbacks(&this->rt.graph, &spa_graph_impl_default, NULL);
|
||||||
|
|
||||||
spa_debug_set_type_map(this->type.map);
|
|
||||||
|
|
||||||
this->support[0] = SPA_SUPPORT_INIT(SPA_TYPE__TypeMap, this->type.map);
|
this->support[0] = SPA_SUPPORT_INIT(SPA_TYPE__TypeMap, this->type.map);
|
||||||
this->support[1] = SPA_SUPPORT_INIT(SPA_TYPE_LOOP__DataLoop, this->data_loop->loop);
|
this->support[1] = SPA_SUPPORT_INIT(SPA_TYPE_LOOP__DataLoop, this->data_loop->loop);
|
||||||
this->support[2] = SPA_SUPPORT_INIT(SPA_TYPE_LOOP__MainLoop, this->main_loop->loop);
|
this->support[2] = SPA_SUPPORT_INIT(SPA_TYPE_LOOP__MainLoop, this->main_loop->loop);
|
||||||
|
|
@ -784,7 +784,7 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
}
|
}
|
||||||
pw_log_debug("enum output %d with filter: %p", oidx, filter);
|
pw_log_debug("enum output %d with filter: %p", oidx, filter);
|
||||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||||
spa_debug_pod(filter, SPA_DEBUG_FLAG_FORMAT);
|
spa_debug_format(2, core->type.map, filter);
|
||||||
|
|
||||||
if ((res = spa_node_port_enum_params(output->node->node,
|
if ((res = spa_node_port_enum_params(output->node->node,
|
||||||
output->direction, output->port_id,
|
output->direction, output->port_id,
|
||||||
|
|
@ -800,7 +800,7 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
|
|
||||||
pw_log_debug("Got filtered:");
|
pw_log_debug("Got filtered:");
|
||||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||||
spa_debug_pod(*format, SPA_DEBUG_FLAG_FORMAT);
|
spa_debug_format(2, core->type.map, *format);
|
||||||
} else {
|
} else {
|
||||||
res = -EBADF;
|
res = -EBADF;
|
||||||
asprintf(error, "error node state");
|
asprintf(error, "error node state");
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@
|
||||||
#include <spa/pod/parser.h>
|
#include <spa/pod/parser.h>
|
||||||
#include <spa/pod/compare.h>
|
#include <spa/pod/compare.h>
|
||||||
#include <spa/param/param.h>
|
#include <spa/param/param.h>
|
||||||
|
#include <spa/debug/node.h>
|
||||||
|
#include <spa/debug/format.h>
|
||||||
|
|
||||||
#include <spa/lib/debug.h>
|
|
||||||
|
|
||||||
#include "pipewire.h"
|
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
#include "pipewire.h"
|
||||||
#include "interfaces.h"
|
#include "interfaces.h"
|
||||||
#include "link.h"
|
#include "link.h"
|
||||||
#include "work-queue.h"
|
#include "work-queue.h"
|
||||||
|
|
@ -186,7 +186,7 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
|
||||||
|
|
||||||
pw_log_debug("link %p: doing set format %p", this, format);
|
pw_log_debug("link %p: doing set format %p", this, format);
|
||||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||||
spa_debug_pod(format, SPA_DEBUG_FLAG_FORMAT);
|
spa_debug_format(2, t->map, format);
|
||||||
|
|
||||||
if (out_state == PW_PORT_STATE_CONFIGURE) {
|
if (out_state == PW_PORT_STATE_CONFIGURE) {
|
||||||
pw_log_debug("link %p: doing set format on output", this);
|
pw_log_debug("link %p: doing set format on output", this);
|
||||||
|
|
@ -459,7 +459,7 @@ param_filter(struct pw_link *this,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG) && iparam != NULL)
|
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG) && iparam != NULL)
|
||||||
spa_debug_pod(iparam, 0);
|
spa_debug_pod(2, this->core->type.map, iparam);
|
||||||
|
|
||||||
for (oidx = 0;;) {
|
for (oidx = 0;;) {
|
||||||
pw_log_debug("oparam %d", oidx);
|
pw_log_debug("oparam %d", oidx);
|
||||||
|
|
@ -470,7 +470,7 @@ param_filter(struct pw_link *this,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||||
spa_debug_pod(oparam, 0);
|
spa_debug_pod(2, this->core->type.map, oparam);
|
||||||
|
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
|
|
@ -555,8 +555,8 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG)) {
|
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG)) {
|
||||||
spa_debug_port_info(oinfo);
|
spa_debug_port_info(2, oinfo);
|
||||||
spa_debug_port_info(iinfo);
|
spa_debug_port_info(2, iinfo);
|
||||||
}
|
}
|
||||||
if (output->allocation.n_buffers) {
|
if (output->allocation.n_buffers) {
|
||||||
out_flags = 0;
|
out_flags = 0;
|
||||||
|
|
@ -593,7 +593,7 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
|
||||||
spa_pod_fixate(params[i]);
|
spa_pod_fixate(params[i]);
|
||||||
pw_log_debug("fixated param %d:", i);
|
pw_log_debug("fixated param %d:", i);
|
||||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||||
spa_debug_pod(params[i], 0);
|
spa_debug_pod(2, this->core->type.map, params[i]);
|
||||||
offset += SPA_ROUND_UP_N(SPA_POD_SIZE(params[i]), 8);
|
offset += SPA_ROUND_UP_N(SPA_POD_SIZE(params[i]), 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,10 @@ pw_log_logv(enum spa_log_level level,
|
||||||
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
|
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
|
||||||
|
|
||||||
#define pw_log_logc(lev,...) \
|
#define pw_log_logc(lev,...) \
|
||||||
|
({ \
|
||||||
if (SPA_UNLIKELY(pw_log_level_enabled (lev))) \
|
if (SPA_UNLIKELY(pw_log_level_enabled (lev))) \
|
||||||
pw_log_log(lev,__VA_ARGS__)
|
pw_log_log(lev,__VA_ARGS__); \
|
||||||
|
})
|
||||||
|
|
||||||
#define pw_log_error(...) pw_log_logc(SPA_LOG_LEVEL_ERROR,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
#define pw_log_error(...) pw_log_logc(SPA_LOG_LEVEL_ERROR,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||||
#define pw_log_warn(...) pw_log_logc(SPA_LOG_LEVEL_WARN,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
#define pw_log_warn(...) pw_log_logc(SPA_LOG_LEVEL_WARN,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||||
|
|
|
||||||
|
|
@ -79,12 +79,11 @@ libpipewire = shared_library('pipewire-@0@'.format(apiversion), pipewire_sources
|
||||||
soversion : soversion,
|
soversion : soversion,
|
||||||
c_args : libpipewire_c_args,
|
c_args : libpipewire_c_args,
|
||||||
include_directories : [pipewire_inc, configinc, spa_inc],
|
include_directories : [pipewire_inc, configinc, spa_inc],
|
||||||
link_with : spalib,
|
|
||||||
install : true,
|
install : true,
|
||||||
dependencies : [dl_lib, mathlib, pthread_lib],
|
dependencies : [dl_lib, mathlib, pthread_lib],
|
||||||
)
|
)
|
||||||
|
|
||||||
pipewire_dep = declare_dependency(link_with : libpipewire,
|
pipewire_dep = declare_dependency(link_with : libpipewire,
|
||||||
include_directories : [pipewire_inc, configinc, spa_inc],
|
include_directories : [pipewire_inc, configinc, spa_inc],
|
||||||
dependencies : [pthread_lib,spalib_dep],
|
dependencies : [pthread_lib],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <spa/lib/debug.h>
|
#include <spa/debug/format.h>
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <pipewire/command.h>
|
#include <pipewire/command.h>
|
||||||
|
|
@ -596,7 +596,7 @@ static void info_link(struct proxy_data *pd)
|
||||||
fprintf(stdout, "%c\tinput-port-id: %u\n", MARK_CHANGE(1), info->input_port_id);
|
fprintf(stdout, "%c\tinput-port-id: %u\n", MARK_CHANGE(1), info->input_port_id);
|
||||||
fprintf(stdout, "%c\tformat:\n", MARK_CHANGE(2));
|
fprintf(stdout, "%c\tformat:\n", MARK_CHANGE(2));
|
||||||
if (info->format)
|
if (info->format)
|
||||||
spa_debug_pod(info->format, SPA_DEBUG_FLAG_FORMAT);
|
spa_debug_format(2, pd->rd->data->t->map, info->format);
|
||||||
else
|
else
|
||||||
fprintf(stdout, "\t\tnone\n");
|
fprintf(stdout, "\t\tnone\n");
|
||||||
print_properties(info->props, MARK_CHANGE(3), true);
|
print_properties(info->props, MARK_CHANGE(3), true);
|
||||||
|
|
@ -666,14 +666,14 @@ static void node_event_param(void *object, uint32_t id, uint32_t index, uint32_t
|
||||||
struct proxy_data *data = object;
|
struct proxy_data *data = object;
|
||||||
struct remote_data *rd = data->rd;
|
struct remote_data *rd = data->rd;
|
||||||
struct pw_type *t = rd->data->t;
|
struct pw_type *t = rd->data->t;
|
||||||
uint32_t flags = 0;
|
|
||||||
|
|
||||||
fprintf(stdout, "remote %d node %d param %d index %d\n",
|
fprintf(stdout, "remote %d node %d param %d index %d\n",
|
||||||
rd->id, data->global->id, id, index);
|
rd->id, data->global->id, id, index);
|
||||||
|
|
||||||
if (spa_pod_is_object_type(param, t->spa_format))
|
if (spa_pod_is_object_type(param, t->spa_format))
|
||||||
flags |= SPA_DEBUG_FLAG_FORMAT;
|
spa_debug_format(2, t->map, param);
|
||||||
spa_debug_pod(param, flags);
|
else
|
||||||
|
spa_debug_pod(2, t->map, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct pw_node_proxy_events node_events = {
|
static const struct pw_node_proxy_events node_events = {
|
||||||
|
|
@ -704,14 +704,14 @@ static void port_event_param(void *object, uint32_t id, uint32_t index, uint32_t
|
||||||
struct proxy_data *data = object;
|
struct proxy_data *data = object;
|
||||||
struct remote_data *rd = data->rd;
|
struct remote_data *rd = data->rd;
|
||||||
struct pw_type *t = rd->data->t;
|
struct pw_type *t = rd->data->t;
|
||||||
uint32_t flags = 0;
|
|
||||||
|
|
||||||
fprintf(stdout, "remote %d port %d param %d index %d\n",
|
fprintf(stdout, "remote %d port %d param %d index %d\n",
|
||||||
rd->id, data->global->id, id, index);
|
rd->id, data->global->id, id, index);
|
||||||
|
|
||||||
if (spa_pod_is_object_type(param, t->spa_format))
|
if (spa_pod_is_object_type(param, t->spa_format))
|
||||||
flags |= SPA_DEBUG_FLAG_FORMAT;
|
spa_debug_format(2, t->map, param);
|
||||||
spa_debug_pod(param, flags);
|
else
|
||||||
|
spa_debug_pod(2, t->map, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct pw_port_proxy_events port_events = {
|
static const struct pw_port_proxy_events port_events = {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include <spa/lib/debug.h>
|
#include <spa/debug/format.h>
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <pipewire/interfaces.h>
|
#include <pipewire/interfaces.h>
|
||||||
|
|
@ -216,10 +216,10 @@ static void print_node(struct proxy_data *data)
|
||||||
printf("%c\tname: \"%s\"\n", MARK_CHANGE(0), info->name);
|
printf("%c\tname: \"%s\"\n", MARK_CHANGE(0), info->name);
|
||||||
printf("%c\tparams:\n", MARK_CHANGE(5));
|
printf("%c\tparams:\n", MARK_CHANGE(5));
|
||||||
for (i = 0; i < data->n_params; i++) {
|
for (i = 0; i < data->n_params; i++) {
|
||||||
uint32_t flags = 0;
|
|
||||||
if (spa_pod_is_object_type(data->params[i], t->spa_format))
|
if (spa_pod_is_object_type(data->params[i], t->spa_format))
|
||||||
flags |= SPA_DEBUG_FLAG_FORMAT;
|
spa_debug_format(2, t->map, data->params[i]);
|
||||||
spa_debug_pod(data->params[i], flags);
|
else
|
||||||
|
spa_debug_pod(2, t->map, data->params[i]);
|
||||||
}
|
}
|
||||||
printf("%c\tinput ports: %u/%u\n", MARK_CHANGE(1),
|
printf("%c\tinput ports: %u/%u\n", MARK_CHANGE(1),
|
||||||
info->n_input_ports, info->max_input_ports);
|
info->n_input_ports, info->max_input_ports);
|
||||||
|
|
@ -293,10 +293,10 @@ static void print_port(struct proxy_data *data)
|
||||||
printf("%c\tname: \"%s\"\n", MARK_CHANGE(0), info->name);
|
printf("%c\tname: \"%s\"\n", MARK_CHANGE(0), info->name);
|
||||||
printf("%c\tparams:\n", MARK_CHANGE(2));
|
printf("%c\tparams:\n", MARK_CHANGE(2));
|
||||||
for (i = 0; i < data->n_params; i++) {
|
for (i = 0; i < data->n_params; i++) {
|
||||||
uint32_t flags = 0;
|
|
||||||
if (spa_pod_is_object_type(data->params[i], t->spa_format))
|
if (spa_pod_is_object_type(data->params[i], t->spa_format))
|
||||||
flags |= SPA_DEBUG_FLAG_FORMAT;
|
spa_debug_format(2, t->map, data->params[i]);
|
||||||
spa_debug_pod(data->params[i], flags);
|
else
|
||||||
|
spa_debug_pod(2, t->map, data->params[i]);
|
||||||
}
|
}
|
||||||
print_properties(info->props, MARK_CHANGE(1));
|
print_properties(info->props, MARK_CHANGE(1));
|
||||||
}
|
}
|
||||||
|
|
@ -404,6 +404,7 @@ static const struct pw_client_proxy_events client_events = {
|
||||||
static void link_event_info(void *object, struct pw_link_info *info)
|
static void link_event_info(void *object, struct pw_link_info *info)
|
||||||
{
|
{
|
||||||
struct proxy_data *data = object;
|
struct proxy_data *data = object;
|
||||||
|
struct pw_type *t = pw_core_get_type(data->data->core);
|
||||||
bool print_all, print_mark;
|
bool print_all, print_mark;
|
||||||
|
|
||||||
print_all = true;
|
print_all = true;
|
||||||
|
|
@ -431,7 +432,7 @@ static void link_event_info(void *object, struct pw_link_info *info)
|
||||||
printf("%c\tinput-port-id: %u\n", MARK_CHANGE(1), info->input_port_id);
|
printf("%c\tinput-port-id: %u\n", MARK_CHANGE(1), info->input_port_id);
|
||||||
printf("%c\tformat:\n", MARK_CHANGE(2));
|
printf("%c\tformat:\n", MARK_CHANGE(2));
|
||||||
if (info->format)
|
if (info->format)
|
||||||
spa_debug_pod(info->format, SPA_DEBUG_FLAG_FORMAT);
|
spa_debug_format(2, t->map, info->format);
|
||||||
else
|
else
|
||||||
printf("\t\tnone\n");
|
printf("\t\tnone\n");
|
||||||
print_properties(info->props, MARK_CHANGE(3));
|
print_properties(info->props, MARK_CHANGE(3));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue