mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alloc-params: use dynamic types for alloc-params
This commit is contained in:
parent
7270986c3a
commit
048a4b81a8
21 changed files with 166 additions and 271 deletions
|
|
@ -27,7 +27,7 @@ extern "C" {
|
|||
#include <spa/defs.h>
|
||||
#include <spa/props.h>
|
||||
#include <spa/format.h>
|
||||
#include <spa/port.h>
|
||||
#include <spa/alloc-param.h>
|
||||
#include <spa/node.h>
|
||||
|
||||
typedef struct _PinosClientNodeBuffer PinosClientNodeBuffer;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ typedef struct _PinosTransportArea PinosTransportArea;
|
|||
#include <string.h>
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/port.h>
|
||||
#include <spa/node.h>
|
||||
|
||||
#include <pinos/client/mem.h>
|
||||
|
|
|
|||
|
|
@ -52,4 +52,7 @@ pinos_uri_init (PinosURI *uri)
|
|||
spa_node_events_map (uri->map, &uri->node_events);
|
||||
spa_node_commands_map (uri->map, &uri->node_commands);
|
||||
spa_monitor_types_map (uri->map, &uri->monitor_types);
|
||||
spa_alloc_param_buffers_map (uri->map, &uri->alloc_param_buffers);
|
||||
spa_alloc_param_meta_enable_map (uri->map, &uri->alloc_param_meta_enable);
|
||||
spa_alloc_param_video_padding_map (uri->map, &uri->alloc_param_video_padding);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ struct _PinosURI {
|
|||
SpaNodeEvents node_events;
|
||||
SpaNodeCommands node_commands;
|
||||
SpaMonitorTypes monitor_types;
|
||||
SpaAllocParamBuffers alloc_param_buffers;
|
||||
SpaAllocParamMetaEnable alloc_param_meta_enable;
|
||||
SpaAllocParamVideoPadding alloc_param_video_padding;
|
||||
};
|
||||
|
||||
void pinos_uri_init (PinosURI *uri);
|
||||
|
|
|
|||
|
|
@ -128,29 +128,31 @@ do_start (GstBufferPool * pool)
|
|||
SpaPODBuilder b = { NULL };
|
||||
uint8_t buffer[1024];
|
||||
SpaPODFrame f[2];
|
||||
PinosContext *ctx = p->stream->context;
|
||||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_get_params (config, &caps, &size, &min_buffers, &max_buffers);
|
||||
|
||||
spa_pod_builder_init (&b, buffer, sizeof (buffer));
|
||||
spa_pod_builder_object (&b, &f[0], 0, SPA_ALLOC_PARAM_TYPE_BUFFERS,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_SIZE, SPA_POD_TYPE_INT, size),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_STRIDE, SPA_POD_TYPE_INT, 0),
|
||||
PROP_MM (&f[1], SPA_ALLOC_PARAM_BUFFERS_BUFFERS, SPA_POD_TYPE_INT, min_buffers, min_buffers, max_buffers),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_ALIGN, SPA_POD_TYPE_INT, 16));
|
||||
spa_pod_builder_object (&b, &f[0], 0, ctx->uri.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], ctx->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, size),
|
||||
PROP (&f[1], ctx->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 0),
|
||||
PROP_MM (&f[1], ctx->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, min_buffers, min_buffers, max_buffers),
|
||||
PROP (&f[1], ctx->uri.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, SPA_ALLOC_PARAM_TYPE_META_ENABLE,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
spa_pod_builder_object (&b, &f[0], 0, ctx->uri.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], ctx->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
port_params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
spa_pod_builder_object (&b, &f[0], 0, SPA_ALLOC_PARAM_TYPE_META_ENABLE,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, SPA_META_TYPE_RINGBUFFER),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_RB_SIZE, SPA_POD_TYPE_INT,
|
||||
size * SPA_MAX (4, SPA_MAX (min_buffers, max_buffers))),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_RB_STRIDE, SPA_POD_TYPE_INT, 0),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_RB_BLOCKS, SPA_POD_TYPE_INT, 1),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_RB_ALIGN, SPA_POD_TYPE_INT, 16));
|
||||
spa_pod_builder_object (&b, &f[0], 0, ctx->uri.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], ctx->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_RINGBUFFER),
|
||||
PROP (&f[1], ctx->uri.alloc_param_meta_enable.ringbufferSize, SPA_POD_TYPE_INT,
|
||||
size * SPA_MAX (4,
|
||||
SPA_MAX (min_buffers, max_buffers))),
|
||||
PROP (&f[1], ctx->uri.alloc_param_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, 0),
|
||||
PROP (&f[1], ctx->uri.alloc_param_meta_enable.ringbufferBlocks, SPA_POD_TYPE_INT, 1),
|
||||
PROP (&f[1], ctx->uri.alloc_param_meta_enable.ringbufferAlign, SPA_POD_TYPE_INT, 16));
|
||||
port_params[2] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
pinos_stream_finish_format (p->stream, SPA_RESULT_OK, port_params, 2);
|
||||
|
|
|
|||
|
|
@ -775,6 +775,7 @@ on_format_changed (PinosListener *listener,
|
|||
GstPinosSrc *pinossrc = SPA_CONTAINER_OF (listener, GstPinosSrc, stream_format_changed);
|
||||
GstCaps *caps;
|
||||
gboolean res;
|
||||
PinosContext *ctx = stream->context;
|
||||
|
||||
caps = gst_caps_from_format (format);
|
||||
GST_DEBUG_OBJECT (pinossrc, "we got format %" GST_PTR_FORMAT, caps);
|
||||
|
|
@ -788,8 +789,8 @@ on_format_changed (PinosListener *listener,
|
|||
SpaPODFrame f[2];
|
||||
|
||||
spa_pod_builder_init (&b, buffer, sizeof (buffer));
|
||||
spa_pod_builder_object (&b, &f[0], 0, SPA_ALLOC_PARAM_TYPE_META_ENABLE,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
spa_pod_builder_object (&b, &f[0], 0, ctx->uri.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], ctx->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
params[0] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
GST_DEBUG_OBJECT (pinossrc, "doing finish format");
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ error:
|
|||
}
|
||||
|
||||
static void *
|
||||
find_param (const SpaPortInfo *info, SpaAllocParamType type)
|
||||
find_param (const SpaPortInfo *info, uint32_t type)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
|
|
@ -153,16 +153,16 @@ find_param (const SpaPortInfo *info, SpaAllocParamType type)
|
|||
}
|
||||
|
||||
static void *
|
||||
find_meta_enable (const SpaPortInfo *info, SpaMetaType type)
|
||||
find_meta_enable (PinosCore *core, const SpaPortInfo *info, SpaMetaType type)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < info->n_params; i++) {
|
||||
if (spa_pod_is_object_type (&info->params[i]->pod, SPA_ALLOC_PARAM_TYPE_META_ENABLE)) {
|
||||
if (spa_pod_is_object_type (&info->params[i]->pod, core->uri.alloc_param_meta_enable.MetaEnable)) {
|
||||
uint32_t qtype;
|
||||
|
||||
if (spa_alloc_param_query (info->params[i],
|
||||
SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, &qtype, 0) != 1)
|
||||
core->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, &qtype, 0) != 1)
|
||||
continue;
|
||||
|
||||
if (qtype == type)
|
||||
|
|
@ -208,11 +208,11 @@ alloc_buffers (PinosLink *this,
|
|||
for (i = 0; i < n_params; i++) {
|
||||
SpaAllocParam *ap = params[i];
|
||||
|
||||
if (ap->pod.type == SPA_ALLOC_PARAM_TYPE_META_ENABLE) {
|
||||
if (ap->pod.type == this->core->uri.alloc_param_meta_enable.MetaEnable) {
|
||||
uint32_t type;
|
||||
|
||||
if (spa_alloc_param_query (ap,
|
||||
SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, &type,
|
||||
this->core->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, &type,
|
||||
0) != 1)
|
||||
continue;
|
||||
|
||||
|
|
@ -397,50 +397,50 @@ do_allocation (PinosLink *this, SpaNodeState in_state, SpaNodeState out_state)
|
|||
uint32_t max_buffers;
|
||||
size_t minsize = 1024, stride = 0;
|
||||
|
||||
in_me = find_meta_enable (iinfo, SPA_META_TYPE_RINGBUFFER);
|
||||
out_me = find_meta_enable (oinfo, SPA_META_TYPE_RINGBUFFER);
|
||||
in_me = find_meta_enable (this->core, iinfo, SPA_META_TYPE_RINGBUFFER);
|
||||
out_me = find_meta_enable (this->core, oinfo, SPA_META_TYPE_RINGBUFFER);
|
||||
if (in_me && out_me) {
|
||||
uint32_t ms1, ms2, s1, s2;
|
||||
max_buffers = 1;
|
||||
|
||||
if (spa_alloc_param_query (in_me,
|
||||
SPA_ALLOC_PARAM_META_ENABLE_RB_SIZE, SPA_POD_TYPE_INT, &ms1,
|
||||
SPA_ALLOC_PARAM_META_ENABLE_RB_STRIDE, SPA_POD_TYPE_INT, &s1, 0) == 2 &&
|
||||
this->core->uri.alloc_param_meta_enable.ringbufferSize, SPA_POD_TYPE_INT, &ms1,
|
||||
this->core->uri.alloc_param_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, &s1, 0) == 2 &&
|
||||
spa_alloc_param_query (in_me,
|
||||
SPA_ALLOC_PARAM_META_ENABLE_RB_SIZE, SPA_POD_TYPE_INT, &ms2,
|
||||
SPA_ALLOC_PARAM_META_ENABLE_RB_STRIDE, SPA_POD_TYPE_INT, &s2, 0) == 2) {
|
||||
this->core->uri.alloc_param_meta_enable.ringbufferSize, SPA_POD_TYPE_INT, &ms2,
|
||||
this->core->uri.alloc_param_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, &s2, 0) == 2) {
|
||||
minsize = SPA_MAX (ms1, ms2);
|
||||
stride = SPA_MAX (s1, s2);
|
||||
}
|
||||
} else {
|
||||
max_buffers = MAX_BUFFERS;
|
||||
minsize = stride = 0;
|
||||
in_alloc = find_param (iinfo, SPA_ALLOC_PARAM_TYPE_BUFFERS);
|
||||
in_alloc = find_param (iinfo, this->core->uri.alloc_param_buffers.Buffers);
|
||||
if (in_alloc) {
|
||||
uint32_t qmax_buffers = max_buffers,
|
||||
qminsize = minsize,
|
||||
qstride = stride;
|
||||
|
||||
spa_alloc_param_query (in_alloc,
|
||||
SPA_ALLOC_PARAM_BUFFERS_SIZE, SPA_POD_TYPE_INT, &qminsize,
|
||||
SPA_ALLOC_PARAM_BUFFERS_STRIDE, SPA_POD_TYPE_INT, &qstride,
|
||||
SPA_ALLOC_PARAM_BUFFERS_BUFFERS, SPA_POD_TYPE_INT, &qmax_buffers,
|
||||
this->core->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, &qminsize,
|
||||
this->core->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, &qstride,
|
||||
this->core->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, &qmax_buffers,
|
||||
0);
|
||||
|
||||
max_buffers = qmax_buffers == 0 ? max_buffers : SPA_MIN (qmax_buffers, max_buffers);
|
||||
minsize = SPA_MAX (minsize, qminsize);
|
||||
stride = SPA_MAX (stride, qstride);
|
||||
}
|
||||
out_alloc = find_param (oinfo, SPA_ALLOC_PARAM_TYPE_BUFFERS);
|
||||
out_alloc = find_param (oinfo, this->core->uri.alloc_param_buffers.Buffers);
|
||||
if (out_alloc) {
|
||||
uint32_t qmax_buffers = max_buffers,
|
||||
qminsize = minsize,
|
||||
qstride = stride;
|
||||
|
||||
spa_alloc_param_query (out_alloc,
|
||||
SPA_ALLOC_PARAM_BUFFERS_SIZE, SPA_POD_TYPE_INT, &qminsize,
|
||||
SPA_ALLOC_PARAM_BUFFERS_STRIDE, SPA_POD_TYPE_INT, &qstride,
|
||||
SPA_ALLOC_PARAM_BUFFERS_BUFFERS, SPA_POD_TYPE_INT, &qmax_buffers,
|
||||
this->core->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, &qminsize,
|
||||
this->core->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, &qstride,
|
||||
this->core->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, &qmax_buffers,
|
||||
0);
|
||||
|
||||
max_buffers = qmax_buffers == 0 ? max_buffers : SPA_MIN (qmax_buffers, max_buffers);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ typedef enum {
|
|||
} SpaDataType;
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/port.h>
|
||||
#include <spa/ringbuffer.h>
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
spa_headers = [
|
||||
'alloc-param.h',
|
||||
'barrier.h',
|
||||
'buffer.h',
|
||||
'clock.h',
|
||||
|
|
@ -20,7 +21,6 @@ spa_headers = [
|
|||
'pod-builder.h',
|
||||
'pod-iter.h',
|
||||
'pod-utils.h',
|
||||
'port.h',
|
||||
'props.h',
|
||||
'ringbuffer.h'
|
||||
]
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ typedef enum {
|
|||
#include <spa/defs.h>
|
||||
#include <spa/plugin.h>
|
||||
#include <spa/props.h>
|
||||
#include <spa/port.h>
|
||||
#include <spa/alloc-param.h>
|
||||
#include <spa/node-event.h>
|
||||
#include <spa/node-command.h>
|
||||
#include <spa/buffer.h>
|
||||
|
|
@ -116,6 +116,50 @@ typedef struct {
|
|||
SpaEvent *event;
|
||||
} SpaPortOutput;
|
||||
|
||||
/**
|
||||
* SpaPortInfoFlags:
|
||||
* @SPA_PORT_INFO_FLAG_NONE: no flags
|
||||
* @SPA_PORT_INFO_FLAG_REMOVABLE: port can be removed
|
||||
* @SPA_PORT_INFO_FLAG_OPTIONAL: processing on port is optional
|
||||
* @SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS: the port can give a buffer
|
||||
* @SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS: the port can use a provided buffer
|
||||
* @SPA_PORT_INFO_FLAG_IN_PLACE: the port can process data in-place and will need
|
||||
* a writable input buffer
|
||||
* @SPA_PORT_INFO_FLAG_NO_REF: the port does not keep a ref on the buffer
|
||||
* @SPA_PORT_INFO_FLAG_LIVE: output buffers from this port are timestamped against
|
||||
* a live clock.
|
||||
*/
|
||||
typedef enum {
|
||||
SPA_PORT_INFO_FLAG_NONE = 0,
|
||||
SPA_PORT_INFO_FLAG_REMOVABLE = 1 << 0,
|
||||
SPA_PORT_INFO_FLAG_OPTIONAL = 1 << 1,
|
||||
SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS = 1 << 2,
|
||||
SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS = 1 << 3,
|
||||
SPA_PORT_INFO_FLAG_IN_PLACE = 1 << 4,
|
||||
SPA_PORT_INFO_FLAG_NO_REF = 1 << 5,
|
||||
SPA_PORT_INFO_FLAG_LIVE = 1 << 6,
|
||||
} SpaPortInfoFlags;
|
||||
|
||||
/**
|
||||
* SpaPortInfo
|
||||
* @flags: extra port flags
|
||||
* @n_params: number of elements in @params;
|
||||
* @params: extra allocation parameters
|
||||
* @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 {
|
||||
SpaPortInfoFlags flags;
|
||||
uint32_t n_params;
|
||||
SpaAllocParam **params;
|
||||
uint64_t maxbuffering;
|
||||
uint64_t latency;
|
||||
SpaDict *extra;
|
||||
} SpaPortInfo;
|
||||
|
||||
/**
|
||||
* SpaNodeEventCallback:
|
||||
* @node: a #SpaNode emiting the event
|
||||
|
|
|
|||
|
|
@ -297,7 +297,8 @@ spa_pod_builder_push_struct (SpaPODBuilder *builder,
|
|||
spa_pod_builder_raw (builder, &p, sizeof(p)));
|
||||
}
|
||||
|
||||
#define SPA_POD_OBJECT_INIT(size,id,type) { { size, SPA_POD_TYPE_OBJECT }, { id, type } }
|
||||
#define SPA_POD_OBJECT_INIT(size,id,type) { { size, SPA_POD_TYPE_OBJECT }, { id, type } }
|
||||
#define SPA_POD_OBJECT_INIT_COMPLEX(size,id,type,...) { { size, SPA_POD_TYPE_OBJECT }, { id, type }, __VA_ARGS__ }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push_object (SpaPODBuilder *builder,
|
||||
|
|
|
|||
|
|
@ -1,178 +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_PORT_H__
|
||||
#define __SPA_PORT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SpaAllocParam SpaAllocParam;
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/buffer.h>
|
||||
#include <spa/dict.h>
|
||||
#include <spa/pod-utils.h>
|
||||
|
||||
#define SPA_ALLOC_PARAM_URI "http://spaplug.in/ns/alloc-param"
|
||||
#define SPA_ALLOC_PARAM_URI_PREFIX SPA_ALLOC_PARAM_URI "-"
|
||||
|
||||
/**
|
||||
* SpaAllocParamType:
|
||||
* @SPA_ALLOC_PARAM_TYPE_INVALID: invalid type, should be ignored
|
||||
* @SPA_ALLOC_PARAM_TYPE_BUFFER: buffer requirements
|
||||
* @SPA_ALLOC_PARAM_TYPE_META_ENABLE: enable a certain metadata on buffers
|
||||
* @SPA_ALLOC_PARAM_TYPE_VIDEO_PADDING: do specialized video padding
|
||||
*/
|
||||
typedef enum {
|
||||
SPA_ALLOC_PARAM_TYPE_INVALID,
|
||||
SPA_ALLOC_PARAM_TYPE_BUFFERS,
|
||||
SPA_ALLOC_PARAM_TYPE_META_ENABLE,
|
||||
SPA_ALLOC_PARAM_TYPE_VIDEO_PADDING,
|
||||
} SpaAllocParamType;
|
||||
|
||||
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_ALLOC_PARAM_BUFFERS SPA_ALLOC_PARAM_URI_PREFIX "buffers"
|
||||
#define SPA_ALLOC_PARAM_BUFFERS_PREFIX SPA_ALLOC_PARAM_BUFFERS "#"
|
||||
|
||||
#define SPA_ALLOC_PARAM_BUFFERS__size SPA_ALLOC_PARAM_BUFFERS_PREFIX "size"
|
||||
#define SPA_ALLOC_PARAM_BUFFERS__stride SPA_ALLOC_PARAM_BUFFERS_PREFIX "stride"
|
||||
#define SPA_ALLOC_PARAM_BUFFERS__buffers SPA_ALLOC_PARAM_BUFFERS_PREFIX "buffers"
|
||||
#define SPA_ALLOC_PARAM_BUFFERS__align SPA_ALLOC_PARAM_BUFFERS_PREFIX "align"
|
||||
|
||||
typedef enum {
|
||||
SPA_ALLOC_PARAM_BUFFERS_SIZE = 1,
|
||||
SPA_ALLOC_PARAM_BUFFERS_STRIDE,
|
||||
SPA_ALLOC_PARAM_BUFFERS_BUFFERS,
|
||||
SPA_ALLOC_PARAM_BUFFERS_ALIGN,
|
||||
} SpaAllocParamBuffersKey;
|
||||
|
||||
#define SPA_ALLOC_PARAM_META_ENABLE SPA_ALLOC_PARAM_URI_PREFIX "meta-enable"
|
||||
#define SPA_ALLOC_PARAM_META_ENABLE_PREFIX SPA_ALLOC_PARAM_META_ENABLE "#"
|
||||
#define SPA_ALLOC_PARAM_META_ENABLE__type SPA_ALLOC_PARAM_META_ENABLE_PREFIX "type"
|
||||
|
||||
#define SPA_ALLOC_PARAM_META_ENABLE__ringbufferSize SPA_ALLOC_PARAM_META_ENABLE_PREFIX "ringbufferSize"
|
||||
#define SPA_ALLOC_PARAM_META_ENABLE__ringbufferStride SPA_ALLOC_PARAM_META_ENABLE_PREFIX "ringbufferStride"
|
||||
#define SPA_ALLOC_PARAM_META_ENABLE__ringbufferBlocks SPA_ALLOC_PARAM_META_ENABLE_PREFIX "ringbufferBlocks"
|
||||
#define SPA_ALLOC_PARAM_META_ENABLE__ringbufferAlign SPA_ALLOC_PARAM_META_ENABLE_PREFIX "ringbufferAlign"
|
||||
|
||||
typedef enum {
|
||||
SPA_ALLOC_PARAM_META_ENABLE_TYPE = 1,
|
||||
SPA_ALLOC_PARAM_META_ENABLE_RB_SIZE,
|
||||
SPA_ALLOC_PARAM_META_ENABLE_RB_STRIDE,
|
||||
SPA_ALLOC_PARAM_META_ENABLE_RB_BLOCKS,
|
||||
SPA_ALLOC_PARAM_META_ENABLE_RB_ALIGN,
|
||||
} SpaAllocParamMetaEnableKey;
|
||||
|
||||
#define SPA_ALLOC_PARAM_VIDEO_PADDING SPA_ALLOC_PARAM_URI_PREFIX "video-padding"
|
||||
#define SPA_ALLOC_PARAM_VIDEO_PADDING_PREFIX SPA_ALLOC_PARAM_VIDEO_PADDING "#"
|
||||
|
||||
#define SPA_ALLOC_PARAM_VIDEO_PADDING__top SPA_ALLOC_PARAM_VIDEO_PADDING_PREFIX "top"
|
||||
#define SPA_ALLOC_PARAM_VIDEO_PADDING__bottom SPA_ALLOC_PARAM_VIDEO_PADDING_PREFIX "bottom"
|
||||
#define SPA_ALLOC_PARAM_VIDEO_PADDING__left SPA_ALLOC_PARAM_VIDEO_PADDING_PREFIX "left"
|
||||
#define SPA_ALLOC_PARAM_VIDEO_PADDING__right SPA_ALLOC_PARAM_VIDEO_PADDING_PREFIX "right"
|
||||
#define SPA_ALLOC_PARAM_VIDEO_PADDING__strideAlign0 SPA_ALLOC_PARAM_VIDEO_PADDING_PREFIX "strideAlign0"
|
||||
#define SPA_ALLOC_PARAM_VIDEO_PADDING__strideAlign1 SPA_ALLOC_PARAM_VIDEO_PADDING_PREFIX "strideAlign1"
|
||||
#define SPA_ALLOC_PARAM_VIDEO_PADDING__strideAlign2 SPA_ALLOC_PARAM_VIDEO_PADDING_PREFIX "strideAlign2"
|
||||
#define SPA_ALLOC_PARAM_VIDEO_PADDING__strideAlign3 SPA_ALLOC_PARAM_VIDEO_PADDING_PREFIX "strideAlign3"
|
||||
|
||||
typedef enum {
|
||||
SPA_ALLOC_PARAM_VIDEO_PADDING_TOP = 1,
|
||||
SPA_ALLOC_PARAM_VIDEO_PADDING_BOTTOM,
|
||||
SPA_ALLOC_PARAM_VIDEO_PADDING_LEFT,
|
||||
SPA_ALLOC_PARAM_VIDEO_PADDING_RIGHT,
|
||||
SPA_ALLOC_PARAM_VIDEO_PADDING_STRIDE_ALIGN0,
|
||||
SPA_ALLOC_PARAM_VIDEO_PADDING_STRIDE_ALIGN1,
|
||||
SPA_ALLOC_PARAM_VIDEO_PADDING_STRIDE_ALIGN2,
|
||||
SPA_ALLOC_PARAM_VIDEO_PADDING_STRIDE_ALIGN3,
|
||||
} SpaAllocParamVideoPaddingKey;
|
||||
|
||||
/**
|
||||
* SpaPortInfoFlags:
|
||||
* @SPA_PORT_INFO_FLAG_NONE: no flags
|
||||
* @SPA_PORT_INFO_FLAG_REMOVABLE: port can be removed
|
||||
* @SPA_PORT_INFO_FLAG_OPTIONAL: processing on port is optional
|
||||
* @SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS: the port can give a buffer
|
||||
* @SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS: the port can use a provided buffer
|
||||
* @SPA_PORT_INFO_FLAG_IN_PLACE: the port can process data in-place and will need
|
||||
* a writable input buffer
|
||||
* @SPA_PORT_INFO_FLAG_NO_REF: the port does not keep a ref on the buffer
|
||||
* @SPA_PORT_INFO_FLAG_LIVE: output buffers from this port are timestamped against
|
||||
* a live clock.
|
||||
*/
|
||||
typedef enum {
|
||||
SPA_PORT_INFO_FLAG_NONE = 0,
|
||||
SPA_PORT_INFO_FLAG_REMOVABLE = 1 << 0,
|
||||
SPA_PORT_INFO_FLAG_OPTIONAL = 1 << 1,
|
||||
SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS = 1 << 2,
|
||||
SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS = 1 << 3,
|
||||
SPA_PORT_INFO_FLAG_IN_PLACE = 1 << 4,
|
||||
SPA_PORT_INFO_FLAG_NO_REF = 1 << 5,
|
||||
SPA_PORT_INFO_FLAG_LIVE = 1 << 6,
|
||||
} SpaPortInfoFlags;
|
||||
|
||||
/**
|
||||
* SpaPortInfo
|
||||
* @flags: extra port flags
|
||||
* @maxbuffering: the maximum amount of bytes that the element will keep
|
||||
* around internally
|
||||
* @latency: latency on this port in nanoseconds
|
||||
* @params: extra allocation parameters
|
||||
* @n_params: number of elements in @params;
|
||||
* @extra: a dictionary of extra port info
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
SpaPortInfoFlags flags;
|
||||
uint64_t maxbuffering;
|
||||
uint64_t latency;
|
||||
SpaAllocParam **params;
|
||||
uint32_t n_params;
|
||||
SpaDict *extra;
|
||||
} SpaPortInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __SPA_PORT_H__ */
|
||||
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include <spa/defs.h>
|
||||
#include <spa/port.h>
|
||||
#include <spa/node.h>
|
||||
#include <spa/buffer.h>
|
||||
#include <spa/pod.h>
|
||||
#include <spa/props.h>
|
||||
|
|
|
|||
|
|
@ -395,23 +395,23 @@ spa_alsa_sink_node_port_set_format (SpaNode *node,
|
|||
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, SPA_ALLOC_PARAM_TYPE_BUFFERS,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_SIZE, SPA_POD_TYPE_INT, this->period_frames * this->frame_size),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_STRIDE, SPA_POD_TYPE_INT, 0),
|
||||
PROP_MM (&f[1], SPA_ALLOC_PARAM_BUFFERS_BUFFERS, SPA_POD_TYPE_INT, 32, 1, 32),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_ALIGN, SPA_POD_TYPE_INT, 16));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, this->period_frames * this->frame_size),
|
||||
PROP (&f[1], this->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 0),
|
||||
PROP_MM (&f[1], this->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, 32, 1, 32),
|
||||
PROP (&f[1], this->uri.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, SPA_ALLOC_PARAM_TYPE_META_ENABLE,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
this->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
spa_pod_builder_object (&b, &f[0], 0, SPA_ALLOC_PARAM_TYPE_META_ENABLE,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, SPA_META_TYPE_RINGBUFFER),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_RB_SIZE, SPA_POD_TYPE_INT, this->period_frames * this->frame_size * 32),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_RB_STRIDE, SPA_POD_TYPE_INT, 0),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_RB_BLOCKS, SPA_POD_TYPE_INT, 1),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_RB_ALIGN, SPA_POD_TYPE_INT, 16));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_RINGBUFFER),
|
||||
PROP (&f[1], this->uri.alloc_param_meta_enable.ringbufferSize, SPA_POD_TYPE_INT, this->period_frames * this->frame_size * 32),
|
||||
PROP (&f[1], this->uri.alloc_param_meta_enable.ringbufferStride, SPA_POD_TYPE_INT, 0),
|
||||
PROP (&f[1], this->uri.alloc_param_meta_enable.ringbufferBlocks, SPA_POD_TYPE_INT, 1),
|
||||
PROP (&f[1], this->uri.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;
|
||||
|
||||
|
|
@ -786,6 +786,8 @@ alsa_sink_init (const SpaHandleFactory *factory,
|
|||
spa_audio_formats_map (this->map, &this->uri.audio_formats);
|
||||
spa_node_events_map (this->map, &this->uri.node_events);
|
||||
spa_node_commands_map (this->map, &this->uri.node_commands);
|
||||
spa_alloc_param_buffers_map (this->map, &this->uri.alloc_param_buffers);
|
||||
spa_alloc_param_meta_enable_map (this->map, &this->uri.alloc_param_meta_enable);
|
||||
|
||||
this->node = alsasink_node;
|
||||
this->stream = SND_PCM_STREAM_PLAYBACK;
|
||||
|
|
|
|||
|
|
@ -444,19 +444,18 @@ spa_alsa_source_node_port_set_format (SpaNode *node,
|
|||
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, SPA_ALLOC_PARAM_TYPE_BUFFERS,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_SIZE, SPA_POD_TYPE_INT, this->period_frames * this->frame_size),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_STRIDE, SPA_POD_TYPE_INT, 0),
|
||||
PROP_MM (&f[1], SPA_ALLOC_PARAM_BUFFERS_BUFFERS, SPA_POD_TYPE_INT, 32, 1, 32),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_ALIGN, SPA_POD_TYPE_INT, 16));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, this->period_frames * this->frame_size),
|
||||
PROP (&f[1], this->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 0),
|
||||
PROP_MM (&f[1], this->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, 32, 1, 32),
|
||||
PROP (&f[1], this->uri.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, SPA_ALLOC_PARAM_TYPE_META_ENABLE,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
this->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
this->info.extra = NULL;
|
||||
|
||||
this->have_format = true;
|
||||
|
||||
update_state (this, SPA_NODE_STATE_READY);
|
||||
|
|
@ -853,6 +852,8 @@ alsa_source_init (const SpaHandleFactory *factory,
|
|||
spa_audio_formats_map (this->map, &this->uri.audio_formats);
|
||||
spa_node_events_map (this->map, &this->uri.node_events);
|
||||
spa_node_commands_map (this->map, &this->uri.node_commands);
|
||||
spa_alloc_param_buffers_map (this->map, &this->uri.alloc_param_buffers);
|
||||
spa_alloc_param_meta_enable_map (this->map, &this->uri.alloc_param_meta_enable);
|
||||
|
||||
this->node = alsasource_node;
|
||||
this->clock = alsasource_clock;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ typedef struct {
|
|||
SpaAudioFormats audio_formats;
|
||||
SpaNodeEvents node_events;
|
||||
SpaNodeCommands node_commands;
|
||||
SpaAllocParamBuffers alloc_param_buffers;
|
||||
SpaAllocParamMetaEnable alloc_param_meta_enable;
|
||||
} URI;
|
||||
|
||||
struct _SpaALSAState {
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ typedef struct {
|
|||
SpaAudioFormats audio_formats;
|
||||
SpaNodeEvents node_events;
|
||||
SpaNodeCommands node_commands;
|
||||
SpaAllocParamBuffers alloc_param_buffers;
|
||||
SpaAllocParamMetaEnable alloc_param_meta_enable;
|
||||
} URI;
|
||||
|
||||
typedef struct _SpaAudioTestSrc SpaAudioTestSrc;
|
||||
|
|
@ -539,15 +541,15 @@ spa_audiotestsrc_node_port_set_format (SpaNode *node,
|
|||
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, SPA_ALLOC_PARAM_TYPE_BUFFERS,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_SIZE, SPA_POD_TYPE_INT, 1024),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_STRIDE, SPA_POD_TYPE_INT, 1024),
|
||||
PROP_MM (&f[1], SPA_ALLOC_PARAM_BUFFERS_BUFFERS, SPA_POD_TYPE_INT, 32, 2, 32),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_ALIGN, SPA_POD_TYPE_INT, 16));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, 1024),
|
||||
PROP (&f[1], this->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 1024),
|
||||
PROP_U_MM (&f[1], this->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, 32, 2, 32),
|
||||
PROP (&f[1], this->uri.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, SPA_ALLOC_PARAM_TYPE_META_ENABLE,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
this->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
this->info.extra = NULL;
|
||||
|
|
@ -956,6 +958,8 @@ audiotestsrc_init (const SpaHandleFactory *factory,
|
|||
spa_audio_formats_map (this->map, &this->uri.audio_formats);
|
||||
spa_node_events_map (this->map, &this->uri.node_events);
|
||||
spa_node_commands_map (this->map, &this->uri.node_commands);
|
||||
spa_alloc_param_buffers_map (this->map, &this->uri.alloc_param_buffers);
|
||||
spa_alloc_param_meta_enable_map (this->map, &this->uri.alloc_param_meta_enable);
|
||||
|
||||
this->node = audiotestsrc_node;
|
||||
this->clock = audiotestsrc_clock;
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ typedef struct {
|
|||
SpaVideoFormats video_formats;
|
||||
SpaNodeEvents node_events;
|
||||
SpaNodeCommands node_commands;
|
||||
SpaAllocParamBuffers alloc_param_buffers;
|
||||
SpaAllocParamMetaEnable alloc_param_meta_enable;
|
||||
} URI;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -965,6 +967,8 @@ v4l2_source_init (const SpaHandleFactory *factory,
|
|||
spa_video_formats_map (this->map, &this->uri.video_formats);
|
||||
spa_node_events_map (this->map, &this->uri.node_events);
|
||||
spa_node_commands_map (this->map, &this->uri.node_commands);
|
||||
spa_alloc_param_buffers_map (this->map, &this->uri.alloc_param_buffers);
|
||||
spa_alloc_param_meta_enable_map (this->map, &this->uri.alloc_param_meta_enable);
|
||||
|
||||
this->node = v4l2source_node;
|
||||
this->clock = v4l2source_clock;
|
||||
|
|
|
|||
|
|
@ -887,21 +887,21 @@ spa_v4l2_set_format (SpaV4l2Source *this, SpaVideoInfo *format, bool try_only)
|
|||
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;
|
||||
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, SPA_ALLOC_PARAM_TYPE_BUFFERS,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_SIZE, SPA_POD_TYPE_INT, fmt.fmt.pix.sizeimage),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_STRIDE, SPA_POD_TYPE_INT, fmt.fmt.pix.bytesperline),
|
||||
PROP_U_MM (&f[1], SPA_ALLOC_PARAM_BUFFERS_BUFFERS, SPA_POD_TYPE_INT, MAX_BUFFERS, 2, MAX_BUFFERS),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_ALIGN, SPA_POD_TYPE_INT, 16));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, fmt.fmt.pix.sizeimage),
|
||||
PROP (&f[1], this->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, fmt.fmt.pix.bytesperline),
|
||||
PROP_U_MM (&f[1], this->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, MAX_BUFFERS, 2, MAX_BUFFERS),
|
||||
PROP (&f[1], this->uri.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, SPA_ALLOC_PARAM_TYPE_META_ENABLE,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
state->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
state->info.extra = NULL;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ typedef struct {
|
|||
SpaVideoFormats video_formats;
|
||||
SpaNodeEvents node_events;
|
||||
SpaNodeCommands node_commands;
|
||||
SpaAllocParamBuffers alloc_param_buffers;
|
||||
SpaAllocParamMetaEnable alloc_param_meta_enable;
|
||||
} URI;
|
||||
|
||||
typedef struct _SpaVideoTestSrc SpaVideoTestSrc;
|
||||
|
|
@ -541,15 +543,15 @@ spa_videotestsrc_node_port_set_format (SpaNode *node,
|
|||
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, SPA_ALLOC_PARAM_TYPE_BUFFERS,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_SIZE, SPA_POD_TYPE_INT, this->stride * raw_info->size.height),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_STRIDE, SPA_POD_TYPE_INT, this->stride),
|
||||
PROP_U_MM (&f[1], SPA_ALLOC_PARAM_BUFFERS_BUFFERS, SPA_POD_TYPE_INT, 32, 2, 32),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_ALIGN, SPA_POD_TYPE_INT, 16));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, this->stride * raw_info->size.height),
|
||||
PROP (&f[1], this->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, this->stride),
|
||||
PROP_U_MM (&f[1], this->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, 32, 2, 32),
|
||||
PROP (&f[1], this->uri.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, SPA_ALLOC_PARAM_TYPE_META_ENABLE,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
this->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
this->info.extra = NULL;
|
||||
|
|
@ -958,6 +960,8 @@ videotestsrc_init (const SpaHandleFactory *factory,
|
|||
spa_video_formats_map (this->map, &this->uri.video_formats);
|
||||
spa_node_events_map (this->map, &this->uri.node_events);
|
||||
spa_node_commands_map (this->map, &this->uri.node_commands);
|
||||
spa_alloc_param_buffers_map (this->map, &this->uri.alloc_param_buffers);
|
||||
spa_alloc_param_meta_enable_map (this->map, &this->uri.alloc_param_meta_enable);
|
||||
|
||||
this->node = videotestsrc_node;
|
||||
this->clock = videotestsrc_clock;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ typedef struct {
|
|||
SpaAudioFormats audio_formats;
|
||||
SpaNodeEvents node_events;
|
||||
SpaNodeCommands node_commands;
|
||||
SpaAllocParamBuffers alloc_param_buffers;
|
||||
SpaAllocParamMetaEnable alloc_param_meta_enable;
|
||||
} URI;
|
||||
|
||||
struct _SpaVolume {
|
||||
|
|
@ -382,15 +384,15 @@ spa_volume_node_port_set_format (SpaNode *node,
|
|||
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, SPA_ALLOC_PARAM_TYPE_BUFFERS,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_SIZE, SPA_POD_TYPE_INT, 16),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_STRIDE, SPA_POD_TYPE_INT, 16),
|
||||
PROP_U_MM (&f[1], SPA_ALLOC_PARAM_BUFFERS_BUFFERS, SPA_POD_TYPE_INT, MAX_BUFFERS, 2, MAX_BUFFERS),
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_BUFFERS_ALIGN, SPA_POD_TYPE_INT, 16));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_buffers.Buffers,
|
||||
PROP (&f[1], this->uri.alloc_param_buffers.size, SPA_POD_TYPE_INT, 16),
|
||||
PROP (&f[1], this->uri.alloc_param_buffers.stride, SPA_POD_TYPE_INT, 16),
|
||||
PROP_U_MM (&f[1], this->uri.alloc_param_buffers.buffers, SPA_POD_TYPE_INT, MAX_BUFFERS, 2, MAX_BUFFERS),
|
||||
PROP (&f[1], this->uri.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, SPA_ALLOC_PARAM_TYPE_META_ENABLE,
|
||||
PROP (&f[1], SPA_ALLOC_PARAM_META_ENABLE_TYPE, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
spa_pod_builder_object (&b, &f[0], 0, this->uri.alloc_param_meta_enable.MetaEnable,
|
||||
PROP (&f[1], this->uri.alloc_param_meta_enable.type, SPA_POD_TYPE_INT, SPA_META_TYPE_HEADER));
|
||||
port->params[1] = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaAllocParam);
|
||||
|
||||
port->info.extra = NULL;
|
||||
|
|
@ -844,6 +846,8 @@ volume_init (const SpaHandleFactory *factory,
|
|||
spa_audio_formats_map (this->map, &this->uri.audio_formats);
|
||||
spa_node_events_map (this->map, &this->uri.node_events);
|
||||
spa_node_commands_map (this->map, &this->uri.node_commands);
|
||||
spa_alloc_param_buffers_map (this->map, &this->uri.alloc_param_buffers);
|
||||
spa_alloc_param_meta_enable_map (this->map, &this->uri.alloc_param_meta_enable);
|
||||
|
||||
this->node = volume_node;
|
||||
reset_volume_props (&this->props);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue