Remove dynamic types

Do not use dynamic types anymore. The reason is that it's difficult:

- to maintain a shared type database over a network.
- the extra overhead when translating between processes and for
  maintaining the translation tables.
- race conditions in translating in RT-threads, this is a problem
  because we want to make event streams.

We now have simple enums with types and extension points for all
types. This is also nicer to use in general.
We don't need the mapper anymore or pass strings around as types.
There is a parallel type info system to get more info about ids and
enums and their hierarchy. It can also be used for debugging.
This commit is contained in:
Wim Taymans 2018-08-23 17:47:57 +02:00
parent e6977fa178
commit fca3e1d85d
162 changed files with 5200 additions and 7461 deletions

View file

@ -0,0 +1,52 @@
/* 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_BUFFER_TYPES_H__
#define __SPA_BUFFER_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/buffer/buffer.h>
#include <spa/utils/type-info.h>
#define SPA_TYPE__Buffer SPA_TYPE_POINTER_BASE "Buffer"
#define SPA_TYPE_BUFFER_BASE SPA_TYPE__Buffer ":"
/** Buffers contain data of a certain type */
#define SPA_TYPE__Data SPA_TYPE_ENUM_BASE "Data"
#define SPA_TYPE_DATA_BASE SPA_TYPE__Data ":"
/** base type for fd based memory */
#define SPA_TYPE_DATA__Fd SPA_TYPE_DATA_BASE "Fd"
#define SPA_TYPE_DATA_FD_BASE SPA_TYPE_DATA__Fd ":"
static const struct spa_type_info spa_type_data_type[] = {
{ SPA_DATA_MemPtr, SPA_TYPE_DATA_BASE "MemPtr", SPA_POD_TYPE_INT, },
{ SPA_DATA_MemFd, SPA_TYPE_DATA_FD_BASE "MemFd", SPA_POD_TYPE_INT, },
{ SPA_DATA_DmaBuf, SPA_TYPE_DATA_FD_BASE "DmaBuf", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_BUFFER_TYPES_H__ */

View file

@ -26,46 +26,19 @@ extern "C" {
#include <spa/utils/defs.h>
#include <spa/buffer/meta.h>
#include <spa/support/type-map.h>
/** \page page_buffer Buffers
*
* Buffers describe the data and metadata that is exchanged between
* ports of a node.
*/
#define SPA_TYPE__Buffer SPA_TYPE_POINTER_BASE "Buffer"
#define SPA_TYPE_BUFFER_BASE SPA_TYPE__Buffer ":"
/** Buffers contain data of a certain type */
#define SPA_TYPE__Data SPA_TYPE_ENUM_BASE "DataType"
#define SPA_TYPE_DATA_BASE SPA_TYPE__Data ":"
/** The data type for a plain memory pointer. The data member points to
* the memory. */
#define SPA_TYPE_DATA__MemPtr SPA_TYPE_DATA_BASE "MemPtr"
/** base type for fd based memory */
#define SPA_TYPE_DATA__Fd SPA_TYPE_DATA_BASE "Fd"
#define SPA_TYPE_DATA_FD_BASE SPA_TYPE_DATA__Fd ":"
#define SPA_TYPE_DATA_FD__MemFd SPA_TYPE_DATA_FD_BASE "MemFd"
#define SPA_TYPE_DATA_FD__DmaBuf SPA_TYPE_DATA_FD_BASE "DmaBuf"
struct spa_type_data {
uint32_t MemPtr; /**< system memory */
uint32_t MemFd; /**< memory accesible with an fd */
uint32_t DmaBuf; /**< dmabuf fd */
enum spa_data_type {
SPA_DATA_MemPtr,
SPA_DATA_MemFd,
SPA_DATA_DmaBuf,
};
static inline void spa_type_data_map(struct spa_type_map *map, struct spa_type_data *type)
{
if (type->MemPtr == 0) {
type->MemPtr = spa_type_map_get_id(map, SPA_TYPE_DATA__MemPtr);
type->MemFd = spa_type_map_get_id(map, SPA_TYPE_DATA_FD__MemFd);
type->DmaBuf = spa_type_map_get_id(map, SPA_TYPE_DATA_FD__DmaBuf);
}
}
/** Chunk of memory */
struct spa_chunk {
uint32_t offset; /**< offset of valid data. Should be taken
@ -79,7 +52,7 @@ struct spa_chunk {
/** Data for a buffer */
struct spa_data {
uint32_t type; /**< memory type */
uint32_t type; /**< memory type, one of enum spa_data_type */
uint32_t flags; /**< data flags */
int fd; /**< optional fd for data */
uint32_t mapoffset; /**< offset to map fd at */

View file

@ -0,0 +1,50 @@
/* 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_META_H__
#define __SPA_META_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/utils/type-info.h>
#define SPA_TYPE__Meta SPA_TYPE_POINTER_BASE "Meta"
#define SPA_TYPE_META_BASE SPA_TYPE__Meta ":"
#define SPA_TYPE_META__Region SPA_TYPE_META_BASE "Region"
#define SPA_TYPE_META_REGION_BASE SPA_TYPE_META__Region ":"
#define SPA_TYPE_META__RegionArray SPA_TYPE_META_BASE "RegionArray"
#define SPA_TYPE_META_REGION_ARRAY_BASE SPA_TYPE_META__RegionArray ":"
static const struct spa_type_info spa_type_meta_type[] = {
{ SPA_META_Header, SPA_TYPE_META_BASE "Header", SPA_POD_TYPE_INT, },
{ SPA_META_VideoCrop, SPA_TYPE_META_REGION_BASE "VideoCrop", SPA_POD_TYPE_INT, },
{ SPA_META_VideoDamage, SPA_TYPE_META_REGION_ARRAY_BASE "VideoDamage", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_META_H__ */

View file

@ -25,24 +25,16 @@ extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/support/type-map.h>
/** \page page_meta Metadata
*
* Metadata contains extra information on a buffer.
*/
#define SPA_TYPE__Meta SPA_TYPE_POINTER_BASE "Meta"
#define SPA_TYPE_META_BASE SPA_TYPE__Meta ":"
#define SPA_TYPE_META__Header SPA_TYPE_META_BASE "Header"
#define SPA_TYPE_META__Region SPA_TYPE_META_BASE "Region"
#define SPA_TYPE_META_REGION_BASE SPA_TYPE_META__Region ":"
#define SPA_TYPE_META__RegionArray SPA_TYPE_META_BASE "RegionArray"
#define SPA_TYPE_META_REGION_ARRAY_BASE SPA_TYPE_META__RegionArray ":"
#define SPA_TYPE_META__VideoCrop SPA_TYPE_META_REGION_BASE "VideoCrop"
#define SPA_TYPE_META__VideoDamage SPA_TYPE_META_REGION_ARRAY_BASE "VideoDamage"
enum spa_meta_type {
SPA_META_Header,
SPA_META_VideoCrop,
SPA_META_VideoDamage,
};
/**
* A metadata element.
@ -52,7 +44,7 @@ extern "C" {
* itself.
*/
struct spa_meta {
uint32_t type; /**< metadata type */
uint32_t type; /**< metadata type, one of enum spa_meta_type */
void *data; /**< pointer to metadata */
uint32_t size; /**< size of metadata */
};
@ -91,21 +83,6 @@ struct spa_meta_region {
spa_meta_check(pos, meta); \
(pos)++)
struct spa_type_meta {
uint32_t Header;
uint32_t VideoCrop;
uint32_t VideoDamage;
};
static inline void spa_type_meta_map(struct spa_type_map *map, struct spa_type_meta *type)
{
if (type->Header == 0) {
type->Header = spa_type_map_get_id(map, SPA_TYPE_META__Header);
type->VideoCrop = spa_type_map_get_id(map, SPA_TYPE_META__VideoCrop);
type->VideoDamage = spa_type_map_get_id(map, SPA_TYPE_META__VideoDamage);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -24,15 +24,14 @@
extern "C" {
#endif
#include <spa/support/type-map.h>
#include <spa/debug/debug-mem.h>
#include <spa/buffer/buffer-types.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)
static inline int spa_debug_buffer(int indent, const struct spa_buffer *buffer)
{
int i;
@ -43,25 +42,33 @@ static inline int spa_debug_buffer(int indent,
struct spa_meta *m = &buffer->metas[i];
const char *type_name;
type_name = spa_type_map_get_type(map, m->type);
type_name = spa_debug_type_find_name(spa_type_meta_type, 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)) {
switch (m->type) {
case SPA_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)) {
break;
}
case SPA_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 {
break;
}
case SPA_META_VideoDamage:
default:
spa_debug("%*s" " Unknown:", indent, "");
spa_debug_mem(5, m->data, m->size);
}
@ -70,7 +77,7 @@ static inline int spa_debug_buffer(int indent,
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_type_find_name(spa_type_data_type, 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);

View file

@ -24,11 +24,13 @@
extern "C" {
#endif
#include <spa/support/type-map.h>
#include <spa/pod/parser.h>
#include <spa/debug/types.h>
#include <spa/param/format-types.h>
#include <spa/param/audio/format-types.h>
static inline int
spa_debug_format_value(struct spa_type_map *map,
spa_debug_format_value(const struct spa_type_info *info,
uint32_t type, void *body, uint32_t size)
{
switch (type) {
@ -36,21 +38,21 @@ spa_debug_format_value(struct spa_type_map *map,
fprintf(stderr, "%s", *(int32_t *) body ? "true" : "false");
break;
case SPA_POD_TYPE_ID:
case SPA_POD_TYPE_INT:
{
const char *str = map ? spa_type_map_get_type(map, *(int32_t *) body) : NULL;
const char *str = spa_debug_type_find_name(info, *(int32_t *) body);
char tmp[64];
if (str) {
const char *h = rindex(str, ':');
if (h)
str = h + 1;
} else {
str = "unknown";
snprintf(tmp, sizeof(tmp), "%d", *(int32_t*)body);
str = tmp;
}
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;
@ -88,7 +90,7 @@ spa_debug_format_value(struct spa_type_map *map,
}
static inline int spa_debug_format(int indent,
struct spa_type_map *map, const struct spa_pod *format)
const struct spa_type_info *info, const struct spa_pod *format)
{
int i;
const char *media_type;
@ -121,19 +123,25 @@ static inline int spa_debug_format(int indent,
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);
media_type = spa_debug_type_find_name(spa_type_media_type, mtype);
media_subtype = spa_debug_type_find_name(spa_type_media_subtype, mstype);
fprintf(stderr, "%-6s %s/%s\n", "", rindex(media_type, ':') + 1,
rindex(media_subtype, ':') + 1);
fprintf(stderr, "%-6s %s/%s\n", "",
media_type ? rindex(media_type, ':') + 1 : "unknown",
media_subtype ? rindex(media_subtype, ':') + 1 : "unknown");
info = spa_type_format_get_ids(mtype, mstype);
SPA_POD_OBJECT_FOREACH((struct spa_pod_object*)format, pod) {
struct spa_pod_prop *prop;
const char *key;
const struct spa_type_info *ti;
if (pod->type != SPA_POD_TYPE_PROP)
continue;
@ -144,13 +152,15 @@ static inline int spa_debug_format(int indent,
(prop->body.flags & SPA_POD_PROP_FLAG_OPTIONAL))
continue;
key = spa_type_map_get_type(map, prop->body.key);
ti = spa_debug_type_find(info, prop->body.key);
key = ti ? ti->name : NULL;
fprintf(stderr, " %20s : (%s) ", rindex(key, ':') + 1,
fprintf(stderr, " %20s : (%s) ",
key ? rindex(key, ':') + 1 : "unknown",
pod_type_names[prop->body.value.type]);
if (!(prop->body.flags & SPA_POD_PROP_FLAG_UNSET)) {
spa_debug_format_value(map,
spa_debug_format_value(ti->values,
prop->body.value.type,
SPA_POD_BODY(&prop->body.value),
prop->body.value.size);
@ -180,7 +190,7 @@ static inline int spa_debug_format(int indent,
SPA_POD_PROP_ALTERNATIVE_FOREACH(&prop->body, prop->pod.size, alt) {
if (i > 0)
fprintf(stderr, "%s", sep);
spa_debug_format_value(map,
spa_debug_format_value(ti->values,
prop->body.value.type,
alt,
prop->body.value.size);

View file

@ -24,8 +24,8 @@
extern "C" {
#endif
#include <spa/support/type-map.h>
#include <spa/debug/mem.h>
#include <spa/debug/types.h>
#include <spa/pod/pod.h>
#include <spa/pod/iter.h>
@ -34,7 +34,7 @@ extern "C" {
#endif
static inline int
spa_debug_pod_value(int indent, struct spa_type_map *map,
spa_debug_pod_value(int indent, const struct spa_type_info *info,
uint32_t type, void *body, uint32_t size)
{
switch (type) {
@ -43,7 +43,7 @@ spa_debug_pod_value(int indent, struct spa_type_map *map,
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));
spa_debug_type_find_name(info, *(int32_t *) body));
break;
case SPA_POD_TYPE_INT:
spa_debug("%*s" "Int %d", indent, "", *(int32_t *) body);
@ -67,7 +67,7 @@ spa_debug_pod_value(int indent, struct spa_type_map *map,
{
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);
spa_debug_type_find_name(info, b->type), b->value);
break;
}
case SPA_POD_TYPE_RECTANGLE:
@ -93,7 +93,7 @@ spa_debug_pod_value(int indent, struct spa_type_map *map,
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);
spa_debug_pod_value(indent + 2, info, b->child.type, p, b->child.size);
break;
}
case SPA_POD_TYPE_STRUCT:
@ -101,19 +101,20 @@ spa_debug_pod_value(int indent, struct spa_type_map *map,
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);
spa_debug_pod_value(indent + 2, info, 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;
const struct spa_type_info *ti = spa_debug_type_find(info, b->type);
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_debug_type_find_name(info, b->id), ti ? ti->name : "unknown");
SPA_POD_OBJECT_BODY_FOREACH(b, size, p)
spa_debug_pod_value(indent + 2, map, p->type, SPA_POD_BODY(p), p->size);
spa_debug_pod_value(indent + 2, ti ? ti->values : NULL,
p->type, SPA_POD_BODY(p), p->size);
break;
}
case SPA_POD_TYPE_PROP:
@ -123,12 +124,12 @@ spa_debug_pod_value(int indent, struct spa_type_map *map,
int i;
spa_debug("%*s" "Prop: key %s, flags %d", indent, "",
map ? spa_type_map_get_type(map, b->key) : "*no map*", b->flags);
spa_debug_type_find_name(info, b->key), 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),
spa_debug_pod_value(indent + 4, info, b->value.type, SPA_POD_BODY(&b->value),
b->value.size);
i = 0;
@ -143,7 +144,7 @@ spa_debug_pod_value(int indent, struct spa_type_map *map,
spa_debug("%*s" "Max: ", indent + 2, "");
else
break;
spa_debug_pod_value(indent + 4, map, b->value.type, alt, b->value.size);
spa_debug_pod_value(indent + 4, info, b->value.type, alt, b->value.size);
i++;
}
break;
@ -157,7 +158,7 @@ spa_debug_pod_value(int indent, struct spa_type_map *map,
spa_debug("%*s" "Step: ", indent + 2, "");
else
break;
spa_debug_pod_value(indent + 4, map, b->value.type, alt, b->value.size);
spa_debug_pod_value(indent + 4, info, b->value.type, alt, b->value.size);
i++;
}
break;
@ -166,7 +167,7 @@ spa_debug_pod_value(int indent, struct spa_type_map *map,
if (i == 0) {
spa_debug("%*s" "Enum:", indent + 2, "");
}
spa_debug_pod_value(indent + 4, map, b->value.type, alt, b->value.size);
spa_debug_pod_value(indent + 4, info, b->value.type, alt, b->value.size);
i++;
}
break;
@ -191,9 +192,9 @@ spa_debug_pod_value(int indent, struct spa_type_map *map,
}
static inline int spa_debug_pod(int indent,
struct spa_type_map *map, const struct spa_pod *pod)
const struct spa_type_info *info, const struct spa_pod *pod)
{
return spa_debug_pod_value(indent, map,
return spa_debug_pod_value(indent, info,
SPA_POD_TYPE(pod),
SPA_POD_BODY(pod),
SPA_POD_BODY_SIZE(pod));

View file

@ -0,0 +1,80 @@
/* 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_TYPES_H__
#define __SPA_DEBUG_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/monitor/monitor-types.h>
#include <spa/node/node-types.h>
#include <spa/param/buffers.h>
#include <spa/param/buffers-types.h>
static const struct spa_type_info spa_debug_types[] =
{
{ SPA_ID_INVALID, "", SPA_POD_TYPE_ID, spa_type_monitor },
{ SPA_ID_INVALID, "", SPA_POD_TYPE_ID, spa_type_node },
{ SPA_ID_INVALID, "", SPA_POD_TYPE_ID, spa_type_param_buffers },
{ 0, NULL, },
};
static inline const struct spa_type_info *spa_debug_type_find(const struct spa_type_info *info, uint32_t id)
{
const struct spa_type_info *res;
while (info && info->name) {
if (info->id == SPA_ID_INVALID)
if ((res = spa_debug_type_find(info->values, id)))
return res;
if (info->id == id)
return info;
info++;
}
return NULL;
}
static inline const char *spa_debug_type_find_name(const struct spa_type_info *info, uint32_t id)
{
const struct spa_type_info *type;
if ((type = spa_debug_type_find(info, id)) == NULL)
return NULL;
return type->name;
}
static inline uint32_t spa_debug_type_find_id(const struct spa_type_info *info, const char *name)
{
while (info && info->name) {
uint32_t res;
if (strcmp(info->name, name) == 0)
return info->id;
if ((res = spa_debug_type_find_id(info->values, name)) != SPA_ID_INVALID)
return res;
info++;
}
return SPA_ID_INVALID;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_DEBUG_NODE_H__ */

View file

@ -37,7 +37,6 @@ spa_param_headers = [
'param/meta.h',
'param/io.h',
'param/format.h',
'param/format-utils.h',
]
install_headers(spa_param_headers,
@ -60,8 +59,6 @@ spa_support_headers = [
'support/log-impl.h',
'support/loop.h',
'support/plugin.h',
'support/type-map.h',
'support/type-map-impl.h',
]
install_headers(spa_support_headers,
@ -83,7 +80,6 @@ spa_audio_headers = [
'param/audio/format.h',
'param/audio/format-utils.h',
'param/audio/raw.h',
'param/audio/raw-utils.h',
]
install_headers(spa_audio_headers,
@ -97,7 +93,6 @@ spa_video_headers = [
'param/video/format-utils.h',
'param/video/multiview.h',
'param/video/raw.h',
'param/video/raw-utils.h',
]
install_headers(spa_video_headers,

View file

@ -0,0 +1,86 @@
/* 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_MONITOR_TYPES_H__
#define __SPA_MONITOR_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/type.h>
#include <spa/monitor/monitor.h>
#include <spa/pod/event-types.h>
#define SPA_TYPE_EVENT__Monitor SPA_TYPE_EVENT_BASE "Monitor"
#define SPA_TYPE_EVENT_MONITOR_BASE SPA_TYPE_EVENT__Monitor ":"
#define SPA_TYPE__MonitorItemFlags SPA_TYPE_FLAGS_BASE "MonitorItemFlags"
#define SPA_TYPE_MONITOR_ITEM_FLAGS_BASE SPA_TYPE__MonitorItemFlags ":"
static const struct spa_type_info spa_type_monitor_item_flags[] = {
{ SPA_MONITOR_ITEM_FLAG_NONE, SPA_TYPE_MONITOR_ITEM_FLAGS_BASE "none", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
#define SPA_TYPE__MonitorItemState SPA_TYPE_ENUM_BASE "MonitorItemState"
#define SPA_TYPE_MONITOR_ITEM_STATE_BASE SPA_TYPE__MonitorItemState ":"
static const struct spa_type_info spa_type_monitor_item_state[] = {
{ SPA_MONITOR_ITEM_STATE_AVAILABLE, SPA_TYPE_MONITOR_ITEM_STATE_BASE "available", SPA_POD_TYPE_INT, },
{ SPA_MONITOR_ITEM_STATE_DISABLED, SPA_TYPE_MONITOR_ITEM_STATE_BASE "disabled", SPA_POD_TYPE_INT, },
{ SPA_MONITOR_ITEM_STATE_UNAVAILABLE, SPA_TYPE_MONITOR_ITEM_STATE_BASE "unavailable", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
#define SPA_TYPE__MonitorItem SPA_TYPE_POD_OBJECT_BASE "MonitorItem"
#define SPA_TYPE_MONITOR_ITEM_BASE SPA_TYPE__MonitorItem ":"
static const struct spa_type_info spa_type_monitor_item_ids[] = {
{ SPA_MONITOR_ITEM_id, SPA_TYPE_MONITOR_ITEM_BASE "id", SPA_POD_TYPE_STRING, },
{ SPA_MONITOR_ITEM_flags, SPA_TYPE_MONITOR_ITEM_BASE "flags", SPA_POD_TYPE_INT,
spa_type_monitor_item_flags },
{ SPA_MONITOR_ITEM_state, SPA_TYPE_MONITOR_ITEM_BASE "state", SPA_POD_TYPE_INT,
spa_type_monitor_item_state },
{ SPA_MONITOR_ITEM_name, SPA_TYPE_MONITOR_ITEM_BASE "name", SPA_POD_TYPE_STRING, },
{ SPA_MONITOR_ITEM_class, SPA_TYPE_MONITOR_ITEM_BASE "class", SPA_POD_TYPE_STRING, },
{ SPA_MONITOR_ITEM_info, SPA_TYPE_MONITOR_ITEM_BASE "info", SPA_POD_TYPE_POD, },
{ SPA_MONITOR_ITEM_factory, SPA_TYPE_MONITOR_ITEM_BASE "factory", SPA_POD_TYPE_POINTER, },
{ 0, NULL, },
};
#define SPA_TYPE__Monitor SPA_TYPE_INTERFACE_BASE "Monitor"
#define SPA_TYPE_MONITOR_BASE SPA_TYPE__Monitor ":"
static const struct spa_type_info spa_type_monitor[] = {
{ SPA_ID_INTERFACE_Monitor, SPA_TYPE__Monitor, SPA_POD_TYPE_ID, },
{ SPA_ID_EVENT_MONITOR_Added, SPA_TYPE_EVENT_MONITOR_BASE "Added", SPA_POD_TYPE_ID, },
{ SPA_ID_EVENT_MONITOR_Removed, SPA_TYPE_EVENT_MONITOR_BASE "Removed", SPA_POD_TYPE_ID, },
{ SPA_ID_EVENT_MONITOR_Changed, SPA_TYPE_EVENT_MONITOR_BASE "Changed", SPA_POD_TYPE_ID, },
{ SPA_ID_OBJECT_MonitorItem, SPA_TYPE__MonitorItem, SPA_POD_TYPE_OBJECT,
spa_type_monitor_item_ids},
{ 0, NULL, },
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_MONITOR_TYPES_H__ */

View file

@ -25,68 +25,23 @@ extern "C" {
#endif
struct spa_monitor;
#define SPA_TYPE__Monitor SPA_TYPE_INTERFACE_BASE "Monitor"
#define SPA_TYPE_MONITOR_BASE SPA_TYPE__Monitor ":"
#include <spa/utils/defs.h>
#include <spa/utils/dict.h>
#include <spa/pod/event.h>
#include <spa/pod/builder.h>
#define SPA_TYPE_EVENT__Monitor SPA_TYPE_EVENT_BASE "Monitor"
#define SPA_TYPE_EVENT_MONITOR_BASE SPA_TYPE_EVENT__Monitor ":"
#define SPA_TYPE_EVENT_MONITOR__Added SPA_TYPE_EVENT_MONITOR_BASE "Added"
#define SPA_TYPE_EVENT_MONITOR__Removed SPA_TYPE_EVENT_MONITOR_BASE "Removed"
#define SPA_TYPE_EVENT_MONITOR__Changed SPA_TYPE_EVENT_MONITOR_BASE "Changed"
#define SPA_TYPE__MonitorItem SPA_TYPE_POD_OBJECT_BASE "MonitorItem"
#define SPA_TYPE_MONITOR_ITEM_BASE SPA_TYPE__MonitorItem ":"
#define SPA_TYPE_MONITOR_ITEM__id SPA_TYPE_MONITOR_ITEM_BASE "id"
#define SPA_TYPE_MONITOR_ITEM__flags SPA_TYPE_MONITOR_ITEM_BASE "flags"
#define SPA_TYPE_MONITOR_ITEM__state SPA_TYPE_MONITOR_ITEM_BASE "state"
#define SPA_TYPE_MONITOR_ITEM__name SPA_TYPE_MONITOR_ITEM_BASE "name"
#define SPA_TYPE_MONITOR_ITEM__class SPA_TYPE_MONITOR_ITEM_BASE "class"
#define SPA_TYPE_MONITOR_ITEM__info SPA_TYPE_MONITOR_ITEM_BASE "info"
#define SPA_TYPE_MONITOR_ITEM__factory SPA_TYPE_MONITOR_ITEM_BASE "factory"
struct spa_type_monitor {
uint32_t Monitor; /*< the monitor object */
uint32_t Added; /*< item added event */
uint32_t Removed; /*< item removed event */
uint32_t Changed; /*< item changed event */
uint32_t MonitorItem; /*< monitor item object */
uint32_t id; /*< item id property */
uint32_t flags; /*< item flags property */
uint32_t state; /*< item state property */
uint32_t name; /*< item name property */
uint32_t klass; /*< item klass property */
uint32_t info; /*< item info property */
uint32_t factory; /*< item factory property */
/** properties for SPA_ID_OBJECT_MonitorItem */
enum spa_monitor_item {
SPA_MONITOR_ITEM_id,
SPA_MONITOR_ITEM_flags,
SPA_MONITOR_ITEM_state,
SPA_MONITOR_ITEM_name,
SPA_MONITOR_ITEM_class,
SPA_MONITOR_ITEM_info,
SPA_MONITOR_ITEM_factory,
};
static inline void spa_type_monitor_map(struct spa_type_map *map, struct spa_type_monitor *type)
{
if (type->Monitor == 0) {
type->Monitor = spa_type_map_get_id(map, SPA_TYPE__Monitor);
type->Added = spa_type_map_get_id(map, SPA_TYPE_EVENT_MONITOR__Added);
type->Removed = spa_type_map_get_id(map, SPA_TYPE_EVENT_MONITOR__Removed);
type->Changed = spa_type_map_get_id(map, SPA_TYPE_EVENT_MONITOR__Changed);
type->MonitorItem = spa_type_map_get_id(map, SPA_TYPE__MonitorItem);
type->id = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__id);
type->flags = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__flags);
type->state = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__state);
type->name = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__name);
type->klass = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__class);
type->info = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__info);
type->factory = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__factory);
}
}
enum spa_monitor_item_flags {
SPA_MONITOR_ITEM_FLAG_NONE = 0,
};

View file

@ -0,0 +1,55 @@
/* 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_COMMAND_NODE_TYPES_H__
#define __SPA_COMMAND_NODE_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/type-info.h>
#include <spa/node/command.h>
#define SPA_TYPE_COMMAND__Node SPA_TYPE_COMMAND_BASE "Node"
#define SPA_TYPE_COMMAND_NODE_BASE SPA_TYPE_COMMAND__Node ":"
/** Suspend a node. This will release all resources of the node */
#define SPA_TYPE_COMMAND_NODE__Suspend SPA_TYPE_COMMAND_NODE_BASE "Suspend"
/** Pause processing of a node */
#define SPA_TYPE_COMMAND_NODE__Pause SPA_TYPE_COMMAND_NODE_BASE "Pause"
/** Start processing of a node */
#define SPA_TYPE_COMMAND_NODE__Start SPA_TYPE_COMMAND_NODE_BASE "Start"
/** Enable ports of a node. When sent to a port, enables just that port. Enabled
* ports on a Started node begin streaming immediately */
#define SPA_TYPE_COMMAND_NODE__Enable SPA_TYPE_COMMAND_NODE_BASE "Enable"
/** Disable ports of a node. When sent to a port, disables just that port. */
#define SPA_TYPE_COMMAND_NODE__Disable SPA_TYPE_COMMAND_NODE_BASE "Disable"
/** Flush all data from the node or port */
#define SPA_TYPE_COMMAND_NODE__Flush SPA_TYPE_COMMAND_NODE_BASE "Flush"
/** Drain all data from the node or port */
#define SPA_TYPE_COMMAND_NODE__Drain SPA_TYPE_COMMAND_NODE_BASE "Drain"
/** Set a marker on a node or port */
#define SPA_TYPE_COMMAND_NODE__Marker SPA_TYPE_COMMAND_NODE_BASE "Marker"
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _SPA_COMMAND_NODE_TYPES_H__ */

View file

@ -24,56 +24,8 @@
extern "C" {
#endif
#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 ":"
/** Suspend a node. This will release all resources of the node */
#define SPA_TYPE_COMMAND_NODE__Suspend SPA_TYPE_COMMAND_NODE_BASE "Suspend"
/** Pause processing of a node */
#define SPA_TYPE_COMMAND_NODE__Pause SPA_TYPE_COMMAND_NODE_BASE "Pause"
/** Start processing of a node */
#define SPA_TYPE_COMMAND_NODE__Start SPA_TYPE_COMMAND_NODE_BASE "Start"
/** Enable ports of a node. When sent to a port, enables just that port. Enabled
* ports on a Started node begin streaming immediately */
#define SPA_TYPE_COMMAND_NODE__Enable SPA_TYPE_COMMAND_NODE_BASE "Enable"
/** Disable ports of a node. When sent to a port, disables just that port. */
#define SPA_TYPE_COMMAND_NODE__Disable SPA_TYPE_COMMAND_NODE_BASE "Disable"
/** Flush all data from the node or port */
#define SPA_TYPE_COMMAND_NODE__Flush SPA_TYPE_COMMAND_NODE_BASE "Flush"
/** Drain all data from the node or port */
#define SPA_TYPE_COMMAND_NODE__Drain SPA_TYPE_COMMAND_NODE_BASE "Drain"
/** Set a marker on a node or port */
#define SPA_TYPE_COMMAND_NODE__Marker SPA_TYPE_COMMAND_NODE_BASE "Marker"
struct spa_type_command_node {
uint32_t Suspend;
uint32_t Pause;
uint32_t Start;
uint32_t Enable;
uint32_t Disable;
uint32_t Flush;
uint32_t Drain;
uint32_t Marker;
};
static inline void
spa_type_command_node_map(struct spa_type_map *map, struct spa_type_command_node *type)
{
if (type->Suspend == 0) {
type->Suspend = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Suspend);
type->Pause = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Pause);
type->Start = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Start);
type->Enable = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Enable);
type->Disable = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Disable);
type->Flush = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Flush);
type->Drain = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Drain);
type->Marker = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Marker);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -0,0 +1,41 @@
/* 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_EVENT_NODE_TYPES_H__
#define __SPA_EVENT_NODE_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/type-info.h>
#include <spa/node/event.h>
#define SPA_TYPE_EVENT__Node SPA_TYPE_EVENT_BASE "Node"
#define SPA_TYPE_EVENT_NODE_BASE SPA_TYPE_EVENT__Node ":"
#define SPA_TYPE_EVENT_NODE__Error SPA_TYPE_EVENT_NODE_BASE "Error"
#define SPA_TYPE_EVENT_NODE__Buffering SPA_TYPE_EVENT_NODE_BASE "Buffering"
#define SPA_TYPE_EVENT_NODE__RequestRefresh SPA_TYPE_EVENT_NODE_BASE "RequestRefresh"
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_EVENT_NODE_TYPES_H__ */

View file

@ -26,32 +26,8 @@ extern "C" {
#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 ":"
#define SPA_TYPE_EVENT_NODE__Error SPA_TYPE_EVENT_NODE_BASE "Error"
#define SPA_TYPE_EVENT_NODE__Buffering SPA_TYPE_EVENT_NODE_BASE "Buffering"
#define SPA_TYPE_EVENT_NODE__RequestRefresh SPA_TYPE_EVENT_NODE_BASE "RequestRefresh"
struct spa_type_event_node {
uint32_t Error;
uint32_t Buffering;
uint32_t RequestRefresh;
};
static inline void
spa_type_event_node_map(struct spa_type_map *map, struct spa_type_event_node *type)
{
if (type->Error == 0) {
type->Error = spa_type_map_get_id(map, SPA_TYPE_EVENT_NODE__Error);
type->Buffering = spa_type_map_get_id(map, SPA_TYPE_EVENT_NODE__Buffering);
type->RequestRefresh = spa_type_map_get_id(map, SPA_TYPE_EVENT_NODE__RequestRefresh);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -0,0 +1,51 @@
/* 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_IO_TYPES_H__
#define __SPA_IO_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/type-info.h>
#include <spa/node/io.h>
/** Base for IO structures to interface with node ports */
#define SPA_TYPE__IO SPA_TYPE_POINTER_BASE "IO"
#define SPA_TYPE_IO_BASE SPA_TYPE__IO ":"
/** Base for control structures */
#define SPA_TYPE_IO__Control SPA_TYPE_IO_BASE "Control"
#define SPA_TYPE_IO_CONTROL_BASE SPA_TYPE_IO__Control ":"
/** An io area to exchange buffers with a port */
#define SPA_TYPE_IO__Buffers SPA_TYPE_IO_BASE "Buffers"
/** IO area with clock information */
#define SPA_TYPE_IO__Clock SPA_TYPE_IO_BASE "Clock"
/** IO area with latency information */
#define SPA_TYPE_IO__Latency SPA_TYPE_IO_BASE "Latency"
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_IO_TYPES_H__ */

View file

@ -24,34 +24,14 @@
extern "C" {
#endif
#include <spa/support/type-map.h>
/** Base for IO structures to interface with node ports */
#define SPA_TYPE__IO SPA_TYPE_POINTER_BASE "IO"
#define SPA_TYPE_IO_BASE SPA_TYPE__IO ":"
/** Base for control structures */
#define SPA_TYPE_IO__Control SPA_TYPE_IO_BASE "Control"
#define SPA_TYPE_IO_CONTROL_BASE SPA_TYPE_IO__Control ":"
/** Base for controlable properties */
#define SPA_TYPE_IO__Prop SPA_TYPE_IO_BASE "Prop"
#define SPA_TYPE_IO_PROP_BASE SPA_TYPE_IO__Prop ":"
/** An io area to exchange buffers with a port */
#define SPA_TYPE_IO__Buffers SPA_TYPE_IO_BASE "Buffers"
/** IO area with clock information */
#define SPA_TYPE_IO__Clock SPA_TYPE_IO_BASE "Clock"
/** IO area with latency information */
#define SPA_TYPE_IO__Latency SPA_TYPE_IO_BASE "Latency"
#include <spa/utils/defs.h>
/** Buffers IO area
*
* IO information for a port on a node. This is allocated
* by the host and configured on all ports for which IO is requested.
*/
struct spa_io_buffers {
#define SPA_STATUS_OK 0
#define SPA_STATUS_NEED_BUFFER (1<<0)
@ -65,9 +45,6 @@ struct spa_io_buffers {
#define SPA_IO_BUFFERS_INIT (struct spa_io_buffers) { SPA_STATUS_OK, SPA_ID_INVALID, }
/** Information about requested range */
#define SPA_TYPE_IO_CONTROL__Range SPA_TYPE_IO_CONTROL_BASE "Range"
/** A range, suitable for input ports that can suggest a range to output ports */
struct spa_io_control_range {
uint64_t offset; /**< offset in range */
@ -92,25 +69,6 @@ struct spa_io_latency {
uint64_t max; /**< max latency */
};
struct spa_type_io {
uint32_t Buffers;
uint32_t ControlRange;
uint32_t Prop;
uint32_t Clock;
uint32_t Latency;
};
static inline void spa_type_io_map(struct spa_type_map *map, struct spa_type_io *type)
{
if (type->Buffers == 0) {
type->Buffers = spa_type_map_get_id(map, SPA_TYPE_IO__Buffers);
type->ControlRange = spa_type_map_get_id(map, SPA_TYPE_IO_CONTROL__Range);
type->Prop = spa_type_map_get_id(map, SPA_TYPE_IO__Prop);
type->Clock = spa_type_map_get_id(map, SPA_TYPE_IO__Clock);
type->Latency = spa_type_map_get_id(map, SPA_TYPE_IO__Latency);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -0,0 +1,42 @@
/* 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_NODE_TYPES_H__
#define __SPA_NODE_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/type-info.h>
#include <spa/node/node.h>
#define SPA_TYPE__Node SPA_TYPE_INTERFACE_BASE "Node"
#define SPA_TYPE_NODE_BASE SPA_TYPE__Node ":"
static const struct spa_type_info spa_type_node[] = {
{ SPA_ID_INTERFACE_Node, SPA_TYPE__Node, SPA_POD_TYPE_ID, },
{ 0, NULL, },
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_NODE_TYPES_H__ */

View file

@ -24,12 +24,10 @@
extern "C" {
#endif
#define SPA_TYPE__Node SPA_TYPE_INTERFACE_BASE "Node"
#define SPA_TYPE_NODE_BASE SPA_TYPE__Node ":"
struct spa_node;
#include <spa/utils/defs.h>
#include <spa/utils/type.h>
#include <spa/support/plugin.h>

View file

@ -0,0 +1,50 @@
/* 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_AUDIO_FORMAT_TYPES_H__
#define __SPA_PARAM_AUDIO_FORMAT_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/param/audio/format.h>
#include <spa/param/audio/raw-types.h>
#define SPA_TYPE__FormatAudio SPA_TYPE_FORMAT_BASE "Audio"
#define SPA_TYPE_FORMAT_AUDIO_BASE SPA_TYPE__FormatAudio ":"
static const struct spa_type_info spa_type_format_audio_ids[] = {
{ SPA_FORMAT_AUDIO_format, SPA_TYPE_FORMAT_AUDIO_BASE "format", SPA_POD_TYPE_INT,
spa_type_audio_format },
{ SPA_FORMAT_AUDIO_flags, SPA_TYPE_FORMAT_AUDIO_BASE "flags", SPA_POD_TYPE_INT,
spa_type_audio_flags },
{ SPA_FORMAT_AUDIO_layout, SPA_TYPE_FORMAT_AUDIO_BASE "layout", SPA_POD_TYPE_INT,
spa_type_audio_layout },
{ SPA_FORMAT_AUDIO_rate, SPA_TYPE_FORMAT_AUDIO_BASE "rate", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_AUDIO_channels, SPA_TYPE_FORMAT_AUDIO_BASE "channels", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_AUDIO_channelMask, SPA_TYPE_FORMAT_AUDIO_BASE "channelMask", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_AUDIO_FORMAT_TYPES_H */

View file

@ -24,43 +24,32 @@
extern "C" {
#endif
#include <spa/param/format-utils.h>
#include <spa/pod/parser.h>
#include <spa/param/audio/format.h>
#include <spa/param/audio/raw-utils.h>
struct spa_type_format_audio {
uint32_t format;
uint32_t flags;
uint32_t layout;
uint32_t rate;
uint32_t channels;
uint32_t channel_mask;
};
#if 0
#define SPA_TYPE_FORMAT__Audio SPA_TYPE_FORMAT_BASE "Audio"
#define SPA_TYPE_FORMAT_AUDIO_BASE SPA_TYPE_FORMAT__Audio ":"
static inline void
spa_type_format_audio_map(struct spa_type_map *map, struct spa_type_format_audio *type)
{
if (type->format == 0) {
type->format = spa_type_map_get_id(map, SPA_TYPE_FORMAT_AUDIO__format);
type->flags = spa_type_map_get_id(map, SPA_TYPE_FORMAT_AUDIO__flags);
type->layout = spa_type_map_get_id(map, SPA_TYPE_FORMAT_AUDIO__layout);
type->rate = spa_type_map_get_id(map, SPA_TYPE_FORMAT_AUDIO__rate);
type->channels = spa_type_map_get_id(map, SPA_TYPE_FORMAT_AUDIO__channels);
type->channel_mask = spa_type_map_get_id(map, SPA_TYPE_FORMAT_AUDIO__channelMask);
}
}
#define SPA_TYPE_FORMAT_AUDIO__format SPA_TYPE_FORMAT_AUDIO_BASE "format"
#define SPA_TYPE_FORMAT_AUDIO__flags SPA_TYPE_FORMAT_AUDIO_BASE "flags"
#define SPA_TYPE_FORMAT_AUDIO__layout SPA_TYPE_FORMAT_AUDIO_BASE "layout"
#define SPA_TYPE_FORMAT_AUDIO__rate SPA_TYPE_FORMAT_AUDIO_BASE "rate"
#define SPA_TYPE_FORMAT_AUDIO__channels SPA_TYPE_FORMAT_AUDIO_BASE "channels"
#define SPA_TYPE_FORMAT_AUDIO__channelMask SPA_TYPE_FORMAT_AUDIO_BASE "channel-mask"
#endif
static inline int
spa_format_audio_raw_parse(const struct spa_pod *format,
struct spa_audio_info_raw *info, struct spa_type_format_audio *type)
spa_format_audio_raw_parse(const struct spa_pod *format, struct spa_audio_info_raw *info)
{
return spa_pod_object_parse(format,
":",type->format, "I", &info->format,
":",type->layout, "i", &info->layout,
":",type->rate, "i", &info->rate,
":",type->channels, "i", &info->channels,
":",type->flags, "?i", &info->flags,
":",type->channel_mask, "?i", &info->channel_mask, NULL);
":", SPA_FORMAT_AUDIO_format, "I", &info->format,
":", SPA_FORMAT_AUDIO_layout, "i", &info->layout,
":", SPA_FORMAT_AUDIO_rate, "i", &info->rate,
":", SPA_FORMAT_AUDIO_channels, "i", &info->channels,
":", SPA_FORMAT_AUDIO_flags, "?i", &info->flags,
":", SPA_FORMAT_AUDIO_channelMask, "?i", &info->channel_mask, NULL);
}
#ifdef __cplusplus

View file

@ -27,15 +27,15 @@ extern "C" {
#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 ":"
#define SPA_TYPE_FORMAT_AUDIO__format SPA_TYPE_FORMAT_AUDIO_BASE "format"
#define SPA_TYPE_FORMAT_AUDIO__flags SPA_TYPE_FORMAT_AUDIO_BASE "flags"
#define SPA_TYPE_FORMAT_AUDIO__layout SPA_TYPE_FORMAT_AUDIO_BASE "layout"
#define SPA_TYPE_FORMAT_AUDIO__rate SPA_TYPE_FORMAT_AUDIO_BASE "rate"
#define SPA_TYPE_FORMAT_AUDIO__channels SPA_TYPE_FORMAT_AUDIO_BASE "channels"
#define SPA_TYPE_FORMAT_AUDIO__channelMask SPA_TYPE_FORMAT_AUDIO_BASE "channel-mask"
/** properties for audio SPA_ID_OBJECT_Format */
enum spa_format_audio {
SPA_FORMAT_AUDIO_format,
SPA_FORMAT_AUDIO_flags,
SPA_FORMAT_AUDIO_layout,
SPA_FORMAT_AUDIO_rate,
SPA_FORMAT_AUDIO_channels,
SPA_FORMAT_AUDIO_channelMask,
};
struct spa_audio_info {
uint32_t media_type;

View file

@ -0,0 +1,90 @@
/* 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_AUDIO_RAW_TYPES_H__
#define __SPA_AUDIO_RAW_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/param/audio/raw.h>
#define SPA_TYPE__AudioFormat SPA_TYPE_ENUM_BASE "AudioFormat"
#define SPA_TYPE_AUDIO_FORMAT_BASE SPA_TYPE__AudioFormat ":"
static const struct spa_type_info spa_type_audio_format[] = {
{ SPA_AUDIO_FORMAT_UNKNOWN, SPA_TYPE_AUDIO_FORMAT_BASE "UNKNOWN", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_ENCODED, SPA_TYPE_AUDIO_FORMAT_BASE "ENCODED", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S8, SPA_TYPE_AUDIO_FORMAT_BASE "S8", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U8, SPA_TYPE_AUDIO_FORMAT_BASE "U8", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S16_LE, SPA_TYPE_AUDIO_FORMAT_BASE "S16LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S16_BE, SPA_TYPE_AUDIO_FORMAT_BASE "S16BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U16_LE, SPA_TYPE_AUDIO_FORMAT_BASE "U16LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U16_BE, SPA_TYPE_AUDIO_FORMAT_BASE "U16BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S24_32_LE, SPA_TYPE_AUDIO_FORMAT_BASE "S24_32LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S24_32_BE, SPA_TYPE_AUDIO_FORMAT_BASE "S24_32BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U24_32_LE, SPA_TYPE_AUDIO_FORMAT_BASE "U24_32LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U24_32_BE, SPA_TYPE_AUDIO_FORMAT_BASE "U24_32BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S32_LE, SPA_TYPE_AUDIO_FORMAT_BASE "S32LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S32_BE, SPA_TYPE_AUDIO_FORMAT_BASE "S32BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U32_LE, SPA_TYPE_AUDIO_FORMAT_BASE "U32LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U32_BE, SPA_TYPE_AUDIO_FORMAT_BASE "U32BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S24_LE, SPA_TYPE_AUDIO_FORMAT_BASE "S24LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S24_BE, SPA_TYPE_AUDIO_FORMAT_BASE "S24BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U24_LE, SPA_TYPE_AUDIO_FORMAT_BASE "U24LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U24_BE, SPA_TYPE_AUDIO_FORMAT_BASE "U24BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S20_LE, SPA_TYPE_AUDIO_FORMAT_BASE "S20LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S20_BE, SPA_TYPE_AUDIO_FORMAT_BASE "S20BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U20_LE, SPA_TYPE_AUDIO_FORMAT_BASE "U20LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U20_BE, SPA_TYPE_AUDIO_FORMAT_BASE "U20BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S18_LE, SPA_TYPE_AUDIO_FORMAT_BASE "S18LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_S18_BE, SPA_TYPE_AUDIO_FORMAT_BASE "S18BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U18_LE, SPA_TYPE_AUDIO_FORMAT_BASE "U18LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_U18_BE, SPA_TYPE_AUDIO_FORMAT_BASE "U18BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_F32_LE, SPA_TYPE_AUDIO_FORMAT_BASE "F32LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_F32_BE, SPA_TYPE_AUDIO_FORMAT_BASE "F32BE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_F64_LE, SPA_TYPE_AUDIO_FORMAT_BASE "F64LE", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FORMAT_F64_BE, SPA_TYPE_AUDIO_FORMAT_BASE "F64BE", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
#define SPA_TYPE__AudioFlags SPA_TYPE_FLAGS_BASE "AudioFlags"
#define SPA_TYPE_AUDIO_FLAGS_BASE SPA_TYPE__AudioFlags ":"
static const struct spa_type_info spa_type_audio_flags[] = {
{ SPA_AUDIO_FLAG_NONE, SPA_TYPE_AUDIO_FLAGS_BASE "none", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_FLAG_UNPOSITIONED, SPA_TYPE_AUDIO_FLAGS_BASE "unpositioned", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
#define SPA_TYPE__AudioLayout SPA_TYPE_ENUM_BASE "AudioLayout"
#define SPA_TYPE_AUDIO_ENUM_BASE SPA_TYPE__AudioLayout ":"
static const struct spa_type_info spa_type_audio_layout[] = {
{ SPA_AUDIO_LAYOUT_INTERLEAVED, SPA_TYPE_AUDIO_ENUM_BASE "interleaved", SPA_POD_TYPE_INT, },
{ SPA_AUDIO_LAYOUT_NON_INTERLEAVED, SPA_TYPE_AUDIO_ENUM_BASE "non-interleaved", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_AUDIO_RAW_TYPES_H__ */

View file

@ -1,119 +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_AUDIO_RAW_UTILS_H__
#define __SPA_AUDIO_RAW_UTILS_H__
#ifdef __cplusplus
extern "C" {
#endif
#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"
#define _SPA_TYPE_AUDIO_FORMAT_OE(fmt) SPA_TYPE_AUDIO_FORMAT_BASE fmt "LE"
#elif __BYTE_ORDER == __LITTLE_ENDIAN
#define _SPA_TYPE_AUDIO_FORMAT_NE(fmt) SPA_TYPE_AUDIO_FORMAT_BASE fmt "LE"
#define _SPA_TYPE_AUDIO_FORMAT_OE(fmt) SPA_TYPE_AUDIO_FORMAT_BASE fmt "BE"
#endif
struct spa_type_audio_format {
uint32_t UNKNOWN;
uint32_t ENCODED;
uint32_t S8;
uint32_t U8;
uint32_t S16;
uint32_t U16;
uint32_t S24_32;
uint32_t U24_32;
uint32_t S32;
uint32_t U32;
uint32_t S24;
uint32_t U24;
uint32_t S20;
uint32_t U20;
uint32_t S18;
uint32_t U18;
uint32_t F32;
uint32_t F64;
uint32_t S16_OE;
uint32_t U16_OE;
uint32_t S24_32_OE;
uint32_t U24_32_OE;
uint32_t S32_OE;
uint32_t U32_OE;
uint32_t S24_OE;
uint32_t U24_OE;
uint32_t S20_OE;
uint32_t U20_OE;
uint32_t S18_OE;
uint32_t U18_OE;
uint32_t F32_OE;
uint32_t F64_OE;
};
static inline void
spa_type_audio_format_map(struct spa_type_map *map, struct spa_type_audio_format *type)
{
if (type->ENCODED == 0) {
type->UNKNOWN = 0;
type->ENCODED = spa_type_map_get_id(map, SPA_TYPE_AUDIO_FORMAT__ENCODED);
type->S8 = spa_type_map_get_id(map, SPA_TYPE_AUDIO_FORMAT__S8);
type->U8 = spa_type_map_get_id(map, SPA_TYPE_AUDIO_FORMAT__U8);
type->S16 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("S16"));
type->U16 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("U16"));
type->S24_32 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("S24_32"));
type->U24_32 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("U24_32"));
type->S32 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("S32"));
type->U32 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("U32"));
type->S24 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("S24"));
type->U24 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("U24"));
type->S20 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("S20"));
type->U20 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("U20"));
type->S18 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("S18"));
type->U18 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("U18"));
type->F32 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("F32"));
type->F64 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("F64"));
type->S16_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("S16"));
type->U16_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("U16"));
type->S24_32_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("S24_32"));
type->U24_32_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("U24_32"));
type->S32_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("S32"));
type->U32_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("U32"));
type->S24_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("S24"));
type->U24_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("U24"));
type->S20_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("S20"));
type->U20_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("U20"));
type->S18_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("S18"));
type->U18_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("U18"));
type->F32_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("F32"));
type->F64_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("F64"));
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_AUDIO_RAW_UTILS_H__ */

View file

@ -26,41 +26,100 @@ extern "C" {
#include <endian.h>
#define SPA_TYPE__AudioFormat SPA_TYPE_ENUM_BASE "AudioFormat"
#define SPA_TYPE_AUDIO_FORMAT_BASE SPA_TYPE__AudioFormat ":"
enum spa_audio_format {
SPA_AUDIO_FORMAT_UNKNOWN,
SPA_AUDIO_FORMAT_ENCODED,
SPA_AUDIO_FORMAT_S8,
SPA_AUDIO_FORMAT_U8,
SPA_AUDIO_FORMAT_S16_LE,
SPA_AUDIO_FORMAT_S16_BE,
SPA_AUDIO_FORMAT_U16_LE,
SPA_AUDIO_FORMAT_U16_BE,
SPA_AUDIO_FORMAT_S24_32_LE,
SPA_AUDIO_FORMAT_S24_32_BE,
SPA_AUDIO_FORMAT_U24_32_LE,
SPA_AUDIO_FORMAT_U24_32_BE,
SPA_AUDIO_FORMAT_S32_LE,
SPA_AUDIO_FORMAT_S32_BE,
SPA_AUDIO_FORMAT_U32_LE,
SPA_AUDIO_FORMAT_U32_BE,
SPA_AUDIO_FORMAT_S24_LE,
SPA_AUDIO_FORMAT_S24_BE,
SPA_AUDIO_FORMAT_U24_LE,
SPA_AUDIO_FORMAT_U24_BE,
SPA_AUDIO_FORMAT_S20_LE,
SPA_AUDIO_FORMAT_S20_BE,
SPA_AUDIO_FORMAT_U20_LE,
SPA_AUDIO_FORMAT_U20_BE,
SPA_AUDIO_FORMAT_S18_LE,
SPA_AUDIO_FORMAT_S18_BE,
SPA_AUDIO_FORMAT_U18_LE,
SPA_AUDIO_FORMAT_U18_BE,
SPA_AUDIO_FORMAT_F32_LE,
SPA_AUDIO_FORMAT_F32_BE,
SPA_AUDIO_FORMAT_F64_LE,
SPA_AUDIO_FORMAT_F64_BE,
#define SPA_TYPE_AUDIO_FORMAT__UNKNOWN SPA_TYPE_AUDIO_FORMAT_BASE "UNKNOWN"
#define SPA_TYPE_AUDIO_FORMAT__ENCODED SPA_TYPE_AUDIO_FORMAT_BASE "ENCODED"
#define SPA_TYPE_AUDIO_FORMAT__S8 SPA_TYPE_AUDIO_FORMAT_BASE "S8"
#define SPA_TYPE_AUDIO_FORMAT__U8 SPA_TYPE_AUDIO_FORMAT_BASE "U8"
#define SPA_TYPE_AUDIO_FORMAT__S16LE SPA_TYPE_AUDIO_FORMAT_BASE "S16LE"
#define SPA_TYPE_AUDIO_FORMAT__S16BE SPA_TYPE_AUDIO_FORMAT_BASE "S16BE"
#define SPA_TYPE_AUDIO_FORMAT__U16LE SPA_TYPE_AUDIO_FORMAT_BASE "U16LE"
#define SPA_TYPE_AUDIO_FORMAT__U16BE SPA_TYPE_AUDIO_FORMAT_BASE "U16BE"
#define SPA_TYPE_AUDIO_FORMAT__S24_32LE SPA_TYPE_AUDIO_FORMAT_BASE "S24_32LE"
#define SPA_TYPE_AUDIO_FORMAT__S24_32BE SPA_TYPE_AUDIO_FORMAT_BASE "S24_32BE"
#define SPA_TYPE_AUDIO_FORMAT__U24_32LE SPA_TYPE_AUDIO_FORMAT_BASE "U24_32LE"
#define SPA_TYPE_AUDIO_FORMAT__U24_32BE SPA_TYPE_AUDIO_FORMAT_BASE "U24_32BE"
#define SPA_TYPE_AUDIO_FORMAT__S32LE SPA_TYPE_AUDIO_FORMAT_BASE "S32LE"
#define SPA_TYPE_AUDIO_FORMAT__S32BE SPA_TYPE_AUDIO_FORMAT_BASE "S32BE"
#define SPA_TYPE_AUDIO_FORMAT__U32LE SPA_TYPE_AUDIO_FORMAT_BASE "U32LE"
#define SPA_TYPE_AUDIO_FORMAT__U32BE SPA_TYPE_AUDIO_FORMAT_BASE "U32BE"
#define SPA_TYPE_AUDIO_FORMAT__S24LE SPA_TYPE_AUDIO_FORMAT_BASE "S24LE"
#define SPA_TYPE_AUDIO_FORMAT__S24BE SPA_TYPE_AUDIO_FORMAT_BASE "S24BE"
#define SPA_TYPE_AUDIO_FORMAT__U24LE SPA_TYPE_AUDIO_FORMAT_BASE "U24LE"
#define SPA_TYPE_AUDIO_FORMAT__U24BE SPA_TYPE_AUDIO_FORMAT_BASE "U24BE"
#define SPA_TYPE_AUDIO_FORMAT__S20LE SPA_TYPE_AUDIO_FORMAT_BASE "S20LE"
#define SPA_TYPE_AUDIO_FORMAT__S20BE SPA_TYPE_AUDIO_FORMAT_BASE "S20BE"
#define SPA_TYPE_AUDIO_FORMAT__U20LE SPA_TYPE_AUDIO_FORMAT_BASE "U20LE"
#define SPA_TYPE_AUDIO_FORMAT__U20BE SPA_TYPE_AUDIO_FORMAT_BASE "U20BE"
#define SPA_TYPE_AUDIO_FORMAT__S18LE SPA_TYPE_AUDIO_FORMAT_BASE "S18LE"
#define SPA_TYPE_AUDIO_FORMAT__S18BE SPA_TYPE_AUDIO_FORMAT_BASE "S18BE"
#define SPA_TYPE_AUDIO_FORMAT__U18LE SPA_TYPE_AUDIO_FORMAT_BASE "U18LE"
#define SPA_TYPE_AUDIO_FORMAT__U18BE SPA_TYPE_AUDIO_FORMAT_BASE "U18BE"
#define SPA_TYPE_AUDIO_FORMAT__F32LE SPA_TYPE_AUDIO_FORMAT_BASE "F32LE"
#define SPA_TYPE_AUDIO_FORMAT__F32BE SPA_TYPE_AUDIO_FORMAT_BASE "F32BE"
#define SPA_TYPE_AUDIO_FORMAT__F64LE SPA_TYPE_AUDIO_FORMAT_BASE "F64LE"
#define SPA_TYPE_AUDIO_FORMAT__F64BE SPA_TYPE_AUDIO_FORMAT_BASE "F64BE"
#if __BYTE_ORDER == __BIG_ENDIAN
SPA_AUDIO_FORMAT_S16 = SPA_AUDIO_FORMAT_S16_BE,
SPA_AUDIO_FORMAT_U16 = SPA_AUDIO_FORMAT_U16_BE,
SPA_AUDIO_FORMAT_S24_32 = SPA_AUDIO_FORMAT_S24_32_BE,
SPA_AUDIO_FORMAT_U24_32 = SPA_AUDIO_FORMAT_U24_32_BE,
SPA_AUDIO_FORMAT_S32 = SPA_AUDIO_FORMAT_S32_BE,
SPA_AUDIO_FORMAT_U32 = SPA_AUDIO_FORMAT_U32_BE,
SPA_AUDIO_FORMAT_S24 = SPA_AUDIO_FORMAT_S24_BE,
SPA_AUDIO_FORMAT_U24 = SPA_AUDIO_FORMAT_U24_BE,
SPA_AUDIO_FORMAT_S20 = SPA_AUDIO_FORMAT_S20_BE,
SPA_AUDIO_FORMAT_U20 = SPA_AUDIO_FORMAT_U20_BE,
SPA_AUDIO_FORMAT_S18 = SPA_AUDIO_FORMAT_S18_BE,
SPA_AUDIO_FORMAT_U18 = SPA_AUDIO_FORMAT_U18_BE,
SPA_AUDIO_FORMAT_F32 = SPA_AUDIO_FORMAT_F32_BE,
SPA_AUDIO_FORMAT_F64 = SPA_AUDIO_FORMAT_F64_BE,
SPA_AUDIO_FORMAT_S16_OE = SPA_AUDIO_FORMAT_S16_LE,
SPA_AUDIO_FORMAT_U16_OE = SPA_AUDIO_FORMAT_U16_LE,
SPA_AUDIO_FORMAT_S24_32_OE = SPA_AUDIO_FORMAT_S24_32_LE,
SPA_AUDIO_FORMAT_U24_32_OE = SPA_AUDIO_FORMAT_U24_32_LE,
SPA_AUDIO_FORMAT_S32_OE = SPA_AUDIO_FORMAT_S32_LE,
SPA_AUDIO_FORMAT_U32_OE = SPA_AUDIO_FORMAT_U32_LE,
SPA_AUDIO_FORMAT_S24_OE = SPA_AUDIO_FORMAT_S24_LE,
SPA_AUDIO_FORMAT_U24_OE = SPA_AUDIO_FORMAT_U24_LE,
SPA_AUDIO_FORMAT_S20_OE = SPA_AUDIO_FORMAT_S20_LE,
SPA_AUDIO_FORMAT_U20_OE = SPA_AUDIO_FORMAT_U20_LE,
SPA_AUDIO_FORMAT_S18_OE = SPA_AUDIO_FORMAT_S18_LE,
SPA_AUDIO_FORMAT_U18_OE = SPA_AUDIO_FORMAT_U18_LE,
SPA_AUDIO_FORMAT_F32_OE = SPA_AUDIO_FORMAT_F32_LE,
SPA_AUDIO_FORMAT_F64_OE = SPA_AUDIO_FORMAT_F64_LE,
#elif __BYTE_ORDER == __LITTLE_ENDIAN
SPA_AUDIO_FORMAT_S16 = SPA_AUDIO_FORMAT_S16_LE,
SPA_AUDIO_FORMAT_U16 = SPA_AUDIO_FORMAT_U16_LE,
SPA_AUDIO_FORMAT_S24_32 = SPA_AUDIO_FORMAT_S24_32_LE,
SPA_AUDIO_FORMAT_U24_32 = SPA_AUDIO_FORMAT_U24_32_LE,
SPA_AUDIO_FORMAT_S32 = SPA_AUDIO_FORMAT_S32_LE,
SPA_AUDIO_FORMAT_U32 = SPA_AUDIO_FORMAT_U32_LE,
SPA_AUDIO_FORMAT_S24 = SPA_AUDIO_FORMAT_S24_LE,
SPA_AUDIO_FORMAT_U24 = SPA_AUDIO_FORMAT_U24_LE,
SPA_AUDIO_FORMAT_S20 = SPA_AUDIO_FORMAT_S20_LE,
SPA_AUDIO_FORMAT_U20 = SPA_AUDIO_FORMAT_U20_LE,
SPA_AUDIO_FORMAT_S18 = SPA_AUDIO_FORMAT_S18_LE,
SPA_AUDIO_FORMAT_U18 = SPA_AUDIO_FORMAT_U18_LE,
SPA_AUDIO_FORMAT_F32 = SPA_AUDIO_FORMAT_F32_LE,
SPA_AUDIO_FORMAT_F64 = SPA_AUDIO_FORMAT_F64_LE,
SPA_AUDIO_FORMAT_S16_OE = SPA_AUDIO_FORMAT_S16_BE,
SPA_AUDIO_FORMAT_U16_OE = SPA_AUDIO_FORMAT_U16_BE,
SPA_AUDIO_FORMAT_S24_32_OE = SPA_AUDIO_FORMAT_S24_32_BE,
SPA_AUDIO_FORMAT_U24_32_OE = SPA_AUDIO_FORMAT_U24_32_BE,
SPA_AUDIO_FORMAT_S32_OE = SPA_AUDIO_FORMAT_S32_BE,
SPA_AUDIO_FORMAT_U32_OE = SPA_AUDIO_FORMAT_U32_BE,
SPA_AUDIO_FORMAT_S24_OE = SPA_AUDIO_FORMAT_S24_BE,
SPA_AUDIO_FORMAT_U24_OE = SPA_AUDIO_FORMAT_U24_BE,
SPA_AUDIO_FORMAT_S20_OE = SPA_AUDIO_FORMAT_S20_BE,
SPA_AUDIO_FORMAT_U20_OE = SPA_AUDIO_FORMAT_U20_BE,
SPA_AUDIO_FORMAT_S18_OE = SPA_AUDIO_FORMAT_S18_BE,
SPA_AUDIO_FORMAT_U18_OE = SPA_AUDIO_FORMAT_U18_BE,
SPA_AUDIO_FORMAT_F32_OE = SPA_AUDIO_FORMAT_F32_BE,
SPA_AUDIO_FORMAT_F64_OE = SPA_AUDIO_FORMAT_F64_BE,
#endif
};
/** Extra audio flags */
enum spa_audio_flags {
@ -77,7 +136,7 @@ enum spa_audio_layout {
/** Audio information description */
struct spa_audio_info_raw {
uint32_t format; /*< format, one of SPA_TYPE__AudioFormat */
enum spa_audio_format format; /*< format, one of enum spa_audio_format */
enum spa_audio_flags flags; /*< extra flags */
enum spa_audio_layout layout; /*< sample layout */
uint32_t rate; /*< sample rate */

View file

@ -0,0 +1,58 @@
/* 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_TYPES_H__
#define __SPA_PARAM_BUFFERS_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/param/param-types.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__buffers SPA_TYPE_PARAM_BUFFERS_BASE "buffers"
#define SPA_TYPE_PARAM_BUFFERS__blocks SPA_TYPE_PARAM_BUFFERS_BASE "blocks"
#define SPA_TYPE_PARAM__BlockInfo SPA_TYPE_PARAM_BASE "BlockInfo"
#define SPA_TYPE_PARAM_BLOCK_INFO_BASE SPA_TYPE_PARAM__BlockInfo ":"
static const struct spa_type_info spa_type_param_buffers_items[] = {
{ SPA_PARAM_BUFFERS_buffers, SPA_TYPE_PARAM_BUFFERS_BASE "buffers", SPA_POD_TYPE_INT, },
{ SPA_PARAM_BUFFERS_blocks, SPA_TYPE_PARAM_BUFFERS_BASE "blocks", SPA_POD_TYPE_INT, },
{ SPA_PARAM_BUFFERS_size, SPA_TYPE_PARAM_BLOCK_INFO_BASE "size", SPA_POD_TYPE_INT, },
{ SPA_PARAM_BUFFERS_stride, SPA_TYPE_PARAM_BLOCK_INFO_BASE "stride", SPA_POD_TYPE_INT, },
{ SPA_PARAM_BUFFERS_align, SPA_TYPE_PARAM_BLOCK_INFO_BASE "align", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
static const struct spa_type_info spa_type_param_buffers[] = {
{ SPA_ID_OBJECT_ParamBuffers, SPA_TYPE_PARAM__Buffers, SPA_POD_TYPE_OBJECT,
spa_type_param_buffers_items },
{ 0, NULL, },
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_BUFFERS_TYPES_H__ */

View file

@ -25,47 +25,16 @@ 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__buffers SPA_TYPE_PARAM_BUFFERS_BASE "buffers"
#define SPA_TYPE_PARAM_BUFFERS__blocks SPA_TYPE_PARAM_BUFFERS_BASE "blocks"
#define SPA_TYPE_PARAM__BlockInfo SPA_TYPE_PARAM_BASE "BlockInfo"
#define SPA_TYPE_PARAM_BLOCK_INFO_BASE SPA_TYPE_PARAM__BlockInfo ":"
#define SPA_TYPE_PARAM_BLOCK_INFO__size SPA_TYPE_PARAM_BLOCK_INFO_BASE "size"
#define SPA_TYPE_PARAM_BLOCK_INFO__stride SPA_TYPE_PARAM_BLOCK_INFO_BASE "stride"
#define SPA_TYPE_PARAM_BLOCK_INFO__align SPA_TYPE_PARAM_BLOCK_INFO_BASE "align"
struct spa_type_param_buffers {
uint32_t Buffers;
uint32_t buffers;
uint32_t blocks;
uint32_t BlockInfo;
uint32_t size;
uint32_t stride;
uint32_t align;
/** properties for SPA_ID_OBJECT_ParamBuffers */
enum spa_param_buffers {
SPA_PARAM_BUFFERS_buffers, /**< number of buffers */
SPA_PARAM_BUFFERS_blocks, /**< number of data blocks per buffer */
SPA_PARAM_BUFFERS_size, /**< size of a data block memory */
SPA_PARAM_BUFFERS_stride, /**< stride of data block memory */
SPA_PARAM_BUFFERS_align, /**< alignment of data block memory */
};
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->buffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_BUFFERS__buffers);
type->blocks = spa_type_map_get_id(map, SPA_TYPE_PARAM_BUFFERS__blocks);
type->BlockInfo = spa_type_map_get_id(map, SPA_TYPE_PARAM__BlockInfo);
type->size = spa_type_map_get_id(map, SPA_TYPE_PARAM_BLOCK_INFO__size);
type->stride = spa_type_map_get_id(map, SPA_TYPE_PARAM_BLOCK_INFO__stride);
type->align = spa_type_map_get_id(map, SPA_TYPE_PARAM_BLOCK_INFO__align);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -0,0 +1,109 @@
/* 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_FORMAT_TYPES_H__
#define __SPA_PARAM_FORMAT_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/param/format.h>
#include <spa/param/param-types.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 ":"
#include <spa/param/audio/format-types.h>
#include <spa/param/video/format-types.h>
static const struct spa_type_info spa_type_media_type[] = {
{ SPA_MEDIA_TYPE_audio, SPA_TYPE_MEDIA_TYPE_BASE "audio", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_TYPE_video, SPA_TYPE_MEDIA_TYPE_BASE "video", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_TYPE_image, SPA_TYPE_MEDIA_TYPE_BASE "image", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_TYPE_binary, SPA_TYPE_MEDIA_TYPE_BASE "binary", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_TYPE_stream, SPA_TYPE_MEDIA_TYPE_BASE "stream", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
#define SPA_TYPE__MediaSubtype SPA_TYPE_ENUM_BASE "MediaSubtype"
#define SPA_TYPE_MEDIA_SUBTYPE_BASE SPA_TYPE__MediaSubtype ":"
static const struct spa_type_info spa_type_media_subtype[] = {
/* generic subtypes */
{ SPA_MEDIA_SUBTYPE_raw, SPA_TYPE_MEDIA_SUBTYPE_BASE "raw", SPA_POD_TYPE_INT, },
/* audio subtypes */
{ SPA_MEDIA_SUBTYPE_mp3, SPA_TYPE_MEDIA_SUBTYPE_BASE "mp3", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_aac, SPA_TYPE_MEDIA_SUBTYPE_BASE "aac", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_vorbis, SPA_TYPE_MEDIA_SUBTYPE_BASE "vorbis", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_wma, SPA_TYPE_MEDIA_SUBTYPE_BASE "wma", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_ra, SPA_TYPE_MEDIA_SUBTYPE_BASE "ra", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_sbc, SPA_TYPE_MEDIA_SUBTYPE_BASE "sbc", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_adpcm, SPA_TYPE_MEDIA_SUBTYPE_BASE "adpcm", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_g723, SPA_TYPE_MEDIA_SUBTYPE_BASE "g723", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_g726, SPA_TYPE_MEDIA_SUBTYPE_BASE "g726", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_g729, SPA_TYPE_MEDIA_SUBTYPE_BASE "g729", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_amr, SPA_TYPE_MEDIA_SUBTYPE_BASE "amr", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_gsm, SPA_TYPE_MEDIA_SUBTYPE_BASE "gsm", SPA_POD_TYPE_INT, },
/* video subtypes */
{ SPA_MEDIA_SUBTYPE_h264, SPA_TYPE_MEDIA_SUBTYPE_BASE "h264", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_mjpg, SPA_TYPE_MEDIA_SUBTYPE_BASE "mjpg", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_dv, SPA_TYPE_MEDIA_SUBTYPE_BASE "dv", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_mpegts, SPA_TYPE_MEDIA_SUBTYPE_BASE "mpegts", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_h263, SPA_TYPE_MEDIA_SUBTYPE_BASE "h263", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_mpeg1, SPA_TYPE_MEDIA_SUBTYPE_BASE "mpeg1", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_mpeg2, SPA_TYPE_MEDIA_SUBTYPE_BASE "mpeg2", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_mpeg4, SPA_TYPE_MEDIA_SUBTYPE_BASE "mpeg4", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_xvid, SPA_TYPE_MEDIA_SUBTYPE_BASE "xvid", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_vc1, SPA_TYPE_MEDIA_SUBTYPE_BASE "vc1", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_vp8, SPA_TYPE_MEDIA_SUBTYPE_BASE "vp8", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_vp9, SPA_TYPE_MEDIA_SUBTYPE_BASE "vp9", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_jpeg, SPA_TYPE_MEDIA_SUBTYPE_BASE "jpeg", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_bayer, SPA_TYPE_MEDIA_SUBTYPE_BASE "bayer", SPA_POD_TYPE_INT, },
{ SPA_MEDIA_SUBTYPE_midi, SPA_TYPE_MEDIA_SUBTYPE_BASE "midi", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
static const struct spa_type_info spa_type_format[] = {
{ SPA_ID_OBJECT_Format, SPA_TYPE__Format, SPA_POD_TYPE_OBJECT, },
{ 0, NULL, },
};
static inline const struct spa_type_info *
spa_type_format_get_ids(uint32_t media_type, uint32_t media_subtype)
{
switch (media_type) {
case SPA_MEDIA_TYPE_audio:
return spa_type_format_audio_ids;
case SPA_MEDIA_TYPE_video:
return spa_type_format_video_ids;
default:
return NULL;
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_FORMAT_TYPES_H__ */

View file

@ -1,145 +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_FORMAT_UTILS_H__
#define __SPA_PARAM_FORMAT_UTILS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.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;
uint32_t video;
uint32_t image;
uint32_t binary;
uint32_t stream;
};
static inline void
spa_type_media_type_map(struct spa_type_map *map, struct spa_type_media_type *type)
{
if (type->audio == 0) {
type->audio = spa_type_map_get_id(map, SPA_TYPE_MEDIA_TYPE__audio);
type->video = spa_type_map_get_id(map, SPA_TYPE_MEDIA_TYPE__video);
type->image = spa_type_map_get_id(map, SPA_TYPE_MEDIA_TYPE__image);
type->binary = spa_type_map_get_id(map, SPA_TYPE_MEDIA_TYPE__binary);
type->stream = spa_type_map_get_id(map, SPA_TYPE_MEDIA_TYPE__stream);
}
}
struct spa_type_media_subtype {
uint32_t raw;
};
static inline void
spa_type_media_subtype_map(struct spa_type_map *map, struct spa_type_media_subtype *type)
{
if (type->raw == 0) {
type->raw = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__raw);
}
}
struct spa_type_media_subtype_video {
uint32_t h264;
uint32_t mjpg;
uint32_t dv;
uint32_t mpegts;
uint32_t h263;
uint32_t mpeg1;
uint32_t mpeg2;
uint32_t mpeg4;
uint32_t xvid;
uint32_t vc1;
uint32_t vp8;
uint32_t vp9;
uint32_t jpeg;
uint32_t bayer;
};
static inline void
spa_type_media_subtype_video_map(struct spa_type_map *map,
struct spa_type_media_subtype_video *type)
{
if (type->h264 == 0) {
type->h264 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__h264);
type->mjpg = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__mjpg);
type->dv = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__dv);
type->mpegts = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__mpegts);
type->h263 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__h263);
type->mpeg1 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__mpeg1);
type->mpeg2 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__mpeg2);
type->mpeg4 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__mpeg4);
type->xvid = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__xvid);
type->vc1 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__vc1);
type->vp8 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__vp8);
type->vp9 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__vp9);
type->jpeg = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__jpeg);
type->bayer = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__bayer);
}
}
struct spa_type_media_subtype_audio {
uint32_t mp3;
uint32_t aac;
uint32_t vorbis;
uint32_t wma;
uint32_t ra;
uint32_t sbc;
uint32_t adpcm;
uint32_t g723;
uint32_t g726;
uint32_t g729;
uint32_t amr;
uint32_t gsm;
uint32_t midi;
};
static inline void
spa_type_media_subtype_audio_map(struct spa_type_map *map,
struct spa_type_media_subtype_audio *type)
{
if (type->mp3 == 0) {
type->mp3 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__mp3);
type->aac = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__aac);
type->vorbis = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__vorbis);
type->wma = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__wma);
type->ra = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__ra);
type->sbc = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__sbc);
type->adpcm = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__adpcm);
type->g723 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__g723);
type->g726 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__g726);
type->g729 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__g729);
type->amr = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__amr);
type->gsm = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__gsm);
type->midi = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__midi);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __PARAM_SPA_FORMAT_UTILS_H__ */

View file

@ -26,54 +26,58 @@ extern "C" {
#include <spa/param/param.h>
#define SPA_TYPE__Format SPA_TYPE_PARAM_BASE "Format"
#define SPA_TYPE_FORMAT_BASE SPA_TYPE__Format ":"
/** media type for SPA_ID_OBJECT_Format */
enum spa_media_type {
SPA_MEDIA_TYPE_audio,
SPA_MEDIA_TYPE_video,
SPA_MEDIA_TYPE_image,
SPA_MEDIA_TYPE_binary,
SPA_MEDIA_TYPE_stream,
};
#define SPA_TYPE__MediaType SPA_TYPE_ENUM_BASE "MediaType"
#define SPA_TYPE_MEDIA_TYPE_BASE SPA_TYPE__MediaType ":"
/** media subtype for SPA_ID_OBJECT_Format */
enum spa_media_subtype {
SPA_MEDIA_SUBTYPE_BASE_Generic,
SPA_MEDIA_SUBTYPE_raw,
#define SPA_TYPE_MEDIA_TYPE__audio SPA_TYPE_MEDIA_TYPE_BASE "audio"
#define SPA_TYPE_MEDIA_TYPE__video SPA_TYPE_MEDIA_TYPE_BASE "video"
#define SPA_TYPE_MEDIA_TYPE__image SPA_TYPE_MEDIA_TYPE_BASE "image"
#define SPA_TYPE_MEDIA_TYPE__binary SPA_TYPE_MEDIA_TYPE_BASE "binary"
#define SPA_TYPE_MEDIA_TYPE__stream SPA_TYPE_MEDIA_TYPE_BASE "stream"
SPA_MEDIA_SUBTYPE_BASE_Audio = 0x10000,
SPA_MEDIA_SUBTYPE_mp3,
SPA_MEDIA_SUBTYPE_aac,
SPA_MEDIA_SUBTYPE_vorbis,
SPA_MEDIA_SUBTYPE_wma,
SPA_MEDIA_SUBTYPE_ra,
SPA_MEDIA_SUBTYPE_sbc,
SPA_MEDIA_SUBTYPE_adpcm,
SPA_MEDIA_SUBTYPE_g723,
SPA_MEDIA_SUBTYPE_g726,
SPA_MEDIA_SUBTYPE_g729,
SPA_MEDIA_SUBTYPE_amr,
SPA_MEDIA_SUBTYPE_gsm,
#define SPA_TYPE__MediaSubtype SPA_TYPE_ENUM_BASE "MediaSubtype"
#define SPA_TYPE_MEDIA_SUBTYPE_BASE SPA_TYPE__MediaSubtype ":"
SPA_MEDIA_SUBTYPE_BASE_Video = 0x20000,
SPA_MEDIA_SUBTYPE_h264,
SPA_MEDIA_SUBTYPE_mjpg,
SPA_MEDIA_SUBTYPE_dv,
SPA_MEDIA_SUBTYPE_mpegts,
SPA_MEDIA_SUBTYPE_h263,
SPA_MEDIA_SUBTYPE_mpeg1,
SPA_MEDIA_SUBTYPE_mpeg2,
SPA_MEDIA_SUBTYPE_mpeg4,
SPA_MEDIA_SUBTYPE_xvid,
SPA_MEDIA_SUBTYPE_vc1,
SPA_MEDIA_SUBTYPE_vp8,
SPA_MEDIA_SUBTYPE_vp9,
SPA_MEDIA_SUBTYPE_jpeg,
SPA_MEDIA_SUBTYPE_bayer,
/* generic subtypes */
#define SPA_TYPE_MEDIA_SUBTYPE__raw SPA_TYPE_MEDIA_SUBTYPE_BASE "raw"
SPA_MEDIA_SUBTYPE_BASE_Image = 0x30000,
/* video subtypes */
#define SPA_TYPE_MEDIA_SUBTYPE__h264 SPA_TYPE_MEDIA_SUBTYPE_BASE "h264"
#define SPA_TYPE_MEDIA_SUBTYPE__mjpg SPA_TYPE_MEDIA_SUBTYPE_BASE "mjpg"
#define SPA_TYPE_MEDIA_SUBTYPE__dv SPA_TYPE_MEDIA_SUBTYPE_BASE "dv"
#define SPA_TYPE_MEDIA_SUBTYPE__mpegts SPA_TYPE_MEDIA_SUBTYPE_BASE "mpegts"
#define SPA_TYPE_MEDIA_SUBTYPE__h263 SPA_TYPE_MEDIA_SUBTYPE_BASE "h263"
#define SPA_TYPE_MEDIA_SUBTYPE__mpeg1 SPA_TYPE_MEDIA_SUBTYPE_BASE "mpeg1"
#define SPA_TYPE_MEDIA_SUBTYPE__mpeg2 SPA_TYPE_MEDIA_SUBTYPE_BASE "mpeg2"
#define SPA_TYPE_MEDIA_SUBTYPE__mpeg4 SPA_TYPE_MEDIA_SUBTYPE_BASE "mpeg4"
#define SPA_TYPE_MEDIA_SUBTYPE__xvid SPA_TYPE_MEDIA_SUBTYPE_BASE "xvid"
#define SPA_TYPE_MEDIA_SUBTYPE__vc1 SPA_TYPE_MEDIA_SUBTYPE_BASE "vc1"
#define SPA_TYPE_MEDIA_SUBTYPE__vp8 SPA_TYPE_MEDIA_SUBTYPE_BASE "vp8"
#define SPA_TYPE_MEDIA_SUBTYPE__vp9 SPA_TYPE_MEDIA_SUBTYPE_BASE "vp9"
#define SPA_TYPE_MEDIA_SUBTYPE__jpeg SPA_TYPE_MEDIA_SUBTYPE_BASE "jpeg"
#define SPA_TYPE_MEDIA_SUBTYPE__bayer SPA_TYPE_MEDIA_SUBTYPE_BASE "bayer"
SPA_MEDIA_SUBTYPE_BASE_Binary = 0x40000,
SPA_MEDIA_SUBTYPE_BASE_Stream = 0x50000,
SPA_MEDIA_SUBTYPE_midi,
};
/* audio subtypes */
#define SPA_TYPE_MEDIA_SUBTYPE__mp3 SPA_TYPE_MEDIA_SUBTYPE_BASE "mp3"
#define SPA_TYPE_MEDIA_SUBTYPE__aac SPA_TYPE_MEDIA_SUBTYPE_BASE "aac"
#define SPA_TYPE_MEDIA_SUBTYPE__vorbis SPA_TYPE_MEDIA_SUBTYPE_BASE "vorbis"
#define SPA_TYPE_MEDIA_SUBTYPE__wma SPA_TYPE_MEDIA_SUBTYPE_BASE "wma"
#define SPA_TYPE_MEDIA_SUBTYPE__ra SPA_TYPE_MEDIA_SUBTYPE_BASE "ra"
#define SPA_TYPE_MEDIA_SUBTYPE__sbc SPA_TYPE_MEDIA_SUBTYPE_BASE "sbc"
#define SPA_TYPE_MEDIA_SUBTYPE__adpcm SPA_TYPE_MEDIA_SUBTYPE_BASE "adpcm"
#define SPA_TYPE_MEDIA_SUBTYPE__g723 SPA_TYPE_MEDIA_SUBTYPE_BASE "g723"
#define SPA_TYPE_MEDIA_SUBTYPE__g726 SPA_TYPE_MEDIA_SUBTYPE_BASE "g726"
#define SPA_TYPE_MEDIA_SUBTYPE__g729 SPA_TYPE_MEDIA_SUBTYPE_BASE "g729"
#define SPA_TYPE_MEDIA_SUBTYPE__amr SPA_TYPE_MEDIA_SUBTYPE_BASE "amr"
#define SPA_TYPE_MEDIA_SUBTYPE__gsm SPA_TYPE_MEDIA_SUBTYPE_BASE "gsm"
#define SPA_TYPE_MEDIA_SUBTYPE__midi SPA_TYPE_MEDIA_SUBTYPE_BASE "midi"
#ifdef __cplusplus
} /* extern "C" */

View file

@ -0,0 +1,101 @@
/* 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_IO_H__
#define __SPA_PARAM_IO_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/param/param.h>
#include <spa/support/type-map.h>
/** type ID of property, uniquely identifies the io area for a port */
#define SPA_TYPE_PARAM_IO__id SPA_TYPE_PARAM_IO_BASE "id"
/** size of the io area for a port */
#define SPA_TYPE_PARAM_IO__size SPA_TYPE_PARAM_IO_BASE "size"
/** enumerate buffer io areas */
#define SPA_TYPE_PARAM_ID_IO__Buffers SPA_TYPE_PARAM_ID_IO_BASE "Buffers"
/* an io area to exchange buffers */
#define SPA_TYPE_PARAM_IO__Buffers SPA_TYPE_PARAM_IO_BASE "Buffers"
/** enumerate Control io areas */
#define SPA_TYPE_PARAM_ID_IO__Control SPA_TYPE_PARAM_ID_IO_BASE "Control"
/* an io area to exchange control information */
#define SPA_TYPE_PARAM_IO__Control SPA_TYPE_PARAM_IO_BASE "Control"
/** enumerate input or output properties */
#define SPA_TYPE_PARAM_ID_IO__Props SPA_TYPE_PARAM_ID_IO_BASE "Props"
#define SPA_TYPE_PARAM_ID_IO_PROPS_BASE SPA_TYPE_PARAM_ID_IO__Props ":"
/** enumerate input property io areas */
#define SPA_TYPE_PARAM_ID_IO_PROPS__In SPA_TYPE_PARAM_ID_IO_PROPS_BASE "In"
/** enumerate output property io areas */
#define SPA_TYPE_PARAM_ID_IO_PROPS__Out SPA_TYPE_PARAM_ID_IO_PROPS_BASE "Out"
/* an io area to exchange properties. Contents can include
* SPA_TYPE_PARAM__PropInfo */
#define SPA_TYPE_PARAM_IO__Prop SPA_TYPE_PARAM_IO_BASE "Prop"
#define SPA_TYPE_PARAM_IO_PROP_BASE SPA_TYPE_PARAM_IO__Prop ":"
/** enumerate clock io areas */
#define SPA_TYPE_PARAM_ID_IO__Clock SPA_TYPE_PARAM_ID_IO_BASE "Clock"
/* an io area to exchange clock information */
#define SPA_TYPE_PARAM_IO__Clock SPA_TYPE_PARAM_IO_BASE "Clock"
struct spa_type_param_io {
uint32_t id; /**< id to configure the io area */
uint32_t size; /**< size of io area */
uint32_t idBuffers; /**< id to enumerate buffer io */
uint32_t Buffers; /**< object type of buffer io area */
uint32_t idControl; /**< id to enumerate control io */
uint32_t Control; /**< object type of Control area */
uint32_t idPropsIn; /**< id to enumerate input properties io */
uint32_t idPropsOut; /**< id to enumerate output properties io */
uint32_t Prop; /**< object type of property area */
uint32_t idClock; /**< id to enumerate clock io */
uint32_t Clock; /**< object type of clock io area */
};
static inline void
spa_type_param_io_map(struct spa_type_map *map,
struct spa_type_param_io *type)
{
if (type->id == 0) {
type->id = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__id);
type->size = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__size);
type->idBuffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO__Buffers);
type->Buffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__Buffers);
type->idControl = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO__Control);
type->Control = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__Control);
type->idPropsIn = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO_PROPS__In);
type->idPropsOut = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO_PROPS__Out);
type->Prop = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__Prop);
type->idClock = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO__Clock);
type->Clock = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__Clock);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_IO_H__ */

View file

@ -26,74 +26,13 @@ extern "C" {
#include <spa/utils/defs.h>
#include <spa/param/param.h>
#include <spa/support/type-map.h>
/** type ID of property, uniquely identifies the io area for a port */
#define SPA_TYPE_PARAM_IO__id SPA_TYPE_PARAM_IO_BASE "id"
/** size of the io area for a port */
#define SPA_TYPE_PARAM_IO__size SPA_TYPE_PARAM_IO_BASE "size"
/** enumerate buffer io areas */
#define SPA_TYPE_PARAM_ID_IO__Buffers SPA_TYPE_PARAM_ID_IO_BASE "Buffers"
/* an io area to exchange buffers */
#define SPA_TYPE_PARAM_IO__Buffers SPA_TYPE_PARAM_IO_BASE "Buffers"
/** enumerate Control io areas */
#define SPA_TYPE_PARAM_ID_IO__Control SPA_TYPE_PARAM_ID_IO_BASE "Control"
/* an io area to exchange control information */
#define SPA_TYPE_PARAM_IO__Control SPA_TYPE_PARAM_IO_BASE "Control"
/** enumerate input or output properties */
#define SPA_TYPE_PARAM_ID_IO__Props SPA_TYPE_PARAM_ID_IO_BASE "Props"
#define SPA_TYPE_PARAM_ID_IO_PROPS_BASE SPA_TYPE_PARAM_ID_IO__Props ":"
/** enumerate input property io areas */
#define SPA_TYPE_PARAM_ID_IO_PROPS__In SPA_TYPE_PARAM_ID_IO_PROPS_BASE "In"
/** enumerate output property io areas */
#define SPA_TYPE_PARAM_ID_IO_PROPS__Out SPA_TYPE_PARAM_ID_IO_PROPS_BASE "Out"
/* an io area to exchange properties. Contents can include
* SPA_TYPE_PARAM__PropInfo */
#define SPA_TYPE_PARAM_IO__Prop SPA_TYPE_PARAM_IO_BASE "Prop"
#define SPA_TYPE_PARAM_IO_PROP_BASE SPA_TYPE_PARAM_IO__Prop ":"
/** enumerate clock io areas */
#define SPA_TYPE_PARAM_ID_IO__Clock SPA_TYPE_PARAM_ID_IO_BASE "Clock"
/* an io area to exchange clock information */
#define SPA_TYPE_PARAM_IO__Clock SPA_TYPE_PARAM_IO_BASE "Clock"
struct spa_type_param_io {
uint32_t id; /**< id to configure the io area */
uint32_t size; /**< size of io area */
uint32_t idBuffers; /**< id to enumerate buffer io */
uint32_t Buffers; /**< object type of buffer io area */
uint32_t idControl; /**< id to enumerate control io */
uint32_t Control; /**< object type of Control area */
uint32_t idPropsIn; /**< id to enumerate input properties io */
uint32_t idPropsOut; /**< id to enumerate output properties io */
uint32_t Prop; /**< object type of property area */
uint32_t idClock; /**< id to enumerate clock io */
uint32_t Clock; /**< object type of clock io area */
/** properties for SPA_ID_OBJECT_ParamIO */
enum spa_param_io {
SPA_PARAM_IO_id, /**< type ID, uniquely identifies the io area */
SPA_PARAM_IO_size, /**< size of the io area */
};
static inline void
spa_type_param_io_map(struct spa_type_map *map,
struct spa_type_param_io *type)
{
if (type->id == 0) {
type->id = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__id);
type->size = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__size);
type->idBuffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO__Buffers);
type->Buffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__Buffers);
type->idControl = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO__Control);
type->Control = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__Control);
type->idPropsIn = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO_PROPS__In);
type->idPropsOut = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO_PROPS__Out);
type->Prop = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__Prop);
type->idClock = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO__Clock);
type->Clock = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__Clock);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -0,0 +1,66 @@
/* 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 <fcntl.h> /* for off_t */
#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"
struct spa_type_param_meta {
uint32_t Meta;
uint32_t type;
uint32_t size;
};
static inline void
spa_type_param_meta_map(struct spa_type_map *map,
struct spa_type_param_meta *type)
{
if (type->Meta == 0) {
size_t 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 },
};
#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,41 +24,15 @@
extern "C" {
#endif
#include <fcntl.h> /* for off_t */
#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"
struct spa_type_param_meta {
uint32_t Meta;
uint32_t type;
uint32_t size;
/** properties for SPA_ID_OBJECT_ParamMeta */
enum spa_param_meta {
SPA_PARAM_META_type, /**< the metadata, one of enum spa_meta_type */
SPA_PARAM_META_size, /**< the expected maximum size the meta */
};
static inline void
spa_type_param_meta_map(struct spa_type_map *map,
struct spa_type_param_meta *type)
{
if (type->Meta == 0) {
size_t 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 },
};
#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

View file

@ -0,0 +1,92 @@
/* 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_PARAM_TYPES_H__
#define __SPA_PARAM_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/pod/pod.h>
/* base for parameter objects */
#define SPA_TYPE__Param SPA_TYPE_POD_OBJECT_BASE "Param"
#define SPA_TYPE_PARAM_BASE SPA_TYPE__Param ":"
/* base for parameter object enumerations */
#define SPA_TYPE__ParamId SPA_TYPE_ENUM_BASE "ParamId"
#define SPA_TYPE_PARAM_ID_BASE SPA_TYPE__ParamId ":"
/** List of supported parameters */
#define SPA_TYPE_PARAM_ID__List SPA_TYPE_PARAM_ID_BASE "List"
/* object with supported parameter id */
#define SPA_TYPE_PARAM__List SPA_TYPE_PARAM_BASE "List"
#define SPA_TYPE_PARAM_LIST_BASE SPA_TYPE_PARAM__List ":"
#define SPA_TYPE_PARAM_LIST__id SPA_TYPE_PARAM_LIST_BASE "id"
/** Enum Property info */
#define SPA_TYPE_PARAM_ID__PropInfo SPA_TYPE_PARAM_ID_BASE "PropInfo"
#define SPA_TYPE_PARAM__PropInfo SPA_TYPE_PARAM_BASE "PropInfo"
#define SPA_TYPE_PARAM_PROP_INFO_BASE SPA_TYPE_PARAM__PropInfo ":"
/** associated id of the property */
#define SPA_TYPE_PARAM_PROP_INFO__id SPA_TYPE_PARAM_PROP_INFO_BASE "id"
/** name of property */
#define SPA_TYPE_PARAM_PROP_INFO__name SPA_TYPE_PARAM_PROP_INFO_BASE "name"
/** associated type and range/enums of property */
#define SPA_TYPE_PARAM_PROP_INFO__type SPA_TYPE_PARAM_PROP_INFO_BASE "type"
/** associated labels of property if any, this is a struct with pairs of values,
* the first one is of the type of the property, the second one is a string with
* a user readable label for the value. */
#define SPA_TYPE_PARAM_PROP_INFO__labels SPA_TYPE_PARAM_PROP_INFO_BASE "labels"
/** Property parameter id, deals with SPA_TYPE__Props */
#define SPA_TYPE_PARAM_ID__Props SPA_TYPE_PARAM_ID_BASE "Props"
/** The available formats */
#define SPA_TYPE_PARAM_ID__EnumFormat SPA_TYPE_PARAM_ID_BASE "EnumFormat"
/** The current format */
#define SPA_TYPE_PARAM_ID__Format SPA_TYPE_PARAM_ID_BASE "Format"
/** The supported buffer sizes */
#define SPA_TYPE_PARAM_ID__Buffers SPA_TYPE_PARAM_ID_BASE "Buffers"
/** The supported metadata */
#define SPA_TYPE_PARAM_ID__Meta SPA_TYPE_PARAM_ID_BASE "Meta"
/** The supported io areas */
#define SPA_TYPE_PARAM_ID__IO SPA_TYPE_PARAM_ID_BASE "IO"
#define SPA_TYPE_PARAM_ID_IO_BASE SPA_TYPE_PARAM_ID__IO ":"
/** Base for parameters that describe IO areas to exchange data,
* control and properties with a node.
*/
#define SPA_TYPE_PARAM__IO SPA_TYPE_PARAM_BASE "IO"
#define SPA_TYPE_PARAM_IO_BASE SPA_TYPE_PARAM__IO ":"
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_TYPES_H__ */

View file

@ -25,105 +25,12 @@ extern "C" {
#endif
#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"
#define SPA_TYPE_PARAM_BASE SPA_TYPE__Param ":"
/* base for parameter object enumerations */
#define SPA_TYPE__ParamId SPA_TYPE_ENUM_BASE "ParamId"
#define SPA_TYPE_PARAM_ID_BASE SPA_TYPE__ParamId ":"
/** List of supported parameters */
#define SPA_TYPE_PARAM_ID__List SPA_TYPE_PARAM_ID_BASE "List"
/* object with supported parameter id */
#define SPA_TYPE_PARAM__List SPA_TYPE_PARAM_BASE "List"
#define SPA_TYPE_PARAM_LIST_BASE SPA_TYPE_PARAM__List ":"
#define SPA_TYPE_PARAM_LIST__id SPA_TYPE_PARAM_LIST_BASE "id"
/** Enum Property info */
#define SPA_TYPE_PARAM_ID__PropInfo SPA_TYPE_PARAM_ID_BASE "PropInfo"
#define SPA_TYPE_PARAM__PropInfo SPA_TYPE_PARAM_BASE "PropInfo"
#define SPA_TYPE_PARAM_PROP_INFO_BASE SPA_TYPE_PARAM__PropInfo ":"
/** associated id of the property */
#define SPA_TYPE_PARAM_PROP_INFO__id SPA_TYPE_PARAM_PROP_INFO_BASE "id"
/** name of property */
#define SPA_TYPE_PARAM_PROP_INFO__name SPA_TYPE_PARAM_PROP_INFO_BASE "name"
/** associated type and range/enums of property */
#define SPA_TYPE_PARAM_PROP_INFO__type SPA_TYPE_PARAM_PROP_INFO_BASE "type"
/** associated labels of property if any, this is a struct with pairs of values,
* the first one is of the type of the property, the second one is a string with
* a user readable label for the value. */
#define SPA_TYPE_PARAM_PROP_INFO__labels SPA_TYPE_PARAM_PROP_INFO_BASE "labels"
/** Property parameter id, deals with SPA_TYPE__Props */
#define SPA_TYPE_PARAM_ID__Props SPA_TYPE_PARAM_ID_BASE "Props"
/** The available formats */
#define SPA_TYPE_PARAM_ID__EnumFormat SPA_TYPE_PARAM_ID_BASE "EnumFormat"
/** The current format */
#define SPA_TYPE_PARAM_ID__Format SPA_TYPE_PARAM_ID_BASE "Format"
/** The supported buffer sizes */
#define SPA_TYPE_PARAM_ID__Buffers SPA_TYPE_PARAM_ID_BASE "Buffers"
/** The supported metadata */
#define SPA_TYPE_PARAM_ID__Meta SPA_TYPE_PARAM_ID_BASE "Meta"
/** The supported io areas */
#define SPA_TYPE_PARAM_ID__IO SPA_TYPE_PARAM_ID_BASE "IO"
#define SPA_TYPE_PARAM_ID_IO_BASE SPA_TYPE_PARAM_ID__IO ":"
/** Base for parameters that describe IO areas to exchange data,
* control and properties with a node.
*/
#define SPA_TYPE_PARAM__IO SPA_TYPE_PARAM_BASE "IO"
#define SPA_TYPE_PARAM_IO_BASE SPA_TYPE_PARAM__IO ":"
struct spa_type_param {
uint32_t idList; /**< id of the list param */
uint32_t List; /**< list object type */
uint32_t listId; /**< id in the list object */
uint32_t idPropInfo; /**< id to enumerate property info */
uint32_t PropInfo; /**< property info object */
uint32_t propId; /**< property id */
uint32_t propName; /**< property name */
uint32_t propType; /**< property type */
uint32_t propLabels; /**< property labels */
uint32_t idProps; /**< id to enumerate properties */
uint32_t idEnumFormat; /**< id to enumerate formats */
uint32_t idFormat; /**< id to get/set format parameter */
uint32_t idBuffers; /**< id to enumerate buffer requirements */
uint32_t idMeta; /**< id to enumerate supported metadata */
/** Properties for SPA_ID_OBJECT_ParamList */
enum spa_param_list {
SPA_PARAM_LIST_id, /**< id of the supported list param */
};
static inline void
spa_type_param_map(struct spa_type_map *map,
struct spa_type_param *type)
{
if (type->idList == 0) {
type->idList = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID__List);
type->List = spa_type_map_get_id(map, SPA_TYPE_PARAM__List);
type->listId = spa_type_map_get_id(map, SPA_TYPE_PARAM_LIST__id);
type->idPropInfo = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID__PropInfo);
type->PropInfo = spa_type_map_get_id(map, SPA_TYPE_PARAM__PropInfo);
type->propId = spa_type_map_get_id(map, SPA_TYPE_PARAM_PROP_INFO__id);
type->propName = spa_type_map_get_id(map, SPA_TYPE_PARAM_PROP_INFO__name);
type->propType = spa_type_map_get_id(map, SPA_TYPE_PARAM_PROP_INFO__type);
type->propLabels = spa_type_map_get_id(map, SPA_TYPE_PARAM_PROP_INFO__labels);
type->idProps = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID__Props);
type->idEnumFormat = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID__EnumFormat);
type->idFormat = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID__Format);
type->idBuffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID__Buffers);
type->idMeta = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID__Meta);
}
}
#ifdef __cplusplus
} /* extern "C" */

View file

@ -0,0 +1,70 @@
/* 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_PROPS_TYPES_H__
#define __SPA_PARAM_PROPS_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/param/param.h>
#define SPA_TYPE__Props SPA_TYPE_PARAM_BASE "Props"
#define SPA_TYPE_PROPS_BASE SPA_TYPE__Props ":"
/** an unknown property */
#define SPA_TYPE_PROPS__unknown SPA_TYPE_PROPS_BASE "unknown"
/** Common property ids */
#define SPA_TYPE_PROPS__device SPA_TYPE_PROPS_BASE "device"
#define SPA_TYPE_PROPS__deviceName SPA_TYPE_PROPS_BASE "deviceName"
#define SPA_TYPE_PROPS__deviceFd SPA_TYPE_PROPS_BASE "deviceFd"
#define SPA_TYPE_PROPS__card SPA_TYPE_PROPS_BASE "card"
#define SPA_TYPE_PROPS__cardName SPA_TYPE_PROPS_BASE "cardName"
#define SPA_TYPE_PROPS__minLatency SPA_TYPE_PROPS_BASE "minLatency"
#define SPA_TYPE_PROPS__maxLatency SPA_TYPE_PROPS_BASE "maxLatency"
#define SPA_TYPE_PROPS__periods SPA_TYPE_PROPS_BASE "periods"
#define SPA_TYPE_PROPS__periodSize SPA_TYPE_PROPS_BASE "periodSize"
#define SPA_TYPE_PROPS__periodEvent SPA_TYPE_PROPS_BASE "periodEvent"
#define SPA_TYPE_PROPS__live SPA_TYPE_PROPS_BASE "live"
#define SPA_TYPE_PROPS__waveType SPA_TYPE_PROPS_BASE "waveType"
#define SPA_TYPE_PROPS__frequency SPA_TYPE_PROPS_BASE "frequency"
#define SPA_TYPE_PROPS__volume SPA_TYPE_PROPS_BASE "volume"
#define SPA_TYPE_PROPS__mute SPA_TYPE_PROPS_BASE "mute"
#define SPA_TYPE_PROPS__patternType SPA_TYPE_PROPS_BASE "patternType"
#define SPA_TYPE_PROPS__ditherType SPA_TYPE_PROPS_BASE "ditherType"
#define SPA_TYPE_PROPS__truncate SPA_TYPE_PROPS_BASE "truncate"
#define SPA_TYPE_PROPS__brightness SPA_TYPE_PROPS_BASE "brightness"
#define SPA_TYPE_PROPS__contrast SPA_TYPE_PROPS_BASE "contrast"
#define SPA_TYPE_PROPS__saturation SPA_TYPE_PROPS_BASE "saturation"
#define SPA_TYPE_PROPS__hue SPA_TYPE_PROPS_BASE "hue"
#define SPA_TYPE_PROPS__gamma SPA_TYPE_PROPS_BASE "gamma"
#define SPA_TYPE_PROPS__exposure SPA_TYPE_PROPS_BASE "exposure"
#define SPA_TYPE_PROPS__gain SPA_TYPE_PROPS_BASE "gain"
#define SPA_TYPE_PROPS__sharpness SPA_TYPE_PROPS_BASE "sharpness"
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_PROPS_TYPES_H__ */

View file

@ -26,42 +26,56 @@ extern "C" {
#include <spa/param/param.h>
#define SPA_TYPE__Props SPA_TYPE_PARAM_BASE "Props"
#define SPA_TYPE_PROPS_BASE SPA_TYPE__Props ":"
/** properties of SPA_ID_OBJECT_PropInfo */
enum spa_prop_info {
SPA_PROP_INFO_id, /**< associated id of the property */
SPA_PROP_INFO_name, /**< name of the property */
SPA_PROP_INFO_type, /**< type and range/enums of property */
SPA_PROP_INFO_labels, /**< labels of property if any, this is a
* struct with pairs of values, the first one
* is of the type of the property, the second
* one is a string with a user readable label
* for the value. */
};
/** an unknown property */
#define SPA_TYPE_PROPS__unknown SPA_TYPE_PROPS_BASE "unknown"
/** predefined properties for SPA_ID_OBJECT_Props */
enum spa_prop {
SPA_PROP_BASE_GENERIC = 0x0,
/** Common property ids */
#define SPA_TYPE_PROPS__device SPA_TYPE_PROPS_BASE "device"
#define SPA_TYPE_PROPS__deviceName SPA_TYPE_PROPS_BASE "deviceName"
#define SPA_TYPE_PROPS__deviceFd SPA_TYPE_PROPS_BASE "deviceFd"
#define SPA_TYPE_PROPS__card SPA_TYPE_PROPS_BASE "card"
#define SPA_TYPE_PROPS__cardName SPA_TYPE_PROPS_BASE "cardName"
SPA_PROP_unknown, /**< an unknown property */
#define SPA_TYPE_PROPS__minLatency SPA_TYPE_PROPS_BASE "minLatency"
#define SPA_TYPE_PROPS__maxLatency SPA_TYPE_PROPS_BASE "maxLatency"
#define SPA_TYPE_PROPS__periods SPA_TYPE_PROPS_BASE "periods"
#define SPA_TYPE_PROPS__periodSize SPA_TYPE_PROPS_BASE "periodSize"
#define SPA_TYPE_PROPS__periodEvent SPA_TYPE_PROPS_BASE "periodEvent"
SPA_PROP_device,
SPA_PROP_deviceName,
SPA_PROP_deviceFd,
SPA_PROP_card,
SPA_PROP_cardName,
#define SPA_TYPE_PROPS__live SPA_TYPE_PROPS_BASE "live"
#define SPA_TYPE_PROPS__waveType SPA_TYPE_PROPS_BASE "waveType"
#define SPA_TYPE_PROPS__frequency SPA_TYPE_PROPS_BASE "frequency"
#define SPA_TYPE_PROPS__volume SPA_TYPE_PROPS_BASE "volume"
#define SPA_TYPE_PROPS__mute SPA_TYPE_PROPS_BASE "mute"
#define SPA_TYPE_PROPS__patternType SPA_TYPE_PROPS_BASE "patternType"
#define SPA_TYPE_PROPS__ditherType SPA_TYPE_PROPS_BASE "ditherType"
#define SPA_TYPE_PROPS__truncate SPA_TYPE_PROPS_BASE "truncate"
SPA_PROP_minLatency,
SPA_PROP_maxLatency,
SPA_PROP_periods,
SPA_PROP_periodSize,
SPA_PROP_periodEvent,
SPA_PROP_live,
#define SPA_TYPE_PROPS__brightness SPA_TYPE_PROPS_BASE "brightness"
#define SPA_TYPE_PROPS__contrast SPA_TYPE_PROPS_BASE "contrast"
#define SPA_TYPE_PROPS__saturation SPA_TYPE_PROPS_BASE "saturation"
#define SPA_TYPE_PROPS__hue SPA_TYPE_PROPS_BASE "hue"
#define SPA_TYPE_PROPS__gamma SPA_TYPE_PROPS_BASE "gamma"
#define SPA_TYPE_PROPS__exposure SPA_TYPE_PROPS_BASE "exposure"
#define SPA_TYPE_PROPS__gain SPA_TYPE_PROPS_BASE "gain"
#define SPA_TYPE_PROPS__sharpness SPA_TYPE_PROPS_BASE "sharpness"
SPA_PROP_waveType,
SPA_PROP_frequency,
SPA_PROP_volume,
SPA_PROP_mute,
SPA_PROP_patternType,
SPA_PROP_ditherType,
SPA_PROP_truncate,
SPA_PROP_brightness,
SPA_PROP_contrast,
SPA_PROP_saturation,
SPA_PROP_hue,
SPA_PROP_gamma,
SPA_PROP_exposure,
SPA_PROP_gain,
SPA_PROP_sharpness,
SPA_PROP_BASE_CUSTOM = 0x10000,
};
#ifdef __cplusplus
} /* extern "C" */

View file

@ -26,8 +26,8 @@ extern "C" {
#include <spa/utils/defs.h>
#include <spa/param/param.h>
#include <spa/support/type-map.h>
#if 0
#define SPA_TYPE_PARAM__VideoPadding SPA_TYPE_PARAM_BASE "VideoPadding"
#define SPA_TYPE_PARAM_VIDEO_PADDING_BASE SPA_TYPE_PARAM__VideoPadding ":"
@ -39,32 +39,7 @@ extern "C" {
#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);
}
}
#endif
#ifdef __cplusplus
} /* extern "C" */

View file

@ -0,0 +1,60 @@
/* 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_FORMAT_TYPES_H__
#define __SPA_PARAM_VIDEO_FORMAT_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/param/video/format.h>
#include <spa/param/video/raw-types.h>
#define SPA_TYPE__FormatVideo SPA_TYPE_FORMAT_BASE "Video"
#define SPA_TYPE_FORMAT_VIDEO_BASE SPA_TYPE__FormatVideo ":"
static const struct spa_type_info spa_type_format_video_ids[] = {
{ SPA_FORMAT_VIDEO_format, SPA_TYPE_FORMAT_VIDEO_BASE "format", SPA_POD_TYPE_ID,
spa_type_video_format, },
{ SPA_FORMAT_VIDEO_size, SPA_TYPE_FORMAT_VIDEO_BASE "size", SPA_POD_TYPE_RECTANGLE, },
{ SPA_FORMAT_VIDEO_framerate, SPA_TYPE_FORMAT_VIDEO_BASE "framerate", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_maxFramerate, SPA_TYPE_FORMAT_VIDEO_BASE "maxFramerate", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_views, SPA_TYPE_FORMAT_VIDEO_BASE "views", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_interlaceMode, SPA_TYPE_FORMAT_VIDEO_BASE "interlaceMode", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_pixelAspectRatio, SPA_TYPE_FORMAT_VIDEO_BASE "pixelAspectRatio", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_multiviewMode, SPA_TYPE_FORMAT_VIDEO_BASE "multiviewMode", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_multiviewFlags, SPA_TYPE_FORMAT_VIDEO_BASE "multiviewFlags", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_chromaSite, SPA_TYPE_FORMAT_VIDEO_BASE "chromaSite", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_colorRange, SPA_TYPE_FORMAT_VIDEO_BASE "colorRange", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_colorMatrix, SPA_TYPE_FORMAT_VIDEO_BASE "colorMatrix", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_transferFunction, SPA_TYPE_FORMAT_VIDEO_BASE "transferFunction", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_colorPrimaries, SPA_TYPE_FORMAT_VIDEO_BASE "colorPrimaries", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_profile, SPA_TYPE_FORMAT_VIDEO_BASE "profile", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_level, SPA_TYPE_FORMAT_VIDEO_BASE "level", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_streamFormat, SPA_TYPE_FORMAT_VIDEO_BASE "streamFormat", SPA_POD_TYPE_INT, },
{ SPA_FORMAT_VIDEO_alignment, SPA_TYPE_FORMAT_VIDEO_BASE "alignment", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_VIDEO_FORMAT_TYPES_H */

View file

@ -24,98 +24,50 @@
extern "C" {
#endif
#include <spa/param/param.h>
#include <spa/param/format-utils.h>
#include <spa/pod/parser.h>
#include <spa/param/video/format.h>
#include <spa/param/video/raw-utils.h>
struct spa_type_format_video {
uint32_t format;
uint32_t size;
uint32_t framerate;
uint32_t max_framerate;
uint32_t views;
uint32_t interlace_mode;
uint32_t pixel_aspect_ratio;
uint32_t multiview_mode;
uint32_t multiview_flags;
uint32_t chroma_site;
uint32_t color_range;
uint32_t color_matrix;
uint32_t transfer_function;
uint32_t color_primaries;
uint32_t profile;
uint32_t level;
uint32_t stream_format;
uint32_t alignment;
};
static inline void
spa_type_format_video_map(struct spa_type_map *map, struct spa_type_format_video *type)
{
if (type->format == 0) {
type->format = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__format);
type->size = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__size);
type->framerate = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__framerate);
type->max_framerate = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__maxFramerate);
type->views = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__views);
type->interlace_mode = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__interlaceMode);
type->pixel_aspect_ratio = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__pixelAspectRatio);
type->multiview_mode = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__multiviewMode);
type->multiview_flags = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__multiviewFlags);
type->chroma_site = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__chromaSite);
type->color_range = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__colorRange);
type->color_matrix = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__colorMatrix);
type->transfer_function = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__transferFunction);
type->color_primaries = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__colorPrimaries);
type->profile = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__profile);
type->level = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__level);
type->stream_format = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__streamFormat);
type->alignment = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__alignment);
}
}
static inline int
spa_format_video_raw_parse(const struct spa_pod *format,
struct spa_video_info_raw *info, struct spa_type_format_video *type)
struct spa_video_info_raw *info)
{
return spa_pod_object_parse(format,
":",type->format, "I", &info->format,
":",type->size, "R", &info->size,
":",type->framerate, "F", &info->framerate,
":",type->max_framerate, "?F", &info->max_framerate,
":",type->views, "?i", &info->views,
":",type->interlace_mode, "?i", &info->interlace_mode,
":",type->pixel_aspect_ratio, "?F", &info->pixel_aspect_ratio,
":",type->multiview_mode, "?i", &info->multiview_mode,
":",type->multiview_flags, "?i", &info->multiview_flags,
":",type->chroma_site, "?i", &info->chroma_site,
":",type->color_range, "?i", &info->color_range,
":",type->color_matrix, "?i", &info->color_matrix,
":",type->transfer_function, "?i", &info->transfer_function,
":",type->color_primaries, "?i", &info->color_primaries, NULL);
":", SPA_FORMAT_VIDEO_format, "I", &info->format,
":", SPA_FORMAT_VIDEO_size, "R", &info->size,
":", SPA_FORMAT_VIDEO_framerate, "F", &info->framerate,
":", SPA_FORMAT_VIDEO_maxFramerate, "?F", &info->max_framerate,
":", SPA_FORMAT_VIDEO_views, "?i", &info->views,
":", SPA_FORMAT_VIDEO_interlaceMode, "?i", &info->interlace_mode,
":", SPA_FORMAT_VIDEO_pixelAspectRatio, "?F", &info->pixel_aspect_ratio,
":", SPA_FORMAT_VIDEO_multiviewMode, "?i", &info->multiview_mode,
":", SPA_FORMAT_VIDEO_multiviewFlags, "?i", &info->multiview_flags,
":", SPA_FORMAT_VIDEO_chromaSite, "?i", &info->chroma_site,
":", SPA_FORMAT_VIDEO_colorRange, "?i", &info->color_range,
":", SPA_FORMAT_VIDEO_colorMatrix, "?i", &info->color_matrix,
":", SPA_FORMAT_VIDEO_transferFunction, "?i", &info->transfer_function,
":", SPA_FORMAT_VIDEO_colorPrimaries, "?i", &info->color_primaries, NULL);
}
static inline int
spa_format_video_h264_parse(const struct spa_pod *format,
struct spa_video_info_h264 *info, struct spa_type_format_video *type)
struct spa_video_info_h264 *info)
{
return spa_pod_object_parse(format,
":",type->size, "?R", &info->size,
":",type->framerate, "?F", &info->framerate,
":",type->max_framerate, "?F", &info->max_framerate,
":",type->stream_format, "?i", &info->stream_format,
":",type->alignment, "?i", &info->alignment, NULL);
":", SPA_FORMAT_VIDEO_size, "?R", &info->size,
":", SPA_FORMAT_VIDEO_framerate, "?F", &info->framerate,
":", SPA_FORMAT_VIDEO_maxFramerate, "?F", &info->max_framerate,
":", SPA_FORMAT_VIDEO_streamFormat, "?i", &info->stream_format,
":", SPA_FORMAT_VIDEO_alignment, "?i", &info->alignment, NULL);
}
static inline int
spa_format_video_mjpg_parse(const struct spa_pod *format,
struct spa_video_info_mjpg *info, struct spa_type_format_video *type)
struct spa_video_info_mjpg *info)
{
return spa_pod_object_parse(format,
":",type->size, "?R", &info->size,
":",type->framerate, "?F", &info->framerate,
":",type->max_framerate, "?F", &info->max_framerate, NULL);
":", SPA_FORMAT_VIDEO_size, "?R", &info->size,
":", SPA_FORMAT_VIDEO_framerate, "?F", &info->framerate,
":", SPA_FORMAT_VIDEO_maxFramerate, "?F", &info->max_framerate, NULL);
}
#ifdef __cplusplus

View file

@ -24,10 +24,32 @@
extern "C" {
#endif
#include <spa/param/format-utils.h>
#include <spa/param/video/raw.h>
#include <spa/param/video/encoded.h>
/** properties for audio SPA_ID_OBJECT_Format */
enum spa_format_video {
SPA_FORMAT_VIDEO_format,
SPA_FORMAT_VIDEO_size,
SPA_FORMAT_VIDEO_framerate,
SPA_FORMAT_VIDEO_maxFramerate,
SPA_FORMAT_VIDEO_views,
SPA_FORMAT_VIDEO_interlaceMode,
SPA_FORMAT_VIDEO_pixelAspectRatio,
SPA_FORMAT_VIDEO_multiviewMode,
SPA_FORMAT_VIDEO_multiviewFlags,
SPA_FORMAT_VIDEO_chromaSite,
SPA_FORMAT_VIDEO_colorRange,
SPA_FORMAT_VIDEO_colorMatrix,
SPA_FORMAT_VIDEO_transferFunction,
SPA_FORMAT_VIDEO_colorPrimaries,
SPA_FORMAT_VIDEO_profile,
SPA_FORMAT_VIDEO_level,
SPA_FORMAT_VIDEO_streamFormat,
SPA_FORMAT_VIDEO_alignment,
};
#if 0
#define SPA_TYPE_FORMAT__Video SPA_TYPE_FORMAT_BASE "Video"
#define SPA_TYPE_FORMAT_VIDEO_BASE SPA_TYPE_FORMAT__Video ":"
@ -49,6 +71,7 @@ extern "C" {
#define SPA_TYPE_FORMAT_VIDEO__level SPA_TYPE_FORMAT_VIDEO_BASE "level"
#define SPA_TYPE_FORMAT_VIDEO__streamFormat SPA_TYPE_FORMAT_VIDEO_BASE "stream-format"
#define SPA_TYPE_FORMAT_VIDEO__alignment SPA_TYPE_FORMAT_VIDEO_BASE "alignment"
#endif
struct spa_video_info {
uint32_t media_type;

View file

@ -0,0 +1,117 @@
/* 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_VIDEO_RAW_TYPES_H__
#define __SPA_VIDEO_RAW_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/param/video/raw.h>
#define SPA_TYPE__VideoFormat SPA_TYPE_ENUM_BASE "VideoFormat"
#define SPA_TYPE_VIDEO_FORMAT_BASE SPA_TYPE__VideoFormat ":"
static const struct spa_type_info spa_type_video_format[] = {
{ SPA_VIDEO_FORMAT_ENCODED, SPA_TYPE_VIDEO_FORMAT_BASE "encoded", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_I420, SPA_TYPE_VIDEO_FORMAT_BASE "I420", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_YV12, SPA_TYPE_VIDEO_FORMAT_BASE "YV12", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_YUY2, SPA_TYPE_VIDEO_FORMAT_BASE "YUY2", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_UYVY, SPA_TYPE_VIDEO_FORMAT_BASE "UYVY", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_AYUV, SPA_TYPE_VIDEO_FORMAT_BASE "AYUV", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_RGBx, SPA_TYPE_VIDEO_FORMAT_BASE "RGBx", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_BGRx, SPA_TYPE_VIDEO_FORMAT_BASE "BGRx", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_xRGB, SPA_TYPE_VIDEO_FORMAT_BASE "xRGB", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_xBGR, SPA_TYPE_VIDEO_FORMAT_BASE "xBGR", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_RGBA, SPA_TYPE_VIDEO_FORMAT_BASE "RGBA", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_BGRA, SPA_TYPE_VIDEO_FORMAT_BASE "BGRA", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_ARGB, SPA_TYPE_VIDEO_FORMAT_BASE "ARGB", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_ABGR, SPA_TYPE_VIDEO_FORMAT_BASE "ABGR", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_RGB, SPA_TYPE_VIDEO_FORMAT_BASE "RGB", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_BGR, SPA_TYPE_VIDEO_FORMAT_BASE "BGR", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_Y41B, SPA_TYPE_VIDEO_FORMAT_BASE "Y41B", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_Y42B, SPA_TYPE_VIDEO_FORMAT_BASE "Y42B", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_YVYU, SPA_TYPE_VIDEO_FORMAT_BASE "YVYU", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_Y444, SPA_TYPE_VIDEO_FORMAT_BASE "Y444", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_v210, SPA_TYPE_VIDEO_FORMAT_BASE "v210", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_v216, SPA_TYPE_VIDEO_FORMAT_BASE "v216", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_NV12, SPA_TYPE_VIDEO_FORMAT_BASE "NV12", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_NV21, SPA_TYPE_VIDEO_FORMAT_BASE "NV21", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GRAY8, SPA_TYPE_VIDEO_FORMAT_BASE "GRAY8", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GRAY16_BE, SPA_TYPE_VIDEO_FORMAT_BASE "GRAY16_BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GRAY16_LE, SPA_TYPE_VIDEO_FORMAT_BASE "GRAY16_LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_v308, SPA_TYPE_VIDEO_FORMAT_BASE "v308", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_RGB16, SPA_TYPE_VIDEO_FORMAT_BASE "RGB16", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_BGR16, SPA_TYPE_VIDEO_FORMAT_BASE "BGR16", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_RGB15, SPA_TYPE_VIDEO_FORMAT_BASE "RGB15", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_BGR15, SPA_TYPE_VIDEO_FORMAT_BASE "BGR15", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_UYVP, SPA_TYPE_VIDEO_FORMAT_BASE "UYVP", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_A420, SPA_TYPE_VIDEO_FORMAT_BASE "A420", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_RGB8P, SPA_TYPE_VIDEO_FORMAT_BASE "RGB8P", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_YUV9, SPA_TYPE_VIDEO_FORMAT_BASE "YUV9", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_YVU9, SPA_TYPE_VIDEO_FORMAT_BASE "YVU9", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_IYU1, SPA_TYPE_VIDEO_FORMAT_BASE "IYU1", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_ARGB64, SPA_TYPE_VIDEO_FORMAT_BASE "ARGB64", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_AYUV64, SPA_TYPE_VIDEO_FORMAT_BASE "AYUV64", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_r210, SPA_TYPE_VIDEO_FORMAT_BASE "r210", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_I420_10BE, SPA_TYPE_VIDEO_FORMAT_BASE "I420_10BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_I420_10LE, SPA_TYPE_VIDEO_FORMAT_BASE "I420_10LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_I422_10BE, SPA_TYPE_VIDEO_FORMAT_BASE "I422_10BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_I422_10LE, SPA_TYPE_VIDEO_FORMAT_BASE "I422_10LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_Y444_10BE, SPA_TYPE_VIDEO_FORMAT_BASE "Y444_10BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_Y444_10LE, SPA_TYPE_VIDEO_FORMAT_BASE "Y444_10LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GBR, SPA_TYPE_VIDEO_FORMAT_BASE "GBR", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GBR_10BE, SPA_TYPE_VIDEO_FORMAT_BASE "GBR_10BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GBR_10LE, SPA_TYPE_VIDEO_FORMAT_BASE "GBR_10LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_NV16, SPA_TYPE_VIDEO_FORMAT_BASE "NV16", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_NV24, SPA_TYPE_VIDEO_FORMAT_BASE "NV24", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_NV12_64Z32, SPA_TYPE_VIDEO_FORMAT_BASE "NV12_64Z32", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_A420_10BE, SPA_TYPE_VIDEO_FORMAT_BASE "A420_10BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_A420_10LE, SPA_TYPE_VIDEO_FORMAT_BASE "A420_10LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_A422_10BE, SPA_TYPE_VIDEO_FORMAT_BASE "A422_10BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_A422_10LE, SPA_TYPE_VIDEO_FORMAT_BASE "A422_10LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_A444_10BE, SPA_TYPE_VIDEO_FORMAT_BASE "A444_10BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_A444_10LE, SPA_TYPE_VIDEO_FORMAT_BASE "A444_10LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_NV61, SPA_TYPE_VIDEO_FORMAT_BASE "NV61", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_P010_10BE, SPA_TYPE_VIDEO_FORMAT_BASE "P010_10BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_P010_10LE, SPA_TYPE_VIDEO_FORMAT_BASE "P010_10LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_IYU2, SPA_TYPE_VIDEO_FORMAT_BASE "IYU2", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_VYUY, SPA_TYPE_VIDEO_FORMAT_BASE "VYUY", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GBRA, SPA_TYPE_VIDEO_FORMAT_BASE "GBRA", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GBRA_10BE, SPA_TYPE_VIDEO_FORMAT_BASE "GBRA_10BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GBRA_10LE, SPA_TYPE_VIDEO_FORMAT_BASE "GBRA_10LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GBR_12BE, SPA_TYPE_VIDEO_FORMAT_BASE "GBR_12BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GBR_12LE, SPA_TYPE_VIDEO_FORMAT_BASE "GBR_12LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GBRA_12BE, SPA_TYPE_VIDEO_FORMAT_BASE "GBRA_12BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_GBRA_12LE, SPA_TYPE_VIDEO_FORMAT_BASE "GBRA_12LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_I420_12BE, SPA_TYPE_VIDEO_FORMAT_BASE "I420_12BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_I420_12LE, SPA_TYPE_VIDEO_FORMAT_BASE "I420_12LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_I422_12BE, SPA_TYPE_VIDEO_FORMAT_BASE "I422_12BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_I422_12LE, SPA_TYPE_VIDEO_FORMAT_BASE "I422_12LE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_Y444_12BE, SPA_TYPE_VIDEO_FORMAT_BASE "Y444_12BE", SPA_POD_TYPE_INT, },
{ SPA_VIDEO_FORMAT_Y444_12LE, SPA_TYPE_VIDEO_FORMAT_BASE "Y444_12LE", SPA_POD_TYPE_INT, },
{ 0, NULL, },
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_VIDEO_RAW_TYPES_H__ */

View file

@ -1,200 +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_VIDEO_RAW_UTILS_H__
#define __SPA_VIDEO_RAW_UTILS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/support/type-map.h>
#include <spa/param/video/raw.h>
struct spa_type_video_format {
uint32_t UNKNOWN;
uint32_t ENCODED;
uint32_t I420;
uint32_t YV12;
uint32_t YUY2;
uint32_t UYVY;
uint32_t AYUV;
uint32_t RGBx;
uint32_t BGRx;
uint32_t xRGB;
uint32_t xBGR;
uint32_t RGBA;
uint32_t BGRA;
uint32_t ARGB;
uint32_t ABGR;
uint32_t RGB;
uint32_t BGR;
uint32_t Y41B;
uint32_t Y42B;
uint32_t YVYU;
uint32_t Y444;
uint32_t v210;
uint32_t v216;
uint32_t NV12;
uint32_t NV21;
uint32_t GRAY8;
uint32_t GRAY16_BE;
uint32_t GRAY16_LE;
uint32_t v308;
uint32_t RGB16;
uint32_t BGR16;
uint32_t RGB15;
uint32_t BGR15;
uint32_t UYVP;
uint32_t A420;
uint32_t RGB8P;
uint32_t YUV9;
uint32_t YVU9;
uint32_t IYU1;
uint32_t ARGB64;
uint32_t AYUV64;
uint32_t r210;
uint32_t I420_10BE;
uint32_t I420_10LE;
uint32_t I422_10BE;
uint32_t I422_10LE;
uint32_t Y444_10BE;
uint32_t Y444_10LE;
uint32_t GBR;
uint32_t GBR_10BE;
uint32_t GBR_10LE;
uint32_t NV16;
uint32_t NV24;
uint32_t NV12_64Z32;
uint32_t A420_10BE;
uint32_t A420_10LE;
uint32_t A422_10BE;
uint32_t A422_10LE;
uint32_t A444_10BE;
uint32_t A444_10LE;
uint32_t NV61;
uint32_t P010_10BE;
uint32_t P010_10LE;
uint32_t IYU2;
uint32_t VYUY;
uint32_t GBRA;
uint32_t GBRA_10BE;
uint32_t GBRA_10LE;
uint32_t GBR_12BE;
uint32_t GBR_12LE;
uint32_t GBRA_12BE;
uint32_t GBRA_12LE;
uint32_t I420_12BE;
uint32_t I420_12LE;
uint32_t I422_12BE;
uint32_t I422_12LE;
uint32_t Y444_12BE;
uint32_t Y444_12LE;
};
static inline void
spa_type_video_format_map(struct spa_type_map *map, struct spa_type_video_format *type)
{
if (type->ENCODED == 0) {
type->UNKNOWN = 0;
type->ENCODED = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__ENCODED);
type->I420 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I420);
type->YV12 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__YV12);
type->YUY2 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__YUY2);
type->UYVY = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__UYVY);
type->AYUV = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__AYUV);
type->RGBx = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__RGBx);
type->BGRx = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__BGRx);
type->xRGB = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__xRGB);
type->xBGR = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__xBGR);
type->RGBA = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__RGBA);
type->BGRA = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__BGRA);
type->ARGB = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__ARGB);
type->ABGR = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__ABGR);
type->RGB = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__RGB);
type->BGR = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__BGR);
type->Y41B = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y41B);
type->Y42B = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y42B);
type->YVYU = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__YVYU);
type->Y444 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y444);
type->v210 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__v210);
type->v216 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__v216);
type->NV12 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__NV12);
type->NV21 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__NV21);
type->GRAY8 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GRAY8);
type->GRAY16_BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GRAY16_BE);
type->GRAY16_LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GRAY16_LE);
type->v308 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__v308);
type->RGB16 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__RGB16);
type->BGR16 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__BGR16);
type->RGB15 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__RGB15);
type->BGR15 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__BGR15);
type->UYVP = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__UYVP);
type->A420 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A420);
type->RGB8P = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__RGB8P);
type->YUV9 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__YUV9);
type->YVU9 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__YVU9);
type->IYU1 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__IYU1);
type->ARGB64 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__ARGB64);
type->AYUV64 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__AYUV64);
type->r210 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__r210);
type->I420_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I420_10BE);
type->I420_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I420_10LE);
type->I422_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I422_10BE);
type->I422_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I422_10LE);
type->Y444_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y444_10BE);
type->Y444_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y444_10LE);
type->GBR = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBR);
type->GBR_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBR_10BE);
type->GBR_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBR_10LE);
type->NV16 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__NV16);
type->NV24 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__NV24);
type->NV12_64Z32 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__NV12_64Z32);
type->A420_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A420_10BE);
type->A420_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A420_10LE);
type->A422_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A422_10BE);
type->A422_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A422_10LE);
type->A444_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A444_10BE);
type->A444_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A444_10LE);
type->NV61 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__NV61);
type->P010_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__P010_10BE);
type->P010_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__P010_10LE);
type->IYU2 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__IYU2);
type->VYUY = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__VYUY);
type->GBRA = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBRA);
type->GBRA_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBRA_10BE);
type->GBRA_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBRA_10LE);
type->GBR_12BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBR_12BE);
type->GBR_12LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBR_12LE);
type->GBRA_12BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBRA_12BE);
type->GBRA_12LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBRA_12LE);
type->I420_12BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I420_12BE);
type->I420_12LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I420_12LE);
type->I422_12BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I422_12BE);
type->I422_12LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I422_12LE);
type->Y444_12BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y444_12BE);
type->Y444_12LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y444_12LE);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_VIDEO_RAW_UTILS_H__ */

View file

@ -24,6 +24,7 @@
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/param/video/chroma.h>
#include <spa/param/video/color.h>
#include <spa/param/video/multiview.h>
@ -31,86 +32,86 @@ extern "C" {
#define SPA_VIDEO_MAX_PLANES 4
#define SPA_VIDEO_MAX_COMPONENTS 4
#define SPA_TYPE__VideoFormat SPA_TYPE_ENUM_BASE "VideoFormat"
#define SPA_TYPE_VIDEO_FORMAT_BASE SPA_TYPE__VideoFormat ":"
#define SPA_TYPE_VIDEO_FORMAT__ENCODED SPA_TYPE_VIDEO_FORMAT_BASE "encoded"
#define SPA_TYPE_VIDEO_FORMAT__I420 SPA_TYPE_VIDEO_FORMAT_BASE "I420"
#define SPA_TYPE_VIDEO_FORMAT__YV12 SPA_TYPE_VIDEO_FORMAT_BASE "YV12"
#define SPA_TYPE_VIDEO_FORMAT__YUY2 SPA_TYPE_VIDEO_FORMAT_BASE "YUY2"
#define SPA_TYPE_VIDEO_FORMAT__UYVY SPA_TYPE_VIDEO_FORMAT_BASE "UYVY"
#define SPA_TYPE_VIDEO_FORMAT__AYUV SPA_TYPE_VIDEO_FORMAT_BASE "AYUV"
#define SPA_TYPE_VIDEO_FORMAT__RGBx SPA_TYPE_VIDEO_FORMAT_BASE "RGBx"
#define SPA_TYPE_VIDEO_FORMAT__BGRx SPA_TYPE_VIDEO_FORMAT_BASE "BGRx"
#define SPA_TYPE_VIDEO_FORMAT__xRGB SPA_TYPE_VIDEO_FORMAT_BASE "xRGB"
#define SPA_TYPE_VIDEO_FORMAT__xBGR SPA_TYPE_VIDEO_FORMAT_BASE "xBGR"
#define SPA_TYPE_VIDEO_FORMAT__RGBA SPA_TYPE_VIDEO_FORMAT_BASE "RGBA"
#define SPA_TYPE_VIDEO_FORMAT__BGRA SPA_TYPE_VIDEO_FORMAT_BASE "BGRA"
#define SPA_TYPE_VIDEO_FORMAT__ARGB SPA_TYPE_VIDEO_FORMAT_BASE "ARGB"
#define SPA_TYPE_VIDEO_FORMAT__ABGR SPA_TYPE_VIDEO_FORMAT_BASE "ABGR"
#define SPA_TYPE_VIDEO_FORMAT__RGB SPA_TYPE_VIDEO_FORMAT_BASE "RGB"
#define SPA_TYPE_VIDEO_FORMAT__BGR SPA_TYPE_VIDEO_FORMAT_BASE "BGR"
#define SPA_TYPE_VIDEO_FORMAT__Y41B SPA_TYPE_VIDEO_FORMAT_BASE "Y41B"
#define SPA_TYPE_VIDEO_FORMAT__Y42B SPA_TYPE_VIDEO_FORMAT_BASE "Y42B"
#define SPA_TYPE_VIDEO_FORMAT__YVYU SPA_TYPE_VIDEO_FORMAT_BASE "YVYU"
#define SPA_TYPE_VIDEO_FORMAT__Y444 SPA_TYPE_VIDEO_FORMAT_BASE "Y444"
#define SPA_TYPE_VIDEO_FORMAT__v210 SPA_TYPE_VIDEO_FORMAT_BASE "v210"
#define SPA_TYPE_VIDEO_FORMAT__v216 SPA_TYPE_VIDEO_FORMAT_BASE "v216"
#define SPA_TYPE_VIDEO_FORMAT__NV12 SPA_TYPE_VIDEO_FORMAT_BASE "NV12"
#define SPA_TYPE_VIDEO_FORMAT__NV21 SPA_TYPE_VIDEO_FORMAT_BASE "NV21"
#define SPA_TYPE_VIDEO_FORMAT__GRAY8 SPA_TYPE_VIDEO_FORMAT_BASE "GRAY8"
#define SPA_TYPE_VIDEO_FORMAT__GRAY16_BE SPA_TYPE_VIDEO_FORMAT_BASE "GRAY16_BE"
#define SPA_TYPE_VIDEO_FORMAT__GRAY16_LE SPA_TYPE_VIDEO_FORMAT_BASE "GRAY16_LE"
#define SPA_TYPE_VIDEO_FORMAT__v308 SPA_TYPE_VIDEO_FORMAT_BASE "v308"
#define SPA_TYPE_VIDEO_FORMAT__RGB16 SPA_TYPE_VIDEO_FORMAT_BASE "RGB16"
#define SPA_TYPE_VIDEO_FORMAT__BGR16 SPA_TYPE_VIDEO_FORMAT_BASE "BGR16"
#define SPA_TYPE_VIDEO_FORMAT__RGB15 SPA_TYPE_VIDEO_FORMAT_BASE "RGB15"
#define SPA_TYPE_VIDEO_FORMAT__BGR15 SPA_TYPE_VIDEO_FORMAT_BASE "BGR15"
#define SPA_TYPE_VIDEO_FORMAT__UYVP SPA_TYPE_VIDEO_FORMAT_BASE "UYVP"
#define SPA_TYPE_VIDEO_FORMAT__A420 SPA_TYPE_VIDEO_FORMAT_BASE "A420"
#define SPA_TYPE_VIDEO_FORMAT__RGB8P SPA_TYPE_VIDEO_FORMAT_BASE "RGB8P"
#define SPA_TYPE_VIDEO_FORMAT__YUV9 SPA_TYPE_VIDEO_FORMAT_BASE "YUV9"
#define SPA_TYPE_VIDEO_FORMAT__YVU9 SPA_TYPE_VIDEO_FORMAT_BASE "YVU9"
#define SPA_TYPE_VIDEO_FORMAT__IYU1 SPA_TYPE_VIDEO_FORMAT_BASE "IYU1"
#define SPA_TYPE_VIDEO_FORMAT__ARGB64 SPA_TYPE_VIDEO_FORMAT_BASE "ARGB64"
#define SPA_TYPE_VIDEO_FORMAT__AYUV64 SPA_TYPE_VIDEO_FORMAT_BASE "AYUV64"
#define SPA_TYPE_VIDEO_FORMAT__r210 SPA_TYPE_VIDEO_FORMAT_BASE "r210"
#define SPA_TYPE_VIDEO_FORMAT__I420_10BE SPA_TYPE_VIDEO_FORMAT_BASE "I420_10BE"
#define SPA_TYPE_VIDEO_FORMAT__I420_10LE SPA_TYPE_VIDEO_FORMAT_BASE "I420_10LE"
#define SPA_TYPE_VIDEO_FORMAT__I422_10BE SPA_TYPE_VIDEO_FORMAT_BASE "I422_10BE"
#define SPA_TYPE_VIDEO_FORMAT__I422_10LE SPA_TYPE_VIDEO_FORMAT_BASE "I422_10LE"
#define SPA_TYPE_VIDEO_FORMAT__Y444_10BE SPA_TYPE_VIDEO_FORMAT_BASE "Y444_10BE"
#define SPA_TYPE_VIDEO_FORMAT__Y444_10LE SPA_TYPE_VIDEO_FORMAT_BASE "Y444_10LE"
#define SPA_TYPE_VIDEO_FORMAT__GBR SPA_TYPE_VIDEO_FORMAT_BASE "GBR"
#define SPA_TYPE_VIDEO_FORMAT__GBR_10BE SPA_TYPE_VIDEO_FORMAT_BASE "GBR_10BE"
#define SPA_TYPE_VIDEO_FORMAT__GBR_10LE SPA_TYPE_VIDEO_FORMAT_BASE "GBR_10LE"
#define SPA_TYPE_VIDEO_FORMAT__NV16 SPA_TYPE_VIDEO_FORMAT_BASE "NV16"
#define SPA_TYPE_VIDEO_FORMAT__NV24 SPA_TYPE_VIDEO_FORMAT_BASE "NV24"
#define SPA_TYPE_VIDEO_FORMAT__NV12_64Z32 SPA_TYPE_VIDEO_FORMAT_BASE "NV12_64Z32"
#define SPA_TYPE_VIDEO_FORMAT__A420_10BE SPA_TYPE_VIDEO_FORMAT_BASE "A420_10BE"
#define SPA_TYPE_VIDEO_FORMAT__A420_10LE SPA_TYPE_VIDEO_FORMAT_BASE "A420_10LE"
#define SPA_TYPE_VIDEO_FORMAT__A422_10BE SPA_TYPE_VIDEO_FORMAT_BASE "A422_10BE"
#define SPA_TYPE_VIDEO_FORMAT__A422_10LE SPA_TYPE_VIDEO_FORMAT_BASE "A422_10LE"
#define SPA_TYPE_VIDEO_FORMAT__A444_10BE SPA_TYPE_VIDEO_FORMAT_BASE "A444_10BE"
#define SPA_TYPE_VIDEO_FORMAT__A444_10LE SPA_TYPE_VIDEO_FORMAT_BASE "A444_10LE"
#define SPA_TYPE_VIDEO_FORMAT__NV61 SPA_TYPE_VIDEO_FORMAT_BASE "NV61"
#define SPA_TYPE_VIDEO_FORMAT__P010_10BE SPA_TYPE_VIDEO_FORMAT_BASE "P010_10BE"
#define SPA_TYPE_VIDEO_FORMAT__P010_10LE SPA_TYPE_VIDEO_FORMAT_BASE "P010_10LE"
#define SPA_TYPE_VIDEO_FORMAT__IYU2 SPA_TYPE_VIDEO_FORMAT_BASE "IYU2"
#define SPA_TYPE_VIDEO_FORMAT__VYUY SPA_TYPE_VIDEO_FORMAT_BASE "VYUY"
#define SPA_TYPE_VIDEO_FORMAT__GBRA SPA_TYPE_VIDEO_FORMAT_BASE "GBRA"
#define SPA_TYPE_VIDEO_FORMAT__GBRA_10BE SPA_TYPE_VIDEO_FORMAT_BASE "GBRA_10BE"
#define SPA_TYPE_VIDEO_FORMAT__GBRA_10LE SPA_TYPE_VIDEO_FORMAT_BASE "GBRA_10LE"
#define SPA_TYPE_VIDEO_FORMAT__GBR_12BE SPA_TYPE_VIDEO_FORMAT_BASE "GBR_12BE"
#define SPA_TYPE_VIDEO_FORMAT__GBR_12LE SPA_TYPE_VIDEO_FORMAT_BASE "GBR_12LE"
#define SPA_TYPE_VIDEO_FORMAT__GBRA_12BE SPA_TYPE_VIDEO_FORMAT_BASE "GBRA_12BE"
#define SPA_TYPE_VIDEO_FORMAT__GBRA_12LE SPA_TYPE_VIDEO_FORMAT_BASE "GBRA_12LE"
#define SPA_TYPE_VIDEO_FORMAT__I420_12BE SPA_TYPE_VIDEO_FORMAT_BASE "I420_12BE"
#define SPA_TYPE_VIDEO_FORMAT__I420_12LE SPA_TYPE_VIDEO_FORMAT_BASE "I420_12LE"
#define SPA_TYPE_VIDEO_FORMAT__I422_12BE SPA_TYPE_VIDEO_FORMAT_BASE "I422_12BE"
#define SPA_TYPE_VIDEO_FORMAT__I422_12LE SPA_TYPE_VIDEO_FORMAT_BASE "I422_12LE"
#define SPA_TYPE_VIDEO_FORMAT__Y444_12BE SPA_TYPE_VIDEO_FORMAT_BASE "Y444_12BE"
#define SPA_TYPE_VIDEO_FORMAT__Y444_12LE SPA_TYPE_VIDEO_FORMAT_BASE "Y444_12LE"
enum spa_video_format {
SPA_VIDEO_FORMAT_UNKNOWN,
SPA_VIDEO_FORMAT_ENCODED,
SPA_VIDEO_FORMAT_I420,
SPA_VIDEO_FORMAT_YV12,
SPA_VIDEO_FORMAT_YUY2,
SPA_VIDEO_FORMAT_UYVY,
SPA_VIDEO_FORMAT_AYUV,
SPA_VIDEO_FORMAT_RGBx,
SPA_VIDEO_FORMAT_BGRx,
SPA_VIDEO_FORMAT_xRGB,
SPA_VIDEO_FORMAT_xBGR,
SPA_VIDEO_FORMAT_RGBA,
SPA_VIDEO_FORMAT_BGRA,
SPA_VIDEO_FORMAT_ARGB,
SPA_VIDEO_FORMAT_ABGR,
SPA_VIDEO_FORMAT_RGB,
SPA_VIDEO_FORMAT_BGR,
SPA_VIDEO_FORMAT_Y41B,
SPA_VIDEO_FORMAT_Y42B,
SPA_VIDEO_FORMAT_YVYU,
SPA_VIDEO_FORMAT_Y444,
SPA_VIDEO_FORMAT_v210,
SPA_VIDEO_FORMAT_v216,
SPA_VIDEO_FORMAT_NV12,
SPA_VIDEO_FORMAT_NV21,
SPA_VIDEO_FORMAT_GRAY8,
SPA_VIDEO_FORMAT_GRAY16_BE,
SPA_VIDEO_FORMAT_GRAY16_LE,
SPA_VIDEO_FORMAT_v308,
SPA_VIDEO_FORMAT_RGB16,
SPA_VIDEO_FORMAT_BGR16,
SPA_VIDEO_FORMAT_RGB15,
SPA_VIDEO_FORMAT_BGR15,
SPA_VIDEO_FORMAT_UYVP,
SPA_VIDEO_FORMAT_A420,
SPA_VIDEO_FORMAT_RGB8P,
SPA_VIDEO_FORMAT_YUV9,
SPA_VIDEO_FORMAT_YVU9,
SPA_VIDEO_FORMAT_IYU1,
SPA_VIDEO_FORMAT_ARGB64,
SPA_VIDEO_FORMAT_AYUV64,
SPA_VIDEO_FORMAT_r210,
SPA_VIDEO_FORMAT_I420_10BE,
SPA_VIDEO_FORMAT_I420_10LE,
SPA_VIDEO_FORMAT_I422_10BE,
SPA_VIDEO_FORMAT_I422_10LE,
SPA_VIDEO_FORMAT_Y444_10BE,
SPA_VIDEO_FORMAT_Y444_10LE,
SPA_VIDEO_FORMAT_GBR,
SPA_VIDEO_FORMAT_GBR_10BE,
SPA_VIDEO_FORMAT_GBR_10LE,
SPA_VIDEO_FORMAT_NV16,
SPA_VIDEO_FORMAT_NV24,
SPA_VIDEO_FORMAT_NV12_64Z32,
SPA_VIDEO_FORMAT_A420_10BE,
SPA_VIDEO_FORMAT_A420_10LE,
SPA_VIDEO_FORMAT_A422_10BE,
SPA_VIDEO_FORMAT_A422_10LE,
SPA_VIDEO_FORMAT_A444_10BE,
SPA_VIDEO_FORMAT_A444_10LE,
SPA_VIDEO_FORMAT_NV61,
SPA_VIDEO_FORMAT_P010_10BE,
SPA_VIDEO_FORMAT_P010_10LE,
SPA_VIDEO_FORMAT_IYU2,
SPA_VIDEO_FORMAT_VYUY,
SPA_VIDEO_FORMAT_GBRA,
SPA_VIDEO_FORMAT_GBRA_10BE,
SPA_VIDEO_FORMAT_GBRA_10LE,
SPA_VIDEO_FORMAT_GBR_12BE,
SPA_VIDEO_FORMAT_GBR_12LE,
SPA_VIDEO_FORMAT_GBRA_12BE,
SPA_VIDEO_FORMAT_GBRA_12LE,
SPA_VIDEO_FORMAT_I420_12BE,
SPA_VIDEO_FORMAT_I420_12LE,
SPA_VIDEO_FORMAT_I422_12BE,
SPA_VIDEO_FORMAT_I422_12LE,
SPA_VIDEO_FORMAT_Y444_12BE,
SPA_VIDEO_FORMAT_Y444_12LE,
};
/**
* spa_video_flags:
@ -174,7 +175,7 @@ enum spa_video_interlace_mode {
* @color_primaries: color primaries. used to convert between R'G'B' and CIE XYZ
*/
struct spa_video_info_raw {
uint32_t format;
enum spa_video_format format;
struct spa_rectangle size;
struct spa_fraction framerate;
struct spa_fraction max_framerate;

View file

@ -0,0 +1,36 @@
/* 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_COMMAND_TYPES_H__
#define __SPA_COMMAND_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/type-info.h>
#define SPA_TYPE__Command SPA_TYPE_POD_OBJECT_BASE "Command"
#define SPA_TYPE_COMMAND_BASE SPA_TYPE__Command ":"
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_COMMAND_TYPES_H__ */

View file

@ -27,9 +27,6 @@ extern "C" {
#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 ":"
struct spa_command_body {
struct spa_pod_object_body body;
};

View file

@ -0,0 +1,36 @@
/* 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_EVENT_TYPES_H__
#define __SPA_EVENT_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/pod/pod-types.h>
#define SPA_TYPE__Event SPA_TYPE_POD_OBJECT_BASE "Event"
#define SPA_TYPE_EVENT_BASE SPA_TYPE__Event ":"
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_EVENT_TYPES_H__ */

View file

@ -26,9 +26,6 @@ extern "C" {
#include <spa/pod/pod.h>
#define SPA_TYPE__Event SPA_TYPE_POD_OBJECT_BASE "Event"
#define SPA_TYPE_EVENT_BASE SPA_TYPE__Event ":"
struct spa_event_body {
struct spa_pod_object_body body;
};

View file

@ -0,0 +1,43 @@
/* 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_TYPES_H__
#define __SPA_POD_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/type-info.h>
#include <spa/pod/pod.h>
#define SPA_TYPE__POD SPA_TYPE_BASE "POD"
#define SPA_TYPE_POD_BASE SPA_TYPE__POD ":"
#define SPA_TYPE_POD__Object SPA_TYPE_POD_BASE "Object"
#define SPA_TYPE_POD_OBJECT_BASE SPA_TYPE_POD__Object ":"
#define SPA_TYPE_POD__Struct SPA_TYPE_POD_BASE "Struct"
#define SPA_TYPE_POD_STRUCT_BASE SPA_TYPE_POD__Struct ":"
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_POD_TYPES_H__ */

View file

@ -28,15 +28,6 @@ extern "C" {
#include <spa/utils/defs.h>
#define SPA_TYPE__POD SPA_TYPE_BASE "POD"
#define SPA_TYPE_POD_BASE SPA_TYPE__POD ":"
#define SPA_TYPE_POD__Object SPA_TYPE_POD_BASE "Object"
#define SPA_TYPE_POD_OBJECT_BASE SPA_TYPE_POD__Object ":"
#define SPA_TYPE_POD__Struct SPA_TYPE_POD_BASE "Struct"
#define SPA_TYPE_POD_STRUCT_BASE SPA_TYPE_POD__Struct ":"
#ifndef SPA_POD_MAX_DEPTH
#define SPA_POD_MAX_DEPTH 16
#endif

View file

@ -0,0 +1,43 @@
/* 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_LOOP_TYPES_H__
#define __SPA_LOOP_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/support/loop.h>
#include <spa/utils/type-info.h>
#define SPA_TYPE__Loop SPA_TYPE_INTERFACE_BASE "Loop"
#define SPA_TYPE_LOOP_BASE SPA_TYPE__Loop ":"
#define SPA_TYPE__LoopControl SPA_TYPE_INTERFACE_BASE "LoopControl"
#define SPA_TYPE__LoopUtils SPA_TYPE_INTERFACE_BASE "LoopUtils"
#define SPA_TYPE_LOOP__MainLoop SPA_TYPE_LOOP_BASE "MainLoop"
#define SPA_TYPE_LOOP__DataLoop SPA_TYPE_LOOP_BASE "DataLoop"
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_LOOP_H__ */

View file

@ -25,16 +25,9 @@ extern "C" {
#endif
struct spa_loop;
#define SPA_TYPE__Loop SPA_TYPE_INTERFACE_BASE "Loop"
#define SPA_TYPE_LOOP_BASE SPA_TYPE__Loop ":"
struct spa_loop_control;
#define SPA_TYPE__LoopControl SPA_TYPE_INTERFACE_BASE "LoopControl"
struct spa_loop_utils;
#define SPA_TYPE__LoopUtils SPA_TYPE_INTERFACE_BASE "LoopUtils"
#define SPA_TYPE_LOOP__MainLoop SPA_TYPE_LOOP_BASE "MainLoop"
#define SPA_TYPE_LOOP__DataLoop SPA_TYPE_LOOP_BASE "DataLoop"
struct spa_source;
#include <spa/utils/defs.h>
#include <spa/utils/hook.h>
@ -46,8 +39,6 @@ enum spa_io {
SPA_IO_ERR = (1 << 3),
};
struct spa_source;
typedef void (*spa_source_func_t) (struct spa_source *source);
struct spa_source {

View file

@ -66,8 +66,8 @@ struct spa_handle {
* handles.
*/
struct spa_interface_info {
const char *type; /*< the type of the interface, can be
* used to get the interface */
uint32_t type; /*< the type of the interface, can be
* used to get the interface */
};
/**
@ -75,18 +75,18 @@ struct spa_interface_info {
* a factory. It can be extra information or interfaces such as logging.
*/
struct spa_support {
const char *type; /*< the type of the support item */
void *data; /*< specific data for the item */
uint32_t type; /*< the type of the support item */
void *data; /*< specific data for the item */
};
/** Find a support item of the given type */
static inline void *spa_support_find(const struct spa_support *support,
uint32_t n_support,
const char *type)
uint32_t type)
{
uint32_t i;
for (i = 0; i < n_support; i++) {
if (strcmp(support[i].type, type) == 0)
if (support[i].type == type)
return support[i].data;
}
return NULL;

View file

@ -1,87 +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_TYPE_MAP_IMPL_H__
#define __SPA_TYPE_MAP_IMPL_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/support/type-map.h>
struct spa_type_map_impl_data {
struct spa_type_map map;
unsigned int n_types;
char *types[1];
};
static inline uint32_t
spa_type_map_impl_get_id (struct spa_type_map *map, const char *type)
{
struct spa_type_map_impl_data *impl = (struct spa_type_map_impl_data *) map;
uint32_t i = 0;
for (i = 1; i <= impl->n_types; i++) {
if (strcmp(impl->types[i], type) == 0)
return i;
}
impl->types[i] = (char *) type;
impl->n_types++;
return i;
}
static inline const char *
spa_type_map_impl_get_type (const struct spa_type_map *map, uint32_t id)
{
struct spa_type_map_impl_data *impl = (struct spa_type_map_impl_data *) map;
if (id <= impl->n_types)
return impl->types[id];
return NULL;
}
static inline size_t spa_type_map_impl_get_size (const struct spa_type_map *map)
{
struct spa_type_map_impl_data *impl = (struct spa_type_map_impl_data *) map;
return impl->n_types;
}
#define SPA_TYPE_MAP_IMPL_DEFINE(name,maxtypes) \
struct { \
struct spa_type_map map; \
unsigned int n_types; \
char *types[maxtypes]; \
} name
#define SPA_TYPE_MAP_IMPL_INIT \
{ { SPA_VERSION_TYPE_MAP, \
NULL, \
spa_type_map_impl_get_id, \
spa_type_map_impl_get_type, \
spa_type_map_impl_get_size,}, \
0, { NULL, } }
#define SPA_TYPE_MAP_IMPL(name,maxtypes) \
SPA_TYPE_MAP_IMPL_DEFINE(name,maxtypes) = SPA_TYPE_MAP_IMPL_INIT
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_TYPE_MAP_IMPL_H__ */

View file

@ -17,44 +17,46 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_TYPE_MAP_H__
#define __SPA_TYPE_MAP_H__
#ifndef __SPA_TYPE_INFO_H__
#define __SPA_TYPE_INFO_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/utils/type.h>
#define SPA_TYPE__TypeMap SPA_TYPE_INTERFACE_BASE "TypeMap"
#define SPA_TYPE_BASE "Spa:"
/**
* Maps between string types and their type id
*/
struct spa_type_map {
/** the version of this structure. This can be used to expand this
* structure in the future */
#define SPA_VERSION_TYPE_MAP 0
uint32_t version;
/**
* Extra information about the type map
*/
const struct spa_dict *info;
#define SPA_TYPE__Enum SPA_TYPE_BASE "Enum"
#define SPA_TYPE_ENUM_BASE SPA_TYPE__Enum ":"
uint32_t (*get_id) (struct spa_type_map *map, const char *type);
#define SPA_TYPE__Flags SPA_TYPE_BASE "Flags"
#define SPA_TYPE_FLAGS_BASE SPA_TYPE__Flags ":"
const char *(*get_type) (const struct spa_type_map *map, uint32_t id);
#define SPA_TYPE__Pointer SPA_TYPE_BASE "Pointer"
#define SPA_TYPE_POINTER_BASE SPA_TYPE__Pointer ":"
size_t (*get_size) (const struct spa_type_map *map);
#define SPA_TYPE__Interface SPA_TYPE_BASE "Interface"
#define SPA_TYPE_INTERFACE_BASE SPA_TYPE__Interface ":"
#define SPA_TYPE__Object SPA_TYPE_BASE "Object"
#define SPA_TYPE_OBJECT_BASE SPA_TYPE__Object ":"
static inline bool spa_type_is_a(const char *type, const char *parent)
{
return type != NULL && parent != NULL && strncmp(type, parent, strlen(parent)) == 0;
}
struct spa_type_info {
uint32_t id;
const char *name;
uint32_t type;
const struct spa_type_info *values;
};
#define spa_type_map_get_id(n,...) (n)->get_id((n),__VA_ARGS__)
#define spa_type_map_get_type(n,...) (n)->get_type((n),__VA_ARGS__)
#define spa_type_map_get_size(n) (n)->get_size(n)
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_TYPE_MAP_H__ */
#endif /* __SPA_TYPE_INFO_H__ */

View file

@ -26,24 +26,78 @@ extern "C" {
#include <spa/utils/defs.h>
#define SPA_TYPE_BASE "Spa:"
enum {
SPA_ID_UNASSIGNED = 0,
/* Interfaces */
SPA_ID_INTERFACE_Handle,
SPA_ID_INTERFACE_HandleFactory,
SPA_ID_INTERFACE_Log,
SPA_ID_INTERFACE_Loop,
SPA_ID_INTERFACE_LoopControl,
SPA_ID_INTERFACE_LoopUtils,
SPA_ID_INTERFACE_DataLoop,
SPA_ID_INTERFACE_MainLoop,
SPA_ID_INTERFACE_DBus,
SPA_ID_INTERFACE_Monitor,
SPA_ID_INTERFACE_Node,
#define SPA_TYPE__Enum SPA_TYPE_BASE "Enum"
#define SPA_TYPE_ENUM_BASE SPA_TYPE__Enum ":"
/* Events */
SPA_ID_EVENT_BASE = 0x10000,
SPA_ID_EVENT_MONITOR_Added,
SPA_ID_EVENT_MONITOR_Removed,
SPA_ID_EVENT_MONITOR_Changed,
SPA_ID_EVENT_NODE_Error,
SPA_ID_EVENT_NODE_Buffering,
SPA_ID_EVENT_NODE_RequestRefresh,
#define SPA_TYPE__Pointer SPA_TYPE_BASE "Pointer"
#define SPA_TYPE_POINTER_BASE SPA_TYPE__Pointer ":"
/* Commands */
SPA_ID_COMMAND_BASE = 0x20000,
SPA_ID_COMMAND_NODE_Suspend,
SPA_ID_COMMAND_NODE_Pause,
SPA_ID_COMMAND_NODE_Start,
SPA_ID_COMMAND_NODE_Enable,
SPA_ID_COMMAND_NODE_Disable,
SPA_ID_COMMAND_NODE_Flush,
SPA_ID_COMMAND_NODE_Drain,
SPA_ID_COMMAND_NODE_Marker,
#define SPA_TYPE__Interface SPA_TYPE_BASE "Interface"
#define SPA_TYPE_INTERFACE_BASE SPA_TYPE__Interface ":"
/* Objects */
SPA_ID_OBJECT_BASE = 0x30000,
SPA_ID_OBJECT_MonitorItem,
#define SPA_TYPE__Object SPA_TYPE_BASE "Object"
#define SPA_TYPE_OBJECT_BASE SPA_TYPE__Object ":"
SPA_ID_OBJECT_ParamList,
SPA_ID_OBJECT_PropInfo,
SPA_ID_OBJECT_Props,
SPA_ID_OBJECT_Format,
SPA_ID_OBJECT_ParamBuffers,
SPA_ID_OBJECT_ParamMeta,
SPA_ID_OBJECT_ParamIO,
/* IO */
SPA_ID_IO_BASE = 0x40000,
SPA_ID_IO_Buffers,
SPA_ID_IO_ControlRange,
SPA_ID_IO_Clock,
SPA_ID_IO_Prop,
SPA_ID_IO_Latency,
/* Params */
SPA_ID_PARAM_BASE = 0x50000,
SPA_ID_PARAM_List, /**< available params */
SPA_ID_PARAM_PropInfo, /**< property information */
SPA_ID_PARAM_Props, /**< properties */
SPA_ID_PARAM_EnumFormat, /**< available formats */
SPA_ID_PARAM_Format, /**< configured format */
SPA_ID_PARAM_Buffers, /**< buffer configurations */
SPA_ID_PARAM_Meta, /**< allowed metadata for buffers */
SPA_ID_PARAM_IO, /**< configurable IO areas */
/* vendor extensions */
SPA_ID_VENDOR_PipeWire = 0x01000000,
SPA_ID_VENDOR_Other = 0x7f000000,
};
static inline bool spa_type_is_a(const char *type, const char *parent)
{
return type != NULL && parent != NULL && strncmp(type, parent, strlen(parent)) == 0;
}
#ifdef __cplusplus
} /* extern "C" */