Reorganise SPA tree

Reorganise the SPA includes to make it more extensible later
Simplify the naming of the buffer and meta params
This commit is contained in:
Wim Taymans 2017-11-10 13:36:14 +01:00
parent 58451d626c
commit caaeaff223
151 changed files with 1353 additions and 964 deletions

View file

@ -24,9 +24,9 @@
extern "C" {
#endif
#include <spa/defs.h>
#include <spa/meta.h>
#include <spa/type-map.h>
#include <spa/utils/defs.h>
#include <spa/buffer/meta.h>
#include <spa/support/type-map.h>
/** \page page_buffer Buffers
*

View file

@ -24,9 +24,9 @@
extern "C" {
#endif
#include <spa/defs.h>
#include <spa/ringbuffer.h>
#include <spa/type-map.h>
#include <spa/utils/defs.h>
#include <spa/utils/ringbuffer.h>
#include <spa/support/type-map.h>
/** \page page_meta Metadata
*

View file

@ -39,9 +39,8 @@ enum spa_clock_state {
SPA_CLOCK_STATE_RUNNING,
};
#include <spa/defs.h>
#include <spa/plugin.h>
#include <spa/pod-builder.h>
#include <spa/utils/defs.h>
#include <spa/pod/builder.h>
/**
* spa_clock:

View file

@ -24,7 +24,7 @@
extern "C" {
#endif
#include <spa/graph.h>
#include <spa/graph/graph.h>
#define SPA_GRAPH_STATE_IN 0
#define SPA_GRAPH_STATE_OUT 1

View file

@ -24,7 +24,7 @@
extern "C" {
#endif
#include <spa/graph.h>
#include <spa/graph/graph.h>
static inline int spa_graph_scheduler_default(struct spa_graph_node *node)
{

View file

@ -24,7 +24,7 @@
extern "C" {
#endif
#include <spa/graph.h>
#include <spa/graph/graph.h>
static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *node)
{

View file

@ -0,0 +1,212 @@
/* Simple Plugin API
* Copyright (C) 2017 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_GRAPH_SCHEDULER_H__
#define __SPA_GRAPH_SCHEDULER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/graph/graph.h>
struct spa_graph_data {
struct spa_graph *graph;
};
static inline void spa_graph_data_init(struct spa_graph_data *data,
struct spa_graph *graph)
{
data->graph = graph;
}
static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *node);
static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *node);
static inline void check_input(struct spa_graph_node *node)
{
struct spa_graph_port *p;
node->ready[SPA_DIRECTION_INPUT] = 0;
spa_list_for_each(p, &node->ports[SPA_DIRECTION_INPUT], link) {
struct spa_graph_port *pport;
struct spa_graph_node *pnode;
if ((pport = p->peer) == NULL)
continue;
pnode = pport->node;
debug("node %p input peer %p io %d %d\n", node, pnode, pport->io->status, pport->io->buffer_id);
pnode->ready[SPA_DIRECTION_OUTPUT]++;
if (pport->io->status == SPA_RESULT_OK)
node->ready[SPA_DIRECTION_INPUT]++;
debug("node %p input peer %p out %d %d\n", node, pnode,
pnode->required[SPA_DIRECTION_OUTPUT],
pnode->ready[SPA_DIRECTION_OUTPUT]);
}
}
static inline void check_output(struct spa_graph_node *node)
{
struct spa_graph_port *p;
node->ready[SPA_DIRECTION_OUTPUT] = 0;
node->required[SPA_DIRECTION_OUTPUT] = 0;
spa_list_for_each(p, &node->ports[SPA_DIRECTION_OUTPUT], link) {
struct spa_graph_port *pport;
struct spa_graph_node *pnode;
if ((pport = p->peer) == NULL)
continue;
pnode = pport->node;
debug("node %p output peer %p io %d %d\n", node, pnode, pport->io->status, pport->io->buffer_id);
if (pport->io->status == SPA_RESULT_HAVE_BUFFER) {
pnode->ready[SPA_DIRECTION_INPUT]++;
node->required[SPA_DIRECTION_OUTPUT]++;
}
debug("node %p output peer %p out %d %d\n", node, pnode,
pnode->required[SPA_DIRECTION_INPUT],
pnode->ready[SPA_DIRECTION_INPUT]);
}
}
static inline void spa_graph_impl_activate(void *data, struct spa_graph_node *node)
{
int res;
debug("node %p activate %d\n", node, node->state);
if (node->state == SPA_RESULT_NEED_BUFFER) {
res = spa_node_process_input(node->implementation);
debug("node %p process in %d\n", node, res);
}
else if (node->state == SPA_RESULT_HAVE_BUFFER) {
res = spa_node_process_output(node->implementation);
debug("node %p process out %d\n", node, res);
}
else
return;
if (res == SPA_RESULT_NEED_BUFFER || (res == SPA_RESULT_OK && node->state == SPA_RESULT_NEED_BUFFER)) {
check_input(node);
}
else if (res == SPA_RESULT_HAVE_BUFFER) {
check_output(node);
}
node->state = res;
debug("node %p activate end %d\n", node, res);
}
static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *node)
{
struct spa_graph_port *p;
debug("node %p start pull\n", node);
node->state = SPA_RESULT_NEED_BUFFER;
node->ready[SPA_DIRECTION_INPUT] = 0;
spa_list_for_each(p, &node->ports[SPA_DIRECTION_INPUT], link) {
struct spa_graph_port *pport;
struct spa_graph_node *pnode;
uint32_t prequired;
if ((pport = p->peer) == NULL)
continue;
pnode = pport->node;
prequired = pnode->required[SPA_DIRECTION_OUTPUT];
debug("node %p pull peer %p io %d %d\n", node, pnode, pport->io->status, pport->io->buffer_id);
pnode->ready[SPA_DIRECTION_OUTPUT]++;
if (pport->io->status == SPA_RESULT_OK)
node->ready[SPA_DIRECTION_INPUT]++;
debug("node %p pull peer %p out %d %d\n", node, pnode, prequired, pnode->ready[SPA_DIRECTION_OUTPUT]);
if (prequired > 0 && pnode->ready[SPA_DIRECTION_OUTPUT] >= prequired) {
pnode->state = SPA_RESULT_HAVE_BUFFER;
spa_graph_impl_activate(data, pnode);
}
}
debug("node %p end pull\n", node);
return SPA_RESULT_OK;
}
static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *node)
{
struct spa_graph_port *p;
uint32_t required;
debug("node %p start push\n", node);
node->state = SPA_RESULT_HAVE_BUFFER;
node->ready[SPA_DIRECTION_OUTPUT] = 0;
node->required[SPA_DIRECTION_OUTPUT] = 0;
spa_list_for_each(p, &node->ports[SPA_DIRECTION_OUTPUT], link) {
struct spa_graph_port *pport;
struct spa_graph_node *pnode;
uint32_t prequired;
if ((pport = p->peer) == NULL)
continue;
pnode = pport->node;
prequired = pnode->required[SPA_DIRECTION_INPUT];
debug("node %p push peer %p io %d %d\n", node, pnode, pport->io->status, pport->io->buffer_id);
if (pport->io->status == SPA_RESULT_HAVE_BUFFER) {
pnode->ready[SPA_DIRECTION_INPUT]++;
node->required[SPA_DIRECTION_OUTPUT]++;
}
debug("node %p push peer %p in %d %d\n", node, pnode, prequired, pnode->ready[SPA_DIRECTION_INPUT]);
if (prequired > 0 && pnode->ready[SPA_DIRECTION_INPUT] >= prequired) {
pnode->state = SPA_RESULT_NEED_BUFFER;
spa_graph_impl_activate(data, pnode);
}
}
required = node->required[SPA_DIRECTION_OUTPUT];
if (required > 0 && node->ready[SPA_DIRECTION_OUTPUT] >= required) {
}
debug("node %p end push\n", node);
return SPA_RESULT_OK;
}
static const struct spa_graph_callbacks spa_graph_impl_default = {
SPA_VERSION_GRAPH_CALLBACKS,
.need_input = spa_graph_impl_need_input,
.have_output = spa_graph_impl_have_output,
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_GRAPH_SCHEDULER_H__ */

View file

@ -0,0 +1,158 @@
/* Simple Plugin API
* Copyright (C) 2017 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_GRAPH_SCHEDULER_H__
#define __SPA_GRAPH_SCHEDULER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/graph/graph.h>
struct spa_graph_data {
struct spa_graph *graph;
};
static inline void spa_graph_data_init(struct spa_graph_data *data,
struct spa_graph *graph)
{
data->graph = graph;
}
static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *node);
static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *node);
static inline void spa_graph_impl_activate(void *data, struct spa_graph_node *node, bool recurse)
{
int res = node->state;
debug("node %p activate %d\n", node, node->state);
if (node->state == SPA_RESULT_NEED_BUFFER) {
res = spa_node_process_input(node->implementation);
debug("node %p process in %d\n", node, res);
}
else if (node->state == SPA_RESULT_HAVE_BUFFER) {
res = spa_node_process_output(node->implementation);
debug("node %p process out %d\n", node, res);
}
if (recurse && (res == SPA_RESULT_NEED_BUFFER || res == SPA_RESULT_OK))
spa_graph_impl_need_input(data, node);
else if (recurse && (res == SPA_RESULT_HAVE_BUFFER))
spa_graph_impl_have_output(data, node);
else
node->state = res;
debug("node %p activate end %d\n", node, node->state);
}
static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *node)
{
struct spa_graph_port *p;
uint32_t required;
debug("node %p start pull\n", node);
node->state = SPA_RESULT_NEED_BUFFER;
node->ready[SPA_DIRECTION_INPUT] = 0;
required = node->required[SPA_DIRECTION_INPUT];
spa_list_for_each(p, &node->ports[SPA_DIRECTION_INPUT], link) {
struct spa_graph_port *pport;
struct spa_graph_node *pnode;
uint32_t prequired;
if ((pport = p->peer) == NULL)
continue;
pnode = pport->node;
prequired = pnode->required[SPA_DIRECTION_OUTPUT];
debug("node %p pull peer %p io %d %d\n", node, pnode, pport->io->status, pport->io->buffer_id);
if (pport->io->status == SPA_RESULT_NEED_BUFFER)
pnode->ready[SPA_DIRECTION_OUTPUT]++;
else if (pport->io->status == SPA_RESULT_OK)
node->ready[SPA_DIRECTION_INPUT]++;
debug("node %p pull peer %p out %d %d\n", node, pnode, prequired, pnode->ready[SPA_DIRECTION_OUTPUT]);
if (prequired > 0 && pnode->ready[SPA_DIRECTION_OUTPUT] >= prequired) {
if (pnode->state == SPA_RESULT_NEED_BUFFER)
pnode->state = SPA_RESULT_HAVE_BUFFER;
spa_graph_impl_activate(data, pnode, true);
}
}
if (required > 0 && node->ready[SPA_DIRECTION_INPUT] >= required)
spa_graph_impl_activate(data, node, false);
debug("node %p end pull\n", node);
return SPA_RESULT_OK;
}
static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *node)
{
struct spa_graph_port *p;
debug("node %p start push\n", node);
node->state = SPA_RESULT_HAVE_BUFFER;
node->ready[SPA_DIRECTION_OUTPUT] = 0;
node->required[SPA_DIRECTION_OUTPUT] = 0;
spa_list_for_each(p, &node->ports[SPA_DIRECTION_OUTPUT], link) {
struct spa_graph_port *pport;
struct spa_graph_node *pnode;
uint32_t prequired;
if ((pport = p->peer) == NULL)
continue;
pnode = pport->node;
prequired = pnode->required[SPA_DIRECTION_INPUT];
debug("node %p push peer %p io %d %d\n", node, pnode, pport->io->status, pport->io->buffer_id);
if (pport->io->status == SPA_RESULT_HAVE_BUFFER) {
pnode->ready[SPA_DIRECTION_INPUT]++;
node->required[SPA_DIRECTION_OUTPUT]++;
}
debug("node %p push peer %p in %d %d\n", node, pnode, prequired, pnode->ready[SPA_DIRECTION_INPUT]);
if (prequired > 0 && pnode->ready[SPA_DIRECTION_INPUT] >= prequired)
spa_graph_impl_activate(data, pnode, true);
}
required = node->required[SPA_DIRECTION_OUTPUT];
if (required > 0 && node->ready[SPA_DIRECTION_OUTPUT] >= required)
spa_graph_impl_activate(data, node, false);
debug("node %p end push\n", node);
return SPA_RESULT_OK;
}
static const struct spa_graph_callbacks spa_graph_impl_default = {
SPA_VERSION_GRAPH_CALLBACKS,
.need_input = spa_graph_impl_need_input,
.have_output = spa_graph_impl_have_output,
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_GRAPH_SCHEDULER_H__ */

View file

@ -24,7 +24,7 @@
extern "C" {
#endif
#include <spa/graph.h>
#include <spa/graph/graph.h>
struct spa_graph_data {
struct spa_graph *graph;

View file

@ -24,9 +24,9 @@
extern "C" {
#endif
#include <spa/defs.h>
#include <spa/list.h>
#include <spa/node.h>
#include <spa/utils/defs.h>
#include <spa/utils/list.h>
#include <spa/node/node.h>
#ifndef spa_debug
#define spa_debug(...)

View file

@ -1,57 +1,60 @@
spa_headers = [
'buffer.h',
'clock.h',
'command.h',
'command-node.h',
'defs.h',
'dict.h',
'event.h',
'event-node.h',
'format.h',
'format-utils.h',
'hook.h',
'list.h',
'log.h',
'loop.h',
'meta.h',
'monitor.h',
'node.h',
'param.h',
'param-alloc.h',
'plugin.h',
'pod.h',
'pod-builder.h',
'pod-iter.h',
'pod-parser.h',
'pod-utils.h',
'props.h',
'ringbuffer.h',
'type.h',
'type-map.h',
'buffer/buffer.h',
'buffer/meta.h',
'clock/clock.h',
'graph/graph.h',
'monitor/monitor.h',
'node/command.h',
'node/event.h',
'node/node.h',
'param/param.h',
'param/props.h',
'param/buffers.h',
'param/meta.h',
'param/format.h',
'param/format-utils.h',
'pod/pod.h',
'pod/builder.h',
'pod/command.h',
'pod/event.h',
'pod/iter.h',
'pod/parser.h',
'support/log.h',
'support/log-impl.h',
'support/loop.h',
'support/plugin.h',
'support/type-map.h',
'support/type-map-impl.h',
'utils/defs.h',
'utils/dict.h',
'utils/hook.h',
'utils/list.h',
'utils/ringbuffer.h',
'utils/type.h',
]
install_headers(spa_headers, subdir : 'spa')
spa_audio_headers = [
'audio/format.h',
'audio/format-utils.h',
'audio/raw.h',
'audio/raw-utils.h',
'param/audio/format.h',
'param/audio/format-utils.h',
'param/audio/raw.h',
'param/audio/raw-utils.h',
]
install_headers(spa_audio_headers,
subdir : 'spa/audio')
subdir : 'spa/param/audio')
spa_video_headers = [
'video/chroma.h',
'video/color.h',
'video/encoded.h',
'video/format.h',
'video/format-utils.h',
'video/multiview.h',
'video/raw.h',
'video/raw-utils.h',
'param/video/chroma.h',
'param/video/color.h',
'param/video/encoded.h',
'param/video/format.h',
'param/video/format-utils.h',
'param/video/multiview.h',
'param/video/raw.h',
'param/video/raw-utils.h',
]
install_headers(spa_video_headers,
subdir : 'spa/video')
subdir : 'spa/param/video')

View file

@ -28,9 +28,9 @@ struct spa_monitor;
#define SPA_TYPE__Monitor SPA_TYPE_INTERFACE_BASE "Monitor"
#define SPA_TYPE_MONITOR_BASE SPA_TYPE__Monitor ":"
#include <spa/defs.h>
#include <spa/dict.h>
#include <spa/event.h>
#include <spa/utils/defs.h>
#include <spa/utils/dict.h>
#include <spa/pod/event.h>
#define SPA_TYPE_EVENT__Monitor SPA_TYPE_EVENT_BASE "Monitor"
#define SPA_TYPE_EVENT_MONITOR_BASE SPA_TYPE_EVENT__Monitor ":"

View file

@ -24,8 +24,8 @@
extern "C" {
#endif
#include <spa/type-map.h>
#include <spa/command.h>
#include <spa/support/type-map.h>
#include <spa/pod/command.h>
#define SPA_TYPE_COMMAND__Node SPA_TYPE_COMMAND_BASE "Node"
#define SPA_TYPE_COMMAND_NODE_BASE SPA_TYPE_COMMAND__Node ":"

View file

@ -24,10 +24,10 @@
extern "C" {
#endif
#include <spa/defs.h>
#include <spa/event.h>
#include <spa/type-map.h>
#include <spa/node.h>
#include <spa/utils/defs.h>
#include <spa/pod/event.h>
#include <spa/support/type-map.h>
#include <spa/node/node.h>
#define SPA_TYPE_EVENT__Node SPA_TYPE_EVENT_BASE "Node"
#define SPA_TYPE_EVENT_NODE_BASE SPA_TYPE_EVENT__Node ":"

View file

@ -29,15 +29,14 @@ extern "C" {
struct spa_node;
#include <spa/defs.h>
#include <spa/plugin.h>
#include <spa/props.h>
#include <spa/pod-builder.h>
#include <spa/param.h>
#include <spa/event-node.h>
#include <spa/command-node.h>
#include <spa/buffer.h>
#include <spa/format.h>
#include <spa/utils/defs.h>
#include <spa/support/plugin.h>
#include <spa/pod/builder.h>
#include <spa/buffer/buffer.h>
#include <spa/node/event.h>
#include <spa/node/command.h>
/** A range */
struct spa_range {

View file

@ -1,150 +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.
*/
#ifndef __SPA_PARAM_ALLOC_H__
#define __SPA_PARAM_ALLOC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/defs.h>
#include <spa/param.h>
#include <spa/type-map.h>
#define SPA_TYPE__ParamAlloc SPA_TYPE_PARAM_BASE "Alloc"
#define SPA_TYPE_PARAM_ALLOC_BASE SPA_TYPE__ParamAlloc ":"
#define SPA_TYPE_PARAM_ALLOC__Buffers SPA_TYPE_PARAM_ALLOC_BASE "Buffers"
#define SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE SPA_TYPE_PARAM_ALLOC__Buffers ":"
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__size SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "size"
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__stride SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "stride"
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__buffers SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "buffers"
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__align SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "align"
struct spa_type_param_alloc_buffers {
uint32_t Buffers;
uint32_t size;
uint32_t stride;
uint32_t buffers;
uint32_t align;
};
static inline void
spa_type_param_alloc_buffers_map(struct spa_type_map *map,
struct spa_type_param_alloc_buffers *type)
{
if (type->Buffers == 0) {
type->Buffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC__Buffers);
type->size = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_BUFFERS__size);
type->stride = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_BUFFERS__stride);
type->buffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_BUFFERS__buffers);
type->align = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_BUFFERS__align);
}
}
#define SPA_TYPE_PARAM_ALLOC__MetaEnable SPA_TYPE_PARAM_ALLOC_BASE "MetaEnable"
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE SPA_TYPE_PARAM_ALLOC__MetaEnable ":"
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__type SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "type"
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__size SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "size"
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferSize SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferSize"
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferMinAvail SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferMinAvail"
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferStride SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferStride"
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferBlocks SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferBlocks"
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferAlign SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferAlign"
struct spa_type_param_alloc_meta_enable {
uint32_t MetaEnable;
uint32_t type;
uint32_t size;
uint32_t ringbufferSize;
uint32_t ringbufferMinAvail;
uint32_t ringbufferStride;
uint32_t ringbufferBlocks;
uint32_t ringbufferAlign;
};
static inline void
spa_type_param_alloc_meta_enable_map(struct spa_type_map *map,
struct spa_type_param_alloc_meta_enable *type)
{
if (type->MetaEnable == 0) {
int i;
#define OFF(n) offsetof(struct spa_type_param_alloc_meta_enable, n)
static struct { off_t offset; const char *type; } tab[] = {
{ OFF(MetaEnable), SPA_TYPE_PARAM_ALLOC__MetaEnable },
{ OFF(type), SPA_TYPE_PARAM_ALLOC_META_ENABLE__type },
{ OFF(size), SPA_TYPE_PARAM_ALLOC_META_ENABLE__size },
{ OFF(ringbufferSize), SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferSize },
{ OFF(ringbufferMinAvail), SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferMinAvail },
{ OFF(ringbufferStride), SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferStride },
{ OFF(ringbufferBlocks), SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferBlocks },
{ OFF(ringbufferAlign), SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferAlign },
};
#undef OFF
for (i = 0; i < SPA_N_ELEMENTS(tab); i++)
*SPA_MEMBER(type, tab[i].offset, uint32_t) = spa_type_map_get_id(map, tab[i].type);
}
}
#define SPA_TYPE_PARAM_ALLOC__VideoPadding SPA_TYPE_PARAM_ALLOC_BASE "VideoPadding"
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE SPA_TYPE_PARAM_ALLOC__VideoPadding ":"
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__top SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "top"
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__bottom SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "bottom"
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__left SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "left"
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__right SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "right"
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign0 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign0"
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign1 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign1"
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign2 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign2"
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign3 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign3"
struct spa_type_param_alloc_video_padding {
uint32_t VideoPadding;
uint32_t top;
uint32_t bottom;
uint32_t left;
uint32_t right;
uint32_t strideAlign[4];
};
static inline void
spa_type_param_alloc_video_padding_map(struct spa_type_map *map,
struct spa_type_param_alloc_video_padding *type)
{
if (type->VideoPadding == 0) {
type->VideoPadding = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC__VideoPadding);
type->top = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__top);
type->bottom = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__bottom);
type->left = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__left);
type->right = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__right);
type->strideAlign[0] = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign0);
type->strideAlign[1] = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign1);
type->strideAlign[2] = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign2);
type->strideAlign[3] = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign3);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_ALLOC_H__ */

View file

@ -17,16 +17,16 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_AUDIO_FORMAT_UTILS_H__
#define __SPA_AUDIO_FORMAT_UTILS_H__
#ifndef __SPA_PARAM_AUDIO_FORMAT_UTILS_H__
#define __SPA_PARAM_AUDIO_FORMAT_UTILS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/format-utils.h>
#include <spa/audio/format.h>
#include <spa/audio/raw-utils.h>
#include <spa/param/format-utils.h>
#include <spa/param/audio/format.h>
#include <spa/param/audio/raw-utils.h>
struct spa_type_format_audio {
uint32_t format;
@ -69,4 +69,4 @@ spa_format_audio_raw_parse(const struct spa_pod_object *format,
} /* extern "C" */
#endif
#endif /* __SPA_AUDIO_FORMAT_UTILS */
#endif /* __SPA_PARAM_AUDIO_FORMAT_UTILS */

View file

@ -17,15 +17,15 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_AUDIO_FORMAT_H__
#define __SPA_AUDIO_FORMAT_H__
#ifndef __SPA_PARAM_AUDIO_FORMAT_H__
#define __SPA_PARAM_AUDIO_FORMAT_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/format.h>
#include <spa/audio/raw.h>
#include <spa/param/format.h>
#include <spa/param/audio/raw.h>
#define SPA_TYPE_FORMAT__Audio SPA_TYPE_FORMAT_BASE "Audio"
#define SPA_TYPE_FORMAT_AUDIO_BASE SPA_TYPE_FORMAT__Audio ":"
@ -49,4 +49,4 @@ struct spa_audio_info {
} /* extern "C" */
#endif
#endif /* __SPA_AUDIO_FORMAT */
#endif /* __SPA_PARAM_AUDIO_FORMAT_H */

View file

@ -24,8 +24,8 @@
extern "C" {
#endif
#include <spa/type-map.h>
#include <spa/audio/raw.h>
#include <spa/support/type-map.h>
#include <spa/param/audio/raw.h>
#if __BYTE_ORDER == __BIG_ENDIAN
#define _SPA_TYPE_AUDIO_FORMAT_NE(fmt) SPA_TYPE_AUDIO_FORMAT_BASE fmt "BE"

View file

@ -0,0 +1,64 @@
/* 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.
*/
#ifndef __SPA_PARAM_BUFFERS_H__
#define __SPA_PARAM_BUFFERS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/param/param.h>
#include <spa/support/type-map.h>
#define SPA_TYPE_PARAM__Buffers SPA_TYPE_PARAM_BASE "Buffers"
#define SPA_TYPE_PARAM_BUFFERS_BASE SPA_TYPE_PARAM__Buffers ":"
#define SPA_TYPE_PARAM_BUFFERS__size SPA_TYPE_PARAM_BUFFERS_BASE "size"
#define SPA_TYPE_PARAM_BUFFERS__stride SPA_TYPE_PARAM_BUFFERS_BASE "stride"
#define SPA_TYPE_PARAM_BUFFERS__buffers SPA_TYPE_PARAM_BUFFERS_BASE "buffers"
#define SPA_TYPE_PARAM_BUFFERS__align SPA_TYPE_PARAM_BUFFERS_BASE "align"
struct spa_type_param_buffers {
uint32_t Buffers;
uint32_t size;
uint32_t stride;
uint32_t buffers;
uint32_t align;
};
static inline void
spa_type_param_buffers_map(struct spa_type_map *map,
struct spa_type_param_buffers *type)
{
if (type->Buffers == 0) {
type->Buffers = spa_type_map_get_id(map, SPA_TYPE_PARAM__Buffers);
type->size = spa_type_map_get_id(map, SPA_TYPE_PARAM_BUFFERS__size);
type->stride = spa_type_map_get_id(map, SPA_TYPE_PARAM_BUFFERS__stride);
type->buffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_BUFFERS__buffers);
type->align = spa_type_map_get_id(map, SPA_TYPE_PARAM_BUFFERS__align);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_BUFFERS_H__ */

View file

@ -17,8 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_FORMAT_UTILS_H__
#define __SPA_FORMAT_UTILS_H__
#ifndef __SPA_PARAM_FORMAT_UTILS_H__
#define __SPA_PARAM_FORMAT_UTILS_H__
#ifdef __cplusplus
extern "C" {
@ -26,9 +26,9 @@ extern "C" {
#include <stdarg.h>
#include <spa/format.h>
#include <spa/pod-parser.h>
#include <spa/type-map.h>
#include <spa/param/format.h>
#include <spa/pod/parser.h>
#include <spa/support/type-map.h>
struct spa_type_media_type {
uint32_t audio;
@ -142,4 +142,4 @@ spa_type_media_subtype_audio_map(struct spa_type_map *map,
} /* extern "C" */
#endif
#endif /* __SPA_FORMAT_UTILS_H__ */
#endif /* __PARAM_SPA_FORMAT_UTILS_H__ */

View file

@ -17,18 +17,17 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_FORMAT_H__
#define __SPA_FORMAT_H__
#ifndef __SPA_PARAM_FORMAT_H__
#define __SPA_PARAM_FORMAT_H__
#ifdef __cplusplus
extern "C" {
#endif
#define SPA_TYPE__Format SPA_TYPE_POD_OBJECT_BASE "Format"
#define SPA_TYPE_FORMAT_BASE SPA_TYPE__Format ":"
#include <spa/param/param.h>
#include <spa/defs.h>
#include <spa/pod.h>
#define SPA_TYPE__Format SPA_TYPE_PARAM_BASE "Format"
#define SPA_TYPE_FORMAT_BASE SPA_TYPE__Format ":"
#define SPA_TYPE__MediaType SPA_TYPE_ENUM_BASE "MediaType"
#define SPA_TYPE_MEDIA_TYPE_BASE SPA_TYPE__MediaType ":"
@ -80,4 +79,4 @@ extern "C" {
} /* extern "C" */
#endif
#endif /* __SPA_FORMAT_H__ */
#endif /* __SPA_PARAM_FORMAT_H__ */

View file

@ -0,0 +1,80 @@
/* 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.
*/
#ifndef __SPA_PARAM_META_H__
#define __SPA_PARAM_META_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/param/param.h>
#include <spa/support/type-map.h>
#define SPA_TYPE_PARAM__Meta SPA_TYPE_PARAM_BASE "Meta"
#define SPA_TYPE_PARAM_META_BASE SPA_TYPE_PARAM__Meta ":"
#define SPA_TYPE_PARAM_META__type SPA_TYPE_PARAM_META_BASE "type"
#define SPA_TYPE_PARAM_META__size SPA_TYPE_PARAM_META_BASE "size"
#define SPA_TYPE_PARAM_META__ringbufferSize SPA_TYPE_PARAM_META_BASE "ringbufferSize"
#define SPA_TYPE_PARAM_META__ringbufferMinAvail SPA_TYPE_PARAM_META_BASE "ringbufferMinAvail"
#define SPA_TYPE_PARAM_META__ringbufferStride SPA_TYPE_PARAM_META_BASE "ringbufferStride"
#define SPA_TYPE_PARAM_META__ringbufferBlocks SPA_TYPE_PARAM_META_BASE "ringbufferBlocks"
#define SPA_TYPE_PARAM_META__ringbufferAlign SPA_TYPE_PARAM_META_BASE "ringbufferAlign"
struct spa_type_param_meta {
uint32_t Meta;
uint32_t type;
uint32_t size;
uint32_t ringbufferSize;
uint32_t ringbufferMinAvail;
uint32_t ringbufferStride;
uint32_t ringbufferBlocks;
uint32_t ringbufferAlign;
};
static inline void
spa_type_param_meta_map(struct spa_type_map *map,
struct spa_type_param_meta *type)
{
if (type->Meta == 0) {
int i;
#define OFF(n) offsetof(struct spa_type_param_meta, n)
static struct { off_t offset; const char *type; } tab[] = {
{ OFF(Meta), SPA_TYPE_PARAM__Meta },
{ OFF(type), SPA_TYPE_PARAM_META__type },
{ OFF(size), SPA_TYPE_PARAM_META__size },
{ OFF(ringbufferSize), SPA_TYPE_PARAM_META__ringbufferSize },
{ OFF(ringbufferMinAvail), SPA_TYPE_PARAM_META__ringbufferMinAvail },
{ OFF(ringbufferStride), SPA_TYPE_PARAM_META__ringbufferStride },
{ OFF(ringbufferBlocks), SPA_TYPE_PARAM_META__ringbufferBlocks },
{ OFF(ringbufferAlign), SPA_TYPE_PARAM_META__ringbufferAlign },
};
#undef OFF
for (i = 0; i < SPA_N_ELEMENTS(tab); i++)
*SPA_MEMBER(type, tab[i].offset, uint32_t) = spa_type_map_get_id(map, tab[i].type);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_META_H__ */

View file

@ -24,9 +24,9 @@
extern "C" {
#endif
#include <spa/defs.h>
#include <spa/pod-utils.h>
#include <spa/type-map.h>
#include <spa/utils/defs.h>
#include <spa/pod/pod.h>
#include <spa/support/type-map.h>
/* base for parameter objects */
#define SPA_TYPE__Param SPA_TYPE_POD_OBJECT_BASE "Param"

View file

@ -17,18 +17,17 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_PROPS_H__
#define __SPA_PROPS_H__
#ifndef __SPA_PARAM_PROPS_H__
#define __SPA_PARAM_PROPS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/pod.h>
#include <spa/param.h>
#include <spa/param/param.h>
#define SPA_TYPE__Props SPA_TYPE_POD_OBJECT_BASE "Props"
#define SPA_TYPE_PROPS_BASE SPA_TYPE__Props ":"
#define SPA_TYPE__Props SPA_TYPE_PARAM_BASE "Props"
#define SPA_TYPE_PROPS_BASE SPA_TYPE__Props ":"
/** Common property ids */
#define SPA_TYPE_PROPS__device SPA_TYPE_PROPS_BASE "device"
@ -52,4 +51,4 @@ extern "C" {
} /* extern "C" */
#endif
#endif /* __SPA_PROPS_H__ */
#endif /* __SPA_PARAM_PROPS_H__ */

View file

@ -0,0 +1,73 @@
/* 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.
*/
#ifndef __SPA_PARAM_VIDEO_PADDING_H__
#define __SPA_PARAM_VIDEO_PADDING_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/param/param.h>
#include <spa/support/type-map.h>
#define SPA_TYPE_PARAM__VideoPadding SPA_TYPE_PARAM_BASE "VideoPadding"
#define SPA_TYPE_PARAM_VIDEO_PADDING_BASE SPA_TYPE_PARAM__VideoPadding ":"
#define SPA_TYPE_PARAM_VIDEO_PADDING__top SPA_TYPE_PARAM_VIDEO_PADDING_BASE "top"
#define SPA_TYPE_PARAM_VIDEO_PADDING__bottom SPA_TYPE_PARAM_VIDEO_PADDING_BASE "bottom"
#define SPA_TYPE_PARAM_VIDEO_PADDING__left SPA_TYPE_PARAM_VIDEO_PADDING_BASE "left"
#define SPA_TYPE_PARAM_VIDEO_PADDING__right SPA_TYPE_PARAM_VIDEO_PADDING_BASE "right"
#define SPA_TYPE_PARAM_VIDEO_PADDING__strideAlign0 SPA_TYPE_PARAM_VIDEO_PADDING_BASE "strideAlign0"
#define SPA_TYPE_PARAM_VIDEO_PADDING__strideAlign1 SPA_TYPE_PARAM_VIDEO_PADDING_BASE "strideAlign1"
#define SPA_TYPE_PARAM_VIDEO_PADDING__strideAlign2 SPA_TYPE_PARAM_VIDEO_PADDING_BASE "strideAlign2"
#define SPA_TYPE_PARAM_VIDEO_PADDING__strideAlign3 SPA_TYPE_PARAM_VIDEO_PADDING_BASE "strideAlign3"
struct spa_type_param_video_padding {
uint32_t VideoPadding;
uint32_t top;
uint32_t bottom;
uint32_t left;
uint32_t right;
uint32_t strideAlign[4];
};
static inline void
spa_type_param_video_padding_map(struct spa_type_map *map,
struct spa_type_param_video_padding *type)
{
if (type->VideoPadding == 0) {
type->VideoPadding = spa_type_map_get_id(map, SPA_TYPE_PARAM__VideoPadding);
type->top = spa_type_map_get_id(map, SPA_TYPE_PARAM_VIDEO_PADDING__top);
type->bottom = spa_type_map_get_id(map, SPA_TYPE_PARAM_VIDEO_PADDING__bottom);
type->left = spa_type_map_get_id(map, SPA_TYPE_PARAM_VIDEO_PADDING__left);
type->right = spa_type_map_get_id(map, SPA_TYPE_PARAM_VIDEO_PADDING__right);
type->strideAlign[0] = spa_type_map_get_id(map, SPA_TYPE_PARAM_VIDEO_PADDING__strideAlign0);
type->strideAlign[1] = spa_type_map_get_id(map, SPA_TYPE_PARAM_VIDEO_PADDING__strideAlign1);
type->strideAlign[2] = spa_type_map_get_id(map, SPA_TYPE_PARAM_VIDEO_PADDING__strideAlign2);
type->strideAlign[3] = spa_type_map_get_id(map, SPA_TYPE_PARAM_VIDEO_PADDING__strideAlign3);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_VIDEO_PADDING_H__ */

View file

@ -27,8 +27,8 @@ extern "C" {
struct spa_video_info_h264;
struct spa_video_info_mjpg;
#include <spa/format.h>
#include <spa/video/format.h>
#include <spa/param/format.h>
#include <spa/param/video/format.h>
enum spa_h264_stream_format {
SPA_H264_STREAM_FORMAT_UNKNOWN = 0,

View file

@ -17,16 +17,17 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_VIDEO_FORMAT_UTILS_H__
#define __SPA_VIDEO_FORMAT_UTILS_H__
#ifndef __SPA_PARAM_VIDEO_FORMAT_UTILS_H__
#define __SPA_PARAM_VIDEO_FORMAT_UTILS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/format-utils.h>
#include <spa/video/format.h>
#include <spa/video/raw-utils.h>
#include <spa/param/param.h>
#include <spa/param/format-utils.h>
#include <spa/param/video/format.h>
#include <spa/param/video/raw-utils.h>
struct spa_type_format_video {
uint32_t format;
@ -127,4 +128,4 @@ spa_format_video_mjpg_parse(const struct spa_pod_object *format,
} /* extern "C" */
#endif
#endif /* __SPA_VIDEO_FORMAT_UTILS */
#endif /* __SPA_PARAM_VIDEO_FORMAT_UTILS */

View file

@ -17,16 +17,16 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_VIDEO_FORMAT_H__
#define __SPA_VIDEO_FORMAT_H__
#ifndef __SPA_PARAM_VIDEO_FORMAT_H__
#define __SPA_PARAM_VIDEO_FORMAT_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/format-utils.h>
#include <spa/video/raw.h>
#include <spa/video/encoded.h>
#include <spa/param/format-utils.h>
#include <spa/param/video/raw.h>
#include <spa/param/video/encoded.h>
#define SPA_TYPE_FORMAT__Video SPA_TYPE_FORMAT_BASE "Video"
#define SPA_TYPE_FORMAT_VIDEO_BASE SPA_TYPE_FORMAT__Video ":"
@ -64,4 +64,4 @@ struct spa_video_info {
} /* extern "C" */
#endif
#endif /* __SPA_VIDEO_FORMAT */
#endif /* __SPA_PARAM_VIDEO_FORMAT */

View file

@ -24,8 +24,8 @@
extern "C" {
#endif
#include <spa/type-map.h>
#include <spa/video/raw.h>
#include <spa/support/type-map.h>
#include <spa/param/video/raw.h>
struct spa_type_video_format {
uint32_t UNKNOWN;

View file

@ -24,10 +24,9 @@
extern "C" {
#endif
#include <spa/props.h>
#include <spa/video/chroma.h>
#include <spa/video/color.h>
#include <spa/video/multiview.h>
#include <spa/param/video/chroma.h>
#include <spa/param/video/color.h>
#include <spa/param/video/multiview.h>
#define SPA_VIDEO_MAX_PLANES 4
#define SPA_VIDEO_MAX_COMPONENTS 4

View file

@ -1,65 +0,0 @@
/* Simple Plugin API
* Copyright (C) 2017 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_POD_ITER_H__
#define __SPA_POD_ITER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#include <spa/defs.h>
#include <spa/pod-utils.h>
struct spa_pod_iter {
const void *data;
uint32_t size;
uint32_t offset;
};
static inline void spa_pod_iter_init(struct spa_pod_iter *iter, const void *data, uint32_t size, uint32_t offset)
{
iter->data = data;
iter->size = size;
iter->offset = offset;
}
static inline struct spa_pod *spa_pod_iter_current(struct spa_pod_iter *iter)
{
if (iter->offset + 8 <= iter->size) {
struct spa_pod *pod = SPA_MEMBER(iter->data, iter->offset, struct spa_pod);
if (SPA_POD_SIZE(pod) <= iter->size)
return pod;
}
return NULL;
}
static inline void spa_pod_iter_advance(struct spa_pod_iter *iter, struct spa_pod *current)
{
if (current)
iter->offset += SPA_ROUND_UP_N(SPA_POD_SIZE(current), 8);
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_POD_H__ */

View file

@ -25,7 +25,8 @@ extern "C" {
#endif
#include <stdarg.h>
#include <spa/pod-utils.h>
#include <spa/pod/pod.h>
struct spa_pod_frame {
struct spa_pod pod;

View file

@ -24,8 +24,8 @@
extern "C" {
#endif
#include <spa/defs.h>
#include <spa/pod.h>
#include <spa/utils/defs.h>
#include <spa/pod/pod.h>
#define SPA_TYPE__Command SPA_TYPE_POD_OBJECT_BASE "Command"
#define SPA_TYPE_COMMAND_BASE SPA_TYPE__Command ":"

View file

@ -24,8 +24,7 @@
extern "C" {
#endif
#include <spa/defs.h>
#include <spa/pod.h>
#include <spa/pod/pod.h>
#define SPA_TYPE__Event SPA_TYPE_POD_OBJECT_BASE "Event"
#define SPA_TYPE_EVENT_BASE SPA_TYPE__Event ":"

View file

@ -17,37 +17,47 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_POD_UTILS_H__
#define __SPA_POD_UTILS_H__
#ifndef __SPA_POD_ITER_H__
#define __SPA_POD_ITER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#include <spa/pod.h>
#define SPA_POD_BODY_SIZE(pod) (((struct spa_pod*)(pod))->size)
#define SPA_POD_TYPE(pod) (((struct spa_pod*)(pod))->type)
#define SPA_POD_SIZE(pod) (sizeof(struct spa_pod) + SPA_POD_BODY_SIZE(pod))
#define SPA_POD_CONTENTS_SIZE(type,pod) (SPA_POD_SIZE(pod)-sizeof(type))
#include <spa/pod/pod.h>
#define SPA_POD_CONTENTS(type,pod) SPA_MEMBER((pod),sizeof(type),void)
#define SPA_POD_CONTENTS_CONST(type,pod) SPA_MEMBER((pod),sizeof(type),const void)
#define SPA_POD_BODY(pod) SPA_MEMBER((pod),sizeof(struct spa_pod),void)
#define SPA_POD_BODY_CONST(pod) SPA_MEMBER((pod),sizeof(struct spa_pod),const void)
struct spa_pod_iter {
const void *data;
uint32_t size;
uint32_t offset;
};
#define SPA_POD_VALUE(type,pod) (((type*)pod)->value)
#define SPA_POD_PROP_N_VALUES(prop) (((prop)->pod.size - sizeof(struct spa_pod_prop_body)) / (prop)->body.value.size)
static inline bool spa_pod_is_object_type(struct spa_pod *pod, uint32_t type)
static inline void spa_pod_iter_init(struct spa_pod_iter *iter, const void *data, uint32_t size, uint32_t offset)
{
return (pod->type == SPA_POD_TYPE_OBJECT
&& ((struct spa_pod_object *) pod)->body.type == type);
iter->data = data;
iter->size = size;
iter->offset = offset;
}
static inline bool spa_pod_is_iter(const void *pod, uint32_t size, const struct spa_pod *iter)
static inline struct spa_pod *spa_pod_iter_current(struct spa_pod_iter *iter)
{
if (iter->offset + 8 <= iter->size) {
struct spa_pod *pod = SPA_MEMBER(iter->data, iter->offset, struct spa_pod);
if (SPA_POD_SIZE(pod) <= iter->size)
return pod;
}
return NULL;
}
static inline void spa_pod_iter_advance(struct spa_pod_iter *iter, struct spa_pod *current)
{
if (current)
iter->offset += SPA_ROUND_UP_N(SPA_POD_SIZE(current), 8);
}
static inline bool spa_pod_is_inside(const void *pod, uint32_t size, const struct spa_pod *iter)
{
return iter < SPA_MEMBER(pod, size, struct spa_pod);
}
@ -64,22 +74,21 @@ static inline struct spa_pod *spa_pod_next(const struct spa_pod *iter)
#define SPA_POD_FOREACH(pod, size, iter) \
for ((iter) = (pod); \
spa_pod_is_iter(pod, size, iter); \
spa_pod_is_inside(pod, size, iter); \
(iter) = spa_pod_next(iter))
#define SPA_POD_FOREACH_SAFE(pod, size, iter, tmp) \
for ((iter) = (pod), (tmp) = spa_pod_next(iter); \
spa_pod_is_iter(pod, size, iter); \
spa_pod_is_inside(pod, size, iter); \
(iter) = (tmp), \
(tmp) = spa_pod_next(iter))
#define SPA_POD_CONTENTS_FOREACH(pod, offset, iter) \
SPA_POD_FOREACH(SPA_MEMBER((pod), (offset), struct spa_pod),SPA_POD_SIZE (pod)-(offset),iter)
#define SPA_POD_OBJECT_BODY_FOREACH(body, size, iter) \
for ((iter) = SPA_MEMBER((body), sizeof(struct spa_pod_object_body), struct spa_pod); \
spa_pod_is_iter(body, size, iter); \
spa_pod_is_inside(body, size, iter); \
(iter) = spa_pod_next(iter))
#define SPA_POD_OBJECT_FOREACH(obj, iter) \
@ -115,16 +124,6 @@ static inline struct spa_pod_prop *spa_pod_struct_find_prop(const struct spa_pod
return spa_pod_contents_find_prop(&obj->pod, sizeof(struct spa_pod_struct), key);
}
#include <spa/pod-parser.h>
#define spa_pod_object_parse(object,...) \
({ \
struct spa_pod_parser __p; \
const struct spa_pod_object *__obj = object; \
spa_pod_parser_pod(&__p, &__obj->pod); \
spa_pod_parser_get(&__p, "<", ##__VA_ARGS__, NULL); \
})
static inline int spa_pod_object_fixate(struct spa_pod_object *obj)
{
struct spa_pod *res;
@ -139,4 +138,4 @@ static inline int spa_pod_object_fixate(struct spa_pod_object *obj)
} /* extern "C" */
#endif
#endif /* __SPA_POD_UTILS_H__ */
#endif /* __SPA_POD_H__ */

View file

@ -25,7 +25,8 @@ extern "C" {
#endif
#include <stdarg.h>
#include <spa/pod-iter.h>
#include <spa/pod/iter.h>
struct spa_pod_parser {
int depth;
@ -309,6 +310,14 @@ static inline int spa_pod_parser_get(struct spa_pod_parser *parser,
return res;
}
#define spa_pod_object_parse(object,...) \
({ \
struct spa_pod_parser __p; \
const struct spa_pod_object *__obj = object; \
spa_pod_parser_pod(&__p, &__obj->pod); \
spa_pod_parser_get(&__p, "<", ##__VA_ARGS__, NULL); \
})
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -26,7 +26,7 @@ extern "C" {
#include <stdarg.h>
#include <spa/defs.h>
#include <spa/utils/defs.h>
#define SPA_TYPE__POD SPA_TYPE_BASE "POD"
#define SPA_TYPE_POD_BASE SPA_TYPE__POD ":"
@ -76,11 +76,23 @@ enum spa_pod_type {
SPA_POD_TYPE_CUSTOM_START = 64,
};
#define SPA_POD_BODY_SIZE(pod) (((struct spa_pod*)(pod))->size)
#define SPA_POD_TYPE(pod) (((struct spa_pod*)(pod))->type)
#define SPA_POD_SIZE(pod) (sizeof(struct spa_pod) + SPA_POD_BODY_SIZE(pod))
#define SPA_POD_CONTENTS_SIZE(type,pod) (SPA_POD_SIZE(pod)-sizeof(type))
#define SPA_POD_CONTENTS(type,pod) SPA_MEMBER((pod),sizeof(type),void)
#define SPA_POD_CONTENTS_CONST(type,pod) SPA_MEMBER((pod),sizeof(type),const void)
#define SPA_POD_BODY(pod) SPA_MEMBER((pod),sizeof(struct spa_pod),void)
#define SPA_POD_BODY_CONST(pod) SPA_MEMBER((pod),sizeof(struct spa_pod),const void)
struct spa_pod {
uint32_t size;
uint32_t type; /* one of spa_pod_type */
};
#define SPA_POD_VALUE(type,pod) (((type*)pod)->value)
struct spa_pod_bool {
struct spa_pod pod;
int32_t value;
@ -165,6 +177,12 @@ struct spa_pod_object {
struct spa_pod_object_body body;
};
static inline bool spa_pod_is_object_type(struct spa_pod *pod, uint32_t type)
{
return (pod->type == SPA_POD_TYPE_OBJECT
&& ((struct spa_pod_object *) pod)->body.type == type);
}
struct spa_pod_pointer_body {
uint32_t type;
void *value;
@ -180,6 +198,8 @@ struct spa_pod_fd {
int value;
};
#define SPA_POD_PROP_N_VALUES(prop) (((prop)->pod.size - sizeof(struct spa_pod_prop_body)) / (prop)->body.value.size)
struct spa_pod_prop_body {
uint32_t key;
#define SPA_POD_PROP_RANGE_NONE 0

View file

@ -24,7 +24,7 @@
extern "C" {
#endif
#include <spa/log.h>
#include <spa/support/log.h>
static inline void spa_log_impl_logv(struct spa_log *log,
enum spa_log_level level,

View file

@ -29,9 +29,7 @@ extern "C" {
#include <stdarg.h>
#include <spa/defs.h>
#include <spa/plugin.h>
#include <spa/loop.h>
#include <spa/utils/defs.h>
enum spa_log_level {
SPA_LOG_LEVEL_NONE = 0,

View file

@ -36,9 +36,8 @@ struct spa_loop_utils;
#define SPA_TYPE_LOOP__MainLoop SPA_TYPE_LOOP_BASE "MainLoop"
#define SPA_TYPE_LOOP__DataLoop SPA_TYPE_LOOP_BASE "DataLoop"
#include <spa/defs.h>
#include <spa/list.h>
#include <spa/hook.h>
#include <spa/utils/defs.h>
#include <spa/utils/hook.h>
enum spa_io {
SPA_IO_IN = (1 << 0),

View file

@ -24,8 +24,8 @@
extern "C" {
#endif
#include <spa/defs.h>
#include <spa/dict.h>
#include <spa/utils/defs.h>
#include <spa/utils/dict.h>
#define SPA_TYPE__Handle SPA_TYPE_INTERFACE_BASE "Handle"
#define SPA_TYPE__HandleFactory SPA_TYPE_INTERFACE_BASE "HandleFactory"

View file

@ -24,7 +24,7 @@
extern "C" {
#endif
#include <spa/type-map.h>
#include <spa/support/type-map.h>
static inline uint32_t
spa_type_map_impl_get_id (struct spa_type_map *map, const char *type)

View file

@ -24,9 +24,8 @@
extern "C" {
#endif
#include <spa/defs.h>
#include <spa/plugin.h>
#include <spa/type.h>
#include <spa/utils/defs.h>
#include <spa/utils/type.h>
#define SPA_TYPE__TypeMap SPA_TYPE_INTERFACE_BASE "TypeMap"

View file

@ -29,7 +29,7 @@ extern "C" {
#include <string.h>
#include <spa/defs.h>
#include <spa/utils/defs.h>
struct spa_dict_item {
const char *key;

View file

@ -24,7 +24,7 @@
extern "C" {
#endif
#include <spa/list.h>
#include <spa/utils/list.h>
/** \class spa_hook
*

View file

@ -24,8 +24,6 @@
extern "C" {
#endif
#include <spa/defs.h>
struct spa_list {
struct spa_list *next;
struct spa_list *prev;

View file

@ -30,7 +30,7 @@ struct spa_ringbuffer;
#include <string.h>
#include <spa/defs.h>
#include <spa/utils/defs.h>
/**
* spa_ringbuffer:

View file

@ -24,7 +24,7 @@
extern "C" {
#endif
#include <spa/defs.h>
#include <spa/utils/defs.h>
#define SPA_TYPE_BASE "Spa:"