mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04: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__ */
|
||||
|
|
@ -29,20 +29,12 @@
|
|||
SpaResult
|
||||
spa_debug_port_info (const SpaPortInfo *info, const SpaTypeMap *map)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
fprintf (stderr, "SpaPortInfo %p:\n", info);
|
||||
fprintf (stderr, " flags: \t%08x\n", info->flags);
|
||||
fprintf (stderr, " maxbuffering: \t%"PRIu64"\n", info->maxbuffering);
|
||||
fprintf (stderr, " latency: \t%" PRIu64 "\n", info->latency);
|
||||
fprintf (stderr, " n_params: \t%d\n", info->n_params);
|
||||
for (i = 0; i < info->n_params; i++) {
|
||||
SpaAllocParam *param = info->params[i];
|
||||
spa_debug_pod (¶m->pod, map);
|
||||
}
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -151,6 +143,13 @@ spa_debug_props (const SpaProps *props, const SpaTypeMap *map)
|
|||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
SpaResult
|
||||
spa_debug_param (const SpaParam *param, const SpaTypeMap *map)
|
||||
{
|
||||
spa_debug_pod (¶m->pod, map);
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
struct pod_type_name {
|
||||
const char *name;
|
||||
const char *CCName;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ extern "C" {
|
|||
SpaResult spa_debug_port_info (const SpaPortInfo *info, const SpaTypeMap *map);
|
||||
SpaResult spa_debug_buffer (const SpaBuffer *buffer, const SpaTypeMap *map);
|
||||
SpaResult spa_debug_props (const SpaProps *props, const SpaTypeMap *map);
|
||||
SpaResult spa_debug_param (const SpaParam *param, const SpaTypeMap *map);
|
||||
SpaResult spa_debug_pod (const SpaPOD *pod, const SpaTypeMap *map);
|
||||
SpaResult spa_debug_format (const SpaFormat *format, const SpaTypeMap *map);
|
||||
SpaResult spa_debug_dump_mem (const void *data, size_t size);
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ spa_props_filter (SpaPODBuilder *b,
|
|||
nalt1--;
|
||||
} else {
|
||||
nalt1 = 1;
|
||||
rt1 = SPA_POD_PROP_RANGE_NONE;
|
||||
}
|
||||
|
||||
if (p2->body.flags & SPA_POD_PROP_FLAG_UNSET) {
|
||||
|
|
@ -190,6 +191,7 @@ spa_props_filter (SpaPODBuilder *b,
|
|||
nalt2--;
|
||||
} else {
|
||||
nalt2 = 1;
|
||||
rt2 = SPA_POD_PROP_RANGE_NONE;
|
||||
}
|
||||
|
||||
if ((rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_NONE) ||
|
||||
|
|
|
|||
|
|
@ -278,8 +278,6 @@ spa_alsa_sink_node_port_set_format (SpaNode *node,
|
|||
const SpaFormat *format)
|
||||
{
|
||||
SpaALSASink *this;
|
||||
SpaPODBuilder b = { NULL };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
spa_return_val_if_fail (node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
||||
|
|
@ -312,36 +310,11 @@ spa_alsa_sink_node_port_set_format (SpaNode *node,
|
|||
}
|
||||
|
||||
if (this->have_format) {
|
||||
this->info.direction = direction;
|
||||
this->info.port_id = port_id;
|
||||
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.maxbuffering = this->buffer_frames * this->frame_size;
|
||||
this->info.latency = (this->period_frames * SPA_NSEC_PER_SEC) / this->rate;
|
||||
this->info.n_params = 3;
|
||||
this->info.params = this->params;
|
||||
|
||||
spa_pod_builder_init (&b, this->params_buffer, sizeof (this->params_buffer));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->type.alloc_param_buffers.size, SPA_POD_TYPE_INT,
|
||||
this->props.min_latency * this->frame_size),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 0),
|
||||
PROP_MM (&f[1], this->type.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, 32, 1, 32),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
this->params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
this->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Ringbuffer),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaRingbuffer)),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.ringbufferSize, SPA_POD_TYPE_INT, this->period_frames * this->frame_size * 32),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, 0),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.ringbufferBlocks, SPA_POD_TYPE_INT, 1),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.ringbufferAlign, SPA_POD_TYPE_INT, 16));
|
||||
this->params[2] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
this->info.extra = NULL;
|
||||
this->info.rate = this->rate;
|
||||
}
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -400,19 +373,66 @@ spa_alsa_sink_node_port_get_info (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_alsa_sink_node_port_get_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props)
|
||||
spa_alsa_sink_node_port_enum_params (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
|
||||
SpaALSASink *this;
|
||||
SpaPODBuilder b = { NULL };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
spa_return_val_if_fail (node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail (param != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
||||
this = SPA_CONTAINER_OF (node, SpaALSASink, node);
|
||||
|
||||
spa_return_val_if_fail (CHECK_PORT (this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
||||
|
||||
spa_pod_builder_init (&b, this->params_buffer, sizeof (this->params_buffer));
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_buffers.Buffers,
|
||||
PROP (&f[1], this->type.param_alloc_buffers.size, SPA_POD_TYPE_INT,
|
||||
this->props.min_latency * this->frame_size),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.stride, SPA_POD_TYPE_INT, 0),
|
||||
PROP_MM (&f[1], this->type.param_alloc_buffers.buffers, SPA_POD_TYPE_INT, 32, 1, 32),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
break;
|
||||
|
||||
case 1:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Ringbuffer),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaRingbuffer)),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.ringbufferSize, SPA_POD_TYPE_INT, this->period_frames * this->frame_size * 32),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, 0),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.ringbufferBlocks, SPA_POD_TYPE_INT, 1),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.ringbufferAlign, SPA_POD_TYPE_INT, 16));
|
||||
break;
|
||||
|
||||
default:
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
*param = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_alsa_sink_node_port_set_props (SpaNode *node,
|
||||
spa_alsa_sink_node_port_set_param (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props)
|
||||
const SpaParam *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -471,7 +491,7 @@ static SpaResult
|
|||
spa_alsa_sink_node_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)
|
||||
|
|
@ -599,8 +619,8 @@ static const SpaNode alsasink_node = {
|
|||
spa_alsa_sink_node_port_set_format,
|
||||
spa_alsa_sink_node_port_get_format,
|
||||
spa_alsa_sink_node_port_get_info,
|
||||
spa_alsa_sink_node_port_get_props,
|
||||
spa_alsa_sink_node_port_set_props,
|
||||
spa_alsa_sink_node_port_enum_params,
|
||||
spa_alsa_sink_node_port_set_param,
|
||||
spa_alsa_sink_node_port_use_buffers,
|
||||
spa_alsa_sink_node_port_alloc_buffers,
|
||||
spa_alsa_sink_node_port_set_io,
|
||||
|
|
|
|||
|
|
@ -325,8 +325,6 @@ spa_alsa_source_node_port_set_format (SpaNode *node,
|
|||
const SpaFormat *format)
|
||||
{
|
||||
SpaALSASource *this;
|
||||
SpaPODBuilder b = { NULL };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
spa_return_val_if_fail (node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
||||
|
|
@ -358,28 +356,11 @@ spa_alsa_source_node_port_set_format (SpaNode *node,
|
|||
}
|
||||
|
||||
if (this->have_format) {
|
||||
this->info.direction = direction;
|
||||
this->info.port_id = port_id;
|
||||
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_INFO_FLAG_LIVE;
|
||||
this->info.maxbuffering = this->buffer_frames * this->frame_size;
|
||||
this->info.latency = (this->period_frames * SPA_NSEC_PER_SEC) / this->rate;
|
||||
this->info.n_params = 2;
|
||||
this->info.params = this->params;
|
||||
|
||||
spa_pod_builder_init (&b, this->params_buffer, sizeof (this->params_buffer));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->type.alloc_param_buffers.size, SPA_POD_TYPE_INT,
|
||||
this->props.min_latency * this->frame_size),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 0),
|
||||
PROP_MM (&f[1], this->type.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, 32, 1, 32),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
this->params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
this->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
this->info.extra = NULL;
|
||||
this->info.rate = this->rate;
|
||||
}
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -438,19 +419,55 @@ spa_alsa_source_node_port_get_info (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_alsa_source_node_port_get_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props)
|
||||
spa_alsa_source_node_port_enum_params (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
SpaALSASource *this;
|
||||
SpaPODBuilder b = { NULL, };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
spa_return_val_if_fail (node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail (param != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
||||
this = SPA_CONTAINER_OF (node, SpaALSASource, node);
|
||||
|
||||
spa_return_val_if_fail (CHECK_PORT (this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
||||
|
||||
spa_pod_builder_init (&b, this->params_buffer, sizeof (this->params_buffer));
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_buffers.Buffers,
|
||||
PROP (&f[1], this->type.param_alloc_buffers.size, SPA_POD_TYPE_INT,
|
||||
this->props.min_latency * this->frame_size),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.stride, SPA_POD_TYPE_INT, 0),
|
||||
PROP_MM (&f[1], this->type.param_alloc_buffers.buffers, SPA_POD_TYPE_INT, 32, 1, 32),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
break;
|
||||
|
||||
case 1:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
break;
|
||||
|
||||
default:
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
*param = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_alsa_source_node_port_set_props (SpaNode *node,
|
||||
spa_alsa_source_node_port_set_param (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props)
|
||||
const SpaParam *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -508,7 +525,7 @@ static SpaResult
|
|||
spa_alsa_source_node_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)
|
||||
|
|
@ -639,8 +656,8 @@ static const SpaNode alsasource_node = {
|
|||
spa_alsa_source_node_port_set_format,
|
||||
spa_alsa_source_node_port_get_format,
|
||||
spa_alsa_source_node_port_get_info,
|
||||
spa_alsa_source_node_port_get_props,
|
||||
spa_alsa_source_node_port_set_props,
|
||||
spa_alsa_source_node_port_enum_params,
|
||||
spa_alsa_source_node_port_set_param,
|
||||
spa_alsa_source_node_port_use_buffers,
|
||||
spa_alsa_source_node_port_alloc_buffers,
|
||||
spa_alsa_source_node_port_set_io,
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ extern "C" {
|
|||
#include <spa/log.h>
|
||||
#include <spa/list.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/param-alloc.h>
|
||||
#include <spa/loop.h>
|
||||
#include <spa/ringbuffer.h>
|
||||
#include <spa/audio/format-utils.h>
|
||||
|
|
@ -76,8 +77,8 @@ typedef struct {
|
|||
SpaTypeAudioFormat audio_format;
|
||||
SpaTypeEventNode event_node;
|
||||
SpaTypeCommandNode command_node;
|
||||
SpaTypeAllocParamBuffers alloc_param_buffers;
|
||||
SpaTypeAllocParamMetaEnable alloc_param_meta_enable;
|
||||
SpaTypeParamAllocBuffers param_alloc_buffers;
|
||||
SpaTypeParamAllocMetaEnable param_alloc_meta_enable;
|
||||
} Type;
|
||||
|
||||
static inline void
|
||||
|
|
@ -101,8 +102,8 @@ init_type (Type *type, SpaTypeMap *map)
|
|||
spa_type_audio_format_map (map, &type->audio_format);
|
||||
spa_type_event_node_map (map, &type->event_node);
|
||||
spa_type_command_node_map (map, &type->command_node);
|
||||
spa_type_alloc_param_buffers_map (map, &type->alloc_param_buffers);
|
||||
spa_type_alloc_param_meta_enable_map (map, &type->alloc_param_meta_enable);
|
||||
spa_type_param_alloc_buffers_map (map, &type->param_alloc_buffers);
|
||||
spa_type_param_alloc_meta_enable_map (map, &type->param_alloc_meta_enable);
|
||||
}
|
||||
|
||||
struct _SpaALSAState {
|
||||
|
|
@ -142,7 +143,7 @@ struct _SpaALSAState {
|
|||
size_t frame_size;
|
||||
|
||||
SpaPortInfo info;
|
||||
SpaAllocParam *params[3];
|
||||
uint32_t params[3];
|
||||
uint8_t params_buffer[1024];
|
||||
SpaPortIO *io;
|
||||
|
||||
|
|
|
|||
|
|
@ -431,19 +431,20 @@ spa_audiomixer_node_port_get_info (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_audiomixer_node_port_get_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props)
|
||||
spa_audiomixer_node_port_enum_params (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_audiomixer_node_port_set_props (SpaNode *node,
|
||||
spa_audiomixer_node_port_set_param (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props)
|
||||
const SpaParam *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -499,7 +500,7 @@ static SpaResult
|
|||
spa_audiomixer_node_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)
|
||||
|
|
@ -798,8 +799,8 @@ static const SpaNode audiomixer_node = {
|
|||
spa_audiomixer_node_port_set_format,
|
||||
spa_audiomixer_node_port_get_format,
|
||||
spa_audiomixer_node_port_get_info,
|
||||
spa_audiomixer_node_port_get_props,
|
||||
spa_audiomixer_node_port_set_props,
|
||||
spa_audiomixer_node_port_enum_params,
|
||||
spa_audiomixer_node_port_set_param,
|
||||
spa_audiomixer_node_port_use_buffers,
|
||||
spa_audiomixer_node_port_alloc_buffers,
|
||||
spa_audiomixer_node_port_set_io,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <spa/log.h>
|
||||
#include <spa/loop.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/param-alloc.h>
|
||||
#include <spa/list.h>
|
||||
#include <spa/audio/format-utils.h>
|
||||
#include <spa/format-builder.h>
|
||||
|
|
@ -56,8 +57,8 @@ typedef struct {
|
|||
SpaTypeAudioFormat audio_format;
|
||||
SpaTypeEventNode event_node;
|
||||
SpaTypeCommandNode command_node;
|
||||
SpaTypeAllocParamBuffers alloc_param_buffers;
|
||||
SpaTypeAllocParamMetaEnable alloc_param_meta_enable;
|
||||
SpaTypeParamAllocBuffers param_alloc_buffers;
|
||||
SpaTypeParamAllocMetaEnable param_alloc_meta_enable;
|
||||
} Type;
|
||||
|
||||
static inline void
|
||||
|
|
@ -81,8 +82,8 @@ init_type (Type *type, SpaTypeMap *map)
|
|||
spa_type_audio_format_map (map, &type->audio_format);
|
||||
spa_type_event_node_map (map, &type->event_node);
|
||||
spa_type_command_node_map (map, &type->command_node);
|
||||
spa_type_alloc_param_buffers_map (map, &type->alloc_param_buffers);
|
||||
spa_type_alloc_param_meta_enable_map (map, &type->alloc_param_meta_enable);
|
||||
spa_type_param_alloc_buffers_map (map, &type->param_alloc_buffers);
|
||||
spa_type_param_alloc_meta_enable_map (map, &type->param_alloc_meta_enable);
|
||||
}
|
||||
|
||||
typedef struct _SpaAudioTestSrc SpaAudioTestSrc;
|
||||
|
|
@ -128,7 +129,7 @@ struct _SpaAudioTestSrc {
|
|||
struct itimerspec timerspec;
|
||||
|
||||
SpaPortInfo info;
|
||||
SpaAllocParam *params[2];
|
||||
uint32_t params[2];
|
||||
uint8_t params_buffer[1024];
|
||||
SpaPortIO *io;
|
||||
|
||||
|
|
@ -607,29 +608,9 @@ spa_audiotestsrc_node_port_set_format (SpaNode *node,
|
|||
}
|
||||
|
||||
if (this->have_format) {
|
||||
SpaPODBuilder b = { NULL };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
this->info.maxbuffering = -1;
|
||||
this->info.latency = BYTES_TO_TIME (this, 1024);
|
||||
|
||||
this->info.n_params = 2;
|
||||
this->info.params = this->params;
|
||||
|
||||
spa_pod_builder_init (&b, this->params_buffer, sizeof (this->params_buffer));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->type.alloc_param_buffers.size, SPA_POD_TYPE_INT, 1024 * this->bpf),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.stride, SPA_POD_TYPE_INT, this->bpf),
|
||||
PROP_U_MM (&f[1], this->type.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, 32, 2, 32),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
this->params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
this->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
this->info.extra = NULL;
|
||||
this->info.direction = direction;
|
||||
this->info.port_id = port_id;
|
||||
this->info.rate = this->current_format.info.raw.rate;
|
||||
}
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -688,19 +669,54 @@ spa_audiotestsrc_node_port_get_info (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_audiotestsrc_node_port_get_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props)
|
||||
spa_audiotestsrc_node_port_enum_params (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
SpaAudioTestSrc *this;
|
||||
SpaPODBuilder b = { NULL, };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
spa_return_val_if_fail (node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail (param != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
||||
this = SPA_CONTAINER_OF (node, SpaAudioTestSrc, node);
|
||||
|
||||
spa_return_val_if_fail (CHECK_PORT (this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
||||
|
||||
spa_pod_builder_init (&b, this->params_buffer, sizeof (this->params_buffer));
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_buffers.Buffers,
|
||||
PROP (&f[1], this->type.param_alloc_buffers.size, SPA_POD_TYPE_INT, 1024 * this->bpf),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.stride, SPA_POD_TYPE_INT, this->bpf),
|
||||
PROP_U_MM (&f[1], this->type.param_alloc_buffers.buffers, SPA_POD_TYPE_INT, 32, 2, 32),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
break;
|
||||
|
||||
case 1:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
break;
|
||||
|
||||
default:
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
*param = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_audiotestsrc_node_port_set_props (SpaNode *node,
|
||||
spa_audiotestsrc_node_port_set_param (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props)
|
||||
const SpaParam *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -753,7 +769,7 @@ static SpaResult
|
|||
spa_audiotestsrc_node_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)
|
||||
|
|
@ -882,8 +898,8 @@ static const SpaNode audiotestsrc_node = {
|
|||
spa_audiotestsrc_node_port_set_format,
|
||||
spa_audiotestsrc_node_port_get_format,
|
||||
spa_audiotestsrc_node_port_get_info,
|
||||
spa_audiotestsrc_node_port_get_props,
|
||||
spa_audiotestsrc_node_port_set_props,
|
||||
spa_audiotestsrc_node_port_enum_params,
|
||||
spa_audiotestsrc_node_port_set_param,
|
||||
spa_audiotestsrc_node_port_use_buffers,
|
||||
spa_audiotestsrc_node_port_alloc_buffers,
|
||||
spa_audiotestsrc_node_port_set_io,
|
||||
|
|
|
|||
|
|
@ -324,19 +324,20 @@ spa_ffmpeg_dec_node_port_get_info (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_ffmpeg_dec_node_port_get_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props)
|
||||
spa_ffmpeg_dec_node_port_enum_params (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_ffmpeg_dec_node_port_set_props (SpaNode *node,
|
||||
spa_ffmpeg_dec_node_port_set_param (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props)
|
||||
const SpaParam *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -361,7 +362,7 @@ static SpaResult
|
|||
spa_ffmpeg_dec_node_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)
|
||||
|
|
@ -463,8 +464,8 @@ static const SpaNode ffmpeg_dec_node = {
|
|||
spa_ffmpeg_dec_node_port_set_format,
|
||||
spa_ffmpeg_dec_node_port_get_format,
|
||||
spa_ffmpeg_dec_node_port_get_info,
|
||||
spa_ffmpeg_dec_node_port_get_props,
|
||||
spa_ffmpeg_dec_node_port_set_props,
|
||||
spa_ffmpeg_dec_node_port_enum_params,
|
||||
spa_ffmpeg_dec_node_port_set_param,
|
||||
spa_ffmpeg_dec_node_port_use_buffers,
|
||||
spa_ffmpeg_dec_node_port_alloc_buffers,
|
||||
spa_ffmpeg_dec_node_port_set_io,
|
||||
|
|
|
|||
|
|
@ -328,19 +328,20 @@ spa_ffmpeg_enc_node_port_get_info (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_ffmpeg_enc_node_port_get_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props)
|
||||
spa_ffmpeg_enc_node_port_enum_params (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_ffmpeg_enc_node_port_set_props (SpaNode *node,
|
||||
spa_ffmpeg_enc_node_port_set_param (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props)
|
||||
const SpaParam *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -365,7 +366,7 @@ static SpaResult
|
|||
spa_ffmpeg_enc_node_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)
|
||||
|
|
@ -466,8 +467,8 @@ static const SpaNode ffmpeg_enc_node = {
|
|||
spa_ffmpeg_enc_node_port_set_format,
|
||||
spa_ffmpeg_enc_node_port_get_format,
|
||||
spa_ffmpeg_enc_node_port_get_info,
|
||||
spa_ffmpeg_enc_node_port_get_props,
|
||||
spa_ffmpeg_enc_node_port_set_props,
|
||||
spa_ffmpeg_enc_node_port_enum_params,
|
||||
spa_ffmpeg_enc_node_port_set_param,
|
||||
spa_ffmpeg_enc_node_port_use_buffers,
|
||||
spa_ffmpeg_enc_node_port_alloc_buffers,
|
||||
spa_ffmpeg_enc_node_port_set_io,
|
||||
|
|
|
|||
|
|
@ -60,8 +60,6 @@ typedef struct {
|
|||
bool have_buffers;
|
||||
LibvaBuffer buffers[MAX_BUFFERS];
|
||||
SpaPortInfo info;
|
||||
SpaAllocParam *params[1];
|
||||
SpaAllocParamBuffers param_buffers;
|
||||
SpaPortStatus status;
|
||||
} SpaLibvaState;
|
||||
|
||||
|
|
@ -412,7 +410,7 @@ spa_libva_dec_node_port_use_buffers (SpaHandle *handle,
|
|||
static SpaResult
|
||||
spa_libva_dec_node_port_alloc_buffers (SpaHandle *handle,
|
||||
uint32_t port_id,
|
||||
SpaAllocParam **params,
|
||||
SpaParam **params,
|
||||
uint32_t n_params,
|
||||
SpaBuffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <spa/log.h>
|
||||
#include <spa/loop.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/param-alloc.h>
|
||||
#include <spa/list.h>
|
||||
#include <spa/format-builder.h>
|
||||
#include <lib/props.h>
|
||||
|
|
@ -42,8 +43,8 @@ typedef struct {
|
|||
SpaTypeData data;
|
||||
SpaTypeEventNode event_node;
|
||||
SpaTypeCommandNode command_node;
|
||||
SpaTypeAllocParamBuffers alloc_param_buffers;
|
||||
SpaTypeAllocParamMetaEnable alloc_param_meta_enable;
|
||||
SpaTypeParamAllocBuffers param_alloc_buffers;
|
||||
SpaTypeParamAllocMetaEnable param_alloc_meta_enable;
|
||||
} Type;
|
||||
|
||||
static inline void
|
||||
|
|
@ -58,8 +59,8 @@ init_type (Type *type, SpaTypeMap *map)
|
|||
spa_type_data_map (map, &type->data);
|
||||
spa_type_event_node_map (map, &type->event_node);
|
||||
spa_type_command_node_map (map, &type->command_node);
|
||||
spa_type_alloc_param_buffers_map (map, &type->alloc_param_buffers);
|
||||
spa_type_alloc_param_meta_enable_map (map, &type->alloc_param_meta_enable);
|
||||
spa_type_param_alloc_buffers_map (map, &type->param_alloc_buffers);
|
||||
spa_type_param_alloc_meta_enable_map (map, &type->param_alloc_meta_enable);
|
||||
}
|
||||
|
||||
typedef struct _SpaFakeSink SpaFakeSink;
|
||||
|
|
@ -100,7 +101,6 @@ struct _SpaFakeSink {
|
|||
struct itimerspec timerspec;
|
||||
|
||||
SpaPortInfo info;
|
||||
SpaAllocParam *params[2];
|
||||
uint8_t params_buffer[1024];
|
||||
SpaPortIO *io;
|
||||
|
||||
|
|
@ -467,33 +467,6 @@ spa_fakesink_node_port_set_format (SpaNode *node,
|
|||
memcpy (this->format_buffer, format, SPA_POD_SIZE (format));
|
||||
this->have_format = true;
|
||||
}
|
||||
|
||||
if (this->have_format) {
|
||||
SpaPODBuilder b = { NULL };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
this->info.latency = 0;
|
||||
this->info.maxbuffering = -1;
|
||||
|
||||
this->info.n_params = 2;
|
||||
this->info.params = this->params;
|
||||
|
||||
spa_pod_builder_init (&b, this->params_buffer, sizeof (this->params_buffer));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->type.alloc_param_buffers.size, SPA_POD_TYPE_INT, 128),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 1),
|
||||
PROP_U_MM (&f[1], this->type.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, 32, 2, 32),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
this->params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
this->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
this->info.extra = NULL;
|
||||
}
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -541,29 +514,63 @@ spa_fakesink_node_port_get_info (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_fakesink_node_port_get_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props)
|
||||
spa_fakesink_node_port_enum_params (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
SpaFakeSink *this;
|
||||
SpaPODBuilder b = { NULL };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
spa_return_val_if_fail (node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail (param != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
||||
this = SPA_CONTAINER_OF (node, SpaFakeSink, node);
|
||||
|
||||
spa_return_val_if_fail (CHECK_PORT (this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
||||
|
||||
spa_pod_builder_init (&b, this->params_buffer, sizeof (this->params_buffer));
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_buffers.Buffers,
|
||||
PROP (&f[1], this->type.param_alloc_buffers.size, SPA_POD_TYPE_INT, 128),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.stride, SPA_POD_TYPE_INT, 1),
|
||||
PROP_U_MM (&f[1], this->type.param_alloc_buffers.buffers, SPA_POD_TYPE_INT, 32, 2, 32),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
break;
|
||||
|
||||
case 1:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
break;
|
||||
|
||||
default:
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
*param = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_fakesink_node_port_set_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props)
|
||||
spa_fakesink_node_port_set_param (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaParam *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_fakesink_node_port_use_buffers (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaBuffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaBuffer **buffers,
|
||||
uint32_t n_buffers)
|
||||
{
|
||||
SpaFakeSink *this;
|
||||
uint32_t i;
|
||||
|
|
@ -604,7 +611,7 @@ static SpaResult
|
|||
spa_fakesink_node_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)
|
||||
|
|
@ -716,8 +723,8 @@ static const SpaNode fakesink_node = {
|
|||
spa_fakesink_node_port_set_format,
|
||||
spa_fakesink_node_port_get_format,
|
||||
spa_fakesink_node_port_get_info,
|
||||
spa_fakesink_node_port_get_props,
|
||||
spa_fakesink_node_port_set_props,
|
||||
spa_fakesink_node_port_enum_params,
|
||||
spa_fakesink_node_port_set_param,
|
||||
spa_fakesink_node_port_use_buffers,
|
||||
spa_fakesink_node_port_alloc_buffers,
|
||||
spa_fakesink_node_port_set_io,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <spa/log.h>
|
||||
#include <spa/loop.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/param-alloc.h>
|
||||
#include <spa/list.h>
|
||||
#include <spa/format-builder.h>
|
||||
#include <lib/props.h>
|
||||
|
|
@ -43,8 +44,8 @@ typedef struct {
|
|||
SpaTypeData data;
|
||||
SpaTypeEventNode event_node;
|
||||
SpaTypeCommandNode command_node;
|
||||
SpaTypeAllocParamBuffers alloc_param_buffers;
|
||||
SpaTypeAllocParamMetaEnable alloc_param_meta_enable;
|
||||
SpaTypeParamAllocBuffers param_alloc_buffers;
|
||||
SpaTypeParamAllocMetaEnable param_alloc_meta_enable;
|
||||
} Type;
|
||||
|
||||
static inline void
|
||||
|
|
@ -60,8 +61,8 @@ init_type (Type *type, SpaTypeMap *map)
|
|||
spa_type_data_map (map, &type->data);
|
||||
spa_type_event_node_map (map, &type->event_node);
|
||||
spa_type_command_node_map (map, &type->command_node);
|
||||
spa_type_alloc_param_buffers_map (map, &type->alloc_param_buffers);
|
||||
spa_type_alloc_param_meta_enable_map (map, &type->alloc_param_meta_enable);
|
||||
spa_type_param_alloc_buffers_map (map, &type->param_alloc_buffers);
|
||||
spa_type_param_alloc_meta_enable_map (map, &type->param_alloc_meta_enable);
|
||||
}
|
||||
|
||||
typedef struct _SpaFakeSrc SpaFakeSrc;
|
||||
|
|
@ -103,7 +104,6 @@ struct _SpaFakeSrc {
|
|||
struct itimerspec timerspec;
|
||||
|
||||
SpaPortInfo info;
|
||||
SpaAllocParam *params[2];
|
||||
uint8_t params_buffer[1024];
|
||||
SpaPortIO *io;
|
||||
|
||||
|
|
@ -481,29 +481,6 @@ spa_fakesrc_node_port_set_format (SpaNode *node,
|
|||
}
|
||||
|
||||
if (this->have_format) {
|
||||
SpaPODBuilder b = { NULL };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
this->info.latency = 0;
|
||||
this->info.maxbuffering = -1;
|
||||
|
||||
this->info.n_params = 2;
|
||||
this->info.params = this->params;
|
||||
|
||||
spa_pod_builder_init (&b, this->params_buffer, sizeof (this->params_buffer));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->type.alloc_param_buffers.size, SPA_POD_TYPE_INT, 128),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 1),
|
||||
PROP_U_MM (&f[1], this->type.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, 32, 2, 32),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
this->params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
this->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
this->info.extra = NULL;
|
||||
}
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -553,19 +530,53 @@ spa_fakesrc_node_port_get_info (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_fakesrc_node_port_get_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props)
|
||||
spa_fakesrc_node_port_enum_params (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
SpaFakeSrc *this;
|
||||
SpaPODBuilder b = { NULL };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
spa_return_val_if_fail (node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail (param != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
||||
this = SPA_CONTAINER_OF (node, SpaFakeSrc, node);
|
||||
|
||||
spa_return_val_if_fail (CHECK_PORT (this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
||||
|
||||
spa_pod_builder_init (&b, this->params_buffer, sizeof (this->params_buffer));
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_buffers.Buffers,
|
||||
PROP (&f[1], this->type.param_alloc_buffers.size, SPA_POD_TYPE_INT, 128),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.stride, SPA_POD_TYPE_INT, 1),
|
||||
PROP_U_MM (&f[1], this->type.param_alloc_buffers.buffers, SPA_POD_TYPE_INT, 32, 2, 32),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
break;
|
||||
|
||||
case 1:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
break;
|
||||
|
||||
default:
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
*param = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_fakesrc_node_port_set_props (SpaNode *node,
|
||||
spa_fakesrc_node_port_set_param (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props)
|
||||
const SpaParam *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -618,7 +629,7 @@ static SpaResult
|
|||
spa_fakesrc_node_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)
|
||||
|
|
@ -749,8 +760,8 @@ static const SpaNode fakesrc_node = {
|
|||
spa_fakesrc_node_port_set_format,
|
||||
spa_fakesrc_node_port_get_format,
|
||||
spa_fakesrc_node_port_get_info,
|
||||
spa_fakesrc_node_port_get_props,
|
||||
spa_fakesrc_node_port_set_props,
|
||||
spa_fakesrc_node_port_enum_params,
|
||||
spa_fakesrc_node_port_set_param,
|
||||
spa_fakesrc_node_port_use_buffers,
|
||||
spa_fakesrc_node_port_alloc_buffers,
|
||||
spa_fakesrc_node_port_set_io,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <spa/list.h>
|
||||
#include <spa/log.h>
|
||||
#include <spa/loop.h>
|
||||
#include <spa/param-alloc.h>
|
||||
#include <spa/type-map.h>
|
||||
#include <spa/format-builder.h>
|
||||
#include <lib/debug.h>
|
||||
|
|
@ -78,8 +79,8 @@ typedef struct {
|
|||
SpaTypeVideoFormat video_format;
|
||||
SpaTypeEventNode event_node;
|
||||
SpaTypeCommandNode command_node;
|
||||
SpaTypeAllocParamBuffers alloc_param_buffers;
|
||||
SpaTypeAllocParamMetaEnable alloc_param_meta_enable;
|
||||
SpaTypeParamAllocBuffers param_alloc_buffers;
|
||||
SpaTypeParamAllocMetaEnable param_alloc_meta_enable;
|
||||
SpaTypeMeta meta;
|
||||
SpaTypeData data;
|
||||
} Type;
|
||||
|
|
@ -101,8 +102,8 @@ init_type (Type *type, SpaTypeMap *map)
|
|||
spa_type_video_format_map (map, &type->video_format);
|
||||
spa_type_event_node_map (map, &type->event_node);
|
||||
spa_type_command_node_map (map, &type->command_node);
|
||||
spa_type_alloc_param_buffers_map (map, &type->alloc_param_buffers);
|
||||
spa_type_alloc_param_meta_enable_map (map, &type->alloc_param_meta_enable);
|
||||
spa_type_param_alloc_buffers_map (map, &type->param_alloc_buffers);
|
||||
spa_type_param_alloc_meta_enable_map (map, &type->param_alloc_meta_enable);
|
||||
spa_type_meta_map (map, &type->meta);
|
||||
spa_type_data_map (map, &type->data);
|
||||
}
|
||||
|
|
@ -139,7 +140,6 @@ typedef struct {
|
|||
SpaSource source;
|
||||
|
||||
SpaPortInfo info;
|
||||
SpaAllocParam *params[2];
|
||||
uint8_t params_buffer[1024];
|
||||
SpaPortIO *io;
|
||||
|
||||
|
|
@ -637,19 +637,58 @@ spa_v4l2_source_node_port_get_info (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_v4l2_source_node_port_get_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props)
|
||||
spa_v4l2_source_node_port_enum_params (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
|
||||
SpaV4l2Source *this;
|
||||
SpaV4l2State *state;
|
||||
SpaPODBuilder b = { NULL, };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
spa_return_val_if_fail (node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail (param != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
||||
this = SPA_CONTAINER_OF (node, SpaV4l2Source, node);
|
||||
|
||||
spa_return_val_if_fail (CHECK_PORT (this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
||||
|
||||
state = &this->state[port_id];
|
||||
|
||||
spa_pod_builder_init (&b, state->params_buffer, sizeof (state->params_buffer));
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_buffers.Buffers,
|
||||
PROP (&f[1], this->type.param_alloc_buffers.size, SPA_POD_TYPE_INT, state->fmt.fmt.pix.sizeimage),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.stride, SPA_POD_TYPE_INT, state->fmt.fmt.pix.bytesperline),
|
||||
PROP_U_MM (&f[1], this->type.param_alloc_buffers.buffers, SPA_POD_TYPE_INT, MAX_BUFFERS, 2, MAX_BUFFERS),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
break;
|
||||
|
||||
case 1:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
break;
|
||||
|
||||
default:
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
*param = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_v4l2_source_node_port_set_props (SpaNode *node,
|
||||
spa_v4l2_source_node_port_set_param (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props)
|
||||
const SpaParam *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -692,7 +731,7 @@ static SpaResult
|
|||
spa_v4l2_source_node_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)
|
||||
|
|
@ -831,8 +870,8 @@ static const SpaNode v4l2source_node = {
|
|||
spa_v4l2_source_node_port_set_format,
|
||||
spa_v4l2_source_node_port_get_format,
|
||||
spa_v4l2_source_node_port_get_info,
|
||||
spa_v4l2_source_node_port_get_props,
|
||||
spa_v4l2_source_node_port_set_props,
|
||||
spa_v4l2_source_node_port_enum_params,
|
||||
spa_v4l2_source_node_port_set_param,
|
||||
spa_v4l2_source_node_port_use_buffers,
|
||||
spa_v4l2_source_node_port_alloc_buffers,
|
||||
spa_v4l2_source_node_port_set_io,
|
||||
|
|
|
|||
|
|
@ -814,8 +814,6 @@ spa_v4l2_set_format (SpaV4l2Source *this, SpaVideoInfo *format, bool try_only)
|
|||
uint32_t video_format;
|
||||
SpaRectangle *size = NULL;
|
||||
SpaFraction *framerate = NULL;
|
||||
SpaPODBuilder b = { NULL };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
CLEAR (fmt);
|
||||
CLEAR (streamparm);
|
||||
|
|
@ -900,30 +898,12 @@ spa_v4l2_set_format (SpaV4l2Source *this, SpaVideoInfo *format, bool try_only)
|
|||
framerate->denom = streamparm.parm.capture.timeperframe.numerator;
|
||||
|
||||
state->fmt = fmt;
|
||||
state->info.direction = SPA_DIRECTION_OUTPUT;
|
||||
state->info.port_id = 0;
|
||||
state->info.flags = (state->export_buf ? SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS : 0) |
|
||||
SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
||||
SPA_PORT_INFO_FLAG_LIVE;
|
||||
state->info.maxbuffering = -1;
|
||||
state->info.latency = (streamparm.parm.capture.timeperframe.numerator * SPA_NSEC_PER_SEC) /
|
||||
streamparm.parm.capture.timeperframe.denominator;
|
||||
|
||||
state->info.n_params = 2;
|
||||
state->info.params = state->params;
|
||||
|
||||
spa_pod_builder_init (&b, state->params_buffer, sizeof (state->params_buffer));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->type.alloc_param_buffers.size, SPA_POD_TYPE_INT, fmt.fmt.pix.sizeimage),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.stride, SPA_POD_TYPE_INT, fmt.fmt.pix.bytesperline),
|
||||
PROP_U_MM (&f[1], this->type.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, MAX_BUFFERS, 2, MAX_BUFFERS),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
state->params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
state->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
state->info.extra = NULL;
|
||||
state->info.rate = streamparm.parm.capture.timeperframe.denominator;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1077,7 +1057,7 @@ spa_v4l2_use_buffers (SpaV4l2Source *this, SpaBuffer **buffers, uint32_t n_buffe
|
|||
|
||||
static SpaResult
|
||||
mmap_init (SpaV4l2Source *this,
|
||||
SpaAllocParam **params,
|
||||
SpaParam **params,
|
||||
uint32_t n_params,
|
||||
SpaBuffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
@ -1189,7 +1169,7 @@ read_init (SpaV4l2Source *this)
|
|||
|
||||
static SpaResult
|
||||
spa_v4l2_alloc_buffers (SpaV4l2Source *this,
|
||||
SpaAllocParam **params,
|
||||
SpaParam **params,
|
||||
uint32_t n_params,
|
||||
SpaBuffer **buffers,
|
||||
uint32_t *n_buffers)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include <spa/log.h>
|
||||
#include <spa/loop.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/param-alloc.h>
|
||||
#include <spa/list.h>
|
||||
#include <spa/video/format-utils.h>
|
||||
#include <spa/format-builder.h>
|
||||
|
|
@ -54,8 +55,8 @@ typedef struct {
|
|||
SpaTypeVideoFormat video_format;
|
||||
SpaTypeEventNode event_node;
|
||||
SpaTypeCommandNode command_node;
|
||||
SpaTypeAllocParamBuffers alloc_param_buffers;
|
||||
SpaTypeAllocParamMetaEnable alloc_param_meta_enable;
|
||||
SpaTypeParamAllocBuffers param_alloc_buffers;
|
||||
SpaTypeParamAllocMetaEnable param_alloc_meta_enable;
|
||||
} Type;
|
||||
|
||||
static inline void
|
||||
|
|
@ -77,8 +78,8 @@ init_type (Type *type, SpaTypeMap *map)
|
|||
spa_type_video_format_map (map, &type->video_format);
|
||||
spa_type_event_node_map (map, &type->event_node);
|
||||
spa_type_command_node_map (map, &type->command_node);
|
||||
spa_type_alloc_param_buffers_map (map, &type->alloc_param_buffers);
|
||||
spa_type_alloc_param_meta_enable_map (map, &type->alloc_param_meta_enable);
|
||||
spa_type_param_alloc_buffers_map (map, &type->param_alloc_buffers);
|
||||
spa_type_param_alloc_meta_enable_map (map, &type->param_alloc_meta_enable);
|
||||
}
|
||||
|
||||
typedef struct _SpaVideoTestSrc SpaVideoTestSrc;
|
||||
|
|
@ -120,7 +121,6 @@ struct _SpaVideoTestSrc {
|
|||
struct itimerspec timerspec;
|
||||
|
||||
SpaPortInfo info;
|
||||
SpaAllocParam *params[2];
|
||||
uint8_t params_buffer[1024];
|
||||
SpaPortIO *io;
|
||||
|
||||
|
|
@ -560,30 +560,7 @@ spa_videotestsrc_node_port_set_format (SpaNode *node,
|
|||
|
||||
if (this->have_format) {
|
||||
SpaVideoInfoRaw *raw_info = &this->current_format.info.raw;
|
||||
SpaPODBuilder b = { NULL };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
this->info.latency = 0;
|
||||
this->info.maxbuffering = -1;
|
||||
|
||||
this->info.n_params = 2;
|
||||
this->info.params = this->params;
|
||||
this->stride = SPA_ROUND_UP_N (this->bpp * raw_info->size.width, 4);
|
||||
|
||||
spa_pod_builder_init (&b, this->params_buffer, sizeof (this->params_buffer));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->type.alloc_param_buffers.size, SPA_POD_TYPE_INT, this->stride * raw_info->size.height),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.stride, SPA_POD_TYPE_INT, this->stride),
|
||||
PROP_U_MM (&f[1], this->type.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, 32, 2, 32),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
this->params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
this->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
this->info.extra = NULL;
|
||||
}
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -641,19 +618,57 @@ spa_videotestsrc_node_port_get_info (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_videotestsrc_node_port_get_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props)
|
||||
spa_videotestsrc_node_port_enum_params (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
SpaVideoTestSrc *this;
|
||||
SpaPODBuilder b = { NULL, };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
spa_return_val_if_fail (node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail (param != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
||||
this = SPA_CONTAINER_OF (node, SpaVideoTestSrc, node);
|
||||
|
||||
spa_return_val_if_fail (CHECK_PORT (this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
||||
|
||||
spa_pod_builder_init (&b, this->params_buffer, sizeof (this->params_buffer));
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
{
|
||||
SpaVideoInfoRaw *raw_info = &this->current_format.info.raw;
|
||||
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_buffers.Buffers,
|
||||
PROP (&f[1], this->type.param_alloc_buffers.size, SPA_POD_TYPE_INT, this->stride * raw_info->size.height),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.stride, SPA_POD_TYPE_INT, this->stride),
|
||||
PROP_U_MM (&f[1], this->type.param_alloc_buffers.buffers, SPA_POD_TYPE_INT, 32, 2, 32),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
break;
|
||||
|
||||
default:
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
*param = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_videotestsrc_node_port_set_props (SpaNode *node,
|
||||
spa_videotestsrc_node_port_set_param (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props)
|
||||
const SpaParam *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -705,7 +720,7 @@ static SpaResult
|
|||
spa_videotestsrc_node_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)
|
||||
|
|
@ -834,8 +849,8 @@ static const SpaNode videotestsrc_node = {
|
|||
spa_videotestsrc_node_port_set_format,
|
||||
spa_videotestsrc_node_port_get_format,
|
||||
spa_videotestsrc_node_port_get_info,
|
||||
spa_videotestsrc_node_port_get_props,
|
||||
spa_videotestsrc_node_port_set_props,
|
||||
spa_videotestsrc_node_port_enum_params,
|
||||
spa_videotestsrc_node_port_set_param,
|
||||
spa_videotestsrc_node_port_use_buffers,
|
||||
spa_videotestsrc_node_port_alloc_buffers,
|
||||
spa_videotestsrc_node_port_set_io,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <spa/list.h>
|
||||
#include <spa/audio/format-utils.h>
|
||||
#include <spa/format-builder.h>
|
||||
#include <spa/param-alloc.h>
|
||||
#include <lib/props.h>
|
||||
|
||||
#define MAX_BUFFERS 16
|
||||
|
|
@ -50,7 +51,6 @@ typedef struct {
|
|||
bool have_format;
|
||||
|
||||
SpaPortInfo info;
|
||||
SpaAllocParam *params[2];
|
||||
uint8_t params_buffer[1024];
|
||||
|
||||
SpaVolumeBuffer buffers[MAX_BUFFERS];
|
||||
|
|
@ -74,8 +74,8 @@ typedef struct {
|
|||
SpaTypeAudioFormat audio_format;
|
||||
SpaTypeEventNode event_node;
|
||||
SpaTypeCommandNode command_node;
|
||||
SpaTypeAllocParamBuffers alloc_param_buffers;
|
||||
SpaTypeAllocParamMetaEnable alloc_param_meta_enable;
|
||||
SpaTypeParamAllocBuffers param_alloc_buffers;
|
||||
SpaTypeParamAllocMetaEnable param_alloc_meta_enable;
|
||||
} Type;
|
||||
|
||||
static inline void
|
||||
|
|
@ -94,8 +94,8 @@ init_type (Type *type, SpaTypeMap *map)
|
|||
spa_type_audio_format_map (map, &type->audio_format);
|
||||
spa_type_event_node_map (map, &type->event_node);
|
||||
spa_type_command_node_map (map, &type->command_node);
|
||||
spa_type_alloc_param_buffers_map (map, &type->alloc_param_buffers);
|
||||
spa_type_alloc_param_meta_enable_map (map, &type->alloc_param_meta_enable);
|
||||
spa_type_param_alloc_buffers_map (map, &type->param_alloc_buffers);
|
||||
spa_type_param_alloc_meta_enable_map (map, &type->param_alloc_meta_enable);
|
||||
}
|
||||
|
||||
struct _SpaVolume {
|
||||
|
|
@ -388,32 +388,6 @@ spa_volume_node_port_set_format (SpaNode *node,
|
|||
port->have_format = true;
|
||||
}
|
||||
|
||||
if (port->have_format) {
|
||||
SpaPODBuilder b = { NULL };
|
||||
SpaPODFrame f[2];
|
||||
|
||||
port->info.maxbuffering = -1;
|
||||
port->info.latency = 0;
|
||||
|
||||
port->info.n_params = 2;
|
||||
port->info.params = port->params;
|
||||
|
||||
spa_pod_builder_init (&b, port->params_buffer, sizeof (port->params_buffer));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->type.alloc_param_buffers.size, SPA_POD_TYPE_INT, 16),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 16),
|
||||
PROP_U_MM (&f[1], this->type.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, MAX_BUFFERS, 2, MAX_BUFFERS),
|
||||
PROP (&f[1], this->type.alloc_param_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
port->params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.alloc_param_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
port->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
port->info.extra = NULL;
|
||||
}
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -466,19 +440,57 @@ spa_volume_node_port_get_info (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_volume_node_port_get_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props)
|
||||
spa_volume_node_port_enum_params (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
SpaPODBuilder b = { NULL };
|
||||
SpaPODFrame f[2];
|
||||
SpaVolume *this;
|
||||
SpaVolumePort *port;
|
||||
|
||||
spa_return_val_if_fail (node != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
spa_return_val_if_fail (param != NULL, SPA_RESULT_INVALID_ARGUMENTS);
|
||||
|
||||
this = SPA_CONTAINER_OF (node, SpaVolume, node);
|
||||
|
||||
spa_return_val_if_fail (CHECK_PORT (this, direction, port_id), SPA_RESULT_INVALID_PORT);
|
||||
|
||||
port = direction == SPA_DIRECTION_INPUT ? &this->in_ports[port_id] : &this->out_ports[port_id];
|
||||
|
||||
spa_pod_builder_init (&b, port->params_buffer, sizeof (port->params_buffer));
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_buffers.Buffers,
|
||||
PROP (&f[1], this->type.param_alloc_buffers.size, SPA_POD_TYPE_INT, 16),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.stride, SPA_POD_TYPE_INT, 16),
|
||||
PROP_U_MM (&f[1], this->type.param_alloc_buffers.buffers, SPA_POD_TYPE_INT, MAX_BUFFERS, 2, MAX_BUFFERS),
|
||||
PROP (&f[1], this->type.param_alloc_buffers.align, SPA_POD_TYPE_INT, 16));
|
||||
break;
|
||||
|
||||
case 1:
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->type.param_alloc_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.type, SPA_POD_TYPE_ID, this->type.meta.Header),
|
||||
PROP (&f[1], this->type.param_alloc_meta_enable.size, SPA_POD_TYPE_INT, sizeof (SpaMetaHeader)));
|
||||
break;
|
||||
|
||||
default:
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
*param = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaParam);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_volume_node_port_set_props (SpaNode *node,
|
||||
spa_volume_node_port_set_param (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props)
|
||||
const SpaParam *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -538,7 +550,7 @@ static SpaResult
|
|||
spa_volume_node_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)
|
||||
|
|
@ -772,8 +784,8 @@ static const SpaNode volume_node = {
|
|||
spa_volume_node_port_set_format,
|
||||
spa_volume_node_port_get_format,
|
||||
spa_volume_node_port_get_info,
|
||||
spa_volume_node_port_get_props,
|
||||
spa_volume_node_port_set_props,
|
||||
spa_volume_node_port_enum_params,
|
||||
spa_volume_node_port_set_param,
|
||||
spa_volume_node_port_use_buffers,
|
||||
spa_volume_node_port_alloc_buffers,
|
||||
spa_volume_node_port_set_io,
|
||||
|
|
|
|||
|
|
@ -388,19 +388,20 @@ spa_xv_sink_node_port_get_info (SpaNode *node,
|
|||
}
|
||||
|
||||
static SpaResult
|
||||
spa_xv_sink_node_port_get_props (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
SpaProps **props)
|
||||
spa_xv_sink_node_port_enum_params (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
uint32_t index,
|
||||
SpaParam **param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
spa_xv_sink_node_port_set_props (SpaNode *node,
|
||||
spa_xv_sink_node_port_set_param (SpaNode *node,
|
||||
SpaDirection direction,
|
||||
uint32_t port_id,
|
||||
const SpaProps *props)
|
||||
const SpaParam *param)
|
||||
{
|
||||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -419,7 +420,7 @@ static SpaResult
|
|||
spa_xv_sink_node_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)
|
||||
|
|
@ -492,8 +493,8 @@ static const SpaNode xvsink_node = {
|
|||
spa_xv_sink_node_port_set_format,
|
||||
spa_xv_sink_node_port_get_format,
|
||||
spa_xv_sink_node_port_get_info,
|
||||
spa_xv_sink_node_port_get_props,
|
||||
spa_xv_sink_node_port_set_props,
|
||||
spa_xv_sink_node_port_enum_params,
|
||||
spa_xv_sink_node_port_set_param,
|
||||
spa_xv_sink_node_port_use_buffers,
|
||||
spa_xv_sink_node_port_alloc_buffers,
|
||||
spa_xv_sink_node_port_set_io,
|
||||
|
|
|
|||
|
|
@ -51,10 +51,9 @@ inspect_port (AppData *data, SpaNode *node, SpaDirection direction, uint32_t por
|
|||
{
|
||||
SpaResult res;
|
||||
SpaFormat *format;
|
||||
uint32_t index = 0;
|
||||
SpaProps *props;
|
||||
uint32_t index;
|
||||
|
||||
while (true) {
|
||||
for (index = 0; ; index++) {
|
||||
if ((res = spa_node_port_enum_formats (node, direction, port_id, &format, NULL, index)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf ("got error %d\n", res);
|
||||
|
|
@ -62,12 +61,19 @@ inspect_port (AppData *data, SpaNode *node, SpaDirection direction, uint32_t por
|
|||
}
|
||||
if (format)
|
||||
spa_debug_format (format, data->map);
|
||||
index++;
|
||||
}
|
||||
if ((res = spa_node_port_get_props (node, direction, port_id, &props)) < 0)
|
||||
printf ("port_get_props error: %d\n", res);
|
||||
else
|
||||
spa_debug_props (props, data->map);
|
||||
|
||||
|
||||
for (index = 0; ; index++) {
|
||||
SpaParam *param;
|
||||
|
||||
if ((res = spa_node_port_enum_params (node, direction, port_id, index, ¶m)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf ("port_enum_params error: %d\n", res);
|
||||
break;
|
||||
}
|
||||
spa_debug_param (param, data->map);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue