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 /** \defgroup spa_param Parameters 33 * Parameter value enumerations and type information 34 */ 35 36 /** 37 * \addtogroup spa_param 38 * \{ 39 */ 40 41 #include <spa/utils/defs.h> 42 43 /** different parameter types that can be queried */ 44 enum spa_param_type { 45 SPA_PARAM_Invalid, /**< invalid */ 46 SPA_PARAM_PropInfo, /**< property information as SPA_TYPE_OBJECT_PropInfo */ 47 SPA_PARAM_Props, /**< properties as SPA_TYPE_OBJECT_Props */ 48 SPA_PARAM_EnumFormat, /**< available formats as SPA_TYPE_OBJECT_Format */ 49 SPA_PARAM_Format, /**< configured format as SPA_TYPE_OBJECT_Format */ 50 SPA_PARAM_Buffers, /**< buffer configurations as SPA_TYPE_OBJECT_ParamBuffers*/ 51 SPA_PARAM_Meta, /**< allowed metadata for buffers as SPA_TYPE_OBJECT_ParamMeta*/ 52 SPA_PARAM_IO, /**< configurable IO areas as SPA_TYPE_OBJECT_ParamIO */ 53 SPA_PARAM_EnumProfile, /**< profile enumeration as SPA_TYPE_OBJECT_ParamProfile */ 54 SPA_PARAM_Profile, /**< profile configuration as SPA_TYPE_OBJECT_ParamProfile */ 55 SPA_PARAM_EnumPortConfig, /**< port configuration enumeration as SPA_TYPE_OBJECT_ParamPortConfig */ 56 SPA_PARAM_PortConfig, /**< port configuration as SPA_TYPE_OBJECT_ParamPortConfig */ 57 SPA_PARAM_EnumRoute, /**< routing enumeration as SPA_TYPE_OBJECT_ParamRoute */ 58 SPA_PARAM_Route, /**< routing configuration as SPA_TYPE_OBJECT_ParamRoute */ 59 SPA_PARAM_Control, /**< Control parameter, a SPA_TYPE_Sequence */ 60 SPA_PARAM_Latency, /**< latency reporting, a SPA_TYPE_OBJECT_ParamLatency */ 61 SPA_PARAM_ProcessLatency, /**< processing latency, a SPA_TYPE_OBJECT_ParamProcessLatency */ 62 }; 63 64 /** information about a parameter */ 65 struct spa_param_info { 66 uint32_t id; /**< enum spa_param_type */ 67 #define SPA_PARAM_INFO_SERIAL (1<<0) /**< bit to signal update even when the 68 * read/write flags don't change */ 69 #define SPA_PARAM_INFO_READ (1<<1) 70 #define SPA_PARAM_INFO_WRITE (1<<2) 71 #define SPA_PARAM_INFO_READWRITE (SPA_PARAM_INFO_WRITE|SPA_PARAM_INFO_READ) 72 uint32_t flags; 73 uint32_t user; /**< private user field. You can use this to keep 74 * state. */ 75 uint32_t padding[5]; 76 }; 77 78 #define SPA_PARAM_INFO(id,flags) (struct spa_param_info){ (id), (flags) } 79 80 /** properties for SPA_TYPE_OBJECT_ParamBuffers */ 81 enum spa_param_buffers { 82 SPA_PARAM_BUFFERS_START, 83 SPA_PARAM_BUFFERS_buffers, /**< number of buffers (Int) */ 84 SPA_PARAM_BUFFERS_blocks, /**< number of data blocks per buffer (Int) */ 85 SPA_PARAM_BUFFERS_size, /**< size of a data block memory (Int)*/ 86 SPA_PARAM_BUFFERS_stride, /**< stride of data block memory (Int) */ 87 SPA_PARAM_BUFFERS_align, /**< alignment of data block memory (Int) */ 88 SPA_PARAM_BUFFERS_dataType, /**< possible memory types (Int, mask of enum spa_data_type) */ 89 }; 90 91 /** properties for SPA_TYPE_OBJECT_ParamMeta */ 92 enum spa_param_meta { 93 SPA_PARAM_META_START, 94 SPA_PARAM_META_type, /**< the metadata, one of enum spa_meta_type (Id enum spa_meta_type) */ 95 SPA_PARAM_META_size, /**< the expected maximum size the meta (Int) */ 96 }; 97 98 /** properties for SPA_TYPE_OBJECT_ParamIO */ 99 enum spa_param_io { 100 SPA_PARAM_IO_START, 101 SPA_PARAM_IO_id, /**< type ID, uniquely identifies the io area (Id enum spa_io_type) */ 102 SPA_PARAM_IO_size, /**< size of the io area (Int) */ 103 }; 104 105 enum spa_param_availability { 106 SPA_PARAM_AVAILABILITY_unknown, /**< unknown availability */ 107 SPA_PARAM_AVAILABILITY_no, /**< not available */ 108 SPA_PARAM_AVAILABILITY_yes, /**< available */ 109 }; 110 111 /** properties for SPA_TYPE_OBJECT_ParamProfile */ 112 enum spa_param_profile { 113 SPA_PARAM_PROFILE_START, 114 SPA_PARAM_PROFILE_index, /**< profile index (Int) */ 115 SPA_PARAM_PROFILE_name, /**< profile name (String) */ 116 SPA_PARAM_PROFILE_description, /**< profile description (String) */ 117 SPA_PARAM_PROFILE_priority, /**< profile priority (Int) */ 118 SPA_PARAM_PROFILE_available, /**< availability of the profile 119 * (Id enum spa_param_availability) */ 120 SPA_PARAM_PROFILE_info, /**< info (Struct( 121 * Int : n_items, 122 * (String : key, 123 * String : value)*)) */ 124 SPA_PARAM_PROFILE_classes, /**< node classes provided by this profile 125 * (Struct( 126 * Int : number of items following 127 * Struct( 128 * String : class name (eg. "Audio/Source"), 129 * Int : number of nodes 130 * String : property (eg. "card.profile.devices"), 131 * Array of Int: device indexes 132 * )*)) */ 133 SPA_PARAM_PROFILE_save, /**< If profile should be saved (Bool) */ 134 }; 135 136 enum spa_param_port_config_mode { 137 SPA_PARAM_PORT_CONFIG_MODE_none, /**< no configuration */ 138 SPA_PARAM_PORT_CONFIG_MODE_passthrough, /**< passthrough configuration */ 139 SPA_PARAM_PORT_CONFIG_MODE_convert, /**< convert configuration */ 140 SPA_PARAM_PORT_CONFIG_MODE_dsp, /**< dsp configuration, depending on the external 141 * format. For audio, ports will be configured for 142 * the given number of channels with F32 format. */ 143 }; 144 145 /** properties for SPA_TYPE_OBJECT_ParamPortConfig */ 146 enum spa_param_port_config { 147 SPA_PARAM_PORT_CONFIG_START, 148 SPA_PARAM_PORT_CONFIG_direction, /**< direction, input/output (Id enum spa_direction) */ 149 SPA_PARAM_PORT_CONFIG_mode, /**< (Id enum spa_param_port_config_mode) mode */ 150 SPA_PARAM_PORT_CONFIG_monitor, /**< (Bool) enable monitor output ports on input ports */ 151 SPA_PARAM_PORT_CONFIG_control, /**< (Bool) enable control ports */ 152 SPA_PARAM_PORT_CONFIG_format, /**< (Object) format filter */ 153 }; 154 155 /** properties for SPA_TYPE_OBJECT_ParamRoute */ 156 enum spa_param_route { 157 SPA_PARAM_ROUTE_START, 158 SPA_PARAM_ROUTE_index, /**< index of the routing destination (Int) */ 159 SPA_PARAM_ROUTE_direction, /**< direction, input/output (Id enum spa_direction) */ 160 SPA_PARAM_ROUTE_device, /**< device id (Int) */ 161 SPA_PARAM_ROUTE_name, /**< name of the routing destination (String) */ 162 SPA_PARAM_ROUTE_description, /**< description of the destination (String) */ 163 SPA_PARAM_ROUTE_priority, /**< priority of the destination (Int) */ 164 SPA_PARAM_ROUTE_available, /**< availability of the destination 165 * (Id enum spa_param_availability) */ 166 SPA_PARAM_ROUTE_info, /**< info (Struct( 167 * Int : n_items, 168 * (String : key, 169 * String : value)*)) */ 170 SPA_PARAM_ROUTE_profiles, /**< associated profile indexes (Array of Int) */ 171 SPA_PARAM_ROUTE_props, /**< properties SPA_TYPE_OBJECT_Props */ 172 SPA_PARAM_ROUTE_devices, /**< associated device indexes (Array of Int) */ 173 SPA_PARAM_ROUTE_profile, /**< profile id (Int) */ 174 SPA_PARAM_ROUTE_save, /**< If route should be saved (Bool) */ 175 }; 176 177 178 /** properties for SPA_TYPE_OBJECT_ParamLatency */ 179 enum spa_param_latency { 180 SPA_PARAM_LATENCY_START, 181 SPA_PARAM_LATENCY_direction, /**< direction, input/output (Id enum spa_direction) */ 182 SPA_PARAM_LATENCY_minQuantum, /**< min latency relative to quantum (Float) */ 183 SPA_PARAM_LATENCY_maxQuantum, /**< max latency relative to quantum (Float) */ 184 SPA_PARAM_LATENCY_minRate, /**< min latency (Int) relative to rate */ 185 SPA_PARAM_LATENCY_maxRate, /**< max latency (Int) relative to rate */ 186 SPA_PARAM_LATENCY_minNs, /**< min latency (Long) in nanoseconds */ 187 SPA_PARAM_LATENCY_maxNs, /**< max latency (Long) in nanoseconds */ 188 }; 189 190 /** properties for SPA_TYPE_OBJECT_ParamProcessLatency */ 191 enum spa_param_process_latency { 192 SPA_PARAM_PROCESS_LATENCY_START, 193 SPA_PARAM_PROCESS_LATENCY_quantum, /**< latency relative to quantum (Float) */ 194 SPA_PARAM_PROCESS_LATENCY_rate, /**< latency (Int) relative to rate */ 195 SPA_PARAM_PROCESS_LATENCY_ns, /**< latency (Long) in nanoseconds */ 196 }; 197 198 enum spa_param_bitorder { 199 SPA_PARAM_BITORDER_unknown, /**< unknown bitorder */ 200 SPA_PARAM_BITORDER_msb, /**< most significant bit */ 201 SPA_PARAM_BITORDER_lsb, /**< least significant bit */ 202 }; 203 204 /** 205 * \} 206 */ 207 208 #ifdef __cplusplus 209 } /* extern "C" */ 210 #endif 211 212 #endif /* SPA_PARAM_H */ 213