| 1 |
/* Simple Plugin API |
| 2 |
* |
| 3 |
* Copyright © 2018 Wim Taymans |
| 4 |
* |
| 5 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 6 |
* copy of this software and associated documentation files (the "Software"), |
| 7 |
* to deal in the Software without restriction, including without limitation |
| 8 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 |
* and/or sell copies of the Software, and to permit persons to whom the |
| 10 |
* Software is furnished to do so, subject to the following conditions: |
| 11 |
* |
| 12 |
* The above copyright notice and this permission notice (including the next |
| 13 |
* paragraph) shall be included in all copies or substantial portions of the |
| 14 |
* Software. |
| 15 |
* |
| 16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 |
* DEALINGS IN THE SOFTWARE. |
| 23 |
*/ |
| 24 |
|
| 25 |
#ifndef SPA_PARAM_H |
| 26 |
#define SPA_PARAM_H |
| 27 |
|
| 28 |
#ifdef __cplusplus |
| 29 |
extern "C" { |
| 30 |
#endif |
| 31 |
|
| 32 |
#include <spa/utils/defs.h> |
| 33 |
|
| 34 |
/** different parameter types that can be queried */ |
| 35 |
enum spa_param_type { |
| 36 |
SPA_PARAM_Invalid, /**< invalid */ |
| 37 |
SPA_PARAM_PropInfo, /**< property information as SPA_TYPE_OBJECT_PropInfo */ |
| 38 |
SPA_PARAM_Props, /**< properties as SPA_TYPE_OBJECT_Props */ |
| 39 |
SPA_PARAM_EnumFormat, /**< available formats as SPA_TYPE_OBJECT_Format */ |
| 40 |
SPA_PARAM_Format, /**< configured format as SPA_TYPE_OBJECT_Format */ |
| 41 |
SPA_PARAM_Buffers, /**< buffer configurations as SPA_TYPE_OBJECT_ParamBuffers*/ |
| 42 |
SPA_PARAM_Meta, /**< allowed metadata for buffers as SPA_TYPE_OBJECT_ParamMeta*/ |
| 43 |
SPA_PARAM_IO, /**< configurable IO areas as SPA_TYPE_OBJECT_ParamIO */ |
| 44 |
SPA_PARAM_EnumProfile, /**< profile enumeration as SPA_TYPE_OBJECT_ParamProfile */ |
| 45 |
SPA_PARAM_Profile, /**< profile configuration as SPA_TYPE_OBJECT_ParamProfile */ |
| 46 |
SPA_PARAM_EnumPortConfig, /**< port configuration enumeration as SPA_TYPE_OBJECT_ParamPortConfig */ |
| 47 |
SPA_PARAM_PortConfig, /**< port configuration as SPA_TYPE_OBJECT_ParamPortConfig */ |
| 48 |
SPA_PARAM_EnumRoute, /**< routing enumeration as SPA_TYPE_OBJECT_ParamRoute */ |
| 49 |
SPA_PARAM_Route, /**< routing configuration as SPA_TYPE_OBJECT_ParamRoute */ |
| 50 |
SPA_PARAM_Control, /**< Control parameter, a SPA_TYPE_Sequence */ |
| 51 |
}; |
| 52 |
|
| 53 |
/** information about a parameter */ |
| 54 |
struct spa_param_info { |
| 55 |
uint32_t id; /**< enum spa_param_type */ |
| 56 |
#define SPA_PARAM_INFO_SERIAL (1<<0) /**< bit to signal update even when the |
| 57 |
* read/write flags don't change */ |
| 58 |
#define SPA_PARAM_INFO_READ (1<<1) |
| 59 |
#define SPA_PARAM_INFO_WRITE (1<<2) |
| 60 |
#define SPA_PARAM_INFO_READWRITE (SPA_PARAM_INFO_WRITE|SPA_PARAM_INFO_READ) |
| 61 |
uint32_t flags; |
| 62 |
uint32_t user; /**< private user field. You can use this to keep |
| 63 |
* state. */ |
| 64 |
uint32_t padding[5]; |
| 65 |
}; |
| 66 |
|
| 67 |
#define SPA_PARAM_INFO(id,flags) (struct spa_param_info){ (id), (flags) } |
| 68 |
|
| 69 |
/** properties for SPA_TYPE_OBJECT_ParamBuffers */ |
| 70 |
enum spa_param_buffers { |
| 71 |
SPA_PARAM_BUFFERS_START, |
| 72 |
SPA_PARAM_BUFFERS_buffers, /**< number of buffers (Int) */ |
| 73 |
SPA_PARAM_BUFFERS_blocks, /**< number of data blocks per buffer (Int) */ |
| 74 |
SPA_PARAM_BUFFERS_size, /**< size of a data block memory (Int)*/ |
| 75 |
SPA_PARAM_BUFFERS_stride, /**< stride of data block memory (Int) */ |
| 76 |
SPA_PARAM_BUFFERS_align, /**< alignment of data block memory (Int) */ |
| 77 |
SPA_PARAM_BUFFERS_dataType, /**< possible memory types (Int, mask of enum spa_data_type) */ |
| 78 |
}; |
| 79 |
|
| 80 |
/** properties for SPA_TYPE_OBJECT_ParamMeta */ |
| 81 |
enum spa_param_meta { |
| 82 |
SPA_PARAM_META_START, |
| 83 |
SPA_PARAM_META_type, /**< the metadata, one of enum spa_meta_type (Id enum spa_meta_type) */ |
| 84 |
SPA_PARAM_META_size, /**< the expected maximum size the meta (Int) */ |
| 85 |
}; |
| 86 |
|
| 87 |
/** properties for SPA_TYPE_OBJECT_ParamIO */ |
| 88 |
enum spa_param_io { |
| 89 |
SPA_PARAM_IO_START, |
| 90 |
SPA_PARAM_IO_id, /**< type ID, uniquely identifies the io area (Id enum spa_io_type) */ |
| 91 |
SPA_PARAM_IO_size, /**< size of the io area (Int) */ |
| 92 |
}; |
| 93 |
|
| 94 |
enum spa_param_availability { |
| 95 |
SPA_PARAM_AVAILABILITY_unknown, /**< unknown availability */ |
| 96 |
SPA_PARAM_AVAILABILITY_no, /**< not available */ |
| 97 |
SPA_PARAM_AVAILABILITY_yes, /**< available */ |
| 98 |
}; |
| 99 |
|
| 100 |
/** properties for SPA_TYPE_OBJECT_ParamProfile */ |
| 101 |
enum spa_param_profile { |
| 102 |
SPA_PARAM_PROFILE_START, |
| 103 |
SPA_PARAM_PROFILE_index, /**< profile index (Int) */ |
| 104 |
SPA_PARAM_PROFILE_name, /**< profile name (String) */ |
| 105 |
SPA_PARAM_PROFILE_description, /**< profile description (String) */ |
| 106 |
SPA_PARAM_PROFILE_priority, /**< profile priority (Int) */ |
| 107 |
SPA_PARAM_PROFILE_available, /**< availability of the profile |
| 108 |
* (Id enum spa_param_availability) */ |
| 109 |
SPA_PARAM_PROFILE_info, /**< info (Struct( |
| 110 |
* Int : n_items, |
| 111 |
* (String : key, |
| 112 |
* String : value)*)) */ |
| 113 |
SPA_PARAM_PROFILE_classes, /**< node classes provided by this profile |
| 114 |
* (Struct( |
| 115 |
* Int : number of items following |
| 116 |
* Struct( |
| 117 |
* String : class name (eg. "Audio/Source"), |
| 118 |
* Int : number of nodes |
| 119 |
* String : property (eg. "card.profile.devices"), |
| 120 |
* Array of Int: device indexes |
| 121 |
* )*)) */ |
| 122 |
SPA_PARAM_PROFILE_save, /**< If profile should be saved (Bool) */ |
| 123 |
}; |
| 124 |
|
| 125 |
enum spa_param_port_config_mode { |
| 126 |
SPA_PARAM_PORT_CONFIG_MODE_none, /**< no configuration */ |
| 127 |
SPA_PARAM_PORT_CONFIG_MODE_passthrough, /**< passthrough configuration */ |
| 128 |
SPA_PARAM_PORT_CONFIG_MODE_convert, /**< convert configuration */ |
| 129 |
SPA_PARAM_PORT_CONFIG_MODE_dsp, /**< dsp configuration, depending on the external |
| 130 |
* format. For audio, ports will be configured for |
| 131 |
* the given number of channels with F32 format. */ |
| 132 |
}; |
| 133 |
|
| 134 |
/** properties for SPA_TYPE_OBJECT_ParamPortConfig */ |
| 135 |
enum spa_param_port_config { |
| 136 |
SPA_PARAM_PORT_CONFIG_START, |
| 137 |
SPA_PARAM_PORT_CONFIG_direction, /**< direction, input/output (Id enum spa_direction) */ |
| 138 |
SPA_PARAM_PORT_CONFIG_mode, /**< (Id enum spa_param_port_config_mode) mode */ |
| 139 |
SPA_PARAM_PORT_CONFIG_monitor, /**< (Bool) enable monitor output ports on input ports */ |
| 140 |
SPA_PARAM_PORT_CONFIG_control, /**< (Bool) enable control ports */ |
| 141 |
SPA_PARAM_PORT_CONFIG_format, /**< (Object) format filter */ |
| 142 |
}; |
| 143 |
|
| 144 |
/** properties for SPA_TYPE_OBJECT_ParamRoute */ |
| 145 |
enum spa_param_route { |
| 146 |
SPA_PARAM_ROUTE_START, |
| 147 |
SPA_PARAM_ROUTE_index, /**< index of the routing destination (Int) */ |
| 148 |
SPA_PARAM_ROUTE_direction, /**< direction, input/output (Id enum spa_direction) */ |
| 149 |
SPA_PARAM_ROUTE_device, /**< device id (Int) */ |
| 150 |
SPA_PARAM_ROUTE_name, /**< name of the routing destination (String) */ |
| 151 |
SPA_PARAM_ROUTE_description, /**< description of the destination (String) */ |
| 152 |
SPA_PARAM_ROUTE_priority, /**< priority of the destination (Int) */ |
| 153 |
SPA_PARAM_ROUTE_available, /**< availability of the destination |
| 154 |
* (Id enum spa_param_availability) */ |
| 155 |
SPA_PARAM_ROUTE_info, /**< info (Struct( |
| 156 |
* Int : n_items, |
| 157 |
* (String : key, |
| 158 |
* String : value)*)) */ |
| 159 |
SPA_PARAM_ROUTE_profiles, /**< associated profile indexes (Array of Int) */ |
| 160 |
SPA_PARAM_ROUTE_props, /**< properties SPA_TYPE_OBJECT_Props */ |
| 161 |
SPA_PARAM_ROUTE_devices, /**< associated device indexes (Array of Int) */ |
| 162 |
SPA_PARAM_ROUTE_profile, /**< profile id (Int) */ |
| 163 |
SPA_PARAM_ROUTE_save, /**< If route should be saved (Bool) */ |
| 164 |
}; |
| 165 |
|
| 166 |
|
| 167 |
#ifdef __cplusplus |
| 168 |
} /* extern "C" */ |
| 169 |
#endif |
| 170 |
|
| 171 |
#endif /* SPA_PARAM_H */ |