• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 i_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 I_AUDIO_TYPES_H
38 #define I_AUDIO_TYPES_H
39 
40 #include <stdint.h>
41 #include <stdbool.h>
42 
43 #define AUDIO_HW_ADAPTER_NUM_MAX        8 // Limit the number of sound cards supported to a maximum of 8
44 #define AUDIO_HW_PORT_NUM_MAX    10
45 #define AUDIO_HW_STREAM_NUM_MAX  10
46 /**
47  * @brief Defines the audio handle.
48  */
49 typedef void *AudioHandle;
50 
51 /**
52  * @brief Enumerates the audio port type.
53  */
54 enum AudioHwiPortDirection {
55     HW_PORT_OUT    = 0x1u, /**< Output port */
56     HW_PORT_IN     = 0x2u, /**< Input port */
57     HW_PORT_OUT_IN = 0x3u, /**< Input/output port, supporting both audio input and output */
58 };
59 
60 /**
61  * @brief Defines the audio port.
62  */
63 struct AudioHwiPort {
64     enum AudioHwiPortDirection dir; /**< Audio port type. For details, see {@link AudioHwiPortDirection} */
65     uint32_t portId;             /**< Audio port ID */
66     const char *portName;        /**< Audio port name */
67 };
68 
69 /**
70  * @brief Defines the audio adapter descriptor.
71  *
72  * An audio adapter is a set of port drivers for a sound card, including the output and input ports.
73  * One port corresponds to multiple pins, and each pin belongs to a physical component (such as a
74  * speaker or a wired headset).
75  */
76 struct AudioAdapterHwiDescriptor {
77     const char *adapterName; /**< Name of the audio adapter */
78     uint32_t portNum;        /**< Number of ports supported by an audio adapter */
79     struct AudioHwiPort *ports; /**< List of ports supported by an audio adapter */
80 };
81 
82 /**
83  * @brief Enumerates the pin of an audio adapter.
84  */
85 enum AudioHwiPortPin {
86     HW_PIN_NONE                     = 0x0u,       /**< Invalid pin */
87     HW_PIN_OUT_SPEAKER              = 0x1u,       /**< Speaker output pin */
88     HW_PIN_OUT_HEADSET              = 0x2u,       /**< Wired headset pin for output */
89     HW_PIN_OUT_LINEOUT              = 0x4u,       /**< Line-out pin */
90     HW_PIN_OUT_HDMI                 = 0x8u,       /**< HDMI output pin */
91     HW_PIN_OUT_USB                  = 0x10u,      /**< USB output pin */
92     HW_PIN_OUT_USB_EXT              = 0x20u,      /**< Extended USB output pin*/
93     HW_PIN_OUT_EARPIECE             = 0x30u,      /**< Earpiece output pin */
94     HW_PIN_OUT_BLUETOOTH_SCO        = 0x40u,      /**< Bluetooth SCO output pin */
95     HW_PIN_OUT_DAUDIO_DEFAULT       = 0x80u,
96     HW_PIN_OUT_HEADPHONE            = 0x100u,     /**< Wired headphone output pin*/
97     HW_PIN_IN_MIC                   = 0x8000001u, /**< Microphone input pin */
98     HW_PIN_IN_HS_MIC                = 0x8000002u, /**< Wired headset microphone pin for input */
99     HW_PIN_IN_LINEIN                = 0x8000004u, /**< Line-in pin */
100     HW_PIN_IN_USB_EXT               = 0x8000008u, /**< Extended USB input pin*/
101     HW_PIN_IN_BLUETOOTH_SCO_HEADSET = 0x8000010u, /**< Bluetooth SCO headset input pin */
102 };
103 
104 /**
105  * @brief Defines the audio device descriptor.
106  */
107 struct AudioHwiDeviceDescriptor {
108     uint32_t portId;        /**< Audio port ID */
109     enum AudioHwiPortPin pins; /**< Pins of audio ports (input and output). For details, see {@link AudioHwiPortPin}. */
110     const char *desc;       /**< Audio device name */
111 };
112 
113 /**
114  * @brief Enumerates the audio category.
115  */
116 enum AudioHwiCategory {
117     HW_AUDIO_IN_MEDIA = 0,     /**< Media */
118     HW_AUDIO_IN_COMMUNICATION, /**< Communications */
119     HW_AUDIO_IN_RINGTONE,      /**< Ringtone */
120     HW_AUDIO_IN_CALL,          /**< Call */
121     HW_AUDIO_MMAP_NOIRQ,       /**< Mmap mode */
122 };
123 
124 /**
125  * @brief Defines the audio scene descriptor.
126  */
127 struct AudioHwiSceneDescriptor {
128     /**
129      * @brief Describes the audio scene.
130      */
131     union SceneDescHwi {
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 AudioHwiDeviceDescriptor desc; /**< Audio device descriptor */
136 };
137 
138 /**
139  * @brief Enumerates the audio format.
140  */
141 enum AudioHwiFormat {
142     AUDIO_HW_FORMAT_TYPE_PCM_8_BIT  = 0x1u,       /**< 8-bit PCM */
143     AUDIO_HW_FORMAT_TYPE_PCM_16_BIT = 0x2u,       /**< 16-bit PCM */
144     AUDIO_HW_FORMAT_TYPE_PCM_24_BIT = 0x3u,       /**< 24-bit PCM */
145     AUDIO_HW_FORMAT_TYPE_PCM_32_BIT = 0x4u,       /**< 32-bit PCM */
146     AUDIO_HW_FORMAT_TYPE_AAC_MAIN   = 0x1000001u, /**< AAC main */
147     AUDIO_HW_FORMAT_TYPE_AAC_LC     = 0x1000002u, /**< AAC LC */
148     AUDIO_HW_FORMAT_TYPE_AAC_LD     = 0x1000003u, /**< AAC LD */
149     AUDIO_HW_FORMAT_TYPE_AAC_ELD    = 0x1000004u, /**< AAC ELD */
150     AUDIO_HW_FORMAT_TYPE_AAC_HE_V1  = 0x1000005u, /**< AAC HE_V1 */
151     AUDIO_HW_FORMAT_TYPE_AAC_HE_V2  = 0x1000006u, /**< AAC HE_V2 */
152     AUDIO_HW_FORMAT_TYPE_G711A      = 0x2000001u, /**< G711A */
153     AUDIO_HW_FORMAT_TYPE_G711U      = 0x2000002u, /**< G711u */
154     AUDIO_HW_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 AudioHwiChannelMask {
163     AUDIO_HW_CHANNEL_MONO           = 1u,      /**< Mono channel */
164     AUDIO_HW_CHANNEL_FRONT_LEFT     = 1u,      /**< Front left channel */
165     AUDIO_HW_CHANNEL_FRONT_RIGHT    = 2u,      /**< Front right channel */
166     AUDIO_HW_CHANNEL_FRONT_CENTER   = 4u,      /**< Front right channel */
167     AUDIO_HW_CHANNEL_LOW_FREQUENCY  = 8u,      /**< 0x8 */
168     AUDIO_HW_CHANNEL_BACK_LEFT      = 16u,     /**< 0x10 */
169     AUDIO_HW_CHANNEL_BACK_RIGHT     = 32u,     /**< 0x20 */
170     AUDIO_HW_CHANNEL_BACK_CENTER    = 256u,    /**< 0x100 */
171     AUDIO_HW_CHANNEL_SIDE_LEFT      = 512u,    /**< 0x200 */
172     AUDIO_HW_CHANNEL_SIDE_RIGHT     = 1024u,   /**< 0x400 */
173     AUDIO_HW_CHANNEL_TOP_SIDE_LEFT  = 262144u, /**< 0x40000 */
174     AUDIO_HW_CHANNEL_TOP_SIDE_RIGHT = 524288u, /**< 0x80000 */
175     AUDIO_HW_CHANNEL_STEREO         = 3u,      /**< FRONT_LEFT | FRONT_RIGHT */
176     AUDIO_HW_CHANNEL_2POINT1        = 11u,     /**< STEREO | LOW_FREQUENCY */
177     AUDIO_HW_CHANNEL_QUAD           = 51u,     /**< STEREO | BACK_LEFT | BACK_RIGHT */
178     AUDIO_HW_CHANNEL_3POINT0POINT2  = 786439u, /**< STEREO | FRONT_CENTER | TOP_SIDE_LEFT | TOP_SIDE_RIGHT */
179     AUDIO_HW_CHANNEL_5POINT1        = 63u,     /**< QUAD | FRONT_CENTER | LOW_FREQUENCY */
180     AUDIO_HW_CHANNEL_6POINT1        = 319u,    /**< AUDIO_CHANNEL_5POINT1 | BACK_CENTER */
181     AUDIO_HW_CHANNEL_7POINT1        = 1599u,   /**< AUDIO_CHANNEL_5POINT1 | SIDE_LEFT | SIDE_RIGHT */
182 };
183 
184 /**
185  * @brief Enumerates masks of audio sampling rates.
186  */
187 enum AudioHwiSampleRatesMask {
188     AUDIO_HW_SAMPLE_RATE_MASK_8000    = 0x1u,        /**< 8 kHz */
189     AUDIO_HW_SAMPLE_RATE_MASK_12000   = 0x2u,        /**< 12 kHz */
190     AUDIO_HW_SAMPLE_RATE_MASK_11025   = 0x4u,        /**< 11.025 kHz */
191     AUDIO_HW_SAMPLE_RATE_MASK_16000   = 0x8u,        /**< 16 kHz */
192     AUDIO_HW_SAMPLE_RATE_MASK_22050   = 0x10u,       /**< 22.050 kHz */
193     AUDIO_HW_SAMPLE_RATE_MASK_24000   = 0x20u,       /**< 24 kHz */
194     AUDIO_HW_SAMPLE_RATE_MASK_32000   = 0x40u,       /**< 32 kHz */
195     AUDIO_HW_SAMPLE_RATE_MASK_44100   = 0x80u,       /**< 44.1 kHz */
196     AUDIO_HW_SAMPLE_RATE_MASK_48000   = 0x100u,      /**< 48 kHz */
197     AUDIO_HW_SAMPLE_RATE_MASK_64000   = 0x200u,      /**< 64 kHz */
198     AUDIO_HW_SAMPLE_RATE_MASK_96000   = 0x400u,      /**< 96 kHz */
199     AUDIO_HW_SAMPLE_RATE_MASK_INVALID = 0xFFFFFFFFu, /**< Invalid sampling rate */
200 };
201 
202 enum AudioHwiInputType {
203     AUDIO_HW_INPUT_DEFAULT_TYPE             = 0,
204     AUDIO_HW_INPUT_MIC_TYPE                 = 1 << 0,
205     AUDIO_HW_INPUT_SPEECH_WAKEUP_TYPE       = 1 << 1,
206     AUDIO_HW_INPUT_VOICE_COMMUNICATION_TYPE = 1 << 2,
207     AUDIO_HW_INPUT_VOICE_RECOGNITION_TYPE   = 1 << 3,
208 };
209 /**
210  * @brief Defines audio sampling attributes.
211  */
212 struct AudioHwiSampleAttributes {
213     enum AudioHwiCategory type;   /**< Audio type. For details, see {@link AudioHwiCategory} */
214     bool interleaved;          /**< Interleaving flag of audio data */
215     enum AudioHwiFormat format;   /**< Audio data format. For details, see {@link AudioHwiFormat}. */
216     uint32_t sampleRate;       /**< Audio sampling rate */
217     uint32_t channelCount;     /**< Number of audio channels. For example, for the mono channel, the value is 1,
218                                 * and for the stereo channel, the value is 2.
219                                 */
220     uint32_t period;           /**< Audio sampling period */
221     uint32_t frameSize;        /**< Frame size of the audio data */
222     bool isBigEndian;          /**< Big endian flag of audio data */
223     bool isSignedData;         /**< Signed or unsigned flag of audio data */
224     uint32_t startThreshold;   /**< Audio render start threshold. */
225     uint32_t stopThreshold;    /**< Audio render stop threshold. */
226     uint32_t silenceThreshold; /**< Audio capture buffer threshold. */
227     int32_t streamId;          /**< Audio Identifier of render or capture */
228     int32_t sourceType;
229 };
230 
231 /**
232  * @brief Defines the audio timestamp, which is a substitute for POSIX <b>timespec</b>.
233  */
234 struct AudioHwiTimeStamp {
235     int64_t tvSec;  /**< Seconds */
236     int64_t tvNSec; /**< Nanoseconds */
237 };
238 
239 /**
240  * @brief Enumerates the passthrough data transmission mode of an audio port.
241  */
242 enum AudioHwiPortPassthroughMode {
243     HW_PORT_PASSTHROUGH_LPCM    = 0x1, /**< Stereo PCM */
244     HW_PORT_PASSTHROUGH_RAW     = 0x2, /**< HDMI passthrough */
245     HW_PORT_PASSTHROUGH_HBR2LBR = 0x4, /**< Blu-ray next-generation audio output with reduced specifications */
246     HW_PORT_PASSTHROUGH_AUTO    = 0x8, /**< Mode automatically matched based on the HDMI EDID */
247 };
248 
249 /**
250  * @brief Defines the sub-port capability.
251  */
252 struct AudioHwiSubPortCapability {
253     uint32_t portId;                    /**< Sub-port ID */
254     const char *desc;                   /**< Sub-port name */
255     enum AudioHwiPortPassthroughMode mask; /**< Passthrough mode of data transmission. For details,
256                                          * see {@link AudioHwiPortPassthroughMode}.
257                                          */
258 };
259 
260 /**
261  * @brief Defines formats of raw audio samples.
262  */
263 enum AudioHwiSampleFormat {
264     /* 8 bits */
265     AUDIO_HW_SAMPLE_FORMAT_S8,   /**< signed 8 bit sample */
266     AUDIO_HW_SAMPLE_FORMAT_S8P,  /**< signed 8 bit planar sample */
267     AUDIO_HW_SAMPLE_FORMAT_U8,   /**< unsigned 8 bit sample */
268     AUDIO_HW_SAMPLE_FORMAT_U8P,  /**< unsigned 8 bit planar sample */
269     /* 16 bits */
270     AUDIO_HW_SAMPLE_FORMAT_S16,  /**< signed 16 bit sample */
271     AUDIO_HW_SAMPLE_FORMAT_S16P, /**< signed 16 bit planar sample */
272     AUDIO_HW_SAMPLE_FORMAT_U16,  /**< unsigned 16 bit sample */
273     AUDIO_HW_SAMPLE_FORMAT_U16P, /**< unsigned 16 bit planar sample */
274     /* 24 bits */
275     AUDIO_HW_SAMPLE_FORMAT_S24,  /**< signed 24 bit sample */
276     AUDIO_HW_SAMPLE_FORMAT_S24P, /**< signed 24 bit planar sample */
277     AUDIO_HW_SAMPLE_FORMAT_U24,  /**< unsigned 24 bit sample */
278     AUDIO_HW_SAMPLE_FORMAT_U24P, /**< unsigned 24 bit planar sample */
279     /* 32 bits */
280     AUDIO_HW_SAMPLE_FORMAT_S32,  /**< signed 32 bit sample */
281     AUDIO_HW_SAMPLE_FORMAT_S32P, /**< signed 32 bit planar sample */
282     AUDIO_HW_SAMPLE_FORMAT_U32,  /**< unsigned 32 bit sample */
283     AUDIO_HW_SAMPLE_FORMAT_U32P, /**< unsigned 32 bit planar sample */
284     /* 64 bits */
285     AUDIO_HW_SAMPLE_FORMAT_S64,  /**< signed 64 bit sample */
286     AUDIO_HW_SAMPLE_FORMAT_S64P, /**< signed 64 bit planar sample */
287     AUDIO_HW_SAMPLE_FORMAT_U64,  /**< unsigned 64 bit sample */
288     AUDIO_HW_SAMPLE_FORMAT_U64P, /**< unsigned 64 bit planar sample */
289     /* float double */
290     AUDIO_HW_SAMPLE_FORMAT_F32,  /**< float 32 bit sample */
291     AUDIO_HW_SAMPLE_FORMAT_F32P, /**< float 32 bit planar sample */
292     AUDIO_HW_SAMPLE_FORMAT_F64,  /**< double 64 bit sample */
293     AUDIO_HW_SAMPLE_FORMAT_F64P, /**< double 64 bit planar sample */
294 };
295 
296 /**
297  * @brief Defines the audio port capability.
298  */
299 struct AudioHwiPortCapability {
300     uint32_t deviceType;                     /**< Device type (output or input) */
301     uint32_t deviceId;                       /**< Device ID used for device binding */
302     bool hardwareMode;                       /**< Whether to support device binding */
303     uint32_t formatNum;                      /**< Number of the supported audio formats */
304     enum AudioHwiFormat *formats;            /**< Supported audio formats. For details, see {@link AudioHwiFormat}. */
305     uint32_t sampleRateMasks;                /**< Supported audio sampling rates (8 kHz, 16 kHz, 32 kHz, and 48 kHz) */
306     enum AudioHwiChannelMask channelMasks;   /**< Audio channel layout mask of the device. For details,
307                                               * see {@link AudioHwiChannelMask}.
308                                               */
309     uint32_t channelCount;                   /**< Supported maximum number of audio channels */
310     uint32_t subPortsNum;                    /**< Number of supported sub-ports (for output devices only) */
311     struct AudioHwiSubPortCapability *subPorts; /**< List of supported sub-ports */
312     uint32_t supportSampleFormatNum;         /**< Number of the supported audio sample format enum. */
313     enum AudioHwiSampleFormat *supportSampleFormats; /**< Supported audio sample formats. For details,
314                                                    * see {@link AudioHwiSampleFormat}.
315                                                    */
316 };
317 
318 /**
319  * @brief Enumerates channel modes for audio rendering.
320  *
321  * @attention The following modes are set for rendering dual-channel audios. Others are not supported.
322  */
323 enum AudioHwiChannelMode {
324     AUDIO_HW_CHANNEL_NORMAL = 0, /**< Normal mode. No processing is required. */
325     AUDIO_HW_CHANNEL_BOTH_LEFT,  /**< Two left channels */
326     AUDIO_HW_CHANNEL_BOTH_RIGHT, /**< Two right channels */
327     AUDIO_HW_CHANNEL_EXCHANGE, /**< Data exchange between the left and right channels. The left channel takes the audio
328                                * stream of the right channel, and the right channel takes that of the left channel.
329                                */
330     AUDIO_HW_CHANNEL_MIX,        /**< Mix of streams of the left and right channels */
331     AUDIO_HW_CHANNEL_LEFT_MUTE,  /**< Left channel muted. The stream of the right channel is output. */
332     AUDIO_HW_CHANNEL_RIGHT_MUTE, /**< Right channel muted. The stream of the left channel is output. */
333     AUDIO_HW_CHANNEL_BOTH_MUTE,  /**< Both left and right channels muted */
334 };
335 
336 /**
337  * @brief Enumerates the execution types of the <b>DrainBuffer</b> function.
338  */
339 enum AudioHwiDrainNotifyType {
340     AUDIO_HW_DRAIN_NORMAL_MODE, /**< The <b>DrainBuffer</b> function returns after all data finishes playback. */
341     AUDIO_HW_DRAIN_EARLY_MODE,  /**< The <b>DrainBuffer</b> function returns before all the data of the current track
342                               * finishes playback to reserve time for a smooth track switch by the audio service.
343                               */
344 };
345 
346 /**
347  * @brief Enumerates callback notification events.
348  */
349 enum AudioHwiCallbackType {
350     AUDIO_HW_NONBLOCK_WRITE_COMPLETED, /**< The non-block write is complete. */
351     AUDIO_HW_DRAIN_COMPLETED,          /**< The draining is complete. */
352     AUDIO_HW_FLUSH_COMPLETED,           /**< The flush is complete. */
353     AUDIO_HW_RENDER_FULL,               /**< The render buffer is full.*/
354     AUDIO_HW_ERROR_OCCUR,               /**< An error occurs.*/
355 };
356 
357 /**
358  * @brief Describes a mmap buffer.
359  */
360 struct AudioHwiMmapBufferDescriptor {
361     void *memoryAddress;                 /**< Pointer to the mmap buffer */
362     int32_t memoryFd;                    /**< File descriptor of the mmap buffer */
363     int32_t totalBufferFrames;           /**< Total size of the mmap buffer (unit: frame )*/
364     int32_t transferFrameSize;           /**< Transfer size (unit: frame) */
365     int32_t isShareable;                 /**< Whether the mmap buffer can be shared among processes */
366     uint32_t offset;
367 };
368 
369 /**
370  * @brief Describes AudioHwiPortRole.
371  */
372 enum AudioHwiPortRole {
373     AUDIO_HW_PORT_UNASSIGNED_ROLE = 0, /**< Unassigned port role */
374     AUDIO_HW_PORT_SOURCE_ROLE = 1,     /**< Assigned source role */
375     AUDIO_HW_PORT_SINK_ROLE = 2,       /**< Assigned sink role */
376 };
377 
378 /**
379  * @brief Describes AudioHwiPortType.
380  */
381 enum AudioHwiPortType {
382     AUDIO_HW_PORT_UNASSIGNED_TYPE = 0, /**< Unassigned port type */
383     AUDIO_HW_PORT_DEVICE_TYPE = 1,     /**< Assigned device type */
384     AUDIO_HW_PORT_MIX_TYPE = 2,        /**< Assigned mix type */
385     AUDIO_HW_PORT_SESSION_TYPE = 3,    /**< Assigned session type */
386 };
387 
388 /**
389  * @brief Describes AudioHwiDevExtInfo.
390  */
391 struct AudioHwiDevExtInfo {
392     int32_t moduleId;       /**< Identifier of the module stream is attached to */
393     enum AudioHwiPortPin type; /**< Device type For details, see {@link AudioHwiPortPin}. */
394     const char *desc;       /**< Address  */
395 };
396 
397 /**
398  * @brief Describes AudioMixInfo.
399  */
400 struct AudioHwiMixExtInfo {
401     int32_t moduleId;     /**< Identifier of the module stream is attached to */
402     int32_t streamId;     /**< Identifier of the capture or render passed by caller */
403 };
404 
405 /**
406  * @brief Describes AudioHwiSessionType.
407  */
408 enum AudioHwiSessionType {
409     AUDIO_HW_OUTPUT_STAGE_SESSION = 0,
410     AUDIO_HW_OUTPUT_MIX_SESSION,
411     AUDIO_HW_ALLOCATE_SESSION,
412     AUDIO_HW_INVALID_SESSION,
413 };
414 
415 /**
416  * @brief Describes AudioHwiSessionExtInfo.
417  */
418 struct AudioHwiSessionExtInfo {
419     enum AudioHwiSessionType sessionType;
420 };
421 
422 /**
423  * @brief Describes AudioHwiRouteNode.
424  */
425 struct AudioHwiRouteNode {
426     int32_t portId;                      /**< Audio port ID */
427     enum AudioHwiPortRole role;             /**< Audio port as a sink or a source */
428     enum AudioHwiPortType type;             /**< device, mix ... */
429     union {
430         struct AudioHwiDevExtInfo device;   /* Specific Device Ext info */
431         struct AudioHwiMixExtInfo mix;      /* Specific mix info */
432         struct AudioHwiSessionExtInfo session; /* session specific info */
433     } ext;
434 };
435 
436 /**
437  * @brief Describes AudioHwiRoute.
438  */
439 struct AudioHwiRoute {
440     uint32_t sourcesNum;
441     struct AudioHwiRouteNode *sources;
442     uint32_t sinksNum;
443     struct AudioHwiRouteNode *sinks;
444 };
445 
446 /**
447  * @brief Enumerates the restricted key type of the parameters
448  */
449 enum AudioHwiExtParamKey {
450     AUDIO_HW_EXT_PARAM_KEY_NONE = 0,     /**< Distributed audio extra param key none */
451     AUDIO_HW_EXT_PARAM_KEY_VOLUME = 1,   /**< Distributed audio extra param key volume event */
452     AUDIO_HW_EXT_PARAM_KEY_FOCUS = 2,    /**< Distributed audio extra param key focus event */
453     AUDIO_HW_EXT_PARAM_KEY_BUTTON = 3,   /**< Distributed audio extra param key media button event */
454     AUDIO_HW_EXT_PARAM_KEY_EFFECT = 4,   /**< Distributed audio extra param key audio effect event */
455     AUDIO_HW_EXT_PARAM_KEY_STATUS = 5,   /**< Distributed audio extra param key device status event */
456     AUDIO_HW_EXT_PARAM_KEY_LOWPOWER = 1000, /**< Low power event type */
457 };
458 /**
459  * @brief Describes status of audio deivce.@link enum AudioHwiDeviceType
460  */
461 struct AudioHwiDeviceStatus {
462     uint32_t pnpStatus;
463 };
464 /**
465  * @brief Called when an event defined in {@link AudioHwiCallbackType} occurs.
466  *
467  * @param AudioHwiCallbackType 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 (*RenderHwiCallback)(enum AudioHwiCallbackType, 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 (*ParamHwiCallback)(enum AudioHwiExtParamKey key, const char *condition,
486     const char *value, void *reserved, void *cookie);
487 
488 #endif /* I_AUDIO_TYPES_H */