add per type API defines

This commit is contained in:
Wim Taymans 2024-11-21 11:50:12 +01:00
parent b03f2f7afa
commit 31802d4994
85 changed files with 1137 additions and 509 deletions

View file

@ -19,7 +19,15 @@ extern "C" {
#include <spa/param/audio/format.h>
#include <spa/param/format-utils.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_AAC_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_AAC_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_AAC_UTILS static inline
#endif
#endif
SPA_API_AUDIO_AAC_UTILS int
spa_format_audio_aac_parse(const struct spa_pod *format, struct spa_audio_info_aac *info)
{
int res;
@ -33,7 +41,7 @@ spa_format_audio_aac_parse(const struct spa_pod *format, struct spa_audio_info_a
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_AAC_UTILS struct spa_pod *
spa_format_audio_aac_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_aac *info)
{

View file

@ -19,7 +19,16 @@ extern "C" {
#include <spa/param/audio/format.h>
#include <spa/param/format-utils.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_ALAC_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_ALAC_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_ALAC_UTILS static inline
#endif
#endif
SPA_API_AUDIO_ALAC_UTILS int
spa_format_audio_alac_parse(const struct spa_pod *format, struct spa_audio_info_alac *info)
{
int res;
@ -30,7 +39,7 @@ spa_format_audio_alac_parse(const struct spa_pod *format, struct spa_audio_info_
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_ALAC_UTILS struct spa_pod *
spa_format_audio_alac_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_alac *info)
{

View file

@ -19,7 +19,16 @@ extern "C" {
#include <spa/param/audio/format.h>
#include <spa/param/format-utils.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_AMR_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_AMR_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_AMR_UTILS static inline
#endif
#endif
SPA_API_AUDIO_AMR_UTILS int
spa_format_audio_amr_parse(const struct spa_pod *format, struct spa_audio_info_amr *info)
{
int res;
@ -31,7 +40,7 @@ spa_format_audio_amr_parse(const struct spa_pod *format, struct spa_audio_info_a
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_AMR_UTILS struct spa_pod *
spa_format_audio_amr_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_amr *info)
{

View file

@ -19,7 +19,15 @@ extern "C" {
#include <spa/param/audio/format.h>
#include <spa/param/format-utils.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_APE_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_APE_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_APE_UTILS static inline
#endif
#endif
SPA_API_AUDIO_APE_UTILS int
spa_format_audio_ape_parse(const struct spa_pod *format, struct spa_audio_info_ape *info)
{
int res;
@ -30,7 +38,7 @@ spa_format_audio_ape_parse(const struct spa_pod *format, struct spa_audio_info_a
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_APE_UTILS struct spa_pod *
spa_format_audio_ape_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_ape *info)
{

View file

@ -19,7 +19,15 @@ extern "C" {
#include <spa/param/format-utils.h>
#include <spa/param/audio/format.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_DSD_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_DSD_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_DSD_UTILS static inline
#endif
#endif
SPA_API_AUDIO_DSD_UTILS int
spa_format_audio_dsd_parse(const struct spa_pod *format, struct spa_audio_info_dsd *info)
{
struct spa_pod *position = NULL;
@ -39,7 +47,7 @@ spa_format_audio_dsd_parse(const struct spa_pod *format, struct spa_audio_info_d
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_DSD_UTILS struct spa_pod *
spa_format_audio_dsd_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_dsd *info)
{

View file

@ -19,7 +19,15 @@ extern "C" {
#include <spa/param/audio/format.h>
#include <spa/param/format-utils.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_DSP_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_DSP_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_DSP_UTILS static inline
#endif
#endif
SPA_API_AUDIO_DSP_UTILS int
spa_format_audio_dsp_parse(const struct spa_pod *format, struct spa_audio_info_dsp *info)
{
int res;
@ -29,7 +37,7 @@ spa_format_audio_dsp_parse(const struct spa_pod *format, struct spa_audio_info_d
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_DSP_UTILS struct spa_pod *
spa_format_audio_dsp_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_dsp *info)
{

View file

@ -19,7 +19,15 @@ extern "C" {
#include <spa/param/audio/format.h>
#include <spa/param/format-utils.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_FLAC_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_FLAC_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_FLAC_UTILS static inline
#endif
#endif
SPA_API_AUDIO_FLAC_UTILS int
spa_format_audio_flac_parse(const struct spa_pod *format, struct spa_audio_info_flac *info)
{
int res;
@ -30,7 +38,7 @@ spa_format_audio_flac_parse(const struct spa_pod *format, struct spa_audio_info_
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_FLAC_UTILS struct spa_pod *
spa_format_audio_flac_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_flac *info)
{

View file

@ -34,7 +34,15 @@ extern "C" {
* \{
*/
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_FORMAT_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_FORMAT_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_FORMAT_UTILS static inline
#endif
#endif
SPA_API_AUDIO_FORMAT_UTILS int
spa_format_audio_parse(const struct spa_pod *format, struct spa_audio_info *info)
{
int res;
@ -76,7 +84,7 @@ spa_format_audio_parse(const struct spa_pod *format, struct spa_audio_info *info
return -ENOTSUP;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_FORMAT_UTILS struct spa_pod *
spa_format_audio_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info *info)
{

View file

@ -17,6 +17,14 @@ extern "C" {
* \{
*/
#ifndef SPA_API_AUDIO_IEC958_TYPES
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_IEC958_TYPES SPA_API_IMPL
#else
#define SPA_API_AUDIO_IEC958_TYPES static inline
#endif
#endif
#define SPA_TYPE_INFO_AudioIEC958Codec SPA_TYPE_INFO_ENUM_BASE "AudioIEC958Codec"
#define SPA_TYPE_INFO_AUDIO_IEC958_CODEC_BASE SPA_TYPE_INFO_AudioIEC958Codec ":"
@ -33,11 +41,11 @@ static const struct spa_type_info spa_type_audio_iec958_codec[] = {
{ 0, 0, NULL, NULL },
};
SPA_API_IMPL uint32_t spa_type_audio_iec958_codec_from_short_name(const char *name)
SPA_API_AUDIO_IEC958_TYPES uint32_t spa_type_audio_iec958_codec_from_short_name(const char *name)
{
return spa_type_from_short_name(name, spa_type_audio_iec958_codec, SPA_AUDIO_IEC958_CODEC_UNKNOWN);
}
SPA_API_IMPL const char * spa_type_audio_iec958_codec_to_short_name(uint32_t type)
SPA_API_AUDIO_IEC958_TYPES const char * spa_type_audio_iec958_codec_to_short_name(uint32_t type)
{
return spa_type_to_short_name(type, spa_type_audio_iec958_codec, "UNKNOWN");
}

View file

@ -19,7 +19,15 @@ extern "C" {
#include <spa/param/audio/format.h>
#include <spa/param/format-utils.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_IEC958_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_IEC958_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_IEC958_UTILS static inline
#endif
#endif
SPA_API_AUDIO_IEC958_UTILS int
spa_format_audio_iec958_parse(const struct spa_pod *format, struct spa_audio_info_iec958 *info)
{
int res;
@ -30,7 +38,7 @@ spa_format_audio_iec958_parse(const struct spa_pod *format, struct spa_audio_inf
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_IEC958_UTILS struct spa_pod *
spa_format_audio_iec958_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_iec958 *info)
{

View file

@ -19,7 +19,15 @@ extern "C" {
#include <spa/param/audio/format.h>
#include <spa/param/format-utils.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_MP3_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_MP3_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_MP3_UTILS static inline
#endif
#endif
SPA_API_AUDIO_MP3_UTILS int
spa_format_audio_mp3_parse(const struct spa_pod *format, struct spa_audio_info_mp3 *info)
{
int res;
@ -30,7 +38,7 @@ spa_format_audio_mp3_parse(const struct spa_pod *format, struct spa_audio_info_m
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_MP3_UTILS struct spa_pod *
spa_format_audio_mp3_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_mp3 *info)
{

View file

@ -19,7 +19,15 @@ extern "C" {
#include <spa/param/audio/format.h>
#include <spa/param/format-utils.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_RA_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_RA_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_RA_UTILS static inline
#endif
#endif
SPA_API_AUDIO_RA_UTILS int
spa_format_audio_ra_parse(const struct spa_pod *format, struct spa_audio_info_ra *info)
{
int res;
@ -30,7 +38,7 @@ spa_format_audio_ra_parse(const struct spa_pod *format, struct spa_audio_info_ra
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_RA_UTILS struct spa_pod *
spa_format_audio_ra_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_ra *info)
{

View file

@ -19,7 +19,15 @@ extern "C" {
#include <spa/param/audio/raw.h>
#include <spa/param/audio/raw-types.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_RAW_JSON
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_RAW_JSON SPA_API_IMPL
#else
#define SPA_API_AUDIO_RAW_JSON static inline
#endif
#endif
SPA_API_AUDIO_RAW_JSON int
spa_audio_parse_position(const char *str, size_t len,
uint32_t *position, uint32_t *n_channels)
{
@ -38,7 +46,7 @@ spa_audio_parse_position(const char *str, size_t len,
return channels;
}
SPA_API_IMPL int
SPA_API_AUDIO_RAW_JSON int
spa_audio_info_raw_update(struct spa_audio_info_raw *info, const char *key, const char *val, bool force)
{
uint32_t v;
@ -60,7 +68,7 @@ spa_audio_info_raw_update(struct spa_audio_info_raw *info, const char *key, cons
return 0;
}
SPA_API_IMPL int SPA_SENTINEL
SPA_API_AUDIO_RAW_JSON int SPA_SENTINEL
spa_audio_info_raw_init_dict_keys(struct spa_audio_info_raw *info,
const struct spa_dict *defaults,
const struct spa_dict *dict, ...)

View file

@ -18,6 +18,14 @@ extern "C" {
#include <spa/utils/string.h>
#include <spa/param/audio/raw.h>
#ifndef SPA_API_AUDIO_RAW_TYPES
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_RAW_TYPES SPA_API_IMPL
#else
#define SPA_API_AUDIO_RAW_TYPES static inline
#endif
#endif
#define SPA_TYPE_INFO_AudioFormat SPA_TYPE_INFO_ENUM_BASE "AudioFormat"
#define SPA_TYPE_INFO_AUDIO_FORMAT_BASE SPA_TYPE_INFO_AudioFormat ":"
@ -129,11 +137,11 @@ static const struct spa_type_info spa_type_audio_format[] = {
{ 0, 0, NULL, NULL },
};
SPA_API_IMPL uint32_t spa_type_audio_format_from_short_name(const char *name)
SPA_API_AUDIO_RAW_TYPES uint32_t spa_type_audio_format_from_short_name(const char *name)
{
return spa_type_from_short_name(name, spa_type_audio_format, SPA_AUDIO_FORMAT_UNKNOWN);
}
SPA_API_IMPL const char * spa_type_audio_format_to_short_name(uint32_t type)
SPA_API_AUDIO_RAW_TYPES const char * spa_type_audio_format_to_short_name(uint32_t type)
{
return spa_type_to_short_name(type, spa_type_audio_format, "UNKNOWN");
}
@ -257,11 +265,11 @@ static const struct spa_type_info spa_type_audio_channel[] = {
{ 0, 0, NULL, NULL },
};
SPA_API_IMPL uint32_t spa_type_audio_channel_from_short_name(const char *name)
SPA_API_AUDIO_RAW_TYPES uint32_t spa_type_audio_channel_from_short_name(const char *name)
{
return spa_type_from_short_name(name, spa_type_audio_channel, SPA_AUDIO_CHANNEL_UNKNOWN);
}
SPA_API_IMPL const char * spa_type_audio_channel_to_short_name(uint32_t type)
SPA_API_AUDIO_RAW_TYPES const char * spa_type_audio_channel_to_short_name(uint32_t type)
{
return spa_type_to_short_name(type, spa_type_audio_channel, "UNK");
}

View file

@ -19,7 +19,15 @@ extern "C" {
#include <spa/param/audio/format.h>
#include <spa/param/format-utils.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_RAW_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_RAW_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_RAW_UTILS static inline
#endif
#endif
SPA_API_AUDIO_RAW_UTILS int
spa_format_audio_raw_parse(const struct spa_pod *format, struct spa_audio_info_raw *info)
{
struct spa_pod *position = NULL;
@ -38,7 +46,7 @@ spa_format_audio_raw_parse(const struct spa_pod *format, struct spa_audio_info_r
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_RAW_UTILS struct spa_pod *
spa_format_audio_raw_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_raw *info)
{

View file

@ -19,7 +19,15 @@ extern "C" {
#include <spa/param/audio/format.h>
#include <spa/param/format-utils.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_VORBIS_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_VORBIS_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_VORBIS_UTILS static inline
#endif
#endif
SPA_API_AUDIO_VORBIS_UTILS int
spa_format_audio_vorbis_parse(const struct spa_pod *format, struct spa_audio_info_vorbis *info)
{
int res;
@ -30,7 +38,7 @@ spa_format_audio_vorbis_parse(const struct spa_pod *format, struct spa_audio_inf
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_VORBIS_UTILS struct spa_pod *
spa_format_audio_vorbis_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_vorbis *info)
{

View file

@ -19,7 +19,15 @@ extern "C" {
#include <spa/param/audio/format.h>
#include <spa/param/format-utils.h>
SPA_API_IMPL int
#ifndef SPA_API_AUDIO_WMA_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_AUDIO_WMA_UTILS SPA_API_IMPL
#else
#define SPA_API_AUDIO_WMA_UTILS static inline
#endif
#endif
SPA_API_AUDIO_WMA_UTILS int
spa_format_audio_wma_parse(const struct spa_pod *format, struct spa_audio_info_wma *info)
{
int res;
@ -33,7 +41,7 @@ spa_format_audio_wma_parse(const struct spa_pod *format, struct spa_audio_info_w
return res;
}
SPA_API_IMPL struct spa_pod *
SPA_API_AUDIO_WMA_UTILS struct spa_pod *
spa_format_audio_wma_build(struct spa_pod_builder *builder, uint32_t id,
const struct spa_audio_info_wma *info)
{