mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-12 13:30:15 -05:00
Add control properties to audiotestsrc
Add control properties to audiotestsrc for frequency and volume and add a test program. Add size parameter to set_io for additional checks and to make it easy to know how much control data we can write.
This commit is contained in:
parent
8efea3e1ea
commit
a092b9312a
28 changed files with 774 additions and 64 deletions
|
|
@ -34,9 +34,13 @@ 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 properties */
|
||||
#define SPA_TYPE_IO__Prop SPA_TYPE_IO_BASE "Prop"
|
||||
#define SPA_TYPE_IO_PROP_BASE SPA_TYPE_IO__Prop ":"
|
||||
/** 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 ":"
|
||||
|
||||
/** An io area to exchange buffers with a port */
|
||||
#define SPA_TYPE_IO__Buffers SPA_TYPE_IO_BASE "Buffers"
|
||||
|
|
@ -72,6 +76,8 @@ struct spa_io_control_range {
|
|||
struct spa_type_io {
|
||||
uint32_t Buffers;
|
||||
uint32_t ControlRange;
|
||||
uint32_t InputProp;
|
||||
uint32_t OutputProp;
|
||||
};
|
||||
|
||||
static inline void spa_type_io_map(struct spa_type_map *map, struct spa_type_io *type)
|
||||
|
|
@ -79,6 +85,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -432,16 +432,18 @@ struct spa_node {
|
|||
* \param port_id a port id
|
||||
* \param id the id of the io area, the available ids can be
|
||||
* enumerated with the port parameters.
|
||||
* \param io a io area memory
|
||||
* \param data a io area memory
|
||||
* \param size the size of \a data
|
||||
* \return 0 on success
|
||||
* -EINVAL when node is NULL the port is not valid
|
||||
* -ENOENT when \id is unknown
|
||||
* -EINVAL when invalid input is given
|
||||
* -ENOENT when \a id is unknown
|
||||
* -ENOSPC when \a size is too small
|
||||
*/
|
||||
int (*port_set_io) (struct spa_node *node,
|
||||
enum spa_direction direction,
|
||||
uint32_t port_id,
|
||||
uint32_t id,
|
||||
void *io);
|
||||
void *data, size_t size);
|
||||
|
||||
/**
|
||||
* Tell an output port to reuse a buffer.
|
||||
|
|
|
|||
|
|
@ -31,15 +31,21 @@ extern "C" {
|
|||
#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"
|
||||
/** associated property if any */
|
||||
#define SPA_TYPE_PARAM_IO__propId SPA_TYPE_PARAM_IO_BASE "propId"
|
||||
/** associated type of property if any */
|
||||
#define SPA_TYPE_PARAM_IO__propType SPA_TYPE_PARAM_IO_BASE "propType"
|
||||
|
||||
struct spa_type_param_io {
|
||||
uint32_t IO;
|
||||
uint32_t id;
|
||||
uint32_t size;
|
||||
uint32_t propId;
|
||||
uint32_t propType;
|
||||
};
|
||||
|
||||
static inline void
|
||||
|
|
@ -51,6 +57,7 @@ spa_type_param_io_map(struct spa_type_map *map,
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue