mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
audio: make audio format an uri type
This commit is contained in:
parent
ff62c1b9ce
commit
03292fd80f
24 changed files with 608 additions and 364 deletions
|
|
@ -25,10 +25,9 @@
|
|||
#include <gst/audio/audio.h>
|
||||
|
||||
#include <spa/lib/mapper.h>
|
||||
#include <spa/include/spa/video/format.h>
|
||||
#include <spa/include/spa/audio/format.h>
|
||||
#include <spa/include/spa/format.h>
|
||||
#include <spa/include/spa/format-builder.h>
|
||||
#include <spa/include/spa/video/format-utils.h>
|
||||
#include <spa/include/spa/audio/format-utils.h>
|
||||
|
||||
#include "gstpinosformat.h"
|
||||
|
||||
|
|
@ -45,6 +44,7 @@ static SpaMediaSubtypesAudio media_subtypes_audio = { 0, };
|
|||
static SpaPropVideo prop_video = { 0, };
|
||||
static SpaPropAudio prop_audio = { 0, };
|
||||
static SpaVideoFormats video_formats = { 0, };
|
||||
static SpaAudioFormats audio_formats = { 0, };
|
||||
|
||||
static void
|
||||
ensure_types (void)
|
||||
|
|
@ -56,6 +56,7 @@ ensure_types (void)
|
|||
spa_prop_video_map (spa_id_map_get_default (), &prop_video);
|
||||
spa_prop_audio_map (spa_id_map_get_default (), &prop_audio);
|
||||
spa_video_formats_map (spa_id_map_get_default (), &video_formats);
|
||||
spa_audio_formats_map (spa_id_map_get_default (), &audio_formats);
|
||||
}
|
||||
|
||||
static const MediaType media_type_map[] = {
|
||||
|
|
@ -134,6 +135,49 @@ static const uint32_t *video_format_map[] = {
|
|||
&video_formats.VYUY,
|
||||
};
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define _FORMAT_LE(fmt) &audio_formats. fmt ## _OE
|
||||
#define _FORMAT_BE(fmt) &audio_formats. fmt
|
||||
#elif __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define _FORMAT_LE(fmt) &audio_formats. fmt
|
||||
#define _FORMAT_BE(fmt) &audio_formats. fmt ## _OE
|
||||
#endif
|
||||
|
||||
static const uint32_t *audio_format_map[] = {
|
||||
&audio_formats.UNKNOWN,
|
||||
&audio_formats.ENCODED,
|
||||
&audio_formats.S8,
|
||||
&audio_formats.U8,
|
||||
_FORMAT_LE (S16),
|
||||
_FORMAT_BE (S16),
|
||||
_FORMAT_LE (U16),
|
||||
_FORMAT_BE (U16),
|
||||
_FORMAT_LE (S24_32),
|
||||
_FORMAT_BE (S24_32),
|
||||
_FORMAT_LE (U24_32),
|
||||
_FORMAT_BE (U24_32),
|
||||
_FORMAT_LE (S32),
|
||||
_FORMAT_BE (S32),
|
||||
_FORMAT_LE (U32),
|
||||
_FORMAT_BE (U32),
|
||||
_FORMAT_LE (S24),
|
||||
_FORMAT_BE (S24),
|
||||
_FORMAT_LE (U24),
|
||||
_FORMAT_BE (U24),
|
||||
_FORMAT_LE (S20),
|
||||
_FORMAT_BE (S20),
|
||||
_FORMAT_LE (U20),
|
||||
_FORMAT_BE (U20),
|
||||
_FORMAT_LE (S18),
|
||||
_FORMAT_BE (S18),
|
||||
_FORMAT_LE (U18),
|
||||
_FORMAT_BE (U18),
|
||||
_FORMAT_LE (F32),
|
||||
_FORMAT_BE (F32),
|
||||
_FORMAT_LE (F64),
|
||||
_FORMAT_BE (F64),
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPODBuilder b;
|
||||
const MediaType *type;
|
||||
|
|
@ -379,7 +423,7 @@ handle_audio_fields (ConvertData *d)
|
|||
prop_audio.format,
|
||||
get_range_type (value) | SPA_POD_PROP_FLAG_READWRITE);
|
||||
|
||||
spa_pod_builder_int (&d->b, gst_audio_format_from_string (v));
|
||||
spa_pod_builder_uri (&d->b, *audio_format_map[gst_video_format_from_string (v)]);
|
||||
}
|
||||
if (i > 1)
|
||||
SPA_POD_BUILDER_DEREF (&d->b, f.ref, SpaPODProp)->body.flags |= SPA_POD_PROP_FLAG_UNSET;
|
||||
|
|
@ -583,8 +627,10 @@ gst_caps_from_format (const SpaFormat *format)
|
|||
return NULL;
|
||||
|
||||
if (media_subtype == media_subtypes.raw) {
|
||||
const char * str = spa_id_map_get_uri (spa_id_map_get_default (), f.info.raw.format);
|
||||
|
||||
res = gst_caps_new_simple ("audio/x-raw",
|
||||
"format", G_TYPE_STRING, gst_audio_format_to_string (f.info.raw.format),
|
||||
"format", G_TYPE_STRING, strstr (str, "#") + 1,
|
||||
"layout", G_TYPE_STRING, "interleaved",
|
||||
"rate", G_TYPE_INT, f.info.raw.rate,
|
||||
"channels", G_TYPE_INT, f.info.raw.channels,
|
||||
|
|
|
|||
60
spa/include/spa/audio/format-utils.h
Normal file
60
spa/include/spa/audio/format-utils.h
Normal 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_AUDIO_FORMAT_UTILS_H__
|
||||
#define __SPA_AUDIO_FORMAT_UTILS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/format-utils.h>
|
||||
#include <spa/audio/format.h>
|
||||
#include <spa/audio/raw-utils.h>
|
||||
|
||||
typedef struct {
|
||||
uint32_t format;
|
||||
uint32_t flags;
|
||||
uint32_t layout;
|
||||
uint32_t rate;
|
||||
uint32_t channels;
|
||||
uint32_t channel_mask;
|
||||
} SpaPropAudio;
|
||||
|
||||
static inline void
|
||||
spa_prop_audio_map (SpaIDMap *map, SpaPropAudio *types)
|
||||
{
|
||||
if (types->format == 0) {
|
||||
types->format = spa_id_map_get_id (map, SPA_PROP_AUDIO__format);
|
||||
types->flags = spa_id_map_get_id (map, SPA_PROP_AUDIO__flags);
|
||||
types->layout = spa_id_map_get_id (map, SPA_PROP_AUDIO__layout);
|
||||
types->rate = spa_id_map_get_id (map, SPA_PROP_AUDIO__rate);
|
||||
types->channels = spa_id_map_get_id (map, SPA_PROP_AUDIO__channels);
|
||||
types->channel_mask = spa_id_map_get_id (map, SPA_PROP_AUDIO__channelMask);
|
||||
}
|
||||
}
|
||||
|
||||
SpaResult spa_format_audio_parse (const SpaFormat *format,
|
||||
SpaAudioInfo *info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_AUDIO_FORMAT_UTILS */
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/format-utils.h>
|
||||
#include <spa/format.h>
|
||||
#include <spa/audio/raw.h>
|
||||
|
||||
typedef struct _SpaAudioInfo SpaAudioInfo;
|
||||
|
|
@ -39,28 +39,6 @@ typedef struct _SpaAudioInfo SpaAudioInfo;
|
|||
#define SPA_PROP_AUDIO__channels SPA_PROP_AUDIO_PREFIX "channels"
|
||||
#define SPA_PROP_AUDIO__channelMask SPA_PROP_AUDIO_PREFIX "channel-mask"
|
||||
|
||||
typedef struct {
|
||||
uint32_t format;
|
||||
uint32_t flags;
|
||||
uint32_t layout;
|
||||
uint32_t rate;
|
||||
uint32_t channels;
|
||||
uint32_t channel_mask;
|
||||
} SpaPropAudio;
|
||||
|
||||
static inline void
|
||||
spa_prop_audio_map (SpaIDMap *map, SpaPropAudio *types)
|
||||
{
|
||||
if (types->format == 0) {
|
||||
types->format = spa_id_map_get_id (map, SPA_PROP_AUDIO__format);
|
||||
types->flags = spa_id_map_get_id (map, SPA_PROP_AUDIO__flags);
|
||||
types->layout = spa_id_map_get_id (map, SPA_PROP_AUDIO__layout);
|
||||
types->rate = spa_id_map_get_id (map, SPA_PROP_AUDIO__rate);
|
||||
types->channels = spa_id_map_get_id (map, SPA_PROP_AUDIO__channels);
|
||||
types->channel_mask = spa_id_map_get_id (map, SPA_PROP_AUDIO__channelMask);
|
||||
}
|
||||
}
|
||||
|
||||
struct _SpaAudioInfo {
|
||||
uint32_t media_type;
|
||||
uint32_t media_subtype;
|
||||
|
|
@ -69,9 +47,6 @@ struct _SpaAudioInfo {
|
|||
} info;
|
||||
};
|
||||
|
||||
SpaResult spa_format_audio_parse (const SpaFormat *format,
|
||||
SpaAudioInfo *info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
119
spa/include/spa/audio/raw-utils.h
Normal file
119
spa/include/spa/audio/raw-utils.h
Normal 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/id-map.h>
|
||||
#include <spa/audio/raw.h>
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define _SPA_AUDIO_FORMAT_NE(fmt) SPA_AUDIO_FORMAT_PREFIX fmt "BE"
|
||||
#define _SPA_AUDIO_FORMAT_OE(fmt) SPA_AUDIO_FORMAT_PREFIX fmt "LE"
|
||||
#elif __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define _SPA_AUDIO_FORMAT_NE(fmt) SPA_AUDIO_FORMAT_PREFIX fmt "LE"
|
||||
#define _SPA_AUDIO_FORMAT_OE(fmt) SPA_AUDIO_FORMAT_PREFIX fmt "BE"
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
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;
|
||||
} SpaAudioFormats;
|
||||
|
||||
static inline void
|
||||
spa_audio_formats_map (SpaIDMap *map, SpaAudioFormats *types)
|
||||
{
|
||||
if (types->ENCODED == 0) {
|
||||
types->UNKNOWN = 0;
|
||||
types->ENCODED = spa_id_map_get_id (map, SPA_AUDIO_FORMAT__ENCODED);
|
||||
|
||||
types->S8 = spa_id_map_get_id (map, SPA_AUDIO_FORMAT__S8);
|
||||
types->U8 = spa_id_map_get_id (map, SPA_AUDIO_FORMAT__U8);
|
||||
|
||||
types->S16 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("S16"));
|
||||
types->U16 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("U16"));
|
||||
types->S24_32 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("S24_32"));
|
||||
types->U24_32 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("U24_32"));
|
||||
types->S32 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("S32"));
|
||||
types->U32 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("U32"));
|
||||
types->S24 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("S24"));
|
||||
types->U24 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("U24"));
|
||||
types->S20 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("S20"));
|
||||
types->U20 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("U20"));
|
||||
types->S18 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("S18"));
|
||||
types->U18 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("U18"));
|
||||
types->F32 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("F32"));
|
||||
types->F64 = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_NE ("F64"));
|
||||
|
||||
types->S16_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("S16"));
|
||||
types->U16_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("U16"));
|
||||
types->S24_32_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("S24_32"));
|
||||
types->U24_32_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("U24_32"));
|
||||
types->S32_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("S32"));
|
||||
types->U32_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("U32"));
|
||||
types->S24_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("S24"));
|
||||
types->U24_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("U24"));
|
||||
types->S20_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("S20"));
|
||||
types->U20_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("U20"));
|
||||
types->S18_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("S18"));
|
||||
types->U18_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("U18"));
|
||||
types->F32_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("F32"));
|
||||
types->F64_OE = spa_id_map_get_id (map, _SPA_AUDIO_FORMAT_OE ("F64"));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_AUDIO_RAW_UTILS_H__ */
|
||||
|
|
@ -28,72 +28,41 @@ typedef struct _SpaAudioInfoRaw SpaAudioInfoRaw;
|
|||
|
||||
#include <endian.h>
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define _SPA_AUDIO_FORMAT_NE(fmt) SPA_AUDIO_FORMAT_ ## fmt ## BE
|
||||
#define _SPA_AUDIO_FORMAT_OE(fmt) SPA_AUDIO_FORMAT_ ## fmt ## LE
|
||||
#elif __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define _SPA_AUDIO_FORMAT_NE(fmt) SPA_AUDIO_FORMAT_ ## fmt ## LE
|
||||
#define _SPA_AUDIO_FORMAT_OE(fmt) SPA_AUDIO_FORMAT_ ## fmt ## BE
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
SPA_AUDIO_FORMAT_UNKNOWN,
|
||||
SPA_AUDIO_FORMAT_ENCODED,
|
||||
/* 8 bit */
|
||||
SPA_AUDIO_FORMAT_S8,
|
||||
SPA_AUDIO_FORMAT_U8,
|
||||
/* 16 bit */
|
||||
SPA_AUDIO_FORMAT_S16LE,
|
||||
SPA_AUDIO_FORMAT_S16BE,
|
||||
SPA_AUDIO_FORMAT_U16LE,
|
||||
SPA_AUDIO_FORMAT_U16BE,
|
||||
/* 24 bit in low 3 bytes of 32 bits*/
|
||||
SPA_AUDIO_FORMAT_S24_32LE,
|
||||
SPA_AUDIO_FORMAT_S24_32BE,
|
||||
SPA_AUDIO_FORMAT_U24_32LE,
|
||||
SPA_AUDIO_FORMAT_U24_32BE,
|
||||
/* 32 bit */
|
||||
SPA_AUDIO_FORMAT_S32LE,
|
||||
SPA_AUDIO_FORMAT_S32BE,
|
||||
SPA_AUDIO_FORMAT_U32LE,
|
||||
SPA_AUDIO_FORMAT_U32BE,
|
||||
/* 24 bit in 3 bytes*/
|
||||
SPA_AUDIO_FORMAT_S24LE,
|
||||
SPA_AUDIO_FORMAT_S24BE,
|
||||
SPA_AUDIO_FORMAT_U24LE,
|
||||
SPA_AUDIO_FORMAT_U24BE,
|
||||
/* 20 bit in 3 bytes*/
|
||||
SPA_AUDIO_FORMAT_S20LE,
|
||||
SPA_AUDIO_FORMAT_S20BE,
|
||||
SPA_AUDIO_FORMAT_U20LE,
|
||||
SPA_AUDIO_FORMAT_U20BE,
|
||||
/* 18 bit in 3 bytes*/
|
||||
SPA_AUDIO_FORMAT_S18LE,
|
||||
SPA_AUDIO_FORMAT_S18BE,
|
||||
SPA_AUDIO_FORMAT_U18LE,
|
||||
SPA_AUDIO_FORMAT_U18BE,
|
||||
/* float */
|
||||
SPA_AUDIO_FORMAT_F32LE,
|
||||
SPA_AUDIO_FORMAT_F32BE,
|
||||
SPA_AUDIO_FORMAT_F64LE,
|
||||
SPA_AUDIO_FORMAT_F64BE,
|
||||
/* native endianness equivalents */
|
||||
SPA_AUDIO_FORMAT_S16 = _SPA_AUDIO_FORMAT_NE(S16),
|
||||
SPA_AUDIO_FORMAT_U16 = _SPA_AUDIO_FORMAT_NE(U16),
|
||||
SPA_AUDIO_FORMAT_S24_32 = _SPA_AUDIO_FORMAT_NE(S24_32),
|
||||
SPA_AUDIO_FORMAT_U24_32 = _SPA_AUDIO_FORMAT_NE(U24_32),
|
||||
SPA_AUDIO_FORMAT_S32 = _SPA_AUDIO_FORMAT_NE(S32),
|
||||
SPA_AUDIO_FORMAT_U32 = _SPA_AUDIO_FORMAT_NE(U32),
|
||||
SPA_AUDIO_FORMAT_S24 = _SPA_AUDIO_FORMAT_NE(S24),
|
||||
SPA_AUDIO_FORMAT_U24 = _SPA_AUDIO_FORMAT_NE(U24),
|
||||
SPA_AUDIO_FORMAT_S20 = _SPA_AUDIO_FORMAT_NE(S20),
|
||||
SPA_AUDIO_FORMAT_U20 = _SPA_AUDIO_FORMAT_NE(U20),
|
||||
SPA_AUDIO_FORMAT_S18 = _SPA_AUDIO_FORMAT_NE(S18),
|
||||
SPA_AUDIO_FORMAT_U18 = _SPA_AUDIO_FORMAT_NE(U18),
|
||||
SPA_AUDIO_FORMAT_F32 = _SPA_AUDIO_FORMAT_NE(F32),
|
||||
SPA_AUDIO_FORMAT_F64 = _SPA_AUDIO_FORMAT_NE(F64)
|
||||
} SpaAudioFormat;
|
||||
#define SPA_AUDIO_FORMAT_URI "http://spaplug.in/ns/audio-format"
|
||||
#define SPA_AUDIO_FORMAT_PREFIX SPA_AUDIO_FORMAT_URI "#"
|
||||
|
||||
#define SPA_AUDIO_FORMAT__UNKNOWN SPA_AUDIO_FORMAT_PREFIX "UNKNOWN"
|
||||
#define SPA_AUDIO_FORMAT__ENCODED SPA_AUDIO_FORMAT_PREFIX "ENCODED"
|
||||
#define SPA_AUDIO_FORMAT__S8 SPA_AUDIO_FORMAT_PREFIX "S8"
|
||||
#define SPA_AUDIO_FORMAT__U8 SPA_AUDIO_FORMAT_PREFIX "U8"
|
||||
#define SPA_AUDIO_FORMAT__S16LE SPA_AUDIO_FORMAT_PREFIX "S16LE"
|
||||
#define SPA_AUDIO_FORMAT__S16BE SPA_AUDIO_FORMAT_PREFIX "S16BE"
|
||||
#define SPA_AUDIO_FORMAT__U16LE SPA_AUDIO_FORMAT_PREFIX "U16LE"
|
||||
#define SPA_AUDIO_FORMAT__U16BE SPA_AUDIO_FORMAT_PREFIX "U16BE"
|
||||
#define SPA_AUDIO_FORMAT__S24_32LE SPA_AUDIO_FORMAT_PREFIX "S24_32LE"
|
||||
#define SPA_AUDIO_FORMAT__S24_32BE SPA_AUDIO_FORMAT_PREFIX "S24_32BE"
|
||||
#define SPA_AUDIO_FORMAT__U24_32LE SPA_AUDIO_FORMAT_PREFIX "U24_32LE"
|
||||
#define SPA_AUDIO_FORMAT__U24_32BE SPA_AUDIO_FORMAT_PREFIX "U24_32BE"
|
||||
#define SPA_AUDIO_FORMAT__S32LE SPA_AUDIO_FORMAT_PREFIX "S32LE"
|
||||
#define SPA_AUDIO_FORMAT__S32BE SPA_AUDIO_FORMAT_PREFIX "S32BE"
|
||||
#define SPA_AUDIO_FORMAT__U32LE SPA_AUDIO_FORMAT_PREFIX "U32LE"
|
||||
#define SPA_AUDIO_FORMAT__U32BE SPA_AUDIO_FORMAT_PREFIX "U32BE"
|
||||
#define SPA_AUDIO_FORMAT__S24LE SPA_AUDIO_FORMAT_PREFIX "S24LE"
|
||||
#define SPA_AUDIO_FORMAT__S24BE SPA_AUDIO_FORMAT_PREFIX "S24BE"
|
||||
#define SPA_AUDIO_FORMAT__U24LE SPA_AUDIO_FORMAT_PREFIX "U24LE"
|
||||
#define SPA_AUDIO_FORMAT__U24BE SPA_AUDIO_FORMAT_PREFIX "U24BE"
|
||||
#define SPA_AUDIO_FORMAT__S20LE SPA_AUDIO_FORMAT_PREFIX "S20LE"
|
||||
#define SPA_AUDIO_FORMAT__S20BE SPA_AUDIO_FORMAT_PREFIX "S20BE"
|
||||
#define SPA_AUDIO_FORMAT__U20LE SPA_AUDIO_FORMAT_PREFIX "U20LE"
|
||||
#define SPA_AUDIO_FORMAT__U20BE SPA_AUDIO_FORMAT_PREFIX "U20BE"
|
||||
#define SPA_AUDIO_FORMAT__S18LE SPA_AUDIO_FORMAT_PREFIX "S18LE"
|
||||
#define SPA_AUDIO_FORMAT__S18BE SPA_AUDIO_FORMAT_PREFIX "S18BE"
|
||||
#define SPA_AUDIO_FORMAT__U18LE SPA_AUDIO_FORMAT_PREFIX "U18LE"
|
||||
#define SPA_AUDIO_FORMAT__U18BE SPA_AUDIO_FORMAT_PREFIX "U18BE"
|
||||
#define SPA_AUDIO_FORMAT__F32LE SPA_AUDIO_FORMAT_PREFIX "F32LE"
|
||||
#define SPA_AUDIO_FORMAT__F32BE SPA_AUDIO_FORMAT_PREFIX "F32BE"
|
||||
#define SPA_AUDIO_FORMAT__F64LE SPA_AUDIO_FORMAT_PREFIX "F64LE"
|
||||
#define SPA_AUDIO_FORMAT__F64BE SPA_AUDIO_FORMAT_PREFIX "F64BE"
|
||||
|
||||
/**
|
||||
* SpaAudioFlags:
|
||||
|
|
@ -130,7 +99,7 @@ typedef enum {
|
|||
* @channel_mask: the channel mask
|
||||
*/
|
||||
struct _SpaAudioInfoRaw {
|
||||
SpaAudioFormat format;
|
||||
uint32_t format;
|
||||
SpaAudioFlags flags;
|
||||
SpaAudioLayout layout;
|
||||
uint32_t rate;
|
||||
|
|
|
|||
84
spa/include/spa/video/format-utils.h
Normal file
84
spa/include/spa/video/format-utils.h
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/* 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_FORMAT_UTILS_H__
|
||||
#define __SPA_VIDEO_FORMAT_UTILS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/format-utils.h>
|
||||
#include <spa/video/format.h>
|
||||
#include <spa/video/raw-utils.h>
|
||||
|
||||
typedef struct {
|
||||
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;
|
||||
} SpaPropVideo;
|
||||
|
||||
static inline void
|
||||
spa_prop_video_map (SpaIDMap *map, SpaPropVideo *types)
|
||||
{
|
||||
if (types->format == 0) {
|
||||
types->format = spa_id_map_get_id (map, SPA_PROP_VIDEO__format);
|
||||
types->size = spa_id_map_get_id (map, SPA_PROP_VIDEO__size);
|
||||
types->framerate = spa_id_map_get_id (map, SPA_PROP_VIDEO__framerate);
|
||||
types->max_framerate = spa_id_map_get_id (map, SPA_PROP_VIDEO__maxFramerate);
|
||||
types->views = spa_id_map_get_id (map, SPA_PROP_VIDEO__views);
|
||||
types->interlace_mode = spa_id_map_get_id (map, SPA_PROP_VIDEO__interlaceMode);
|
||||
types->pixel_aspect_ratio = spa_id_map_get_id (map, SPA_PROP_VIDEO__pixelAspectRatio);
|
||||
types->multiview_mode = spa_id_map_get_id (map, SPA_PROP_VIDEO__multiviewMode);
|
||||
types->multiview_flags = spa_id_map_get_id (map, SPA_PROP_VIDEO__multiviewFlags);
|
||||
types->chroma_site = spa_id_map_get_id (map, SPA_PROP_VIDEO__chromaSite);
|
||||
types->color_range = spa_id_map_get_id (map, SPA_PROP_VIDEO__colorRange);
|
||||
types->color_matrix = spa_id_map_get_id (map, SPA_PROP_VIDEO__colorMatrix);
|
||||
types->transfer_function = spa_id_map_get_id (map, SPA_PROP_VIDEO__transferFunction);
|
||||
types->color_primaries = spa_id_map_get_id (map, SPA_PROP_VIDEO__colorPrimaries);
|
||||
types->profile = spa_id_map_get_id (map, SPA_PROP_VIDEO__profile);
|
||||
types->level = spa_id_map_get_id (map, SPA_PROP_VIDEO__level);
|
||||
types->stream_format = spa_id_map_get_id (map, SPA_PROP_VIDEO__streamFormat);
|
||||
types->alignment = spa_id_map_get_id (map, SPA_PROP_VIDEO__alignment);
|
||||
}
|
||||
}
|
||||
|
||||
SpaResult spa_format_video_parse (const SpaFormat *format,
|
||||
SpaVideoInfo *info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_VIDEO_FORMAT_UTILS */
|
||||
|
|
@ -52,55 +52,6 @@ typedef struct _SpaVideoInfo SpaVideoInfo;
|
|||
#define SPA_PROP_VIDEO__streamFormat SPA_PROP_VIDEO_PREFIX "stream-format"
|
||||
#define SPA_PROP_VIDEO__alignment SPA_PROP_VIDEO_PREFIX "alignment"
|
||||
|
||||
typedef struct {
|
||||
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;
|
||||
} SpaPropVideo;
|
||||
|
||||
static inline void
|
||||
spa_prop_video_map (SpaIDMap *map, SpaPropVideo *types)
|
||||
{
|
||||
if (types->format == 0) {
|
||||
types->format = spa_id_map_get_id (map, SPA_PROP_VIDEO__format);
|
||||
types->size = spa_id_map_get_id (map, SPA_PROP_VIDEO__size);
|
||||
types->framerate = spa_id_map_get_id (map, SPA_PROP_VIDEO__framerate);
|
||||
types->max_framerate = spa_id_map_get_id (map, SPA_PROP_VIDEO__maxFramerate);
|
||||
types->views = spa_id_map_get_id (map, SPA_PROP_VIDEO__views);
|
||||
types->interlace_mode = spa_id_map_get_id (map, SPA_PROP_VIDEO__interlaceMode);
|
||||
types->pixel_aspect_ratio = spa_id_map_get_id (map, SPA_PROP_VIDEO__pixelAspectRatio);
|
||||
types->multiview_mode = spa_id_map_get_id (map, SPA_PROP_VIDEO__multiviewMode);
|
||||
types->multiview_flags = spa_id_map_get_id (map, SPA_PROP_VIDEO__multiviewFlags);
|
||||
types->chroma_site = spa_id_map_get_id (map, SPA_PROP_VIDEO__chromaSite);
|
||||
types->color_range = spa_id_map_get_id (map, SPA_PROP_VIDEO__colorRange);
|
||||
types->color_matrix = spa_id_map_get_id (map, SPA_PROP_VIDEO__colorMatrix);
|
||||
types->transfer_function = spa_id_map_get_id (map, SPA_PROP_VIDEO__transferFunction);
|
||||
types->color_primaries = spa_id_map_get_id (map, SPA_PROP_VIDEO__colorPrimaries);
|
||||
types->profile = spa_id_map_get_id (map, SPA_PROP_VIDEO__profile);
|
||||
types->level = spa_id_map_get_id (map, SPA_PROP_VIDEO__level);
|
||||
types->stream_format = spa_id_map_get_id (map, SPA_PROP_VIDEO__streamFormat);
|
||||
types->alignment = spa_id_map_get_id (map, SPA_PROP_VIDEO__alignment);
|
||||
}
|
||||
}
|
||||
|
||||
SpaResult spa_format_video_parse (const SpaFormat *format,
|
||||
SpaVideoInfo *info);
|
||||
|
||||
struct _SpaVideoInfo {
|
||||
uint32_t media_type;
|
||||
uint32_t media_subtype;
|
||||
|
|
|
|||
177
spa/include/spa/video/raw-utils.h
Normal file
177
spa/include/spa/video/raw-utils.h
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
/* 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
|
||||
|
||||
typedef struct _SpaVideoInfoRaw SpaVideoInfoRaw;
|
||||
|
||||
#include <spa/id-map.h>
|
||||
#include <spa/video/raw.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
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;
|
||||
} SpaVideoFormats;
|
||||
|
||||
static inline void
|
||||
spa_video_formats_map (SpaIDMap *map, SpaVideoFormats *types)
|
||||
{
|
||||
if (types->ENCODED == 0) {
|
||||
types->UNKNOWN = 0;
|
||||
types->ENCODED = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__ENCODED);
|
||||
types->I420 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__I420);
|
||||
types->YV12 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__YV12);
|
||||
types->YUY2 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__YUY2);
|
||||
types->UYVY = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__UYVY);
|
||||
types->AYUV = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__AYUV);
|
||||
types->RGBx = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__RGBx);
|
||||
types->BGRx = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__BGRx);
|
||||
types->xRGB = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__xRGB);
|
||||
types->xBGR = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__xBGR);
|
||||
types->RGBA = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__RGBA);
|
||||
types->BGRA = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__BGRA);
|
||||
types->ARGB = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__ARGB);
|
||||
types->ABGR = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__ABGR);
|
||||
types->RGB = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__RGB);
|
||||
types->BGR = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__BGR);
|
||||
types->Y41B = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__Y41B);
|
||||
types->Y42B = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__Y42B);
|
||||
types->YVYU = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__YVYU);
|
||||
types->Y444 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__Y444);
|
||||
types->v210 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__v210);
|
||||
types->v216 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__v216);
|
||||
types->NV12 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__NV12);
|
||||
types->NV21 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__NV21);
|
||||
types->GRAY8 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__GRAY8);
|
||||
types->GRAY16_BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__GRAY16_BE);
|
||||
types->GRAY16_LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__GRAY16_LE);
|
||||
types->v308 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__v308);
|
||||
types->RGB16 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__RGB16);
|
||||
types->BGR16 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__BGR16);
|
||||
types->RGB15 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__RGB15);
|
||||
types->BGR15 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__BGR15);
|
||||
types->UYVP = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__UYVP);
|
||||
types->A420 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A420);
|
||||
types->RGB8P = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__RGB8P);
|
||||
types->YUV9 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__YUV9);
|
||||
types->YVU9 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__YVU9);
|
||||
types->IYU1 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__IYU1);
|
||||
types->ARGB64 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__ARGB64);
|
||||
types->AYUV64 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__AYUV64);
|
||||
types->r210 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__r210);
|
||||
types->I420_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__I420_10BE);
|
||||
types->I420_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__I420_10LE);
|
||||
types->I422_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__I422_10BE);
|
||||
types->I422_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__I422_10LE);
|
||||
types->Y444_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__Y444_10BE);
|
||||
types->Y444_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__Y444_10LE);
|
||||
types->GBR = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__GBR);
|
||||
types->GBR_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__GBR_10BE);
|
||||
types->GBR_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__GBR_10LE);
|
||||
types->NV16 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__NV16);
|
||||
types->NV24 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__NV24);
|
||||
types->NV12_64Z32 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__NV12_64Z32);
|
||||
types->A420_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A420_10BE);
|
||||
types->A420_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A420_10LE);
|
||||
types->A422_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A422_10BE);
|
||||
types->A422_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A422_10LE);
|
||||
types->A444_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A444_10BE);
|
||||
types->A444_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A444_10LE);
|
||||
types->NV61 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__NV61);
|
||||
types->P010_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__P010_10BE);
|
||||
types->P010_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__P010_10LE);
|
||||
types->IYU2 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__IYU2);
|
||||
types->VYUY = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__VYUY);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_VIDEO_RAW_UTILS_H__ */
|
||||
|
|
@ -103,147 +103,6 @@ typedef struct _SpaVideoInfoRaw SpaVideoInfoRaw;
|
|||
#define SPA_VIDEO_FORMAT__IYU2 SPA_VIDEO_FORMAT_PREFIX "IYU2"
|
||||
#define SPA_VIDEO_FORMAT__VYUY SPA_VIDEO_FORMAT_PREFIX "VYUY"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
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;
|
||||
} SpaVideoFormats;
|
||||
|
||||
static inline void
|
||||
spa_video_formats_map (SpaIDMap *map, SpaVideoFormats *types)
|
||||
{
|
||||
if (types->ENCODED == 0) {
|
||||
types->UNKNOWN = 0;
|
||||
types->ENCODED = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__ENCODED);
|
||||
types->I420 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__I420);
|
||||
types->YV12 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__YV12);
|
||||
types->YUY2 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__YUY2);
|
||||
types->UYVY = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__UYVY);
|
||||
types->AYUV = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__AYUV);
|
||||
types->RGBx = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__RGBx);
|
||||
types->BGRx = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__BGRx);
|
||||
types->xRGB = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__xRGB);
|
||||
types->xBGR = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__xBGR);
|
||||
types->RGBA = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__RGBA);
|
||||
types->BGRA = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__BGRA);
|
||||
types->ARGB = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__ARGB);
|
||||
types->ABGR = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__ABGR);
|
||||
types->RGB = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__RGB);
|
||||
types->BGR = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__BGR);
|
||||
types->Y41B = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__Y41B);
|
||||
types->Y42B = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__Y42B);
|
||||
types->YVYU = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__YVYU);
|
||||
types->Y444 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__Y444);
|
||||
types->v210 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__v210);
|
||||
types->v216 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__v216);
|
||||
types->NV12 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__NV12);
|
||||
types->NV21 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__NV21);
|
||||
types->GRAY8 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__GRAY8);
|
||||
types->GRAY16_BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__GRAY16_BE);
|
||||
types->GRAY16_LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__GRAY16_LE);
|
||||
types->v308 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__v308);
|
||||
types->RGB16 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__RGB16);
|
||||
types->BGR16 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__BGR16);
|
||||
types->RGB15 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__RGB15);
|
||||
types->BGR15 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__BGR15);
|
||||
types->UYVP = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__UYVP);
|
||||
types->A420 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A420);
|
||||
types->RGB8P = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__RGB8P);
|
||||
types->YUV9 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__YUV9);
|
||||
types->YVU9 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__YVU9);
|
||||
types->IYU1 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__IYU1);
|
||||
types->ARGB64 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__ARGB64);
|
||||
types->AYUV64 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__AYUV64);
|
||||
types->r210 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__r210);
|
||||
types->I420_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__I420_10BE);
|
||||
types->I420_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__I420_10LE);
|
||||
types->I422_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__I422_10BE);
|
||||
types->I422_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__I422_10LE);
|
||||
types->Y444_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__Y444_10BE);
|
||||
types->Y444_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__Y444_10LE);
|
||||
types->GBR = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__GBR);
|
||||
types->GBR_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__GBR_10BE);
|
||||
types->GBR_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__GBR_10LE);
|
||||
types->NV16 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__NV16);
|
||||
types->NV24 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__NV24);
|
||||
types->NV12_64Z32 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__NV12_64Z32);
|
||||
types->A420_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A420_10BE);
|
||||
types->A420_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A420_10LE);
|
||||
types->A422_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A422_10BE);
|
||||
types->A422_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A422_10LE);
|
||||
types->A444_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A444_10BE);
|
||||
types->A444_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__A444_10LE);
|
||||
types->NV61 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__NV61);
|
||||
types->P010_10BE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__P010_10BE);
|
||||
types->P010_10LE = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__P010_10LE);
|
||||
types->IYU2 = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__IYU2);
|
||||
types->VYUY = spa_id_map_get_id (map, SPA_VIDEO_FORMAT__VYUY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SpaVideoFlags:
|
||||
* @SPA_VIDEO_FLAG_NONE: no flags
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <lib/mapper.h>
|
||||
#include <spa/audio/raw.h>
|
||||
#include <spa/audio/format.h>
|
||||
#include <spa/audio/raw-utils.h>
|
||||
#include <spa/audio/format-utils.h>
|
||||
|
||||
SpaResult
|
||||
spa_format_audio_parse (const SpaFormat *format,
|
||||
|
|
@ -48,7 +48,7 @@ spa_format_audio_parse (const SpaFormat *format,
|
|||
|
||||
if (info->media_subtype == media_subtypes.raw) {
|
||||
spa_format_query (format,
|
||||
prop_audio.format, SPA_POD_TYPE_INT, &info->info.raw.format,
|
||||
prop_audio.format, SPA_POD_TYPE_URI, &info->info.raw.format,
|
||||
prop_audio.flags, SPA_POD_TYPE_INT, &info->info.raw.flags,
|
||||
prop_audio.layout, SPA_POD_TYPE_INT, &info->info.raw.layout,
|
||||
prop_audio.rate, SPA_POD_TYPE_INT, &info->info.raw.rate,
|
||||
|
|
|
|||
|
|
@ -22,9 +22,8 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <spa/video/raw.h>
|
||||
#include <spa/video/format.h>
|
||||
#include <spa/format-builder.h>
|
||||
#include <spa/video/format-utils.h>
|
||||
#include <lib/props.h>
|
||||
#include <lib/mapper.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -326,9 +326,9 @@ next:
|
|||
case 0:
|
||||
spa_pod_builder_format (&b, &f[0],
|
||||
this->uri.media_types.audio, this->uri.media_subtypes.raw,
|
||||
PROP_U_EN (&f[1], this->uri.prop_audio.format, SPA_POD_TYPE_INT, 3, SPA_AUDIO_FORMAT_S16,
|
||||
SPA_AUDIO_FORMAT_S16,
|
||||
SPA_AUDIO_FORMAT_S32),
|
||||
PROP_U_EN (&f[1], this->uri.prop_audio.format, SPA_POD_TYPE_URI, 3, this->uri.audio_formats.S16,
|
||||
this->uri.audio_formats.S16,
|
||||
this->uri.audio_formats.S32),
|
||||
PROP_U_MM (&f[1], this->uri.prop_audio.rate, SPA_POD_TYPE_INT, 44100, 1, INT32_MAX),
|
||||
PROP_U_MM (&f[1], this->uri.prop_audio.channels, SPA_POD_TYPE_INT, 2, 1, INT32_MAX));
|
||||
break;
|
||||
|
|
@ -799,6 +799,7 @@ alsa_sink_init (const SpaHandleFactory *factory,
|
|||
spa_media_subtypes_map (this->map, &this->uri.media_subtypes);
|
||||
spa_media_subtypes_audio_map (this->map, &this->uri.media_subtypes_audio);
|
||||
spa_prop_audio_map (this->map, &this->uri.prop_audio);
|
||||
spa_audio_formats_map (this->map, &this->uri.audio_formats);
|
||||
|
||||
this->node = alsasink_node;
|
||||
this->stream = SND_PCM_STREAM_PLAYBACK;
|
||||
|
|
|
|||
|
|
@ -360,9 +360,9 @@ next:
|
|||
case 0:
|
||||
spa_pod_builder_format (&b, &f[0],
|
||||
this->uri.media_types.audio, this->uri.media_subtypes.raw,
|
||||
PROP_U_EN (&f[1], this->uri.prop_audio.format, SPA_POD_TYPE_INT, 3, SPA_AUDIO_FORMAT_S16,
|
||||
SPA_AUDIO_FORMAT_S16,
|
||||
SPA_AUDIO_FORMAT_S32),
|
||||
PROP_U_EN (&f[1], this->uri.prop_audio.format, SPA_POD_TYPE_URI, 3, this->uri.audio_formats.S16,
|
||||
this->uri.audio_formats.S16,
|
||||
this->uri.audio_formats.S32),
|
||||
PROP_U_MM (&f[1], this->uri.prop_audio.rate, SPA_POD_TYPE_INT, 44100, 1, INT32_MAX),
|
||||
PROP_U_MM (&f[1], this->uri.prop_audio.channels, SPA_POD_TYPE_INT, 2, 1, INT32_MAX));
|
||||
break;
|
||||
|
|
@ -865,6 +865,7 @@ alsa_source_init (const SpaHandleFactory *factory,
|
|||
spa_media_subtypes_map (this->map, &this->uri.media_subtypes);
|
||||
spa_media_subtypes_audio_map (this->map, &this->uri.media_subtypes_audio);
|
||||
spa_prop_audio_map (this->map, &this->uri.prop_audio);
|
||||
spa_audio_formats_map (this->map, &this->uri.audio_formats);
|
||||
|
||||
this->node = alsasource_node;
|
||||
this->clock = alsasource_clock;
|
||||
|
|
|
|||
|
|
@ -56,54 +56,52 @@ spa_alsa_close (SpaALSAState *state)
|
|||
return err;
|
||||
}
|
||||
|
||||
static snd_pcm_format_t
|
||||
spa_alsa_format_to_alsa (SpaAudioFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case SPA_AUDIO_FORMAT_S8:
|
||||
return SND_PCM_FORMAT_S8;
|
||||
case SPA_AUDIO_FORMAT_U8:
|
||||
return SND_PCM_FORMAT_U8;
|
||||
/* 16 bit */
|
||||
case SPA_AUDIO_FORMAT_S16LE:
|
||||
return SND_PCM_FORMAT_S16_LE;
|
||||
case SPA_AUDIO_FORMAT_S16BE:
|
||||
return SND_PCM_FORMAT_S16_BE;
|
||||
case SPA_AUDIO_FORMAT_U16LE:
|
||||
return SND_PCM_FORMAT_U16_LE;
|
||||
case SPA_AUDIO_FORMAT_U16BE:
|
||||
return SND_PCM_FORMAT_U16_BE;
|
||||
/* 24 bit in low 3 bytes of 32 bits */
|
||||
case SPA_AUDIO_FORMAT_S24_32LE:
|
||||
return SND_PCM_FORMAT_S24_LE;
|
||||
case SPA_AUDIO_FORMAT_S24_32BE:
|
||||
return SND_PCM_FORMAT_S24_BE;
|
||||
case SPA_AUDIO_FORMAT_U24_32LE:
|
||||
return SND_PCM_FORMAT_U24_LE;
|
||||
case SPA_AUDIO_FORMAT_U24_32BE:
|
||||
return SND_PCM_FORMAT_U24_BE;
|
||||
/* 24 bit in 3 bytes */
|
||||
case SPA_AUDIO_FORMAT_S24LE:
|
||||
return SND_PCM_FORMAT_S24_3LE;
|
||||
case SPA_AUDIO_FORMAT_S24BE:
|
||||
return SND_PCM_FORMAT_S24_3BE;
|
||||
case SPA_AUDIO_FORMAT_U24LE:
|
||||
return SND_PCM_FORMAT_U24_3LE;
|
||||
case SPA_AUDIO_FORMAT_U24BE:
|
||||
return SND_PCM_FORMAT_U24_3BE;
|
||||
/* 32 bit */
|
||||
case SPA_AUDIO_FORMAT_S32LE:
|
||||
return SND_PCM_FORMAT_S32_LE;
|
||||
case SPA_AUDIO_FORMAT_S32BE:
|
||||
return SND_PCM_FORMAT_S32_BE;
|
||||
case SPA_AUDIO_FORMAT_U32LE:
|
||||
return SND_PCM_FORMAT_U32_LE;
|
||||
case SPA_AUDIO_FORMAT_U32BE:
|
||||
return SND_PCM_FORMAT_U32_BE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
typedef struct {
|
||||
off_t format_offset;
|
||||
snd_pcm_format_t format;
|
||||
} FormatInfo;
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define _FORMAT_LE(fmt) offsetof(URI, audio_formats. fmt ## _OE)
|
||||
#define _FORMAT_BE(fmt) offsetof(URI, audio_formats. fmt)
|
||||
#elif __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define _FORMAT_LE(fmt) offsetof(URI, audio_formats. fmt)
|
||||
#define _FORMAT_BE(fmt) offsetof(URI, audio_formats. fmt ## _OE)
|
||||
#endif
|
||||
|
||||
static const FormatInfo format_info[] =
|
||||
{
|
||||
{ offsetof(URI, audio_formats.UNKNOWN), SND_PCM_FORMAT_UNKNOWN },
|
||||
{ offsetof(URI, audio_formats.S8), SND_PCM_FORMAT_S8 },
|
||||
{ offsetof(URI, audio_formats.U8), SND_PCM_FORMAT_U8 },
|
||||
{ _FORMAT_LE (S16), SND_PCM_FORMAT_S16_LE },
|
||||
{ _FORMAT_BE (S16), SND_PCM_FORMAT_S16_BE },
|
||||
{ _FORMAT_LE (U16), SND_PCM_FORMAT_U16_LE },
|
||||
{ _FORMAT_BE (U16), SND_PCM_FORMAT_U16_BE },
|
||||
{ _FORMAT_LE (S24_32), SND_PCM_FORMAT_S24_LE },
|
||||
{ _FORMAT_BE (S24_32), SND_PCM_FORMAT_S24_BE },
|
||||
{ _FORMAT_LE (U24_32), SND_PCM_FORMAT_U24_LE },
|
||||
{ _FORMAT_BE (U24_32), SND_PCM_FORMAT_U24_BE },
|
||||
{ _FORMAT_LE (S24), SND_PCM_FORMAT_S24_3LE },
|
||||
{ _FORMAT_BE (S24), SND_PCM_FORMAT_S24_3BE },
|
||||
{ _FORMAT_LE (U24), SND_PCM_FORMAT_U24_3LE },
|
||||
{ _FORMAT_BE (U24), SND_PCM_FORMAT_U24_3BE },
|
||||
{ _FORMAT_LE (S32), SND_PCM_FORMAT_S32_LE },
|
||||
{ _FORMAT_BE (S32), SND_PCM_FORMAT_S32_BE },
|
||||
{ _FORMAT_LE (U32), SND_PCM_FORMAT_U32_LE },
|
||||
{ _FORMAT_BE (U32), SND_PCM_FORMAT_U32_BE },
|
||||
};
|
||||
|
||||
static snd_pcm_format_t
|
||||
spa_alsa_format_to_alsa (URI *uri, uint32_t format)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SPA_N_ELEMENTS (format_info); i++) {
|
||||
uint32_t f = *SPA_MEMBER (uri, format_info[i].format_offset, uint32_t);
|
||||
if (f == format)
|
||||
return format_info[i].format;
|
||||
}
|
||||
return SND_PCM_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +132,7 @@ spa_alsa_set_format (SpaALSAState *state, SpaAudioInfo *fmt, SpaPortFormatFlags
|
|||
CHECK (snd_pcm_hw_params_set_access(hndl, params, SND_PCM_ACCESS_MMAP_INTERLEAVED), "set_access");
|
||||
|
||||
/* set the sample format */
|
||||
format = spa_alsa_format_to_alsa (info->format);
|
||||
format = spa_alsa_format_to_alsa (&state->uri, info->format);
|
||||
spa_log_info (state->log, "Stream parameters are %iHz, %s, %i channels", info->rate, snd_pcm_format_name(format), info->channels);
|
||||
CHECK (snd_pcm_hw_params_set_format (hndl, params, format), "set_format");
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ extern "C" {
|
|||
#include <spa/node.h>
|
||||
#include <spa/loop.h>
|
||||
#include <spa/ringbuffer.h>
|
||||
#include <spa/audio/format.h>
|
||||
#include <spa/audio/format-utils.h>
|
||||
#include <spa/format-builder.h>
|
||||
|
||||
typedef struct _SpaALSAState SpaALSAState;
|
||||
|
|
@ -66,6 +66,7 @@ typedef struct {
|
|||
SpaMediaSubtypes media_subtypes;
|
||||
SpaMediaSubtypesAudio media_subtypes_audio;
|
||||
SpaPropAudio prop_audio;
|
||||
SpaAudioFormats audio_formats;
|
||||
} URI;
|
||||
|
||||
struct _SpaALSAState {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include <spa/log.h>
|
||||
#include <spa/id-map.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/audio/format.h>
|
||||
#include <spa/audio/format-utils.h>
|
||||
#include <lib/props.h>
|
||||
|
||||
#define MAX_PORTS 128
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include <spa/loop.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/list.h>
|
||||
#include <spa/audio/format.h>
|
||||
#include <spa/audio/format-utils.h>
|
||||
#include <spa/format-builder.h>
|
||||
#include <lib/props.h>
|
||||
|
||||
|
|
@ -42,6 +42,7 @@ typedef struct {
|
|||
SpaMediaTypes media_types;
|
||||
SpaMediaSubtypes media_subtypes;
|
||||
SpaPropAudio prop_audio;
|
||||
SpaAudioFormats audio_formats;
|
||||
} URI;
|
||||
|
||||
typedef struct _SpaAudioTestSrc SpaAudioTestSrc;
|
||||
|
|
@ -471,9 +472,9 @@ next:
|
|||
case 0:
|
||||
spa_pod_builder_format (&b, &f[0],
|
||||
this->uri.media_types.audio, this->uri.media_subtypes.raw,
|
||||
PROP_U_EN (&f[1], this->uri.prop_audio.format, SPA_POD_TYPE_INT, 3, SPA_AUDIO_FORMAT_S16,
|
||||
SPA_AUDIO_FORMAT_S16,
|
||||
SPA_AUDIO_FORMAT_S32),
|
||||
PROP_U_EN (&f[1], this->uri.prop_audio.format, SPA_POD_TYPE_URI, 3, this->uri.audio_formats.S16,
|
||||
this->uri.audio_formats.S16,
|
||||
this->uri.audio_formats.S32),
|
||||
PROP_U_MM (&f[1], this->uri.prop_audio.rate, SPA_POD_TYPE_INT, 44100, 1, INT32_MAX),
|
||||
PROP_U_MM (&f[1], this->uri.prop_audio.channels, SPA_POD_TYPE_INT, 2, 1, INT32_MAX));
|
||||
break;
|
||||
|
|
@ -589,7 +590,7 @@ spa_audiotestsrc_node_port_get_format (SpaNode *node,
|
|||
spa_pod_builder_init (&b, this->format_buffer, sizeof (this->format_buffer));
|
||||
spa_pod_builder_format (&b, &f[0],
|
||||
this->uri.media_types.audio, this->uri.media_subtypes.raw,
|
||||
PROP (&f[1], this->uri.prop_audio.format, SPA_POD_TYPE_INT, this->current_format.info.raw.format),
|
||||
PROP (&f[1], this->uri.prop_audio.format, SPA_POD_TYPE_URI, this->current_format.info.raw.format),
|
||||
PROP (&f[1], this->uri.prop_audio.rate, SPA_POD_TYPE_INT, this->current_format.info.raw.rate),
|
||||
PROP (&f[1], this->uri.prop_audio.channels, SPA_POD_TYPE_INT, this->current_format.info.raw.channels));
|
||||
|
||||
|
|
@ -958,6 +959,7 @@ audiotestsrc_init (const SpaHandleFactory *factory,
|
|||
spa_media_types_fill (&this->uri.media_types, this->map);
|
||||
spa_media_subtypes_map (this->map, &this->uri.media_subtypes);
|
||||
spa_prop_audio_map (this->map, &this->uri.prop_audio);
|
||||
spa_audio_formats_map (this->map, &this->uri.audio_formats);
|
||||
|
||||
this->node = audiotestsrc_node;
|
||||
this->clock = audiotestsrc_clock;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <spa/id-map.h>
|
||||
#include <spa/log.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/video/format.h>
|
||||
#include <spa/video/format-utils.h>
|
||||
#include <lib/props.h>
|
||||
|
||||
typedef struct _SpaFFMpegDec SpaFFMpegDec;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <spa/log.h>
|
||||
#include <spa/id-map.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/video/format.h>
|
||||
#include <spa/video/format-utils.h>
|
||||
#include <lib/props.h>
|
||||
|
||||
typedef struct _SpaFFMpegEnc SpaFFMpegEnc;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <linux/videodev2.h>
|
||||
|
||||
#include <spa/node.h>
|
||||
#include <spa/video/format.h>
|
||||
#include <spa/video/format-utils.h>
|
||||
#include <spa/list.h>
|
||||
#include <spa/log.h>
|
||||
#include <spa/loop.h>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include <spa/loop.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/list.h>
|
||||
#include <spa/video/format.h>
|
||||
#include <spa/video/format-utils.h>
|
||||
#include <spa/format-builder.h>
|
||||
#include <lib/props.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <spa/id-map.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/list.h>
|
||||
#include <spa/audio/format.h>
|
||||
#include <spa/audio/format-utils.h>
|
||||
#include <spa/format-builder.h>
|
||||
#include <lib/props.h>
|
||||
|
||||
|
|
@ -66,6 +66,7 @@ typedef struct {
|
|||
SpaMediaTypes media_types;
|
||||
SpaMediaSubtypes media_subtypes;
|
||||
SpaPropAudio prop_audio;
|
||||
SpaAudioFormats audio_formats;
|
||||
} URI;
|
||||
|
||||
struct _SpaVolume {
|
||||
|
|
@ -312,10 +313,10 @@ next:
|
|||
case 0:
|
||||
spa_pod_builder_format (&b, &f[0],
|
||||
this->uri.media_types.audio, this->uri.media_subtypes.raw,
|
||||
PROP_U_EN (&f[1], this->uri.prop_audio.format, SPA_POD_TYPE_INT, 3,
|
||||
SPA_AUDIO_FORMAT_S16,
|
||||
SPA_AUDIO_FORMAT_S16,
|
||||
SPA_AUDIO_FORMAT_S32),
|
||||
PROP_U_EN (&f[1], this->uri.prop_audio.format, SPA_POD_TYPE_URI, 3,
|
||||
this->uri.audio_formats.S16,
|
||||
this->uri.audio_formats.S16,
|
||||
this->uri.audio_formats.S32),
|
||||
PROP_U_MM (&f[1], this->uri.prop_audio.rate, SPA_POD_TYPE_INT, 44100, 1, INT32_MAX),
|
||||
PROP_U_MM (&f[1], this->uri.prop_audio.channels, SPA_POD_TYPE_INT, 2, 1, INT32_MAX));
|
||||
|
||||
|
|
@ -844,6 +845,7 @@ volume_init (const SpaHandleFactory *factory,
|
|||
spa_media_types_fill (&this->uri.media_types, this->map);
|
||||
spa_media_subtypes_map (this->map, &this->uri.media_subtypes);
|
||||
spa_prop_audio_map (this->map, &this->uri.prop_audio);
|
||||
spa_audio_formats_map (this->map, &this->uri.audio_formats);
|
||||
|
||||
this->node = volume_node;
|
||||
reset_volume_props (&this->props);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include <spa/id-map.h>
|
||||
#include <spa/log.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/video/format.h>
|
||||
#include <spa/video/format-utils.h>
|
||||
#include <lib/props.h>
|
||||
|
||||
typedef struct _SpaXvSink SpaXvSink;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include <spa/log.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/loop.h>
|
||||
#include <spa/video/format.h>
|
||||
#include <spa/video/format-utils.h>
|
||||
#include <spa/format-builder.h>
|
||||
#include <lib/debug.h>
|
||||
#include <lib/mapper.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue