mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
spa: don't use typedef for struct and enum
This commit is contained in:
parent
83964cec87
commit
11f23a3ffa
163 changed files with 6510 additions and 8264 deletions
|
|
@ -28,17 +28,17 @@ extern "C" {
|
|||
#include <spa/audio/format.h>
|
||||
#include <spa/audio/raw-utils.h>
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_format_audio {
|
||||
uint32_t format;
|
||||
uint32_t flags;
|
||||
uint32_t layout;
|
||||
uint32_t rate;
|
||||
uint32_t channels;
|
||||
uint32_t channel_mask;
|
||||
} SpaTypeFormatAudio;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_format_audio_map (SpaTypeMap *map, SpaTypeFormatAudio *type)
|
||||
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);
|
||||
|
|
@ -51,9 +51,9 @@ spa_type_format_audio_map (SpaTypeMap *map, SpaTypeFormatAudio *type)
|
|||
}
|
||||
|
||||
static inline bool
|
||||
spa_format_audio_raw_parse (const SpaFormat *format,
|
||||
SpaAudioInfoRaw *info,
|
||||
SpaTypeFormatAudio *type)
|
||||
spa_format_audio_raw_parse (const struct spa_format *format,
|
||||
struct spa_audio_info_raw *info,
|
||||
struct spa_type_format_audio *type)
|
||||
{
|
||||
spa_format_query (format,
|
||||
type->format, SPA_POD_TYPE_ID, &info->format,
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ extern "C" {
|
|||
#include <spa/format.h>
|
||||
#include <spa/audio/raw.h>
|
||||
|
||||
typedef struct _SpaAudioInfo SpaAudioInfo;
|
||||
|
||||
#define SPA_TYPE_FORMAT__Audio SPA_TYPE_FORMAT_BASE "Audio"
|
||||
#define SPA_TYPE_FORMAT_AUDIO_BASE SPA_TYPE_FORMAT__Audio ":"
|
||||
|
||||
|
|
@ -39,11 +37,11 @@ typedef struct _SpaAudioInfo SpaAudioInfo;
|
|||
#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 _SpaAudioInfo {
|
||||
struct spa_audio_info {
|
||||
uint32_t media_type;
|
||||
uint32_t media_subtype;
|
||||
union {
|
||||
SpaAudioInfoRaw raw;
|
||||
struct spa_audio_info_raw raw;
|
||||
} info;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ extern "C" {
|
|||
#define _SPA_TYPE_AUDIO_FORMAT_OE(fmt) SPA_TYPE_AUDIO_FORMAT_BASE fmt "BE"
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_audio_format {
|
||||
uint32_t UNKNOWN;
|
||||
uint32_t ENCODED;
|
||||
uint32_t S8;
|
||||
|
|
@ -68,10 +68,10 @@ typedef struct {
|
|||
uint32_t U18_OE;
|
||||
uint32_t F32_OE;
|
||||
uint32_t F64_OE;
|
||||
} SpaTypeAudioFormat;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_audio_format_map (SpaTypeMap *map, SpaTypeAudioFormat *type)
|
||||
spa_type_audio_format_map (struct spa_type_map *map, struct spa_type_audio_format *type)
|
||||
{
|
||||
if (type->ENCODED == 0) {
|
||||
type->UNKNOWN = 0;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaAudioInfoRaw SpaAudioInfoRaw;
|
||||
|
||||
#include <endian.h>
|
||||
|
||||
#define SPA_TYPE__AudioFormat SPA_TYPE_ENUM_BASE "AudioFormat"
|
||||
|
|
@ -65,32 +63,32 @@ typedef struct _SpaAudioInfoRaw SpaAudioInfoRaw;
|
|||
#define SPA_TYPE_AUDIO_FORMAT__F64BE SPA_TYPE_AUDIO_FORMAT_BASE "F64BE"
|
||||
|
||||
/**
|
||||
* SpaAudioFlags:
|
||||
* spa_audio_flags:
|
||||
* @SPA_AUDIO_FLAG_NONE: no valid flag
|
||||
* @SPA_AUDIO_FLAG_UNPOSITIONED: the position array explicitly
|
||||
* contains unpositioned channels.
|
||||
*
|
||||
* Extra audio flags
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_audio_flags {
|
||||
SPA_AUDIO_FLAG_NONE = 0,
|
||||
SPA_AUDIO_FLAG_UNPOSITIONED = (1 << 0)
|
||||
} SpaAudioFlags;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaAudioLayout:
|
||||
* 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.
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_audio_layout {
|
||||
SPA_AUDIO_LAYOUT_INTERLEAVED = 0,
|
||||
SPA_AUDIO_LAYOUT_NON_INTERLEAVED
|
||||
} SpaAudioLayout;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaAudioInfoRaw:
|
||||
* spa_audio_info_raw:
|
||||
* @format: the format
|
||||
* @flags: extra flags
|
||||
* @layout: the sample layout
|
||||
|
|
@ -98,13 +96,13 @@ typedef enum {
|
|||
* @channels: the number of channels
|
||||
* @channel_mask: the channel mask
|
||||
*/
|
||||
struct _SpaAudioInfoRaw {
|
||||
uint32_t format;
|
||||
SpaAudioFlags flags;
|
||||
SpaAudioLayout layout;
|
||||
uint32_t rate;
|
||||
uint32_t channels;
|
||||
uint32_t 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
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaBuffer SpaBuffer;
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/meta.h>
|
||||
#include <spa/type-map.h>
|
||||
|
|
@ -41,15 +39,15 @@ typedef struct _SpaBuffer SpaBuffer;
|
|||
#define SPA_TYPE_DATA__DmaBuf SPA_TYPE_DATA_BASE "DmaBuf"
|
||||
#define SPA_TYPE_DATA__Id SPA_TYPE_DATA_BASE "Id"
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_data {
|
||||
uint32_t MemPtr;
|
||||
uint32_t MemFd;
|
||||
uint32_t DmaBuf;
|
||||
uint32_t Id;
|
||||
} SpaTypeData;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_data_map (SpaTypeMap *map, SpaTypeData *type)
|
||||
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);
|
||||
|
|
@ -60,19 +58,19 @@ spa_type_data_map (SpaTypeMap *map, SpaTypeData *type)
|
|||
}
|
||||
|
||||
/**
|
||||
* SpaChunk:
|
||||
* spa_chunk:
|
||||
* @offset: offset of valid data
|
||||
* @size: size of valid data
|
||||
* @stride: stride of data if applicable
|
||||
*/
|
||||
typedef struct {
|
||||
struct spa_chunk {
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
int32_t stride;
|
||||
} SpaChunk;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaData:
|
||||
* spa_data:
|
||||
* @type: memory type
|
||||
* @flags: memory flags
|
||||
* @fd: file descriptor
|
||||
|
|
@ -81,34 +79,34 @@ typedef struct {
|
|||
* @data: pointer to memory
|
||||
* @chunk: pointer to chunk with valid offset
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t type;
|
||||
uint32_t flags;
|
||||
int fd;
|
||||
uint32_t mapoffset;
|
||||
uint32_t maxsize;
|
||||
void *data;
|
||||
SpaChunk *chunk;
|
||||
} SpaData;
|
||||
struct spa_data {
|
||||
uint32_t type;
|
||||
uint32_t flags;
|
||||
int fd;
|
||||
uint32_t mapoffset;
|
||||
uint32_t maxsize;
|
||||
void *data;
|
||||
struct spa_chunk *chunk;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaBuffer:
|
||||
* spa_buffer:
|
||||
* @id: buffer id
|
||||
* @n_metas: number of metadata
|
||||
* @metas: offset of array of @n_metas metadata
|
||||
* @n_datas: number of data pointers
|
||||
* @datas: offset of array of @n_datas data pointers
|
||||
*/
|
||||
struct _SpaBuffer {
|
||||
uint32_t id;
|
||||
uint32_t n_metas;
|
||||
SpaMeta *metas;
|
||||
uint32_t n_datas;
|
||||
SpaData *datas;
|
||||
struct spa_buffer {
|
||||
uint32_t id;
|
||||
uint32_t n_metas;
|
||||
struct spa_meta *metas;
|
||||
uint32_t n_datas;
|
||||
struct spa_data *datas;
|
||||
};
|
||||
|
||||
static inline void *
|
||||
spa_buffer_find_meta (SpaBuffer *b, uint32_t type)
|
||||
spa_buffer_find_meta (struct spa_buffer *b, uint32_t type)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,76 +24,74 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaClock SpaClock;
|
||||
|
||||
#define SPA_TYPE__Clock SPA_TYPE_INTERFACE_BASE "Clock"
|
||||
#define SPA_TYPE_CLOCK_BASE SPA_TYPE__Clock ":"
|
||||
|
||||
/**
|
||||
* SpaClockState:
|
||||
* spa_clock_state:
|
||||
* @SPA_CLOCK_STATE_STOPPED: the clock is stopped
|
||||
* @SPA_CLOCK_STATE_PAUSED: the clock is paused
|
||||
* @SPA_CLOCK_STATE_RUNNING: the clock is running
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_clock_state {
|
||||
SPA_CLOCK_STATE_STOPPED,
|
||||
SPA_CLOCK_STATE_PAUSED,
|
||||
SPA_CLOCK_STATE_RUNNING,
|
||||
} SpaClockState;
|
||||
};
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/plugin.h>
|
||||
#include <spa/props.h>
|
||||
|
||||
/**
|
||||
* SpaClock:
|
||||
* spa_clock:
|
||||
*
|
||||
* A time provider.
|
||||
*/
|
||||
struct _SpaClock {
|
||||
struct spa_clock {
|
||||
/* the total size of this clock. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
/**
|
||||
* SpaClock::info
|
||||
* spa_clock::info
|
||||
*
|
||||
* Extra information about the clock
|
||||
*/
|
||||
const SpaDict *info;
|
||||
const struct spa_dict *info;
|
||||
/**
|
||||
* SpaClock::state:
|
||||
* spa_clock::state:
|
||||
*
|
||||
* The current state of the clock
|
||||
*/
|
||||
SpaClockState state;
|
||||
enum spa_clock_state state;
|
||||
/**
|
||||
* SpaClock::get_props:
|
||||
* @clock: a #SpaClock
|
||||
* @props: a location for a #SpaProps pointer
|
||||
* spa_clock::get_props:
|
||||
* @clock: a #spa_clock
|
||||
* @props: a location for a #struct spa_props pointer
|
||||
*
|
||||
* Get the configurable properties of @clock.
|
||||
*
|
||||
* The returned @props is a snapshot of the current configuration and
|
||||
* can be modified. The modifications will take effect after a call
|
||||
* to SpaClock::set_props.
|
||||
* to spa_clock::set_props.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when clock or props are %NULL
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no properties
|
||||
* implemented on @clock
|
||||
*/
|
||||
SpaResult (*get_props) (SpaClock *clock,
|
||||
SpaProps **props);
|
||||
int (*get_props) (struct spa_clock *clock,
|
||||
struct spa_props **props);
|
||||
/**
|
||||
* SpaClock::set_props:
|
||||
* @clock: a #SpaClock
|
||||
* @props: a #SpaProps
|
||||
* spa_clock::set_props:
|
||||
* @clock: a #spa_clock
|
||||
* @props: a #struct spa_props
|
||||
*
|
||||
* Set the configurable properties in @clock.
|
||||
*
|
||||
* Usually, @props will be obtained from SpaClock::get_props and then
|
||||
* modified but it is also possible to set another #SpaProps object
|
||||
* as long as its keys and types match those of SpaProps::get_props.
|
||||
* Usually, @props will be obtained from spa_clock::get_props and then
|
||||
* modified but it is also possible to set another #struct spa_props object
|
||||
* as long as its keys and types match those of struct spa_props::get_props.
|
||||
*
|
||||
* Properties with keys that are not known are ignored.
|
||||
*
|
||||
|
|
@ -106,13 +104,13 @@ struct _SpaClock {
|
|||
* #SPA_RESULT_WRONG_PROPERTY_TYPE when a property has the wrong
|
||||
* type.
|
||||
*/
|
||||
SpaResult (*set_props) (SpaClock *clock,
|
||||
const SpaProps *props);
|
||||
int (*set_props) (struct spa_clock *clock,
|
||||
const struct spa_props *props);
|
||||
|
||||
SpaResult (*get_time) (SpaClock *clock,
|
||||
int32_t *rate,
|
||||
int64_t *ticks,
|
||||
int64_t *monotonic_time);
|
||||
int (*get_time) (struct spa_clock *clock,
|
||||
int32_t *rate,
|
||||
int64_t *ticks,
|
||||
int64_t *monotonic_time);
|
||||
};
|
||||
|
||||
#define spa_clock_get_props(n,...) (n)->get_props((n),__VA_ARGS__)
|
||||
|
|
|
|||
|
|
@ -37,17 +37,17 @@ extern "C" {
|
|||
#define SPA_TYPE_COMMAND_NODE__Marker SPA_TYPE_COMMAND_NODE_BASE "Marker"
|
||||
#define SPA_TYPE_COMMAND_NODE__ClockUpdate SPA_TYPE_COMMAND_NODE_BASE "ClockUpdate"
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_command_node {
|
||||
uint32_t Pause;
|
||||
uint32_t Start;
|
||||
uint32_t Flush;
|
||||
uint32_t Drain;
|
||||
uint32_t Marker;
|
||||
uint32_t ClockUpdate;
|
||||
} SpaTypeCommandNode;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_command_node_map (SpaTypeMap *map, SpaTypeCommandNode *type)
|
||||
spa_type_command_node_map (struct spa_type_map *map, struct spa_type_command_node *type)
|
||||
{
|
||||
if (type->Pause == 0) {
|
||||
type->Pause = spa_type_map_get_id (map, SPA_TYPE_COMMAND_NODE__Pause);
|
||||
|
|
@ -60,7 +60,7 @@ spa_type_command_node_map (SpaTypeMap *map, SpaTypeCommandNode *type)
|
|||
}
|
||||
|
||||
/**
|
||||
* SpaCommandNodeClockUpdate:
|
||||
* spa_command_node_clock_update:
|
||||
* @change_mask: marks which fields are updated
|
||||
* @rate: the number of @ticks per second
|
||||
* @ticks: the new ticks, when @change_mask = 1<<0
|
||||
|
|
@ -71,40 +71,40 @@ spa_type_command_node_map (SpaTypeMap *map, SpaTypeCommandNode *type)
|
|||
* @scale: update to the speed stored as Q16.16, @change_mask = 1<<1
|
||||
* @state: the new clock state, when @change_mask = 1<<2
|
||||
*/
|
||||
typedef struct {
|
||||
SpaPODObjectBody body;
|
||||
struct spa_command_node_clock_update_body {
|
||||
struct spa_pod_object_body body;
|
||||
#define SPA_COMMAND_NODE_CLOCK_UPDATE_TIME (1 << 0)
|
||||
#define SPA_COMMAND_NODE_CLOCK_UPDATE_SCALE (1 << 1)
|
||||
#define SPA_COMMAND_NODE_CLOCK_UPDATE_STATE (1 << 2)
|
||||
#define SPA_COMMAND_NODE_CLOCK_UPDATE_LATENCY (1 << 3)
|
||||
SpaPODInt change_mask SPA_ALIGNED (8);
|
||||
SpaPODInt rate SPA_ALIGNED (8);
|
||||
SpaPODLong ticks SPA_ALIGNED (8);
|
||||
SpaPODLong monotonic_time SPA_ALIGNED (8);
|
||||
SpaPODLong offset SPA_ALIGNED (8);
|
||||
SpaPODInt scale SPA_ALIGNED (8);
|
||||
SpaPODInt state SPA_ALIGNED (8);
|
||||
struct spa_pod_int change_mask SPA_ALIGNED (8);
|
||||
struct spa_pod_int rate SPA_ALIGNED (8);
|
||||
struct spa_pod_long ticks SPA_ALIGNED (8);
|
||||
struct spa_pod_long monotonic_time SPA_ALIGNED (8);
|
||||
struct spa_pod_long offset SPA_ALIGNED (8);
|
||||
struct spa_pod_int scale SPA_ALIGNED (8);
|
||||
struct spa_pod_int state SPA_ALIGNED (8);
|
||||
#define SPA_COMMAND_NODE_CLOCK_UPDATE_FLAG_LIVE (1 << 0)
|
||||
SpaPODInt flags SPA_ALIGNED (8);
|
||||
SpaPODLong latency SPA_ALIGNED (8);
|
||||
} SpaCommandNodeClockUpdateBody;
|
||||
struct spa_pod_int flags SPA_ALIGNED (8);
|
||||
struct spa_pod_long latency SPA_ALIGNED (8);
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
SpaCommandNodeClockUpdateBody body;
|
||||
} SpaCommandNodeClockUpdate;
|
||||
struct spa_command_node_clock_update {
|
||||
struct spa_pod pod;
|
||||
struct spa_command_node_clock_update_body body;
|
||||
};
|
||||
|
||||
#define SPA_COMMAND_NODE_CLOCK_UPDATE_INIT(type,change_mask,rate,ticks,monotonic_time,offset,scale,state,flags,latency) \
|
||||
SPA_COMMAND_INIT_COMPLEX (SpaCommandNodeClockUpdate, \
|
||||
sizeof (SpaCommandNodeClockUpdateBody), type, \
|
||||
SPA_POD_INT_INIT (change_mask), \
|
||||
SPA_POD_INT_INIT (rate), \
|
||||
SPA_POD_LONG_INIT (ticks), \
|
||||
SPA_POD_LONG_INIT (monotonic_time), \
|
||||
SPA_POD_LONG_INIT (offset), \
|
||||
SPA_POD_INT_INIT (scale), \
|
||||
SPA_POD_INT_INIT (state), \
|
||||
SPA_POD_INT_INIT (flags), \
|
||||
SPA_COMMAND_INIT_COMPLEX (struct spa_command_node_clock_update, \
|
||||
sizeof (struct spa_command_node_clock_update_body), type, \
|
||||
SPA_POD_INT_INIT (change_mask), \
|
||||
SPA_POD_INT_INIT (rate), \
|
||||
SPA_POD_LONG_INIT (ticks), \
|
||||
SPA_POD_LONG_INIT (monotonic_time), \
|
||||
SPA_POD_LONG_INIT (offset), \
|
||||
SPA_POD_INT_INIT (scale), \
|
||||
SPA_POD_INT_INIT (state), \
|
||||
SPA_POD_INT_INIT (flags), \
|
||||
SPA_POD_LONG_INIT (latency))
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -24,27 +24,25 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaCommand SpaCommand;
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/pod.h>
|
||||
|
||||
#define SPA_TYPE__Command SPA_TYPE_POD_OBJECT_BASE "Command"
|
||||
#define SPA_TYPE_COMMAND_BASE SPA_TYPE__Command ":"
|
||||
|
||||
typedef struct {
|
||||
SpaPODObjectBody body;
|
||||
} SpaCommandBody;
|
||||
struct spa_command_body {
|
||||
struct spa_pod_object_body body;
|
||||
};
|
||||
|
||||
struct _SpaCommand {
|
||||
SpaPOD pod;
|
||||
SpaCommandBody body;
|
||||
struct spa_command {
|
||||
struct spa_pod pod;
|
||||
struct spa_command_body body;
|
||||
};
|
||||
|
||||
#define SPA_COMMAND_TYPE(cmd) ((cmd)->body.body.type)
|
||||
|
||||
#define SPA_COMMAND_INIT(type) (SpaCommand) \
|
||||
{ { sizeof (SpaCommandBody), SPA_POD_TYPE_OBJECT }, \
|
||||
#define SPA_COMMAND_INIT(type) (struct spa_command) \
|
||||
{ { sizeof (struct spa_command_body), SPA_POD_TYPE_OBJECT }, \
|
||||
{ { 0, type } } } \
|
||||
|
||||
#define SPA_COMMAND_INIT_COMPLEX(t,size,type,...) (t) \
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ extern "C" {
|
|||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef enum {
|
||||
enum {
|
||||
SPA_RESULT_ASYNC = (1 << 30),
|
||||
SPA_RESULT_WAIT_SYNC = 2,
|
||||
SPA_RESULT_MODIFIED = 1,
|
||||
|
|
@ -71,7 +71,7 @@ typedef enum {
|
|||
SPA_RESULT_SKIPPED = -34,
|
||||
SPA_RESULT_OUT_OF_BUFFERS = -35,
|
||||
SPA_RESULT_INCOMPATIBLE_PROPS = -36,
|
||||
} SpaResult;
|
||||
};
|
||||
|
||||
#define SPA_ASYNC_MASK (3 << 30)
|
||||
#define SPA_ASYNC_SEQ_MASK (SPA_RESULT_ASYNC - 1)
|
||||
|
|
@ -83,22 +83,20 @@ typedef enum {
|
|||
#define SPA_RESULT_ASYNC_SEQ(res) ((res) & SPA_ASYNC_SEQ_MASK)
|
||||
#define SPA_RESULT_RETURN_ASYNC(seq) (SPA_RESULT_ASYNC | ((seq) & SPA_ASYNC_SEQ_MASK))
|
||||
|
||||
typedef enum {
|
||||
enum spa_direction {
|
||||
SPA_DIRECTION_INPUT = 0,
|
||||
SPA_DIRECTION_OUTPUT = 1,
|
||||
} SpaDirection;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct spa_rectangle {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
} SpaRectangle;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct spa_fraction {
|
||||
uint32_t num;
|
||||
uint32_t denom;
|
||||
} SpaFraction;
|
||||
|
||||
typedef void (*SpaNotify) (void *data);
|
||||
};
|
||||
|
||||
#define SPA_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
|
||||
#define SPA_MIN(a,b) ((a)<(b) ? (a) : (b))
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaDict SpaDict;
|
||||
|
||||
#define SPA_TYPE__Dict SPA_TYPE_POINTER_BASE "Dict"
|
||||
#define SPA_TYPE_DICT_BASE SPA_TYPE__Dict ":"
|
||||
|
||||
|
|
@ -33,14 +31,14 @@ typedef struct _SpaDict SpaDict;
|
|||
|
||||
#include <spa/defs.h>
|
||||
|
||||
typedef struct {
|
||||
struct spa_dict_item {
|
||||
const char *key;
|
||||
const char *value;
|
||||
} SpaDictItem;
|
||||
};
|
||||
|
||||
struct _SpaDict {
|
||||
uint32_t n_items;
|
||||
SpaDictItem *items;
|
||||
struct spa_dict {
|
||||
uint32_t n_items;
|
||||
struct spa_dict_item *items;
|
||||
};
|
||||
|
||||
#define SPA_DICT_INIT(n_items,items) { n_items, items }
|
||||
|
|
@ -50,10 +48,10 @@ struct _SpaDict {
|
|||
(item) < &(dict)->items[(dict)->n_items]; \
|
||||
(item)++)
|
||||
|
||||
static inline SpaDictItem *
|
||||
spa_dict_lookup_item (const SpaDict *dict, const char *key)
|
||||
static inline struct spa_dict_item *
|
||||
spa_dict_lookup_item (const struct spa_dict *dict, const char *key)
|
||||
{
|
||||
SpaDictItem *item;
|
||||
struct spa_dict_item *item;
|
||||
spa_dict_for_each (item, dict) {
|
||||
if (!strcmp (item->key, key))
|
||||
return item;
|
||||
|
|
@ -62,9 +60,9 @@ spa_dict_lookup_item (const SpaDict *dict, const char *key)
|
|||
}
|
||||
|
||||
static inline const char *
|
||||
spa_dict_lookup (const SpaDict *dict, const char *key)
|
||||
spa_dict_lookup (const struct spa_dict *dict, const char *key)
|
||||
{
|
||||
SpaDictItem *item = spa_dict_lookup_item (dict, key);
|
||||
struct spa_dict_item *item = spa_dict_lookup_item (dict, key);
|
||||
return item ? item->value : NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,16 +38,16 @@ extern "C" {
|
|||
#define SPA_TYPE_EVENT_NODE__RequestRefresh SPA_TYPE_EVENT_NODE_BASE "RequestRefresh"
|
||||
#define SPA_TYPE_EVENT_NODE__RequestClockUpdate SPA_TYPE_EVENT_NODE_BASE "RequestClockUpdate"
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_event_node {
|
||||
uint32_t AsyncComplete;
|
||||
uint32_t Error;
|
||||
uint32_t Buffering;
|
||||
uint32_t RequestRefresh;
|
||||
uint32_t RequestClockUpdate;
|
||||
} SpaTypeEventNode;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_event_node_map (SpaTypeMap *map, SpaTypeEventNode *type)
|
||||
spa_type_event_node_map (struct spa_type_map *map, struct spa_type_event_node *type)
|
||||
{
|
||||
if (type->AsyncComplete == 0) {
|
||||
type->AsyncComplete = spa_type_map_get_id (map, SPA_TYPE_EVENT_NODE__AsyncComplete);
|
||||
|
|
@ -58,43 +58,43 @@ spa_type_event_node_map (SpaTypeMap *map, SpaTypeEventNode *type)
|
|||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
SpaPODObjectBody body;
|
||||
SpaPODInt seq SPA_ALIGNED (8);
|
||||
SpaPODInt res SPA_ALIGNED (8);
|
||||
} SpaEventNodeAsyncCompleteBody;
|
||||
struct spa_event_node_async_complete_body {
|
||||
struct spa_pod_object_body body;
|
||||
struct spa_pod_int seq SPA_ALIGNED (8);
|
||||
struct spa_pod_int res SPA_ALIGNED (8);
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
SpaEventNodeAsyncCompleteBody body;
|
||||
} SpaEventNodeAsyncComplete;
|
||||
struct spa_event_node_async_complete {
|
||||
struct spa_pod pod;
|
||||
struct spa_event_node_async_complete_body body;
|
||||
};
|
||||
|
||||
#define SPA_EVENT_NODE_ASYNC_COMPLETE_INIT(type,seq,res) \
|
||||
SPA_EVENT_INIT_COMPLEX (SpaEventNodeAsyncComplete, \
|
||||
sizeof (SpaEventNodeAsyncCompleteBody), type, \
|
||||
SPA_POD_INT_INIT (seq), \
|
||||
#define SPA_EVENT_NODE_ASYNC_COMPLETE_INIT(type,seq,res) \
|
||||
SPA_EVENT_INIT_COMPLEX (struct spa_event_node_async_complete, \
|
||||
sizeof (struct spa_event_node_async_complete_body), type, \
|
||||
SPA_POD_INT_INIT (seq), \
|
||||
SPA_POD_INT_INIT (res))
|
||||
|
||||
typedef struct {
|
||||
SpaPODObjectBody body;
|
||||
struct spa_event_node_request_clock_update_body {
|
||||
struct spa_pod_object_body body;
|
||||
#define SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_TIME (1 << 0)
|
||||
#define SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_SCALE (1 << 1)
|
||||
#define SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_STATE (1 << 2)
|
||||
SpaPODInt update_mask SPA_ALIGNED (8);
|
||||
SpaPODLong timestamp SPA_ALIGNED (8);
|
||||
SpaPODLong offset SPA_ALIGNED (8);
|
||||
} SpaEventNodeRequestClockUpdateBody;
|
||||
struct spa_pod_int update_mask SPA_ALIGNED (8);
|
||||
struct spa_pod_long timestamp SPA_ALIGNED (8);
|
||||
struct spa_pod_long offset SPA_ALIGNED (8);
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
SpaEventNodeRequestClockUpdateBody body;
|
||||
} SpaEventNodeRequestClockUpdate;
|
||||
struct spa_event_node_request_clock_update {
|
||||
struct spa_pod pod;
|
||||
struct spa_event_node_request_clock_update_body body;
|
||||
};
|
||||
|
||||
#define SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_INIT(type,update_mask,timestamp,offset) \
|
||||
SPA_EVENT_INIT_COMPLEX (SpaEventNodeRequestClockUpdate, \
|
||||
sizeof (SpaEventNodeRequestClockUpdateBody), type, \
|
||||
SPA_POD_INT_INIT (update_mask), \
|
||||
SPA_POD_LONG_INIT (timestamp), \
|
||||
#define SPA_EVENT_NODE_REQUEST_CLOCK_UPDATE_INIT(type,update_mask,timestamp,offset) \
|
||||
SPA_EVENT_INIT_COMPLEX (struct spa_event_node_request_clock_update, \
|
||||
sizeof (struct spa_event_node_request_clock_update_body), type, \
|
||||
SPA_POD_INT_INIT (update_mask), \
|
||||
SPA_POD_LONG_INIT (timestamp), \
|
||||
SPA_POD_LONG_INIT (offset))
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -24,32 +24,30 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaEvent SpaEvent;
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/pod.h>
|
||||
|
||||
#define SPA_TYPE__Event SPA_TYPE_POD_OBJECT_BASE "Event"
|
||||
#define SPA_TYPE_EVENT_BASE SPA_TYPE__Event ":"
|
||||
|
||||
typedef struct {
|
||||
SpaPODObjectBody body;
|
||||
} SpaEventBody;
|
||||
struct spa_event_body {
|
||||
struct spa_pod_object_body body;
|
||||
};
|
||||
|
||||
struct _SpaEvent {
|
||||
SpaPOD pod;
|
||||
SpaEventBody body;
|
||||
struct spa_event {
|
||||
struct spa_pod pod;
|
||||
struct spa_event_body body;
|
||||
};
|
||||
|
||||
#define SPA_EVENT_TYPE(ev) ((ev)->body.body.type)
|
||||
|
||||
#define SPA_EVENT_INIT(type) (SpaEvent) \
|
||||
{ { sizeof (SpaEventBody), SPA_POD_TYPE_OBJECT }, \
|
||||
{ { 0, type } } } \
|
||||
#define SPA_EVENT_INIT(type) (struct spa_event) \
|
||||
{ { sizeof (struct spa_event_body), SPA_POD_TYPE_OBJECT }, \
|
||||
{ { 0, type } } } \
|
||||
|
||||
#define SPA_EVENT_INIT_COMPLEX(t,size,type,...) (t) \
|
||||
{ { size, SPA_POD_TYPE_OBJECT }, \
|
||||
{ { 0, type }, __VA_ARGS__ } } \
|
||||
#define SPA_EVENT_INIT_COMPLEX(t,size,type,...) (t) \
|
||||
{ { size, SPA_POD_TYPE_OBJECT }, \
|
||||
{ { 0, type }, __VA_ARGS__ } } \
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ extern "C" {
|
|||
#include <spa/pod-builder.h>
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push_format (SpaPODBuilder *builder,
|
||||
SpaPODFrame *frame,
|
||||
uint32_t format_type,
|
||||
uint32_t media_type,
|
||||
uint32_t media_subtype)
|
||||
spa_pod_builder_push_format (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame,
|
||||
uint32_t format_type,
|
||||
uint32_t media_type,
|
||||
uint32_t media_subtype)
|
||||
{
|
||||
const SpaFormat p = { { sizeof (SpaFormatBody), SPA_POD_TYPE_OBJECT },
|
||||
const struct spa_format p = { { sizeof (struct spa_format_body), SPA_POD_TYPE_OBJECT },
|
||||
{ { 0, format_type },
|
||||
{ { sizeof (uint32_t), SPA_POD_TYPE_ID }, media_type },
|
||||
{ { sizeof (uint32_t), SPA_POD_TYPE_ID }, media_subtype } } };
|
||||
|
|
@ -50,10 +50,10 @@ spa_pod_builder_push_format (SpaPODBuilder *builder,
|
|||
SPA_POD_TYPE_ID,media_subtype, \
|
||||
__VA_ARGS__)
|
||||
|
||||
SpaResult
|
||||
spa_format_filter (const SpaFormat *format,
|
||||
const SpaFormat *filter,
|
||||
SpaPODBuilder *result);
|
||||
int
|
||||
spa_format_filter (const struct spa_format *format,
|
||||
const struct spa_format *filter,
|
||||
struct spa_pod_builder *result);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -30,16 +30,16 @@ extern "C" {
|
|||
#include <spa/pod-utils.h>
|
||||
#include <spa/type-map.h>
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_media_type {
|
||||
uint32_t audio;
|
||||
uint32_t video;
|
||||
uint32_t image;
|
||||
uint32_t binary;
|
||||
uint32_t stream;
|
||||
} SpaTypeMediaType;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_media_type_map (SpaTypeMap *map, SpaTypeMediaType *type)
|
||||
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);
|
||||
|
|
@ -50,19 +50,19 @@ spa_type_media_type_map (SpaTypeMap *map, SpaTypeMediaType *type)
|
|||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_media_subtype {
|
||||
uint32_t raw;
|
||||
} SpaTypeMediaSubtype;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_media_subtype_map (SpaTypeMap *map, SpaTypeMediaSubtype *type)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_media_subtype_video {
|
||||
uint32_t h264;
|
||||
uint32_t mjpg;
|
||||
uint32_t dv;
|
||||
|
|
@ -77,30 +77,30 @@ typedef struct {
|
|||
uint32_t vp9;
|
||||
uint32_t jpeg;
|
||||
uint32_t bayer;
|
||||
} SpaTypeMediaSubtypeVideo;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_media_subtype_video_map (SpaTypeMap *map, SpaTypeMediaSubtypeVideo *type)
|
||||
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->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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_media_subtype_audio {
|
||||
uint32_t mp3;
|
||||
uint32_t aac;
|
||||
uint32_t vorbis;
|
||||
|
|
@ -113,24 +113,24 @@ typedef struct {
|
|||
uint32_t g729;
|
||||
uint32_t amr;
|
||||
uint32_t gsm;
|
||||
} SpaTypeMediaSubtypeAudio;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_media_subtype_audio_map (SpaTypeMap *map, SpaTypeMediaSubtypeAudio *type)
|
||||
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->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->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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -141,39 +141,39 @@ spa_type_media_subtype_audio_map (SpaTypeMap *map, SpaTypeMediaSubtypeAudio *typ
|
|||
SPA_POD_ID_INIT (media_subtype) } }
|
||||
|
||||
#define SPA_FORMAT_BODY_FOREACH(body, size, iter) \
|
||||
for ((iter) = SPA_MEMBER ((body), sizeof (SpaFormatBody), SpaPODProp); \
|
||||
(iter) < SPA_MEMBER ((body), (size), SpaPODProp); \
|
||||
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), SpaPODProp))
|
||||
for ((iter) = SPA_MEMBER ((body), sizeof (struct spa_format_body), struct spa_pod_prop); \
|
||||
(iter) < SPA_MEMBER ((body), (size), struct spa_pod_prop); \
|
||||
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), struct spa_pod_prop))
|
||||
|
||||
#define SPA_FORMAT_FOREACH(format, iter) \
|
||||
SPA_FORMAT_BODY_FOREACH(&format->body, SPA_POD_BODY_SIZE(format), iter)
|
||||
|
||||
#define SPA_FORMAT_MEDIA_TYPE(f) SPA_POD_VALUE (SpaPODId, &f->body.media_type)
|
||||
#define SPA_FORMAT_MEDIA_SUBTYPE(f) SPA_POD_VALUE (SpaPODId, &f->body.media_subtype)
|
||||
#define SPA_FORMAT_MEDIA_TYPE(f) SPA_POD_VALUE (struct spa_pod_id, &f->body.media_type)
|
||||
#define SPA_FORMAT_MEDIA_SUBTYPE(f) SPA_POD_VALUE (struct spa_pod_id, &f->body.media_subtype)
|
||||
|
||||
static inline SpaPODProp *
|
||||
spa_format_find_prop (const SpaFormat *format, uint32_t key)
|
||||
static inline struct spa_pod_prop *
|
||||
spa_format_find_prop (const struct spa_format *format, uint32_t key)
|
||||
{
|
||||
return spa_pod_contents_find_prop (&format->pod, sizeof (SpaFormat), key);
|
||||
return spa_pod_contents_find_prop (&format->pod, sizeof (struct spa_format), key);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_format_query (const SpaFormat *format, uint32_t key, ...)
|
||||
spa_format_query (const struct spa_format *format, uint32_t key, ...)
|
||||
{
|
||||
uint32_t count;
|
||||
va_list args;
|
||||
|
||||
va_start (args, key);
|
||||
count = spa_pod_contents_queryv (&format->pod, sizeof (SpaFormat), key, args);
|
||||
count = spa_pod_contents_queryv (&format->pod, sizeof (struct spa_format), key, args);
|
||||
va_end (args);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static inline SpaResult
|
||||
spa_format_fixate (SpaFormat *format)
|
||||
static inline int
|
||||
spa_format_fixate (struct spa_format *format)
|
||||
{
|
||||
SpaPODProp *prop;
|
||||
struct spa_pod_prop *prop;
|
||||
|
||||
SPA_FORMAT_FOREACH (format, prop)
|
||||
prop->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;
|
||||
|
|
|
|||
|
|
@ -24,11 +24,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct spa_format;
|
||||
#define SPA_TYPE__Format SPA_TYPE_POD_OBJECT_BASE "Format"
|
||||
#define SPA_TYPE_FORMAT_BASE SPA_TYPE__Format ":"
|
||||
|
||||
typedef struct _SpaFormat SpaFormat;
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/pod.h>
|
||||
|
||||
|
|
@ -77,22 +76,22 @@ typedef struct _SpaFormat SpaFormat;
|
|||
#define SPA_TYPE_MEDIA_SUBTYPE__amr SPA_TYPE_MEDIA_SUBTYPE_BASE "amr"
|
||||
#define SPA_TYPE_MEDIA_SUBTYPE__gsm SPA_TYPE_MEDIA_SUBTYPE_BASE "gsm"
|
||||
|
||||
typedef struct {
|
||||
SpaPODObjectBody obj_body;
|
||||
SpaPODId media_type SPA_ALIGNED (8);
|
||||
SpaPODId media_subtype SPA_ALIGNED (8);
|
||||
/* contents follow, series of SpaPODProp */
|
||||
} SpaFormatBody;
|
||||
struct spa_format_body {
|
||||
struct spa_pod_object_body obj_body;
|
||||
struct spa_pod_id media_type SPA_ALIGNED (8);
|
||||
struct spa_pod_id media_subtype SPA_ALIGNED (8);
|
||||
/* contents follow, series of spa_pod_prop */
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaFormat:
|
||||
* spa_format:
|
||||
* @media_type: media type
|
||||
* @media_subtype: subtype
|
||||
* @pod: POD object with properties
|
||||
*/
|
||||
struct _SpaFormat {
|
||||
SpaPOD pod;
|
||||
SpaFormatBody body;
|
||||
struct spa_format {
|
||||
struct spa_pod pod;
|
||||
struct spa_format_body body;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -27,56 +27,56 @@ extern "C" {
|
|||
#include <spa/defs.h>
|
||||
#include <spa/list.h>
|
||||
|
||||
typedef struct SpaGraph SpaGraph;
|
||||
typedef struct SpaGraphNode SpaGraphNode;
|
||||
typedef struct SpaGraphPort SpaGraphPort;
|
||||
struct spa_graph;
|
||||
struct spa_graph_node;
|
||||
struct spa_graph_port;
|
||||
|
||||
struct SpaGraph {
|
||||
SpaList nodes;
|
||||
SpaList ready;
|
||||
struct spa_graph {
|
||||
struct spa_list nodes;
|
||||
struct spa_list ready;
|
||||
};
|
||||
|
||||
typedef SpaResult (*SpaGraphNodeFunc) (SpaGraphNode *node);
|
||||
typedef int (*spa_graph_node_func_t) (struct spa_graph_node *node);
|
||||
|
||||
struct SpaGraphNode {
|
||||
SpaList link;
|
||||
SpaList ready_link;
|
||||
SpaList ports[2];
|
||||
struct spa_graph_node {
|
||||
struct spa_list link;
|
||||
struct spa_list ready_link;
|
||||
struct spa_list ports[2];
|
||||
#define SPA_GRAPH_NODE_FLAG_ASYNC (1 << 0)
|
||||
uint32_t flags;
|
||||
SpaResult state;
|
||||
int state;
|
||||
#define SPA_GRAPH_ACTION_CHECK 0
|
||||
#define SPA_GRAPH_ACTION_IN 1
|
||||
#define SPA_GRAPH_ACTION_OUT 2
|
||||
uint32_t action;
|
||||
SpaGraphNodeFunc schedule;
|
||||
spa_graph_node_func_t schedule;
|
||||
void *user_data;
|
||||
uint32_t max_in;
|
||||
uint32_t required_in;
|
||||
uint32_t ready_in;
|
||||
};
|
||||
|
||||
struct SpaGraphPort {
|
||||
SpaList link;
|
||||
SpaGraphNode *node;
|
||||
SpaDirection direction;
|
||||
uint32_t port_id;
|
||||
uint32_t flags;
|
||||
SpaPortIO *io;
|
||||
SpaGraphPort *peer;
|
||||
struct spa_graph_port {
|
||||
struct spa_list link;
|
||||
struct spa_graph_node *node;
|
||||
enum spa_direction direction;
|
||||
uint32_t port_id;
|
||||
uint32_t flags;
|
||||
struct spa_port_io *io;
|
||||
struct spa_graph_port *peer;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_graph_init (SpaGraph *graph)
|
||||
spa_graph_init (struct spa_graph *graph)
|
||||
{
|
||||
spa_list_init (&graph->nodes);
|
||||
spa_list_init (&graph->ready);
|
||||
}
|
||||
|
||||
static inline SpaResult
|
||||
spa_graph_node_schedule_default (SpaGraphNode *node)
|
||||
static inline int
|
||||
spa_graph_node_schedule_default (struct spa_graph_node *node)
|
||||
{
|
||||
SpaNode *n = node->user_data;
|
||||
struct spa_node *n = node->user_data;
|
||||
|
||||
if (node->action == SPA_GRAPH_ACTION_IN)
|
||||
return spa_node_process_input (n);
|
||||
|
|
@ -87,7 +87,7 @@ spa_graph_node_schedule_default (SpaGraphNode *node)
|
|||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_node_add (SpaGraph *graph, SpaGraphNode *node, SpaGraphNodeFunc schedule, void *user_data)
|
||||
spa_graph_node_add (struct spa_graph *graph, struct spa_graph_node *node, spa_graph_node_func_t schedule, void *user_data)
|
||||
{
|
||||
spa_list_init (&node->ports[SPA_DIRECTION_INPUT]);
|
||||
spa_list_init (&node->ports[SPA_DIRECTION_OUTPUT]);
|
||||
|
|
@ -101,10 +101,10 @@ spa_graph_node_add (SpaGraph *graph, SpaGraphNode *node, SpaGraphNodeFunc schedu
|
|||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_port_check (SpaGraph *graph,
|
||||
SpaGraphPort *port)
|
||||
spa_graph_port_check (struct spa_graph *graph,
|
||||
struct spa_graph_port *port)
|
||||
{
|
||||
SpaGraphNode *node = port->node;
|
||||
struct spa_graph_node *node = port->node;
|
||||
|
||||
if (port->io->status == SPA_RESULT_HAVE_BUFFER)
|
||||
node->ready_in++;
|
||||
|
|
@ -120,13 +120,13 @@ spa_graph_port_check (SpaGraph *graph,
|
|||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_port_add (SpaGraph *graph,
|
||||
SpaGraphNode *node,
|
||||
SpaGraphPort *port,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
SpaPortIO *io)
|
||||
spa_graph_port_add (struct spa_graph *graph,
|
||||
struct spa_graph_node *node,
|
||||
struct spa_graph_port *port,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
struct spa_port_io *io)
|
||||
{
|
||||
port->node = node;
|
||||
port->direction = direction;
|
||||
|
|
@ -142,41 +142,41 @@ spa_graph_port_add (SpaGraph *graph,
|
|||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_node_remove (SpaGraph *graph, SpaGraphNode *node)
|
||||
spa_graph_node_remove (struct spa_graph *graph, struct spa_graph_node *node)
|
||||
{
|
||||
spa_list_remove (&node->link);
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_port_remove (SpaGraph *graph, SpaGraphPort *port)
|
||||
spa_graph_port_remove (struct spa_graph *graph, struct spa_graph_port *port)
|
||||
{
|
||||
spa_list_remove (&port->link);
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_port_link (SpaGraph *graph, SpaGraphPort *out, SpaGraphPort *in)
|
||||
spa_graph_port_link (struct spa_graph *graph, struct spa_graph_port *out, struct spa_graph_port *in)
|
||||
{
|
||||
out->peer = in;
|
||||
in->peer = out;
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_port_unlink (SpaGraph *graph, SpaGraphPort *out, SpaGraphPort *in)
|
||||
spa_graph_port_unlink (struct spa_graph *graph, struct spa_graph_port *out, struct spa_graph_port *in)
|
||||
{
|
||||
out->peer = NULL;
|
||||
in->peer = NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_node_schedule (SpaGraph *graph, SpaGraphNode *node)
|
||||
spa_graph_node_schedule (struct spa_graph *graph, struct spa_graph_node *node)
|
||||
{
|
||||
SpaGraphPort *p;
|
||||
struct spa_graph_port *p;
|
||||
|
||||
if (node->ready_link.next == NULL)
|
||||
spa_list_insert (graph->ready.prev, &node->ready_link);
|
||||
|
||||
while (!spa_list_is_empty (&graph->ready)) {
|
||||
SpaGraphNode *n = spa_list_first (&graph->ready, SpaGraphNode, ready_link);
|
||||
struct spa_graph_node *n = spa_list_first (&graph->ready, struct spa_graph_node, ready_link);
|
||||
|
||||
spa_list_remove (&n->ready_link);
|
||||
n->ready_link.next = NULL;
|
||||
|
|
@ -195,7 +195,7 @@ spa_graph_node_schedule (SpaGraph *graph, SpaGraphNode *node)
|
|||
if (n->state == SPA_RESULT_NEED_BUFFER) {
|
||||
n->ready_in = 0;
|
||||
spa_list_for_each (p, &n->ports[SPA_DIRECTION_INPUT], link) {
|
||||
SpaGraphNode *pn = p->peer->node;
|
||||
struct spa_graph_node *pn = p->peer->node;
|
||||
if (p->io->status == SPA_RESULT_NEED_BUFFER) {
|
||||
if (pn != node || pn->flags & SPA_GRAPH_NODE_FLAG_ASYNC) {
|
||||
pn->action = SPA_GRAPH_ACTION_OUT;
|
||||
|
|
|
|||
|
|
@ -24,25 +24,23 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaList SpaList;
|
||||
|
||||
#include <spa/defs.h>
|
||||
|
||||
struct _SpaList {
|
||||
SpaList *next;
|
||||
SpaList *prev;
|
||||
struct spa_list {
|
||||
struct spa_list *next;
|
||||
struct spa_list *prev;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_list_init (SpaList *list)
|
||||
spa_list_init (struct spa_list *list)
|
||||
{
|
||||
list->next = list;
|
||||
list->prev = list;
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_list_insert (SpaList *list,
|
||||
SpaList *elem)
|
||||
spa_list_insert (struct spa_list *list,
|
||||
struct spa_list *elem)
|
||||
{
|
||||
elem->prev = list;
|
||||
elem->next = list->next;
|
||||
|
|
@ -51,7 +49,7 @@ spa_list_insert (SpaList *list,
|
|||
}
|
||||
|
||||
static inline void
|
||||
spa_list_remove (SpaList *elem)
|
||||
spa_list_remove (struct spa_list *elem)
|
||||
{
|
||||
elem->prev->next = elem->next;
|
||||
elem->next->prev = elem->prev;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaLog SpaLog;
|
||||
|
||||
#define SPA_TYPE__Log SPA_TYPE_INTERFACE_BASE "Log"
|
||||
#define SPA_TYPE_LOG_BASE SPA_TYPE__Log ":"
|
||||
|
||||
|
|
@ -34,43 +32,42 @@ typedef struct _SpaLog SpaLog;
|
|||
#include <spa/defs.h>
|
||||
#include <spa/plugin.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
enum spa_log_level {
|
||||
SPA_LOG_LEVEL_NONE = 0,
|
||||
SPA_LOG_LEVEL_ERROR,
|
||||
SPA_LOG_LEVEL_WARN,
|
||||
SPA_LOG_LEVEL_INFO,
|
||||
SPA_LOG_LEVEL_DEBUG,
|
||||
SPA_LOG_LEVEL_TRACE,
|
||||
} SpaLogLevel;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaLog:
|
||||
* struct spa_log:
|
||||
*
|
||||
* The Log interface
|
||||
*/
|
||||
struct _SpaLog {
|
||||
struct spa_log {
|
||||
/* the total size of this log. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
/**
|
||||
* SpaLog::info
|
||||
* struct spa_log::info
|
||||
*
|
||||
* Extra information about the log
|
||||
*/
|
||||
const SpaDict *info;
|
||||
const struct spa_dict *info;
|
||||
|
||||
/**
|
||||
* SpaLog::level
|
||||
* struct spa_log::level
|
||||
*
|
||||
* Logging level, everything above this level is not logged
|
||||
*/
|
||||
SpaLogLevel level;
|
||||
enum spa_log_level level;
|
||||
|
||||
/**
|
||||
* SpaLog::log
|
||||
* @log: a #SpaLog
|
||||
* @level: a #SpaLogLevel
|
||||
* struct spa_log::log
|
||||
* @log: a #struct spa_log
|
||||
* @level: a #enum spa_log_level
|
||||
* @file: the file name
|
||||
* @line: the line number
|
||||
* @func: the function name
|
||||
|
|
@ -79,17 +76,17 @@ struct _SpaLog {
|
|||
*
|
||||
* Log a message with the given log level.
|
||||
*/
|
||||
void (*log) (SpaLog *log,
|
||||
SpaLogLevel level,
|
||||
const char *file,
|
||||
int line,
|
||||
const char *func,
|
||||
const char *fmt, ...) SPA_PRINTF_FUNC(6, 7);
|
||||
void (*log) (struct spa_log *log,
|
||||
enum spa_log_level level,
|
||||
const char *file,
|
||||
int line,
|
||||
const char *func,
|
||||
const char *fmt, ...) SPA_PRINTF_FUNC(6, 7);
|
||||
|
||||
/**
|
||||
* SpaLog::logv
|
||||
* @log: a #SpaLog
|
||||
* @level: a #SpaLogLevel
|
||||
* struct spa_log::logv
|
||||
* @log: a #struct spa_log
|
||||
* @level: a #enum spa_log_level
|
||||
* @file: the file name
|
||||
* @line: the line number
|
||||
* @func: the function name
|
||||
|
|
@ -98,13 +95,13 @@ struct _SpaLog {
|
|||
*
|
||||
* Log a message with the given log level.
|
||||
*/
|
||||
void (*logv) (SpaLog *log,
|
||||
SpaLogLevel level,
|
||||
const char *file,
|
||||
int line,
|
||||
const char *func,
|
||||
const char *fmt,
|
||||
va_list args) SPA_PRINTF_FUNC(6, 0);
|
||||
void (*logv) (struct spa_log *log,
|
||||
enum spa_log_level level,
|
||||
const char *file,
|
||||
int line,
|
||||
const char *func,
|
||||
const char *fmt,
|
||||
va_list args) SPA_PRINTF_FUNC(6, 0);
|
||||
};
|
||||
|
||||
#define spa_log_level_enabled(l,lev) ((l) && (l)->level >= (lev))
|
||||
|
|
@ -124,7 +121,7 @@ struct _SpaLog {
|
|||
#else
|
||||
|
||||
#define SPA_LOG_FUNC(name,lev) \
|
||||
static inline void spa_log_##name (SpaLog *l, const char *format, ...) \
|
||||
static inline void spa_log_##name (struct spa_log *l, const char *format, ...) \
|
||||
{ \
|
||||
if (SPA_UNLIKELY (spa_log_level_enabled (l, lev))) { \
|
||||
va_list varargs; \
|
||||
|
|
|
|||
|
|
@ -24,15 +24,13 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaLoop SpaLoop;
|
||||
typedef struct _SpaSource SpaSource;
|
||||
typedef struct _SpaLoopControl SpaLoopControl;
|
||||
typedef struct _SpaLoopUtils SpaLoopUtils;
|
||||
|
||||
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"
|
||||
|
|
@ -40,52 +38,54 @@ typedef struct _SpaLoopUtils SpaLoopUtils;
|
|||
|
||||
#include <spa/defs.h>
|
||||
|
||||
typedef void (*SpaSourceFunc) (SpaSource *source);
|
||||
|
||||
typedef enum {
|
||||
enum spa_io {
|
||||
SPA_IO_IN = (1 << 0),
|
||||
SPA_IO_OUT = (1 << 1),
|
||||
SPA_IO_HUP = (1 << 2),
|
||||
SPA_IO_ERR = (1 << 3),
|
||||
} SpaIO;
|
||||
|
||||
struct _SpaSource {
|
||||
SpaLoop *loop;
|
||||
SpaSourceFunc func;
|
||||
void *data;
|
||||
int fd;
|
||||
SpaIO mask;
|
||||
SpaIO rmask;
|
||||
};
|
||||
|
||||
typedef SpaResult (*SpaInvokeFunc) (SpaLoop *loop,
|
||||
bool async,
|
||||
uint32_t seq,
|
||||
size_t size,
|
||||
void *data,
|
||||
void *user_data);
|
||||
struct spa_source;
|
||||
|
||||
typedef void (*spa_source_func_t) (struct spa_source *source);
|
||||
|
||||
struct spa_source {
|
||||
struct spa_loop *loop;
|
||||
spa_source_func_t func;
|
||||
void *data;
|
||||
int fd;
|
||||
enum spa_io mask;
|
||||
enum spa_io rmask;
|
||||
};
|
||||
|
||||
typedef int (*spa_invoke_func_t) (struct spa_loop *loop,
|
||||
bool async,
|
||||
uint32_t seq,
|
||||
size_t size,
|
||||
void *data,
|
||||
void *user_data);
|
||||
/**
|
||||
* SpaLoop:
|
||||
* spa_loop:
|
||||
*
|
||||
* Register sources and work items to an event loop
|
||||
*/
|
||||
struct _SpaLoop {
|
||||
struct spa_loop {
|
||||
/* the total size of this structure. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
|
||||
SpaResult (*add_source) (SpaLoop *loop,
|
||||
SpaSource *source);
|
||||
SpaResult (*update_source) (SpaSource *source);
|
||||
int (*add_source) (struct spa_loop *loop,
|
||||
struct spa_source *source);
|
||||
int (*update_source) (struct spa_source *source);
|
||||
|
||||
void (*remove_source) (SpaSource *source);
|
||||
void (*remove_source) (struct spa_source *source);
|
||||
|
||||
SpaResult (*invoke) (SpaLoop *loop,
|
||||
SpaInvokeFunc func,
|
||||
uint32_t seq,
|
||||
size_t size,
|
||||
void *data,
|
||||
void *user_data);
|
||||
int (*invoke) (struct spa_loop *loop,
|
||||
spa_invoke_func_t func,
|
||||
uint32_t seq,
|
||||
size_t size,
|
||||
void *data,
|
||||
void *user_data);
|
||||
};
|
||||
|
||||
#define spa_loop_add_source(l,...) (l)->add_source((l),__VA_ARGS__)
|
||||
|
|
@ -93,30 +93,30 @@ struct _SpaLoop {
|
|||
#define spa_loop_remove_source(l,...) (l)->remove_source(__VA_ARGS__)
|
||||
#define spa_loop_invoke(l,...) (l)->invoke((l),__VA_ARGS__)
|
||||
|
||||
typedef void (*SpaLoopHook) (SpaLoopControl *ctrl,
|
||||
void *data);
|
||||
typedef void (*spa_loop_hook_t) (struct spa_loop_control *ctrl,
|
||||
void *data);
|
||||
/**
|
||||
* SpaLoopControl:
|
||||
* spa_loop_control:
|
||||
*
|
||||
* Control an event loop
|
||||
*/
|
||||
struct _SpaLoopControl {
|
||||
struct spa_loop_control {
|
||||
/* the total size of this structure. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
|
||||
int (*get_fd) (SpaLoopControl *ctrl);
|
||||
int (*get_fd) (struct spa_loop_control *ctrl);
|
||||
|
||||
void (*set_hooks) (SpaLoopControl *ctrl,
|
||||
SpaLoopHook pre_hook,
|
||||
SpaLoopHook post_hook,
|
||||
void *data);
|
||||
void (*set_hooks) (struct spa_loop_control *ctrl,
|
||||
spa_loop_hook_t pre_hook,
|
||||
spa_loop_hook_t post_hook,
|
||||
void *data);
|
||||
|
||||
void (*enter) (SpaLoopControl *ctrl);
|
||||
void (*leave) (SpaLoopControl *ctrl);
|
||||
void (*enter) (struct spa_loop_control *ctrl);
|
||||
void (*leave) (struct spa_loop_control *ctrl);
|
||||
|
||||
SpaResult (*iterate) (SpaLoopControl *ctrl,
|
||||
int timeout);
|
||||
int (*iterate) (struct spa_loop_control *ctrl,
|
||||
int timeout);
|
||||
};
|
||||
|
||||
#define spa_loop_control_get_fd(l) (l)->get_fd(l)
|
||||
|
|
@ -126,69 +126,69 @@ struct _SpaLoopControl {
|
|||
#define spa_loop_control_leave(l) (l)->leave(l)
|
||||
|
||||
|
||||
typedef void (*SpaSourceIOFunc) (SpaLoopUtils *utils,
|
||||
SpaSource *source,
|
||||
int fd,
|
||||
SpaIO mask,
|
||||
void *data);
|
||||
typedef void (*SpaSourceIdleFunc) (SpaLoopUtils *utils,
|
||||
SpaSource *source,
|
||||
void *data);
|
||||
typedef void (*SpaSourceEventFunc) (SpaLoopUtils *utils,
|
||||
SpaSource *source,
|
||||
void *data);
|
||||
typedef void (*SpaSourceTimerFunc) (SpaLoopUtils *utils,
|
||||
SpaSource *source,
|
||||
void *data);
|
||||
typedef void (*SpaSourceSignalFunc) (SpaLoopUtils *utils,
|
||||
SpaSource *source,
|
||||
int signal_number,
|
||||
void *data);
|
||||
typedef void (*spa_source_io_func_t) (struct spa_loop_utils *utils,
|
||||
struct spa_source *source,
|
||||
int fd,
|
||||
enum spa_io mask,
|
||||
void *data);
|
||||
typedef void (*spa_source_idle_func_t) (struct spa_loop_utils *utils,
|
||||
struct spa_source *source,
|
||||
void *data);
|
||||
typedef void (*spa_source_event_func_t) (struct spa_loop_utils *utils,
|
||||
struct spa_source *source,
|
||||
void *data);
|
||||
typedef void (*spa_source_timer_func_t) (struct spa_loop_utils *utils,
|
||||
struct spa_source *source,
|
||||
void *data);
|
||||
typedef void (*spa_source_signal_func_t) (struct spa_loop_utils *utils,
|
||||
struct spa_source *source,
|
||||
int signal_number,
|
||||
void *data);
|
||||
|
||||
/**
|
||||
* SpaLoopUtils:
|
||||
* struct spa_loop_utils:
|
||||
*
|
||||
* Create sources for an event loop
|
||||
*/
|
||||
struct _SpaLoopUtils {
|
||||
struct spa_loop_utils {
|
||||
/* the total size of this structure. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
|
||||
SpaSource * (*add_io) (SpaLoopUtils *utils,
|
||||
int fd,
|
||||
SpaIO mask,
|
||||
bool close,
|
||||
SpaSourceIOFunc func,
|
||||
void *data);
|
||||
SpaResult (*update_io) (SpaSource *source,
|
||||
SpaIO mask);
|
||||
struct spa_source * (*add_io) (struct spa_loop_utils *utils,
|
||||
int fd,
|
||||
enum spa_io mask,
|
||||
bool close,
|
||||
spa_source_io_func_t func,
|
||||
void *data);
|
||||
int (*update_io) (struct spa_source *source,
|
||||
enum spa_io mask);
|
||||
|
||||
SpaSource * (*add_idle) (SpaLoopUtils *utils,
|
||||
bool enabled,
|
||||
SpaSourceIdleFunc func,
|
||||
void *data);
|
||||
void (*enable_idle) (SpaSource *source,
|
||||
bool enabled);
|
||||
struct spa_source * (*add_idle) (struct spa_loop_utils *utils,
|
||||
bool enabled,
|
||||
spa_source_idle_func_t func,
|
||||
void *data);
|
||||
void (*enable_idle) (struct spa_source *source,
|
||||
bool enabled);
|
||||
|
||||
SpaSource * (*add_event) (SpaLoopUtils *utils,
|
||||
SpaSourceEventFunc func,
|
||||
void *data);
|
||||
void (*signal_event) (SpaSource *source);
|
||||
struct spa_source * (*add_event) (struct spa_loop_utils *utils,
|
||||
spa_source_event_func_t func,
|
||||
void *data);
|
||||
void (*signal_event) (struct spa_source *source);
|
||||
|
||||
SpaSource * (*add_timer) (SpaLoopUtils *utils,
|
||||
SpaSourceTimerFunc func,
|
||||
void *data);
|
||||
SpaResult (*update_timer) (SpaSource *source,
|
||||
struct timespec *value,
|
||||
struct timespec *interval,
|
||||
bool absolute);
|
||||
SpaSource * (*add_signal) (SpaLoopUtils *utils,
|
||||
int signal_number,
|
||||
SpaSourceSignalFunc func,
|
||||
void *data);
|
||||
struct spa_source * (*add_timer) (struct spa_loop_utils *utils,
|
||||
spa_source_timer_func_t func,
|
||||
void *data);
|
||||
int (*update_timer) (struct spa_source *source,
|
||||
struct timespec *value,
|
||||
struct timespec *interval,
|
||||
bool absolute);
|
||||
struct spa_source * (*add_signal) (struct spa_loop_utils *utils,
|
||||
int signal_number,
|
||||
spa_source_signal_func_t func,
|
||||
void *data);
|
||||
|
||||
void (*destroy_source) (SpaSource *source);
|
||||
void (*destroy_source) (struct spa_source *source);
|
||||
};
|
||||
|
||||
#define spa_loop_utils_add_io(l,...) (l)->add_io(l,__VA_ARGS__)
|
||||
|
|
|
|||
|
|
@ -37,16 +37,16 @@ extern "C" {
|
|||
#define SPA_TYPE_META__Ringbuffer SPA_TYPE_META_BASE "Ringbuffer"
|
||||
#define SPA_TYPE_META__Shared SPA_TYPE_META_BASE "Shared"
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_meta {
|
||||
uint32_t Header;
|
||||
uint32_t Pointer;
|
||||
uint32_t VideoCrop;
|
||||
uint32_t Ringbuffer;
|
||||
uint32_t Shared;
|
||||
} SpaTypeMeta;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_meta_map (SpaTypeMap *map, SpaTypeMeta *type)
|
||||
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);
|
||||
|
|
@ -58,14 +58,14 @@ spa_type_meta_map (SpaTypeMap *map, SpaTypeMeta *type)
|
|||
}
|
||||
|
||||
/**
|
||||
* SpaMetaHeader:
|
||||
* spa_meta_header:
|
||||
* @flags: extra flags
|
||||
* @seq: sequence number. This monotonically increments and with the rate,
|
||||
* it can be used to derive a media time.
|
||||
* @pts: The MONOTONIC time for @seq.
|
||||
* @dts_offset: offset relative to @pts to start decoding this buffer.
|
||||
*/
|
||||
typedef struct {
|
||||
struct spa_meta_header {
|
||||
#define SPA_META_HEADER_FLAG_DISCONT (1 << 0) /* data is not continous with previous buffer */
|
||||
#define SPA_META_HEADER_FLAG_CORRUPTED (1 << 1) /* data might be corrupted */
|
||||
#define SPA_META_HEADER_FLAG_MARKER (1 << 2) /* media specific marker */
|
||||
|
|
@ -76,58 +76,58 @@ typedef struct {
|
|||
uint32_t seq;
|
||||
int64_t pts;
|
||||
int64_t dts_offset;
|
||||
} SpaMetaHeader;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct spa_meta_pointer {
|
||||
uint32_t type;
|
||||
void *ptr;
|
||||
} SpaMetaPointer;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaMetaVideoCrop:
|
||||
* spa_meta_video_crop:
|
||||
* @x:
|
||||
* @y:
|
||||
* @width:
|
||||
* @height
|
||||
*/
|
||||
typedef struct {
|
||||
struct spa_meta_video_crop {
|
||||
int32_t x, y;
|
||||
int32_t width, height;
|
||||
} SpaMetaVideoCrop;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaMetaRingbuffer:
|
||||
* spa_meta_ringbuffer:
|
||||
* @ringbuffer:
|
||||
*/
|
||||
typedef struct {
|
||||
SpaRingbuffer ringbuffer;
|
||||
} SpaMetaRingbuffer;
|
||||
struct spa_meta_ringbuffer {
|
||||
struct spa_ringbuffer ringbuffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaMetaShared:
|
||||
* spa_meta_shared:
|
||||
* @flags: flags
|
||||
* @fd: the fd of the memory
|
||||
* @offset: start offset of memory
|
||||
* @size: size of the memory
|
||||
*/
|
||||
typedef struct {
|
||||
struct spa_meta_shared {
|
||||
int32_t flags;
|
||||
int fd;
|
||||
int32_t offset;
|
||||
uint32_t size;
|
||||
} SpaMetaShared;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaMeta:
|
||||
* spa_meta:
|
||||
* @type: metadata type
|
||||
* @data: pointer to metadata
|
||||
* @size: size of metadata
|
||||
*/
|
||||
typedef struct {
|
||||
struct spa_meta {
|
||||
uint32_t type;
|
||||
void *data;
|
||||
uint32_t size;
|
||||
} SpaMeta;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaMonitor SpaMonitor;
|
||||
|
||||
struct spa_monitor;
|
||||
#define SPA_TYPE__Monitor SPA_TYPE_INTERFACE_BASE "Monitor"
|
||||
#define SPA_TYPE_MONITOR_BASE SPA_TYPE__Monitor ":"
|
||||
|
||||
|
|
@ -33,7 +32,6 @@ typedef struct _SpaMonitor SpaMonitor;
|
|||
#include <spa/dict.h>
|
||||
#include <spa/event.h>
|
||||
|
||||
typedef SpaEvent SpaEventMonitor;
|
||||
#define SPA_TYPE_EVENT__Monitor SPA_TYPE_EVENT_BASE "Monitor"
|
||||
#define SPA_TYPE_EVENT_MONITOR_BASE SPA_TYPE_EVENT__Monitor ":"
|
||||
|
||||
|
|
@ -41,7 +39,9 @@ typedef SpaEvent SpaEventMonitor;
|
|||
#define SPA_TYPE_EVENT_MONITOR__Removed SPA_TYPE_EVENT_MONITOR_BASE "Removed"
|
||||
#define SPA_TYPE_EVENT_MONITOR__Changed SPA_TYPE_EVENT_MONITOR_BASE "Changed"
|
||||
|
||||
typedef SpaPODObject SpaMonitorItem;
|
||||
struct spa_monitor_item {
|
||||
struct spa_pod_object object;
|
||||
};
|
||||
#define SPA_TYPE__MonitorItem SPA_TYPE_POD_OBJECT_BASE "MonitorItem"
|
||||
#define SPA_TYPE_MONITOR_ITEM_BASE SPA_TYPE__MonitorItem ":"
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ typedef SpaPODObject SpaMonitorItem;
|
|||
#define SPA_TYPE_MONITOR_ITEM__info SPA_TYPE_MONITOR_ITEM_BASE "info"
|
||||
#define SPA_TYPE_MONITOR_ITEM__factory SPA_TYPE_MONITOR_ITEM_BASE "factory"
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_monitor {
|
||||
uint32_t Monitor;
|
||||
|
||||
uint32_t Added;
|
||||
|
|
@ -68,10 +68,10 @@ typedef struct {
|
|||
uint32_t klass;
|
||||
uint32_t info;
|
||||
uint32_t factory;
|
||||
} SpaTypeMonitor;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_monitor_map (SpaTypeMap *map, SpaTypeMonitor *type)
|
||||
spa_type_monitor_map (struct spa_type_map *map, struct spa_type_monitor *type)
|
||||
{
|
||||
if (type->Added == 0) {
|
||||
type->Monitor = spa_type_map_get_id (map, SPA_TYPE__Monitor);
|
||||
|
|
@ -89,75 +89,72 @@ spa_type_monitor_map (SpaTypeMap *map, SpaTypeMonitor *type)
|
|||
}
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
enum spa_monitor_item_flags {
|
||||
SPA_MONITOR_ITEM_FLAG_NONE = 0,
|
||||
} SpaMonitorItemFlags;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaMonitorItemState:
|
||||
* spa_monitor_item_state:
|
||||
* @SPA_MONITOR_ITEM_STATE_AVAILABLE: The item is available
|
||||
* @SPA_MONITOR_ITEM_STATE_DISABLED: the item is disabled
|
||||
* @SPA_MONITOR_ITEM_STATE_UNAVAILABLE: the item is unavailable
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_monitor_item_state {
|
||||
SPA_MONITOR_ITEM_STATE_AVAILABLE,
|
||||
SPA_MONITOR_ITEM_STATE_DISABLED,
|
||||
SPA_MONITOR_ITEM_STATE_UNAVAILABLE,
|
||||
} SpaMonitorItemState;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaMonitorCallback:
|
||||
* @node: a #SpaMonitor emiting the event
|
||||
* @event: the event that was emited
|
||||
* @user_data: user data provided when registering the callback
|
||||
*
|
||||
* This will be called when a monitor event is notified
|
||||
* on @monitor.
|
||||
* spa_monitor_callbacks:
|
||||
*/
|
||||
typedef void (*SpaEventMonitorCallback) (SpaMonitor *monitor,
|
||||
SpaEventMonitor *event,
|
||||
void *user_data);
|
||||
struct spa_monitor_callbacks {
|
||||
void (*event) (struct spa_monitor *monitor,
|
||||
struct spa_event *event,
|
||||
void *user_data);
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaMonitor:
|
||||
* spa_monitor:
|
||||
*
|
||||
* The device monitor interface.
|
||||
*/
|
||||
struct _SpaMonitor {
|
||||
struct spa_monitor {
|
||||
/**
|
||||
* SpaMonitor::info
|
||||
* spa_monitor::info
|
||||
*
|
||||
* Extra information about the monitor
|
||||
*/
|
||||
const SpaDict * info;
|
||||
const struct spa_dict* info;
|
||||
|
||||
/* the total size of this monitor. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
|
||||
/**
|
||||
* SpaMonitor::set_event_callback:
|
||||
* @monitor: a #SpaMonitor
|
||||
* @callback: a #SpaEventMonitorCallback
|
||||
* spa_monitor::set_callbacks:
|
||||
* @monitor: a #spa_monitor
|
||||
* @callback: a #callbacks
|
||||
* @user_data: extra user data
|
||||
*
|
||||
* Set an event callback to receive asynchronous notifications from
|
||||
* Set callbacks to receive asynchronous notifications from
|
||||
* the monitor.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
*/
|
||||
SpaResult (*set_event_callback) (SpaMonitor *monitor,
|
||||
SpaEventMonitorCallback callback,
|
||||
void *user_data);
|
||||
int (*set_callbacks) (struct spa_monitor *monitor,
|
||||
const struct spa_monitor_callbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data);
|
||||
|
||||
SpaResult (*enum_items) (SpaMonitor *monitor,
|
||||
SpaMonitorItem **item,
|
||||
uint32_t index);
|
||||
int (*enum_items) (struct spa_monitor *monitor,
|
||||
struct spa_monitor_item **item,
|
||||
uint32_t index);
|
||||
|
||||
};
|
||||
|
||||
#define spa_monitor_set_event_callback(m,...) (m)->set_event_callback((m),__VA_ARGS__)
|
||||
#define spa_monitor_enum_items(m,...) (m)->enum_items((m),__VA_ARGS__)
|
||||
#define spa_monitor_set_callbacks(m,...) (m)->set_callbacks((m),__VA_ARGS__)
|
||||
#define spa_monitor_enum_items(m,...) (m)->enum_items((m),__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaNode SpaNode;
|
||||
|
||||
#define SPA_TYPE__Node SPA_TYPE_INTERFACE_BASE "Node"
|
||||
#define SPA_TYPE_NODE_BASE SPA_TYPE__Node ":"
|
||||
|
||||
struct spa_node;
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/plugin.h>
|
||||
#include <spa/props.h>
|
||||
|
|
@ -38,14 +38,14 @@ typedef struct _SpaNode SpaNode;
|
|||
#include <spa/buffer.h>
|
||||
#include <spa/format.h>
|
||||
|
||||
typedef struct {
|
||||
uint64_t offset;
|
||||
uint32_t min_size;
|
||||
uint32_t max_size;
|
||||
} SpaRange;
|
||||
struct spa_range {
|
||||
uint64_t offset;
|
||||
uint32_t min_size;
|
||||
uint32_t max_size;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaPortIO:
|
||||
* struct spa_port_io:
|
||||
* @status: the status
|
||||
* @buffer_id: a buffer id
|
||||
* @range: requested range
|
||||
|
|
@ -53,20 +53,20 @@ typedef struct {
|
|||
* IO information for a port on a node. This is allocated
|
||||
* by the host and configured on all ports for which IO is requested.
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t status;
|
||||
uint32_t buffer_id;
|
||||
SpaRange range;
|
||||
} SpaPortIO;
|
||||
struct spa_port_io {
|
||||
uint32_t status;
|
||||
uint32_t buffer_id;
|
||||
struct spa_range range;
|
||||
};
|
||||
|
||||
#define SPA_PORT_IO_INIT (SpaPortIO) { SPA_RESULT_NEED_BUFFER, SPA_ID_INVALID, }
|
||||
#define SPA_PORT_IO_INIT (struct spa_port_io) { SPA_RESULT_NEED_BUFFER, SPA_ID_INVALID, }
|
||||
|
||||
/**
|
||||
* SpaPortInfo
|
||||
* struct spa_port_info
|
||||
* @flags: extra port flags
|
||||
* @rate: rate of sequence number increment per second of media data
|
||||
*/
|
||||
typedef struct {
|
||||
struct spa_port_info {
|
||||
#define SPA_PORT_INFO_FLAG_REMOVABLE (1<<0) /* port can be removed */
|
||||
#define SPA_PORT_INFO_FLAG_OPTIONAL (1<<1) /* processing on port is optional */
|
||||
#define SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS (1<<2) /* the port can allocate buffer data */
|
||||
|
|
@ -76,27 +76,27 @@ typedef struct {
|
|||
#define SPA_PORT_INFO_FLAG_NO_REF (1<<5) /* the port does not keep a ref on the buffer */
|
||||
#define SPA_PORT_INFO_FLAG_LIVE (1<<6) /* output buffers from this port are timestamped against
|
||||
* a live clock. */
|
||||
uint32_t flags;
|
||||
uint32_t rate;
|
||||
} SpaPortInfo;
|
||||
uint32_t flags;
|
||||
uint32_t rate;
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
struct spa_node_callbacks {
|
||||
/**
|
||||
* SpaNodeCallbacks::event:
|
||||
* @node: a #SpaNode
|
||||
* struct spa_node_callbacks::event:
|
||||
* @node: a #struct spa_node
|
||||
* @event: the event that was emited
|
||||
* @user_data: user data provided when registering the callbacks
|
||||
*
|
||||
* This will be called when an out-of-bound event is notified
|
||||
* on @node. the callback can be called from any thread.
|
||||
*/
|
||||
void (*event) (SpaNode *node,
|
||||
SpaEvent *event,
|
||||
void *user_data);
|
||||
void (*event) (struct spa_node *node,
|
||||
struct spa_event *event,
|
||||
void *user_data);
|
||||
/**
|
||||
* SpaNodeCallbacks::need_input:
|
||||
* @node: a #SpaNode
|
||||
* struct spa_node_callbacks::need_input:
|
||||
* @node: a #struct spa_node
|
||||
* @user_data: user data provided when registering the callbacks
|
||||
*
|
||||
* The node needs more input. This callback is called from the
|
||||
|
|
@ -105,11 +105,11 @@ typedef struct {
|
|||
* When this function is NULL, synchronous operation is requested
|
||||
* on the input ports.
|
||||
*/
|
||||
void (*need_input) (SpaNode *node,
|
||||
void *user_data);
|
||||
void (*need_input) (struct spa_node *node,
|
||||
void *user_data);
|
||||
/**
|
||||
* SpaNodeCallbacks::have_output:
|
||||
* @node: a #SpaNode
|
||||
* struct spa_node_callbacks::have_output:
|
||||
* @node: a #struct spa_node
|
||||
* @user_data: user data provided when registering the callbacks
|
||||
*
|
||||
* The node has output input. This callback is called from the
|
||||
|
|
@ -118,11 +118,11 @@ typedef struct {
|
|||
* When this function is NULL, synchronous operation is requested
|
||||
* on the output ports.
|
||||
*/
|
||||
void (*have_output) (SpaNode *node,
|
||||
void *user_data);
|
||||
void (*have_output) (struct spa_node *node,
|
||||
void *user_data);
|
||||
/**
|
||||
* SpaNodeCallbacks::reuse_buffer:
|
||||
* @node: a #SpaNode
|
||||
* struct spa_node_callbacks::reuse_buffer:
|
||||
* @node: a #struct spa_node
|
||||
* @port_id: an input port_id
|
||||
* @buffer_id: the buffer id to be reused
|
||||
* @user_data: user data provided when registering the callbacks
|
||||
|
|
@ -133,40 +133,40 @@ typedef struct {
|
|||
* When this function is NULL, the buffers to reuse will be set in
|
||||
* the io area or the input ports.
|
||||
*/
|
||||
void (*reuse_buffer) (SpaNode *node,
|
||||
uint32_t port_id,
|
||||
uint32_t buffer_id,
|
||||
void *user_data);
|
||||
} SpaNodeCallbacks;
|
||||
void (*reuse_buffer) (struct spa_node *node,
|
||||
uint32_t port_id,
|
||||
uint32_t buffer_id,
|
||||
void *user_data);
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaNode:
|
||||
* struct spa_node:
|
||||
*
|
||||
* A SpaNode is a component that can comsume and produce buffers.
|
||||
* A struct spa_node is a component that can comsume and produce buffers.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct _SpaNode {
|
||||
struct spa_node {
|
||||
/* the total size of this node. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
/**
|
||||
* SpaNode::info
|
||||
* spa_node::info
|
||||
*
|
||||
* Extra information about the node
|
||||
*/
|
||||
const SpaDict * info;
|
||||
const struct spa_dict *info;
|
||||
/**
|
||||
* SpaNode::get_props:
|
||||
* @node: a #SpaNode
|
||||
* @props: a location for a #SpaProps pointer
|
||||
* spa_node::get_props:
|
||||
* @node: a #spa_node
|
||||
* @props: a location for a #struct spa_props pointer
|
||||
*
|
||||
* Get the configurable properties of @node.
|
||||
*
|
||||
* The returned @props is a snapshot of the current configuration and
|
||||
* can be modified. The modifications will take effect after a call
|
||||
* to SpaNode::set_props.
|
||||
* to spa_node::set_props.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
|
|
@ -175,18 +175,18 @@ struct _SpaNode {
|
|||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no properties
|
||||
* implemented on @node
|
||||
*/
|
||||
SpaResult (*get_props) (SpaNode *node,
|
||||
SpaProps **props);
|
||||
int (*get_props) (struct spa_node *node,
|
||||
struct spa_props **props);
|
||||
/**
|
||||
* SpaNode::set_props:
|
||||
* @node: a #SpaNode
|
||||
* @props: a #SpaProps
|
||||
* struct spa_node::set_props:
|
||||
* @node: a #struct spa_node
|
||||
* @props: a #struct spa_props
|
||||
*
|
||||
* Set the configurable properties in @node.
|
||||
*
|
||||
* Usually, @props will be obtained from SpaNode::get_props and then
|
||||
* modified but it is also possible to set another #SpaProps object
|
||||
* as long as its keys and types match those of SpaProps::get_props.
|
||||
* Usually, @props will be obtained from struct spa_node::get_props and then
|
||||
* modified but it is also possible to set another #struct spa_props object
|
||||
* as long as its keys and types match those of struct spa_props::get_props.
|
||||
*
|
||||
* Properties with keys that are not known are ignored.
|
||||
*
|
||||
|
|
@ -201,12 +201,12 @@ struct _SpaNode {
|
|||
* #SPA_RESULT_WRONG_PROPERTY_TYPE when a property has the wrong
|
||||
* type.
|
||||
*/
|
||||
SpaResult (*set_props) (SpaNode *node,
|
||||
const SpaProps *props);
|
||||
int (*set_props) (struct spa_node *node,
|
||||
const struct spa_props *props);
|
||||
/**
|
||||
* SpaNode::send_command:
|
||||
* @node: a #SpaNode
|
||||
* @command: a #SpaCommand
|
||||
* struct spa_node::send_command:
|
||||
* @node: a #struct spa_node
|
||||
* @command: a #spa_command
|
||||
*
|
||||
* Send a command to @node.
|
||||
*
|
||||
|
|
@ -220,11 +220,11 @@ struct _SpaNode {
|
|||
* #SPA_RESULT_INVALID_COMMAND @command is an invalid command
|
||||
* #SPA_RESULT_ASYNC @command is executed asynchronously
|
||||
*/
|
||||
SpaResult (*send_command) (SpaNode *node,
|
||||
SpaCommand *command);
|
||||
int (*send_command) (struct spa_node *node,
|
||||
struct spa_command *command);
|
||||
/**
|
||||
* SpaNode::set_event_callback:
|
||||
* @node: a #SpaNode
|
||||
* struct spa_node::set_event_callback:
|
||||
* @node: a #struct spa_node
|
||||
* @callbacks: callbacks to set
|
||||
* @callbacks_size: size of the callbacks structure
|
||||
* @user_data: user data passed to the callback functions
|
||||
|
|
@ -237,13 +237,13 @@ struct _SpaNode {
|
|||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
*/
|
||||
SpaResult (*set_callbacks) (SpaNode *node,
|
||||
const SpaNodeCallbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data);
|
||||
int (*set_callbacks) (struct spa_node *node,
|
||||
const struct spa_node_callbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data);
|
||||
/**
|
||||
* SpaNode::get_n_ports:
|
||||
* @node: a #SpaNode
|
||||
* struct spa_node::get_n_ports:
|
||||
* @node: a #struct spa_node
|
||||
* @n_input_ports: location to hold the number of input ports or %NULL
|
||||
* @max_input_ports: location to hold the maximum number of input ports or %NULL
|
||||
* @n_output_ports: location to hold the number of output ports or %NULL
|
||||
|
|
@ -257,14 +257,14 @@ struct _SpaNode {
|
|||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
*/
|
||||
SpaResult (*get_n_ports) (SpaNode *node,
|
||||
uint32_t *n_input_ports,
|
||||
uint32_t *max_input_ports,
|
||||
uint32_t *n_output_ports,
|
||||
uint32_t *max_output_ports);
|
||||
int (*get_n_ports) (struct spa_node *node,
|
||||
uint32_t *n_input_ports,
|
||||
uint32_t *max_input_ports,
|
||||
uint32_t *n_output_ports,
|
||||
uint32_t *max_output_ports);
|
||||
/**
|
||||
* SpaNode::get_port_ids:
|
||||
* @node: a #SpaNode
|
||||
* struct spa_node::get_port_ids:
|
||||
* @node: a #struct spa_node
|
||||
* @n_input_ports: size of the @input_ids array
|
||||
* @input_ids: array to store the input stream ids
|
||||
* @n_output_ports: size of the @output_ids array
|
||||
|
|
@ -277,16 +277,16 @@ struct _SpaNode {
|
|||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
*/
|
||||
SpaResult (*get_port_ids) (SpaNode *node,
|
||||
uint32_t n_input_ports,
|
||||
uint32_t *input_ids,
|
||||
uint32_t n_output_ports,
|
||||
uint32_t *output_ids);
|
||||
int (*get_port_ids) (struct spa_node *node,
|
||||
uint32_t n_input_ports,
|
||||
uint32_t *input_ids,
|
||||
uint32_t n_output_ports,
|
||||
uint32_t *output_ids);
|
||||
|
||||
/**
|
||||
* SpaNode::add_port:
|
||||
* @node: a #SpaNode
|
||||
* @direction: a #SpaDirection
|
||||
* struct spa_node::add_port:
|
||||
* @node: a #struct spa_node
|
||||
* @direction: a #enum spa_direction
|
||||
* @port_id: an unused port id
|
||||
*
|
||||
* Make a new port with @port_id. The called should use get_port_ids() to
|
||||
|
|
@ -299,17 +299,17 @@ struct _SpaNode {
|
|||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
*/
|
||||
SpaResult (*add_port) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id);
|
||||
SpaResult (*remove_port) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id);
|
||||
int (*add_port) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id);
|
||||
int (*remove_port) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id);
|
||||
|
||||
/**
|
||||
* SpaNode::port_enum_formats:
|
||||
* @node: a #SpaNode
|
||||
* @direction: a #SpaDirection
|
||||
* struct spa_node::port_enum_formats:
|
||||
* @node: a #struct spa_node
|
||||
* @direction: a #enum spa_direction
|
||||
* @port_id: the port to query
|
||||
* @format: pointer to a format
|
||||
* @filter: a format filter
|
||||
|
|
@ -324,7 +324,7 @@ struct _SpaNode {
|
|||
* returns #SPA_RESULT_ENUM_END.
|
||||
*
|
||||
* The result format can be queried and modified and ultimately be used
|
||||
* to call SpaNode::port_set_format.
|
||||
* to call struct spa_node::port_set_format.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
|
|
@ -333,19 +333,19 @@ struct _SpaNode {
|
|||
* #SPA_RESULT_INVALID_PORT when port_id is not valid
|
||||
* #SPA_RESULT_ENUM_END when no format exists
|
||||
*/
|
||||
SpaResult (*port_enum_formats) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaFormat **format,
|
||||
const SpaFormat *filter,
|
||||
uint32_t index);
|
||||
int (*port_enum_formats) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_format **format,
|
||||
const struct spa_format *filter,
|
||||
uint32_t index);
|
||||
/**
|
||||
* SpaNode::port_set_format:
|
||||
* @node: a #SpaNode
|
||||
* @direction: a #SpaDirection
|
||||
* struct spa_node::port_set_format:
|
||||
* @node: a #struct spa_node
|
||||
* @direction: a #enum spa_direction
|
||||
* @port_id: the port to configure
|
||||
* @flags: flags
|
||||
* @format: a #SpaFormat with the format
|
||||
* @format: a #struct spa_format with the format
|
||||
*
|
||||
* Set a format on @port_id of @node.
|
||||
*
|
||||
|
|
@ -361,7 +361,7 @@ struct _SpaNode {
|
|||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_OK_RECHECK on success, the value of @format might have been
|
||||
* changed depending on @flags and the final value can be found by
|
||||
* doing SpaNode::get_format.
|
||||
* doing struct spa_node::get_format.
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
* #SPA_RESULT_INVALID_PORT when port_id is not valid
|
||||
* #SPA_RESULT_INVALID_MEDIA_TYPE when the media type is not valid
|
||||
|
|
@ -376,19 +376,19 @@ struct _SpaNode {
|
|||
#define SPA_PORT_FORMAT_FLAG_FIXATE (1 << 1) /* fixate the non-optional unset fields */
|
||||
#define SPA_PORT_FORMAT_FLAG_NEAREST (1 << 2) /* allow set fields to be rounded to the
|
||||
* nearest allowed field value. */
|
||||
SpaResult (*port_set_format) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const SpaFormat *format);
|
||||
int (*port_set_format) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t flags,
|
||||
const struct spa_format *format);
|
||||
/**
|
||||
* SpaNode::port_get_format:
|
||||
* @node: a #SpaNode
|
||||
* @direction: a #SpaDirection
|
||||
* struct spa_node::port_get_format:
|
||||
* @node: a #struct spa_node
|
||||
* @direction: a #enum spa_direction
|
||||
* @port_id: the port to query
|
||||
* @format: a pointer to a location to hold the #SpaFormat
|
||||
* @format: a pointer to a location to hold the #struct spa_format
|
||||
*
|
||||
* Get the format on @port_id of @node. The result #SpaFormat can
|
||||
* Get the format on @port_id of @node. The result #struct spa_format can
|
||||
* not be modified.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
|
|
@ -398,30 +398,30 @@ struct _SpaNode {
|
|||
* #SPA_RESULT_INVALID_PORT when @port_id is not valid
|
||||
* #SPA_RESULT_INVALID_NO_FORMAT when no format was set
|
||||
*/
|
||||
SpaResult (*port_get_format) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaFormat **format);
|
||||
int (*port_get_format) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
const struct spa_format **format);
|
||||
|
||||
SpaResult (*port_get_info) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaPortInfo **info);
|
||||
int (*port_get_info) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
const struct spa_port_info **info);
|
||||
|
||||
SpaResult (*port_enum_params) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param);
|
||||
SpaResult (*port_set_param) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaParam *param);
|
||||
int (*port_enum_params) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
struct spa_param **param);
|
||||
int (*port_set_param) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
const struct spa_param *param);
|
||||
|
||||
/**
|
||||
* SpaNode::port_use_buffers:
|
||||
* @node: a #SpaNode
|
||||
* @direction: a #SpaDirection
|
||||
* struct spa_node::port_use_buffers:
|
||||
* @node: a #struct spa_node
|
||||
* @direction: a #enum spa_direction
|
||||
* @port_id: a port id
|
||||
* @buffers: an array of buffer pointers
|
||||
* @n_buffers: number of elements in @buffers
|
||||
|
|
@ -448,15 +448,15 @@ struct _SpaNode {
|
|||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_ASYNC the function is executed asynchronously
|
||||
*/
|
||||
SpaResult (*port_use_buffers) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaBuffer **buffers,
|
||||
uint32_t n_buffers);
|
||||
int (*port_use_buffers) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t n_buffers);
|
||||
/**
|
||||
* SpaNode::port_alloc_buffers:
|
||||
* @node: a #SpaNode
|
||||
* @direction: a #SpaDirection
|
||||
* struct spa_node::port_alloc_buffers:
|
||||
* @node: a #struct spa_node
|
||||
* @direction: a #enum spa_direction
|
||||
* @port_id: a port id
|
||||
* @params: allocation parameters
|
||||
* @n_params: number of elements in @params
|
||||
|
|
@ -480,7 +480,7 @@ struct _SpaNode {
|
|||
* node to PAUSED, when the node has enough buffers on all ports.
|
||||
*
|
||||
* Once the port has allocated buffers, the memory of the buffers can be
|
||||
* released again by calling SpaNode::port_use_buffers with %NULL.
|
||||
* released again by calling struct spa_node::port_use_buffers with %NULL.
|
||||
*
|
||||
* This function must be called from the main thread.
|
||||
*
|
||||
|
|
@ -488,19 +488,19 @@ struct _SpaNode {
|
|||
* #SPA_RESULT_ERROR when the node already has allocated buffers.
|
||||
* #SPA_RESULT_ASYNC the function is executed asynchronously
|
||||
*/
|
||||
SpaResult (*port_alloc_buffers) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaParam **params,
|
||||
uint32_t n_params,
|
||||
SpaBuffer **buffers,
|
||||
uint32_t *n_buffers);
|
||||
int (*port_alloc_buffers) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_param **params,
|
||||
uint32_t n_params,
|
||||
struct spa_buffer **buffers,
|
||||
uint32_t *n_buffers);
|
||||
|
||||
/**
|
||||
* SpaNode::port_set_io:
|
||||
* @direction: a #SpaDirection
|
||||
* struct spa_node::port_set_io:
|
||||
* @direction: a #enum spa_direction
|
||||
* @port_id: a port id
|
||||
* @io: a #SpaPortIO
|
||||
* @io: a #struct spa_port_io
|
||||
*
|
||||
* Configure the given io structure on @port_id. This
|
||||
* structure is allocated by the host and is used to query the state
|
||||
|
|
@ -510,14 +510,14 @@ struct _SpaNode {
|
|||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
*/
|
||||
SpaResult (*port_set_io) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaPortIO *io);
|
||||
int (*port_set_io) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_port_io *io);
|
||||
|
||||
/**
|
||||
* SpaNode::port_reuse_buffer:
|
||||
* @node: a #SpaNode
|
||||
* struct spa_node::port_reuse_buffer:
|
||||
* @node: a #struct spa_node
|
||||
* @port_id: a port id
|
||||
* @buffer_id: a buffer id to reuse
|
||||
*
|
||||
|
|
@ -528,74 +528,87 @@ struct _SpaNode {
|
|||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
|
||||
*/
|
||||
SpaResult (*port_reuse_buffer) (SpaNode *node,
|
||||
uint32_t port_id,
|
||||
uint32_t buffer_id);
|
||||
int (*port_reuse_buffer) (struct spa_node *node,
|
||||
uint32_t port_id,
|
||||
uint32_t buffer_id);
|
||||
|
||||
SpaResult (*port_send_command) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaCommand *command);
|
||||
int (*port_send_command) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
struct spa_command *command);
|
||||
/**
|
||||
* SpaNode::process_input:
|
||||
* @node: a #SpaNode
|
||||
* struct spa_node::process_input:
|
||||
* @node: a #struct spa_node
|
||||
*
|
||||
* Process the input area of the node.
|
||||
*
|
||||
* For synchronous nodes, this function is called to start processing data
|
||||
* or when process_output returned SPA_RESULT_NEED_MORE_INPUT
|
||||
* or when process_output returned SPA_RESULT_NEED_BUFFER
|
||||
*
|
||||
* For Asynchronous node, this function is called when a NEED_INPUT event
|
||||
* is received from the node.
|
||||
*
|
||||
* Before calling this function, you must configure SpaPortInput structures
|
||||
* Before calling this function, you must configure spa_port_io structures
|
||||
* configured on the input ports.
|
||||
*
|
||||
* The node will loop through all SpaPortInput structures and will
|
||||
* process the buffers. For each port, the port info will be updated as:
|
||||
* The node will loop through all spa_port_io structures and will
|
||||
* process the buffers. For each port, the port io will be used as:
|
||||
*
|
||||
* - The buffer_id is set to SPA_ID_INVALID and the status is set to
|
||||
* SPA_RESULT_OK when the buffer was successfully consumed
|
||||
* - if status is set to HAVE_BUFFER, buffer_id is read and processed.
|
||||
*
|
||||
* - The buffer_id is untouched and the status is set to an error when
|
||||
* the buffer was invalid.
|
||||
* The spa_port_io of the port is then updated as follows.
|
||||
*
|
||||
* - The buffer_id is untouched and the status is set to SPA_RESULT_OK
|
||||
* when no input was consumed. This can happen when the node does not
|
||||
* need input on this port.
|
||||
* - buffer_id is set to a buffer id that should be reused. SPA_ID_INVALID
|
||||
* is set when there is no buffer to reuse
|
||||
*
|
||||
* - status is set to SPA_RESULT_OK when no new buffer is needed
|
||||
*
|
||||
* - status is set to SPA_RESULT_NEED_BUFFER when a new buffer is needed
|
||||
* on the pad.
|
||||
*
|
||||
* - status is set to an error code when the buffer_id was invalid or any
|
||||
* processing error happened on the port.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success or when the node is asynchronous
|
||||
* #SPA_RESULT_HAVE_OUTPUT for synchronous nodes when output
|
||||
* #SPA_RESULT_HAVE_BUFFER for synchronous nodes when output
|
||||
* can be consumed.
|
||||
* #SPA_RESULT_OUT_OF_BUFFERS for synchronous nodes when buffers
|
||||
* should be released with port_reuse_buffer
|
||||
* #SPA_RESULT_ERROR when one of the inputs is in error
|
||||
*/
|
||||
SpaResult (*process_input) (SpaNode *node);
|
||||
int (*process_input) (struct spa_node *node);
|
||||
|
||||
/**
|
||||
* SpaNode::process_output:
|
||||
* @node: a #SpaNode
|
||||
* struct spa_node::process_output:
|
||||
* @node: a #struct spa_node
|
||||
*
|
||||
* Tell the node to produce more output.
|
||||
*
|
||||
* Before calling this function you must process the buffers and events
|
||||
* in the SpaPortOutput structure and set the buffer_id to SPA_ID_INVALID
|
||||
* for all consumed buffers. Buffers that you do not want to consume should
|
||||
* be returned to the node with port_reuse_buffer.
|
||||
* Tell the node that output is consumed.
|
||||
*
|
||||
* For synchronous nodes, this function can be called when process_input
|
||||
* returned #SPA_RESULT_HAVE_ENOUGH_INPUT.
|
||||
* returned #SPA_RESULT_HAVE_BUFFER.
|
||||
*
|
||||
* For Asynchronous node, this function is called when a HAVE_OUTPUT event
|
||||
* is received from the node.
|
||||
*
|
||||
* Before calling this function you must process the buffers
|
||||
* in each of the output ports spa_port_io structure as follows:
|
||||
*
|
||||
* - use the buffer_id from the io for all the ports where the status is
|
||||
* SPA_RESULT_HAVE_BUFFER
|
||||
*
|
||||
* - set buffer_id to a buffer_id you would like to reuse or SPA_ID_INVALID
|
||||
* when no buffer is to be reused.
|
||||
*
|
||||
* - set the status to SPA_RESULT_NEED_BUFFER for all port you want more
|
||||
* output from
|
||||
*
|
||||
* - set the status to SPA_RESULT_OK for the port you don't want more
|
||||
* buffer from.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success or when the node is asynchronous
|
||||
* #SPA_RESULT_NEED_INPUT for synchronous nodes when input
|
||||
* #SPA_RESULT_NEED_BUFFER for synchronous nodes when input
|
||||
* is needed.
|
||||
* #SPA_RESULT_ERROR when one of the outputs is in error
|
||||
*/
|
||||
SpaResult (*process_output) (SpaNode *node);
|
||||
int (*process_output) (struct spa_node *node);
|
||||
};
|
||||
|
||||
#define spa_node_get_props(n,...) (n)->get_props((n),__VA_ARGS__)
|
||||
|
|
|
|||
|
|
@ -39,16 +39,17 @@ extern "C" {
|
|||
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__buffers SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "buffers"
|
||||
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__align SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "align"
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_param_alloc_buffers {
|
||||
uint32_t Buffers;
|
||||
uint32_t size;
|
||||
uint32_t stride;
|
||||
uint32_t buffers;
|
||||
uint32_t align;
|
||||
} SpaTypeParamAllocBuffers;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_param_alloc_buffers_map (SpaTypeMap *map, SpaTypeParamAllocBuffers *type)
|
||||
spa_type_param_alloc_buffers_map (struct spa_type_map *map,
|
||||
struct spa_type_param_alloc_buffers *type)
|
||||
{
|
||||
if (type->Buffers == 0) {
|
||||
type->Buffers = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC__Buffers);
|
||||
|
|
@ -69,7 +70,7 @@ spa_type_param_alloc_buffers_map (SpaTypeMap *map, SpaTypeParamAllocBuffers *typ
|
|||
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferBlocks SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferBlocks"
|
||||
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferAlign SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferAlign"
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_param_alloc_meta_enable {
|
||||
uint32_t MetaEnable;
|
||||
uint32_t type;
|
||||
uint32_t size;
|
||||
|
|
@ -77,19 +78,20 @@ typedef struct {
|
|||
uint32_t ringbufferStride;
|
||||
uint32_t ringbufferBlocks;
|
||||
uint32_t ringbufferAlign;
|
||||
} SpaTypeParamAllocMetaEnable;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_param_alloc_meta_enable_map (SpaTypeMap *map, SpaTypeParamAllocMetaEnable *type)
|
||||
spa_type_param_alloc_meta_enable_map (struct spa_type_map *map,
|
||||
struct spa_type_param_alloc_meta_enable *type)
|
||||
{
|
||||
if (type->MetaEnable == 0) {
|
||||
type->MetaEnable = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC__MetaEnable);
|
||||
type->type = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__type);
|
||||
type->size = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__size);
|
||||
type->ringbufferSize = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferSize);
|
||||
type->ringbufferStride = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferStride);
|
||||
type->ringbufferBlocks = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferBlocks);
|
||||
type->ringbufferAlign = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferAlign);
|
||||
type->MetaEnable = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC__MetaEnable);
|
||||
type->type = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__type);
|
||||
type->size = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__size);
|
||||
type->ringbufferSize = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferSize);
|
||||
type->ringbufferStride = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferStride);
|
||||
type->ringbufferBlocks = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferBlocks);
|
||||
type->ringbufferAlign = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferAlign);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -105,28 +107,29 @@ spa_type_param_alloc_meta_enable_map (SpaTypeMap *map, SpaTypeParamAllocMetaEnab
|
|||
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign2 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign2"
|
||||
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign3 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign3"
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_param_alloc_video_padding {
|
||||
uint32_t VideoPadding;
|
||||
uint32_t top;
|
||||
uint32_t bottom;
|
||||
uint32_t left;
|
||||
uint32_t right;
|
||||
uint32_t strideAlign[4];
|
||||
} SpaTypeParamAllocVideoPadding;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_param_alloc_video_padding_map (SpaTypeMap *map, SpaTypeParamAllocVideoPadding *type)
|
||||
spa_type_param_alloc_video_padding_map (struct spa_type_map *map,
|
||||
struct spa_type_param_alloc_video_padding *type)
|
||||
{
|
||||
if (type->VideoPadding == 0) {
|
||||
type->VideoPadding = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC__VideoPadding);
|
||||
type->top = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__top);
|
||||
type->bottom = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__bottom);
|
||||
type->left = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__left);
|
||||
type->right = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__right);
|
||||
type->strideAlign[0] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign0);
|
||||
type->strideAlign[1] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign1);
|
||||
type->strideAlign[2] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign2);
|
||||
type->strideAlign[3] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign3);
|
||||
type->VideoPadding = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC__VideoPadding);
|
||||
type->top = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__top);
|
||||
type->bottom = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__bottom);
|
||||
type->left = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__left);
|
||||
type->right = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__right);
|
||||
type->strideAlign[0] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign0);
|
||||
type->strideAlign[1] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign1);
|
||||
type->strideAlign[2] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign2);
|
||||
type->strideAlign[3] = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,49 +24,43 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaParam SpaParam;
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/pod-utils.h>
|
||||
|
||||
struct spa_param;
|
||||
#define SPA_TYPE__Param SPA_TYPE_POD_OBJECT_BASE "Param"
|
||||
#define SPA_TYPE_PARAM_BASE SPA_TYPE__Param ":"
|
||||
|
||||
typedef struct {
|
||||
SpaPODObjectBody body;
|
||||
/* SpaPODProp follow */
|
||||
} SpaParamBody;
|
||||
|
||||
struct _SpaParam {
|
||||
SpaPOD pod;
|
||||
SpaParamBody body;
|
||||
struct spa_param {
|
||||
struct spa_pod_object object;
|
||||
};
|
||||
|
||||
static inline uint32_t
|
||||
spa_param_query (const SpaParam *param, uint32_t key, ...)
|
||||
spa_param_query (const struct spa_param *param, uint32_t key, ...)
|
||||
{
|
||||
uint32_t count;
|
||||
va_list args;
|
||||
|
||||
va_start (args, key);
|
||||
count = spa_pod_contents_queryv (¶m->pod, sizeof (SpaParam), key, args);
|
||||
count = spa_pod_contents_queryv (¶m->object.pod, sizeof (struct spa_param), key, args);
|
||||
va_end (args);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#define SPA_PARAM_BODY_FOREACH(body, size, iter) \
|
||||
for ((iter) = SPA_MEMBER ((body), sizeof (SpaParamBody), SpaPODProp); \
|
||||
(iter) < SPA_MEMBER ((body), (size), SpaPODProp); \
|
||||
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), SpaPODProp))
|
||||
for ((iter) = SPA_MEMBER ((body), sizeof (struct spa_pod_object_body), struct spa_pod_prop); \
|
||||
(iter) < SPA_MEMBER ((body), (size), struct spa_pod_prop); \
|
||||
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), struct spa_pod_prop))
|
||||
|
||||
#define SPA_PARAM_FOREACH(param, iter) \
|
||||
SPA_PARAM_BODY_FOREACH(¶m->body, SPA_POD_BODY_SIZE(param), iter)
|
||||
SPA_PARAM_BODY_FOREACH(¶m->object.body, SPA_POD_BODY_SIZE(param), iter)
|
||||
|
||||
static inline SpaResult
|
||||
spa_param_fixate (SpaParam *param)
|
||||
static inline int
|
||||
spa_param_fixate (struct spa_param *param)
|
||||
{
|
||||
SpaPODProp *prop;
|
||||
struct spa_pod_prop *prop;
|
||||
|
||||
SPA_PARAM_FOREACH (param, prop)
|
||||
prop->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;
|
||||
|
|
|
|||
|
|
@ -30,15 +30,12 @@ extern "C" {
|
|||
#define SPA_TYPE__Handle SPA_TYPE_INTERFACE_BASE "Handle"
|
||||
#define SPA_TYPE__HandleFactory SPA_TYPE_INTERFACE_BASE "HandleFactory"
|
||||
|
||||
typedef struct _SpaHandle SpaHandle;
|
||||
typedef struct _SpaHandleFactory SpaHandleFactory;
|
||||
|
||||
struct _SpaHandle {
|
||||
struct spa_handle {
|
||||
/* user_data that can be set by the application */
|
||||
void * user_data;
|
||||
/**
|
||||
* SpaHandle::get_interface:
|
||||
* @handle: a #SpaHandle
|
||||
* spa_handle::get_interface:
|
||||
* @handle: a #spa_handle
|
||||
* @interface_id: the interface id
|
||||
* @interface: result to hold the interface.
|
||||
*
|
||||
|
|
@ -48,11 +45,11 @@ struct _SpaHandle {
|
|||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no extensions
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when handle or info is %NULL
|
||||
*/
|
||||
SpaResult (*get_interface) (SpaHandle *handle,
|
||||
uint32_t interface_id,
|
||||
void **interface);
|
||||
int (*get_interface) (struct spa_handle *handle,
|
||||
uint32_t interface_id,
|
||||
void **interface);
|
||||
/**
|
||||
* SpaHandle::clear
|
||||
* spa_handle::clear
|
||||
* @handle: a pointer to memory
|
||||
*
|
||||
* Clean up the memory of @handle. After this, @handle should not be used
|
||||
|
|
@ -60,67 +57,67 @@ struct _SpaHandle {
|
|||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
*/
|
||||
SpaResult (*clear) (SpaHandle *handle);
|
||||
int (*clear) (struct spa_handle *handle);
|
||||
};
|
||||
|
||||
#define spa_handle_get_interface(h,...) (h)->get_interface((h),__VA_ARGS__)
|
||||
#define spa_handle_clear(h) (h)->clear((h))
|
||||
|
||||
/**
|
||||
* SpaInterfaceInfo:
|
||||
* struct spa_interface_info:
|
||||
* @type: the type of the interface, can be used to get the interface
|
||||
*
|
||||
* This structure lists the information about available interfaces on
|
||||
* handles.
|
||||
*/
|
||||
typedef struct {
|
||||
struct spa_interface_info {
|
||||
const char *type;
|
||||
} SpaInterfaceInfo;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaSupport:
|
||||
* struct spa_support:
|
||||
* @type: the type of the support item
|
||||
* @data: specific data for the item
|
||||
*
|
||||
* Extra supporting infrastructure passed to the init() function of
|
||||
* a factory. It can be extra information or interfaces such as logging.
|
||||
*/
|
||||
typedef struct {
|
||||
struct spa_support {
|
||||
const char *type;
|
||||
void *data;
|
||||
} SpaSupport;
|
||||
};
|
||||
|
||||
struct _SpaHandleFactory {
|
||||
struct spa_handle_factory {
|
||||
/**
|
||||
* SpaHandleFactory::name
|
||||
* spa_handle_factory::name
|
||||
*
|
||||
* The name
|
||||
*/
|
||||
const char * name;
|
||||
/**
|
||||
* SpaHandleFactory::info
|
||||
* spa_handle_factory::info
|
||||
*
|
||||
* Extra information about the handles of this factory.
|
||||
*/
|
||||
const SpaDict * info;
|
||||
const struct spa_dict * info;
|
||||
/**
|
||||
* SpaHandleFactory::size
|
||||
* spa_handle_factory::size
|
||||
*
|
||||
* The size of handles from this factory
|
||||
*/
|
||||
const size_t size;
|
||||
|
||||
/**
|
||||
* SpaHandleFactory::init
|
||||
* @factory: a #SpaHandleFactory
|
||||
* spa_handle_factory::init
|
||||
* @factory: a #spa_handle_factory
|
||||
* @handle: a pointer to memory
|
||||
* @info: extra handle specific information, usually obtained
|
||||
* from a #SpaMonitor. This can be used to configure the handle.
|
||||
* from a #spa_monitor. This can be used to configure the handle.
|
||||
* @support: support items
|
||||
* @n_support: number of elements in @support
|
||||
*
|
||||
* Initialize an instance of this factory. The caller should allocate
|
||||
* memory at least SpaHandleFactory::size bytes and pass this as @handle.
|
||||
* memory at least spa_handle_factory::size bytes and pass this as @handle.
|
||||
*
|
||||
* @support can optionally contain extra interfaces or data ites that the
|
||||
* plugin can use such as a logger.
|
||||
|
|
@ -129,16 +126,16 @@ struct _SpaHandleFactory {
|
|||
* #SPA_RESULT_NOT_IMPLEMENTED when an instance can't be made
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when factory or handle are %NULL
|
||||
*/
|
||||
SpaResult (*init) (const SpaHandleFactory *factory,
|
||||
SpaHandle *handle,
|
||||
const SpaDict *info,
|
||||
const SpaSupport *support,
|
||||
uint32_t n_support);
|
||||
int (*init) (const struct spa_handle_factory *factory,
|
||||
struct spa_handle *handle,
|
||||
const struct spa_dict *info,
|
||||
const struct spa_support *support,
|
||||
uint32_t n_support);
|
||||
|
||||
/**
|
||||
* SpaHandle::enum_interface_info:
|
||||
* @factory: a #SpaHandleFactory
|
||||
* @info: result to hold SpaInterfaceInfo.
|
||||
* spa_handle_factory::enum_interface_info:
|
||||
* @factory: a #spa_handle_factory
|
||||
* @info: result to hold spa_interface_info.
|
||||
* @index: index to keep track of the enumeration, 0 for first item
|
||||
*
|
||||
* Enumerate the interface information for @factory.
|
||||
|
|
@ -148,16 +145,16 @@ struct _SpaHandleFactory {
|
|||
* #SPA_RESULT_INVALID_ARGUMENTS when handle or info is %NULL
|
||||
* #SPA_RESULT_ENUM_END when there are no more infos
|
||||
*/
|
||||
SpaResult (*enum_interface_info) (const SpaHandleFactory *factory,
|
||||
const SpaInterfaceInfo **info,
|
||||
uint32_t index);
|
||||
int (*enum_interface_info) (const struct spa_handle_factory *factory,
|
||||
const struct spa_interface_info **info,
|
||||
uint32_t index);
|
||||
};
|
||||
|
||||
#define spa_handle_factory_init(h,...) (h)->init((h),__VA_ARGS__)
|
||||
#define spa_handle_factory_enum_interface_info(h,...) (h)->enum_interface_info((h),__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* SpaEnumHandleFactoryFunc:
|
||||
* spa_handle_factory_enum_func_t:
|
||||
* @factory: a location to hold the factory result
|
||||
* @index: index to keep track of the enumeration
|
||||
*
|
||||
|
|
@ -167,11 +164,13 @@ struct _SpaHandleFactory {
|
|||
* #SPA_RESULT_INVALID_ARGUMENTS when factory is %NULL
|
||||
* #SPA_RESULT_ENUM_END when there are no more factories
|
||||
*/
|
||||
typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory,
|
||||
uint32_t index);
|
||||
typedef int (*spa_handle_factory_enum_func_t) (const struct spa_handle_factory **factory,
|
||||
uint32_t index);
|
||||
|
||||
#define SPA_HANDLE_FACTORY_ENUM_FUNC_NAME "spa_handle_factory_enum"
|
||||
|
||||
/**
|
||||
* spa_enum_handle_factory:
|
||||
* spa_handle_factory_enum:
|
||||
* @factory: a location to hold the factory result
|
||||
* @index: index to keep track of the enumeration
|
||||
*
|
||||
|
|
@ -181,8 +180,8 @@ typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory,
|
|||
* #SPA_RESULT_INVALID_ARGUMENTS when factory is %NULL
|
||||
* #SPA_RESULT_ENUM_END when there are no more factories
|
||||
*/
|
||||
SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||
uint32_t index);
|
||||
int spa_handle_factory_enum (const struct spa_handle_factory **factory,
|
||||
uint32_t index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -28,30 +28,30 @@ extern "C" {
|
|||
#include <stdio.h>
|
||||
#include <spa/pod-utils.h>
|
||||
|
||||
typedef struct _SpaPODFrame {
|
||||
struct _SpaPODFrame *parent;
|
||||
SpaPOD pod;
|
||||
uint32_t ref;
|
||||
} SpaPODFrame;
|
||||
struct spa_pod_frame {
|
||||
struct spa_pod_frame *parent;
|
||||
struct spa_pod pod;
|
||||
uint32_t ref;
|
||||
};
|
||||
|
||||
typedef struct _SpaPODBuilder {
|
||||
struct spa_pod_builder {
|
||||
void *data;
|
||||
uint32_t size;
|
||||
uint32_t offset;
|
||||
SpaPODFrame *stack;
|
||||
uint32_t (*write) (struct _SpaPODBuilder *builder, uint32_t ref, const void *data, uint32_t size);
|
||||
struct spa_pod_frame *stack;
|
||||
uint32_t (*write) (struct spa_pod_builder *builder, uint32_t ref, const void *data, uint32_t size);
|
||||
bool in_array;
|
||||
bool first;
|
||||
} SpaPODBuilder;
|
||||
};
|
||||
|
||||
#define SPA_POD_BUILDER_INIT(buffer,size) { buffer, size, }
|
||||
|
||||
#define SPA_POD_BUILDER_DEREF(b,ref,type) SPA_MEMBER ((b)->data, (ref), type)
|
||||
|
||||
static inline void
|
||||
spa_pod_builder_init (SpaPODBuilder *builder,
|
||||
void *data,
|
||||
uint32_t size)
|
||||
spa_pod_builder_init (struct spa_pod_builder *builder,
|
||||
void *data,
|
||||
uint32_t size)
|
||||
{
|
||||
builder->data = data;
|
||||
builder->size = size;
|
||||
|
|
@ -60,10 +60,10 @@ spa_pod_builder_init (SpaPODBuilder *builder,
|
|||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push (SpaPODBuilder *builder,
|
||||
SpaPODFrame *frame,
|
||||
const SpaPOD *pod,
|
||||
uint32_t ref)
|
||||
spa_pod_builder_push (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame,
|
||||
const struct spa_pod *pod,
|
||||
uint32_t ref)
|
||||
{
|
||||
frame->parent = builder->stack;
|
||||
frame->pod = *pod;
|
||||
|
|
@ -75,10 +75,10 @@ spa_pod_builder_push (SpaPODBuilder *builder,
|
|||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_raw (SpaPODBuilder *builder, const void *data, uint32_t size)
|
||||
spa_pod_builder_raw (struct spa_pod_builder *builder, const void *data, uint32_t size)
|
||||
{
|
||||
uint32_t ref;
|
||||
SpaPODFrame *f;
|
||||
struct spa_pod_frame *f;
|
||||
|
||||
if (builder->write) {
|
||||
ref = builder->write (builder, -1, data, size);
|
||||
|
|
@ -98,7 +98,7 @@ spa_pod_builder_raw (SpaPODBuilder *builder, const void *data, uint32_t size)
|
|||
}
|
||||
|
||||
static void
|
||||
spa_pod_builder_pad (SpaPODBuilder *builder, uint32_t size)
|
||||
spa_pod_builder_pad (struct spa_pod_builder *builder, uint32_t size)
|
||||
{
|
||||
uint64_t zeroes = 0;
|
||||
size = SPA_ROUND_UP_N (size, 8) - size;
|
||||
|
|
@ -107,7 +107,7 @@ spa_pod_builder_pad (SpaPODBuilder *builder, uint32_t size)
|
|||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_raw_padded (SpaPODBuilder *builder, const void *data, uint32_t size)
|
||||
spa_pod_builder_raw_padded (struct spa_pod_builder *builder, const void *data, uint32_t size)
|
||||
{
|
||||
uint32_t ref = size ? spa_pod_builder_raw (builder, data, size) : -1;
|
||||
spa_pod_builder_pad (builder, size);
|
||||
|
|
@ -115,14 +115,14 @@ spa_pod_builder_raw_padded (SpaPODBuilder *builder, const void *data, uint32_t s
|
|||
}
|
||||
|
||||
static inline void
|
||||
spa_pod_builder_pop (SpaPODBuilder *builder,
|
||||
SpaPODFrame *frame)
|
||||
spa_pod_builder_pop (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame)
|
||||
{
|
||||
if (frame->ref != -1) {
|
||||
if (builder->write)
|
||||
builder->write (builder, frame->ref, &frame->pod, sizeof(SpaPOD));
|
||||
builder->write (builder, frame->ref, &frame->pod, sizeof(struct spa_pod));
|
||||
else
|
||||
memcpy (builder->data + frame->ref, &frame->pod, sizeof(SpaPOD));
|
||||
memcpy (builder->data + frame->ref, &frame->pod, sizeof(struct spa_pod));
|
||||
}
|
||||
builder->stack = frame->parent;
|
||||
builder->in_array = (builder->stack && (builder->stack->pod.type == SPA_POD_TYPE_ARRAY ||
|
||||
|
|
@ -131,7 +131,7 @@ spa_pod_builder_pop (SpaPODBuilder *builder,
|
|||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_primitive (SpaPODBuilder *builder, const SpaPOD *p)
|
||||
spa_pod_builder_primitive (struct spa_pod_builder *builder, const struct spa_pod *p)
|
||||
{
|
||||
const void *data;
|
||||
uint32_t size, ref;
|
||||
|
|
@ -153,63 +153,63 @@ spa_pod_builder_primitive (SpaPODBuilder *builder, const SpaPOD *p)
|
|||
#define SPA_POD_BOOL_INIT(val) { { sizeof (uint32_t), SPA_POD_TYPE_BOOL }, val ? 1 : 0 }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_bool (SpaPODBuilder *builder, bool val)
|
||||
spa_pod_builder_bool (struct spa_pod_builder *builder, bool val)
|
||||
{
|
||||
const SpaPODBool p = SPA_POD_BOOL_INIT (val);
|
||||
const struct spa_pod_bool p = SPA_POD_BOOL_INIT (val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
}
|
||||
|
||||
#define SPA_POD_ID_INIT(val) { { sizeof (uint32_t), SPA_POD_TYPE_ID }, val }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_id (SpaPODBuilder *builder, uint32_t val)
|
||||
spa_pod_builder_id (struct spa_pod_builder *builder, uint32_t val)
|
||||
{
|
||||
const SpaPODId p = SPA_POD_ID_INIT (val);
|
||||
const struct spa_pod_id p = SPA_POD_ID_INIT (val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
}
|
||||
|
||||
#define SPA_POD_INT_INIT(val) { { sizeof (uint32_t), SPA_POD_TYPE_INT }, val }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_int (SpaPODBuilder *builder, int32_t val)
|
||||
spa_pod_builder_int (struct spa_pod_builder *builder, int32_t val)
|
||||
{
|
||||
const SpaPODInt p = SPA_POD_INT_INIT (val);
|
||||
const struct spa_pod_int p = SPA_POD_INT_INIT (val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
}
|
||||
|
||||
#define SPA_POD_LONG_INIT(val) { { sizeof (uint64_t), SPA_POD_TYPE_LONG }, val }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_long (SpaPODBuilder *builder, int64_t val)
|
||||
spa_pod_builder_long (struct spa_pod_builder *builder, int64_t val)
|
||||
{
|
||||
const SpaPODLong p = SPA_POD_LONG_INIT (val);
|
||||
const struct spa_pod_long p = SPA_POD_LONG_INIT (val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
}
|
||||
|
||||
#define SPA_POD_FLOAT_INIT(val) { { sizeof (float), SPA_POD_TYPE_FLOAT }, val }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_float (SpaPODBuilder *builder, float val)
|
||||
spa_pod_builder_float (struct spa_pod_builder *builder, float val)
|
||||
{
|
||||
const SpaPODFloat p = SPA_POD_FLOAT_INIT (val);
|
||||
const struct spa_pod_float p = SPA_POD_FLOAT_INIT (val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
}
|
||||
|
||||
#define SPA_POD_DOUBLE_INIT(val) { { sizeof (double), SPA_POD_TYPE_DOUBLE }, val }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_double (SpaPODBuilder *builder, double val)
|
||||
spa_pod_builder_double (struct spa_pod_builder *builder, double val)
|
||||
{
|
||||
const SpaPODDouble p = SPA_POD_DOUBLE_INIT (val);
|
||||
const struct spa_pod_double p = SPA_POD_DOUBLE_INIT (val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
}
|
||||
|
||||
#define SPA_POD_STRING_INIT(len) { { len, SPA_POD_TYPE_STRING } }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_string_len (SpaPODBuilder *builder, const char *str, uint32_t len)
|
||||
spa_pod_builder_string_len (struct spa_pod_builder *builder, const char *str, uint32_t len)
|
||||
{
|
||||
const SpaPODString p = SPA_POD_STRING_INIT (len);
|
||||
const struct spa_pod_string p = SPA_POD_STRING_INIT (len);
|
||||
uint32_t ref = spa_pod_builder_raw (builder, &p, sizeof (p));
|
||||
if (spa_pod_builder_raw_padded (builder, str, len) == -1)
|
||||
ref = -1;
|
||||
|
|
@ -217,7 +217,7 @@ spa_pod_builder_string_len (SpaPODBuilder *builder, const char *str, uint32_t le
|
|||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_string (SpaPODBuilder *builder, const char *str)
|
||||
spa_pod_builder_string (struct spa_pod_builder *builder, const char *str)
|
||||
{
|
||||
uint32_t len = str ? strlen (str) : 0;
|
||||
return spa_pod_builder_string_len (builder, str ? str : "", len + 1);
|
||||
|
|
@ -226,60 +226,60 @@ spa_pod_builder_string (SpaPODBuilder *builder, const char *str)
|
|||
#define SPA_POD_BYTES_INIT(len) { { len, SPA_POD_TYPE_BYTES } }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_bytes (SpaPODBuilder *builder, const void *bytes, uint32_t len)
|
||||
spa_pod_builder_bytes (struct spa_pod_builder *builder, const void *bytes, uint32_t len)
|
||||
{
|
||||
const SpaPODBytes p = SPA_POD_BYTES_INIT (len);
|
||||
const struct spa_pod_bytes p = SPA_POD_BYTES_INIT (len);
|
||||
uint32_t ref = spa_pod_builder_raw (builder, &p, sizeof (p));
|
||||
if (spa_pod_builder_raw_padded (builder, bytes, len) == -1)
|
||||
ref = -1;
|
||||
return ref;
|
||||
}
|
||||
|
||||
#define SPA_POD_POINTER_INIT(type,value) { { sizeof (SpaPODPointerBody), SPA_POD_TYPE_POINTER }, { type, value } }
|
||||
#define SPA_POD_POINTER_INIT(type,value) { { sizeof (struct spa_pod_pointer_body), SPA_POD_TYPE_POINTER }, { type, value } }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_pointer (SpaPODBuilder *builder, uint32_t type, void *val)
|
||||
spa_pod_builder_pointer (struct spa_pod_builder *builder, uint32_t type, void *val)
|
||||
{
|
||||
const SpaPODPointer p = SPA_POD_POINTER_INIT (type, val);
|
||||
const struct spa_pod_pointer p = SPA_POD_POINTER_INIT (type, val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
}
|
||||
|
||||
#define SPA_POD_RECTANGLE_INIT(width,height) { { sizeof (SpaRectangle), SPA_POD_TYPE_RECTANGLE }, { width, height } }
|
||||
#define SPA_POD_RECTANGLE_INIT(width,height) { { sizeof (struct spa_rectangle), SPA_POD_TYPE_RECTANGLE }, { width, height } }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_rectangle (SpaPODBuilder *builder, uint32_t width, uint32_t height)
|
||||
spa_pod_builder_rectangle (struct spa_pod_builder *builder, uint32_t width, uint32_t height)
|
||||
{
|
||||
const SpaPODRectangle p = SPA_POD_RECTANGLE_INIT (width, height);
|
||||
const struct spa_pod_rectangle p = SPA_POD_RECTANGLE_INIT (width, height);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
}
|
||||
|
||||
#define SPA_POD_FRACTION_INIT(num,denom) { { sizeof (SpaFraction), SPA_POD_TYPE_FRACTION }, { num, denom } }
|
||||
#define SPA_POD_FRACTION_INIT(num,denom) { { sizeof (struct spa_fraction), SPA_POD_TYPE_FRACTION }, { num, denom } }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_fraction (SpaPODBuilder *builder, uint32_t num, uint32_t denom)
|
||||
spa_pod_builder_fraction (struct spa_pod_builder *builder, uint32_t num, uint32_t denom)
|
||||
{
|
||||
const SpaPODFraction p = SPA_POD_FRACTION_INIT (num, denom);
|
||||
const struct spa_pod_fraction p = SPA_POD_FRACTION_INIT (num, denom);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push_array (SpaPODBuilder *builder,
|
||||
SpaPODFrame *frame)
|
||||
spa_pod_builder_push_array (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame)
|
||||
{
|
||||
const SpaPODArray p = { { sizeof (SpaPODArrayBody) - sizeof (SpaPOD), SPA_POD_TYPE_ARRAY }, { { 0, 0 } } };
|
||||
const struct spa_pod_array p = { { sizeof (struct spa_pod_array_body) - sizeof (struct spa_pod), SPA_POD_TYPE_ARRAY }, { { 0, 0 } } };
|
||||
return spa_pod_builder_push (builder, frame, &p.pod,
|
||||
spa_pod_builder_raw (builder, &p, sizeof(p) - sizeof(SpaPOD)));
|
||||
spa_pod_builder_raw (builder, &p, sizeof(p) - sizeof(struct spa_pod)));
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_array (SpaPODBuilder *builder,
|
||||
spa_pod_builder_array (struct spa_pod_builder *builder,
|
||||
uint32_t child_size,
|
||||
uint32_t child_type,
|
||||
uint32_t n_elems,
|
||||
const void *elems)
|
||||
{
|
||||
const SpaPODArray p = {
|
||||
{ sizeof (SpaPODArrayBody) + n_elems * child_size, SPA_POD_TYPE_ARRAY },
|
||||
const struct spa_pod_array p = {
|
||||
{ sizeof (struct spa_pod_array_body) + n_elems * child_size, SPA_POD_TYPE_ARRAY },
|
||||
{ { child_size, child_type } }
|
||||
};
|
||||
uint32_t ref = spa_pod_builder_raw (builder, &p, sizeof(p));
|
||||
|
|
@ -291,10 +291,10 @@ spa_pod_builder_array (SpaPODBuilder *builder,
|
|||
#define SPA_POD_STRUCT_INIT(size) { { size, SPA_POD_TYPE_STRUCT } }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push_struct (SpaPODBuilder *builder,
|
||||
SpaPODFrame *frame)
|
||||
spa_pod_builder_push_struct (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame)
|
||||
{
|
||||
const SpaPODStruct p = SPA_POD_STRUCT_INIT (0);
|
||||
const struct spa_pod_struct p = SPA_POD_STRUCT_INIT (0);
|
||||
return spa_pod_builder_push (builder, frame, &p.pod,
|
||||
spa_pod_builder_raw (builder, &p, sizeof(p)));
|
||||
}
|
||||
|
|
@ -303,51 +303,52 @@ spa_pod_builder_push_struct (SpaPODBuilder *builder,
|
|||
#define SPA_POD_OBJECT_INIT_COMPLEX(size,id,type,...) { { size, SPA_POD_TYPE_OBJECT }, { id, type }, __VA_ARGS__ }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push_object (SpaPODBuilder *builder,
|
||||
SpaPODFrame *frame,
|
||||
spa_pod_builder_push_object (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame,
|
||||
uint32_t id,
|
||||
uint32_t type)
|
||||
{
|
||||
const SpaPODObject p = SPA_POD_OBJECT_INIT (sizeof (SpaPODObjectBody), id, type);
|
||||
const struct spa_pod_object p = SPA_POD_OBJECT_INIT (sizeof (struct spa_pod_object_body), id, type);
|
||||
return spa_pod_builder_push (builder, frame, &p.pod,
|
||||
spa_pod_builder_raw (builder, &p, sizeof(p)));
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push_prop (SpaPODBuilder *builder,
|
||||
SpaPODFrame *frame,
|
||||
spa_pod_builder_push_prop (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame,
|
||||
uint32_t key,
|
||||
uint32_t flags)
|
||||
{
|
||||
const SpaPODProp p = { { sizeof (SpaPODPropBody) - sizeof(SpaPOD), SPA_POD_TYPE_PROP},
|
||||
{ key, flags, { 0, 0 } } };
|
||||
const struct spa_pod_prop p = { { sizeof (struct spa_pod_prop_body) -
|
||||
sizeof(struct spa_pod), SPA_POD_TYPE_PROP},
|
||||
{ key, flags, { 0, 0 } } };
|
||||
return spa_pod_builder_push (builder, frame, &p.pod,
|
||||
spa_pod_builder_raw (builder, &p, sizeof(p) - sizeof(SpaPOD)));
|
||||
spa_pod_builder_raw (builder, &p, sizeof(p) - sizeof(struct spa_pod)));
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_pod_builder_addv (SpaPODBuilder *builder,
|
||||
spa_pod_builder_addv (struct spa_pod_builder *builder,
|
||||
uint32_t type,
|
||||
va_list args)
|
||||
{
|
||||
uint32_t n_values = 0;
|
||||
union {
|
||||
SpaPOD pod;
|
||||
SpaPODBool bool_pod;
|
||||
SpaPODId id_pod;
|
||||
SpaPODInt int_pod;
|
||||
SpaPODLong long_pod;
|
||||
SpaPODFloat float_pod;
|
||||
SpaPODDouble double_pod;
|
||||
SpaPODString string_pod;
|
||||
SpaPODBytes bytes_pod;
|
||||
SpaPODPointer pointer_pod;
|
||||
SpaPODRectangle rectangle_pod;
|
||||
SpaPODFraction fraction_pod;
|
||||
SpaPODArray array_pod;
|
||||
SpaPODStruct struct_pod;
|
||||
SpaPODObject object_pod;
|
||||
SpaPODProp prop_pod;
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_bool bool_pod;
|
||||
struct spa_pod_id id_pod;
|
||||
struct spa_pod_int int_pod;
|
||||
struct spa_pod_long long_pod;
|
||||
struct spa_pod_float float_pod;
|
||||
struct spa_pod_double double_pod;
|
||||
struct spa_pod_string string_pod;
|
||||
struct spa_pod_bytes bytes_pod;
|
||||
struct spa_pod_pointer pointer_pod;
|
||||
struct spa_pod_rectangle rectangle_pod;
|
||||
struct spa_pod_fraction fraction_pod;
|
||||
struct spa_pod_array array_pod;
|
||||
struct spa_pod_struct struct_pod;
|
||||
struct spa_pod_object object_pod;
|
||||
struct spa_pod_prop prop_pod;
|
||||
} head;
|
||||
uint32_t head_size;
|
||||
const void *body;
|
||||
|
|
@ -355,7 +356,7 @@ spa_pod_builder_addv (SpaPODBuilder *builder,
|
|||
static const uint64_t zeroes = 0;
|
||||
|
||||
while (type != SPA_POD_TYPE_INVALID) {
|
||||
SpaPODFrame *f = NULL;
|
||||
struct spa_pod_frame *f = NULL;
|
||||
const void *data[3];
|
||||
uint32_t size[3], ref, i, n_sizes = 0;
|
||||
|
||||
|
|
@ -368,28 +369,28 @@ spa_pod_builder_addv (SpaPODBuilder *builder,
|
|||
head.int_pod.pod.type = type;
|
||||
head.int_pod.pod.size = body_size = sizeof (uint32_t);
|
||||
head.int_pod.value = va_arg (args, int);
|
||||
head_size = sizeof (SpaPOD);
|
||||
head_size = sizeof (struct spa_pod);
|
||||
body = &head.int_pod.value;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_LONG:
|
||||
head.long_pod.pod.type = SPA_POD_TYPE_LONG;
|
||||
head.long_pod.pod.size = body_size = sizeof (uint32_t);
|
||||
head.long_pod.value = va_arg (args, int64_t);
|
||||
head_size = sizeof (SpaPOD);
|
||||
head_size = sizeof (struct spa_pod);
|
||||
body = &head.long_pod.value;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_FLOAT:
|
||||
head.float_pod.pod.type = SPA_POD_TYPE_FLOAT;
|
||||
head.float_pod.pod.size = body_size = sizeof (float);
|
||||
head.float_pod.value = va_arg (args, double);
|
||||
head_size = sizeof (SpaPOD);
|
||||
head_size = sizeof (struct spa_pod);
|
||||
body = &head.float_pod.value;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_DOUBLE:
|
||||
head.double_pod.pod.type = SPA_POD_TYPE_DOUBLE;
|
||||
head.double_pod.pod.size = body_size = sizeof (double);
|
||||
head.double_pod.value = va_arg (args, double);
|
||||
head_size = sizeof (SpaPOD);
|
||||
head_size = sizeof (struct spa_pod);
|
||||
body = &head.double_pod.value;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_STRING:
|
||||
|
|
@ -397,94 +398,94 @@ spa_pod_builder_addv (SpaPODBuilder *builder,
|
|||
body_size = body ? strlen (body) + 1 : (body = "", 1);
|
||||
head.string_pod.pod.type = SPA_POD_TYPE_STRING;
|
||||
head.string_pod.pod.size = body_size;
|
||||
head_size = sizeof (SpaPOD);
|
||||
head_size = sizeof (struct spa_pod);
|
||||
goto primitive;
|
||||
case -SPA_POD_TYPE_STRING:
|
||||
body = va_arg (args, const char *);
|
||||
body_size = va_arg (args, uint32_t);
|
||||
head.string_pod.pod.type = SPA_POD_TYPE_STRING;
|
||||
head.string_pod.pod.size = body_size;
|
||||
head_size = sizeof (SpaPOD);
|
||||
head_size = sizeof (struct spa_pod);
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_BYTES:
|
||||
body = va_arg (args, void *);
|
||||
body_size = va_arg (args, uint32_t);
|
||||
head.bytes_pod.pod.type = SPA_POD_TYPE_BYTES;
|
||||
head.bytes_pod.pod.size = body_size;
|
||||
head_size = sizeof (SpaPOD);
|
||||
head_size = sizeof (struct spa_pod);
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_POINTER:
|
||||
head.pointer_pod.pod.type = SPA_POD_TYPE_POINTER;
|
||||
head.pointer_pod.pod.size = body_size = sizeof (SpaPODPointerBody);
|
||||
head.pointer_pod.pod.size = body_size = sizeof (struct spa_pod_pointer_body);
|
||||
head.pointer_pod.body.type = va_arg (args, uint32_t);
|
||||
head.pointer_pod.body.value = va_arg (args, void *);
|
||||
head_size = sizeof (SpaPOD);
|
||||
head_size = sizeof (struct spa_pod);
|
||||
body = &head.pointer_pod.body;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_RECTANGLE:
|
||||
head.rectangle_pod.pod.type = SPA_POD_TYPE_RECTANGLE;
|
||||
head.rectangle_pod.pod.size = body_size = sizeof (SpaRectangle);
|
||||
head.rectangle_pod.pod.size = body_size = sizeof (struct spa_rectangle);
|
||||
head.rectangle_pod.value.width = va_arg (args, uint32_t);
|
||||
head.rectangle_pod.value.height = va_arg (args, uint32_t);
|
||||
head_size = sizeof (SpaPOD);
|
||||
head_size = sizeof (struct spa_pod);
|
||||
body = &head.rectangle_pod.value;
|
||||
goto primitive;
|
||||
case -SPA_POD_TYPE_RECTANGLE:
|
||||
head.rectangle_pod.pod.type = SPA_POD_TYPE_RECTANGLE;
|
||||
head.rectangle_pod.pod.size = body_size = sizeof (SpaRectangle);
|
||||
head.rectangle_pod.value = *va_arg (args, SpaRectangle *);
|
||||
head_size = sizeof (SpaPOD);
|
||||
head.rectangle_pod.pod.size = body_size = sizeof (struct spa_rectangle);
|
||||
head.rectangle_pod.value = *va_arg (args, struct spa_rectangle *);
|
||||
head_size = sizeof (struct spa_pod);
|
||||
body = &head.rectangle_pod.value;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_FRACTION:
|
||||
head.fraction_pod.pod.type = SPA_POD_TYPE_FRACTION;
|
||||
head.fraction_pod.pod.size = body_size = sizeof (SpaFraction);
|
||||
head.fraction_pod.pod.size = body_size = sizeof (struct spa_fraction);
|
||||
head.fraction_pod.value.num = va_arg (args, uint32_t);
|
||||
head.fraction_pod.value.denom = va_arg (args, uint32_t);
|
||||
head_size = sizeof (SpaPOD);
|
||||
head_size = sizeof (struct spa_pod);
|
||||
body = &head.fraction_pod.value;
|
||||
goto primitive;
|
||||
case -SPA_POD_TYPE_FRACTION:
|
||||
head.fraction_pod.pod.type = SPA_POD_TYPE_FRACTION;
|
||||
head.fraction_pod.pod.size = body_size = sizeof (SpaFraction);
|
||||
head.fraction_pod.value = *va_arg (args, SpaFraction *);
|
||||
head_size = sizeof (SpaPOD);
|
||||
head.fraction_pod.pod.size = body_size = sizeof (struct spa_fraction);
|
||||
head.fraction_pod.value = *va_arg (args, struct spa_fraction *);
|
||||
head_size = sizeof (struct spa_pod);
|
||||
body = &head.fraction_pod.value;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_BITMASK:
|
||||
break;
|
||||
case SPA_POD_TYPE_ARRAY:
|
||||
f = va_arg (args, SpaPODFrame *);
|
||||
f = va_arg (args, struct spa_pod_frame *);
|
||||
type = va_arg (args, uint32_t);
|
||||
n_values = va_arg (args, uint32_t);
|
||||
head.array_pod.pod.type = SPA_POD_TYPE_ARRAY;
|
||||
head.array_pod.pod.size = 0;
|
||||
head_size = sizeof(SpaPOD);
|
||||
head_size = sizeof(struct spa_pod);
|
||||
body = NULL;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_STRUCT:
|
||||
f = va_arg (args, SpaPODFrame *);
|
||||
f = va_arg (args, struct spa_pod_frame *);
|
||||
head.struct_pod.pod.type = SPA_POD_TYPE_STRUCT;
|
||||
head.struct_pod.pod.size = 0;
|
||||
head_size = sizeof(SpaPOD);
|
||||
head_size = sizeof(struct spa_pod);
|
||||
body = NULL;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_OBJECT:
|
||||
f = va_arg (args, SpaPODFrame *);
|
||||
f = va_arg (args, struct spa_pod_frame *);
|
||||
head.object_pod.pod.type = SPA_POD_TYPE_OBJECT;
|
||||
head.object_pod.pod.size = sizeof (SpaPODObjectBody);
|
||||
head.object_pod.pod.size = sizeof (struct spa_pod_object_body);
|
||||
head.object_pod.body.id = va_arg (args, uint32_t);
|
||||
head.object_pod.body.type = va_arg (args, uint32_t);
|
||||
head_size = sizeof(SpaPODObject);
|
||||
head_size = sizeof(struct spa_pod_object);
|
||||
body = NULL;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_PROP:
|
||||
f = va_arg (args, SpaPODFrame *);
|
||||
f = va_arg (args, struct spa_pod_frame *);
|
||||
head.prop_pod.pod.type = SPA_POD_TYPE_PROP;
|
||||
head.prop_pod.pod.size = sizeof (SpaPODPropBody) - sizeof(SpaPOD);
|
||||
head.prop_pod.pod.size = sizeof (struct spa_pod_prop_body) - sizeof(struct spa_pod);
|
||||
head.prop_pod.body.key = va_arg (args, uint32_t);
|
||||
head.prop_pod.body.flags = va_arg (args, uint32_t);
|
||||
head_size = sizeof (SpaPODProp) - sizeof(SpaPOD);
|
||||
head_size = sizeof (struct spa_pod_prop) - sizeof(struct spa_pod);
|
||||
body = NULL;
|
||||
type = va_arg (args, uint32_t);
|
||||
n_values = va_arg (args, uint32_t);
|
||||
|
|
@ -493,7 +494,7 @@ spa_pod_builder_addv (SpaPODBuilder *builder,
|
|||
case -SPA_POD_TYPE_STRUCT:
|
||||
case -SPA_POD_TYPE_OBJECT:
|
||||
case -SPA_POD_TYPE_PROP:
|
||||
f = va_arg (args, SpaPODFrame *);
|
||||
f = va_arg (args, struct spa_pod_frame *);
|
||||
spa_pod_builder_pop (builder, f);
|
||||
break;
|
||||
case SPA_POD_TYPE_POD:
|
||||
|
|
@ -535,8 +536,8 @@ extra:
|
|||
}
|
||||
|
||||
static inline void
|
||||
spa_pod_builder_add (SpaPODBuilder *builder,
|
||||
uint32_t type, ...)
|
||||
spa_pod_builder_add (struct spa_pod_builder *builder,
|
||||
uint32_t type, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ extern "C" {
|
|||
#include <spa/defs.h>
|
||||
#include <spa/pod-utils.h>
|
||||
|
||||
typedef struct {
|
||||
struct spa_pod_iter {
|
||||
const void *data;
|
||||
uint32_t size;
|
||||
uint32_t offset;
|
||||
} SpaPODIter;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_pod_iter_contents (SpaPODIter *iter, const void *data, uint32_t size)
|
||||
spa_pod_iter_contents (struct spa_pod_iter *iter, const void *data, uint32_t size)
|
||||
{
|
||||
iter->data = data;
|
||||
iter->size = size;
|
||||
|
|
@ -44,40 +44,40 @@ spa_pod_iter_contents (SpaPODIter *iter, const void *data, uint32_t size)
|
|||
}
|
||||
|
||||
static inline bool
|
||||
spa_pod_iter_struct (SpaPODIter *iter, const void *data, uint32_t size)
|
||||
spa_pod_iter_struct (struct spa_pod_iter *iter, const void *data, uint32_t size)
|
||||
{
|
||||
if (data == NULL || size < 8 || SPA_POD_SIZE (data) > size || SPA_POD_TYPE (data) != SPA_POD_TYPE_STRUCT)
|
||||
return false;
|
||||
|
||||
spa_pod_iter_contents (iter, SPA_POD_CONTENTS (SpaPODStruct, data),
|
||||
SPA_POD_CONTENTS_SIZE (SpaPODStruct, data));
|
||||
spa_pod_iter_contents (iter, SPA_POD_CONTENTS (struct spa_pod_struct, data),
|
||||
SPA_POD_CONTENTS_SIZE (struct spa_pod_struct, data));
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
spa_pod_iter_object (SpaPODIter *iter, const void *data, uint32_t size)
|
||||
spa_pod_iter_object (struct spa_pod_iter *iter, const void *data, uint32_t size)
|
||||
{
|
||||
if (data == NULL || SPA_POD_SIZE (data) > size || SPA_POD_TYPE (data) != SPA_POD_TYPE_OBJECT)
|
||||
return false;
|
||||
|
||||
spa_pod_iter_contents (iter, SPA_POD_CONTENTS (SpaPODObject, data),
|
||||
SPA_POD_CONTENTS_SIZE (SpaPODObject, data));
|
||||
spa_pod_iter_contents (iter, SPA_POD_CONTENTS (struct spa_pod_object, data),
|
||||
SPA_POD_CONTENTS_SIZE (struct spa_pod_object, data));
|
||||
return true;
|
||||
}
|
||||
static inline bool
|
||||
spa_pod_iter_pod (SpaPODIter *iter, SpaPOD *pod)
|
||||
spa_pod_iter_pod (struct spa_pod_iter *iter, struct spa_pod *pod)
|
||||
{
|
||||
void *data;
|
||||
uint32_t size;
|
||||
|
||||
switch (SPA_POD_TYPE (pod)) {
|
||||
case SPA_POD_TYPE_STRUCT:
|
||||
data = SPA_POD_CONTENTS (SpaPODStruct, pod);
|
||||
size = SPA_POD_CONTENTS_SIZE (SpaPODStruct, pod);
|
||||
data = SPA_POD_CONTENTS (struct spa_pod_struct, pod);
|
||||
size = SPA_POD_CONTENTS_SIZE (struct spa_pod_struct, pod);
|
||||
break;
|
||||
case SPA_POD_TYPE_OBJECT:
|
||||
data = SPA_POD_CONTENTS (SpaPODObject, pod);
|
||||
size = SPA_POD_CONTENTS_SIZE (SpaPODObject, pod);
|
||||
data = SPA_POD_CONTENTS (struct spa_pod_object, pod);
|
||||
size = SPA_POD_CONTENTS_SIZE (struct spa_pod_object, pod);
|
||||
break;
|
||||
default:
|
||||
spa_pod_iter_contents (iter, NULL, 0);
|
||||
|
|
@ -88,22 +88,22 @@ spa_pod_iter_pod (SpaPODIter *iter, SpaPOD *pod)
|
|||
}
|
||||
|
||||
static inline bool
|
||||
spa_pod_iter_has_next (SpaPODIter *iter)
|
||||
spa_pod_iter_has_next (struct spa_pod_iter *iter)
|
||||
{
|
||||
return (iter->offset + 8 <= iter->size &&
|
||||
SPA_POD_SIZE (SPA_MEMBER (iter->data, iter->offset, SpaPOD)) <= iter->size);
|
||||
SPA_POD_SIZE (SPA_MEMBER (iter->data, iter->offset, struct spa_pod)) <= iter->size);
|
||||
}
|
||||
|
||||
static inline SpaPOD *
|
||||
spa_pod_iter_next (SpaPODIter *iter)
|
||||
static inline struct spa_pod *
|
||||
spa_pod_iter_next (struct spa_pod_iter *iter)
|
||||
{
|
||||
SpaPOD *res = SPA_MEMBER (iter->data, iter->offset, SpaPOD);
|
||||
struct spa_pod *res = SPA_MEMBER (iter->data, iter->offset, struct spa_pod);
|
||||
iter->offset += SPA_ROUND_UP_N (SPA_POD_SIZE (res), 8);
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline SpaPOD *
|
||||
spa_pod_iter_first (SpaPODIter *iter, SpaPOD *pod)
|
||||
static inline struct spa_pod *
|
||||
spa_pod_iter_first (struct spa_pod_iter *iter, struct spa_pod *pod)
|
||||
{
|
||||
if (!spa_pod_iter_pod (iter, pod) ||
|
||||
!spa_pod_iter_has_next (iter))
|
||||
|
|
@ -112,14 +112,14 @@ spa_pod_iter_first (SpaPODIter *iter, SpaPOD *pod)
|
|||
}
|
||||
|
||||
static inline bool
|
||||
spa_pod_iter_getv (SpaPODIter *iter,
|
||||
spa_pod_iter_getv (struct spa_pod_iter *iter,
|
||||
uint32_t type,
|
||||
va_list args)
|
||||
{
|
||||
bool res = true;
|
||||
|
||||
while (type && (res = spa_pod_iter_has_next (iter))) {
|
||||
SpaPOD *pod = spa_pod_iter_next (iter);
|
||||
struct spa_pod *pod = spa_pod_iter_next (iter);
|
||||
|
||||
SPA_POD_COLLECT (pod, type, args, error);
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ error:
|
|||
}
|
||||
|
||||
static inline bool
|
||||
spa_pod_iter_get (SpaPODIter *iter, uint32_t type, ...)
|
||||
spa_pod_iter_get (struct spa_pod_iter *iter, uint32_t type, ...)
|
||||
{
|
||||
va_list args;
|
||||
bool res;
|
||||
|
|
|
|||
|
|
@ -28,80 +28,80 @@ extern "C" {
|
|||
#include <stdarg.h>
|
||||
#include <spa/pod.h>
|
||||
|
||||
#define SPA_POD_BODY_SIZE(pod) (((SpaPOD*)(pod))->size)
|
||||
#define SPA_POD_TYPE(pod) (((SpaPOD*)(pod))->type)
|
||||
#define SPA_POD_SIZE(pod) (sizeof(SpaPOD) + SPA_POD_BODY_SIZE(pod))
|
||||
#define SPA_POD_BODY_SIZE(pod) (((struct spa_pod*)(pod))->size)
|
||||
#define SPA_POD_TYPE(pod) (((struct spa_pod*)(pod))->type)
|
||||
#define SPA_POD_SIZE(pod) (sizeof(struct spa_pod) + SPA_POD_BODY_SIZE(pod))
|
||||
#define SPA_POD_CONTENTS_SIZE(type,pod) (SPA_POD_SIZE(pod)-sizeof(type))
|
||||
|
||||
#define SPA_POD_CONTENTS(type,pod) SPA_MEMBER((pod),sizeof(type),void)
|
||||
#define SPA_POD_CONTENTS_CONST(type,pod) SPA_MEMBER((pod),sizeof(type),const void)
|
||||
#define SPA_POD_BODY(pod) SPA_MEMBER((pod),sizeof(SpaPOD),void)
|
||||
#define SPA_POD_BODY_CONST(pod) SPA_MEMBER((pod),sizeof(SpaPOD),const void)
|
||||
#define SPA_POD_BODY(pod) SPA_MEMBER((pod),sizeof(struct spa_pod),void)
|
||||
#define SPA_POD_BODY_CONST(pod) SPA_MEMBER((pod),sizeof(struct spa_pod),const void)
|
||||
|
||||
#define SPA_POD_VALUE(type,pod) (((type*)pod)->value)
|
||||
|
||||
#define SPA_POD_PROP_N_VALUES(prop) (((prop)->pod.size - sizeof (SpaPODPropBody)) / (prop)->body.value.size)
|
||||
#define SPA_POD_PROP_N_VALUES(prop) (((prop)->pod.size - sizeof (struct spa_pod_prop_body)) / (prop)->body.value.size)
|
||||
|
||||
static inline bool
|
||||
spa_pod_is_object_type (SpaPOD *pod, uint32_t type)
|
||||
spa_pod_is_object_type (struct spa_pod *pod, uint32_t type)
|
||||
{
|
||||
return (pod->type == SPA_POD_TYPE_OBJECT && ((SpaPODObject*)pod)->body.type == type);
|
||||
return (pod->type == SPA_POD_TYPE_OBJECT && ((struct spa_pod_object*)pod)->body.type == type);
|
||||
}
|
||||
|
||||
#define SPA_POD_ARRAY_BODY_FOREACH(body, _size, iter) \
|
||||
for ((iter) = SPA_MEMBER ((body), sizeof(SpaPODArrayBody), __typeof__(*(iter))); \
|
||||
for ((iter) = SPA_MEMBER ((body), sizeof(struct spa_pod_array_body), __typeof__(*(iter))); \
|
||||
(iter) < SPA_MEMBER ((body), (_size), __typeof__(*(iter))); \
|
||||
(iter) = SPA_MEMBER ((iter), (body)->child.size, __typeof__(*(iter))))
|
||||
|
||||
#define SPA_POD_FOREACH(pod, size, iter) \
|
||||
for ((iter) = (pod); \
|
||||
(iter) < SPA_MEMBER ((pod), (size), SpaPOD); \
|
||||
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), SpaPOD))
|
||||
(iter) < SPA_MEMBER ((pod), (size), struct spa_pod); \
|
||||
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), struct spa_pod))
|
||||
|
||||
#define SPA_POD_CONTENTS_FOREACH(pod, offset, iter) \
|
||||
SPA_POD_FOREACH(SPA_MEMBER ((pod), (offset), SpaPOD),SPA_POD_SIZE (pod),iter)
|
||||
SPA_POD_FOREACH(SPA_MEMBER ((pod), (offset), struct spa_pod),SPA_POD_SIZE (pod),iter)
|
||||
|
||||
#define SPA_POD_OBJECT_BODY_FOREACH(body, size, iter) \
|
||||
for ((iter) = SPA_MEMBER ((body), sizeof (SpaPODObjectBody), SpaPOD); \
|
||||
(iter) < SPA_MEMBER ((body), (size), SpaPOD); \
|
||||
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), SpaPOD))
|
||||
for ((iter) = SPA_MEMBER ((body), sizeof (struct spa_pod_object_body), struct spa_pod); \
|
||||
(iter) < SPA_MEMBER ((body), (size), struct spa_pod); \
|
||||
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), struct spa_pod))
|
||||
|
||||
#define SPA_POD_OBJECT_FOREACH(obj, iter) \
|
||||
SPA_POD_OBJECT_BODY_FOREACH(&obj->body, SPA_POD_BODY_SIZE(obj), iter)
|
||||
|
||||
#define SPA_POD_PROP_ALTERNATIVE_FOREACH(body, _size, iter) \
|
||||
for ((iter) = SPA_MEMBER ((body), (body)->value.size + sizeof (SpaPODPropBody), __typeof__(*iter)); \
|
||||
for ((iter) = SPA_MEMBER ((body), (body)->value.size + sizeof (struct spa_pod_prop_body), __typeof__(*iter)); \
|
||||
(iter) <= SPA_MEMBER ((body), (_size)-(body)->value.size, __typeof__(*iter)); \
|
||||
(iter) = SPA_MEMBER ((iter), (body)->value.size, __typeof__(*iter)))
|
||||
|
||||
static inline SpaPODProp *
|
||||
spa_pod_contents_find_prop (const SpaPOD *pod, uint32_t offset, uint32_t key)
|
||||
static inline struct spa_pod_prop *
|
||||
spa_pod_contents_find_prop (const struct spa_pod *pod, uint32_t offset, uint32_t key)
|
||||
{
|
||||
SpaPOD *res;
|
||||
struct spa_pod *res;
|
||||
SPA_POD_CONTENTS_FOREACH (pod, offset, res) {
|
||||
if (res->type == SPA_POD_TYPE_PROP && ((SpaPODProp*)res)->body.key == key)
|
||||
return (SpaPODProp *)res;
|
||||
if (res->type == SPA_POD_TYPE_PROP && ((struct spa_pod_prop*)res)->body.key == key)
|
||||
return (struct spa_pod_prop *)res;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline SpaPODProp *
|
||||
spa_pod_object_find_prop (const SpaPODObject *obj, uint32_t key)
|
||||
static inline struct spa_pod_prop *
|
||||
spa_pod_object_find_prop (const struct spa_pod_object *obj, uint32_t key)
|
||||
{
|
||||
return spa_pod_contents_find_prop (&obj->pod, sizeof (SpaPODObject), key);
|
||||
return spa_pod_contents_find_prop (&obj->pod, sizeof (struct spa_pod_object), key);
|
||||
}
|
||||
|
||||
#define SPA_POD_COLLECT(pod,type,args,error) \
|
||||
do { \
|
||||
if (type == SPA_POD_TYPE_POD) { \
|
||||
*(va_arg (args, SpaPOD **)) = pod; \
|
||||
*(va_arg (args, struct spa_pod **)) = pod; \
|
||||
} else if ((pod)->type == SPA_POD_TYPE_NONE) { \
|
||||
switch (type) { \
|
||||
case -SPA_POD_TYPE_ARRAY: \
|
||||
case -SPA_POD_TYPE_STRUCT: \
|
||||
case -SPA_POD_TYPE_OBJECT: \
|
||||
case -SPA_POD_TYPE_PROP: \
|
||||
*(va_arg (args, SpaPOD **)) = NULL; \
|
||||
*(va_arg (args, struct spa_pod **)) = NULL; \
|
||||
break; \
|
||||
default: \
|
||||
goto error; \
|
||||
|
|
@ -111,45 +111,47 @@ spa_pod_object_find_prop (const SpaPODObject *obj, uint32_t key)
|
|||
case SPA_POD_TYPE_BOOL: \
|
||||
case SPA_POD_TYPE_ID: \
|
||||
case SPA_POD_TYPE_INT: \
|
||||
*(va_arg (args, int32_t*)) = SPA_POD_VALUE(SpaPODInt, pod); \
|
||||
*(va_arg (args, int32_t*)) = SPA_POD_VALUE(struct spa_pod_int, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_LONG: \
|
||||
*(va_arg (args, int64_t*)) = SPA_POD_VALUE (SpaPODLong, pod); \
|
||||
*(va_arg (args, int64_t*)) = SPA_POD_VALUE (struct spa_pod_long, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_FLOAT: \
|
||||
*(va_arg (args, float*)) = SPA_POD_VALUE (SpaPODFloat, pod); \
|
||||
*(va_arg (args, float*)) = SPA_POD_VALUE (struct spa_pod_float, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_DOUBLE: \
|
||||
*(va_arg (args, double*)) = SPA_POD_VALUE (SpaPODDouble, pod); \
|
||||
*(va_arg (args, double*)) = SPA_POD_VALUE (struct spa_pod_double, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_STRING: \
|
||||
*(va_arg (args, char **)) = SPA_POD_CONTENTS (SpaPODString, pod); \
|
||||
*(va_arg (args, char **)) = SPA_POD_CONTENTS (struct spa_pod_string, pod); \
|
||||
break; \
|
||||
case -SPA_POD_TYPE_STRING: \
|
||||
{ \
|
||||
char *dest = va_arg (args, char *); \
|
||||
uint32_t maxlen = va_arg (args, uint32_t); \
|
||||
strncpy (dest, SPA_POD_CONTENTS (SpaPODString, pod), maxlen-1); \
|
||||
strncpy (dest, SPA_POD_CONTENTS (struct spa_pod_string, pod), maxlen-1); \
|
||||
break; \
|
||||
} \
|
||||
case SPA_POD_TYPE_BYTES: \
|
||||
*(va_arg (args, void **)) = SPA_POD_CONTENTS (SpaPODBytes, pod); \
|
||||
*(va_arg (args, void **)) = SPA_POD_CONTENTS (struct spa_pod_bytes, pod); \
|
||||
*(va_arg (args, uint32_t *)) = SPA_POD_BODY_SIZE (pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_POINTER: \
|
||||
{ \
|
||||
SpaPODPointerBody *b = SPA_POD_BODY (pod); \
|
||||
struct spa_pod_pointer_body *b = SPA_POD_BODY (pod); \
|
||||
*(va_arg (args, void **)) = b->value; \
|
||||
break; \
|
||||
} \
|
||||
case SPA_POD_TYPE_RECTANGLE: \
|
||||
*(va_arg (args, SpaRectangle *)) = SPA_POD_VALUE (SpaPODRectangle, pod); \
|
||||
*(va_arg (args, struct spa_rectangle *)) = \
|
||||
SPA_POD_VALUE (struct spa_pod_rectangle, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_FRACTION: \
|
||||
*(va_arg (args, SpaFraction *)) = SPA_POD_VALUE (SpaPODFraction, pod); \
|
||||
*(va_arg (args, struct spa_fraction *)) = \
|
||||
SPA_POD_VALUE (struct spa_pod_fraction, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_BITMASK: \
|
||||
*(va_arg (args, uint32_t **)) = SPA_POD_CONTENTS (SpaPOD, pod); \
|
||||
*(va_arg (args, uint32_t **)) = SPA_POD_CONTENTS (struct spa_pod, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_ARRAY: \
|
||||
case SPA_POD_TYPE_STRUCT: \
|
||||
|
|
@ -159,14 +161,14 @@ spa_pod_object_find_prop (const SpaPODObject *obj, uint32_t key)
|
|||
case -SPA_POD_TYPE_STRUCT: \
|
||||
case -SPA_POD_TYPE_OBJECT: \
|
||||
case -SPA_POD_TYPE_PROP: \
|
||||
*(va_arg (args, SpaPOD **)) = pod; \
|
||||
*(va_arg (args, struct spa_pod **)) = pod; \
|
||||
break; \
|
||||
default: \
|
||||
goto error; \
|
||||
} \
|
||||
} else \
|
||||
goto error; \
|
||||
} while (false); \
|
||||
} while (false);
|
||||
|
||||
#define SPA_POD_COLLECT_SKIP(type,args) \
|
||||
switch (type) { \
|
||||
|
|
@ -200,13 +202,13 @@ spa_pod_object_find_prop (const SpaPODObject *obj, uint32_t key)
|
|||
} \
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_contents_queryv (const SpaPOD *pod, uint32_t offset, uint32_t key, va_list args)
|
||||
spa_pod_contents_queryv (const struct spa_pod *pod, uint32_t offset, uint32_t key, va_list args)
|
||||
{
|
||||
uint32_t count = 0;
|
||||
|
||||
while (key) {
|
||||
uint32_t type;
|
||||
SpaPODProp *prop = spa_pod_contents_find_prop (pod, offset, key);
|
||||
struct spa_pod_prop *prop = spa_pod_contents_find_prop (pod, offset, key);
|
||||
|
||||
type = va_arg (args, uint32_t);
|
||||
|
||||
|
|
@ -224,7 +226,7 @@ next:
|
|||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_contents_query (const SpaPOD *pod, uint32_t offset, uint32_t key, ...)
|
||||
spa_pod_contents_query (const struct spa_pod *pod, uint32_t offset, uint32_t key, ...)
|
||||
{
|
||||
va_list args;
|
||||
uint32_t count;
|
||||
|
|
@ -237,7 +239,7 @@ spa_pod_contents_query (const SpaPOD *pod, uint32_t offset, uint32_t key, ...)
|
|||
}
|
||||
|
||||
#define spa_pod_object_query(object,key, ...) \
|
||||
spa_pod_contents_query (&object->pod, sizeof (SpaPODObject), key, __VA_ARGS__)
|
||||
spa_pod_contents_query (&(object)->pod, sizeof (struct spa_pod_object), key, __VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ extern "C" {
|
|||
#define SPA_TYPE_POD_STRUCT_BASE SPA_TYPE_POD__Struct ":"
|
||||
|
||||
/**
|
||||
* SpaPODType:
|
||||
* spa_pod_type:
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_pod_type {
|
||||
SPA_POD_TYPE_INVALID = 0,
|
||||
SPA_POD_TYPE_NONE = 1,
|
||||
SPA_POD_TYPE_BOOL,
|
||||
|
|
@ -60,88 +60,97 @@ typedef enum {
|
|||
SPA_POD_TYPE_OBJECT,
|
||||
SPA_POD_TYPE_PROP,
|
||||
SPA_POD_TYPE_POD,
|
||||
} SpaPODType;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct spa_pod {
|
||||
uint32_t size;
|
||||
uint32_t type; /* one of SpaPODType */
|
||||
} SpaPOD;
|
||||
uint32_t type; /* one of spa_pod_type */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
int32_t value;
|
||||
struct spa_pod_int {
|
||||
struct spa_pod pod;
|
||||
int32_t value;
|
||||
int32_t __padding;
|
||||
} SpaPODInt;
|
||||
};
|
||||
|
||||
typedef SpaPODInt SpaPODBool;
|
||||
typedef SpaPODInt SpaPODId;
|
||||
struct spa_pod_bool {
|
||||
struct spa_pod pod;
|
||||
int32_t value;
|
||||
int32_t __padding;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
int64_t value;
|
||||
} SpaPODLong;
|
||||
struct spa_pod_id {
|
||||
struct spa_pod pod;
|
||||
int32_t value;
|
||||
int32_t __padding;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
float value;
|
||||
} SpaPODFloat;
|
||||
struct spa_pod_long {
|
||||
struct spa_pod pod;
|
||||
int64_t value;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
double value;
|
||||
} SpaPODDouble;
|
||||
struct spa_pod_float {
|
||||
struct spa_pod pod;
|
||||
float value;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
struct spa_pod_double {
|
||||
struct spa_pod pod;
|
||||
double value;
|
||||
};
|
||||
|
||||
struct spa_pod_string {
|
||||
struct spa_pod pod;
|
||||
/* value here */
|
||||
} SpaPODString;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
struct spa_pod_bytes {
|
||||
struct spa_pod pod;
|
||||
/* value here */
|
||||
} SpaPODBytes;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct spa_pod_pointer_body {
|
||||
uint32_t type;
|
||||
void *value;
|
||||
} SpaPODPointerBody;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
SpaPODPointerBody body;
|
||||
} SpaPODPointer;
|
||||
struct spa_pod_pointer {
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_pointer_body body;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
SpaRectangle value;
|
||||
} SpaPODRectangle;
|
||||
struct spa_pod_rectangle {
|
||||
struct spa_pod pod;
|
||||
struct spa_rectangle value;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
SpaFraction value;
|
||||
} SpaPODFraction;
|
||||
struct spa_pod_fraction {
|
||||
struct spa_pod pod;
|
||||
struct spa_fraction value;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
struct spa_pod_bitmap {
|
||||
struct spa_pod pod;
|
||||
/* array of uint8_t follows with the bitmap */
|
||||
} SpaPODBitmap;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD child;
|
||||
struct spa_pod_array_body {
|
||||
struct spa_pod child;
|
||||
/* array with elements of child.size follows */
|
||||
} SpaPODArrayBody;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
SpaPODArrayBody body;
|
||||
} SpaPODArray;
|
||||
struct spa_pod_array {
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_array_body body;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
/* one or more SpaPOD follow */
|
||||
} SpaPODStruct;
|
||||
struct spa_pod_struct {
|
||||
struct spa_pod pod;
|
||||
/* one or more spa_pod follow */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct spa_pod_prop_body {
|
||||
uint32_t key;
|
||||
#define SPA_POD_PROP_RANGE_NONE 0
|
||||
#define SPA_POD_PROP_RANGE_MIN_MAX 1
|
||||
|
|
@ -154,26 +163,26 @@ typedef struct {
|
|||
#define SPA_POD_PROP_FLAG_READONLY (1 << 6)
|
||||
#define SPA_POD_PROP_FLAG_DEPRECATED (1 << 7)
|
||||
uint32_t flags;
|
||||
SpaPOD value;
|
||||
struct spa_pod value;
|
||||
/* array with elements of value.size follows,
|
||||
* first element is value/default, rest are alternatives */
|
||||
} SpaPODPropBody;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
SpaPODPropBody body;
|
||||
} SpaPODProp;
|
||||
struct spa_pod_prop {
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_prop_body body;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct spa_pod_object_body {
|
||||
uint32_t id;
|
||||
uint32_t type;
|
||||
/* contents follow, series of SpaPODProp */
|
||||
} SpaPODObjectBody;
|
||||
/* contents follow, series of spa_pod_prop */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SpaPOD pod;
|
||||
SpaPODObjectBody body;
|
||||
} SpaPODObject;
|
||||
struct spa_pod_object {
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_object_body body;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ extern "C" {
|
|||
#include <spa/pod.h>
|
||||
#include <spa/pod-builder.h>
|
||||
|
||||
typedef SpaPODObject SpaProps;
|
||||
struct spa_props {
|
||||
struct spa_pod_object object;
|
||||
};
|
||||
|
||||
#define SPA_TYPE__Props SPA_TYPE_POD_OBJECT_BASE "Props"
|
||||
#define SPA_TYPE_PROPS_BASE SPA_TYPE__Props ":"
|
||||
|
|
@ -49,8 +51,8 @@ typedef SpaPODObject SpaProps;
|
|||
#define SPA_TYPE_PROPS__patternType SPA_TYPE_PROPS_BASE "patternType"
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push_props (SpaPODBuilder *builder,
|
||||
SpaPODFrame *frame,
|
||||
spa_pod_builder_push_props (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame,
|
||||
uint32_t props_type)
|
||||
{
|
||||
return spa_pod_builder_push_object (builder, frame, 0, props_type);
|
||||
|
|
@ -60,13 +62,13 @@ spa_pod_builder_push_props (SpaPODBuilder *builder,
|
|||
spa_pod_builder_object(b, f, 0, props_type,__VA_ARGS__)
|
||||
|
||||
static inline uint32_t
|
||||
spa_props_query (const SpaProps *props, uint32_t key, ...)
|
||||
spa_props_query (const struct spa_props *props, uint32_t key, ...)
|
||||
{
|
||||
uint32_t count;
|
||||
va_list args;
|
||||
|
||||
va_start (args, key);
|
||||
count = spa_pod_contents_queryv (&props->pod, sizeof (SpaProps), key, args);
|
||||
count = spa_pod_contents_queryv (&props->object.pod, sizeof (struct spa_props), key, args);
|
||||
va_end (args);
|
||||
|
||||
return count;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaRingbuffer SpaRingbuffer;
|
||||
|
||||
struct spa_ringbuffer;
|
||||
#define SPA_TYPE__RingBuffer SPA_TYPE_INTERFACE_BASE "RingBuffer"
|
||||
#define SPA_TYPE_RINGBUFFER_BASE SPA_TYPE__RingBuffer ":"
|
||||
|
||||
|
|
@ -34,13 +33,13 @@ typedef struct _SpaRingbuffer SpaRingbuffer;
|
|||
#include <spa/defs.h>
|
||||
|
||||
/**
|
||||
* SpaRingbuffer:
|
||||
* spa_ringbuffer:
|
||||
* @readindex: the current read index
|
||||
* @writeindex: the current write index
|
||||
* @size: the size of the ringbuffer must be power of 2
|
||||
* @mask: mask as @size - 1
|
||||
*/
|
||||
struct _SpaRingbuffer {
|
||||
struct spa_ringbuffer {
|
||||
uint32_t readindex;
|
||||
uint32_t writeindex;
|
||||
uint32_t size;
|
||||
|
|
@ -49,17 +48,17 @@ struct _SpaRingbuffer {
|
|||
|
||||
/**
|
||||
* spa_ringbuffer_init:
|
||||
* @rbuf: a #SpaRingbuffer
|
||||
* @rbuf: a #struct spa_ringbuffer
|
||||
* @data: pointer to an array
|
||||
* @size: the number of elements in @data
|
||||
*
|
||||
* Initialize a #SpaRingbuffer with @data and @size.
|
||||
* Initialize a #struct spa_ringbuffer with @data and @size.
|
||||
* Size must be a power of 2.
|
||||
*
|
||||
* Returns: %SPA_RESULT_OK, unless size is not a power of 2.
|
||||
*/
|
||||
static inline SpaResult
|
||||
spa_ringbuffer_init (SpaRingbuffer *rbuf,
|
||||
static inline int
|
||||
spa_ringbuffer_init (struct spa_ringbuffer *rbuf,
|
||||
uint32_t size)
|
||||
{
|
||||
if (SPA_UNLIKELY ((size & (size - 1)) != 0))
|
||||
|
|
@ -75,12 +74,12 @@ spa_ringbuffer_init (SpaRingbuffer *rbuf,
|
|||
|
||||
/**
|
||||
* spa_ringbuffer_clear:
|
||||
* @rbuf: a #SpaRingbuffer
|
||||
* @rbuf: a #struct spa_ringbuffer
|
||||
*
|
||||
* Clear @rbuf
|
||||
*/
|
||||
static inline void
|
||||
spa_ringbuffer_clear (SpaRingbuffer *rbuf)
|
||||
spa_ringbuffer_clear (struct spa_ringbuffer *rbuf)
|
||||
{
|
||||
rbuf->readindex = 0;
|
||||
rbuf->writeindex = 0;
|
||||
|
|
@ -88,7 +87,7 @@ spa_ringbuffer_clear (SpaRingbuffer *rbuf)
|
|||
|
||||
/**
|
||||
* spa_ringbuffer_get_read_index:
|
||||
* @rbuf: a #SpaRingbuffer
|
||||
* @rbuf: a #struct spa_ringbuffer
|
||||
* @index: the value of readindex, should be masked to get the
|
||||
* offset in the ringbuffer memory
|
||||
*
|
||||
|
|
@ -97,8 +96,8 @@ spa_ringbuffer_clear (SpaRingbuffer *rbuf)
|
|||
* was an overrun.
|
||||
*/
|
||||
static inline int32_t
|
||||
spa_ringbuffer_get_read_index (SpaRingbuffer *rbuf,
|
||||
uint32_t *index)
|
||||
spa_ringbuffer_get_read_index (struct spa_ringbuffer *rbuf,
|
||||
uint32_t *index)
|
||||
{
|
||||
int32_t avail;
|
||||
|
||||
|
|
@ -110,7 +109,7 @@ spa_ringbuffer_get_read_index (SpaRingbuffer *rbuf,
|
|||
|
||||
/**
|
||||
* spa_ringbuffer_read_data:
|
||||
* @rbuf: a #SpaRingbuffer
|
||||
* @rbuf: a #struct spa_ringbuffer
|
||||
* @buffer: memory to read from
|
||||
* @offset: offset in @buffer to read from
|
||||
* @data: destination memory
|
||||
|
|
@ -120,11 +119,11 @@ spa_ringbuffer_get_read_index (SpaRingbuffer *rbuf,
|
|||
* with the size of @rbuf and len should be smaller than the size.
|
||||
*/
|
||||
static inline void
|
||||
spa_ringbuffer_read_data (SpaRingbuffer *rbuf,
|
||||
void *buffer,
|
||||
uint32_t offset,
|
||||
void *data,
|
||||
uint32_t len)
|
||||
spa_ringbuffer_read_data (struct spa_ringbuffer *rbuf,
|
||||
void *buffer,
|
||||
uint32_t offset,
|
||||
void *data,
|
||||
uint32_t len)
|
||||
{
|
||||
uint32_t first = SPA_MIN (len, rbuf->size - offset);
|
||||
memcpy (data, buffer + offset, first);
|
||||
|
|
@ -135,21 +134,21 @@ spa_ringbuffer_read_data (SpaRingbuffer *rbuf,
|
|||
|
||||
/**
|
||||
* spa_ringbuffer_read_update:
|
||||
* @rbuf: a #SpaRingbuffer
|
||||
* @rbuf: a #struct spa_ringbuffer
|
||||
* @index: new index
|
||||
*
|
||||
* Update the read pointer to @index
|
||||
*/
|
||||
static inline void
|
||||
spa_ringbuffer_read_update (SpaRingbuffer *rbuf,
|
||||
int32_t index)
|
||||
spa_ringbuffer_read_update (struct spa_ringbuffer *rbuf,
|
||||
int32_t index)
|
||||
{
|
||||
__atomic_store_n (&rbuf->readindex, index, __ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
/**
|
||||
* spa_ringbuffer_get_write_index:
|
||||
* @rbuf: a #SpaRingbuffer
|
||||
* @rbuf: a #struct spa_ringbuffer
|
||||
* @index: the value of writeindex, should be masked to get the
|
||||
* offset in the ringbuffer memory
|
||||
*
|
||||
|
|
@ -159,8 +158,8 @@ spa_ringbuffer_read_update (SpaRingbuffer *rbuf,
|
|||
* the number of bytes available for writing.
|
||||
*/
|
||||
static inline int32_t
|
||||
spa_ringbuffer_get_write_index (SpaRingbuffer *rbuf,
|
||||
uint32_t *index)
|
||||
spa_ringbuffer_get_write_index (struct spa_ringbuffer *rbuf,
|
||||
uint32_t *index)
|
||||
{
|
||||
int32_t filled;
|
||||
|
||||
|
|
@ -171,11 +170,11 @@ spa_ringbuffer_get_write_index (SpaRingbuffer *rbuf,
|
|||
}
|
||||
|
||||
static inline void
|
||||
spa_ringbuffer_write_data (SpaRingbuffer *rbuf,
|
||||
void *buffer,
|
||||
uint32_t offset,
|
||||
void *data,
|
||||
uint32_t len)
|
||||
spa_ringbuffer_write_data (struct spa_ringbuffer *rbuf,
|
||||
void *buffer,
|
||||
uint32_t offset,
|
||||
void *data,
|
||||
uint32_t len)
|
||||
{
|
||||
uint32_t first = SPA_MIN (len, rbuf->size - offset);
|
||||
memcpy (buffer + offset, data, first);
|
||||
|
|
@ -186,15 +185,15 @@ spa_ringbuffer_write_data (SpaRingbuffer *rbuf,
|
|||
|
||||
/**
|
||||
* spa_ringbuffer_write_update:
|
||||
* @rbuf: a #SpaRingbuffer
|
||||
* @rbuf: a #struct spa_ringbuffer
|
||||
* @index: new index
|
||||
*
|
||||
* Update the write pointer to @index
|
||||
*
|
||||
*/
|
||||
static inline void
|
||||
spa_ringbuffer_write_update (SpaRingbuffer *rbuf,
|
||||
int32_t index)
|
||||
spa_ringbuffer_write_update (struct spa_ringbuffer *rbuf,
|
||||
int32_t index)
|
||||
{
|
||||
__atomic_store_n (&rbuf->writeindex, index, __ATOMIC_RELEASE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaTypeMap SpaTypeMap;
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/plugin.h>
|
||||
#include <spa/type.h>
|
||||
|
|
@ -33,28 +31,28 @@ typedef struct _SpaTypeMap SpaTypeMap;
|
|||
#define SPA_TYPE__TypeMap SPA_TYPE_INTERFACE_BASE "TypeMap"
|
||||
|
||||
/**
|
||||
* SpaTypeMap:
|
||||
* spa_type_map:
|
||||
*
|
||||
* Maps between string types and their type id
|
||||
*/
|
||||
struct _SpaTypeMap {
|
||||
struct spa_type_map {
|
||||
/* the total size of this structure. This can be used to expand this
|
||||
* structure in the future */
|
||||
const size_t size;
|
||||
/**
|
||||
* SpaTypeMap::info
|
||||
* spa_type_map::info
|
||||
*
|
||||
* Extra information about the type map
|
||||
*/
|
||||
const SpaDict *info;
|
||||
const struct spa_dict *info;
|
||||
|
||||
SpaType (*get_id) (SpaTypeMap *map,
|
||||
const char *type);
|
||||
uint32_t (*get_id) (struct spa_type_map *map,
|
||||
const char *type);
|
||||
|
||||
const char * (*get_type) (const SpaTypeMap *map,
|
||||
SpaType id);
|
||||
const char * (*get_type) (const struct spa_type_map *map,
|
||||
uint32_t id);
|
||||
|
||||
size_t (*get_size) (const SpaTypeMap *map);
|
||||
size_t (*get_size) (const struct spa_type_map *map);
|
||||
};
|
||||
|
||||
#define spa_type_map_get_id(n,...) (n)->get_id((n),__VA_ARGS__)
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ extern "C" {
|
|||
|
||||
#include <spa/defs.h>
|
||||
|
||||
typedef uint32_t SpaType;
|
||||
|
||||
#define SPA_TYPE_BASE "Spa:"
|
||||
|
||||
#define SPA_TYPE__Enum SPA_TYPE_BASE "Enum"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/**
|
||||
* SpaVideoChromaSite:
|
||||
* spa_video_chroma_site:
|
||||
* @SPA_VIDEO_CHROMA_SITE_UNKNOWN: unknown cositing
|
||||
* @SPA_VIDEO_CHROMA_SITE_NONE: no cositing
|
||||
* @SPA_VIDEO_CHROMA_SITE_H_COSITED: chroma is horizontally cosited
|
||||
|
|
@ -38,7 +38,7 @@ extern "C" {
|
|||
*
|
||||
* Various Chroma sitings.
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_video_chroma_site {
|
||||
SPA_VIDEO_CHROMA_SITE_UNKNOWN = 0,
|
||||
SPA_VIDEO_CHROMA_SITE_NONE = (1 << 0),
|
||||
SPA_VIDEO_CHROMA_SITE_H_COSITED = (1 << 1),
|
||||
|
|
@ -49,7 +49,7 @@ typedef enum {
|
|||
SPA_VIDEO_CHROMA_SITE_JPEG = (SPA_VIDEO_CHROMA_SITE_NONE),
|
||||
SPA_VIDEO_CHROMA_SITE_MPEG2 = (SPA_VIDEO_CHROMA_SITE_H_COSITED),
|
||||
SPA_VIDEO_CHROMA_SITE_DV = (SPA_VIDEO_CHROMA_SITE_COSITED | SPA_VIDEO_CHROMA_SITE_ALT_LINE),
|
||||
} SpaVideoChromaSite;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/**
|
||||
* SpaVideoColorRange:
|
||||
* spa_video_color_range:
|
||||
* @SPA_VIDEO_COLOR_RANGE_UNKNOWN: unknown range
|
||||
* @SPA_VIDEO_COLOR_RANGE_0_255: [0..255] for 8 bit components
|
||||
* @SPA_VIDEO_COLOR_RANGE_16_235: [16..235] for 8 bit components. Chroma has
|
||||
|
|
@ -34,14 +34,14 @@ extern "C" {
|
|||
* Possible color range values. These constants are defined for 8 bit color
|
||||
* values and can be scaled for other bit depths.
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_video_color_range {
|
||||
SPA_VIDEO_COLOR_RANGE_UNKNOWN = 0,
|
||||
SPA_VIDEO_COLOR_RANGE_0_255,
|
||||
SPA_VIDEO_COLOR_RANGE_16_235
|
||||
} SpaVideoColorRange;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaVideoColorMatrix:
|
||||
* spa_video_color_matrix:
|
||||
* @SPA_VIDEO_COLOR_MATRIX_UNKNOWN: unknown matrix
|
||||
* @SPA_VIDEO_COLOR_MATRIX_RGB: identity matrix
|
||||
* @SPA_VIDEO_COLOR_MATRIX_FCC: FCC color matrix
|
||||
|
|
@ -53,7 +53,7 @@ typedef enum {
|
|||
* The color matrix is used to convert between Y'PbPr and
|
||||
* non-linear RGB (R'G'B')
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_video_color_matrix {
|
||||
SPA_VIDEO_COLOR_MATRIX_UNKNOWN = 0,
|
||||
SPA_VIDEO_COLOR_MATRIX_RGB,
|
||||
SPA_VIDEO_COLOR_MATRIX_FCC,
|
||||
|
|
@ -61,10 +61,10 @@ typedef enum {
|
|||
SPA_VIDEO_COLOR_MATRIX_BT601,
|
||||
SPA_VIDEO_COLOR_MATRIX_SMPTE240M,
|
||||
SPA_VIDEO_COLOR_MATRIX_BT2020
|
||||
} SpaVideoColorMatrix;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaVideoTransferFunction:
|
||||
* spa_video_transfer_function:
|
||||
* @SPA_VIDEO_TRANSFER_UNKNOWN: unknown transfer function
|
||||
* @SPA_VIDEO_TRANSFER_GAMMA10: linear RGB, gamma 1.0 curve
|
||||
* @SPA_VIDEO_TRANSFER_GAMMA18: Gamma 1.8 curve
|
||||
|
|
@ -89,7 +89,7 @@ typedef enum {
|
|||
* The video transfer function defines the formula for converting between
|
||||
* non-linear RGB (R'G'B') and linear RGB
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_video_transfer_function {
|
||||
SPA_VIDEO_TRANSFER_UNKNOWN = 0,
|
||||
SPA_VIDEO_TRANSFER_GAMMA10,
|
||||
SPA_VIDEO_TRANSFER_GAMMA18,
|
||||
|
|
@ -103,10 +103,10 @@ typedef enum {
|
|||
SPA_VIDEO_TRANSFER_LOG316,
|
||||
SPA_VIDEO_TRANSFER_BT2020_12,
|
||||
SPA_VIDEO_TRANSFER_ADOBERGB
|
||||
} SpaVideoTransferFunction;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaVideoColorPrimaries:
|
||||
* spa_video_color_primaries:
|
||||
* @SPA_VIDEO_COLOR_PRIMARIES_UNKNOWN: unknown color primaries
|
||||
* @SPA_VIDEO_COLOR_PRIMARIES_BT709: BT709 primaries
|
||||
* @SPA_VIDEO_COLOR_PRIMARIES_BT470M: BT470M primaries
|
||||
|
|
@ -120,7 +120,7 @@ typedef enum {
|
|||
* The color primaries define the how to transform linear RGB values to and from
|
||||
* the CIE XYZ colorspace.
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_video_color_primaries {
|
||||
SPA_VIDEO_COLOR_PRIMARIES_UNKNOWN = 0,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_BT709,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_BT470M,
|
||||
|
|
@ -130,10 +130,10 @@ typedef enum {
|
|||
SPA_VIDEO_COLOR_PRIMARIES_FILM,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_BT2020,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_ADOBERGB
|
||||
} SpaVideoColorPrimaries;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaVideoColorimetry:
|
||||
* spa_video_colorimetry:
|
||||
* @range: the color range. This is the valid range for the samples.
|
||||
* It is used to convert the samples to Y'PbPr values.
|
||||
* @matrix: the color matrix. Used to convert between Y'PbPr and
|
||||
|
|
@ -143,12 +143,12 @@ typedef enum {
|
|||
*
|
||||
* Structure describing the color info.
|
||||
*/
|
||||
typedef struct {
|
||||
SpaVideoColorRange range;
|
||||
SpaVideoColorMatrix matrix;
|
||||
SpaVideoTransferFunction transfer;
|
||||
SpaVideoColorPrimaries primaries;
|
||||
} SpaVideoColorimetry;
|
||||
struct spa_video_colorimetry {
|
||||
enum spa_video_color_range range;
|
||||
enum spa_video_color_matrix matrix;
|
||||
enum spa_video_transfer_function transfer;
|
||||
enum spa_video_color_primaries primaries;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -24,37 +24,37 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaVideoInfoH264 SpaVideoInfoH264;
|
||||
typedef struct _SpaVideoInfoMJPG SpaVideoInfoMJPG;
|
||||
struct spa_video_info_h264;
|
||||
struct spa_video_info_mjpg;
|
||||
|
||||
#include <spa/format.h>
|
||||
#include <spa/video/format.h>
|
||||
|
||||
typedef enum {
|
||||
enum spa_h264_stream_format {
|
||||
SPA_H264_STREAM_FORMAT_UNKNOWN = 0,
|
||||
SPA_H264_STREAM_FORMAT_AVC,
|
||||
SPA_H264_STREAM_FORMAT_AVC3,
|
||||
SPA_H264_STREAM_FORMAT_BYTESTREAM
|
||||
} SpaH264StreamFormat;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
enum spa_h264_alignment {
|
||||
SPA_H264_ALIGNMENT_UNKNOWN = 0,
|
||||
SPA_H264_ALIGNMENT_AU,
|
||||
SPA_H264_ALIGNMENT_NAL
|
||||
} SpaH264Alignment;
|
||||
|
||||
struct _SpaVideoInfoH264 {
|
||||
SpaRectangle size;
|
||||
SpaFraction framerate;
|
||||
SpaFraction max_framerate;
|
||||
SpaH264StreamFormat stream_format;
|
||||
SpaH264Alignment alignment;
|
||||
};
|
||||
|
||||
struct _SpaVideoInfoMJPG {
|
||||
SpaRectangle size;
|
||||
SpaFraction framerate;
|
||||
SpaFraction max_framerate;
|
||||
struct spa_video_info_h264 {
|
||||
struct spa_rectangle size;
|
||||
struct spa_fraction framerate;
|
||||
struct spa_fraction max_framerate;
|
||||
enum spa_h264_stream_format stream_format;
|
||||
enum spa_h264_alignment alignment;
|
||||
};
|
||||
|
||||
struct spa_video_info_mjpg {
|
||||
struct spa_rectangle size;
|
||||
struct spa_fraction framerate;
|
||||
struct spa_fraction max_framerate;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ extern "C" {
|
|||
#include <spa/video/format.h>
|
||||
#include <spa/video/raw-utils.h>
|
||||
|
||||
typedef struct {
|
||||
struct spa_type_format_video {
|
||||
uint32_t format;
|
||||
uint32_t size;
|
||||
uint32_t framerate;
|
||||
|
|
@ -47,10 +47,10 @@ typedef struct {
|
|||
uint32_t level;
|
||||
uint32_t stream_format;
|
||||
uint32_t alignment;
|
||||
} SpaTypeFormatVideo;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_format_video_map (SpaTypeMap *map, SpaTypeFormatVideo *type)
|
||||
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);
|
||||
|
|
@ -75,9 +75,9 @@ spa_type_format_video_map (SpaTypeMap *map, SpaTypeFormatVideo *type)
|
|||
}
|
||||
|
||||
static inline bool
|
||||
spa_format_video_raw_parse (const SpaFormat *format,
|
||||
SpaVideoInfoRaw *info,
|
||||
SpaTypeFormatVideo *type)
|
||||
spa_format_video_raw_parse (const struct spa_format *format,
|
||||
struct spa_video_info_raw *info,
|
||||
struct spa_type_format_video *type)
|
||||
{
|
||||
spa_format_query (format,
|
||||
type->format, SPA_POD_TYPE_ID, &info->format,
|
||||
|
|
@ -99,9 +99,9 @@ spa_format_video_raw_parse (const SpaFormat *format,
|
|||
}
|
||||
|
||||
static inline bool
|
||||
spa_format_video_h264_parse (const SpaFormat *format,
|
||||
SpaVideoInfoH264 *info,
|
||||
SpaTypeFormatVideo *type)
|
||||
spa_format_video_h264_parse (const struct spa_format *format,
|
||||
struct spa_video_info_h264 *info,
|
||||
struct spa_type_format_video *type)
|
||||
{
|
||||
spa_format_query (format,
|
||||
type->size, SPA_POD_TYPE_RECTANGLE, &info->size,
|
||||
|
|
@ -114,9 +114,9 @@ spa_format_video_h264_parse (const SpaFormat *format,
|
|||
}
|
||||
|
||||
static inline bool
|
||||
spa_format_video_mjpg_parse (const SpaFormat *format,
|
||||
SpaVideoInfoMJPG *info,
|
||||
SpaTypeFormatVideo *type)
|
||||
spa_format_video_mjpg_parse (const struct spa_format *format,
|
||||
struct spa_video_info_mjpg *info,
|
||||
struct spa_type_format_video *type)
|
||||
{
|
||||
spa_format_query (format,
|
||||
type->size, SPA_POD_TYPE_RECTANGLE, &info->size,
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ extern "C" {
|
|||
#include <spa/video/raw.h>
|
||||
#include <spa/video/encoded.h>
|
||||
|
||||
typedef struct _SpaVideoInfo SpaVideoInfo;
|
||||
|
||||
#define SPA_TYPE_FORMAT__Video SPA_TYPE_FORMAT_BASE "Video"
|
||||
#define SPA_TYPE_FORMAT_VIDEO_BASE SPA_TYPE_FORMAT__Video ":"
|
||||
|
||||
|
|
@ -52,13 +50,13 @@ typedef struct _SpaVideoInfo SpaVideoInfo;
|
|||
#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"
|
||||
|
||||
struct _SpaVideoInfo {
|
||||
struct spa_video_info {
|
||||
uint32_t media_type;
|
||||
uint32_t media_subtype;
|
||||
union {
|
||||
SpaVideoInfoRaw raw;
|
||||
SpaVideoInfoH264 h264;
|
||||
SpaVideoInfoMJPG mjpg;
|
||||
struct spa_video_info_raw raw;
|
||||
struct spa_video_info_h264 h264;
|
||||
struct spa_video_info_mjpg mjpg;
|
||||
} info;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/**
|
||||
* SpaVideoMultiviewMode:
|
||||
* spa_video_multiview_mode:
|
||||
* @SPA_VIDEO_MULTIVIEW_MODE_NONE: A special value indicating
|
||||
* no multiview information. Used in SpaVideoInfo and other places to
|
||||
* no multiview information. Used in spa_video_info and other places to
|
||||
* indicate that no specific multiview handling has been requested or
|
||||
* provided. This value is never carried on caps.
|
||||
* @SPA_VIDEO_MULTIVIEW_MODE_MONO: All frames are monoscopic.
|
||||
|
|
@ -53,18 +53,17 @@ extern "C" {
|
|||
* @SPA_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME: Multiple
|
||||
* independent views are provided in separate frames in sequence.
|
||||
* This method only applies to raw video buffers at the moment.
|
||||
* Specific view identification is via the #SpaVideoMultiviewMeta
|
||||
* and #SpaVideoMeta(s) on raw video buffers.
|
||||
* Specific view identification is via the #spa_video_multiview_meta
|
||||
* on raw video buffers.
|
||||
* @SPA_VIDEO_MULTIVIEW_MODE_SEPARATED: Multiple views are
|
||||
* provided as separate #SpaMemory framebuffers attached to each
|
||||
* #SpaBuffer, described by the #SpaVideoMultiviewMeta
|
||||
* and #SpaVideoMeta(s)
|
||||
* provided as separate #spa_data framebuffers attached to each
|
||||
* #spa_buffer, described by the #spa_video_multiview_meta
|
||||
*
|
||||
* All possible stereoscopic 3D and multiview representations.
|
||||
* In conjunction with #SpaVideoMultiviewFlags, describes how
|
||||
* In conjunction with #soa_video_multiview_flags, describes how
|
||||
* multiview content is being transported in the stream.
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_video_multiview_mode {
|
||||
SPA_VIDEO_MULTIVIEW_MODE_NONE = -1,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_MONO = 0,
|
||||
/* Single view modes */
|
||||
|
|
@ -84,10 +83,10 @@ typedef enum {
|
|||
SPA_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_SEPARATED
|
||||
/* future expansion for annotated modes */
|
||||
} SpaVideoMultiviewMode;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaVideoMultiviewFlags:
|
||||
* spa_video_multiview_flags:
|
||||
* @SPA_VIDEO_MULTIVIEW_FLAGS_NONE: No flags
|
||||
* @SPA_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST: For stereo streams, the
|
||||
* normal arrangement of left and right views is reversed.
|
||||
|
|
@ -113,11 +112,11 @@ typedef enum {
|
|||
* absence or presence of the @SPA_VIDEO_BUFFER_FLAG_MULTIPLE_VIEW
|
||||
* buffer flag.
|
||||
*
|
||||
* SpaVideoMultiviewFlags are used to indicate extra properties of a
|
||||
* spa_video_multiview_flags are used to indicate extra properties of a
|
||||
* stereo/multiview stream beyond the frame layout and buffer mapping
|
||||
* that is conveyed in the #SpaMultiviewMode.
|
||||
* that is conveyed in the #spa_video_multiview_mode.
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_video_multiview_flags {
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_NONE = 0,
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST = (1 << 0),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED = (1 << 1),
|
||||
|
|
@ -126,7 +125,7 @@ typedef enum {
|
|||
SPA_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED = (1 << 4),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT = (1 << 14),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO = (1 << 15)
|
||||
} SpaVideoMultiviewFlags;
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -24,13 +24,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaVideoInfoRaw SpaVideoInfoRaw;
|
||||
|
||||
#include <spa/type-map.h>
|
||||
#include <spa/video/raw.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct spa_type_video_format {
|
||||
uint32_t UNKNOWN;
|
||||
uint32_t ENCODED;
|
||||
uint32_t I420;
|
||||
|
|
@ -109,10 +106,10 @@ typedef struct
|
|||
uint32_t I422_12LE;
|
||||
uint32_t Y444_12BE;
|
||||
uint32_t Y444_12LE;
|
||||
} SpaTypeVideoFormat;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_video_format_map (SpaTypeMap *map, SpaTypeVideoFormat *type)
|
||||
spa_type_video_format_map (struct spa_type_map *map, struct spa_type_video_format *type)
|
||||
{
|
||||
if (type->ENCODED == 0) {
|
||||
type->UNKNOWN = 0;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaVideoInfoRaw SpaVideoInfoRaw;
|
||||
|
||||
#include <spa/props.h>
|
||||
#include <spa/video/chroma.h>
|
||||
#include <spa/video/color.h>
|
||||
|
|
@ -116,7 +114,7 @@ typedef struct _SpaVideoInfoRaw SpaVideoInfoRaw;
|
|||
#define SPA_TYPE_VIDEO_FORMAT__Y444_12LE SPA_TYPE_VIDEO_FORMAT_BASE "Y444_12LE"
|
||||
|
||||
/**
|
||||
* SpaVideoFlags:
|
||||
* spa_video_flags:
|
||||
* @SPA_VIDEO_FLAG_NONE: no flags
|
||||
* @SPA_VIDEO_FLAG_VARIABLE_FPS: a variable fps is selected, fps_n and fps_d
|
||||
* denote the maximum fps of the video
|
||||
|
|
@ -125,14 +123,14 @@ typedef struct _SpaVideoInfoRaw SpaVideoInfoRaw;
|
|||
*
|
||||
* Extra video flags
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_video_flags {
|
||||
SPA_VIDEO_FLAG_NONE = 0,
|
||||
SPA_VIDEO_FLAG_VARIABLE_FPS = (1 << 0),
|
||||
SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1)
|
||||
} SpaVideoFlags;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaVideoInterlaceMode:
|
||||
* spa_video_interlace_mode:
|
||||
* @SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE: all frames are progressive
|
||||
* @SPA_VIDEO_INTERLACE_MODE_INTERLEAVED: 2 fields are interleaved in one video
|
||||
* frame. Extra buffer flags describe the field order.
|
||||
|
|
@ -143,21 +141,21 @@ typedef enum {
|
|||
* 'views' property > 1) the fields of view N can be found at frame ID
|
||||
* (N * 2) and (N * 2) + 1.
|
||||
* Each field has only half the amount of lines as noted in the
|
||||
* height property. This mode requires multiple SpaVideoMeta metadata
|
||||
* height property. This mode requires multiple spa_data
|
||||
* to describe the fields.
|
||||
*
|
||||
* The possible values of the #SpaVideoInterlaceMode describing the interlace
|
||||
* The possible values of the #spa_video_interlace_mode describing the interlace
|
||||
* mode of the stream.
|
||||
*/
|
||||
typedef enum {
|
||||
enum spa_video_interlace_mode {
|
||||
SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE = 0,
|
||||
SPA_VIDEO_INTERLACE_MODE_INTERLEAVED,
|
||||
SPA_VIDEO_INTERLACE_MODE_MIXED,
|
||||
SPA_VIDEO_INTERLACE_MODE_FIELDS
|
||||
} SpaVideoInterlaceMode;
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaVideoInfoRaw:
|
||||
* spa_video_info_raw:
|
||||
* @format: the format
|
||||
* @size: the frame size of the video
|
||||
* @framerate: the framerate of the video 0/1 means variable rate
|
||||
|
|
@ -176,21 +174,21 @@ typedef enum {
|
|||
* @transfer_function: the transfer function. used to convert between R'G'B' and RGB
|
||||
* @color_primaries: color primaries. used to convert between R'G'B' and CIE XYZ
|
||||
*/
|
||||
struct _SpaVideoInfoRaw {
|
||||
uint32_t format;
|
||||
SpaRectangle size;
|
||||
SpaFraction framerate;
|
||||
SpaFraction max_framerate;
|
||||
uint32_t views;
|
||||
SpaVideoInterlaceMode interlace_mode;
|
||||
SpaFraction pixel_aspect_ratio;
|
||||
SpaVideoMultiviewMode multiview_mode;
|
||||
SpaVideoMultiviewFlags multiview_flags;
|
||||
SpaVideoChromaSite chroma_site;
|
||||
SpaVideoColorRange color_range;
|
||||
SpaVideoColorMatrix color_matrix;
|
||||
SpaVideoTransferFunction transfer_function;
|
||||
SpaVideoColorPrimaries color_primaries;
|
||||
struct spa_video_info_raw {
|
||||
uint32_t format;
|
||||
struct spa_rectangle size;
|
||||
struct spa_fraction framerate;
|
||||
struct spa_fraction max_framerate;
|
||||
uint32_t views;
|
||||
enum spa_video_interlace_mode interlace_mode;
|
||||
struct spa_fraction pixel_aspect_ratio;
|
||||
enum spa_video_multiview_mode multiview_mode;
|
||||
enum spa_video_multiview_flags multiview_flags;
|
||||
enum spa_video_chroma_site chroma_site;
|
||||
enum spa_video_color_range color_range;
|
||||
enum spa_video_color_matrix color_matrix;
|
||||
enum spa_video_transfer_function transfer_function;
|
||||
enum spa_video_color_primaries color_primaries;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue