1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup Audio 18 * @{ 19 * 20 * @brief Defines audio-related APIs, including custom data types and functions for loading drivers, 21 * accessing a driver adapter, and rendering and capturing audios. 22 * 23 * @since 1.0 24 * @version 1.0 25 */ 26 27 /** 28 * @file audio_types.h 29 * 30 * @brief Defines custom data types used in API declarations for the audio module, including audio ports, 31 * adapter descriptors, device descriptors, scene descriptors, sampling attributes, and timestamp. 32 * 33 * @since 1.0 34 * @version 1.0 35 */ 36 37 #ifndef AUDIO_TYPES_H 38 #define AUDIO_TYPES_H 39 40 #include <stdint.h> 41 #include <stdbool.h> 42 43 /** 44 * @brief Defines the audio handle. 45 */ 46 typedef void *AudioHandle; 47 48 /** 49 * @brief Enumerates the audio port type. 50 */ 51 enum AudioPortDirection { 52 PORT_OUT = 0x1u, /**< Output port */ 53 PORT_IN = 0x2u, /**< Input port */ 54 PORT_OUT_IN = 0x3u, /**< Input/output port, supporting both audio input and output */ 55 }; 56 57 /** 58 * @brief Defines the audio port. 59 */ 60 struct AudioPort { 61 enum AudioPortDirection dir; /**< Audio port type. For details, see {@link AudioPortDirection} */ 62 uint32_t portId; /**< Audio port ID */ 63 const char *portName; /**< Audio port name */ 64 }; 65 66 /** 67 * @brief Defines the audio adapter descriptor. 68 * 69 * An audio adapter is a set of port drivers for a sound card, including the output and input ports. 70 * One port corresponds to multiple pins, and each pin belongs to a physical component (such as a 71 * speaker or a wired headset). 72 */ 73 struct AudioAdapterDescriptor { 74 const char *adapterName; /**< Name of the audio adapter */ 75 uint32_t portNum; /**< Number of ports supported by an audio adapter */ 76 struct AudioPort *ports; /**< List of ports supported by an audio adapter */ 77 }; 78 79 /** 80 * @brief Enumerates the pin of an audio adapter. 81 */ 82 enum AudioPortPin { 83 PIN_NONE = 0x0u, /**< Invalid pin */ 84 PIN_OUT_SPEAKER = 0x1u, /**< Speaker output pin */ 85 PIN_OUT_HEADSET = 0x2u, /**< Wired headset pin for output */ 86 PIN_OUT_LINEOUT = 0x4u, /**< Line-out pin */ 87 PIN_OUT_HDMI = 0x8u, /**< HDMI output pin */ 88 PIN_OUT_USB = 0x10u, /**< USB output pin */ 89 PIN_OUT_USB_EXT = 0x20u, /**< Extended USB output pin*/ 90 PIN_OUT_EARPIECE = 0x30u, /**< Earpiece output pin */ 91 PIN_OUT_BLUETOOTH_SCO = 0x40u, /**< Bluetooth SCO output pin */ 92 PIN_OUT_DAUDIO_DEFAULT = 0x80u, 93 PIN_OUT_HEADPHONE = 0x100u, /**< Wired headphone output pin*/ 94 PIN_OUT_USB_HEADSET = 0x200u, /**< ARM USB out pin */ 95 PIN_IN_MIC = 0x8000001u, /**< Microphone input pin */ 96 PIN_IN_HS_MIC = 0x8000002u, /**< Wired headset microphone pin for input */ 97 PIN_IN_LINEIN = 0x8000004u, /**< Line-in pin */ 98 PIN_IN_USB_EXT = 0x8000008u, /**< Extended USB input pin*/ 99 PIN_IN_BLUETOOTH_SCO_HEADSET = 0x8000010u, /**< Bluetooth SCO headset input pin */ 100 PIN_IN_USB_HEADSET = 0x8000040u, /**< ARM USB input pin */ 101 }; 102 103 /** 104 * @brief Defines the audio device descriptor. 105 */ 106 struct AudioDeviceDescriptor { 107 uint32_t portId; /**< Audio port ID */ 108 enum AudioPortPin pins; /**< Pins of audio ports (input and output). For details, see {@link AudioPortPin}. */ 109 const char *desc; /**< Audio device name */ 110 }; 111 112 /** 113 * @brief Enumerates the audio category. 114 */ 115 enum AudioCategory { 116 AUDIO_IN_MEDIA = 0, /**< Media */ 117 AUDIO_IN_COMMUNICATION, /**< Communications */ 118 AUDIO_IN_RINGTONE, /**< Ringtone */ 119 AUDIO_IN_CALL, /**< Call */ 120 AUDIO_MMAP_NOIRQ, /**< Mmap mode */ 121 AUDIO_MMAP_VOIP = 8, /**< Mmap Voip mode */ 122 }; 123 124 /** 125 * @brief Defines the audio scene descriptor. 126 */ 127 struct AudioSceneDescriptor { 128 /** 129 * @brief Describes the audio scene. 130 */ 131 union SceneDesc { 132 uint32_t id; /**< Audio scene ID */ 133 const char *desc; /**< Name of the audio scene */ 134 } scene; /**< The <b>scene</b> object */ 135 struct AudioDeviceDescriptor desc; /**< Audio device descriptor */ 136 }; 137 138 /** 139 * @brief Enumerates the audio format. 140 */ 141 enum AudioFormat { 142 AUDIO_FORMAT_TYPE_PCM_8_BIT = 0x1u, /**< 8-bit PCM */ 143 AUDIO_FORMAT_TYPE_PCM_16_BIT = 0x2u, /**< 16-bit PCM */ 144 AUDIO_FORMAT_TYPE_PCM_24_BIT = 0x3u, /**< 24-bit PCM */ 145 AUDIO_FORMAT_TYPE_PCM_32_BIT = 0x4u, /**< 32-bit PCM */ 146 AUDIO_FORMAT_TYPE_AAC_MAIN = 0x1000001u, /**< AAC main */ 147 AUDIO_FORMAT_TYPE_AAC_LC = 0x1000002u, /**< AAC LC */ 148 AUDIO_FORMAT_TYPE_AAC_LD = 0x1000003u, /**< AAC LD */ 149 AUDIO_FORMAT_TYPE_AAC_ELD = 0x1000004u, /**< AAC ELD */ 150 AUDIO_FORMAT_TYPE_AAC_HE_V1 = 0x1000005u, /**< AAC HE_V1 */ 151 AUDIO_FORMAT_TYPE_AAC_HE_V2 = 0x1000006u, /**< AAC HE_V2 */ 152 AUDIO_FORMAT_TYPE_G711A = 0x2000001u, /**< G711A */ 153 AUDIO_FORMAT_TYPE_G711U = 0x2000002u, /**< G711u */ 154 AUDIO_FORMAT_TYPE_G726 = 0x2000003u, /**< G726 */ 155 }; 156 157 /** 158 * @brief Enumerates the audio channel mask. 159 * 160 * A mask describes an audio channel position. 161 */ 162 enum AudioChannelMask { 163 AUDIO_CHANNEL_MONO = 1u, /**< Mono channel */ 164 AUDIO_CHANNEL_FRONT_LEFT = 1u, /**< Front left channel */ 165 AUDIO_CHANNEL_FRONT_RIGHT = 2u, /**< Front right channel */ 166 AUDIO_CHANNEL_FRONT_CENTER = 4u, /**< Front right channel */ 167 AUDIO_CHANNEL_LOW_FREQUENCY = 8u, /**< 0x8 */ 168 AUDIO_CHANNEL_BACK_LEFT = 16u, /**< 0x10 */ 169 AUDIO_CHANNEL_BACK_RIGHT = 32u, /**< 0x20 */ 170 AUDIO_CHANNEL_BACK_CENTER = 256u, /**< 0x100 */ 171 AUDIO_CHANNEL_SIDE_LEFT = 512u, /**< 0x200 */ 172 AUDIO_CHANNEL_SIDE_RIGHT = 1024u, /**< 0x400 */ 173 AUDIO_CHANNEL_TOP_SIDE_LEFT = 262144u, /**< 0x40000 */ 174 AUDIO_CHANNEL_TOP_SIDE_RIGHT = 524288u, /**< 0x80000 */ 175 AUDIO_CHANNEL_STEREO = 3u, /**< FRONT_LEFT | FRONT_RIGHT */ 176 AUDIO_CHANNEL_2POINT1 = 11u, /**< STEREO | LOW_FREQUENCY */ 177 AUDIO_CHANNEL_QUAD = 51u, /**< STEREO | BACK_LEFT | BACK_RIGHT */ 178 AUDIO_CHANNEL_3POINT0POINT2 = 786439u, /**< STEREO | FRONT_CENTER | TOP_SIDE_LEFT | TOP_SIDE_RIGHT */ 179 AUDIO_CHANNEL_5POINT1 = 63u, /**< QUAD | FRONT_CENTER | LOW_FREQUENCY */ 180 AUDIO_CHANNEL_6POINT1 = 319u, /**< AUDIO_CHANNEL_5POINT1 | BACK_CENTER */ 181 AUDIO_CHANNEL_7POINT1 = 1599u, /**< AUDIO_CHANNEL_5POINT1 | SIDE_LEFT | SIDE_RIGHT */ 182 }; 183 184 /** 185 * @brief Enumerates masks of audio sampling rates. 186 */ 187 enum AudioSampleRatesMask { 188 AUDIO_SAMPLE_RATE_MASK_8000 = 0x1u, /**< 8 kHz */ 189 AUDIO_SAMPLE_RATE_MASK_12000 = 0x2u, /**< 12 kHz */ 190 AUDIO_SAMPLE_RATE_MASK_11025 = 0x4u, /**< 11.025 kHz */ 191 AUDIO_SAMPLE_RATE_MASK_16000 = 0x8u, /**< 16 kHz */ 192 AUDIO_SAMPLE_RATE_MASK_22050 = 0x10u, /**< 22.050 kHz */ 193 AUDIO_SAMPLE_RATE_MASK_24000 = 0x20u, /**< 24 kHz */ 194 AUDIO_SAMPLE_RATE_MASK_32000 = 0x40u, /**< 32 kHz */ 195 AUDIO_SAMPLE_RATE_MASK_44100 = 0x80u, /**< 44.1 kHz */ 196 AUDIO_SAMPLE_RATE_MASK_48000 = 0x100u, /**< 48 kHz */ 197 AUDIO_SAMPLE_RATE_MASK_64000 = 0x200u, /**< 64 kHz */ 198 AUDIO_SAMPLE_RATE_MASK_96000 = 0x400u, /**< 96 kHz */ 199 AUDIO_SAMPLE_RATE_MASK_INVALID = 0xFFFFFFFFu, /**< Invalid sampling rate */ 200 }; 201 enum AudioInputType { 202 AUDIO_INPUT_DEFAULT_TYPE = 0, 203 AUDIO_INPUT_MIC_TYPE = 1 << 0, 204 AUDIO_INPUT_SPEECH_WAKEUP_TYPE = 1 << 1, 205 AUDIO_INPUT_VOICE_COMMUNICATION_TYPE = 1 << 2, 206 AUDIO_INPUT_VOICE_RECOGNITION_TYPE = 1 << 3, 207 }; 208 /** 209 * @brief Defines audio sampling attributes. 210 */ 211 struct AudioSampleAttributes { 212 enum AudioCategory type; /**< Audio type. For details, see {@link AudioCategory} */ 213 bool interleaved; /**< Interleaving flag of audio data */ 214 enum AudioFormat format; /**< Audio data format. For details, see {@link AudioFormat}. */ 215 uint32_t sampleRate; /**< Audio sampling rate */ 216 uint32_t channelCount; /**< Number of audio channels. For example, for the mono channel, the value is 1, 217 * and for the stereo channel, the value is 2. 218 */ 219 uint32_t period; /**< Audio sampling period */ 220 uint32_t frameSize; /**< Frame size of the audio data */ 221 bool isBigEndian; /**< Big endian flag of audio data */ 222 bool isSignedData; /**< Signed or unsigned flag of audio data */ 223 uint32_t startThreshold; /**< Audio render start threshold. */ 224 uint32_t stopThreshold; /**< Audio render stop threshold. */ 225 uint32_t silenceThreshold; /**< Audio capture buffer threshold. */ 226 int32_t streamId; /**< Audio Identifier of render or capture */ 227 int32_t sourceType; 228 }; 229 230 /** 231 * @brief Defines the audio timestamp, which is a substitute for POSIX <b>timespec</b>. 232 */ 233 struct AudioTimeStamp { 234 int64_t tvSec; /**< Seconds */ 235 int64_t tvNSec; /**< Nanoseconds */ 236 }; 237 238 /** 239 * @brief Enumerates the passthrough data transmission mode of an audio port. 240 */ 241 enum AudioPortPassthroughMode { 242 PORT_PASSTHROUGH_LPCM = 0x1, /**< Stereo PCM */ 243 PORT_PASSTHROUGH_RAW = 0x2, /**< HDMI passthrough */ 244 PORT_PASSTHROUGH_HBR2LBR = 0x4, /**< Blu-ray next-generation audio output with reduced specifications */ 245 PORT_PASSTHROUGH_AUTO = 0x8, /**< Mode automatically matched based on the HDMI EDID */ 246 }; 247 248 /** 249 * @brief Defines the sub-port capability. 250 */ 251 struct AudioSubPortCapability { 252 uint32_t portId; /**< Sub-port ID */ 253 const char *desc; /**< Sub-port name */ 254 enum AudioPortPassthroughMode mask; /**< Passthrough mode of data transmission. For details, 255 * see {@link AudioPortPassthroughMode}. 256 */ 257 }; 258 259 /** 260 * @brief Defines formats of raw audio samples. 261 */ 262 enum AudioSampleFormat { 263 /* 8 bits */ 264 AUDIO_SAMPLE_FORMAT_S8, /**< signed 8 bit sample */ 265 AUDIO_SAMPLE_FORMAT_S8P, /**< signed 8 bit planar sample */ 266 AUDIO_SAMPLE_FORMAT_U8, /**< unsigned 8 bit sample */ 267 AUDIO_SAMPLE_FORMAT_U8P, /**< unsigned 8 bit planar sample */ 268 /* 16 bits */ 269 AUDIO_SAMPLE_FORMAT_S16, /**< signed 16 bit sample */ 270 AUDIO_SAMPLE_FORMAT_S16P, /**< signed 16 bit planar sample */ 271 AUDIO_SAMPLE_FORMAT_U16, /**< unsigned 16 bit sample */ 272 AUDIO_SAMPLE_FORMAT_U16P, /**< unsigned 16 bit planar sample */ 273 /* 24 bits */ 274 AUDIO_SAMPLE_FORMAT_S24, /**< signed 24 bit sample */ 275 AUDIO_SAMPLE_FORMAT_S24P, /**< signed 24 bit planar sample */ 276 AUDIO_SAMPLE_FORMAT_U24, /**< unsigned 24 bit sample */ 277 AUDIO_SAMPLE_FORMAT_U24P, /**< unsigned 24 bit planar sample */ 278 /* 32 bits */ 279 AUDIO_SAMPLE_FORMAT_S32, /**< signed 32 bit sample */ 280 AUDIO_SAMPLE_FORMAT_S32P, /**< signed 32 bit planar sample */ 281 AUDIO_SAMPLE_FORMAT_U32, /**< unsigned 32 bit sample */ 282 AUDIO_SAMPLE_FORMAT_U32P, /**< unsigned 32 bit planar sample */ 283 /* 64 bits */ 284 AUDIO_SAMPLE_FORMAT_S64, /**< signed 64 bit sample */ 285 AUDIO_SAMPLE_FORMAT_S64P, /**< signed 64 bit planar sample */ 286 AUDIO_SAMPLE_FORMAT_U64, /**< unsigned 64 bit sample */ 287 AUDIO_SAMPLE_FORMAT_U64P, /**< unsigned 64 bit planar sample */ 288 /* float double */ 289 AUDIO_SAMPLE_FORMAT_F32, /**< float 32 bit sample */ 290 AUDIO_SAMPLE_FORMAT_F32P, /**< float 32 bit planar sample */ 291 AUDIO_SAMPLE_FORMAT_F64, /**< double 64 bit sample */ 292 AUDIO_SAMPLE_FORMAT_F64P, /**< double 64 bit planar sample */ 293 }; 294 295 /** 296 * @brief Defines the audio port capability. 297 */ 298 struct AudioPortCapability { 299 uint32_t deviceType; /**< Device type (output or input) */ 300 uint32_t deviceId; /**< Device ID used for device binding */ 301 bool hardwareMode; /**< Whether to support device binding */ 302 uint32_t formatNum; /**< Number of the supported audio formats */ 303 enum AudioFormat *formats; /**< Supported audio formats. For details, see {@link AudioFormat}. */ 304 uint32_t sampleRateMasks; /**< Supported audio sampling rates (8 kHz, 16 kHz, 32 kHz, and 48 kHz) */ 305 enum AudioChannelMask channelMasks; /**< Audio channel layout mask of the device. For details, 306 * see {@link AudioChannelMask}. 307 */ 308 uint32_t channelCount; /**< Supported maximum number of audio channels */ 309 uint32_t subPortsNum; /**< Number of supported sub-ports (for output devices only) */ 310 struct AudioSubPortCapability *subPorts; /**< List of supported sub-ports */ 311 uint32_t supportSampleFormatNum; /**< Number of the supported audio sample format enum. */ 312 enum AudioSampleFormat *supportSampleFormats; /**< Supported audio sample formats. For details, 313 * see {@link AudioSampleFormat}. 314 */ 315 }; 316 317 /** 318 * @brief Enumerates channel modes for audio rendering. 319 * 320 * @attention The following modes are set for rendering dual-channel audios. Others are not supported. 321 */ 322 enum AudioChannelMode { 323 AUDIO_CHANNEL_NORMAL = 0, /**< Normal mode. No processing is required. */ 324 AUDIO_CHANNEL_BOTH_LEFT, /**< Two left channels */ 325 AUDIO_CHANNEL_BOTH_RIGHT, /**< Two right channels */ 326 AUDIO_CHANNEL_EXCHANGE, /**< Data exchange between the left and right channels. The left channel takes the audio 327 * stream of the right channel, and the right channel takes that of the left channel. 328 */ 329 AUDIO_CHANNEL_MIX, /**< Mix of streams of the left and right channels */ 330 AUDIO_CHANNEL_LEFT_MUTE, /**< Left channel muted. The stream of the right channel is output. */ 331 AUDIO_CHANNEL_RIGHT_MUTE, /**< Right channel muted. The stream of the left channel is output. */ 332 AUDIO_CHANNEL_BOTH_MUTE, /**< Both left and right channels muted */ 333 }; 334 335 /** 336 * @brief Enumerates the execution types of the <b>DrainBuffer</b> function. 337 */ 338 enum AudioDrainNotifyType { 339 AUDIO_DRAIN_NORMAL_MODE, /**< The <b>DrainBuffer</b> function returns after all data finishes playback. */ 340 AUDIO_DRAIN_EARLY_MODE, /**< The <b>DrainBuffer</b> function returns before all the data of the current track 341 * finishes playback to reserve time for a smooth track switch by the audio service. 342 */ 343 }; 344 345 /** 346 * @brief Enumerates callback notification events. 347 */ 348 enum AudioCallbackType { 349 AUDIO_NONBLOCK_WRITE_COMPLETED, /**< The non-block write is complete. */ 350 AUDIO_DRAIN_COMPLETED, /**< The draining is complete. */ 351 AUDIO_FLUSH_COMPLETED, /**< The flush is complete. */ 352 AUDIO_RENDER_FULL, /**< The render buffer is full.*/ 353 AUDIO_ERROR_OCCUR, /**< An error occurs.*/ 354 }; 355 356 /** 357 * @brief Describes a mmap buffer. 358 */ 359 struct AudioMmapBufferDescriptor { 360 void *memoryAddress; /**< Pointer to the mmap buffer */ 361 int32_t memoryFd; /**< File descriptor of the mmap buffer */ 362 int32_t totalBufferFrames; /**< Total size of the mmap buffer (unit: frame )*/ 363 int32_t transferFrameSize; /**< Transfer size (unit: frame) */ 364 int32_t isShareable; /**< Whether the mmap buffer can be shared among processes */ 365 uint32_t offset; 366 }; 367 368 /** 369 * @brief Describes AudioPortRole. 370 */ 371 enum AudioPortRole { 372 AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< Unassigned port role */ 373 AUDIO_PORT_SOURCE_ROLE = 1, /**< Assigned source role */ 374 AUDIO_PORT_SINK_ROLE = 2, /**< Assigned sink role */ 375 }; 376 377 /** 378 * @brief Describes AudioPortType. 379 */ 380 enum AudioPortType { 381 AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< Unassigned port type */ 382 AUDIO_PORT_DEVICE_TYPE = 1, /**< Assigned device type */ 383 AUDIO_PORT_MIX_TYPE = 2, /**< Assigned mix type */ 384 AUDIO_PORT_SESSION_TYPE = 3, /**< Assigned session type */ 385 }; 386 387 /** 388 * @brief Describes AudioDevExtInfo. 389 */ 390 struct AudioDevExtInfo { 391 int32_t moduleId; /**< Identifier of the module stream is attached to */ 392 enum AudioPortPin type; /**< Device type For details, see {@link AudioPortPin}. */ 393 const char *desc; /**< Address */ 394 }; 395 396 /** 397 * @brief Describes AudioMixInfo. 398 */ 399 struct AudioMixExtInfo { 400 int32_t moduleId; /**< Identifier of the module stream is attached to */ 401 int32_t streamId; /**< Identifier of the capture or render passed by caller */ 402 }; 403 404 /** 405 * @brief Describes AudioSessionType. 406 */ 407 enum AudioSessionType { 408 AUDIO_OUTPUT_STAGE_SESSION = 0, 409 AUDIO_OUTPUT_MIX_SESSION, 410 AUDIO_ALLOCATE_SESSION, 411 AUDIO_INVALID_SESSION, 412 }; 413 414 /** 415 * @brief Describes AudioSessionExtInfo. 416 */ 417 struct AudioSessionExtInfo { 418 enum AudioSessionType sessionType; 419 }; 420 421 /** 422 * @brief Describes AudioRouteNode. 423 */ 424 struct AudioRouteNode { 425 int32_t portId; /**< Audio port ID */ 426 enum AudioPortRole role; /**< Audio port as a sink or a source */ 427 enum AudioPortType type; /**< device, mix ... */ 428 union { 429 struct AudioDevExtInfo device; /* Specific Device Ext info */ 430 struct AudioMixExtInfo mix; /* Specific mix info */ 431 struct AudioSessionExtInfo session; /* session specific info */ 432 } ext; 433 }; 434 435 /** 436 * @brief Describes AudioRoute. 437 */ 438 struct AudioRoute { 439 uint32_t sourcesNum; 440 const struct AudioRouteNode *sources; 441 uint32_t sinksNum; 442 const struct AudioRouteNode *sinks; 443 }; 444 445 /** 446 * @brief Enumerates the restricted key type of the parameters 447 */ 448 enum AudioExtParamKey { 449 AUDIO_EXT_PARAM_KEY_NONE = 0, /**< Distributed audio extra param key none */ 450 AUDIO_EXT_PARAM_KEY_VOLUME = 1, /**< Distributed audio extra param key volume event */ 451 AUDIO_EXT_PARAM_KEY_FOCUS = 2, /**< Distributed audio extra param key focus event */ 452 AUDIO_EXT_PARAM_KEY_BUTTON = 3, /**< Distributed audio extra param key media button event */ 453 AUDIO_EXT_PARAM_KEY_EFFECT = 4, /**< Distributed audio extra param key audio effect event */ 454 AUDIO_EXT_PARAM_KEY_STATUS = 5, /**< Distributed audio extra param key device status event */ 455 AUDIO_EXT_PARAM_KEY_USB_DEVICE = 101, /**< Check USB device type ARM or HIFI */ 456 AUDIO_EXT_PARAM_KEY_LOWPOWER = 1000, /**< Low power event type */ 457 }; 458 /** 459 * @brief Describes status of audio deivce.@link enum AudioDeviceType 460 */ 461 struct AudioDeviceStatus { 462 uint32_t pnpStatus; 463 }; 464 /** 465 * @brief Called when an event defined in {@link AudioCallbackType} occurs. 466 * 467 * @param AudioCallbackType Indicates the occurred event that triggers this callback. 468 * @param reserved Indicates the pointer to a reserved field. 469 * @param cookie Indicates the pointer to the cookie for data transmission. 470 * @return Returns <b>0</b> if the callback is successfully executed; returns a negative value otherwise. 471 * @see RegCallback 472 */ 473 typedef int32_t (*RenderCallback)(enum AudioCallbackType, void *reserved, void *cookie); 474 475 /** 476 * @brief Register audio extra param callback that will be invoked during audio param event. 477 * 478 * @param key Indicates param change event. 479 * @param condition Indicates the param condition. 480 * @param value Indicates the param value. 481 * @param reserved Indicates reserved param. 482 * @param cookie Indicates the pointer to the callback parameters; 483 * @return Returns <b>0</b> if the operation is successful; returns a negative value otherwise. 484 */ 485 typedef int32_t (*ParamCallback)(enum AudioExtParamKey key, const char *condition, const char *value, void *reserved, 486 void *cookie); 487 488 #endif /* AUDIO_TYPES_H */ 489