mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-12 13:30:15 -05:00
param: add more generic port params
Remove port properties and replace them with port params. Move the params from the PortInfo to enum_params. Use the Param ranges to specify possible sizes etc.
This commit is contained in:
parent
12effccb06
commit
d1a6d6e03f
37 changed files with 1044 additions and 755 deletions
|
|
@ -1,163 +0,0 @@
|
|||
/* Simple Plugin API
|
||||
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SPA_ALLOC_PARAM_H__
|
||||
#define __SPA_ALLOC_PARAM_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaAllocParam SpaAllocParam;
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/type-map.h>
|
||||
#include <spa/pod-utils.h>
|
||||
|
||||
#define SPA_TYPE__AllocParam SPA_TYPE_POD_OBJECT_BASE "AllocParam"
|
||||
#define SPA_TYPE_ALLOC_PARAM_BASE SPA_TYPE__AllocParam ":"
|
||||
|
||||
typedef struct {
|
||||
SpaPODObjectBody body;
|
||||
/* SpaPODProp follow */
|
||||
} SpaAllocParamBody;
|
||||
|
||||
struct _SpaAllocParam {
|
||||
SpaPOD pod;
|
||||
SpaAllocParamBody body;
|
||||
};
|
||||
|
||||
static inline uint32_t
|
||||
spa_alloc_param_query (const SpaAllocParam *param, uint32_t key, ...)
|
||||
{
|
||||
uint32_t count;
|
||||
va_list args;
|
||||
|
||||
va_start (args, key);
|
||||
count = spa_pod_contents_queryv (¶m->pod, sizeof (SpaAllocParam), key, args);
|
||||
va_end (args);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#define SPA_TYPE_ALLOC_PARAM__Buffers SPA_TYPE_ALLOC_PARAM_BASE "Buffers"
|
||||
#define SPA_TYPE_ALLOC_PARAM_BUFFERS_BASE SPA_TYPE_ALLOC_PARAM__Buffers ":"
|
||||
|
||||
#define SPA_TYPE_ALLOC_PARAM_BUFFERS__size SPA_TYPE_ALLOC_PARAM_BUFFERS_BASE "size"
|
||||
#define SPA_TYPE_ALLOC_PARAM_BUFFERS__stride SPA_TYPE_ALLOC_PARAM_BUFFERS_BASE "stride"
|
||||
#define SPA_TYPE_ALLOC_PARAM_BUFFERS__buffers SPA_TYPE_ALLOC_PARAM_BUFFERS_BASE "buffers"
|
||||
#define SPA_TYPE_ALLOC_PARAM_BUFFERS__align SPA_TYPE_ALLOC_PARAM_BUFFERS_BASE "align"
|
||||
|
||||
typedef struct {
|
||||
uint32_t Buffers;
|
||||
uint32_t size;
|
||||
uint32_t stride;
|
||||
uint32_t buffers;
|
||||
uint32_t align;
|
||||
} SpaTypeAllocParamBuffers;
|
||||
|
||||
static inline void
|
||||
spa_type_alloc_param_buffers_map (SpaTypeMap *map, SpaTypeAllocParamBuffers *type)
|
||||
{
|
||||
if (type->Buffers == 0) {
|
||||
type->Buffers = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM__Buffers);
|
||||
type->size = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_BUFFERS__size);
|
||||
type->stride = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_BUFFERS__stride);
|
||||
type->buffers = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_BUFFERS__buffers);
|
||||
type->align = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_BUFFERS__align);
|
||||
}
|
||||
}
|
||||
|
||||
#define SPA_TYPE_ALLOC_PARAM__MetaEnable SPA_TYPE_ALLOC_PARAM_BASE "MetaEnable"
|
||||
#define SPA_TYPE_ALLOC_PARAM_META_ENABLE_BASE SPA_TYPE_ALLOC_PARAM__MetaEnable ":"
|
||||
#define SPA_TYPE_ALLOC_PARAM_META_ENABLE__type SPA_TYPE_ALLOC_PARAM_META_ENABLE_BASE "type"
|
||||
#define SPA_TYPE_ALLOC_PARAM_META_ENABLE__size SPA_TYPE_ALLOC_PARAM_META_ENABLE_BASE "size"
|
||||
|
||||
#define SPA_TYPE_ALLOC_PARAM_META_ENABLE__ringbufferSize SPA_TYPE_ALLOC_PARAM_META_ENABLE_BASE "ringbufferSize"
|
||||
#define SPA_TYPE_ALLOC_PARAM_META_ENABLE__ringbufferStride SPA_TYPE_ALLOC_PARAM_META_ENABLE_BASE "ringbufferStride"
|
||||
#define SPA_TYPE_ALLOC_PARAM_META_ENABLE__ringbufferBlocks SPA_TYPE_ALLOC_PARAM_META_ENABLE_BASE "ringbufferBlocks"
|
||||
#define SPA_TYPE_ALLOC_PARAM_META_ENABLE__ringbufferAlign SPA_TYPE_ALLOC_PARAM_META_ENABLE_BASE "ringbufferAlign"
|
||||
|
||||
typedef struct {
|
||||
uint32_t MetaEnable;
|
||||
uint32_t type;
|
||||
uint32_t size;
|
||||
uint32_t ringbufferSize;
|
||||
uint32_t ringbufferStride;
|
||||
uint32_t ringbufferBlocks;
|
||||
uint32_t ringbufferAlign;
|
||||
} SpaTypeAllocParamMetaEnable;
|
||||
|
||||
static inline void
|
||||
spa_type_alloc_param_meta_enable_map (SpaTypeMap *map, SpaTypeAllocParamMetaEnable *type)
|
||||
{
|
||||
if (type->MetaEnable == 0) {
|
||||
type->MetaEnable = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM__MetaEnable);
|
||||
type->type = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_META_ENABLE__type);
|
||||
type->size = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_META_ENABLE__size);
|
||||
type->ringbufferSize = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_META_ENABLE__ringbufferSize);
|
||||
type->ringbufferStride = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_META_ENABLE__ringbufferStride);
|
||||
type->ringbufferBlocks = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_META_ENABLE__ringbufferBlocks);
|
||||
type->ringbufferAlign = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_META_ENABLE__ringbufferAlign);
|
||||
}
|
||||
}
|
||||
|
||||
#define SPA_TYPE_ALLOC_PARAM__VideoPadding SPA_TYPE_ALLOC_PARAM_BASE "VideoPadding"
|
||||
#define SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING_BASE SPA_TYPE_ALLOC_PARAM__VideoPadding ":"
|
||||
|
||||
#define SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__top SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING_BASE "top"
|
||||
#define SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__bottom SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING_BASE "bottom"
|
||||
#define SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__left SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING_BASE "left"
|
||||
#define SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__right SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING_BASE "right"
|
||||
#define SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__strideAlign0 SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING_BASE "strideAlign0"
|
||||
#define SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__strideAlign1 SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING_BASE "strideAlign1"
|
||||
#define SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__strideAlign2 SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING_BASE "strideAlign2"
|
||||
#define SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__strideAlign3 SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING_BASE "strideAlign3"
|
||||
|
||||
typedef struct {
|
||||
uint32_t VideoPadding;
|
||||
uint32_t top;
|
||||
uint32_t bottom;
|
||||
uint32_t left;
|
||||
uint32_t right;
|
||||
uint32_t strideAlign[4];
|
||||
} SpaTypeAllocParamVideoPadding;
|
||||
|
||||
static inline void
|
||||
spa_type_alloc_param_video_padding_map (SpaTypeMap *map, SpaTypeAllocParamVideoPadding *type)
|
||||
{
|
||||
if (type->VideoPadding == 0) {
|
||||
type->VideoPadding = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM__VideoPadding);
|
||||
type->top = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__top);
|
||||
type->bottom = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__bottom);
|
||||
type->left = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__left);
|
||||
type->right = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__right);
|
||||
type->strideAlign[0] = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__strideAlign0);
|
||||
type->strideAlign[1] = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__strideAlign1);
|
||||
type->strideAlign[2] = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__strideAlign2);
|
||||
type->strideAlign[3] = spa_type_map_get_id (map, SPA_TYPE_ALLOC_PARAM_VIDEO_PADDING__strideAlign3);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __SPA_ALLOC_PARAM_H__ */
|
||||
|
|
@ -32,7 +32,7 @@ typedef struct _SpaNode SpaNode;
|
|||
#include <spa/defs.h>
|
||||
#include <spa/plugin.h>
|
||||
#include <spa/props.h>
|
||||
#include <spa/alloc-param.h>
|
||||
#include <spa/param.h>
|
||||
#include <spa/event-node.h>
|
||||
#include <spa/command-node.h>
|
||||
#include <spa/buffer.h>
|
||||
|
|
@ -66,13 +66,14 @@ typedef struct {
|
|||
* @flags: extra port flags
|
||||
* @rate: rate of sequence number increment per second of media data
|
||||
* @n_params: number of elements in @params;
|
||||
* @params: extra allocation parameters
|
||||
* @params: type ids of params that can be queried
|
||||
* @maxbuffering: the maximum amount of bytes that the element will keep
|
||||
* around internally
|
||||
* @latency: latency on this port in nanoseconds
|
||||
* @extra: a dictionary of extra port info
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t direction;
|
||||
uint32_t port_id;
|
||||
#define SPA_PORT_INFO_FLAG_REMOVABLE (1<<0) /* port can be removed */
|
||||
#define SPA_PORT_INFO_FLAG_OPTIONAL (1<<1) /* processing on port is optional */
|
||||
#define SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS (1<<2) /* the port can allocate buffer data */
|
||||
|
|
@ -84,11 +85,6 @@ typedef struct {
|
|||
* a live clock. */
|
||||
uint32_t flags;
|
||||
uint32_t rate;
|
||||
uint32_t n_params;
|
||||
SpaAllocParam **params;
|
||||
uint64_t maxbuffering;
|
||||
uint64_t latency;
|
||||
SpaDict *extra;
|
||||
} SpaPortInfo;
|
||||
|
||||
|
||||
|
|
@ -419,14 +415,15 @@ struct _SpaNode {
|
|||
uint32_t port_id,
|
||||
const SpaPortInfo **info);
|
||||
|
||||
SpaResult (*port_get_props) (SpaNode *node,
|
||||
SpaResult (*port_enum_params) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props);
|
||||
SpaResult (*port_set_props) (SpaNode *node,
|
||||
uint32_t index,
|
||||
SpaParam **param);
|
||||
SpaResult (*port_set_param) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props);
|
||||
const SpaParam *param);
|
||||
|
||||
/**
|
||||
* SpaNode::port_use_buffers:
|
||||
|
|
@ -501,7 +498,7 @@ struct _SpaNode {
|
|||
SpaResult (*port_alloc_buffers) (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaAllocParam **params,
|
||||
SpaParam **params,
|
||||
uint32_t n_params,
|
||||
SpaBuffer **buffers,
|
||||
uint32_t *n_buffers);
|
||||
|
|
@ -620,8 +617,8 @@ struct _SpaNode {
|
|||
#define spa_node_port_set_format(n,...) (n)->port_set_format((n),__VA_ARGS__)
|
||||
#define spa_node_port_get_format(n,...) (n)->port_get_format((n),__VA_ARGS__)
|
||||
#define spa_node_port_get_info(n,...) (n)->port_get_info((n),__VA_ARGS__)
|
||||
#define spa_node_port_get_props(n,...) (n)->port_get_props((n),__VA_ARGS__)
|
||||
#define spa_node_port_set_props(n,...) (n)->port_set_props((n),__VA_ARGS__)
|
||||
#define spa_node_port_enum_params(n,...) (n)->port_enum_params((n),__VA_ARGS__)
|
||||
#define spa_node_port_set_param(n,...) (n)->port_set_param((n),__VA_ARGS__)
|
||||
#define spa_node_port_use_buffers(n,...) (n)->port_use_buffers((n),__VA_ARGS__)
|
||||
#define spa_node_port_alloc_buffers(n,...) (n)->port_alloc_buffers((n),__VA_ARGS__)
|
||||
#define spa_node_port_set_io(n,...) (n)->port_set_io((n),__VA_ARGS__)
|
||||
|
|
|
|||
138
spa/include/spa/param-alloc.h
Normal file
138
spa/include/spa/param-alloc.h
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
/* Simple Plugin API
|
||||
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SPA_PARAM_ALLOC_H__
|
||||
#define __SPA_PARAM_ALLOC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/param.h>
|
||||
#include <spa/type-map.h>
|
||||
|
||||
#define SPA_TYPE__ParamAlloc SPA_TYPE_PARAM_BASE "Alloc"
|
||||
#define SPA_TYPE_PARAM_ALLOC_BASE SPA_TYPE__ParamAlloc ":"
|
||||
|
||||
#define SPA_TYPE_PARAM_ALLOC__Buffers SPA_TYPE_PARAM_ALLOC_BASE "Buffers"
|
||||
#define SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE SPA_TYPE_PARAM_ALLOC__Buffers ":"
|
||||
|
||||
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__size SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "size"
|
||||
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__stride SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "stride"
|
||||
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__buffers SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "buffers"
|
||||
#define SPA_TYPE_PARAM_ALLOC_BUFFERS__align SPA_TYPE_PARAM_ALLOC_BUFFERS_BASE "align"
|
||||
|
||||
typedef struct {
|
||||
uint32_t Buffers;
|
||||
uint32_t size;
|
||||
uint32_t stride;
|
||||
uint32_t buffers;
|
||||
uint32_t align;
|
||||
} SpaTypeParamAllocBuffers;
|
||||
|
||||
static inline void
|
||||
spa_type_param_alloc_buffers_map (SpaTypeMap *map, SpaTypeParamAllocBuffers *type)
|
||||
{
|
||||
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"
|
||||
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE SPA_TYPE_PARAM_ALLOC__MetaEnable ":"
|
||||
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__type SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "type"
|
||||
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__size SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "size"
|
||||
|
||||
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferSize SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferSize"
|
||||
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferStride SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferStride"
|
||||
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferBlocks SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferBlocks"
|
||||
#define SPA_TYPE_PARAM_ALLOC_META_ENABLE__ringbufferAlign SPA_TYPE_PARAM_ALLOC_META_ENABLE_BASE "ringbufferAlign"
|
||||
|
||||
typedef struct {
|
||||
uint32_t MetaEnable;
|
||||
uint32_t type;
|
||||
uint32_t size;
|
||||
uint32_t ringbufferSize;
|
||||
uint32_t ringbufferStride;
|
||||
uint32_t ringbufferBlocks;
|
||||
uint32_t ringbufferAlign;
|
||||
} SpaTypeParamAllocMetaEnable;
|
||||
|
||||
static inline void
|
||||
spa_type_param_alloc_meta_enable_map (SpaTypeMap *map, SpaTypeParamAllocMetaEnable *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);
|
||||
}
|
||||
}
|
||||
|
||||
#define SPA_TYPE_PARAM_ALLOC__VideoPadding SPA_TYPE_PARAM_ALLOC_BASE "VideoPadding"
|
||||
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE SPA_TYPE_PARAM_ALLOC__VideoPadding ":"
|
||||
|
||||
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__top SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "top"
|
||||
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__bottom SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "bottom"
|
||||
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__left SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "left"
|
||||
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__right SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "right"
|
||||
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign0 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign0"
|
||||
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign1 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign1"
|
||||
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign2 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign2"
|
||||
#define SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING__strideAlign3 SPA_TYPE_PARAM_ALLOC_VIDEO_PADDING_BASE "strideAlign3"
|
||||
|
||||
typedef struct {
|
||||
uint32_t VideoPadding;
|
||||
uint32_t top;
|
||||
uint32_t bottom;
|
||||
uint32_t left;
|
||||
uint32_t right;
|
||||
uint32_t strideAlign[4];
|
||||
} SpaTypeParamAllocVideoPadding;
|
||||
|
||||
static inline void
|
||||
spa_type_param_alloc_video_padding_map (SpaTypeMap *map, SpaTypeParamAllocVideoPadding *type)
|
||||
{
|
||||
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__ */
|
||||
81
spa/include/spa/param.h
Normal file
81
spa/include/spa/param.h
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/* Simple Plugin API
|
||||
* Copyright (C) 2017 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SPA_PARAM_H__
|
||||
#define __SPA_PARAM_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaParam SpaParam;
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/pod-utils.h>
|
||||
|
||||
#define SPA_TYPE__Param SPA_TYPE_POD_OBJECT_BASE "Param"
|
||||
#define SPA_TYPE_PARAM_BASE SPA_TYPE__Param ":"
|
||||
|
||||
typedef struct {
|
||||
SpaPODObjectBody body;
|
||||
/* SpaPODProp follow */
|
||||
} SpaParamBody;
|
||||
|
||||
struct _SpaParam {
|
||||
SpaPOD pod;
|
||||
SpaParamBody body;
|
||||
};
|
||||
|
||||
static inline uint32_t
|
||||
spa_param_query (const SpaParam *param, uint32_t key, ...)
|
||||
{
|
||||
uint32_t count;
|
||||
va_list args;
|
||||
|
||||
va_start (args, key);
|
||||
count = spa_pod_contents_queryv (¶m->pod, sizeof (SpaParam), key, args);
|
||||
va_end (args);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#define SPA_PARAM_BODY_FOREACH(body, size, iter) \
|
||||
for ((iter) = SPA_MEMBER ((body), sizeof (SpaParamBody), SpaPODProp); \
|
||||
(iter) < SPA_MEMBER ((body), (size), SpaPODProp); \
|
||||
(iter) = SPA_MEMBER ((iter), SPA_ROUND_UP_N (SPA_POD_SIZE (iter), 8), SpaPODProp))
|
||||
|
||||
#define SPA_PARAM_FOREACH(param, iter) \
|
||||
SPA_PARAM_BODY_FOREACH(¶m->body, SPA_POD_BODY_SIZE(param), iter)
|
||||
|
||||
static inline SpaResult
|
||||
spa_param_fixate (SpaParam *param)
|
||||
{
|
||||
SpaPODProp *prop;
|
||||
|
||||
SPA_PARAM_FOREACH (param, prop)
|
||||
prop->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __SPA_PARAM_H__ */
|
||||
Loading…
Add table
Add a link
Reference in a new issue