param-io: work on IO parameters

Reorganize the io parameter ids and objects. Make separate enumerations
for buffer, control, input and output properties.
Add a volume output property to export-source. This is still unused
but will eventually be routed to a PropsIn io area where it can
control the volume of a mixer, for example.
This commit is contained in:
Wim Taymans 2017-11-29 13:25:56 +01:00
parent ada3698355
commit 425073afd8
12 changed files with 240 additions and 124 deletions

View file

@ -34,13 +34,9 @@ extern "C" {
#define SPA_TYPE_IO__Control SPA_TYPE_IO_BASE "Control"
#define SPA_TYPE_IO_CONTROL_BASE SPA_TYPE_IO__Control ":"
/** Base for controlable input properties */
#define SPA_TYPE_IO__InputProp SPA_TYPE_IO_BASE "InputProp"
#define SPA_TYPE_IO_INPUT_PROP_BASE SPA_TYPE_IO__InputProp ":"
/** Base for controlable output properties */
#define SPA_TYPE_IO__OutputProp SPA_TYPE_IO_BASE "OutputProp"
#define SPA_TYPE_IO_OUTPUT_PROP_BASE SPA_TYPE_IO__OutputProp ":"
/** Base for controlable properties */
#define SPA_TYPE_IO__Prop SPA_TYPE_IO_BASE "Prop"
#define SPA_TYPE_IO_PROP_BASE SPA_TYPE_IO__Prop ":"
/** An io area to exchange buffers with a port */
#define SPA_TYPE_IO__Buffers SPA_TYPE_IO_BASE "Buffers"
@ -76,8 +72,7 @@ struct spa_io_control_range {
struct spa_type_io {
uint32_t Buffers;
uint32_t ControlRange;
uint32_t InputProp;
uint32_t OutputProp;
uint32_t Prop;
};
static inline void spa_type_io_map(struct spa_type_map *map, struct spa_type_io *type)
@ -85,8 +80,7 @@ static inline void spa_type_io_map(struct spa_type_map *map, struct spa_type_io
if (type->Buffers == 0) {
type->Buffers = spa_type_map_get_id(map, SPA_TYPE_IO__Buffers);
type->ControlRange = spa_type_map_get_id(map, SPA_TYPE_IO_CONTROL__Range);
type->InputProp = spa_type_map_get_id(map, SPA_TYPE_IO__InputProp);
type->OutputProp = spa_type_map_get_id(map, SPA_TYPE_IO__OutputProp);
type->Prop = spa_type_map_get_id(map, SPA_TYPE_IO__Prop);
}
}

View file

@ -48,11 +48,11 @@ struct spa_port_info {
#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 */
#define SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS (1<<3) /**< the port can use a provided buffer */
#define SPA_PORT_INFO_FLAG_IN_PLACE (1<<4) /**< the port can process data in-place and will need
* a writable input buffer */
#define SPA_PORT_INFO_FLAG_IN_PLACE (1<<4) /**< the port can process data in-place and
* will need a writable input buffer */
#define SPA_PORT_INFO_FLAG_NO_REF (1<<5) /**< the port does not keep a ref on the buffer */
#define SPA_PORT_INFO_FLAG_LIVE (1<<6) /**< output buffers from this port are timestamped against
* a live clock. */
#define SPA_PORT_INFO_FLAG_LIVE (1<<6) /**< output buffers from this port are
* timestamped against a live clock. */
uint32_t flags; /**< port flags */
uint32_t rate; /**< rate of sequence numbers on port */
const struct spa_dict *props; /**< extra port properties */

View file

@ -28,36 +28,69 @@ extern "C" {
#include <spa/param/param.h>
#include <spa/support/type-map.h>
#define SPA_TYPE_PARAM__IO SPA_TYPE_PARAM_BASE "IO"
#define SPA_TYPE_PARAM_IO_BASE SPA_TYPE_PARAM__IO ":"
/** type ID of property, uniquely identifies the io area for a port */
#define SPA_TYPE_PARAM_IO__id SPA_TYPE_PARAM_IO_BASE "id"
/** size of the io area for a port */
#define SPA_TYPE_PARAM_IO__size SPA_TYPE_PARAM_IO_BASE "size"
/** enumerate buffer io areas */
#define SPA_TYPE_PARAM_ID_IO__Buffers SPA_TYPE_PARAM_ID_IO_BASE "Buffers"
/* an io area to exchange buffers */
#define SPA_TYPE_PARAM_IO__Buffers SPA_TYPE_PARAM_IO_BASE "Buffers"
/** enumerate Control io areas */
#define SPA_TYPE_PARAM_ID_IO__Control SPA_TYPE_PARAM_ID_IO_BASE "Control"
/* an io area to exchange control information */
#define SPA_TYPE_PARAM_IO__Control SPA_TYPE_PARAM_IO_BASE "Control"
/** enumerate input or output properties */
#define SPA_TYPE_PARAM_ID_IO__Props SPA_TYPE_PARAM_ID_IO_BASE "Props"
#define SPA_TYPE_PARAM_ID_IO_PROPS_BASE SPA_TYPE_PARAM_ID_IO__Props ":"
/** enumerate input property io areas */
#define SPA_TYPE_PARAM_ID_IO_PROPS__In SPA_TYPE_PARAM_ID_IO_PROPS_BASE "In"
/** enumerate output property io areas */
#define SPA_TYPE_PARAM_ID_IO_PROPS__Out SPA_TYPE_PARAM_ID_IO_PROPS_BASE "Out"
/* an io area to exchange properties */
#define SPA_TYPE_PARAM_IO__Prop SPA_TYPE_PARAM_IO_BASE "Prop"
#define SPA_TYPE_PARAM_IO_PROP_BASE SPA_TYPE_PARAM_IO__Prop ":"
/** associated property if any */
#define SPA_TYPE_PARAM_IO__propId SPA_TYPE_PARAM_IO_BASE "propId"
#define SPA_TYPE_PARAM_IO_PROP__id SPA_TYPE_PARAM_IO_PROP_BASE "id"
/** associated type of property if any */
#define SPA_TYPE_PARAM_IO__propType SPA_TYPE_PARAM_IO_BASE "propType"
#define SPA_TYPE_PARAM_IO_PROP__type SPA_TYPE_PARAM_IO_PROP_BASE "type"
struct spa_type_param_io {
uint32_t IO;
uint32_t id;
uint32_t size;
uint32_t propId;
uint32_t propType;
uint32_t id; /**< id to configure the io area */
uint32_t size; /**< size of io area */
uint32_t idBuffers; /**< id to enumerate buffer io */
uint32_t Buffers; /**< object type of buffer io area */
uint32_t idControl; /**< id to enumerate control io */
uint32_t Control; /**< object type of Control area */
uint32_t idPropsIn; /**< id to enumerate input properties io */
uint32_t idPropsOut; /**< id to enumerate output properties io */
uint32_t Prop; /**< object type of property area */
uint32_t propId; /**< property id */
uint32_t propType; /**< property type */
};
static inline void
spa_type_param_io_map(struct spa_type_map *map,
struct spa_type_param_io *type)
{
if (type->IO == 0) {
type->IO = spa_type_map_get_id(map, SPA_TYPE_PARAM__IO);
if (type->id == 0) {
type->id = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__id);
type->size = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__size);
type->propId = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__propId);
type->propType = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__propType);
type->idBuffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO__Buffers);
type->Buffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__Buffers);
type->idControl = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO__Control);
type->Control = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__Control);
type->idPropsIn = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO_PROPS__In);
type->idPropsOut = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID_IO_PROPS__Out);
type->Prop = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO__Prop);
type->propId = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO_PROP__id);
type->propType = spa_type_map_get_id(map, SPA_TYPE_PARAM_IO_PROP__type);
}
}

View file

@ -59,8 +59,15 @@ extern "C" {
/** The supported metadata */
#define SPA_TYPE_PARAM_ID__Meta SPA_TYPE_PARAM_ID_BASE "Meta"
/** The supported io types */
/** The supported io areas */
#define SPA_TYPE_PARAM_ID__IO SPA_TYPE_PARAM_ID_BASE "IO"
#define SPA_TYPE_PARAM_ID_IO_BASE SPA_TYPE_PARAM_ID__IO ":"
/** Base for parameters that describe IO areas to exchange data,
* control and properties with a node.
*/
#define SPA_TYPE_PARAM__IO SPA_TYPE_PARAM_BASE "IO"
#define SPA_TYPE_PARAM_IO_BASE SPA_TYPE_PARAM__IO ":"
struct spa_type_param {
uint32_t idList; /**< id of the list param */
@ -71,7 +78,6 @@ struct spa_type_param {
uint32_t idFormat; /**< id to get/set format parameter */
uint32_t idBuffers; /**< id to enumerate buffer requirements */
uint32_t idMeta; /**< id to enumerate supported metadata */
uint32_t idIO; /**< id to enumerate supported io types */
};
static inline void
@ -87,7 +93,6 @@ spa_type_param_map(struct spa_type_map *map,
type->idFormat = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID__Format);
type->idBuffers = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID__Buffers);
type->idMeta = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID__Meta);
type->idIO = spa_type_map_get_id(map, SPA_TYPE_PARAM_ID__IO);
}
}