mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-11 13:30:07 -05:00
indent
This commit is contained in:
parent
d1a06ae247
commit
5b037661d9
154 changed files with 21017 additions and 23044 deletions
|
|
@ -29,41 +29,39 @@ extern "C" {
|
|||
#include <spa/audio/raw-utils.h>
|
||||
|
||||
struct spa_type_format_audio {
|
||||
uint32_t format;
|
||||
uint32_t flags;
|
||||
uint32_t layout;
|
||||
uint32_t rate;
|
||||
uint32_t channels;
|
||||
uint32_t channel_mask;
|
||||
uint32_t format;
|
||||
uint32_t flags;
|
||||
uint32_t layout;
|
||||
uint32_t rate;
|
||||
uint32_t channels;
|
||||
uint32_t channel_mask;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_format_audio_map (struct spa_type_map *map, struct spa_type_format_audio *type)
|
||||
spa_type_format_audio_map(struct spa_type_map *map, struct spa_type_format_audio *type)
|
||||
{
|
||||
if (type->format == 0) {
|
||||
type->format = spa_type_map_get_id (map, SPA_TYPE_FORMAT_AUDIO__format);
|
||||
type->flags = spa_type_map_get_id (map, SPA_TYPE_FORMAT_AUDIO__flags);
|
||||
type->layout = spa_type_map_get_id (map, SPA_TYPE_FORMAT_AUDIO__layout);
|
||||
type->rate = spa_type_map_get_id (map, SPA_TYPE_FORMAT_AUDIO__rate);
|
||||
type->channels = spa_type_map_get_id (map, SPA_TYPE_FORMAT_AUDIO__channels);
|
||||
type->channel_mask = spa_type_map_get_id (map, SPA_TYPE_FORMAT_AUDIO__channelMask);
|
||||
}
|
||||
if (type->format == 0) {
|
||||
type->format = spa_type_map_get_id(map, SPA_TYPE_FORMAT_AUDIO__format);
|
||||
type->flags = spa_type_map_get_id(map, SPA_TYPE_FORMAT_AUDIO__flags);
|
||||
type->layout = spa_type_map_get_id(map, SPA_TYPE_FORMAT_AUDIO__layout);
|
||||
type->rate = spa_type_map_get_id(map, SPA_TYPE_FORMAT_AUDIO__rate);
|
||||
type->channels = spa_type_map_get_id(map, SPA_TYPE_FORMAT_AUDIO__channels);
|
||||
type->channel_mask = spa_type_map_get_id(map, SPA_TYPE_FORMAT_AUDIO__channelMask);
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool
|
||||
spa_format_audio_raw_parse (const struct spa_format *format,
|
||||
struct spa_audio_info_raw *info,
|
||||
struct spa_type_format_audio *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,
|
||||
type->flags, SPA_POD_TYPE_INT, &info->flags,
|
||||
type->layout, SPA_POD_TYPE_INT, &info->layout,
|
||||
type->rate, SPA_POD_TYPE_INT, &info->rate,
|
||||
type->channels, SPA_POD_TYPE_INT, &info->channels,
|
||||
type->channel_mask, SPA_POD_TYPE_INT, &info->channel_mask,
|
||||
0);
|
||||
return true;
|
||||
spa_format_query(format,
|
||||
type->format, SPA_POD_TYPE_ID, &info->format,
|
||||
type->flags, SPA_POD_TYPE_INT, &info->flags,
|
||||
type->layout, SPA_POD_TYPE_INT, &info->layout,
|
||||
type->rate, SPA_POD_TYPE_INT, &info->rate,
|
||||
type->channels, SPA_POD_TYPE_INT, &info->channels,
|
||||
type->channel_mask, SPA_POD_TYPE_INT, &info->channel_mask, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ extern "C" {
|
|||
#define SPA_TYPE_FORMAT_AUDIO__channelMask SPA_TYPE_FORMAT_AUDIO_BASE "channel-mask"
|
||||
|
||||
struct spa_audio_info {
|
||||
uint32_t media_type;
|
||||
uint32_t media_subtype;
|
||||
union {
|
||||
struct spa_audio_info_raw raw;
|
||||
} info;
|
||||
uint32_t media_type;
|
||||
uint32_t media_subtype;
|
||||
union {
|
||||
struct spa_audio_info_raw raw;
|
||||
} info;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -36,80 +36,80 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
struct spa_type_audio_format {
|
||||
uint32_t UNKNOWN;
|
||||
uint32_t ENCODED;
|
||||
uint32_t S8;
|
||||
uint32_t U8;
|
||||
uint32_t S16;
|
||||
uint32_t U16;
|
||||
uint32_t S24_32;
|
||||
uint32_t U24_32;
|
||||
uint32_t S32;
|
||||
uint32_t U32;
|
||||
uint32_t S24;
|
||||
uint32_t U24;
|
||||
uint32_t S20;
|
||||
uint32_t U20;
|
||||
uint32_t S18;
|
||||
uint32_t U18;
|
||||
uint32_t F32;
|
||||
uint32_t F64;
|
||||
uint32_t S16_OE;
|
||||
uint32_t U16_OE;
|
||||
uint32_t S24_32_OE;
|
||||
uint32_t U24_32_OE;
|
||||
uint32_t S32_OE;
|
||||
uint32_t U32_OE;
|
||||
uint32_t S24_OE;
|
||||
uint32_t U24_OE;
|
||||
uint32_t S20_OE;
|
||||
uint32_t U20_OE;
|
||||
uint32_t S18_OE;
|
||||
uint32_t U18_OE;
|
||||
uint32_t F32_OE;
|
||||
uint32_t F64_OE;
|
||||
uint32_t UNKNOWN;
|
||||
uint32_t ENCODED;
|
||||
uint32_t S8;
|
||||
uint32_t U8;
|
||||
uint32_t S16;
|
||||
uint32_t U16;
|
||||
uint32_t S24_32;
|
||||
uint32_t U24_32;
|
||||
uint32_t S32;
|
||||
uint32_t U32;
|
||||
uint32_t S24;
|
||||
uint32_t U24;
|
||||
uint32_t S20;
|
||||
uint32_t U20;
|
||||
uint32_t S18;
|
||||
uint32_t U18;
|
||||
uint32_t F32;
|
||||
uint32_t F64;
|
||||
uint32_t S16_OE;
|
||||
uint32_t U16_OE;
|
||||
uint32_t S24_32_OE;
|
||||
uint32_t U24_32_OE;
|
||||
uint32_t S32_OE;
|
||||
uint32_t U32_OE;
|
||||
uint32_t S24_OE;
|
||||
uint32_t U24_OE;
|
||||
uint32_t S20_OE;
|
||||
uint32_t U20_OE;
|
||||
uint32_t S18_OE;
|
||||
uint32_t U18_OE;
|
||||
uint32_t F32_OE;
|
||||
uint32_t F64_OE;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_audio_format_map (struct spa_type_map *map, struct spa_type_audio_format *type)
|
||||
spa_type_audio_format_map(struct spa_type_map *map, struct spa_type_audio_format *type)
|
||||
{
|
||||
if (type->ENCODED == 0) {
|
||||
type->UNKNOWN = 0;
|
||||
type->ENCODED = spa_type_map_get_id (map, SPA_TYPE_AUDIO_FORMAT__ENCODED);
|
||||
if (type->ENCODED == 0) {
|
||||
type->UNKNOWN = 0;
|
||||
type->ENCODED = spa_type_map_get_id(map, SPA_TYPE_AUDIO_FORMAT__ENCODED);
|
||||
|
||||
type->S8 = spa_type_map_get_id (map, SPA_TYPE_AUDIO_FORMAT__S8);
|
||||
type->U8 = spa_type_map_get_id (map, SPA_TYPE_AUDIO_FORMAT__U8);
|
||||
type->S8 = spa_type_map_get_id(map, SPA_TYPE_AUDIO_FORMAT__S8);
|
||||
type->U8 = spa_type_map_get_id(map, SPA_TYPE_AUDIO_FORMAT__U8);
|
||||
|
||||
type->S16 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("S16"));
|
||||
type->U16 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("U16"));
|
||||
type->S24_32 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("S24_32"));
|
||||
type->U24_32 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("U24_32"));
|
||||
type->S32 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("S32"));
|
||||
type->U32 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("U32"));
|
||||
type->S24 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("S24"));
|
||||
type->U24 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("U24"));
|
||||
type->S20 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("S20"));
|
||||
type->U20 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("U20"));
|
||||
type->S18 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("S18"));
|
||||
type->U18 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("U18"));
|
||||
type->F32 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("F32"));
|
||||
type->F64 = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_NE ("F64"));
|
||||
type->S16 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("S16"));
|
||||
type->U16 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("U16"));
|
||||
type->S24_32 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("S24_32"));
|
||||
type->U24_32 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("U24_32"));
|
||||
type->S32 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("S32"));
|
||||
type->U32 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("U32"));
|
||||
type->S24 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("S24"));
|
||||
type->U24 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("U24"));
|
||||
type->S20 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("S20"));
|
||||
type->U20 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("U20"));
|
||||
type->S18 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("S18"));
|
||||
type->U18 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("U18"));
|
||||
type->F32 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("F32"));
|
||||
type->F64 = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_NE("F64"));
|
||||
|
||||
type->S16_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("S16"));
|
||||
type->U16_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("U16"));
|
||||
type->S24_32_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("S24_32"));
|
||||
type->U24_32_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("U24_32"));
|
||||
type->S32_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("S32"));
|
||||
type->U32_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("U32"));
|
||||
type->S24_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("S24"));
|
||||
type->U24_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("U24"));
|
||||
type->S20_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("S20"));
|
||||
type->U20_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("U20"));
|
||||
type->S18_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("S18"));
|
||||
type->U18_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("U18"));
|
||||
type->F32_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("F32"));
|
||||
type->F64_OE = spa_type_map_get_id (map, _SPA_TYPE_AUDIO_FORMAT_OE ("F64"));
|
||||
}
|
||||
type->S16_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("S16"));
|
||||
type->U16_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("U16"));
|
||||
type->S24_32_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("S24_32"));
|
||||
type->U24_32_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("U24_32"));
|
||||
type->S32_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("S32"));
|
||||
type->U32_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("U32"));
|
||||
type->S24_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("S24"));
|
||||
type->U24_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("U24"));
|
||||
type->S20_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("S20"));
|
||||
type->U20_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("U20"));
|
||||
type->S18_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("S18"));
|
||||
type->U18_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("U18"));
|
||||
type->F32_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("F32"));
|
||||
type->F64_OE = spa_type_map_get_id(map, _SPA_TYPE_AUDIO_FORMAT_OE("F64"));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ extern "C" {
|
|||
* Extra audio flags
|
||||
*/
|
||||
enum spa_audio_flags {
|
||||
SPA_AUDIO_FLAG_NONE = 0,
|
||||
SPA_AUDIO_FLAG_UNPOSITIONED = (1 << 0)
|
||||
SPA_AUDIO_FLAG_NONE = 0,
|
||||
SPA_AUDIO_FLAG_UNPOSITIONED = (1 << 0)
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -83,8 +83,8 @@ enum spa_audio_flags {
|
|||
* Layout of the audio samples for the different channels.
|
||||
*/
|
||||
enum spa_audio_layout {
|
||||
SPA_AUDIO_LAYOUT_INTERLEAVED = 0,
|
||||
SPA_AUDIO_LAYOUT_NON_INTERLEAVED
|
||||
SPA_AUDIO_LAYOUT_INTERLEAVED = 0,
|
||||
SPA_AUDIO_LAYOUT_NON_INTERLEAVED
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -97,12 +97,12 @@ enum spa_audio_layout {
|
|||
* @channel_mask: the channel mask
|
||||
*/
|
||||
struct spa_audio_info_raw {
|
||||
uint32_t format;
|
||||
enum spa_audio_flags flags;
|
||||
enum spa_audio_layout layout;
|
||||
uint32_t rate;
|
||||
uint32_t channels;
|
||||
uint32_t channel_mask;
|
||||
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
|
||||
|
|
|
|||
|
|
@ -40,21 +40,20 @@ extern "C" {
|
|||
#define SPA_TYPE_DATA__Id SPA_TYPE_DATA_BASE "Id"
|
||||
|
||||
struct spa_type_data {
|
||||
uint32_t MemPtr;
|
||||
uint32_t MemFd;
|
||||
uint32_t DmaBuf;
|
||||
uint32_t Id;
|
||||
uint32_t MemPtr;
|
||||
uint32_t MemFd;
|
||||
uint32_t DmaBuf;
|
||||
uint32_t Id;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_data_map (struct spa_type_map *map, struct spa_type_data *type)
|
||||
static inline void spa_type_data_map(struct spa_type_map *map, struct spa_type_data *type)
|
||||
{
|
||||
if (type->MemPtr == 0) {
|
||||
type->MemPtr = spa_type_map_get_id (map, SPA_TYPE_DATA__MemPtr);
|
||||
type->MemFd = spa_type_map_get_id (map, SPA_TYPE_DATA__MemFd);
|
||||
type->DmaBuf = spa_type_map_get_id (map, SPA_TYPE_DATA__DmaBuf);
|
||||
type->Id = spa_type_map_get_id (map, SPA_TYPE_DATA__Id);
|
||||
}
|
||||
if (type->MemPtr == 0) {
|
||||
type->MemPtr = spa_type_map_get_id(map, SPA_TYPE_DATA__MemPtr);
|
||||
type->MemFd = spa_type_map_get_id(map, SPA_TYPE_DATA__MemFd);
|
||||
type->DmaBuf = spa_type_map_get_id(map, SPA_TYPE_DATA__DmaBuf);
|
||||
type->Id = spa_type_map_get_id(map, SPA_TYPE_DATA__Id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -64,9 +63,9 @@ spa_type_data_map (struct spa_type_map *map, struct spa_type_data *type)
|
|||
* @stride: stride of data if applicable
|
||||
*/
|
||||
struct spa_chunk {
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
int32_t stride;
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
int32_t stride;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -80,13 +79,13 @@ struct spa_chunk {
|
|||
* @chunk: pointer to chunk with valid offset
|
||||
*/
|
||||
struct spa_data {
|
||||
uint32_t type;
|
||||
uint32_t flags;
|
||||
int fd;
|
||||
uint32_t mapoffset;
|
||||
uint32_t maxsize;
|
||||
void *data;
|
||||
struct spa_chunk *chunk;
|
||||
uint32_t type;
|
||||
uint32_t flags;
|
||||
int fd;
|
||||
uint32_t mapoffset;
|
||||
uint32_t maxsize;
|
||||
void *data;
|
||||
struct spa_chunk *chunk;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -98,27 +97,26 @@ struct spa_data {
|
|||
* @datas: offset of array of @n_datas data pointers
|
||||
*/
|
||||
struct spa_buffer {
|
||||
uint32_t id;
|
||||
uint32_t n_metas;
|
||||
struct spa_meta *metas;
|
||||
uint32_t n_datas;
|
||||
struct spa_data *datas;
|
||||
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 (struct spa_buffer *b, uint32_t type)
|
||||
static inline void *spa_buffer_find_meta(struct spa_buffer *b, uint32_t type)
|
||||
{
|
||||
uint32_t i;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < b->n_metas; i++)
|
||||
if (b->metas[i].type == type)
|
||||
return b->metas[i].data;
|
||||
for (i = 0; i < b->n_metas; i++)
|
||||
if (b->metas[i].type == type)
|
||||
return b->metas[i].data;
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_BUFFER_H__ */
|
||||
#endif /* __SPA_BUFFER_H__ */
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ extern "C" {
|
|||
* @SPA_CLOCK_STATE_RUNNING: the clock is running
|
||||
*/
|
||||
enum spa_clock_state {
|
||||
SPA_CLOCK_STATE_STOPPED,
|
||||
SPA_CLOCK_STATE_PAUSED,
|
||||
SPA_CLOCK_STATE_RUNNING,
|
||||
SPA_CLOCK_STATE_STOPPED,
|
||||
SPA_CLOCK_STATE_PAUSED,
|
||||
SPA_CLOCK_STATE_RUNNING,
|
||||
};
|
||||
|
||||
#include <spa/defs.h>
|
||||
|
|
@ -49,68 +49,64 @@ enum spa_clock_state {
|
|||
* A time provider.
|
||||
*/
|
||||
struct spa_clock {
|
||||
/* the total size of this clock. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
/**
|
||||
* spa_clock::info
|
||||
*
|
||||
* Extra information about the clock
|
||||
*/
|
||||
const struct spa_dict *info;
|
||||
/**
|
||||
* spa_clock::state:
|
||||
*
|
||||
* The current state of the clock
|
||||
*/
|
||||
enum spa_clock_state state;
|
||||
/**
|
||||
* 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 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
|
||||
*/
|
||||
int (*get_props) (struct spa_clock *clock,
|
||||
struct spa_props **props);
|
||||
/**
|
||||
* 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 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.
|
||||
*
|
||||
* If @props is NULL, all the properties are reset to their defaults.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when clock is %NULL
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when no properties can be
|
||||
* modified on @clock.
|
||||
* #SPA_RESULT_WRONG_PROPERTY_TYPE when a property has the wrong
|
||||
* type.
|
||||
*/
|
||||
int (*set_props) (struct spa_clock *clock,
|
||||
const struct spa_props *props);
|
||||
/* the total size of this clock. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
|
||||
int (*get_time) (struct spa_clock *clock,
|
||||
int32_t *rate,
|
||||
int64_t *ticks,
|
||||
int64_t *monotonic_time);
|
||||
const struct spa_dict *info;
|
||||
/**
|
||||
* spa_clock::state:
|
||||
*
|
||||
* The current state of the clock
|
||||
*/
|
||||
enum spa_clock_state state;
|
||||
/**
|
||||
* 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 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
|
||||
*/
|
||||
int (*get_props) (struct spa_clock *clock,
|
||||
struct spa_props **props);
|
||||
/**
|
||||
* 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 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.
|
||||
*
|
||||
* If @props is NULL, all the properties are reset to their defaults.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when clock is %NULL
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when no properties can be
|
||||
* modified on @clock.
|
||||
* #SPA_RESULT_WRONG_PROPERTY_TYPE when a property has the wrong
|
||||
* type.
|
||||
*/
|
||||
int (*set_props) (struct spa_clock *clock,
|
||||
const struct spa_props *props);
|
||||
|
||||
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__)
|
||||
|
|
@ -121,4 +117,4 @@ struct spa_clock {
|
|||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_CLOCK_H__ */
|
||||
#endif /* __SPA_CLOCK_H__ */
|
||||
|
|
|
|||
|
|
@ -38,25 +38,25 @@ extern "C" {
|
|||
#define SPA_TYPE_COMMAND_NODE__ClockUpdate SPA_TYPE_COMMAND_NODE_BASE "ClockUpdate"
|
||||
|
||||
struct spa_type_command_node {
|
||||
uint32_t Pause;
|
||||
uint32_t Start;
|
||||
uint32_t Flush;
|
||||
uint32_t Drain;
|
||||
uint32_t Marker;
|
||||
uint32_t ClockUpdate;
|
||||
uint32_t Pause;
|
||||
uint32_t Start;
|
||||
uint32_t Flush;
|
||||
uint32_t Drain;
|
||||
uint32_t Marker;
|
||||
uint32_t ClockUpdate;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_command_node_map (struct spa_type_map *map, struct spa_type_command_node *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);
|
||||
type->Start = spa_type_map_get_id (map, SPA_TYPE_COMMAND_NODE__Start);
|
||||
type->Flush = spa_type_map_get_id (map, SPA_TYPE_COMMAND_NODE__Flush);
|
||||
type->Drain = spa_type_map_get_id (map, SPA_TYPE_COMMAND_NODE__Drain);
|
||||
type->Marker = spa_type_map_get_id (map, SPA_TYPE_COMMAND_NODE__Marker);
|
||||
type->ClockUpdate = spa_type_map_get_id (map, SPA_TYPE_COMMAND_NODE__ClockUpdate);
|
||||
}
|
||||
if (type->Pause == 0) {
|
||||
type->Pause = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Pause);
|
||||
type->Start = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Start);
|
||||
type->Flush = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Flush);
|
||||
type->Drain = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Drain);
|
||||
type->Marker = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Marker);
|
||||
type->ClockUpdate = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__ClockUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -72,43 +72,43 @@ spa_type_command_node_map (struct spa_type_map *map, struct spa_type_command_nod
|
|||
* @state: the new clock state, when @change_mask = 1<<2
|
||||
*/
|
||||
struct spa_command_node_clock_update_body {
|
||||
struct spa_pod_object_body 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)
|
||||
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);
|
||||
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)
|
||||
struct spa_pod_int flags SPA_ALIGNED (8);
|
||||
struct spa_pod_long latency SPA_ALIGNED (8);
|
||||
struct spa_pod_int flags SPA_ALIGNED(8);
|
||||
struct spa_pod_long latency SPA_ALIGNED(8);
|
||||
};
|
||||
|
||||
struct spa_command_node_clock_update {
|
||||
struct spa_pod pod;
|
||||
struct spa_command_node_clock_update_body body;
|
||||
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 (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))
|
||||
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
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_COMMAND_NODE_H__ */
|
||||
#endif /* _SPA_COMMAND_NODE_H__ */
|
||||
|
|
|
|||
|
|
@ -31,23 +31,23 @@ extern "C" {
|
|||
#define SPA_TYPE_COMMAND_BASE SPA_TYPE__Command ":"
|
||||
|
||||
struct spa_command_body {
|
||||
struct spa_pod_object_body body;
|
||||
struct spa_pod_object_body body;
|
||||
};
|
||||
|
||||
struct spa_command {
|
||||
struct spa_pod pod;
|
||||
struct spa_command_body body;
|
||||
struct spa_pod pod;
|
||||
struct spa_command_body body;
|
||||
};
|
||||
|
||||
#define SPA_COMMAND_TYPE(cmd) ((cmd)->body.body.type)
|
||||
|
||||
#define SPA_COMMAND_INIT(type) (struct spa_command) \
|
||||
{ { sizeof (struct spa_command_body), SPA_POD_TYPE_OBJECT }, \
|
||||
{ { 0, type } } } \
|
||||
#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) \
|
||||
{ { size, SPA_POD_TYPE_OBJECT }, \
|
||||
{ { 0, type }, __VA_ARGS__ } } \
|
||||
#define SPA_COMMAND_INIT_COMPLEX(t,size,type,...) (t) \
|
||||
{ { size, SPA_POD_TYPE_OBJECT }, \
|
||||
{ { 0, type }, __VA_ARGS__ } } \
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -31,46 +31,46 @@ extern "C" {
|
|||
#include <stddef.h>
|
||||
|
||||
enum {
|
||||
SPA_RESULT_ASYNC = (1 << 30),
|
||||
SPA_RESULT_WAIT_SYNC = 2,
|
||||
SPA_RESULT_MODIFIED = 1,
|
||||
SPA_RESULT_OK = 0,
|
||||
SPA_RESULT_ERROR = -1,
|
||||
SPA_RESULT_ERRNO = -2,
|
||||
SPA_RESULT_INACTIVE = -3,
|
||||
SPA_RESULT_NO_FORMAT = -4,
|
||||
SPA_RESULT_INVALID_COMMAND = -5,
|
||||
SPA_RESULT_INVALID_PORT = -6,
|
||||
SPA_RESULT_HAVE_BUFFER = -7,
|
||||
SPA_RESULT_NEED_BUFFER = -8,
|
||||
SPA_RESULT_PORTS_CHANGED = -9,
|
||||
SPA_RESULT_FORMAT_CHANGED = -10,
|
||||
SPA_RESULT_PROPERTIES_CHANGED = -11,
|
||||
SPA_RESULT_NOT_IMPLEMENTED = -12,
|
||||
SPA_RESULT_INVALID_PROPERTY_INDEX = -13,
|
||||
SPA_RESULT_PROPERTY_UNSET = -14,
|
||||
SPA_RESULT_ENUM_END = -15,
|
||||
SPA_RESULT_WRONG_PROPERTY_TYPE = -16,
|
||||
SPA_RESULT_WRONG_PROPERTY_SIZE = -17,
|
||||
SPA_RESULT_INVALID_MEDIA_TYPE = -18,
|
||||
SPA_RESULT_INVALID_FORMAT_PROPERTIES = -19,
|
||||
SPA_RESULT_FORMAT_INCOMPLETE = -20,
|
||||
SPA_RESULT_INVALID_ARGUMENTS = -21,
|
||||
SPA_RESULT_UNKNOWN_INTERFACE = -22,
|
||||
SPA_RESULT_INVALID_DIRECTION = -23,
|
||||
SPA_RESULT_TOO_MANY_PORTS = -24,
|
||||
SPA_RESULT_INVALID_PROPERTY_ACCESS = -25,
|
||||
SPA_RESULT_UNEXPECTED = -26,
|
||||
SPA_RESULT_NO_BUFFERS = -27,
|
||||
SPA_RESULT_INVALID_BUFFER_ID = -28,
|
||||
SPA_RESULT_WRONG_STATE = -29,
|
||||
SPA_RESULT_ASYNC_BUSY = -30,
|
||||
SPA_RESULT_INVALID_OBJECT_ID = -31,
|
||||
SPA_RESULT_NO_MEMORY = -32,
|
||||
SPA_RESULT_NO_PERMISSION = -33,
|
||||
SPA_RESULT_SKIPPED = -34,
|
||||
SPA_RESULT_OUT_OF_BUFFERS = -35,
|
||||
SPA_RESULT_INCOMPATIBLE_PROPS = -36,
|
||||
SPA_RESULT_ASYNC = (1 << 30),
|
||||
SPA_RESULT_WAIT_SYNC = 2,
|
||||
SPA_RESULT_MODIFIED = 1,
|
||||
SPA_RESULT_OK = 0,
|
||||
SPA_RESULT_ERROR = -1,
|
||||
SPA_RESULT_ERRNO = -2,
|
||||
SPA_RESULT_INACTIVE = -3,
|
||||
SPA_RESULT_NO_FORMAT = -4,
|
||||
SPA_RESULT_INVALID_COMMAND = -5,
|
||||
SPA_RESULT_INVALID_PORT = -6,
|
||||
SPA_RESULT_HAVE_BUFFER = -7,
|
||||
SPA_RESULT_NEED_BUFFER = -8,
|
||||
SPA_RESULT_PORTS_CHANGED = -9,
|
||||
SPA_RESULT_FORMAT_CHANGED = -10,
|
||||
SPA_RESULT_PROPERTIES_CHANGED = -11,
|
||||
SPA_RESULT_NOT_IMPLEMENTED = -12,
|
||||
SPA_RESULT_INVALID_PROPERTY_INDEX = -13,
|
||||
SPA_RESULT_PROPERTY_UNSET = -14,
|
||||
SPA_RESULT_ENUM_END = -15,
|
||||
SPA_RESULT_WRONG_PROPERTY_TYPE = -16,
|
||||
SPA_RESULT_WRONG_PROPERTY_SIZE = -17,
|
||||
SPA_RESULT_INVALID_MEDIA_TYPE = -18,
|
||||
SPA_RESULT_INVALID_FORMAT_PROPERTIES = -19,
|
||||
SPA_RESULT_FORMAT_INCOMPLETE = -20,
|
||||
SPA_RESULT_INVALID_ARGUMENTS = -21,
|
||||
SPA_RESULT_UNKNOWN_INTERFACE = -22,
|
||||
SPA_RESULT_INVALID_DIRECTION = -23,
|
||||
SPA_RESULT_TOO_MANY_PORTS = -24,
|
||||
SPA_RESULT_INVALID_PROPERTY_ACCESS = -25,
|
||||
SPA_RESULT_UNEXPECTED = -26,
|
||||
SPA_RESULT_NO_BUFFERS = -27,
|
||||
SPA_RESULT_INVALID_BUFFER_ID = -28,
|
||||
SPA_RESULT_WRONG_STATE = -29,
|
||||
SPA_RESULT_ASYNC_BUSY = -30,
|
||||
SPA_RESULT_INVALID_OBJECT_ID = -31,
|
||||
SPA_RESULT_NO_MEMORY = -32,
|
||||
SPA_RESULT_NO_PERMISSION = -33,
|
||||
SPA_RESULT_SKIPPED = -34,
|
||||
SPA_RESULT_OUT_OF_BUFFERS = -35,
|
||||
SPA_RESULT_INCOMPATIBLE_PROPS = -36,
|
||||
};
|
||||
|
||||
#define SPA_ASYNC_MASK (3 << 30)
|
||||
|
|
@ -84,21 +84,21 @@ enum {
|
|||
#define SPA_RESULT_RETURN_ASYNC(seq) (SPA_RESULT_ASYNC | ((seq) & SPA_ASYNC_SEQ_MASK))
|
||||
|
||||
enum spa_direction {
|
||||
SPA_DIRECTION_INPUT = 0,
|
||||
SPA_DIRECTION_OUTPUT = 1,
|
||||
SPA_DIRECTION_INPUT = 0,
|
||||
SPA_DIRECTION_OUTPUT = 1,
|
||||
};
|
||||
|
||||
struct spa_rectangle {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
};
|
||||
|
||||
struct spa_fraction {
|
||||
uint32_t num;
|
||||
uint32_t denom;
|
||||
uint32_t num;
|
||||
uint32_t denom;
|
||||
};
|
||||
|
||||
#define SPA_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
|
||||
#define SPA_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
#define SPA_MIN(a,b) ((a)<(b) ? (a) : (b))
|
||||
#define SPA_MAX(a,b) ((a)>(b) ? (a) : (b))
|
||||
#define SPA_ABS(a) ((a)>0 ? (a) : -(a))
|
||||
|
|
@ -131,11 +131,11 @@ struct spa_fraction {
|
|||
#define SPA_TIMEVAL_TO_TIME(tv) ((tv)->tv_sec * SPA_NSEC_PER_SEC + (tv)->tv_usec * 1000ll)
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define SPA_PRINTF_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
|
||||
# define SPA_ALIGNED(align) __attribute__ ((aligned (align)))
|
||||
#define SPA_PRINTF_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
|
||||
#define SPA_ALIGNED(align) __attribute__((aligned(align)))
|
||||
#else
|
||||
# define SPA_PRINTF_FUNC(fmt, arg1)
|
||||
# define SPA_ALIGNED(align)
|
||||
#define SPA_PRINTF_FUNC(fmt, arg1)
|
||||
#define SPA_ALIGNED(align)
|
||||
#endif
|
||||
|
||||
#define SPA_ROUND_UP_N(num,align) ((((num) + ((align) - 1)) & ~((align) - 1)))
|
||||
|
|
@ -150,25 +150,25 @@ struct spa_fraction {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#define spa_return_if_fail(expr) \
|
||||
do { \
|
||||
if (SPA_UNLIKELY (!(expr))) \
|
||||
return; \
|
||||
} while(false)
|
||||
#define spa_return_if_fail(expr) \
|
||||
do { \
|
||||
if (SPA_UNLIKELY(!(expr))) \
|
||||
return; \
|
||||
} while(false)
|
||||
|
||||
#define spa_return_val_if_fail(expr, val) \
|
||||
do { \
|
||||
if (SPA_UNLIKELY(!(expr))) \
|
||||
return (val); \
|
||||
} while(false)
|
||||
#define spa_return_val_if_fail(expr, val) \
|
||||
do { \
|
||||
if (SPA_UNLIKELY(!(expr))) \
|
||||
return (val); \
|
||||
} while(false)
|
||||
|
||||
/* spa_assert_se() is an assert which guarantees side effects of x,
|
||||
* i.e. is never optimized away, regardless of NDEBUG or FASTPATH. */
|
||||
#define spa_assert_se(expr) \
|
||||
do { \
|
||||
if (SPA_UNLIKELY(!(expr))) \
|
||||
abort(); \
|
||||
} while (false)
|
||||
#define spa_assert_se(expr) \
|
||||
do { \
|
||||
if (SPA_UNLIKELY(!(expr))) \
|
||||
abort(); \
|
||||
} while (false)
|
||||
|
||||
/* Does exactly nothing */
|
||||
#define spa_nop() do {} while (false)
|
||||
|
|
@ -177,8 +177,7 @@ struct spa_fraction {
|
|||
#define spa_zero(x) (spa_memzero(&(x), sizeof(x)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __SPA_DEFS_H__ */
|
||||
|
|
|
|||
|
|
@ -32,38 +32,37 @@ extern "C" {
|
|||
#include <spa/defs.h>
|
||||
|
||||
struct spa_dict_item {
|
||||
const char *key;
|
||||
const char *value;
|
||||
const char *key;
|
||||
const char *value;
|
||||
};
|
||||
|
||||
struct spa_dict {
|
||||
uint32_t n_items;
|
||||
struct spa_dict_item *items;
|
||||
uint32_t n_items;
|
||||
struct spa_dict_item *items;
|
||||
};
|
||||
|
||||
#define SPA_DICT_INIT(n_items,items) { n_items, items }
|
||||
|
||||
#define spa_dict_for_each(item, dict) \
|
||||
for ((item) = (dict)->items; \
|
||||
(item) < &(dict)->items[(dict)->n_items]; \
|
||||
(item)++)
|
||||
#define spa_dict_for_each(item, dict) \
|
||||
for ((item) = (dict)->items; \
|
||||
(item) < &(dict)->items[(dict)->n_items]; \
|
||||
(item)++)
|
||||
|
||||
static inline struct spa_dict_item *
|
||||
spa_dict_lookup_item (const struct spa_dict *dict, const char *key)
|
||||
static inline struct spa_dict_item *spa_dict_lookup_item(const struct spa_dict *dict,
|
||||
const char *key)
|
||||
{
|
||||
struct spa_dict_item *item;
|
||||
spa_dict_for_each (item, dict) {
|
||||
if (!strcmp (item->key, key))
|
||||
return item;
|
||||
}
|
||||
return NULL;
|
||||
struct spa_dict_item *item;
|
||||
spa_dict_for_each(item, dict) {
|
||||
if (!strcmp(item->key, key))
|
||||
return item;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline const char *
|
||||
spa_dict_lookup (const struct spa_dict *dict, const char *key)
|
||||
static inline const char *spa_dict_lookup(const struct spa_dict *dict, const char *key)
|
||||
{
|
||||
struct spa_dict_item *item = spa_dict_lookup_item (dict, key);
|
||||
return item ? item->value : NULL;
|
||||
struct spa_dict_item *item = spa_dict_lookup_item(dict, key);
|
||||
return item ? item->value : NULL;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -39,63 +39,63 @@ extern "C" {
|
|||
#define SPA_TYPE_EVENT_NODE__RequestClockUpdate SPA_TYPE_EVENT_NODE_BASE "RequestClockUpdate"
|
||||
|
||||
struct spa_type_event_node {
|
||||
uint32_t AsyncComplete;
|
||||
uint32_t Error;
|
||||
uint32_t Buffering;
|
||||
uint32_t RequestRefresh;
|
||||
uint32_t RequestClockUpdate;
|
||||
uint32_t AsyncComplete;
|
||||
uint32_t Error;
|
||||
uint32_t Buffering;
|
||||
uint32_t RequestRefresh;
|
||||
uint32_t RequestClockUpdate;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_event_node_map (struct spa_type_map *map, struct spa_type_event_node *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);
|
||||
type->Error = spa_type_map_get_id (map, SPA_TYPE_EVENT_NODE__Error);
|
||||
type->Buffering = spa_type_map_get_id (map, SPA_TYPE_EVENT_NODE__Buffering);
|
||||
type->RequestRefresh = spa_type_map_get_id (map, SPA_TYPE_EVENT_NODE__RequestRefresh);
|
||||
type->RequestClockUpdate = spa_type_map_get_id (map, SPA_TYPE_EVENT_NODE__RequestClockUpdate);
|
||||
}
|
||||
if (type->AsyncComplete == 0) {
|
||||
type->AsyncComplete = spa_type_map_get_id(map, SPA_TYPE_EVENT_NODE__AsyncComplete);
|
||||
type->Error = spa_type_map_get_id(map, SPA_TYPE_EVENT_NODE__Error);
|
||||
type->Buffering = spa_type_map_get_id(map, SPA_TYPE_EVENT_NODE__Buffering);
|
||||
type->RequestRefresh = spa_type_map_get_id(map, SPA_TYPE_EVENT_NODE__RequestRefresh);
|
||||
type->RequestClockUpdate = spa_type_map_get_id(map, SPA_TYPE_EVENT_NODE__RequestClockUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
struct spa_pod_object_body body;
|
||||
struct spa_pod_int seq SPA_ALIGNED(8);
|
||||
struct spa_pod_int res SPA_ALIGNED(8);
|
||||
};
|
||||
|
||||
struct spa_event_node_async_complete {
|
||||
struct spa_pod pod;
|
||||
struct spa_event_node_async_complete_body body;
|
||||
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 (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))
|
||||
#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))
|
||||
|
||||
struct spa_event_node_request_clock_update_body {
|
||||
struct spa_pod_object_body 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)
|
||||
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);
|
||||
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);
|
||||
};
|
||||
|
||||
struct spa_event_node_request_clock_update {
|
||||
struct spa_pod pod;
|
||||
struct spa_event_node_request_clock_update_body body;
|
||||
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 (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))
|
||||
#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
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -31,23 +31,23 @@ extern "C" {
|
|||
#define SPA_TYPE_EVENT_BASE SPA_TYPE__Event ":"
|
||||
|
||||
struct spa_event_body {
|
||||
struct spa_pod_object_body body;
|
||||
struct spa_pod_object_body body;
|
||||
};
|
||||
|
||||
struct spa_event {
|
||||
struct spa_pod pod;
|
||||
struct spa_event_body body;
|
||||
struct spa_pod pod;
|
||||
struct spa_event_body body;
|
||||
};
|
||||
|
||||
#define SPA_EVENT_TYPE(ev) ((ev)->body.body.type)
|
||||
|
||||
#define SPA_EVENT_INIT(type) (struct spa_event) \
|
||||
{ { sizeof (struct spa_event_body), 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,30 +30,30 @@ extern "C" {
|
|||
#include <spa/pod-builder.h>
|
||||
|
||||
static inline uint32_t
|
||||
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)
|
||||
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 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 } } };
|
||||
return spa_pod_builder_push (builder, frame, &p.pod,
|
||||
spa_pod_builder_raw (builder, &p, sizeof(p)));
|
||||
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} } };
|
||||
return spa_pod_builder_push(builder, frame, &p.pod,
|
||||
spa_pod_builder_raw(builder, &p, sizeof(p)));
|
||||
}
|
||||
|
||||
#define spa_pod_builder_format(b,f,format_type,media_type,media_subtype,...) \
|
||||
spa_pod_builder_object(b, f, 0, format_type, \
|
||||
SPA_POD_TYPE_ID,media_type, \
|
||||
SPA_POD_TYPE_ID,media_subtype, \
|
||||
__VA_ARGS__)
|
||||
#define spa_pod_builder_format(b,f,format_type,media_type,media_subtype,...) \
|
||||
spa_pod_builder_object(b, f, 0, format_type, \
|
||||
SPA_POD_TYPE_ID,media_type, \
|
||||
SPA_POD_TYPE_ID,media_subtype, \
|
||||
__VA_ARGS__)
|
||||
|
||||
int
|
||||
spa_format_filter (const struct spa_format *format,
|
||||
const struct spa_format *filter,
|
||||
struct spa_pod_builder *result);
|
||||
spa_format_filter(const struct spa_format *format,
|
||||
const struct spa_format *filter,
|
||||
struct spa_pod_builder *result);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -31,154 +31,154 @@ extern "C" {
|
|||
#include <spa/type-map.h>
|
||||
|
||||
struct spa_type_media_type {
|
||||
uint32_t audio;
|
||||
uint32_t video;
|
||||
uint32_t image;
|
||||
uint32_t binary;
|
||||
uint32_t stream;
|
||||
uint32_t audio;
|
||||
uint32_t video;
|
||||
uint32_t image;
|
||||
uint32_t binary;
|
||||
uint32_t stream;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_media_type_map (struct spa_type_map *map, struct spa_type_media_type *type)
|
||||
spa_type_media_type_map(struct spa_type_map *map, struct spa_type_media_type *type)
|
||||
{
|
||||
if (type->audio == 0) {
|
||||
type->audio = spa_type_map_get_id (map, SPA_TYPE_MEDIA_TYPE__audio);
|
||||
type->video = spa_type_map_get_id (map, SPA_TYPE_MEDIA_TYPE__video);
|
||||
type->image = spa_type_map_get_id (map, SPA_TYPE_MEDIA_TYPE__image);
|
||||
type->binary = spa_type_map_get_id (map, SPA_TYPE_MEDIA_TYPE__binary);
|
||||
type->stream = spa_type_map_get_id (map, SPA_TYPE_MEDIA_TYPE__stream);
|
||||
}
|
||||
if (type->audio == 0) {
|
||||
type->audio = spa_type_map_get_id(map, SPA_TYPE_MEDIA_TYPE__audio);
|
||||
type->video = spa_type_map_get_id(map, SPA_TYPE_MEDIA_TYPE__video);
|
||||
type->image = spa_type_map_get_id(map, SPA_TYPE_MEDIA_TYPE__image);
|
||||
type->binary = spa_type_map_get_id(map, SPA_TYPE_MEDIA_TYPE__binary);
|
||||
type->stream = spa_type_map_get_id(map, SPA_TYPE_MEDIA_TYPE__stream);
|
||||
}
|
||||
}
|
||||
|
||||
struct spa_type_media_subtype {
|
||||
uint32_t raw;
|
||||
uint32_t raw;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_media_subtype_map (struct spa_type_map *map, struct spa_type_media_subtype *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);
|
||||
}
|
||||
if (type->raw == 0) {
|
||||
type->raw = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__raw);
|
||||
}
|
||||
}
|
||||
|
||||
struct spa_type_media_subtype_video {
|
||||
uint32_t h264;
|
||||
uint32_t mjpg;
|
||||
uint32_t dv;
|
||||
uint32_t mpegts;
|
||||
uint32_t h263;
|
||||
uint32_t mpeg1;
|
||||
uint32_t mpeg2;
|
||||
uint32_t mpeg4;
|
||||
uint32_t xvid;
|
||||
uint32_t vc1;
|
||||
uint32_t vp8;
|
||||
uint32_t vp9;
|
||||
uint32_t jpeg;
|
||||
uint32_t bayer;
|
||||
uint32_t h264;
|
||||
uint32_t mjpg;
|
||||
uint32_t dv;
|
||||
uint32_t mpegts;
|
||||
uint32_t h263;
|
||||
uint32_t mpeg1;
|
||||
uint32_t mpeg2;
|
||||
uint32_t mpeg4;
|
||||
uint32_t xvid;
|
||||
uint32_t vc1;
|
||||
uint32_t vp8;
|
||||
uint32_t vp9;
|
||||
uint32_t jpeg;
|
||||
uint32_t bayer;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_media_subtype_video_map (struct spa_type_map *map, struct spa_type_media_subtype_video *type)
|
||||
spa_type_media_subtype_video_map(struct spa_type_map *map,
|
||||
struct spa_type_media_subtype_video *type)
|
||||
{
|
||||
if (type->h264 == 0) {
|
||||
type->h264 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__h264);
|
||||
type->mjpg = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mjpg);
|
||||
type->dv = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__dv);
|
||||
type->mpegts = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mpegts);
|
||||
type->h263 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__h263);
|
||||
type->mpeg1 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mpeg1);
|
||||
type->mpeg2 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mpeg2);
|
||||
type->mpeg4 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__mpeg4);
|
||||
type->xvid = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__xvid);
|
||||
type->vc1 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__vc1);
|
||||
type->vp8 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__vp8);
|
||||
type->vp9 = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__vp9);
|
||||
type->jpeg = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__jpeg);
|
||||
type->bayer = spa_type_map_get_id (map, SPA_TYPE_MEDIA_SUBTYPE__bayer);
|
||||
}
|
||||
if (type->h264 == 0) {
|
||||
type->h264 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__h264);
|
||||
type->mjpg = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__mjpg);
|
||||
type->dv = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__dv);
|
||||
type->mpegts = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__mpegts);
|
||||
type->h263 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__h263);
|
||||
type->mpeg1 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__mpeg1);
|
||||
type->mpeg2 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__mpeg2);
|
||||
type->mpeg4 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__mpeg4);
|
||||
type->xvid = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__xvid);
|
||||
type->vc1 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__vc1);
|
||||
type->vp8 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__vp8);
|
||||
type->vp9 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__vp9);
|
||||
type->jpeg = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__jpeg);
|
||||
type->bayer = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__bayer);
|
||||
}
|
||||
}
|
||||
|
||||
struct spa_type_media_subtype_audio {
|
||||
uint32_t mp3;
|
||||
uint32_t aac;
|
||||
uint32_t vorbis;
|
||||
uint32_t wma;
|
||||
uint32_t ra;
|
||||
uint32_t sbc;
|
||||
uint32_t adpcm;
|
||||
uint32_t g723;
|
||||
uint32_t g726;
|
||||
uint32_t g729;
|
||||
uint32_t amr;
|
||||
uint32_t gsm;
|
||||
uint32_t mp3;
|
||||
uint32_t aac;
|
||||
uint32_t vorbis;
|
||||
uint32_t wma;
|
||||
uint32_t ra;
|
||||
uint32_t sbc;
|
||||
uint32_t adpcm;
|
||||
uint32_t g723;
|
||||
uint32_t g726;
|
||||
uint32_t g729;
|
||||
uint32_t amr;
|
||||
uint32_t gsm;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_media_subtype_audio_map (struct spa_type_map *map, struct spa_type_media_subtype_audio *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->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);
|
||||
}
|
||||
if (type->mp3 == 0) {
|
||||
type->mp3 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__mp3);
|
||||
type->aac = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__aac);
|
||||
type->vorbis = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__vorbis);
|
||||
type->wma = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__wma);
|
||||
type->ra = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__ra);
|
||||
type->sbc = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__sbc);
|
||||
type->adpcm = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__adpcm);
|
||||
type->g723 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__g723);
|
||||
type->g726 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__g726);
|
||||
type->g729 = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__g729);
|
||||
type->amr = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__amr);
|
||||
type->gsm = spa_type_map_get_id(map, SPA_TYPE_MEDIA_SUBTYPE__gsm);
|
||||
}
|
||||
}
|
||||
|
||||
#define SPA_FORMAT_INIT(size,type,media_type,media_subtype,...) \
|
||||
{ { size, SPA_POD_TYPE_OBJECT }, \
|
||||
{ { 0, type }, \
|
||||
SPA_POD_ID_INIT (media_type), \
|
||||
SPA_POD_ID_INIT (media_subtype) } }
|
||||
#define SPA_FORMAT_INIT(size,type,media_type,media_subtype,...) \
|
||||
{ { size, SPA_POD_TYPE_OBJECT }, \
|
||||
{ { 0, type }, \
|
||||
SPA_POD_ID_INIT(media_type), \
|
||||
SPA_POD_ID_INIT(media_subtype) } }
|
||||
|
||||
#define SPA_FORMAT_BODY_FOREACH(body, size, iter) \
|
||||
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_BODY_FOREACH(body, size, iter) \
|
||||
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)
|
||||
SPA_FORMAT_BODY_FOREACH(&format->body, SPA_POD_BODY_SIZE(format), iter)
|
||||
|
||||
#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)
|
||||
#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 struct spa_pod_prop *
|
||||
spa_format_find_prop (const struct spa_format *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 (struct spa_format), key);
|
||||
return spa_pod_contents_find_prop(&format->pod, sizeof(struct spa_format), key);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_format_query (const struct spa_format *format, uint32_t key, ...)
|
||||
static inline uint32_t spa_format_query(const struct spa_format *format, uint32_t key, ...)
|
||||
{
|
||||
uint32_t count;
|
||||
va_list args;
|
||||
uint32_t count;
|
||||
va_list args;
|
||||
|
||||
va_start (args, key);
|
||||
count = spa_pod_contents_queryv (&format->pod, sizeof (struct spa_format), key, args);
|
||||
va_end (args);
|
||||
va_start(args, key);
|
||||
count = spa_pod_contents_queryv(&format->pod, sizeof(struct spa_format), key, args);
|
||||
va_end(args);
|
||||
|
||||
return count;
|
||||
return count;
|
||||
}
|
||||
|
||||
static inline int
|
||||
spa_format_fixate (struct spa_format *format)
|
||||
static inline int spa_format_fixate(struct spa_format *format)
|
||||
{
|
||||
struct spa_pod_prop *prop;
|
||||
struct spa_pod_prop *prop;
|
||||
|
||||
SPA_FORMAT_FOREACH (format, prop)
|
||||
prop->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;
|
||||
SPA_FORMAT_FOREACH(format, prop)
|
||||
prop->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -77,10 +77,10 @@ struct spa_format;
|
|||
#define SPA_TYPE_MEDIA_SUBTYPE__gsm SPA_TYPE_MEDIA_SUBTYPE_BASE "gsm"
|
||||
|
||||
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 */
|
||||
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 */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -90,8 +90,8 @@ struct spa_format_body {
|
|||
* @pod: POD object with properties
|
||||
*/
|
||||
struct spa_format {
|
||||
struct spa_pod pod;
|
||||
struct spa_format_body body;
|
||||
struct spa_pod pod;
|
||||
struct spa_format_body body;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -32,190 +32,186 @@ struct spa_graph_node;
|
|||
struct spa_graph_port;
|
||||
|
||||
struct spa_graph {
|
||||
struct spa_list nodes;
|
||||
struct spa_list ready;
|
||||
struct spa_list nodes;
|
||||
struct spa_list ready;
|
||||
};
|
||||
|
||||
typedef int (*spa_graph_node_func_t) (struct spa_graph_node *node);
|
||||
typedef int (*spa_graph_node_func_t) (struct spa_graph_node * node);
|
||||
|
||||
struct spa_graph_node {
|
||||
struct spa_list link;
|
||||
struct spa_list ready_link;
|
||||
struct spa_list ports[2];
|
||||
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;
|
||||
int state;
|
||||
uint32_t flags;
|
||||
int state;
|
||||
#define SPA_GRAPH_ACTION_CHECK 0
|
||||
#define SPA_GRAPH_ACTION_IN 1
|
||||
#define SPA_GRAPH_ACTION_OUT 2
|
||||
uint32_t action;
|
||||
spa_graph_node_func_t schedule;
|
||||
void *user_data;
|
||||
uint32_t max_in;
|
||||
uint32_t required_in;
|
||||
uint32_t ready_in;
|
||||
uint32_t action;
|
||||
spa_graph_node_func_t schedule;
|
||||
void *user_data;
|
||||
uint32_t max_in;
|
||||
uint32_t required_in;
|
||||
uint32_t ready_in;
|
||||
};
|
||||
|
||||
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;
|
||||
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 (struct spa_graph *graph)
|
||||
static inline void spa_graph_init(struct spa_graph *graph)
|
||||
{
|
||||
spa_list_init (&graph->nodes);
|
||||
spa_list_init (&graph->ready);
|
||||
spa_list_init(&graph->nodes);
|
||||
spa_list_init(&graph->ready);
|
||||
}
|
||||
|
||||
static inline int
|
||||
spa_graph_node_schedule_default (struct spa_graph_node *node)
|
||||
static inline int spa_graph_node_schedule_default(struct spa_graph_node *node)
|
||||
{
|
||||
struct spa_node *n = node->user_data;
|
||||
struct spa_node *n = node->user_data;
|
||||
|
||||
if (node->action == SPA_GRAPH_ACTION_IN)
|
||||
return spa_node_process_input (n);
|
||||
else if (node->action == SPA_GRAPH_ACTION_OUT)
|
||||
return spa_node_process_output (n);
|
||||
else
|
||||
return SPA_RESULT_ERROR;
|
||||
if (node->action == SPA_GRAPH_ACTION_IN)
|
||||
return spa_node_process_input(n);
|
||||
else if (node->action == SPA_GRAPH_ACTION_OUT)
|
||||
return spa_node_process_output(n);
|
||||
else
|
||||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_node_add (struct spa_graph *graph, struct spa_graph_node *node, spa_graph_node_func_t 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]);
|
||||
node->flags = 0;
|
||||
node->state = SPA_RESULT_OK;
|
||||
node->action = SPA_GRAPH_ACTION_OUT;
|
||||
node->schedule = schedule;
|
||||
node->user_data = user_data;
|
||||
spa_list_insert (graph->nodes.prev, &node->link);
|
||||
node->max_in = node->required_in = node->ready_in = 0;
|
||||
spa_list_init(&node->ports[SPA_DIRECTION_INPUT]);
|
||||
spa_list_init(&node->ports[SPA_DIRECTION_OUTPUT]);
|
||||
node->flags = 0;
|
||||
node->state = SPA_RESULT_OK;
|
||||
node->action = SPA_GRAPH_ACTION_OUT;
|
||||
node->schedule = schedule;
|
||||
node->user_data = user_data;
|
||||
spa_list_insert(graph->nodes.prev, &node->link);
|
||||
node->max_in = node->required_in = node->ready_in = 0;
|
||||
}
|
||||
|
||||
static inline void spa_graph_port_check(struct spa_graph *graph, struct spa_graph_port *port)
|
||||
{
|
||||
struct spa_graph_node *node = port->node;
|
||||
|
||||
if (port->io->status == SPA_RESULT_HAVE_BUFFER)
|
||||
node->ready_in++;
|
||||
|
||||
if (node->required_in > 0 && node->ready_in == node->required_in) {
|
||||
node->action = SPA_GRAPH_ACTION_IN;
|
||||
if (node->ready_link.next == NULL)
|
||||
spa_list_insert(graph->ready.prev, &node->ready_link);
|
||||
} else if (node->ready_link.next) {
|
||||
spa_list_remove(&node->ready_link);
|
||||
node->ready_link.next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_port_check (struct spa_graph *graph,
|
||||
struct spa_graph_port *port)
|
||||
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)
|
||||
{
|
||||
struct spa_graph_node *node = port->node;
|
||||
port->node = node;
|
||||
port->direction = direction;
|
||||
port->port_id = port_id;
|
||||
port->flags = flags;
|
||||
port->io = io;
|
||||
port->peer = NULL;
|
||||
spa_list_insert(node->ports[port->direction].prev, &port->link);
|
||||
node->max_in++;
|
||||
if (!(port->flags & SPA_PORT_INFO_FLAG_OPTIONAL) && direction == SPA_DIRECTION_INPUT)
|
||||
node->required_in++;
|
||||
spa_graph_port_check(graph, port);
|
||||
}
|
||||
|
||||
if (port->io->status == SPA_RESULT_HAVE_BUFFER)
|
||||
node->ready_in++;
|
||||
static inline void spa_graph_node_remove(struct spa_graph *graph, struct spa_graph_node *node)
|
||||
{
|
||||
spa_list_remove(&node->link);
|
||||
}
|
||||
|
||||
if (node->required_in > 0 && node->ready_in == node->required_in) {
|
||||
node->action = SPA_GRAPH_ACTION_IN;
|
||||
if (node->ready_link.next == NULL)
|
||||
spa_list_insert (graph->ready.prev, &node->ready_link);
|
||||
} else if (node->ready_link.next) {
|
||||
spa_list_remove (&node->ready_link);
|
||||
node->ready_link.next = NULL;
|
||||
}
|
||||
static inline void spa_graph_port_remove(struct spa_graph *graph, struct spa_graph_port *port)
|
||||
{
|
||||
spa_list_remove(&port->link);
|
||||
}
|
||||
|
||||
static inline void
|
||||
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)
|
||||
spa_graph_port_link(struct spa_graph *graph, struct spa_graph_port *out, struct spa_graph_port *in)
|
||||
{
|
||||
port->node = node;
|
||||
port->direction = direction;
|
||||
port->port_id = port_id;
|
||||
port->flags = flags;
|
||||
port->io = io;
|
||||
port->peer = NULL;
|
||||
spa_list_insert (node->ports[port->direction].prev, &port->link);
|
||||
node->max_in++;
|
||||
if (!(port->flags & SPA_PORT_INFO_FLAG_OPTIONAL) && direction == SPA_DIRECTION_INPUT)
|
||||
node->required_in++;
|
||||
spa_graph_port_check (graph, port);
|
||||
out->peer = in;
|
||||
in->peer = out;
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_node_remove (struct spa_graph *graph, struct spa_graph_node *node)
|
||||
spa_graph_port_unlink(struct spa_graph *graph, struct spa_graph_port *out,
|
||||
struct spa_graph_port *in)
|
||||
{
|
||||
spa_list_remove (&node->link);
|
||||
out->peer = NULL;
|
||||
in->peer = NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_graph_port_remove (struct spa_graph *graph, struct spa_graph_port *port)
|
||||
static inline void spa_graph_node_schedule(struct spa_graph *graph, struct spa_graph_node *node)
|
||||
{
|
||||
spa_list_remove (&port->link);
|
||||
}
|
||||
struct spa_graph_port *p;
|
||||
|
||||
static inline void
|
||||
spa_graph_port_link (struct spa_graph *graph, struct spa_graph_port *out, struct spa_graph_port *in)
|
||||
{
|
||||
out->peer = in;
|
||||
in->peer = out;
|
||||
}
|
||||
if (node->ready_link.next == NULL)
|
||||
spa_list_insert(graph->ready.prev, &node->ready_link);
|
||||
|
||||
static inline void
|
||||
spa_graph_port_unlink (struct spa_graph *graph, struct spa_graph_port *out, struct spa_graph_port *in)
|
||||
{
|
||||
out->peer = NULL;
|
||||
in->peer = NULL;
|
||||
}
|
||||
while (!spa_list_is_empty(&graph->ready)) {
|
||||
struct spa_graph_node *n =
|
||||
spa_list_first(&graph->ready, struct spa_graph_node, ready_link);
|
||||
|
||||
static inline void
|
||||
spa_graph_node_schedule (struct spa_graph *graph, struct spa_graph_node *node)
|
||||
{
|
||||
struct spa_graph_port *p;
|
||||
spa_list_remove(&n->ready_link);
|
||||
n->ready_link.next = NULL;
|
||||
|
||||
if (node->ready_link.next == NULL)
|
||||
spa_list_insert (graph->ready.prev, &node->ready_link);
|
||||
switch (n->action) {
|
||||
case SPA_GRAPH_ACTION_IN:
|
||||
case SPA_GRAPH_ACTION_OUT:
|
||||
n->state = n->schedule(n);
|
||||
if (n->action == SPA_GRAPH_ACTION_IN && n == node)
|
||||
continue;
|
||||
n->action = SPA_GRAPH_ACTION_CHECK;
|
||||
spa_list_insert(graph->ready.prev, &n->ready_link);
|
||||
break;
|
||||
|
||||
while (!spa_list_is_empty (&graph->ready)) {
|
||||
struct spa_graph_node *n = spa_list_first (&graph->ready, struct spa_graph_node, ready_link);
|
||||
case SPA_GRAPH_ACTION_CHECK:
|
||||
if (n->state == SPA_RESULT_NEED_BUFFER) {
|
||||
n->ready_in = 0;
|
||||
spa_list_for_each(p, &n->ports[SPA_DIRECTION_INPUT], link) {
|
||||
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;
|
||||
spa_list_insert(graph->ready.prev,
|
||||
&pn->ready_link);
|
||||
}
|
||||
} else if (p->io->status == SPA_RESULT_OK)
|
||||
n->ready_in++;
|
||||
}
|
||||
} else if (n->state == SPA_RESULT_HAVE_BUFFER) {
|
||||
spa_list_for_each(p, &n->ports[SPA_DIRECTION_OUTPUT], link)
|
||||
spa_graph_port_check(graph, p->peer);
|
||||
}
|
||||
break;
|
||||
|
||||
spa_list_remove (&n->ready_link);
|
||||
n->ready_link.next = NULL;
|
||||
|
||||
switch (n->action) {
|
||||
case SPA_GRAPH_ACTION_IN:
|
||||
case SPA_GRAPH_ACTION_OUT:
|
||||
n->state = n->schedule (n);
|
||||
if (n->action == SPA_GRAPH_ACTION_IN && n == node)
|
||||
continue;
|
||||
n->action = SPA_GRAPH_ACTION_CHECK;
|
||||
spa_list_insert (graph->ready.prev, &n->ready_link);
|
||||
break;
|
||||
|
||||
case SPA_GRAPH_ACTION_CHECK:
|
||||
if (n->state == SPA_RESULT_NEED_BUFFER) {
|
||||
n->ready_in = 0;
|
||||
spa_list_for_each (p, &n->ports[SPA_DIRECTION_INPUT], link) {
|
||||
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;
|
||||
spa_list_insert (graph->ready.prev, &pn->ready_link);
|
||||
}
|
||||
}
|
||||
else if (p->io->status == SPA_RESULT_OK)
|
||||
n->ready_in++;
|
||||
}
|
||||
}
|
||||
else if (n->state == SPA_RESULT_HAVE_BUFFER) {
|
||||
spa_list_for_each (p, &n->ports[SPA_DIRECTION_OUTPUT], link)
|
||||
spa_graph_port_check (graph, p->peer);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -27,53 +27,49 @@ extern "C" {
|
|||
#include <spa/defs.h>
|
||||
|
||||
struct spa_list {
|
||||
struct spa_list *next;
|
||||
struct spa_list *prev;
|
||||
struct spa_list *next;
|
||||
struct spa_list *prev;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_list_init (struct spa_list *list)
|
||||
static inline void spa_list_init(struct spa_list *list)
|
||||
{
|
||||
list->next = list;
|
||||
list->prev = list;
|
||||
list->next = list;
|
||||
list->prev = list;
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_list_insert (struct spa_list *list,
|
||||
struct spa_list *elem)
|
||||
static inline void spa_list_insert(struct spa_list *list, struct spa_list *elem)
|
||||
{
|
||||
elem->prev = list;
|
||||
elem->next = list->next;
|
||||
list->next = elem;
|
||||
elem->next->prev = elem;
|
||||
elem->prev = list;
|
||||
elem->next = list->next;
|
||||
list->next = elem;
|
||||
elem->next->prev = elem;
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_list_remove (struct spa_list *elem)
|
||||
static inline void spa_list_remove(struct spa_list *elem)
|
||||
{
|
||||
elem->prev->next = elem->next;
|
||||
elem->next->prev = elem->prev;
|
||||
elem->prev->next = elem->next;
|
||||
elem->next->prev = elem->prev;
|
||||
}
|
||||
|
||||
#define spa_list_is_empty(l) ((l)->next == (l))
|
||||
|
||||
#define spa_list_first(head, type, member) \
|
||||
SPA_CONTAINER_OF((head)->next, type, member)
|
||||
#define spa_list_first(head, type, member) \
|
||||
SPA_CONTAINER_OF((head)->next, type, member)
|
||||
|
||||
#define spa_list_last(item, type, member) \
|
||||
SPA_CONTAINER_OF((head)->prev, type, member)
|
||||
#define spa_list_last(item, type, member) \
|
||||
SPA_CONTAINER_OF((head)->prev, type, member)
|
||||
|
||||
#define spa_list_for_each(pos, head, member) \
|
||||
for (pos = SPA_CONTAINER_OF((head)->next, __typeof__(*pos), member); \
|
||||
&pos->member != (head); \
|
||||
pos = SPA_CONTAINER_OF(pos->member.next, __typeof__(*pos), member))
|
||||
#define spa_list_for_each(pos, head, member) \
|
||||
for (pos = SPA_CONTAINER_OF((head)->next, __typeof__(*pos), member); \
|
||||
&pos->member != (head); \
|
||||
pos = SPA_CONTAINER_OF(pos->member.next, __typeof__(*pos), member))
|
||||
|
||||
#define spa_list_for_each_safe(pos, tmp, head, member) \
|
||||
for (pos = SPA_CONTAINER_OF((head)->next, __typeof__(*pos), member), \
|
||||
tmp = SPA_CONTAINER_OF((pos)->member.next, __typeof__(*tmp), member); \
|
||||
&pos->member != (head); \
|
||||
pos = tmp, \
|
||||
tmp = SPA_CONTAINER_OF(pos->member.next, __typeof__(*tmp), member))
|
||||
#define spa_list_for_each_safe(pos, tmp, head, member) \
|
||||
for (pos = SPA_CONTAINER_OF((head)->next, __typeof__(*pos), member), \
|
||||
tmp = SPA_CONTAINER_OF((pos)->member.next, __typeof__(*tmp), member); \
|
||||
&pos->member != (head); \
|
||||
pos = tmp, \
|
||||
tmp = SPA_CONTAINER_OF(pos->member.next, __typeof__(*tmp), member))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ extern "C" {
|
|||
#include <spa/plugin.h>
|
||||
|
||||
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,
|
||||
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,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -47,88 +47,88 @@ enum spa_log_level {
|
|||
* The Log interface
|
||||
*/
|
||||
struct spa_log {
|
||||
/* the total size of this log. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
/**
|
||||
* struct spa_log::info
|
||||
*
|
||||
* Extra information about the log
|
||||
*/
|
||||
const struct spa_dict *info;
|
||||
/* the total size of this log. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
/**
|
||||
* struct spa_log::info
|
||||
*
|
||||
* Extra information about the log
|
||||
*/
|
||||
const struct spa_dict *info;
|
||||
|
||||
/**
|
||||
* struct spa_log::level
|
||||
*
|
||||
* Logging level, everything above this level is not logged
|
||||
*/
|
||||
enum spa_log_level level;
|
||||
/**
|
||||
* struct spa_log::level
|
||||
*
|
||||
* Logging level, everything above this level is not logged
|
||||
*/
|
||||
enum spa_log_level level;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @fmt: printf style format
|
||||
* @...: format arguments
|
||||
*
|
||||
* Log a message with the given log level.
|
||||
*/
|
||||
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);
|
||||
/**
|
||||
* 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
|
||||
* @fmt: printf style format
|
||||
* @...: format arguments
|
||||
*
|
||||
* Log a message with the given log level.
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @fmt: printf style format
|
||||
* @args: format arguments
|
||||
*
|
||||
* Log a message with the given log level.
|
||||
*/
|
||||
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);
|
||||
/**
|
||||
* 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
|
||||
* @fmt: printf style format
|
||||
* @args: format arguments
|
||||
*
|
||||
* Log a message with the given log level.
|
||||
*/
|
||||
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))
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
|
||||
#define spa_log_log(l,lev,...) \
|
||||
if (SPA_UNLIKELY (spa_log_level_enabled (l, lev))) \
|
||||
(l)->log((l),lev,__VA_ARGS__)
|
||||
#define spa_log_log(l,lev,...) \
|
||||
if (SPA_UNLIKELY (spa_log_level_enabled (l, lev))) \
|
||||
(l)->log((l),lev,__VA_ARGS__)
|
||||
|
||||
#define spa_log_error(l,...) spa_log_log(l,SPA_LOG_LEVEL_ERROR,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||
#define spa_log_warn(l,...) spa_log_log(l,SPA_LOG_LEVEL_WARN,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||
#define spa_log_info(l,...) spa_log_log(l,SPA_LOG_LEVEL_INFO,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||
#define spa_log_debug(l,...) spa_log_log(l,SPA_LOG_LEVEL_DEBUG,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||
#define spa_log_trace(l,...) spa_log_log(l,SPA_LOG_LEVEL_TRACE,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||
#define spa_log_error(l,...) spa_log_log(l,SPA_LOG_LEVEL_ERROR,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||
#define spa_log_warn(l,...) spa_log_log(l,SPA_LOG_LEVEL_WARN,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||
#define spa_log_info(l,...) spa_log_log(l,SPA_LOG_LEVEL_INFO,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||
#define spa_log_debug(l,...) spa_log_log(l,SPA_LOG_LEVEL_DEBUG,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||
#define spa_log_trace(l,...) spa_log_log(l,SPA_LOG_LEVEL_TRACE,__FILE__,__LINE__,__func__,__VA_ARGS__)
|
||||
|
||||
#else
|
||||
|
||||
#define SPA_LOG_FUNC(name,lev) \
|
||||
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; \
|
||||
va_start (varargs, format); \
|
||||
(l)->logv((l),lev,__FILE__,__LINE__,__func__,format,varargs); \
|
||||
va_end (varargs); \
|
||||
} \
|
||||
#define SPA_LOG_FUNC(name,lev) \
|
||||
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; \
|
||||
va_start (varargs, format); \
|
||||
(l)->logv((l),lev,__FILE__,__LINE__,__func__,format,varargs); \
|
||||
va_end (varargs); \
|
||||
} \
|
||||
}
|
||||
|
||||
SPA_LOG_FUNC(error, SPA_LOG_LEVEL_ERROR)
|
||||
|
|
@ -138,9 +138,7 @@ SPA_LOG_FUNC(debug, SPA_LOG_LEVEL_DEBUG)
|
|||
SPA_LOG_FUNC(trace, SPA_LOG_LEVEL_TRACE)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_LOG_H__ */
|
||||
|
|
|
|||
|
|
@ -39,53 +39,54 @@ struct spa_loop_utils;
|
|||
#include <spa/defs.h>
|
||||
|
||||
enum spa_io {
|
||||
SPA_IO_IN = (1 << 0),
|
||||
SPA_IO_OUT = (1 << 1),
|
||||
SPA_IO_HUP = (1 << 2),
|
||||
SPA_IO_ERR = (1 << 3),
|
||||
SPA_IO_IN = (1 << 0),
|
||||
SPA_IO_OUT = (1 << 1),
|
||||
SPA_IO_HUP = (1 << 2),
|
||||
SPA_IO_ERR = (1 << 3),
|
||||
};
|
||||
|
||||
struct spa_source;
|
||||
|
||||
typedef void (*spa_source_func_t) (struct spa_source *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;
|
||||
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);
|
||||
typedef int (*spa_invoke_func_t) (struct spa_loop * loop,
|
||||
bool async,
|
||||
uint32_t seq,
|
||||
size_t size,
|
||||
void *data,
|
||||
void *user_data);
|
||||
/**
|
||||
* spa_loop:
|
||||
*
|
||||
* Register sources and work items to an event loop
|
||||
*/
|
||||
struct spa_loop {
|
||||
/* the total size of this structure. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
/* the total size of this structure. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
|
||||
int (*add_source) (struct spa_loop *loop,
|
||||
struct spa_source *source);
|
||||
int (*update_source) (struct spa_source *source);
|
||||
int (*add_source) (struct spa_loop *loop,
|
||||
struct spa_source *source);
|
||||
|
||||
void (*remove_source) (struct spa_source *source);
|
||||
int (*update_source) (struct spa_source *source);
|
||||
|
||||
int (*invoke) (struct spa_loop *loop,
|
||||
spa_invoke_func_t func,
|
||||
uint32_t seq,
|
||||
size_t size,
|
||||
void *data,
|
||||
void *user_data);
|
||||
void (*remove_source) (struct spa_source *source);
|
||||
|
||||
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 +94,29 @@ struct spa_loop {
|
|||
#define spa_loop_remove_source(l,...) (l)->remove_source(__VA_ARGS__)
|
||||
#define spa_loop_invoke(l,...) (l)->invoke((l),__VA_ARGS__)
|
||||
|
||||
typedef void (*spa_loop_hook_t) (struct spa_loop_control *ctrl,
|
||||
void *data);
|
||||
typedef void (*spa_loop_hook_t) (struct spa_loop_control * ctrl, void *data);
|
||||
|
||||
/**
|
||||
* spa_loop_control:
|
||||
*
|
||||
* Control an event loop
|
||||
*/
|
||||
struct spa_loop_control {
|
||||
/* the total size of this structure. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
/* the total size of this structure. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
|
||||
int (*get_fd) (struct spa_loop_control *ctrl);
|
||||
int (*get_fd) (struct spa_loop_control *ctrl);
|
||||
|
||||
void (*set_hooks) (struct spa_loop_control *ctrl,
|
||||
spa_loop_hook_t pre_hook,
|
||||
spa_loop_hook_t 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) (struct spa_loop_control *ctrl);
|
||||
void (*leave) (struct spa_loop_control *ctrl);
|
||||
void (*enter) (struct spa_loop_control *ctrl);
|
||||
void (*leave) (struct spa_loop_control *ctrl);
|
||||
|
||||
int (*iterate) (struct spa_loop_control *ctrl,
|
||||
int timeout);
|
||||
int (*iterate) (struct spa_loop_control *ctrl, int timeout);
|
||||
};
|
||||
|
||||
#define spa_loop_control_get_fd(l) (l)->get_fd(l)
|
||||
|
|
@ -126,24 +126,18 @@ struct spa_loop_control {
|
|||
#define spa_loop_control_leave(l) (l)->leave(l)
|
||||
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
/**
|
||||
* struct spa_loop_utils:
|
||||
|
|
@ -151,44 +145,38 @@ typedef void (*spa_source_signal_func_t) (struct spa_loop_utils *utils,
|
|||
* Create sources for an event loop
|
||||
*/
|
||||
struct spa_loop_utils {
|
||||
/* the total size of this structure. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
/* the total size of this structure. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
int (*update_io) (struct spa_source * source, enum spa_io mask);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
void (*destroy_source) (struct spa_source *source);
|
||||
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) (struct spa_source * source);
|
||||
};
|
||||
|
||||
#define spa_loop_utils_add_io(l,...) (l)->add_io(l,__VA_ARGS__)
|
||||
|
|
|
|||
|
|
@ -38,23 +38,22 @@ extern "C" {
|
|||
#define SPA_TYPE_META__Shared SPA_TYPE_META_BASE "Shared"
|
||||
|
||||
struct spa_type_meta {
|
||||
uint32_t Header;
|
||||
uint32_t Pointer;
|
||||
uint32_t VideoCrop;
|
||||
uint32_t Ringbuffer;
|
||||
uint32_t Shared;
|
||||
uint32_t Header;
|
||||
uint32_t Pointer;
|
||||
uint32_t VideoCrop;
|
||||
uint32_t Ringbuffer;
|
||||
uint32_t Shared;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_meta_map (struct spa_type_map *map, struct spa_type_meta *type)
|
||||
static inline void spa_type_meta_map(struct spa_type_map *map, struct spa_type_meta *type)
|
||||
{
|
||||
if (type->Header == 0) {
|
||||
type->Header = spa_type_map_get_id (map, SPA_TYPE_META__Header);
|
||||
type->Pointer = spa_type_map_get_id (map, SPA_TYPE_META__Pointer);
|
||||
type->VideoCrop = spa_type_map_get_id (map, SPA_TYPE_META__VideoCrop);
|
||||
type->Ringbuffer = spa_type_map_get_id (map, SPA_TYPE_META__Ringbuffer);
|
||||
type->Shared = spa_type_map_get_id (map, SPA_TYPE_META__Shared);
|
||||
}
|
||||
if (type->Header == 0) {
|
||||
type->Header = spa_type_map_get_id(map, SPA_TYPE_META__Header);
|
||||
type->Pointer = spa_type_map_get_id(map, SPA_TYPE_META__Pointer);
|
||||
type->VideoCrop = spa_type_map_get_id(map, SPA_TYPE_META__VideoCrop);
|
||||
type->Ringbuffer = spa_type_map_get_id(map, SPA_TYPE_META__Ringbuffer);
|
||||
type->Shared = spa_type_map_get_id(map, SPA_TYPE_META__Shared);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -66,21 +65,21 @@ spa_type_meta_map (struct spa_type_map *map, struct spa_type_meta *type)
|
|||
* @dts_offset: offset relative to @pts to start decoding this buffer.
|
||||
*/
|
||||
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 */
|
||||
#define SPA_META_HEADER_FLAG_HEADER (1 << 3) /* data contains a codec specific header */
|
||||
#define SPA_META_HEADER_FLAG_GAP (1 << 4) /* data contains media neutral data */
|
||||
#define SPA_META_HEADER_FLAG_DELTA_UNIT (1 << 5) /* cannot be decoded independently */
|
||||
uint32_t flags;
|
||||
uint32_t seq;
|
||||
int64_t pts;
|
||||
int64_t dts_offset;
|
||||
#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 */
|
||||
#define SPA_META_HEADER_FLAG_HEADER (1 << 3) /* data contains a codec specific header */
|
||||
#define SPA_META_HEADER_FLAG_GAP (1 << 4) /* data contains media neutral data */
|
||||
#define SPA_META_HEADER_FLAG_DELTA_UNIT (1 << 5) /* cannot be decoded independently */
|
||||
uint32_t flags;
|
||||
uint32_t seq;
|
||||
int64_t pts;
|
||||
int64_t dts_offset;
|
||||
};
|
||||
|
||||
struct spa_meta_pointer {
|
||||
uint32_t type;
|
||||
void *ptr;
|
||||
uint32_t type;
|
||||
void *ptr;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -91,8 +90,8 @@ struct spa_meta_pointer {
|
|||
* @height
|
||||
*/
|
||||
struct spa_meta_video_crop {
|
||||
int32_t x, y;
|
||||
int32_t width, height;
|
||||
int32_t x, y;
|
||||
int32_t width, height;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -100,7 +99,7 @@ struct spa_meta_video_crop {
|
|||
* @ringbuffer:
|
||||
*/
|
||||
struct spa_meta_ringbuffer {
|
||||
struct spa_ringbuffer ringbuffer;
|
||||
struct spa_ringbuffer ringbuffer;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -111,10 +110,10 @@ struct spa_meta_ringbuffer {
|
|||
* @size: size of the memory
|
||||
*/
|
||||
struct spa_meta_shared {
|
||||
int32_t flags;
|
||||
int fd;
|
||||
int32_t offset;
|
||||
uint32_t size;
|
||||
int32_t flags;
|
||||
int fd;
|
||||
int32_t offset;
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -124,9 +123,9 @@ struct spa_meta_shared {
|
|||
* @size: size of metadata
|
||||
*/
|
||||
struct spa_meta {
|
||||
uint32_t type;
|
||||
void *data;
|
||||
uint32_t size;
|
||||
uint32_t type;
|
||||
void *data;
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ struct spa_monitor;
|
|||
#define SPA_TYPE_EVENT_MONITOR__Changed SPA_TYPE_EVENT_MONITOR_BASE "Changed"
|
||||
|
||||
struct spa_monitor_item {
|
||||
struct spa_pod_object object;
|
||||
struct spa_pod_object object;
|
||||
};
|
||||
#define SPA_TYPE__MonitorItem SPA_TYPE_POD_OBJECT_BASE "MonitorItem"
|
||||
#define SPA_TYPE_MONITOR_ITEM_BASE SPA_TYPE__MonitorItem ":"
|
||||
|
|
@ -54,43 +54,42 @@ struct spa_monitor_item {
|
|||
#define SPA_TYPE_MONITOR_ITEM__factory SPA_TYPE_MONITOR_ITEM_BASE "factory"
|
||||
|
||||
struct spa_type_monitor {
|
||||
uint32_t Monitor;
|
||||
uint32_t Monitor;
|
||||
|
||||
uint32_t Added;
|
||||
uint32_t Removed;
|
||||
uint32_t Changed;
|
||||
uint32_t Added;
|
||||
uint32_t Removed;
|
||||
uint32_t Changed;
|
||||
|
||||
uint32_t MonitorItem;
|
||||
uint32_t id;
|
||||
uint32_t flags;
|
||||
uint32_t state;
|
||||
uint32_t name;
|
||||
uint32_t klass;
|
||||
uint32_t info;
|
||||
uint32_t factory;
|
||||
uint32_t MonitorItem;
|
||||
uint32_t id;
|
||||
uint32_t flags;
|
||||
uint32_t state;
|
||||
uint32_t name;
|
||||
uint32_t klass;
|
||||
uint32_t info;
|
||||
uint32_t factory;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_monitor_map (struct spa_type_map *map, struct spa_type_monitor *type)
|
||||
static inline void 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);
|
||||
type->Added = spa_type_map_get_id (map, SPA_TYPE_EVENT_MONITOR__Added);
|
||||
type->Removed = spa_type_map_get_id (map, SPA_TYPE_EVENT_MONITOR__Removed);
|
||||
type->Changed = spa_type_map_get_id (map, SPA_TYPE_EVENT_MONITOR__Changed);
|
||||
type->MonitorItem = spa_type_map_get_id (map, SPA_TYPE__MonitorItem);
|
||||
type->id = spa_type_map_get_id (map, SPA_TYPE_MONITOR_ITEM__id);
|
||||
type->flags = spa_type_map_get_id (map, SPA_TYPE_MONITOR_ITEM__flags);
|
||||
type->state = spa_type_map_get_id (map, SPA_TYPE_MONITOR_ITEM__state);
|
||||
type->name = spa_type_map_get_id (map, SPA_TYPE_MONITOR_ITEM__name);
|
||||
type->klass = spa_type_map_get_id (map, SPA_TYPE_MONITOR_ITEM__class);
|
||||
type->info = spa_type_map_get_id (map, SPA_TYPE_MONITOR_ITEM__info);
|
||||
type->factory = spa_type_map_get_id (map, SPA_TYPE_MONITOR_ITEM__factory);
|
||||
}
|
||||
if (type->Monitor == 0) {
|
||||
type->Monitor = spa_type_map_get_id(map, SPA_TYPE__Monitor);
|
||||
type->Added = spa_type_map_get_id(map, SPA_TYPE_EVENT_MONITOR__Added);
|
||||
type->Removed = spa_type_map_get_id(map, SPA_TYPE_EVENT_MONITOR__Removed);
|
||||
type->Changed = spa_type_map_get_id(map, SPA_TYPE_EVENT_MONITOR__Changed);
|
||||
type->MonitorItem = spa_type_map_get_id(map, SPA_TYPE__MonitorItem);
|
||||
type->id = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__id);
|
||||
type->flags = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__flags);
|
||||
type->state = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__state);
|
||||
type->name = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__name);
|
||||
type->klass = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__class);
|
||||
type->info = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__info);
|
||||
type->factory = spa_type_map_get_id(map, SPA_TYPE_MONITOR_ITEM__factory);
|
||||
}
|
||||
}
|
||||
|
||||
enum spa_monitor_item_flags {
|
||||
SPA_MONITOR_ITEM_FLAG_NONE = 0,
|
||||
SPA_MONITOR_ITEM_FLAG_NONE = 0,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -100,18 +99,16 @@ enum spa_monitor_item_flags {
|
|||
* @SPA_MONITOR_ITEM_STATE_UNAVAILABLE: the item is unavailable
|
||||
*/
|
||||
enum spa_monitor_item_state {
|
||||
SPA_MONITOR_ITEM_STATE_AVAILABLE,
|
||||
SPA_MONITOR_ITEM_STATE_DISABLED,
|
||||
SPA_MONITOR_ITEM_STATE_UNAVAILABLE,
|
||||
SPA_MONITOR_ITEM_STATE_AVAILABLE,
|
||||
SPA_MONITOR_ITEM_STATE_DISABLED,
|
||||
SPA_MONITOR_ITEM_STATE_UNAVAILABLE,
|
||||
};
|
||||
|
||||
/**
|
||||
* spa_monitor_callbacks:
|
||||
*/
|
||||
struct spa_monitor_callbacks {
|
||||
void (*event) (struct spa_monitor *monitor,
|
||||
struct spa_event *event,
|
||||
void *user_data);
|
||||
void (*event) (struct spa_monitor * monitor, struct spa_event * event, void *user_data);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -120,36 +117,34 @@ struct spa_monitor_callbacks {
|
|||
* The device monitor interface.
|
||||
*/
|
||||
struct spa_monitor {
|
||||
/**
|
||||
* spa_monitor::info
|
||||
*
|
||||
* Extra information about the monitor
|
||||
*/
|
||||
const struct spa_dict* info;
|
||||
/**
|
||||
* spa_monitor::info
|
||||
*
|
||||
* Extra information about the monitor
|
||||
*/
|
||||
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;
|
||||
/* the total size of this monitor. This can be used to expand this
|
||||
* structure in the future */
|
||||
size_t size;
|
||||
|
||||
/**
|
||||
* spa_monitor::set_callbacks:
|
||||
* @monitor: a #spa_monitor
|
||||
* @callback: a #callbacks
|
||||
* @user_data: extra user data
|
||||
*
|
||||
* Set callbacks to receive asynchronous notifications from
|
||||
* the monitor.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
*/
|
||||
int (*set_callbacks) (struct spa_monitor *monitor,
|
||||
const struct spa_monitor_callbacks *callbacks,
|
||||
size_t callbacks_size,
|
||||
void *user_data);
|
||||
/**
|
||||
* spa_monitor::set_callbacks:
|
||||
* @monitor: a #spa_monitor
|
||||
* @callback: a #callbacks
|
||||
* @user_data: extra user data
|
||||
*
|
||||
* Set callbacks to receive asynchronous notifications from
|
||||
* the monitor.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
*/
|
||||
int (*set_callbacks) (struct spa_monitor * monitor,
|
||||
const struct spa_monitor_callbacks * callbacks,
|
||||
size_t callbacks_size, void *user_data);
|
||||
|
||||
int (*enum_items) (struct spa_monitor *monitor,
|
||||
struct spa_monitor_item **item,
|
||||
uint32_t index);
|
||||
int (*enum_items) (struct spa_monitor * monitor,
|
||||
struct spa_monitor_item ** item, uint32_t index);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -40,24 +40,24 @@ extern "C" {
|
|||
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__align SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "align"
|
||||
|
||||
struct spa_type_param_alloc_buffers {
|
||||
uint32_t Buffers;
|
||||
uint32_t size;
|
||||
uint32_t stride;
|
||||
uint32_t buffers;
|
||||
uint32_t align;
|
||||
uint32_t Buffers;
|
||||
uint32_t size;
|
||||
uint32_t stride;
|
||||
uint32_t buffers;
|
||||
uint32_t align;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_param_alloc_buffers_map (struct spa_type_map *map,
|
||||
struct spa_type_param_alloc_buffers *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);
|
||||
type->size = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_BUFFERS__size);
|
||||
type->stride = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_BUFFERS__stride);
|
||||
type->buffers = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_BUFFERS__buffers);
|
||||
type->align = spa_type_map_get_id (map, SPA_TYPE_PARAM_ALLOC_BUFFERS__align);
|
||||
}
|
||||
if (type->Buffers == 0) {
|
||||
type->Buffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC__Buffers);
|
||||
type->size = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_BUFFERS__size);
|
||||
type->stride = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_BUFFERS__stride);
|
||||
type->buffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_BUFFERS__buffers);
|
||||
type->align = spa_type_map_get_id(map, SPA_TYPE_PARAM_ALLOC_BUFFERS__align);
|
||||
}
|
||||
}
|
||||
|
||||
#define SPA_TYPE_PARAM_ALLOC__MetaEnable SPA_TYPE_PARAM_ALLOC_BASE "MetaEnable"
|
||||
|
|
@ -71,28 +71,28 @@ spa_type_param_alloc_buffers_map (struct spa_type_map *map,
|
|||
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferAlign SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferAlign"
|
||||
|
||||
struct spa_type_param_alloc_meta_enable {
|
||||
uint32_t MetaEnable;
|
||||
uint32_t type;
|
||||
uint32_t size;
|
||||
uint32_t ringbufferSize;
|
||||
uint32_t ringbufferStride;
|
||||
uint32_t ringbufferBlocks;
|
||||
uint32_t ringbufferAlign;
|
||||
uint32_t MetaEnable;
|
||||
uint32_t type;
|
||||
uint32_t size;
|
||||
uint32_t ringbufferSize;
|
||||
uint32_t ringbufferStride;
|
||||
uint32_t ringbufferBlocks;
|
||||
uint32_t ringbufferAlign;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_param_alloc_meta_enable_map (struct spa_type_map *map,
|
||||
struct spa_type_param_alloc_meta_enable *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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
#define SPA_TYPE_PARAM_ALLOC__VideoPadding SPA_TYPE_PARAM_ALLOC_BASE "VideoPadding"
|
||||
|
|
@ -108,34 +108,33 @@ spa_type_param_alloc_meta_enable_map (struct spa_type_map *map,
|
|||
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign3 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign3"
|
||||
|
||||
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];
|
||||
uint32_t VideoPadding;
|
||||
uint32_t top;
|
||||
uint32_t bottom;
|
||||
uint32_t left;
|
||||
uint32_t right;
|
||||
uint32_t strideAlign[4];
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_param_alloc_video_padding_map (struct spa_type_map *map,
|
||||
struct spa_type_param_alloc_video_padding *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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __SPA_PARAM_ALLOC_H__ */
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/pod-utils.h>
|
||||
|
||||
|
|
@ -33,39 +32,37 @@ struct spa_param;
|
|||
#define SPA_TYPE_PARAM_BASE SPA_TYPE__Param ":"
|
||||
|
||||
struct spa_param {
|
||||
struct spa_pod_object object;
|
||||
struct spa_pod_object object;
|
||||
};
|
||||
|
||||
static inline uint32_t
|
||||
spa_param_query (const struct spa_param *param, uint32_t key, ...)
|
||||
static inline uint32_t spa_param_query(const struct spa_param *param, uint32_t key, ...)
|
||||
{
|
||||
uint32_t count;
|
||||
va_list args;
|
||||
uint32_t count;
|
||||
va_list args;
|
||||
|
||||
va_start (args, key);
|
||||
count = spa_pod_contents_queryv (¶m->object.pod, sizeof (struct spa_param), key, args);
|
||||
va_end (args);
|
||||
va_start(args, key);
|
||||
count = spa_pod_contents_queryv(¶m->object.pod, sizeof(struct spa_param), key, args);
|
||||
va_end(args);
|
||||
|
||||
return count;
|
||||
return count;
|
||||
}
|
||||
|
||||
#define SPA_PARAM_BODY_FOREACH(body, size, iter) \
|
||||
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_BODY_FOREACH(body, size, iter) \
|
||||
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->object.body, SPA_POD_BODY_SIZE(param), iter)
|
||||
SPA_PARAM_BODY_FOREACH(¶m->object.body, SPA_POD_BODY_SIZE(param), iter)
|
||||
|
||||
static inline int
|
||||
spa_param_fixate (struct spa_param *param)
|
||||
static inline int spa_param_fixate(struct spa_param *param)
|
||||
{
|
||||
struct spa_pod_prop *prop;
|
||||
struct spa_pod_prop *prop;
|
||||
|
||||
SPA_PARAM_FOREACH (param, prop)
|
||||
prop->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;
|
||||
SPA_PARAM_FOREACH(param, prop)
|
||||
prop->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -31,33 +31,31 @@ extern "C" {
|
|||
#define SPA_TYPE__HandleFactory SPA_TYPE_INTERFACE_BASE "HandleFactory"
|
||||
|
||||
struct spa_handle {
|
||||
/* user_data that can be set by the application */
|
||||
void * user_data;
|
||||
/**
|
||||
* spa_handle::get_interface:
|
||||
* @handle: a #spa_handle
|
||||
* @interface_id: the interface id
|
||||
* @interface: result to hold the interface.
|
||||
*
|
||||
* Get the interface provided by @handle with @interface_id.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no extensions
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when handle or info is %NULL
|
||||
*/
|
||||
int (*get_interface) (struct spa_handle *handle,
|
||||
uint32_t interface_id,
|
||||
void **interface);
|
||||
/**
|
||||
* spa_handle::clear
|
||||
* @handle: a pointer to memory
|
||||
*
|
||||
* Clean up the memory of @handle. After this, @handle should not be used
|
||||
* anymore.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
*/
|
||||
int (*clear) (struct spa_handle *handle);
|
||||
/* user_data that can be set by the application */
|
||||
void *user_data;
|
||||
/**
|
||||
* spa_handle::get_interface:
|
||||
* @handle: a #spa_handle
|
||||
* @interface_id: the interface id
|
||||
* @interface: result to hold the interface.
|
||||
*
|
||||
* Get the interface provided by @handle with @interface_id.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no extensions
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when handle or info is %NULL
|
||||
*/
|
||||
int (*get_interface) (struct spa_handle * handle, uint32_t interface_id, void **interface);
|
||||
/**
|
||||
* spa_handle::clear
|
||||
* @handle: a pointer to memory
|
||||
*
|
||||
* Clean up the memory of @handle. After this, @handle should not be used
|
||||
* anymore.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
*/
|
||||
int (*clear) (struct spa_handle * handle);
|
||||
};
|
||||
|
||||
#define spa_handle_get_interface(h,...) (h)->get_interface((h),__VA_ARGS__)
|
||||
|
|
@ -71,7 +69,7 @@ struct spa_handle {
|
|||
* handles.
|
||||
*/
|
||||
struct spa_interface_info {
|
||||
const char *type;
|
||||
const char *type;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -83,71 +81,71 @@ struct spa_interface_info {
|
|||
* a factory. It can be extra information or interfaces such as logging.
|
||||
*/
|
||||
struct spa_support {
|
||||
const char *type;
|
||||
void *data;
|
||||
const char *type;
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct spa_handle_factory {
|
||||
/**
|
||||
* spa_handle_factory::name
|
||||
*
|
||||
* The name
|
||||
*/
|
||||
const char * name;
|
||||
/**
|
||||
* spa_handle_factory::info
|
||||
*
|
||||
* Extra information about the handles of this factory.
|
||||
*/
|
||||
const struct spa_dict * info;
|
||||
/**
|
||||
* spa_handle_factory::size
|
||||
*
|
||||
* The size of handles from this factory
|
||||
*/
|
||||
const size_t size;
|
||||
/**
|
||||
* spa_handle_factory::name
|
||||
*
|
||||
* The name
|
||||
*/
|
||||
const char *name;
|
||||
/**
|
||||
* spa_handle_factory::info
|
||||
*
|
||||
* Extra information about the handles of this factory.
|
||||
*/
|
||||
const struct spa_dict *info;
|
||||
/**
|
||||
* spa_handle_factory::size
|
||||
*
|
||||
* The size of handles from this factory
|
||||
*/
|
||||
const size_t size;
|
||||
|
||||
/**
|
||||
* spa_handle_factory::init
|
||||
* @factory: a #spa_handle_factory
|
||||
* @handle: a pointer to memory
|
||||
* @info: extra handle specific information, usually obtained
|
||||
* 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 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.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when an instance can't be made
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when factory or handle are %NULL
|
||||
*/
|
||||
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);
|
||||
/**
|
||||
* spa_handle_factory::init
|
||||
* @factory: a #spa_handle_factory
|
||||
* @handle: a pointer to memory
|
||||
* @info: extra handle specific information, usually obtained
|
||||
* 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 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.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when an instance can't be made
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when factory or handle are %NULL
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no interfaces
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when handle or info is %NULL
|
||||
* #SPA_RESULT_ENUM_END when there are no more infos
|
||||
*/
|
||||
int (*enum_interface_info) (const struct spa_handle_factory *factory,
|
||||
const struct spa_interface_info **info,
|
||||
uint32_t index);
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no interfaces
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when handle or info is %NULL
|
||||
* #SPA_RESULT_ENUM_END when there are no more infos
|
||||
*/
|
||||
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__)
|
||||
|
|
@ -164,8 +162,8 @@ struct spa_handle_factory {
|
|||
* #SPA_RESULT_INVALID_ARGUMENTS when factory is %NULL
|
||||
* #SPA_RESULT_ENUM_END when there are no more factories
|
||||
*/
|
||||
typedef int (*spa_handle_factory_enum_func_t) (const struct spa_handle_factory **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"
|
||||
|
||||
|
|
@ -180,8 +178,7 @@ typedef int (*spa_handle_factory_enum_func_t) (const struct spa_handle_factory *
|
|||
* #SPA_RESULT_INVALID_ARGUMENTS when factory is %NULL
|
||||
* #SPA_RESULT_ENUM_END when there are no more factories
|
||||
*/
|
||||
int spa_handle_factory_enum (const struct spa_handle_factory **factory,
|
||||
uint32_t index);
|
||||
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -29,538 +29,519 @@ extern "C" {
|
|||
#include <spa/pod-utils.h>
|
||||
|
||||
struct spa_pod_frame {
|
||||
struct spa_pod_frame *parent;
|
||||
struct spa_pod pod;
|
||||
uint32_t ref;
|
||||
struct spa_pod_frame *parent;
|
||||
struct spa_pod pod;
|
||||
uint32_t ref;
|
||||
};
|
||||
|
||||
struct spa_pod_builder {
|
||||
void *data;
|
||||
uint32_t size;
|
||||
uint32_t offset;
|
||||
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;
|
||||
void *data;
|
||||
uint32_t size;
|
||||
uint32_t offset;
|
||||
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;
|
||||
};
|
||||
|
||||
#define SPA_POD_BUILDER_INIT(buffer,size) { buffer, size, }
|
||||
|
||||
#define SPA_POD_BUILDER_DEREF(b,ref,type) SPA_MEMBER ((b)->data, (ref), type)
|
||||
#define SPA_POD_BUILDER_DEREF(b,ref,type) SPA_MEMBER((b)->data, (ref), type)
|
||||
|
||||
static inline void
|
||||
spa_pod_builder_init (struct spa_pod_builder *builder,
|
||||
void *data,
|
||||
uint32_t size)
|
||||
static inline void spa_pod_builder_init(struct spa_pod_builder *builder, void *data, uint32_t size)
|
||||
{
|
||||
builder->data = data;
|
||||
builder->size = size;
|
||||
builder->offset = 0;
|
||||
builder->stack = NULL;
|
||||
builder->data = data;
|
||||
builder->size = size;
|
||||
builder->offset = 0;
|
||||
builder->stack = NULL;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame,
|
||||
const struct spa_pod *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;
|
||||
frame->ref = ref;
|
||||
builder->stack = frame;
|
||||
builder->in_array = builder->first = (pod->type == SPA_POD_TYPE_ARRAY ||
|
||||
pod->type == SPA_POD_TYPE_PROP);
|
||||
return ref;
|
||||
frame->parent = builder->stack;
|
||||
frame->pod = *pod;
|
||||
frame->ref = ref;
|
||||
builder->stack = frame;
|
||||
builder->in_array = builder->first = (pod->type == SPA_POD_TYPE_ARRAY ||
|
||||
pod->type == SPA_POD_TYPE_PROP);
|
||||
return ref;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_raw (struct spa_pod_builder *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;
|
||||
struct spa_pod_frame *f;
|
||||
uint32_t ref;
|
||||
struct spa_pod_frame *f;
|
||||
|
||||
if (builder->write) {
|
||||
ref = builder->write (builder, -1, data, size);
|
||||
} else {
|
||||
ref = builder->offset;
|
||||
if (ref + size > builder->size)
|
||||
ref = -1;
|
||||
else
|
||||
memcpy (builder->data + ref, data, size);
|
||||
}
|
||||
if (builder->write) {
|
||||
ref = builder->write(builder, -1, data, size);
|
||||
} else {
|
||||
ref = builder->offset;
|
||||
if (ref + size > builder->size)
|
||||
ref = -1;
|
||||
else
|
||||
memcpy(builder->data + ref, data, size);
|
||||
}
|
||||
|
||||
builder->offset += size;
|
||||
for (f = builder->stack; f; f = f->parent)
|
||||
f->pod.size += size;
|
||||
builder->offset += size;
|
||||
for (f = builder->stack; f; f = f->parent)
|
||||
f->pod.size += size;
|
||||
|
||||
return ref;
|
||||
return ref;
|
||||
}
|
||||
|
||||
static void
|
||||
spa_pod_builder_pad (struct spa_pod_builder *builder, uint32_t size)
|
||||
static void spa_pod_builder_pad(struct spa_pod_builder *builder, uint32_t size)
|
||||
{
|
||||
uint64_t zeroes = 0;
|
||||
size = SPA_ROUND_UP_N (size, 8) - size;
|
||||
if (size)
|
||||
spa_pod_builder_raw (builder, &zeroes, size);
|
||||
uint64_t zeroes = 0;
|
||||
size = SPA_ROUND_UP_N(size, 8) - size;
|
||||
if (size)
|
||||
spa_pod_builder_raw(builder, &zeroes, size);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_raw_padded (struct spa_pod_builder *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);
|
||||
return ref;
|
||||
uint32_t ref = size ? spa_pod_builder_raw(builder, data, size) : -1;
|
||||
spa_pod_builder_pad(builder, size);
|
||||
return ref;
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_pod_builder_pop (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame)
|
||||
static inline void 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(struct spa_pod));
|
||||
else
|
||||
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 ||
|
||||
builder->stack->pod.type == SPA_POD_TYPE_PROP));
|
||||
spa_pod_builder_pad (builder, builder->offset);
|
||||
if (frame->ref != -1) {
|
||||
if (builder->write)
|
||||
builder->write(builder, frame->ref, &frame->pod, sizeof(struct spa_pod));
|
||||
else
|
||||
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 ||
|
||||
builder->stack->pod.type == SPA_POD_TYPE_PROP));
|
||||
spa_pod_builder_pad(builder, builder->offset);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_primitive (struct spa_pod_builder *builder, const struct spa_pod *p)
|
||||
spa_pod_builder_primitive(struct spa_pod_builder *builder, const struct spa_pod *p)
|
||||
{
|
||||
const void *data;
|
||||
uint32_t size, ref;
|
||||
const void *data;
|
||||
uint32_t size, ref;
|
||||
|
||||
if (builder->in_array && !builder->first) {
|
||||
data = SPA_POD_BODY_CONST (p);
|
||||
size = SPA_POD_BODY_SIZE (p);
|
||||
} else {
|
||||
data = p;
|
||||
size = SPA_POD_SIZE (p);
|
||||
builder->first = false;
|
||||
}
|
||||
ref = spa_pod_builder_raw (builder, data, size);
|
||||
if (!builder->in_array)
|
||||
spa_pod_builder_pad (builder, size);
|
||||
return ref;
|
||||
if (builder->in_array && !builder->first) {
|
||||
data = SPA_POD_BODY_CONST(p);
|
||||
size = SPA_POD_BODY_SIZE(p);
|
||||
} else {
|
||||
data = p;
|
||||
size = SPA_POD_SIZE(p);
|
||||
builder->first = false;
|
||||
}
|
||||
ref = spa_pod_builder_raw(builder, data, size);
|
||||
if (!builder->in_array)
|
||||
spa_pod_builder_pad(builder, size);
|
||||
return ref;
|
||||
}
|
||||
|
||||
#define SPA_POD_BOOL_INIT(val) { { sizeof (uint32_t), SPA_POD_TYPE_BOOL }, val ? 1 : 0 }
|
||||
#define SPA_POD_BOOL_INIT(val) { { sizeof(uint32_t), SPA_POD_TYPE_BOOL }, val ? 1 : 0 }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_bool (struct spa_pod_builder *builder, bool val)
|
||||
static inline uint32_t spa_pod_builder_bool(struct spa_pod_builder *builder, bool val)
|
||||
{
|
||||
const struct spa_pod_bool p = SPA_POD_BOOL_INIT (val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
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 }
|
||||
#define SPA_POD_ID_INIT(val) { { sizeof(uint32_t), SPA_POD_TYPE_ID }, val }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_id (struct spa_pod_builder *builder, uint32_t val)
|
||||
static inline uint32_t spa_pod_builder_id(struct spa_pod_builder *builder, uint32_t val)
|
||||
{
|
||||
const struct spa_pod_id p = SPA_POD_ID_INIT (val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
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 }
|
||||
#define SPA_POD_INT_INIT(val) { { sizeof(uint32_t), SPA_POD_TYPE_INT }, val }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_int (struct spa_pod_builder *builder, int32_t val)
|
||||
static inline uint32_t spa_pod_builder_int(struct spa_pod_builder *builder, int32_t val)
|
||||
{
|
||||
const struct spa_pod_int p = SPA_POD_INT_INIT (val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
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 }
|
||||
#define SPA_POD_LONG_INIT(val) { { sizeof(uint64_t), SPA_POD_TYPE_LONG }, val }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_long (struct spa_pod_builder *builder, int64_t val)
|
||||
static inline uint32_t spa_pod_builder_long(struct spa_pod_builder *builder, int64_t val)
|
||||
{
|
||||
const struct spa_pod_long p = SPA_POD_LONG_INIT (val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
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 }
|
||||
#define SPA_POD_FLOAT_INIT(val) { { sizeof(float), SPA_POD_TYPE_FLOAT }, val }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_float (struct spa_pod_builder *builder, float val)
|
||||
static inline uint32_t spa_pod_builder_float(struct spa_pod_builder *builder, float val)
|
||||
{
|
||||
const struct spa_pod_float p = SPA_POD_FLOAT_INIT (val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
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 }
|
||||
#define SPA_POD_DOUBLE_INIT(val) { { sizeof(double), SPA_POD_TYPE_DOUBLE }, val }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_double (struct spa_pod_builder *builder, double val)
|
||||
static inline uint32_t spa_pod_builder_double(struct spa_pod_builder *builder, double val)
|
||||
{
|
||||
const struct spa_pod_double p = SPA_POD_DOUBLE_INIT (val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
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 (struct spa_pod_builder *builder, const char *str, uint32_t len)
|
||||
spa_pod_builder_string_len(struct spa_pod_builder *builder, const char *str, uint32_t 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;
|
||||
return ref;
|
||||
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;
|
||||
return ref;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_string (struct spa_pod_builder *builder, const char *str)
|
||||
static inline uint32_t 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);
|
||||
uint32_t len = str ? strlen(str) : 0;
|
||||
return spa_pod_builder_string_len(builder, str ? str : "", len + 1);
|
||||
}
|
||||
|
||||
#define SPA_POD_BYTES_INIT(len) { { len, SPA_POD_TYPE_BYTES } }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_bytes (struct spa_pod_builder *builder, const void *bytes, uint32_t len)
|
||||
spa_pod_builder_bytes(struct spa_pod_builder *builder, const void *bytes, uint32_t 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;
|
||||
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 (struct spa_pod_pointer_body), 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 (struct spa_pod_builder *builder, uint32_t type, void *val)
|
||||
spa_pod_builder_pointer(struct spa_pod_builder *builder, uint32_t type, void *val)
|
||||
{
|
||||
const struct spa_pod_pointer p = SPA_POD_POINTER_INIT (type, val);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
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 (struct spa_rectangle), 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 (struct spa_pod_builder *builder, uint32_t width, uint32_t height)
|
||||
spa_pod_builder_rectangle(struct spa_pod_builder *builder, uint32_t width, uint32_t height)
|
||||
{
|
||||
const struct spa_pod_rectangle p = SPA_POD_RECTANGLE_INIT (width, height);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
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 (struct spa_fraction), 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 (struct spa_pod_builder *builder, uint32_t num, uint32_t denom)
|
||||
spa_pod_builder_fraction(struct spa_pod_builder *builder, uint32_t num, uint32_t denom)
|
||||
{
|
||||
const struct spa_pod_fraction p = SPA_POD_FRACTION_INIT (num, denom);
|
||||
return spa_pod_builder_primitive (builder, &p.pod);
|
||||
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 (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame)
|
||||
spa_pod_builder_push_array(struct spa_pod_builder *builder, struct spa_pod_frame *frame)
|
||||
{
|
||||
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(struct spa_pod)));
|
||||
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(struct spa_pod)));
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_array (struct spa_pod_builder *builder,
|
||||
uint32_t child_size,
|
||||
uint32_t child_type,
|
||||
uint32_t n_elems,
|
||||
const void *elems)
|
||||
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 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));
|
||||
if (spa_pod_builder_raw_padded (builder, elems, child_size * n_elems) == -1)
|
||||
ref = -1;
|
||||
return ref;
|
||||
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));
|
||||
if (spa_pod_builder_raw_padded(builder, elems, child_size * n_elems) == -1)
|
||||
ref = -1;
|
||||
return ref;
|
||||
}
|
||||
|
||||
#define SPA_POD_STRUCT_INIT(size) { { size, SPA_POD_TYPE_STRUCT } }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push_struct (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame)
|
||||
spa_pod_builder_push_struct(struct spa_pod_builder *builder, struct spa_pod_frame *frame)
|
||||
{
|
||||
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)));
|
||||
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)));
|
||||
}
|
||||
|
||||
#define SPA_POD_OBJECT_INIT(size,id,type) { { size, SPA_POD_TYPE_OBJECT }, { id, type } }
|
||||
#define SPA_POD_OBJECT_INIT_COMPLEX(size,id,type,...) { { size, SPA_POD_TYPE_OBJECT }, { id, type }, __VA_ARGS__ }
|
||||
#define SPA_POD_OBJECT_INIT(size,id,type) { { size, SPA_POD_TYPE_OBJECT }, { id, type } }
|
||||
#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 (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame,
|
||||
uint32_t id,
|
||||
uint32_t type)
|
||||
spa_pod_builder_push_object(struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame, uint32_t id, uint32_t 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)));
|
||||
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 (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame,
|
||||
uint32_t key,
|
||||
uint32_t flags)
|
||||
spa_pod_builder_push_prop(struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame, uint32_t key, uint32_t flags)
|
||||
{
|
||||
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(struct spa_pod)));
|
||||
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(struct spa_pod)));
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_pod_builder_addv (struct spa_pod_builder *builder,
|
||||
uint32_t type,
|
||||
va_list args)
|
||||
spa_pod_builder_addv(struct spa_pod_builder *builder, uint32_t type, va_list args)
|
||||
{
|
||||
uint32_t n_values = 0;
|
||||
union {
|
||||
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;
|
||||
uint32_t body_size;
|
||||
static const uint64_t zeroes = 0;
|
||||
uint32_t n_values = 0;
|
||||
union {
|
||||
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;
|
||||
uint32_t body_size;
|
||||
static const uint64_t zeroes = 0;
|
||||
|
||||
while (type != SPA_POD_TYPE_INVALID) {
|
||||
struct spa_pod_frame *f = NULL;
|
||||
const void *data[3];
|
||||
uint32_t size[3], ref, i, n_sizes = 0;
|
||||
while (type != SPA_POD_TYPE_INVALID) {
|
||||
struct spa_pod_frame *f = NULL;
|
||||
const void *data[3];
|
||||
uint32_t size[3], ref, i, n_sizes = 0;
|
||||
|
||||
switch (type) {
|
||||
case SPA_POD_TYPE_NONE:
|
||||
break;
|
||||
case SPA_POD_TYPE_BOOL:
|
||||
case SPA_POD_TYPE_ID:
|
||||
case SPA_POD_TYPE_INT:
|
||||
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 (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 (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 (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 (struct spa_pod);
|
||||
body = &head.double_pod.value;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_STRING:
|
||||
body = va_arg (args, const char *);
|
||||
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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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, 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(struct spa_pod);
|
||||
body = NULL;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_STRUCT:
|
||||
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(struct spa_pod);
|
||||
body = NULL;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_OBJECT:
|
||||
f = va_arg (args, struct spa_pod_frame *);
|
||||
head.object_pod.pod.type = SPA_POD_TYPE_OBJECT;
|
||||
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(struct spa_pod_object);
|
||||
body = NULL;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_PROP:
|
||||
f = va_arg (args, struct spa_pod_frame *);
|
||||
head.prop_pod.pod.type = SPA_POD_TYPE_PROP;
|
||||
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 (struct spa_pod_prop) - sizeof(struct spa_pod);
|
||||
body = NULL;
|
||||
type = va_arg (args, uint32_t);
|
||||
n_values = va_arg (args, uint32_t);
|
||||
goto primitive;
|
||||
case -SPA_POD_TYPE_ARRAY:
|
||||
case -SPA_POD_TYPE_STRUCT:
|
||||
case -SPA_POD_TYPE_OBJECT:
|
||||
case -SPA_POD_TYPE_PROP:
|
||||
f = va_arg (args, struct spa_pod_frame *);
|
||||
spa_pod_builder_pop (builder, f);
|
||||
break;
|
||||
case SPA_POD_TYPE_POD:
|
||||
if ((body = va_arg (args, void *)) == NULL) {
|
||||
head.pod.type = SPA_POD_TYPE_NONE;
|
||||
head.pod.size = 0;
|
||||
body = &head;
|
||||
}
|
||||
body_size = SPA_POD_SIZE (body);
|
||||
goto extra;
|
||||
}
|
||||
if (0) {
|
||||
primitive:
|
||||
if (!builder->in_array || builder->first) {
|
||||
data[n_sizes] = &head;
|
||||
size[n_sizes++] = head_size;
|
||||
builder->first = false;
|
||||
}
|
||||
if (body) {
|
||||
extra:
|
||||
data[n_sizes] = body;
|
||||
size[n_sizes++] = body_size;
|
||||
if (!builder->in_array) {
|
||||
data[n_sizes] = &zeroes;
|
||||
size[n_sizes++] = SPA_ROUND_UP_N (body_size, 8) - body_size;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < n_sizes; i++) {
|
||||
ref = spa_pod_builder_raw (builder, data[i], size[i]);
|
||||
if (f && i == 0)
|
||||
spa_pod_builder_push (builder, f, data[i], ref);
|
||||
}
|
||||
}
|
||||
if (n_values > 0)
|
||||
n_values--;
|
||||
else
|
||||
type = va_arg (args, uint32_t);
|
||||
}
|
||||
switch (type) {
|
||||
case SPA_POD_TYPE_NONE:
|
||||
break;
|
||||
case SPA_POD_TYPE_BOOL:
|
||||
case SPA_POD_TYPE_ID:
|
||||
case SPA_POD_TYPE_INT:
|
||||
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(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(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(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(struct spa_pod);
|
||||
body = &head.double_pod.value;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_STRING:
|
||||
body = va_arg(args, const char *);
|
||||
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(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(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(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(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(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(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(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(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(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(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(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, 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(struct spa_pod);
|
||||
body = NULL;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_STRUCT:
|
||||
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(struct spa_pod);
|
||||
body = NULL;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_OBJECT:
|
||||
f = va_arg(args, struct spa_pod_frame *);
|
||||
head.object_pod.pod.type = SPA_POD_TYPE_OBJECT;
|
||||
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(struct spa_pod_object);
|
||||
body = NULL;
|
||||
goto primitive;
|
||||
case SPA_POD_TYPE_PROP:
|
||||
f = va_arg(args, struct spa_pod_frame *);
|
||||
head.prop_pod.pod.type = SPA_POD_TYPE_PROP;
|
||||
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(struct spa_pod_prop) - sizeof(struct spa_pod);
|
||||
body = NULL;
|
||||
type = va_arg(args, uint32_t);
|
||||
n_values = va_arg(args, uint32_t);
|
||||
goto primitive;
|
||||
case -SPA_POD_TYPE_ARRAY:
|
||||
case -SPA_POD_TYPE_STRUCT:
|
||||
case -SPA_POD_TYPE_OBJECT:
|
||||
case -SPA_POD_TYPE_PROP:
|
||||
f = va_arg(args, struct spa_pod_frame *);
|
||||
spa_pod_builder_pop(builder, f);
|
||||
break;
|
||||
case SPA_POD_TYPE_POD:
|
||||
if ((body = va_arg(args, void *)) == NULL) {
|
||||
head.pod.type = SPA_POD_TYPE_NONE;
|
||||
head.pod.size = 0;
|
||||
body = &head;
|
||||
}
|
||||
body_size = SPA_POD_SIZE(body);
|
||||
goto extra;
|
||||
}
|
||||
if (0) {
|
||||
primitive:
|
||||
if (!builder->in_array || builder->first) {
|
||||
data[n_sizes] = &head;
|
||||
size[n_sizes++] = head_size;
|
||||
builder->first = false;
|
||||
}
|
||||
if (body) {
|
||||
extra:
|
||||
data[n_sizes] = body;
|
||||
size[n_sizes++] = body_size;
|
||||
if (!builder->in_array) {
|
||||
data[n_sizes] = &zeroes;
|
||||
size[n_sizes++] = SPA_ROUND_UP_N(body_size, 8) - body_size;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < n_sizes; i++) {
|
||||
ref = spa_pod_builder_raw(builder, data[i], size[i]);
|
||||
if (f && i == 0)
|
||||
spa_pod_builder_push(builder, f, data[i], ref);
|
||||
}
|
||||
}
|
||||
if (n_values > 0)
|
||||
n_values--;
|
||||
else
|
||||
type = va_arg(args, uint32_t);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_pod_builder_add (struct spa_pod_builder *builder,
|
||||
uint32_t type, ...)
|
||||
static inline void spa_pod_builder_add(struct spa_pod_builder *builder, uint32_t type, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_list args;
|
||||
|
||||
va_start (args, type);
|
||||
spa_pod_builder_addv (builder, type, args);
|
||||
va_end (args);
|
||||
va_start(args, type);
|
||||
spa_pod_builder_addv(builder, type, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#define SPA_POD_OBJECT(f,id,type,...) \
|
||||
SPA_POD_TYPE_OBJECT, f, id, type, __VA_ARGS__, -SPA_POD_TYPE_OBJECT, f
|
||||
#define SPA_POD_OBJECT(f,id,type,...) \
|
||||
SPA_POD_TYPE_OBJECT, f, id, type, __VA_ARGS__, -SPA_POD_TYPE_OBJECT, f
|
||||
|
||||
#define SPA_POD_STRUCT(f,...) \
|
||||
SPA_POD_TYPE_STRUCT, f, __VA_ARGS__, -SPA_POD_TYPE_STRUCT, f
|
||||
#define SPA_POD_STRUCT(f,...) \
|
||||
SPA_POD_TYPE_STRUCT, f, __VA_ARGS__, -SPA_POD_TYPE_STRUCT, f
|
||||
|
||||
#define SPA_POD_PROP(f,key,flags,type,...) \
|
||||
SPA_POD_TYPE_PROP, f, key, flags, type, __VA_ARGS__, -SPA_POD_TYPE_PROP, f
|
||||
#define SPA_POD_PROP(f,key,flags,type,...) \
|
||||
SPA_POD_TYPE_PROP, f, key, flags, type, __VA_ARGS__, -SPA_POD_TYPE_PROP, f
|
||||
|
||||
|
||||
#define spa_pod_builder_object(b,f,id,type,...) \
|
||||
spa_pod_builder_add(b, SPA_POD_OBJECT (f,id,type,__VA_ARGS__), 0)
|
||||
#define spa_pod_builder_object(b,f,id,type,...) \
|
||||
spa_pod_builder_add(b, SPA_POD_OBJECT(f,id,type,__VA_ARGS__), 0)
|
||||
|
||||
#define spa_pod_builder_struct(b,f,...) \
|
||||
spa_pod_builder_add(b, SPA_POD_STRUCT (f,__VA_ARGS__), 0)
|
||||
#define spa_pod_builder_struct(b,f,...) \
|
||||
spa_pod_builder_add(b, SPA_POD_STRUCT(f,__VA_ARGS__), 0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -30,117 +30,107 @@ extern "C" {
|
|||
#include <spa/pod-utils.h>
|
||||
|
||||
struct spa_pod_iter {
|
||||
const void *data;
|
||||
uint32_t size;
|
||||
uint32_t offset;
|
||||
const void *data;
|
||||
uint32_t size;
|
||||
uint32_t offset;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_pod_iter_contents (struct spa_pod_iter *iter, const void *data, uint32_t size)
|
||||
static inline void spa_pod_iter_contents(struct spa_pod_iter *iter, const void *data, uint32_t size)
|
||||
{
|
||||
iter->data = data;
|
||||
iter->size = size;
|
||||
iter->offset = 0;
|
||||
iter->data = data;
|
||||
iter->size = size;
|
||||
iter->offset = 0;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
spa_pod_iter_struct (struct spa_pod_iter *iter, const void *data, uint32_t size)
|
||||
static inline bool 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;
|
||||
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 (struct spa_pod_struct, data),
|
||||
SPA_POD_CONTENTS_SIZE (struct spa_pod_struct, data));
|
||||
return true;
|
||||
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 (struct spa_pod_iter *iter, const void *data, uint32_t size)
|
||||
static inline bool 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;
|
||||
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 (struct spa_pod_object, data),
|
||||
SPA_POD_CONTENTS_SIZE (struct spa_pod_object, data));
|
||||
return true;
|
||||
}
|
||||
static inline bool
|
||||
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 (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 (struct spa_pod_object, pod);
|
||||
size = SPA_POD_CONTENTS_SIZE (struct spa_pod_object, pod);
|
||||
break;
|
||||
default:
|
||||
spa_pod_iter_contents (iter, NULL, 0);
|
||||
return false;
|
||||
}
|
||||
spa_pod_iter_contents (iter, data, size);
|
||||
return true;
|
||||
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_has_next (struct spa_pod_iter *iter)
|
||||
static inline bool spa_pod_iter_pod(struct spa_pod_iter *iter, struct spa_pod *pod)
|
||||
{
|
||||
return (iter->offset + 8 <= iter->size &&
|
||||
SPA_POD_SIZE (SPA_MEMBER (iter->data, iter->offset, struct spa_pod)) <= iter->size);
|
||||
void *data;
|
||||
uint32_t size;
|
||||
|
||||
switch (SPA_POD_TYPE(pod)) {
|
||||
case SPA_POD_TYPE_STRUCT:
|
||||
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(struct spa_pod_object, pod);
|
||||
size = SPA_POD_CONTENTS_SIZE(struct spa_pod_object, pod);
|
||||
break;
|
||||
default:
|
||||
spa_pod_iter_contents(iter, NULL, 0);
|
||||
return false;
|
||||
}
|
||||
spa_pod_iter_contents(iter, data, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline struct spa_pod *
|
||||
spa_pod_iter_next (struct spa_pod_iter *iter)
|
||||
static inline bool spa_pod_iter_has_next(struct spa_pod_iter *iter)
|
||||
{
|
||||
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;
|
||||
return (iter->offset + 8 <= iter->size &&
|
||||
SPA_POD_SIZE(SPA_MEMBER(iter->data, iter->offset, struct spa_pod)) <= iter->size);
|
||||
}
|
||||
|
||||
static inline struct spa_pod *
|
||||
spa_pod_iter_first (struct spa_pod_iter *iter, struct spa_pod *pod)
|
||||
static inline struct spa_pod *spa_pod_iter_next(struct spa_pod_iter *iter)
|
||||
{
|
||||
if (!spa_pod_iter_pod (iter, pod) ||
|
||||
!spa_pod_iter_has_next (iter))
|
||||
return NULL;
|
||||
return spa_pod_iter_next (iter);
|
||||
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 bool
|
||||
spa_pod_iter_getv (struct spa_pod_iter *iter,
|
||||
uint32_t type,
|
||||
va_list args)
|
||||
static inline struct spa_pod *spa_pod_iter_first(struct spa_pod_iter *iter, struct spa_pod *pod)
|
||||
{
|
||||
bool res = true;
|
||||
|
||||
while (type && (res = spa_pod_iter_has_next (iter))) {
|
||||
struct spa_pod *pod = spa_pod_iter_next (iter);
|
||||
|
||||
SPA_POD_COLLECT (pod, type, args, error);
|
||||
|
||||
type = va_arg (args, uint32_t);
|
||||
}
|
||||
return res;
|
||||
error:
|
||||
return false;
|
||||
if (!spa_pod_iter_pod(iter, pod) || !spa_pod_iter_has_next(iter))
|
||||
return NULL;
|
||||
return spa_pod_iter_next(iter);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
spa_pod_iter_get (struct spa_pod_iter *iter, uint32_t type, ...)
|
||||
static inline bool spa_pod_iter_getv(struct spa_pod_iter *iter, uint32_t type, va_list args)
|
||||
{
|
||||
va_list args;
|
||||
bool res;
|
||||
bool res = true;
|
||||
|
||||
va_start (args, type);
|
||||
res = spa_pod_iter_getv (iter, type, args);
|
||||
va_end (args);
|
||||
while (type && (res = spa_pod_iter_has_next(iter))) {
|
||||
struct spa_pod *pod = spa_pod_iter_next(iter);
|
||||
|
||||
return res;
|
||||
SPA_POD_COLLECT(pod, type, args, error);
|
||||
|
||||
type = va_arg(args, uint32_t);
|
||||
}
|
||||
return res;
|
||||
error:
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool spa_pod_iter_get(struct spa_pod_iter *iter, uint32_t type, ...)
|
||||
{
|
||||
va_list args;
|
||||
bool res;
|
||||
|
||||
va_start(args, type);
|
||||
res = spa_pod_iter_getv(iter, type, args);
|
||||
va_end(args);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -40,206 +40,207 @@ extern "C" {
|
|||
|
||||
#define SPA_POD_VALUE(type,pod) (((type*)pod)->value)
|
||||
|
||||
#define SPA_POD_PROP_N_VALUES(prop) (((prop)->pod.size - sizeof (struct spa_pod_prop_body)) / (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 (struct spa_pod *pod, uint32_t type)
|
||||
static inline bool spa_pod_is_object_type(struct spa_pod *pod, uint32_t type)
|
||||
{
|
||||
return (pod->type == SPA_POD_TYPE_OBJECT && ((struct spa_pod_object*)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(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_ARRAY_BODY_FOREACH(body, _size, 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), struct spa_pod); \
|
||||
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), struct spa_pod))
|
||||
#define SPA_POD_FOREACH(pod, size, iter) \
|
||||
for ((iter) = (pod); \
|
||||
(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), struct spa_pod),SPA_POD_SIZE (pod),iter)
|
||||
#define SPA_POD_CONTENTS_FOREACH(pod, offset, 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 (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_BODY_FOREACH(body, size, iter) \
|
||||
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_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 (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)))
|
||||
#define SPA_POD_PROP_ALTERNATIVE_FOREACH(body, _size, 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 struct spa_pod_prop *
|
||||
spa_pod_contents_find_prop (const struct spa_pod *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)
|
||||
{
|
||||
struct spa_pod *res;
|
||||
SPA_POD_CONTENTS_FOREACH (pod, offset, res) {
|
||||
if (res->type == SPA_POD_TYPE_PROP && ((struct spa_pod_prop*)res)->body.key == key)
|
||||
return (struct spa_pod_prop *)res;
|
||||
}
|
||||
return NULL;
|
||||
struct spa_pod *res;
|
||||
SPA_POD_CONTENTS_FOREACH(pod, offset, 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 struct spa_pod_prop *
|
||||
spa_pod_object_find_prop (const struct spa_pod_object *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 (struct spa_pod_object), 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, 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, struct spa_pod **)) = NULL; \
|
||||
break; \
|
||||
default: \
|
||||
goto error; \
|
||||
} \
|
||||
} else if ((pod)->type == type || (pod)->type == -type) { \
|
||||
switch (type) { \
|
||||
case SPA_POD_TYPE_BOOL: \
|
||||
case SPA_POD_TYPE_ID: \
|
||||
case SPA_POD_TYPE_INT: \
|
||||
*(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 (struct spa_pod_long, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_FLOAT: \
|
||||
*(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 (struct spa_pod_double, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_STRING: \
|
||||
*(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 (struct spa_pod_string, pod), maxlen-1); \
|
||||
break; \
|
||||
} \
|
||||
case SPA_POD_TYPE_BYTES: \
|
||||
*(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: \
|
||||
{ \
|
||||
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, struct spa_rectangle *)) = \
|
||||
SPA_POD_VALUE (struct spa_pod_rectangle, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_FRACTION: \
|
||||
*(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 (struct spa_pod, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_ARRAY: \
|
||||
case SPA_POD_TYPE_STRUCT: \
|
||||
case SPA_POD_TYPE_OBJECT: \
|
||||
case SPA_POD_TYPE_PROP: \
|
||||
case -SPA_POD_TYPE_ARRAY: \
|
||||
case -SPA_POD_TYPE_STRUCT: \
|
||||
case -SPA_POD_TYPE_OBJECT: \
|
||||
case -SPA_POD_TYPE_PROP: \
|
||||
*(va_arg (args, struct spa_pod **)) = pod; \
|
||||
break; \
|
||||
default: \
|
||||
goto error; \
|
||||
} \
|
||||
} else \
|
||||
goto error; \
|
||||
} while (false);
|
||||
#define SPA_POD_COLLECT(pod,type,args,error) \
|
||||
do { \
|
||||
if (type == SPA_POD_TYPE_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, struct spa_pod **)) = NULL; \
|
||||
break; \
|
||||
default: \
|
||||
goto error; \
|
||||
} \
|
||||
} else if ((pod)->type == type || (pod)->type == -type) { \
|
||||
switch (type) { \
|
||||
case SPA_POD_TYPE_BOOL: \
|
||||
case SPA_POD_TYPE_ID: \
|
||||
case SPA_POD_TYPE_INT: \
|
||||
*(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(struct spa_pod_long, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_FLOAT: \
|
||||
*(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(struct spa_pod_double, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_STRING: \
|
||||
*(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(struct spa_pod_string, pod), maxlen-1); \
|
||||
break; \
|
||||
} \
|
||||
case SPA_POD_TYPE_BYTES: \
|
||||
*(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: \
|
||||
{ \
|
||||
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, struct spa_rectangle *)) = \
|
||||
SPA_POD_VALUE(struct spa_pod_rectangle, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_FRACTION: \
|
||||
*(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(struct spa_pod, pod); \
|
||||
break; \
|
||||
case SPA_POD_TYPE_ARRAY: \
|
||||
case SPA_POD_TYPE_STRUCT: \
|
||||
case SPA_POD_TYPE_OBJECT: \
|
||||
case SPA_POD_TYPE_PROP: \
|
||||
case -SPA_POD_TYPE_ARRAY: \
|
||||
case -SPA_POD_TYPE_STRUCT: \
|
||||
case -SPA_POD_TYPE_OBJECT: \
|
||||
case -SPA_POD_TYPE_PROP: \
|
||||
*(va_arg(args, struct spa_pod **)) = pod; \
|
||||
break; \
|
||||
default: \
|
||||
goto error; \
|
||||
} \
|
||||
} else \
|
||||
goto error; \
|
||||
} while (false);
|
||||
|
||||
#define SPA_POD_COLLECT_SKIP(type,args) \
|
||||
switch (type) { \
|
||||
case SPA_POD_TYPE_BYTES: \
|
||||
case SPA_POD_TYPE_POINTER: \
|
||||
va_arg (args, void*); \
|
||||
/* fallthrough */ \
|
||||
case SPA_POD_TYPE_BOOL: \
|
||||
case SPA_POD_TYPE_ID: \
|
||||
case SPA_POD_TYPE_INT: \
|
||||
case SPA_POD_TYPE_LONG: \
|
||||
case SPA_POD_TYPE_FLOAT: \
|
||||
case SPA_POD_TYPE_DOUBLE: \
|
||||
case SPA_POD_TYPE_STRING: \
|
||||
case -SPA_POD_TYPE_STRING: \
|
||||
case SPA_POD_TYPE_RECTANGLE: \
|
||||
case SPA_POD_TYPE_FRACTION: \
|
||||
case SPA_POD_TYPE_BITMASK: \
|
||||
case SPA_POD_TYPE_ARRAY: \
|
||||
case SPA_POD_TYPE_STRUCT: \
|
||||
case SPA_POD_TYPE_OBJECT: \
|
||||
case SPA_POD_TYPE_PROP: \
|
||||
case SPA_POD_TYPE_POD: \
|
||||
case -SPA_POD_TYPE_ARRAY: \
|
||||
case -SPA_POD_TYPE_STRUCT: \
|
||||
case -SPA_POD_TYPE_OBJECT: \
|
||||
case -SPA_POD_TYPE_PROP: \
|
||||
va_arg (args, void*); \
|
||||
default: \
|
||||
break; \
|
||||
} \
|
||||
#define SPA_POD_COLLECT_SKIP(type,args) \
|
||||
switch (type) { \
|
||||
case SPA_POD_TYPE_BYTES: \
|
||||
case SPA_POD_TYPE_POINTER: \
|
||||
va_arg (args, void*); \
|
||||
/* fallthrough */ \
|
||||
case SPA_POD_TYPE_BOOL: \
|
||||
case SPA_POD_TYPE_ID: \
|
||||
case SPA_POD_TYPE_INT: \
|
||||
case SPA_POD_TYPE_LONG: \
|
||||
case SPA_POD_TYPE_FLOAT: \
|
||||
case SPA_POD_TYPE_DOUBLE: \
|
||||
case SPA_POD_TYPE_STRING: \
|
||||
case -SPA_POD_TYPE_STRING: \
|
||||
case SPA_POD_TYPE_RECTANGLE: \
|
||||
case SPA_POD_TYPE_FRACTION: \
|
||||
case SPA_POD_TYPE_BITMASK: \
|
||||
case SPA_POD_TYPE_ARRAY: \
|
||||
case SPA_POD_TYPE_STRUCT: \
|
||||
case SPA_POD_TYPE_OBJECT: \
|
||||
case SPA_POD_TYPE_PROP: \
|
||||
case SPA_POD_TYPE_POD: \
|
||||
case -SPA_POD_TYPE_ARRAY: \
|
||||
case -SPA_POD_TYPE_STRUCT: \
|
||||
case -SPA_POD_TYPE_OBJECT: \
|
||||
case -SPA_POD_TYPE_PROP: \
|
||||
va_arg(args, void*); \
|
||||
default: \
|
||||
break; \
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_contents_queryv (const struct spa_pod *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;
|
||||
uint32_t count = 0;
|
||||
|
||||
while (key) {
|
||||
uint32_t type;
|
||||
struct spa_pod_prop *prop = spa_pod_contents_find_prop (pod, offset, key);
|
||||
while (key) {
|
||||
uint32_t type;
|
||||
struct spa_pod_prop *prop = spa_pod_contents_find_prop(pod, offset, key);
|
||||
|
||||
type = va_arg (args, uint32_t);
|
||||
type = va_arg(args, uint32_t);
|
||||
|
||||
if (prop && prop->body.key == key &&
|
||||
!(prop->body.flags & SPA_POD_PROP_FLAG_UNSET)) {
|
||||
SPA_POD_COLLECT (&prop->body.value, type, args, next);
|
||||
count++;
|
||||
} else {
|
||||
SPA_POD_COLLECT_SKIP (type, args);
|
||||
}
|
||||
next:
|
||||
key = va_arg (args, uint32_t);
|
||||
}
|
||||
return count;
|
||||
if (prop && prop->body.key == key && !(prop->body.flags & SPA_POD_PROP_FLAG_UNSET)) {
|
||||
SPA_POD_COLLECT(&prop->body.value, type, args, next);
|
||||
count++;
|
||||
} else {
|
||||
SPA_POD_COLLECT_SKIP(type, args);
|
||||
}
|
||||
next:
|
||||
key = va_arg(args, uint32_t);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_contents_query (const struct spa_pod *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;
|
||||
va_list args;
|
||||
uint32_t count;
|
||||
|
||||
va_start (args, key);
|
||||
count = spa_pod_contents_queryv (pod, offset, key, args);
|
||||
va_end (args);
|
||||
va_start(args, key);
|
||||
count = spa_pod_contents_queryv(pod, offset, key, args);
|
||||
va_end(args);
|
||||
|
||||
return count;
|
||||
return count;
|
||||
}
|
||||
|
||||
#define spa_pod_object_query(object,key, ...) \
|
||||
spa_pod_contents_query (&(object)->pod, sizeof (struct spa_pod_object), key, __VA_ARGS__)
|
||||
spa_pod_contents_query(&(object)->pod, sizeof(struct spa_pod_object), key, __VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -41,117 +41,117 @@ extern "C" {
|
|||
* spa_pod_type:
|
||||
*/
|
||||
enum spa_pod_type {
|
||||
SPA_POD_TYPE_INVALID = 0,
|
||||
SPA_POD_TYPE_NONE = 1,
|
||||
SPA_POD_TYPE_BOOL,
|
||||
SPA_POD_TYPE_ID,
|
||||
SPA_POD_TYPE_INT,
|
||||
SPA_POD_TYPE_LONG,
|
||||
SPA_POD_TYPE_FLOAT,
|
||||
SPA_POD_TYPE_DOUBLE,
|
||||
SPA_POD_TYPE_STRING,
|
||||
SPA_POD_TYPE_BYTES,
|
||||
SPA_POD_TYPE_POINTER,
|
||||
SPA_POD_TYPE_RECTANGLE,
|
||||
SPA_POD_TYPE_FRACTION,
|
||||
SPA_POD_TYPE_BITMASK,
|
||||
SPA_POD_TYPE_ARRAY,
|
||||
SPA_POD_TYPE_STRUCT,
|
||||
SPA_POD_TYPE_OBJECT,
|
||||
SPA_POD_TYPE_PROP,
|
||||
SPA_POD_TYPE_POD,
|
||||
SPA_POD_TYPE_INVALID = 0,
|
||||
SPA_POD_TYPE_NONE = 1,
|
||||
SPA_POD_TYPE_BOOL,
|
||||
SPA_POD_TYPE_ID,
|
||||
SPA_POD_TYPE_INT,
|
||||
SPA_POD_TYPE_LONG,
|
||||
SPA_POD_TYPE_FLOAT,
|
||||
SPA_POD_TYPE_DOUBLE,
|
||||
SPA_POD_TYPE_STRING,
|
||||
SPA_POD_TYPE_BYTES,
|
||||
SPA_POD_TYPE_POINTER,
|
||||
SPA_POD_TYPE_RECTANGLE,
|
||||
SPA_POD_TYPE_FRACTION,
|
||||
SPA_POD_TYPE_BITMASK,
|
||||
SPA_POD_TYPE_ARRAY,
|
||||
SPA_POD_TYPE_STRUCT,
|
||||
SPA_POD_TYPE_OBJECT,
|
||||
SPA_POD_TYPE_PROP,
|
||||
SPA_POD_TYPE_POD,
|
||||
};
|
||||
|
||||
struct spa_pod {
|
||||
uint32_t size;
|
||||
uint32_t type; /* one of spa_pod_type */
|
||||
uint32_t size;
|
||||
uint32_t type; /* one of spa_pod_type */
|
||||
};
|
||||
|
||||
struct spa_pod_int {
|
||||
struct spa_pod pod;
|
||||
int32_t value;
|
||||
int32_t __padding;
|
||||
struct spa_pod pod;
|
||||
int32_t value;
|
||||
int32_t __padding;
|
||||
};
|
||||
|
||||
struct spa_pod_bool {
|
||||
struct spa_pod pod;
|
||||
int32_t value;
|
||||
int32_t __padding;
|
||||
struct spa_pod pod;
|
||||
int32_t value;
|
||||
int32_t __padding;
|
||||
};
|
||||
|
||||
struct spa_pod_id {
|
||||
struct spa_pod pod;
|
||||
int32_t value;
|
||||
int32_t __padding;
|
||||
struct spa_pod pod;
|
||||
int32_t value;
|
||||
int32_t __padding;
|
||||
};
|
||||
|
||||
struct spa_pod_long {
|
||||
struct spa_pod pod;
|
||||
int64_t value;
|
||||
struct spa_pod pod;
|
||||
int64_t value;
|
||||
};
|
||||
|
||||
struct spa_pod_float {
|
||||
struct spa_pod pod;
|
||||
float value;
|
||||
struct spa_pod pod;
|
||||
float value;
|
||||
};
|
||||
|
||||
struct spa_pod_double {
|
||||
struct spa_pod pod;
|
||||
double value;
|
||||
struct spa_pod pod;
|
||||
double value;
|
||||
};
|
||||
|
||||
struct spa_pod_string {
|
||||
struct spa_pod pod;
|
||||
/* value here */
|
||||
struct spa_pod pod;
|
||||
/* value here */
|
||||
};
|
||||
|
||||
struct spa_pod_bytes {
|
||||
struct spa_pod pod;
|
||||
/* value here */
|
||||
struct spa_pod pod;
|
||||
/* value here */
|
||||
};
|
||||
|
||||
struct spa_pod_pointer_body {
|
||||
uint32_t type;
|
||||
void *value;
|
||||
uint32_t type;
|
||||
void *value;
|
||||
};
|
||||
|
||||
struct spa_pod_pointer {
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_pointer_body body;
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_pointer_body body;
|
||||
};
|
||||
|
||||
struct spa_pod_rectangle {
|
||||
struct spa_pod pod;
|
||||
struct spa_rectangle value;
|
||||
struct spa_pod pod;
|
||||
struct spa_rectangle value;
|
||||
};
|
||||
|
||||
struct spa_pod_fraction {
|
||||
struct spa_pod pod;
|
||||
struct spa_fraction value;
|
||||
struct spa_pod pod;
|
||||
struct spa_fraction value;
|
||||
};
|
||||
|
||||
struct spa_pod_bitmap {
|
||||
struct spa_pod pod;
|
||||
/* array of uint8_t follows with the bitmap */
|
||||
struct spa_pod pod;
|
||||
/* array of uint8_t follows with the bitmap */
|
||||
};
|
||||
|
||||
struct spa_pod_array_body {
|
||||
struct spa_pod child;
|
||||
/* array with elements of child.size follows */
|
||||
struct spa_pod child;
|
||||
/* array with elements of child.size follows */
|
||||
};
|
||||
|
||||
struct spa_pod_array {
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_array_body body;
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_array_body body;
|
||||
};
|
||||
|
||||
struct spa_pod_struct {
|
||||
struct spa_pod pod;
|
||||
/* one or more spa_pod follow */
|
||||
struct spa_pod pod;
|
||||
/* one or more spa_pod follow */
|
||||
};
|
||||
|
||||
struct spa_pod_prop_body {
|
||||
uint32_t key;
|
||||
uint32_t key;
|
||||
#define SPA_POD_PROP_RANGE_NONE 0
|
||||
#define SPA_POD_PROP_RANGE_MIN_MAX 1
|
||||
#define SPA_POD_PROP_RANGE_STEP 2
|
||||
|
|
@ -162,26 +162,26 @@ struct spa_pod_prop_body {
|
|||
#define SPA_POD_PROP_FLAG_OPTIONAL (1 << 5)
|
||||
#define SPA_POD_PROP_FLAG_READONLY (1 << 6)
|
||||
#define SPA_POD_PROP_FLAG_DEPRECATED (1 << 7)
|
||||
uint32_t flags;
|
||||
struct spa_pod value;
|
||||
/* array with elements of value.size follows,
|
||||
* first element is value/default, rest are alternatives */
|
||||
uint32_t flags;
|
||||
struct spa_pod value;
|
||||
/* array with elements of value.size follows,
|
||||
* first element is value/default, rest are alternatives */
|
||||
};
|
||||
|
||||
struct spa_pod_prop {
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_prop_body body;
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_prop_body body;
|
||||
};
|
||||
|
||||
struct spa_pod_object_body {
|
||||
uint32_t id;
|
||||
uint32_t type;
|
||||
/* contents follow, series of spa_pod_prop */
|
||||
uint32_t id;
|
||||
uint32_t type;
|
||||
/* contents follow, series of spa_pod_prop */
|
||||
};
|
||||
|
||||
struct spa_pod_object {
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_object_body body;
|
||||
struct spa_pod pod;
|
||||
struct spa_pod_object_body body;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ extern "C" {
|
|||
#include <spa/pod-builder.h>
|
||||
|
||||
struct spa_props {
|
||||
struct spa_pod_object object;
|
||||
struct spa_pod_object object;
|
||||
};
|
||||
|
||||
#define SPA_TYPE__Props SPA_TYPE_POD_OBJECT_BASE "Props"
|
||||
|
|
@ -51,27 +51,26 @@ struct spa_props {
|
|||
#define SPA_TYPE_PROPS__patternType SPA_TYPE_PROPS_BASE "patternType"
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push_props (struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame,
|
||||
uint32_t props_type)
|
||||
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);
|
||||
return spa_pod_builder_push_object(builder, frame, 0, props_type);
|
||||
}
|
||||
|
||||
#define spa_pod_builder_props(b,f,props_type,...) \
|
||||
spa_pod_builder_object(b, f, 0, props_type,__VA_ARGS__)
|
||||
spa_pod_builder_object(b, f, 0, props_type,__VA_ARGS__)
|
||||
|
||||
static inline uint32_t
|
||||
spa_props_query (const struct spa_props *props, uint32_t key, ...)
|
||||
static inline uint32_t spa_props_query(const struct spa_props *props, uint32_t key, ...)
|
||||
{
|
||||
uint32_t count;
|
||||
va_list args;
|
||||
uint32_t count;
|
||||
va_list args;
|
||||
|
||||
va_start (args, key);
|
||||
count = spa_pod_contents_queryv (&props->object.pod, sizeof (struct spa_props), key, args);
|
||||
va_end (args);
|
||||
va_start(args, key);
|
||||
count = spa_pod_contents_queryv(&props->object.pod, sizeof(struct spa_props), key, args);
|
||||
va_end(args);
|
||||
|
||||
return count;
|
||||
return count;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ struct spa_ringbuffer;
|
|||
* @mask: mask as @size - 1
|
||||
*/
|
||||
struct spa_ringbuffer {
|
||||
uint32_t readindex;
|
||||
uint32_t writeindex;
|
||||
uint32_t size;
|
||||
uint32_t mask;
|
||||
uint32_t readindex;
|
||||
uint32_t writeindex;
|
||||
uint32_t size;
|
||||
uint32_t mask;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -57,19 +57,17 @@ struct spa_ringbuffer {
|
|||
*
|
||||
* Returns: %SPA_RESULT_OK, unless size is not a power of 2.
|
||||
*/
|
||||
static inline int
|
||||
spa_ringbuffer_init (struct spa_ringbuffer *rbuf,
|
||||
uint32_t size)
|
||||
static inline int spa_ringbuffer_init(struct spa_ringbuffer *rbuf, uint32_t size)
|
||||
{
|
||||
if (SPA_UNLIKELY ((size & (size - 1)) != 0))
|
||||
return SPA_RESULT_ERROR;
|
||||
if (SPA_UNLIKELY((size & (size - 1)) != 0))
|
||||
return SPA_RESULT_ERROR;
|
||||
|
||||
rbuf->size = size;
|
||||
rbuf->mask = size - 1;
|
||||
rbuf->readindex = 0;
|
||||
rbuf->writeindex = 0;
|
||||
rbuf->size = size;
|
||||
rbuf->mask = size - 1;
|
||||
rbuf->readindex = 0;
|
||||
rbuf->writeindex = 0;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -78,11 +76,10 @@ spa_ringbuffer_init (struct spa_ringbuffer *rbuf,
|
|||
*
|
||||
* Clear @rbuf
|
||||
*/
|
||||
static inline void
|
||||
spa_ringbuffer_clear (struct spa_ringbuffer *rbuf)
|
||||
static inline void spa_ringbuffer_clear(struct spa_ringbuffer *rbuf)
|
||||
{
|
||||
rbuf->readindex = 0;
|
||||
rbuf->writeindex = 0;
|
||||
rbuf->readindex = 0;
|
||||
rbuf->writeindex = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -95,16 +92,14 @@ spa_ringbuffer_clear (struct spa_ringbuffer *rbuf)
|
|||
* there was an underrun. values > rbuf->size means there
|
||||
* was an overrun.
|
||||
*/
|
||||
static inline int32_t
|
||||
spa_ringbuffer_get_read_index (struct spa_ringbuffer *rbuf,
|
||||
uint32_t *index)
|
||||
static inline int32_t spa_ringbuffer_get_read_index(struct spa_ringbuffer *rbuf, uint32_t * index)
|
||||
{
|
||||
int32_t avail;
|
||||
int32_t avail;
|
||||
|
||||
*index = __atomic_load_n (&rbuf->readindex, __ATOMIC_RELAXED);
|
||||
avail = (int32_t) (__atomic_load_n (&rbuf->writeindex, __ATOMIC_ACQUIRE) - *index);
|
||||
*index = __atomic_load_n(&rbuf->readindex, __ATOMIC_RELAXED);
|
||||
avail = (int32_t) (__atomic_load_n(&rbuf->writeindex, __ATOMIC_ACQUIRE) - *index);
|
||||
|
||||
return avail;
|
||||
return avail;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -119,17 +114,14 @@ spa_ringbuffer_get_read_index (struct spa_ringbuffer *rbuf,
|
|||
* with the size of @rbuf and len should be smaller than the size.
|
||||
*/
|
||||
static inline void
|
||||
spa_ringbuffer_read_data (struct spa_ringbuffer *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);
|
||||
if (SPA_UNLIKELY (len > first)) {
|
||||
memcpy (data + first, buffer, len - first);
|
||||
}
|
||||
uint32_t first = SPA_MIN(len, rbuf->size - offset);
|
||||
memcpy(data, buffer + offset, first);
|
||||
if (SPA_UNLIKELY(len > first)) {
|
||||
memcpy(data + first, buffer, len - first);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -139,11 +131,9 @@ spa_ringbuffer_read_data (struct spa_ringbuffer *rbuf,
|
|||
*
|
||||
* Update the read pointer to @index
|
||||
*/
|
||||
static inline void
|
||||
spa_ringbuffer_read_update (struct spa_ringbuffer *rbuf,
|
||||
int32_t index)
|
||||
static inline void spa_ringbuffer_read_update(struct spa_ringbuffer *rbuf, int32_t index)
|
||||
{
|
||||
__atomic_store_n (&rbuf->readindex, index, __ATOMIC_RELEASE);
|
||||
__atomic_store_n(&rbuf->readindex, index, __ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -157,30 +147,25 @@ spa_ringbuffer_read_update (struct spa_ringbuffer *rbuf,
|
|||
* was an overrun. Subtract from the buffer size to get
|
||||
* the number of bytes available for writing.
|
||||
*/
|
||||
static inline int32_t
|
||||
spa_ringbuffer_get_write_index (struct spa_ringbuffer *rbuf,
|
||||
uint32_t *index)
|
||||
static inline int32_t spa_ringbuffer_get_write_index(struct spa_ringbuffer *rbuf, uint32_t * index)
|
||||
{
|
||||
int32_t filled;
|
||||
int32_t filled;
|
||||
|
||||
*index = __atomic_load_n (&rbuf->writeindex, __ATOMIC_RELAXED);
|
||||
filled = (int32_t) (*index - __atomic_load_n (&rbuf->readindex, __ATOMIC_ACQUIRE));
|
||||
*index = __atomic_load_n(&rbuf->writeindex, __ATOMIC_RELAXED);
|
||||
filled = (int32_t) (*index - __atomic_load_n(&rbuf->readindex, __ATOMIC_ACQUIRE));
|
||||
|
||||
return filled;
|
||||
return filled;
|
||||
}
|
||||
|
||||
static inline void
|
||||
spa_ringbuffer_write_data (struct spa_ringbuffer *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);
|
||||
if (SPA_UNLIKELY (len > first)) {
|
||||
memcpy (buffer, data + first, len - first);
|
||||
}
|
||||
uint32_t first = SPA_MIN(len, rbuf->size - offset);
|
||||
memcpy(buffer + offset, data, first);
|
||||
if (SPA_UNLIKELY(len > first)) {
|
||||
memcpy(buffer, data + first, len - first);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -191,11 +176,9 @@ spa_ringbuffer_write_data (struct spa_ringbuffer *rbuf,
|
|||
* Update the write pointer to @index
|
||||
*
|
||||
*/
|
||||
static inline void
|
||||
spa_ringbuffer_write_update (struct spa_ringbuffer *rbuf,
|
||||
int32_t index)
|
||||
static inline void spa_ringbuffer_write_update(struct spa_ringbuffer *rbuf, int32_t index)
|
||||
{
|
||||
__atomic_store_n (&rbuf->writeindex, index, __ATOMIC_RELEASE);
|
||||
__atomic_store_n(&rbuf->writeindex, index, __ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,23 +36,21 @@ extern "C" {
|
|||
* Maps between string types and their type id
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* spa_type_map::info
|
||||
*
|
||||
* Extra information about the type map
|
||||
*/
|
||||
const struct spa_dict *info;
|
||||
/* the total size of this structure. This can be used to expand this
|
||||
* structure in the future */
|
||||
const size_t size;
|
||||
/**
|
||||
* spa_type_map::info
|
||||
*
|
||||
* Extra information about the type map
|
||||
*/
|
||||
const struct spa_dict *info;
|
||||
|
||||
uint32_t (*get_id) (struct spa_type_map *map,
|
||||
const char *type);
|
||||
uint32_t (*get_id) (struct spa_type_map * map, const char *type);
|
||||
|
||||
const char * (*get_type) (const struct spa_type_map *map,
|
||||
uint32_t id);
|
||||
const char *(*get_type) (const struct spa_type_map * map, uint32_t id);
|
||||
|
||||
size_t (*get_size) (const struct spa_type_map *map);
|
||||
size_t (*get_size) (const struct spa_type_map * map);
|
||||
};
|
||||
|
||||
#define spa_type_map_get_id(n,...) (n)->get_id((n),__VA_ARGS__)
|
||||
|
|
|
|||
|
|
@ -40,10 +40,9 @@ extern "C" {
|
|||
#define SPA_TYPE__Object SPA_TYPE_BASE "Object"
|
||||
#define SPA_TYPE_OBJECT_BASE SPA_TYPE__Object ":"
|
||||
|
||||
static inline bool
|
||||
spa_type_is_a (const char *type, const char *parent)
|
||||
static inline bool spa_type_is_a(const char *type, const char *parent)
|
||||
{
|
||||
return type != NULL && parent != NULL && strncmp (type, parent, strlen (parent)) == 0;
|
||||
return type != NULL && parent != NULL && strncmp(type, parent, strlen(parent)) == 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -39,20 +39,20 @@ extern "C" {
|
|||
* Various Chroma sitings.
|
||||
*/
|
||||
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),
|
||||
SPA_VIDEO_CHROMA_SITE_V_COSITED = (1 << 2),
|
||||
SPA_VIDEO_CHROMA_SITE_ALT_LINE = (1 << 3),
|
||||
/* some common chroma cositing */
|
||||
SPA_VIDEO_CHROMA_SITE_COSITED = (SPA_VIDEO_CHROMA_SITE_H_COSITED | SPA_VIDEO_CHROMA_SITE_V_COSITED),
|
||||
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),
|
||||
SPA_VIDEO_CHROMA_SITE_UNKNOWN = 0,
|
||||
SPA_VIDEO_CHROMA_SITE_NONE = (1 << 0),
|
||||
SPA_VIDEO_CHROMA_SITE_H_COSITED = (1 << 1),
|
||||
SPA_VIDEO_CHROMA_SITE_V_COSITED = (1 << 2),
|
||||
SPA_VIDEO_CHROMA_SITE_ALT_LINE = (1 << 3),
|
||||
/* some common chroma cositing */
|
||||
SPA_VIDEO_CHROMA_SITE_COSITED = (SPA_VIDEO_CHROMA_SITE_H_COSITED | SPA_VIDEO_CHROMA_SITE_V_COSITED),
|
||||
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),
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_VIDEO_CHROMA_H__ */
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ extern "C" {
|
|||
* values and can be scaled for other bit depths.
|
||||
*/
|
||||
enum spa_video_color_range {
|
||||
SPA_VIDEO_COLOR_RANGE_UNKNOWN = 0,
|
||||
SPA_VIDEO_COLOR_RANGE_0_255,
|
||||
SPA_VIDEO_COLOR_RANGE_16_235
|
||||
SPA_VIDEO_COLOR_RANGE_UNKNOWN = 0,
|
||||
SPA_VIDEO_COLOR_RANGE_0_255,
|
||||
SPA_VIDEO_COLOR_RANGE_16_235
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -54,13 +54,13 @@ enum spa_video_color_range {
|
|||
* non-linear RGB (R'G'B')
|
||||
*/
|
||||
enum spa_video_color_matrix {
|
||||
SPA_VIDEO_COLOR_MATRIX_UNKNOWN = 0,
|
||||
SPA_VIDEO_COLOR_MATRIX_RGB,
|
||||
SPA_VIDEO_COLOR_MATRIX_FCC,
|
||||
SPA_VIDEO_COLOR_MATRIX_BT709,
|
||||
SPA_VIDEO_COLOR_MATRIX_BT601,
|
||||
SPA_VIDEO_COLOR_MATRIX_SMPTE240M,
|
||||
SPA_VIDEO_COLOR_MATRIX_BT2020
|
||||
SPA_VIDEO_COLOR_MATRIX_UNKNOWN = 0,
|
||||
SPA_VIDEO_COLOR_MATRIX_RGB,
|
||||
SPA_VIDEO_COLOR_MATRIX_FCC,
|
||||
SPA_VIDEO_COLOR_MATRIX_BT709,
|
||||
SPA_VIDEO_COLOR_MATRIX_BT601,
|
||||
SPA_VIDEO_COLOR_MATRIX_SMPTE240M,
|
||||
SPA_VIDEO_COLOR_MATRIX_BT2020
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -90,19 +90,19 @@ enum spa_video_color_matrix {
|
|||
* non-linear RGB (R'G'B') and linear RGB
|
||||
*/
|
||||
enum spa_video_transfer_function {
|
||||
SPA_VIDEO_TRANSFER_UNKNOWN = 0,
|
||||
SPA_VIDEO_TRANSFER_GAMMA10,
|
||||
SPA_VIDEO_TRANSFER_GAMMA18,
|
||||
SPA_VIDEO_TRANSFER_GAMMA20,
|
||||
SPA_VIDEO_TRANSFER_GAMMA22,
|
||||
SPA_VIDEO_TRANSFER_BT709,
|
||||
SPA_VIDEO_TRANSFER_SMPTE240M,
|
||||
SPA_VIDEO_TRANSFER_SRGB,
|
||||
SPA_VIDEO_TRANSFER_GAMMA28,
|
||||
SPA_VIDEO_TRANSFER_LOG100,
|
||||
SPA_VIDEO_TRANSFER_LOG316,
|
||||
SPA_VIDEO_TRANSFER_BT2020_12,
|
||||
SPA_VIDEO_TRANSFER_ADOBERGB
|
||||
SPA_VIDEO_TRANSFER_UNKNOWN = 0,
|
||||
SPA_VIDEO_TRANSFER_GAMMA10,
|
||||
SPA_VIDEO_TRANSFER_GAMMA18,
|
||||
SPA_VIDEO_TRANSFER_GAMMA20,
|
||||
SPA_VIDEO_TRANSFER_GAMMA22,
|
||||
SPA_VIDEO_TRANSFER_BT709,
|
||||
SPA_VIDEO_TRANSFER_SMPTE240M,
|
||||
SPA_VIDEO_TRANSFER_SRGB,
|
||||
SPA_VIDEO_TRANSFER_GAMMA28,
|
||||
SPA_VIDEO_TRANSFER_LOG100,
|
||||
SPA_VIDEO_TRANSFER_LOG316,
|
||||
SPA_VIDEO_TRANSFER_BT2020_12,
|
||||
SPA_VIDEO_TRANSFER_ADOBERGB
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -121,15 +121,15 @@ enum spa_video_transfer_function {
|
|||
* the CIE XYZ colorspace.
|
||||
*/
|
||||
enum spa_video_color_primaries {
|
||||
SPA_VIDEO_COLOR_PRIMARIES_UNKNOWN = 0,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_BT709,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_BT470M,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_BT470BG,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_SMPTE170M,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_SMPTE240M,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_FILM,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_BT2020,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_ADOBERGB
|
||||
SPA_VIDEO_COLOR_PRIMARIES_UNKNOWN = 0,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_BT709,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_BT470M,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_BT470BG,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_SMPTE170M,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_SMPTE240M,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_FILM,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_BT2020,
|
||||
SPA_VIDEO_COLOR_PRIMARIES_ADOBERGB
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -144,14 +144,14 @@ enum spa_video_color_primaries {
|
|||
* Structure describing the color info.
|
||||
*/
|
||||
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;
|
||||
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" */
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_VIDEO_COLOR_H__ */
|
||||
|
|
|
|||
|
|
@ -31,34 +31,34 @@ struct spa_video_info_mjpg;
|
|||
#include <spa/video/format.h>
|
||||
|
||||
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
|
||||
SPA_H264_STREAM_FORMAT_UNKNOWN = 0,
|
||||
SPA_H264_STREAM_FORMAT_AVC,
|
||||
SPA_H264_STREAM_FORMAT_AVC3,
|
||||
SPA_H264_STREAM_FORMAT_BYTESTREAM
|
||||
};
|
||||
|
||||
enum spa_h264_alignment {
|
||||
SPA_H264_ALIGNMENT_UNKNOWN = 0,
|
||||
SPA_H264_ALIGNMENT_AU,
|
||||
SPA_H264_ALIGNMENT_NAL
|
||||
SPA_H264_ALIGNMENT_UNKNOWN = 0,
|
||||
SPA_H264_ALIGNMENT_AU,
|
||||
SPA_H264_ALIGNMENT_NAL
|
||||
};
|
||||
|
||||
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_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;
|
||||
struct spa_rectangle size;
|
||||
struct spa_fraction framerate;
|
||||
struct spa_fraction max_framerate;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_VIDEO_ENCODED_H__ */
|
||||
|
|
|
|||
|
|
@ -29,105 +29,99 @@ extern "C" {
|
|||
#include <spa/video/raw-utils.h>
|
||||
|
||||
struct spa_type_format_video {
|
||||
uint32_t format;
|
||||
uint32_t size;
|
||||
uint32_t framerate;
|
||||
uint32_t max_framerate;
|
||||
uint32_t views;
|
||||
uint32_t interlace_mode;
|
||||
uint32_t pixel_aspect_ratio;
|
||||
uint32_t multiview_mode;
|
||||
uint32_t multiview_flags;
|
||||
uint32_t chroma_site;
|
||||
uint32_t color_range;
|
||||
uint32_t color_matrix;
|
||||
uint32_t transfer_function;
|
||||
uint32_t color_primaries;
|
||||
uint32_t profile;
|
||||
uint32_t level;
|
||||
uint32_t stream_format;
|
||||
uint32_t alignment;
|
||||
uint32_t format;
|
||||
uint32_t size;
|
||||
uint32_t framerate;
|
||||
uint32_t max_framerate;
|
||||
uint32_t views;
|
||||
uint32_t interlace_mode;
|
||||
uint32_t pixel_aspect_ratio;
|
||||
uint32_t multiview_mode;
|
||||
uint32_t multiview_flags;
|
||||
uint32_t chroma_site;
|
||||
uint32_t color_range;
|
||||
uint32_t color_matrix;
|
||||
uint32_t transfer_function;
|
||||
uint32_t color_primaries;
|
||||
uint32_t profile;
|
||||
uint32_t level;
|
||||
uint32_t stream_format;
|
||||
uint32_t alignment;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_format_video_map (struct spa_type_map *map, struct spa_type_format_video *type)
|
||||
spa_type_format_video_map(struct spa_type_map *map, struct spa_type_format_video *type)
|
||||
{
|
||||
if (type->format == 0) {
|
||||
type->format = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__format);
|
||||
type->size = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__size);
|
||||
type->framerate = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__framerate);
|
||||
type->max_framerate = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__maxFramerate);
|
||||
type->views = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__views);
|
||||
type->interlace_mode = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__interlaceMode);
|
||||
type->pixel_aspect_ratio = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__pixelAspectRatio);
|
||||
type->multiview_mode = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__multiviewMode);
|
||||
type->multiview_flags = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__multiviewFlags);
|
||||
type->chroma_site = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__chromaSite);
|
||||
type->color_range = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__colorRange);
|
||||
type->color_matrix = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__colorMatrix);
|
||||
type->transfer_function = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__transferFunction);
|
||||
type->color_primaries = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__colorPrimaries);
|
||||
type->profile = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__profile);
|
||||
type->level = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__level);
|
||||
type->stream_format = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__streamFormat);
|
||||
type->alignment = spa_type_map_get_id (map, SPA_TYPE_FORMAT_VIDEO__alignment);
|
||||
}
|
||||
if (type->format == 0) {
|
||||
type->format = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__format);
|
||||
type->size = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__size);
|
||||
type->framerate = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__framerate);
|
||||
type->max_framerate = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__maxFramerate);
|
||||
type->views = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__views);
|
||||
type->interlace_mode = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__interlaceMode);
|
||||
type->pixel_aspect_ratio = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__pixelAspectRatio);
|
||||
type->multiview_mode = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__multiviewMode);
|
||||
type->multiview_flags = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__multiviewFlags);
|
||||
type->chroma_site = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__chromaSite);
|
||||
type->color_range = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__colorRange);
|
||||
type->color_matrix = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__colorMatrix);
|
||||
type->transfer_function = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__transferFunction);
|
||||
type->color_primaries = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__colorPrimaries);
|
||||
type->profile = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__profile);
|
||||
type->level = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__level);
|
||||
type->stream_format = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__streamFormat);
|
||||
type->alignment = spa_type_map_get_id(map, SPA_TYPE_FORMAT_VIDEO__alignment);
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool
|
||||
spa_format_video_raw_parse (const struct spa_format *format,
|
||||
struct spa_video_info_raw *info,
|
||||
struct spa_type_format_video *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,
|
||||
type->size, SPA_POD_TYPE_RECTANGLE, &info->size,
|
||||
type->framerate, SPA_POD_TYPE_FRACTION, &info->framerate,
|
||||
type->max_framerate, SPA_POD_TYPE_FRACTION, &info->max_framerate,
|
||||
type->views, SPA_POD_TYPE_INT, &info->views,
|
||||
type->interlace_mode, SPA_POD_TYPE_INT, &info->interlace_mode,
|
||||
type->pixel_aspect_ratio, SPA_POD_TYPE_FRACTION, &info->pixel_aspect_ratio,
|
||||
type->multiview_mode, SPA_POD_TYPE_INT, &info->multiview_mode,
|
||||
type->multiview_flags, SPA_POD_TYPE_INT, &info->multiview_flags,
|
||||
type->chroma_site, SPA_POD_TYPE_INT, &info->chroma_site,
|
||||
type->color_range, SPA_POD_TYPE_INT, &info->color_range,
|
||||
type->color_matrix, SPA_POD_TYPE_INT, &info->color_matrix,
|
||||
type->transfer_function, SPA_POD_TYPE_INT, &info->transfer_function,
|
||||
type->color_primaries, SPA_POD_TYPE_INT, &info->color_primaries,
|
||||
0);
|
||||
return true;
|
||||
spa_format_query(format,
|
||||
type->format, SPA_POD_TYPE_ID, &info->format,
|
||||
type->size, SPA_POD_TYPE_RECTANGLE, &info->size,
|
||||
type->framerate, SPA_POD_TYPE_FRACTION, &info->framerate,
|
||||
type->max_framerate, SPA_POD_TYPE_FRACTION, &info->max_framerate,
|
||||
type->views, SPA_POD_TYPE_INT, &info->views,
|
||||
type->interlace_mode, SPA_POD_TYPE_INT, &info->interlace_mode,
|
||||
type->pixel_aspect_ratio, SPA_POD_TYPE_FRACTION, &info->pixel_aspect_ratio,
|
||||
type->multiview_mode, SPA_POD_TYPE_INT, &info->multiview_mode,
|
||||
type->multiview_flags, SPA_POD_TYPE_INT, &info->multiview_flags,
|
||||
type->chroma_site, SPA_POD_TYPE_INT, &info->chroma_site,
|
||||
type->color_range, SPA_POD_TYPE_INT, &info->color_range,
|
||||
type->color_matrix, SPA_POD_TYPE_INT, &info->color_matrix,
|
||||
type->transfer_function, SPA_POD_TYPE_INT, &info->transfer_function,
|
||||
type->color_primaries, SPA_POD_TYPE_INT, &info->color_primaries, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
spa_format_video_h264_parse (const struct spa_format *format,
|
||||
struct spa_video_info_h264 *info,
|
||||
struct spa_type_format_video *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,
|
||||
type->framerate, SPA_POD_TYPE_FRACTION, &info->framerate,
|
||||
type->max_framerate, SPA_POD_TYPE_FRACTION, &info->max_framerate,
|
||||
type->stream_format, SPA_POD_TYPE_INT , &info->stream_format,
|
||||
type->alignment , SPA_POD_TYPE_INT , &info->alignment,
|
||||
0);
|
||||
return true;
|
||||
spa_format_query(format,
|
||||
type->size, SPA_POD_TYPE_RECTANGLE, &info->size,
|
||||
type->framerate, SPA_POD_TYPE_FRACTION, &info->framerate,
|
||||
type->max_framerate, SPA_POD_TYPE_FRACTION, &info->max_framerate,
|
||||
type->stream_format, SPA_POD_TYPE_INT, &info->stream_format,
|
||||
type->alignment, SPA_POD_TYPE_INT, &info->alignment, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
spa_format_video_mjpg_parse (const struct spa_format *format,
|
||||
struct spa_video_info_mjpg *info,
|
||||
struct spa_type_format_video *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,
|
||||
type->framerate, SPA_POD_TYPE_FRACTION, &info->framerate,
|
||||
type->max_framerate, SPA_POD_TYPE_FRACTION, &info->max_framerate,
|
||||
0);
|
||||
return true;
|
||||
spa_format_query(format,
|
||||
type->size, SPA_POD_TYPE_RECTANGLE, &info->size,
|
||||
type->framerate, SPA_POD_TYPE_FRACTION, &info->framerate,
|
||||
type->max_framerate, SPA_POD_TYPE_FRACTION, &info->max_framerate, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_VIDEO_FORMAT_UTILS */
|
||||
|
|
|
|||
|
|
@ -51,17 +51,17 @@ extern "C" {
|
|||
#define SPA_TYPE_FORMAT_VIDEO__alignment SPA_TYPE_FORMAT_VIDEO_BASE "alignment"
|
||||
|
||||
struct spa_video_info {
|
||||
uint32_t media_type;
|
||||
uint32_t media_subtype;
|
||||
union {
|
||||
struct spa_video_info_raw raw;
|
||||
struct spa_video_info_h264 h264;
|
||||
struct spa_video_info_mjpg mjpg;
|
||||
} info;
|
||||
uint32_t media_type;
|
||||
uint32_t media_subtype;
|
||||
union {
|
||||
struct spa_video_info_raw raw;
|
||||
struct spa_video_info_h264 h264;
|
||||
struct spa_video_info_mjpg mjpg;
|
||||
} info;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_VIDEO_FORMAT */
|
||||
|
|
|
|||
|
|
@ -64,25 +64,25 @@ extern "C" {
|
|||
* multiview content is being transported in the stream.
|
||||
*/
|
||||
enum spa_video_multiview_mode {
|
||||
SPA_VIDEO_MULTIVIEW_MODE_NONE = -1,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_MONO = 0,
|
||||
/* Single view modes */
|
||||
SPA_VIDEO_MULTIVIEW_MODE_LEFT,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_RIGHT,
|
||||
/* Stereo view modes */
|
||||
SPA_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_CHECKERBOARD,
|
||||
/* Padding for new frame packing modes */
|
||||
SPA_VIDEO_MULTIVIEW_MODE_NONE = -1,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_MONO = 0,
|
||||
/* Single view modes */
|
||||
SPA_VIDEO_MULTIVIEW_MODE_LEFT,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_RIGHT,
|
||||
/* Stereo view modes */
|
||||
SPA_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_CHECKERBOARD,
|
||||
/* Padding for new frame packing modes */
|
||||
|
||||
SPA_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME = 32,
|
||||
/* Multivew mode(s) */
|
||||
SPA_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_SEPARATED
|
||||
/* future expansion for annotated modes */
|
||||
SPA_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME = 32,
|
||||
/* Multivew mode(s) */
|
||||
SPA_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME,
|
||||
SPA_VIDEO_MULTIVIEW_MODE_SEPARATED
|
||||
/* future expansion for annotated modes */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -117,19 +117,19 @@ enum spa_video_multiview_mode {
|
|||
* that is conveyed in the #spa_video_multiview_mode.
|
||||
*/
|
||||
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),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED = (1 << 2),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED = (1 << 3),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED = (1 << 4),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT = (1 << 14),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO = (1 << 15)
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_NONE = 0,
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST = (1 << 0),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED = (1 << 1),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED = (1 << 2),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED = (1 << 3),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED = (1 << 4),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT = (1 << 14),
|
||||
SPA_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO = (1 << 15)
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_VIDEO_MULTIVIEW_H__ */
|
||||
|
|
|
|||
|
|
@ -28,173 +28,173 @@ extern "C" {
|
|||
#include <spa/video/raw.h>
|
||||
|
||||
struct spa_type_video_format {
|
||||
uint32_t UNKNOWN;
|
||||
uint32_t ENCODED;
|
||||
uint32_t I420;
|
||||
uint32_t YV12;
|
||||
uint32_t YUY2;
|
||||
uint32_t UYVY;
|
||||
uint32_t AYUV;
|
||||
uint32_t RGBx;
|
||||
uint32_t BGRx;
|
||||
uint32_t xRGB;
|
||||
uint32_t xBGR;
|
||||
uint32_t RGBA;
|
||||
uint32_t BGRA;
|
||||
uint32_t ARGB;
|
||||
uint32_t ABGR;
|
||||
uint32_t RGB;
|
||||
uint32_t BGR;
|
||||
uint32_t Y41B;
|
||||
uint32_t Y42B;
|
||||
uint32_t YVYU;
|
||||
uint32_t Y444;
|
||||
uint32_t v210;
|
||||
uint32_t v216;
|
||||
uint32_t NV12;
|
||||
uint32_t NV21;
|
||||
uint32_t GRAY8;
|
||||
uint32_t GRAY16_BE;
|
||||
uint32_t GRAY16_LE;
|
||||
uint32_t v308;
|
||||
uint32_t RGB16;
|
||||
uint32_t BGR16;
|
||||
uint32_t RGB15;
|
||||
uint32_t BGR15;
|
||||
uint32_t UYVP;
|
||||
uint32_t A420;
|
||||
uint32_t RGB8P;
|
||||
uint32_t YUV9;
|
||||
uint32_t YVU9;
|
||||
uint32_t IYU1;
|
||||
uint32_t ARGB64;
|
||||
uint32_t AYUV64;
|
||||
uint32_t r210;
|
||||
uint32_t I420_10BE;
|
||||
uint32_t I420_10LE;
|
||||
uint32_t I422_10BE;
|
||||
uint32_t I422_10LE;
|
||||
uint32_t Y444_10BE;
|
||||
uint32_t Y444_10LE;
|
||||
uint32_t GBR;
|
||||
uint32_t GBR_10BE;
|
||||
uint32_t GBR_10LE;
|
||||
uint32_t NV16;
|
||||
uint32_t NV24;
|
||||
uint32_t NV12_64Z32;
|
||||
uint32_t A420_10BE;
|
||||
uint32_t A420_10LE;
|
||||
uint32_t A422_10BE;
|
||||
uint32_t A422_10LE;
|
||||
uint32_t A444_10BE;
|
||||
uint32_t A444_10LE;
|
||||
uint32_t NV61;
|
||||
uint32_t P010_10BE;
|
||||
uint32_t P010_10LE;
|
||||
uint32_t IYU2;
|
||||
uint32_t VYUY;
|
||||
uint32_t GBRA;
|
||||
uint32_t GBRA_10BE;
|
||||
uint32_t GBRA_10LE;
|
||||
uint32_t GBR_12BE;
|
||||
uint32_t GBR_12LE;
|
||||
uint32_t GBRA_12BE;
|
||||
uint32_t GBRA_12LE;
|
||||
uint32_t I420_12BE;
|
||||
uint32_t I420_12LE;
|
||||
uint32_t I422_12BE;
|
||||
uint32_t I422_12LE;
|
||||
uint32_t Y444_12BE;
|
||||
uint32_t Y444_12LE;
|
||||
uint32_t UNKNOWN;
|
||||
uint32_t ENCODED;
|
||||
uint32_t I420;
|
||||
uint32_t YV12;
|
||||
uint32_t YUY2;
|
||||
uint32_t UYVY;
|
||||
uint32_t AYUV;
|
||||
uint32_t RGBx;
|
||||
uint32_t BGRx;
|
||||
uint32_t xRGB;
|
||||
uint32_t xBGR;
|
||||
uint32_t RGBA;
|
||||
uint32_t BGRA;
|
||||
uint32_t ARGB;
|
||||
uint32_t ABGR;
|
||||
uint32_t RGB;
|
||||
uint32_t BGR;
|
||||
uint32_t Y41B;
|
||||
uint32_t Y42B;
|
||||
uint32_t YVYU;
|
||||
uint32_t Y444;
|
||||
uint32_t v210;
|
||||
uint32_t v216;
|
||||
uint32_t NV12;
|
||||
uint32_t NV21;
|
||||
uint32_t GRAY8;
|
||||
uint32_t GRAY16_BE;
|
||||
uint32_t GRAY16_LE;
|
||||
uint32_t v308;
|
||||
uint32_t RGB16;
|
||||
uint32_t BGR16;
|
||||
uint32_t RGB15;
|
||||
uint32_t BGR15;
|
||||
uint32_t UYVP;
|
||||
uint32_t A420;
|
||||
uint32_t RGB8P;
|
||||
uint32_t YUV9;
|
||||
uint32_t YVU9;
|
||||
uint32_t IYU1;
|
||||
uint32_t ARGB64;
|
||||
uint32_t AYUV64;
|
||||
uint32_t r210;
|
||||
uint32_t I420_10BE;
|
||||
uint32_t I420_10LE;
|
||||
uint32_t I422_10BE;
|
||||
uint32_t I422_10LE;
|
||||
uint32_t Y444_10BE;
|
||||
uint32_t Y444_10LE;
|
||||
uint32_t GBR;
|
||||
uint32_t GBR_10BE;
|
||||
uint32_t GBR_10LE;
|
||||
uint32_t NV16;
|
||||
uint32_t NV24;
|
||||
uint32_t NV12_64Z32;
|
||||
uint32_t A420_10BE;
|
||||
uint32_t A420_10LE;
|
||||
uint32_t A422_10BE;
|
||||
uint32_t A422_10LE;
|
||||
uint32_t A444_10BE;
|
||||
uint32_t A444_10LE;
|
||||
uint32_t NV61;
|
||||
uint32_t P010_10BE;
|
||||
uint32_t P010_10LE;
|
||||
uint32_t IYU2;
|
||||
uint32_t VYUY;
|
||||
uint32_t GBRA;
|
||||
uint32_t GBRA_10BE;
|
||||
uint32_t GBRA_10LE;
|
||||
uint32_t GBR_12BE;
|
||||
uint32_t GBR_12LE;
|
||||
uint32_t GBRA_12BE;
|
||||
uint32_t GBRA_12LE;
|
||||
uint32_t I420_12BE;
|
||||
uint32_t I420_12LE;
|
||||
uint32_t I422_12BE;
|
||||
uint32_t I422_12LE;
|
||||
uint32_t Y444_12BE;
|
||||
uint32_t Y444_12LE;
|
||||
};
|
||||
|
||||
static inline void
|
||||
spa_type_video_format_map (struct spa_type_map *map, struct spa_type_video_format *type)
|
||||
spa_type_video_format_map(struct spa_type_map *map, struct spa_type_video_format *type)
|
||||
{
|
||||
if (type->ENCODED == 0) {
|
||||
type->UNKNOWN = 0;
|
||||
type->ENCODED = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__ENCODED);
|
||||
type->I420 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__I420);
|
||||
type->YV12 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__YV12);
|
||||
type->YUY2 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__YUY2);
|
||||
type->UYVY = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__UYVY);
|
||||
type->AYUV = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__AYUV);
|
||||
type->RGBx = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__RGBx);
|
||||
type->BGRx = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__BGRx);
|
||||
type->xRGB = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__xRGB);
|
||||
type->xBGR = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__xBGR);
|
||||
type->RGBA = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__RGBA);
|
||||
type->BGRA = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__BGRA);
|
||||
type->ARGB = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__ARGB);
|
||||
type->ABGR = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__ABGR);
|
||||
type->RGB = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__RGB);
|
||||
type->BGR = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__BGR);
|
||||
type->Y41B = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__Y41B);
|
||||
type->Y42B = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__Y42B);
|
||||
type->YVYU = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__YVYU);
|
||||
type->Y444 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__Y444);
|
||||
type->v210 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__v210);
|
||||
type->v216 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__v216);
|
||||
type->NV12 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__NV12);
|
||||
type->NV21 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__NV21);
|
||||
type->GRAY8 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GRAY8);
|
||||
type->GRAY16_BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GRAY16_BE);
|
||||
type->GRAY16_LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GRAY16_LE);
|
||||
type->v308 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__v308);
|
||||
type->RGB16 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__RGB16);
|
||||
type->BGR16 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__BGR16);
|
||||
type->RGB15 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__RGB15);
|
||||
type->BGR15 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__BGR15);
|
||||
type->UYVP = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__UYVP);
|
||||
type->A420 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__A420);
|
||||
type->RGB8P = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__RGB8P);
|
||||
type->YUV9 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__YUV9);
|
||||
type->YVU9 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__YVU9);
|
||||
type->IYU1 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__IYU1);
|
||||
type->ARGB64 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__ARGB64);
|
||||
type->AYUV64 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__AYUV64);
|
||||
type->r210 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__r210);
|
||||
type->I420_10BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__I420_10BE);
|
||||
type->I420_10LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__I420_10LE);
|
||||
type->I422_10BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__I422_10BE);
|
||||
type->I422_10LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__I422_10LE);
|
||||
type->Y444_10BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__Y444_10BE);
|
||||
type->Y444_10LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__Y444_10LE);
|
||||
type->GBR = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GBR);
|
||||
type->GBR_10BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GBR_10BE);
|
||||
type->GBR_10LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GBR_10LE);
|
||||
type->NV16 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__NV16);
|
||||
type->NV24 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__NV24);
|
||||
type->NV12_64Z32 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__NV12_64Z32);
|
||||
type->A420_10BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__A420_10BE);
|
||||
type->A420_10LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__A420_10LE);
|
||||
type->A422_10BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__A422_10BE);
|
||||
type->A422_10LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__A422_10LE);
|
||||
type->A444_10BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__A444_10BE);
|
||||
type->A444_10LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__A444_10LE);
|
||||
type->NV61 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__NV61);
|
||||
type->P010_10BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__P010_10BE);
|
||||
type->P010_10LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__P010_10LE);
|
||||
type->IYU2 = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__IYU2);
|
||||
type->VYUY = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__VYUY);
|
||||
type->GBRA = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GBRA);
|
||||
type->GBRA_10BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GBRA_10BE);
|
||||
type->GBRA_10LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GBRA_10LE);
|
||||
type->GBR_12BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GBR_12BE);
|
||||
type->GBR_12LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GBR_12LE);
|
||||
type->GBRA_12BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GBRA_12BE);
|
||||
type->GBRA_12LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__GBRA_12LE);
|
||||
type->I420_12BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__I420_12BE);
|
||||
type->I420_12LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__I420_12LE);
|
||||
type->I422_12BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__I422_12BE);
|
||||
type->I422_12LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__I422_12LE);
|
||||
type->Y444_12BE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__Y444_12BE);
|
||||
type->Y444_12LE = spa_type_map_get_id (map, SPA_TYPE_VIDEO_FORMAT__Y444_12LE);
|
||||
}
|
||||
if (type->ENCODED == 0) {
|
||||
type->UNKNOWN = 0;
|
||||
type->ENCODED = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__ENCODED);
|
||||
type->I420 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I420);
|
||||
type->YV12 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__YV12);
|
||||
type->YUY2 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__YUY2);
|
||||
type->UYVY = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__UYVY);
|
||||
type->AYUV = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__AYUV);
|
||||
type->RGBx = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__RGBx);
|
||||
type->BGRx = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__BGRx);
|
||||
type->xRGB = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__xRGB);
|
||||
type->xBGR = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__xBGR);
|
||||
type->RGBA = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__RGBA);
|
||||
type->BGRA = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__BGRA);
|
||||
type->ARGB = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__ARGB);
|
||||
type->ABGR = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__ABGR);
|
||||
type->RGB = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__RGB);
|
||||
type->BGR = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__BGR);
|
||||
type->Y41B = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y41B);
|
||||
type->Y42B = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y42B);
|
||||
type->YVYU = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__YVYU);
|
||||
type->Y444 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y444);
|
||||
type->v210 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__v210);
|
||||
type->v216 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__v216);
|
||||
type->NV12 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__NV12);
|
||||
type->NV21 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__NV21);
|
||||
type->GRAY8 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GRAY8);
|
||||
type->GRAY16_BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GRAY16_BE);
|
||||
type->GRAY16_LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GRAY16_LE);
|
||||
type->v308 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__v308);
|
||||
type->RGB16 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__RGB16);
|
||||
type->BGR16 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__BGR16);
|
||||
type->RGB15 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__RGB15);
|
||||
type->BGR15 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__BGR15);
|
||||
type->UYVP = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__UYVP);
|
||||
type->A420 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A420);
|
||||
type->RGB8P = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__RGB8P);
|
||||
type->YUV9 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__YUV9);
|
||||
type->YVU9 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__YVU9);
|
||||
type->IYU1 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__IYU1);
|
||||
type->ARGB64 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__ARGB64);
|
||||
type->AYUV64 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__AYUV64);
|
||||
type->r210 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__r210);
|
||||
type->I420_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I420_10BE);
|
||||
type->I420_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I420_10LE);
|
||||
type->I422_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I422_10BE);
|
||||
type->I422_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I422_10LE);
|
||||
type->Y444_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y444_10BE);
|
||||
type->Y444_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y444_10LE);
|
||||
type->GBR = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBR);
|
||||
type->GBR_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBR_10BE);
|
||||
type->GBR_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBR_10LE);
|
||||
type->NV16 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__NV16);
|
||||
type->NV24 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__NV24);
|
||||
type->NV12_64Z32 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__NV12_64Z32);
|
||||
type->A420_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A420_10BE);
|
||||
type->A420_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A420_10LE);
|
||||
type->A422_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A422_10BE);
|
||||
type->A422_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A422_10LE);
|
||||
type->A444_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A444_10BE);
|
||||
type->A444_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__A444_10LE);
|
||||
type->NV61 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__NV61);
|
||||
type->P010_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__P010_10BE);
|
||||
type->P010_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__P010_10LE);
|
||||
type->IYU2 = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__IYU2);
|
||||
type->VYUY = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__VYUY);
|
||||
type->GBRA = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBRA);
|
||||
type->GBRA_10BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBRA_10BE);
|
||||
type->GBRA_10LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBRA_10LE);
|
||||
type->GBR_12BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBR_12BE);
|
||||
type->GBR_12LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBR_12LE);
|
||||
type->GBRA_12BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBRA_12BE);
|
||||
type->GBRA_12LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__GBRA_12LE);
|
||||
type->I420_12BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I420_12BE);
|
||||
type->I420_12LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I420_12LE);
|
||||
type->I422_12BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I422_12BE);
|
||||
type->I422_12LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__I422_12LE);
|
||||
type->Y444_12BE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y444_12BE);
|
||||
type->Y444_12LE = spa_type_map_get_id(map, SPA_TYPE_VIDEO_FORMAT__Y444_12LE);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_VIDEO_RAW_UTILS_H__ */
|
||||
|
|
|
|||
|
|
@ -124,9 +124,9 @@ extern "C" {
|
|||
* Extra video flags
|
||||
*/
|
||||
enum spa_video_flags {
|
||||
SPA_VIDEO_FLAG_NONE = 0,
|
||||
SPA_VIDEO_FLAG_VARIABLE_FPS = (1 << 0),
|
||||
SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1)
|
||||
SPA_VIDEO_FLAG_NONE = 0,
|
||||
SPA_VIDEO_FLAG_VARIABLE_FPS = (1 << 0),
|
||||
SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1)
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -148,10 +148,10 @@ enum spa_video_flags {
|
|||
* mode of the stream.
|
||||
*/
|
||||
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
|
||||
SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE = 0,
|
||||
SPA_VIDEO_INTERLACE_MODE_INTERLEAVED,
|
||||
SPA_VIDEO_INTERLACE_MODE_MIXED,
|
||||
SPA_VIDEO_INTERLACE_MODE_FIELDS
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -175,24 +175,24 @@ enum spa_video_interlace_mode {
|
|||
* @color_primaries: color primaries. used to convert between R'G'B' and CIE XYZ
|
||||
*/
|
||||
struct spa_video_info_raw {
|
||||
uint32_t format;
|
||||
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;
|
||||
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
|
||||
} /* extern "C" */
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_VIDEO_RAW_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue