Reorganise SPA tree

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

View file

@ -0,0 +1,72 @@
/* 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_UTILS_H__
#define __SPA_PARAM_AUDIO_FORMAT_UTILS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/param/format-utils.h>
#include <spa/param/audio/format.h>
#include <spa/param/audio/raw-utils.h>
struct spa_type_format_audio {
uint32_t format;
uint32_t flags;
uint32_t layout;
uint32_t rate;
uint32_t channels;
uint32_t channel_mask;
};
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);
}
}
static inline int
spa_format_audio_raw_parse(const struct spa_pod_object *format,
struct spa_audio_info_raw *info, struct spa_type_format_audio *type)
{
struct spa_pod_parser prs;
spa_pod_parser_pod(&prs, &format->pod);
return spa_pod_parser_get(&prs,
":",type->format, "I", &info->format,
":",type->rate, "i", &info->rate,
":",type->channels, "i", &info->channels,
":",type->flags, "?i", &info->flags,
":",type->layout, "?i", &info->layout,
":",type->channel_mask, "?i", &info->channel_mask, NULL);
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_AUDIO_FORMAT_UTILS */

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_PARAM_AUDIO_FORMAT_H__
#define __SPA_PARAM_AUDIO_FORMAT_H__
#ifdef __cplusplus
extern "C" {
#endif
#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"
struct spa_audio_info {
uint32_t media_type;
uint32_t media_subtype;
union {
struct spa_audio_info_raw raw;
} info;
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_PARAM_AUDIO_FORMAT_H */

View file

@ -0,0 +1,119 @@
/* 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

@ -0,0 +1,112 @@
/* 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_H__
#define __SPA_AUDIO_RAW_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <endian.h>
#define SPA_TYPE__AudioFormat SPA_TYPE_ENUM_BASE "AudioFormat"
#define SPA_TYPE_AUDIO_FORMAT_BASE SPA_TYPE__AudioFormat ":"
#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"
/**
* spa_audio_flags:
* @SPA_AUDIO_FLAG_NONE: no valid flag
* @SPA_AUDIO_FLAG_UNPOSITIONED: the position array explicitly
* contains unpositioned channels.
*
* Extra audio flags
*/
enum spa_audio_flags {
SPA_AUDIO_FLAG_NONE = 0,
SPA_AUDIO_FLAG_UNPOSITIONED = (1 << 0)
};
/**
* spa_audio_layout:
* @SPA_AUDIO_LAYOUT_INTERLEAVED: interleaved audio
* @SPA_AUDIO_LAYOUT_NON_INTERLEAVED: non-interleaved audio
*
* Layout of the audio samples for the different channels.
*/
enum spa_audio_layout {
SPA_AUDIO_LAYOUT_INTERLEAVED = 0,
SPA_AUDIO_LAYOUT_NON_INTERLEAVED
};
/**
* spa_audio_info_raw:
* @format: the format
* @flags: extra flags
* @layout: the sample layout
* @rate: the sample rate
* @channels: the number of channels
* @channel_mask: the channel mask
*/
struct spa_audio_info_raw {
uint32_t format;
enum spa_audio_flags flags;
enum spa_audio_layout layout;
uint32_t rate;
uint32_t channels;
uint32_t channel_mask;
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_AUDIO_RAW_H__ */