1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 // This header contains definitions of enums that are passed through
18 // the system <-> vendor (also known as framework <-> HAL) boundary.
19 // On the HAL side they are defined in the Audio Policy config schema:
20 // h/i/audio/x.x/config/audio_policy_configuration.xsd
21 //
22 // These enums are passed between the framework and the HAL as
23 // strings. Because of that, functions for to/from string conversion
24 // are also defined here. The enums are defined in a way that
25 // allows having only one list of values which is then used to
26 // generate both enum definitions and to/from string converters.
27 // As this header needs to be compatible with C, preprocessor
28 // macros are used for templating.
29 //
30 // Some enums have framework-only extensions. They are disabled
31 // for vendor code by means of AUDIO_NO_SYSTEM_DECLARATIONS define.
32 // Framework-only enum values can not be received from HAL, thus
33 // string -> enum conversion is not generated for them. However,
34 // since enum -> string conversion is also useful for debugging
35 // purposes, the corresponding cases are handled in conversion
36 // functions.
37 //
38 // There is no automatic update of enum symbols list from the
39 // audio HAL schema, or vice versa. Any new enum value used at
40 // the system <-> vendor boundary must be added to both locations.
41 //
42 // No special functions are provided for dealing with enums that
43 // constitute flags, e.g. to convert a mask into a list of strings.
44 // String conversion functions only support individual flag values.
45 // The only exception is 'audio_channel_mask_from_string' function
46 // which only deals with masks, not with individual channels.
47 
48 #ifndef ANDROID_AUDIO_HAL_ENUMS_H
49 #define ANDROID_AUDIO_HAL_ENUMS_H
50 
51 #include <stdbool.h>
52 #include <stdint.h>
53 #include <string.h>
54 #include <sys/cdefs.h>
55 
56 __BEGIN_DECLS
57 
58 #define AUDIO_ENUM_QUOTE(x) #x
59 #define AUDIO_ENUM_STRINGIFY(x) AUDIO_ENUM_QUOTE(x)
60 // Simple enums are the ones relying on default values.
61 // Enums that specify values need to use '_V' versions of macros.
62 #define AUDIO_DEFINE_ENUM_SYMBOL(symbol) symbol,
63 #define AUDIO_DEFINE_ENUM_SYMBOL_V(symbol, value) symbol = value,
64 #define AUDIO_DEFINE_BIT_MASK(symbol) symbol |
65 #define AUDIO_DEFINE_BIT_MASK_V(symbol, _) AUDIO_DEFINE_BIT_MASK(symbol)
66 #define AUDIO_DEFINE_STRINGIFY_CASE(symbol) case symbol: return AUDIO_ENUM_STRINGIFY(symbol);
67 #define AUDIO_DEFINE_STRINGIFY_CASE_V(symbol, _) AUDIO_DEFINE_STRINGIFY_CASE(symbol)
68 #define AUDIO_DEFINE_PARSE_CASE(symbol) \
69     if (strcmp(s, AUDIO_ENUM_STRINGIFY(symbol)) == 0) { *t = symbol; return true; } else
70 #define AUDIO_DEFINE_PARSE_CASE_V(symbol, _) AUDIO_DEFINE_PARSE_CASE(symbol)
71 
72 
73 // These are individual output channel flags, only one bit must be set.
74 #define AUDIO_CHANNEL_OUT_DISCRETE_CHANNEL_LIST_DEF(V) \
75     V(AUDIO_CHANNEL_OUT_FRONT_LEFT, 0x1u) \
76     V(AUDIO_CHANNEL_OUT_FRONT_RIGHT, 0x2u) \
77     V(AUDIO_CHANNEL_OUT_FRONT_CENTER, 0x4u) \
78     V(AUDIO_CHANNEL_OUT_LOW_FREQUENCY, 0x8u) \
79     V(AUDIO_CHANNEL_OUT_BACK_LEFT, 0x10u) \
80     V(AUDIO_CHANNEL_OUT_BACK_RIGHT, 0x20u) \
81     V(AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER, 0x40u) \
82     V(AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER, 0x80u) \
83     V(AUDIO_CHANNEL_OUT_BACK_CENTER, 0x100u) \
84     V(AUDIO_CHANNEL_OUT_SIDE_LEFT, 0x200u) \
85     V(AUDIO_CHANNEL_OUT_SIDE_RIGHT, 0x400u) \
86     V(AUDIO_CHANNEL_OUT_TOP_CENTER, 0x800u) \
87     V(AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT, 0x1000u) \
88     V(AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER, 0x2000u) \
89     V(AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT, 0x4000u) \
90     V(AUDIO_CHANNEL_OUT_TOP_BACK_LEFT, 0x8000u) \
91     V(AUDIO_CHANNEL_OUT_TOP_BACK_CENTER, 0x10000u) \
92     V(AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT, 0x20000u) \
93     V(AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT, 0x40000u) \
94     V(AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT, 0x80000u) \
95     V(AUDIO_CHANNEL_OUT_BOTTOM_FRONT_LEFT, 0x100000u) \
96     V(AUDIO_CHANNEL_OUT_BOTTOM_FRONT_CENTER, 0x200000u) \
97     V(AUDIO_CHANNEL_OUT_BOTTOM_FRONT_RIGHT, 0x400000u) \
98     V(AUDIO_CHANNEL_OUT_LOW_FREQUENCY_2, 0x800000u) \
99     V(AUDIO_CHANNEL_OUT_HAPTIC_A, 0x20000000u) \
100     V(AUDIO_CHANNEL_OUT_HAPTIC_B, 0x10000000u)
101 // These are individual input channel flags, only one bit must be set.
102 #define AUDIO_CHANNEL_IN_DISCRETE_CHANNEL_LIST_DEF(V) \
103     V(AUDIO_CHANNEL_IN_LEFT, 0x4u) \
104     V(AUDIO_CHANNEL_IN_RIGHT, 0x8u) \
105     V(AUDIO_CHANNEL_IN_FRONT, 0x10u) \
106     V(AUDIO_CHANNEL_IN_BACK, 0x20u) \
107     V(AUDIO_CHANNEL_IN_LEFT_PROCESSED, 0x40u) \
108     V(AUDIO_CHANNEL_IN_RIGHT_PROCESSED, 0x80u) \
109     V(AUDIO_CHANNEL_IN_FRONT_PROCESSED, 0x100u) \
110     V(AUDIO_CHANNEL_IN_BACK_PROCESSED, 0x200u) \
111     V(AUDIO_CHANNEL_IN_PRESSURE, 0x400u) \
112     V(AUDIO_CHANNEL_IN_X_AXIS, 0x800u) \
113     V(AUDIO_CHANNEL_IN_Y_AXIS, 0x1000u) \
114     V(AUDIO_CHANNEL_IN_Z_AXIS, 0x2000u) \
115     V(AUDIO_CHANNEL_IN_VOICE_UPLINK, 0x4000u) \
116     V(AUDIO_CHANNEL_IN_VOICE_DNLINK, 0x8000u) \
117     V(AUDIO_CHANNEL_IN_BACK_LEFT, 0x10000u) \
118     V(AUDIO_CHANNEL_IN_BACK_RIGHT, 0x20000u) \
119     V(AUDIO_CHANNEL_IN_CENTER, 0x40000u) \
120     V(AUDIO_CHANNEL_IN_LOW_FREQUENCY, 0x100000u) \
121     V(AUDIO_CHANNEL_IN_TOP_LEFT, 0x200000u) \
122     V(AUDIO_CHANNEL_IN_TOP_RIGHT, 0x400000u)
123 #define AUDIO_CHANNEL_IN_OUT_MASK_LIST_DEF(V) \
124     V(AUDIO_CHANNEL_NONE, 0x0u)
125 // Input and output masks are defined via individual channels.
126 #define AUDIO_CHANNEL_OUT_MASK_LIST_UNIQUE_DEF(V) \
127     V(AUDIO_CHANNEL_OUT_MONO, AUDIO_CHANNEL_OUT_FRONT_LEFT) \
128     V(AUDIO_CHANNEL_OUT_STEREO, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT) \
129     V(AUDIO_CHANNEL_OUT_2POINT1, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_LOW_FREQUENCY) \
130     V(AUDIO_CHANNEL_OUT_TRI, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER) \
131     V(AUDIO_CHANNEL_OUT_TRI_BACK, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_BACK_CENTER) \
132     V(AUDIO_CHANNEL_OUT_3POINT1, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_LOW_FREQUENCY) \
133     V(AUDIO_CHANNEL_OUT_2POINT0POINT2, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT | AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT) \
134     V(AUDIO_CHANNEL_OUT_2POINT1POINT2, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT | AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT | AUDIO_CHANNEL_OUT_LOW_FREQUENCY) \
135     V(AUDIO_CHANNEL_OUT_3POINT0POINT2, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT | AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT) \
136     V(AUDIO_CHANNEL_OUT_3POINT1POINT2, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT | AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT | AUDIO_CHANNEL_OUT_LOW_FREQUENCY) \
137     V(AUDIO_CHANNEL_OUT_QUAD, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT) \
138     V(AUDIO_CHANNEL_OUT_QUAD_SIDE, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_SIDE_LEFT | AUDIO_CHANNEL_OUT_SIDE_RIGHT) \
139     V(AUDIO_CHANNEL_OUT_SURROUND, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_BACK_CENTER) \
140     V(AUDIO_CHANNEL_OUT_PENTA, AUDIO_CHANNEL_OUT_QUAD | AUDIO_CHANNEL_OUT_FRONT_CENTER) \
141     V(AUDIO_CHANNEL_OUT_5POINT1, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_LOW_FREQUENCY | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT) \
142     V(AUDIO_CHANNEL_OUT_5POINT1_SIDE, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_LOW_FREQUENCY | AUDIO_CHANNEL_OUT_SIDE_LEFT | AUDIO_CHANNEL_OUT_SIDE_RIGHT) \
143     V(AUDIO_CHANNEL_OUT_5POINT1POINT2, AUDIO_CHANNEL_OUT_5POINT1 | AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT | AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT) \
144     V(AUDIO_CHANNEL_OUT_5POINT1POINT4, AUDIO_CHANNEL_OUT_5POINT1 | AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT | AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT | AUDIO_CHANNEL_OUT_TOP_BACK_LEFT | AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT) \
145     V(AUDIO_CHANNEL_OUT_6POINT1, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_LOW_FREQUENCY | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT | AUDIO_CHANNEL_OUT_BACK_CENTER) \
146     V(AUDIO_CHANNEL_OUT_7POINT1, AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_LOW_FREQUENCY | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT | AUDIO_CHANNEL_OUT_SIDE_LEFT | AUDIO_CHANNEL_OUT_SIDE_RIGHT) \
147     V(AUDIO_CHANNEL_OUT_7POINT1POINT2, AUDIO_CHANNEL_OUT_7POINT1 | AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT | AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT) \
148     V(AUDIO_CHANNEL_OUT_7POINT1POINT4, AUDIO_CHANNEL_OUT_7POINT1 | AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT | AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT | AUDIO_CHANNEL_OUT_TOP_BACK_LEFT | AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT) \
149     V(AUDIO_CHANNEL_OUT_13POINT_360RA, \
150             AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | \
151             AUDIO_CHANNEL_OUT_FRONT_CENTER | \
152             AUDIO_CHANNEL_OUT_SIDE_LEFT | AUDIO_CHANNEL_OUT_SIDE_RIGHT | \
153             AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT | AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT | \
154             AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER | \
155             AUDIO_CHANNEL_OUT_TOP_BACK_LEFT | AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT | \
156             AUDIO_CHANNEL_OUT_BOTTOM_FRONT_LEFT | AUDIO_CHANNEL_OUT_BOTTOM_FRONT_RIGHT | \
157             AUDIO_CHANNEL_OUT_BOTTOM_FRONT_CENTER) \
158     V(AUDIO_CHANNEL_OUT_22POINT2, AUDIO_CHANNEL_OUT_7POINT1POINT4 | \
159             AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER | AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER | \
160             AUDIO_CHANNEL_OUT_BACK_CENTER | AUDIO_CHANNEL_OUT_TOP_CENTER | \
161             AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER | AUDIO_CHANNEL_OUT_TOP_BACK_CENTER | \
162             AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT | AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT | \
163             AUDIO_CHANNEL_OUT_BOTTOM_FRONT_LEFT | AUDIO_CHANNEL_OUT_BOTTOM_FRONT_RIGHT | \
164             AUDIO_CHANNEL_OUT_BOTTOM_FRONT_CENTER | \
165             AUDIO_CHANNEL_OUT_LOW_FREQUENCY_2) \
166     V(AUDIO_CHANNEL_OUT_MONO_HAPTIC_A, AUDIO_CHANNEL_OUT_MONO | AUDIO_CHANNEL_OUT_HAPTIC_A) \
167     V(AUDIO_CHANNEL_OUT_STEREO_HAPTIC_A, AUDIO_CHANNEL_OUT_STEREO | AUDIO_CHANNEL_OUT_HAPTIC_A) \
168     V(AUDIO_CHANNEL_OUT_HAPTIC_AB, AUDIO_CHANNEL_OUT_HAPTIC_A | AUDIO_CHANNEL_OUT_HAPTIC_B) \
169     V(AUDIO_CHANNEL_OUT_MONO_HAPTIC_AB, AUDIO_CHANNEL_OUT_MONO | AUDIO_CHANNEL_OUT_HAPTIC_AB) \
170     V(AUDIO_CHANNEL_OUT_STEREO_HAPTIC_AB, AUDIO_CHANNEL_OUT_STEREO | AUDIO_CHANNEL_OUT_HAPTIC_AB)
171 // Some of the channel masks have aliases. They can not appear in the 'to string'
172 // converter as case values must be unique.
173 #define AUDIO_CHANNEL_OUT_MASK_LIST_DEF(V) \
174     AUDIO_CHANNEL_OUT_MASK_LIST_UNIQUE_DEF(V) \
175     V(AUDIO_CHANNEL_OUT_5POINT1_BACK, AUDIO_CHANNEL_OUT_5POINT1) \
176     V(AUDIO_CHANNEL_OUT_QUAD_BACK, AUDIO_CHANNEL_OUT_QUAD)
177 #define AUDIO_CHANNEL_IN_MASK_LIST_DEF(V) \
178     V(AUDIO_CHANNEL_IN_MONO, AUDIO_CHANNEL_IN_FRONT) \
179     V(AUDIO_CHANNEL_IN_STEREO, AUDIO_CHANNEL_IN_LEFT | AUDIO_CHANNEL_IN_RIGHT) \
180     V(AUDIO_CHANNEL_IN_FRONT_BACK, AUDIO_CHANNEL_IN_FRONT | AUDIO_CHANNEL_IN_BACK) \
181     V(AUDIO_CHANNEL_IN_6, AUDIO_CHANNEL_IN_LEFT | AUDIO_CHANNEL_IN_RIGHT | AUDIO_CHANNEL_IN_FRONT | AUDIO_CHANNEL_IN_BACK | AUDIO_CHANNEL_IN_LEFT_PROCESSED | AUDIO_CHANNEL_IN_RIGHT_PROCESSED) \
182     V(AUDIO_CHANNEL_IN_2POINT0POINT2, AUDIO_CHANNEL_IN_LEFT | AUDIO_CHANNEL_IN_RIGHT | AUDIO_CHANNEL_IN_TOP_LEFT | AUDIO_CHANNEL_IN_TOP_RIGHT) \
183     V(AUDIO_CHANNEL_IN_2POINT1POINT2, AUDIO_CHANNEL_IN_LEFT | AUDIO_CHANNEL_IN_RIGHT | AUDIO_CHANNEL_IN_TOP_LEFT | AUDIO_CHANNEL_IN_TOP_RIGHT | AUDIO_CHANNEL_IN_LOW_FREQUENCY) \
184     V(AUDIO_CHANNEL_IN_3POINT0POINT2, AUDIO_CHANNEL_IN_LEFT | AUDIO_CHANNEL_IN_CENTER | AUDIO_CHANNEL_IN_RIGHT | AUDIO_CHANNEL_IN_TOP_LEFT | AUDIO_CHANNEL_IN_TOP_RIGHT) \
185     V(AUDIO_CHANNEL_IN_3POINT1POINT2, AUDIO_CHANNEL_IN_LEFT | AUDIO_CHANNEL_IN_CENTER | AUDIO_CHANNEL_IN_RIGHT | AUDIO_CHANNEL_IN_TOP_LEFT | AUDIO_CHANNEL_IN_TOP_RIGHT | AUDIO_CHANNEL_IN_LOW_FREQUENCY) \
186     V(AUDIO_CHANNEL_IN_5POINT1, AUDIO_CHANNEL_IN_LEFT | AUDIO_CHANNEL_IN_CENTER | AUDIO_CHANNEL_IN_RIGHT | AUDIO_CHANNEL_IN_BACK_LEFT | AUDIO_CHANNEL_IN_BACK_RIGHT | AUDIO_CHANNEL_IN_LOW_FREQUENCY) \
187     V(AUDIO_CHANNEL_IN_VOICE_UPLINK_MONO, AUDIO_CHANNEL_IN_VOICE_UPLINK | AUDIO_CHANNEL_IN_MONO) \
188     V(AUDIO_CHANNEL_IN_VOICE_DNLINK_MONO, AUDIO_CHANNEL_IN_VOICE_DNLINK | AUDIO_CHANNEL_IN_MONO) \
189     V(AUDIO_CHANNEL_IN_VOICE_CALL_MONO, AUDIO_CHANNEL_IN_VOICE_UPLINK_MONO | AUDIO_CHANNEL_IN_VOICE_DNLINK_MONO)
190 
191 enum {
192     AUDIO_CHANNEL_COUNT_MAX = 30u,
193     // Can't use AUDIO_CHANNEL_REPRESENTATION_INDEX because audio.h depends on this header.
194     AUDIO_CHANNEL_INDEX_HDR = 0x80000000u, // AUDIO_CHANNEL_REPRESENTATION_INDEX << COUNT_MAX
195 };
196 
197 // Channel index representation definitions.
198 #define AUDIO_CHANNEL_INDEX_MASK_LIST_DEF(V) \
199     V(AUDIO_CHANNEL_INDEX_MASK_1, AUDIO_CHANNEL_INDEX_HDR | (1 << 1) - 1) \
200     V(AUDIO_CHANNEL_INDEX_MASK_2, AUDIO_CHANNEL_INDEX_HDR | (1 << 2) - 1) \
201     V(AUDIO_CHANNEL_INDEX_MASK_3, AUDIO_CHANNEL_INDEX_HDR | (1 << 3) - 1) \
202     V(AUDIO_CHANNEL_INDEX_MASK_4, AUDIO_CHANNEL_INDEX_HDR | (1 << 4) - 1) \
203     V(AUDIO_CHANNEL_INDEX_MASK_5, AUDIO_CHANNEL_INDEX_HDR | (1 << 5) - 1) \
204     V(AUDIO_CHANNEL_INDEX_MASK_6, AUDIO_CHANNEL_INDEX_HDR | (1 << 6) - 1) \
205     V(AUDIO_CHANNEL_INDEX_MASK_7, AUDIO_CHANNEL_INDEX_HDR | (1 << 7) - 1) \
206     V(AUDIO_CHANNEL_INDEX_MASK_8, AUDIO_CHANNEL_INDEX_HDR | (1 << 8) - 1) \
207     V(AUDIO_CHANNEL_INDEX_MASK_9, AUDIO_CHANNEL_INDEX_HDR | (1 << 9) - 1) \
208     V(AUDIO_CHANNEL_INDEX_MASK_10, AUDIO_CHANNEL_INDEX_HDR | (1 << 10) - 1) \
209     V(AUDIO_CHANNEL_INDEX_MASK_11, AUDIO_CHANNEL_INDEX_HDR | (1 << 11) - 1) \
210     V(AUDIO_CHANNEL_INDEX_MASK_12, AUDIO_CHANNEL_INDEX_HDR | (1 << 12) - 1) \
211     V(AUDIO_CHANNEL_INDEX_MASK_13, AUDIO_CHANNEL_INDEX_HDR | (1 << 13) - 1) \
212     V(AUDIO_CHANNEL_INDEX_MASK_14, AUDIO_CHANNEL_INDEX_HDR | (1 << 14) - 1) \
213     V(AUDIO_CHANNEL_INDEX_MASK_15, AUDIO_CHANNEL_INDEX_HDR | (1 << 15) - 1) \
214     V(AUDIO_CHANNEL_INDEX_MASK_16, AUDIO_CHANNEL_INDEX_HDR | (1 << 16) - 1) \
215     V(AUDIO_CHANNEL_INDEX_MASK_17, AUDIO_CHANNEL_INDEX_HDR | (1 << 17) - 1) \
216     V(AUDIO_CHANNEL_INDEX_MASK_18, AUDIO_CHANNEL_INDEX_HDR | (1 << 18) - 1) \
217     V(AUDIO_CHANNEL_INDEX_MASK_19, AUDIO_CHANNEL_INDEX_HDR | (1 << 19) - 1) \
218     V(AUDIO_CHANNEL_INDEX_MASK_20, AUDIO_CHANNEL_INDEX_HDR | (1 << 20) - 1) \
219     V(AUDIO_CHANNEL_INDEX_MASK_21, AUDIO_CHANNEL_INDEX_HDR | (1 << 21) - 1) \
220     V(AUDIO_CHANNEL_INDEX_MASK_22, AUDIO_CHANNEL_INDEX_HDR | (1 << 22) - 1) \
221     V(AUDIO_CHANNEL_INDEX_MASK_23, AUDIO_CHANNEL_INDEX_HDR | (1 << 23) - 1) \
222     V(AUDIO_CHANNEL_INDEX_MASK_24, AUDIO_CHANNEL_INDEX_HDR | (1 << 24) - 1)
223 
224 // The "channel mask" enum is comprised of discrete channels,
225 // their combinations (masks), and special values.
226 typedef enum {
227     AUDIO_CHANNEL_OUT_DISCRETE_CHANNEL_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
228     AUDIO_CHANNEL_IN_DISCRETE_CHANNEL_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
229     AUDIO_CHANNEL_IN_OUT_MASK_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
230     AUDIO_CHANNEL_OUT_MASK_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
231     AUDIO_CHANNEL_IN_MASK_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
232     AUDIO_CHANNEL_INDEX_MASK_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
233     AUDIO_CHANNEL_OUT_ALL =
234         AUDIO_CHANNEL_OUT_DISCRETE_CHANNEL_LIST_DEF(AUDIO_DEFINE_BIT_MASK_V) 0,
235     AUDIO_CHANNEL_HAPTIC_ALL = AUDIO_CHANNEL_OUT_HAPTIC_B |
236                                AUDIO_CHANNEL_OUT_HAPTIC_A,
237     AUDIO_CHANNEL_IN_ALL =
238         AUDIO_CHANNEL_IN_DISCRETE_CHANNEL_LIST_DEF(AUDIO_DEFINE_BIT_MASK_V) 0,
239     // This value must be part of the enum, but it is not a valid mask,
240     // and thus it does not participate in to/from string conversions.
241     AUDIO_CHANNEL_INVALID = 0xC0000000u,
242 } audio_channel_mask_t;
243 
244 // Due to the fact that flag values for input and output channels
245 // intersect, to string conversions must be defined separately.
audio_channel_out_mask_to_string(audio_channel_mask_t t)246 inline const char* audio_channel_out_mask_to_string(audio_channel_mask_t t) {
247     switch (t) {
248     AUDIO_CHANNEL_IN_OUT_MASK_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
249     AUDIO_CHANNEL_OUT_MASK_LIST_UNIQUE_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
250     default:
251         return "";
252     }
253 }
254 
audio_channel_in_mask_to_string(audio_channel_mask_t t)255 inline const char* audio_channel_in_mask_to_string(audio_channel_mask_t t) {
256     switch (t) {
257     AUDIO_CHANNEL_IN_OUT_MASK_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
258     AUDIO_CHANNEL_IN_MASK_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
259     default:
260         return "";
261     }
262 }
263 
audio_channel_index_mask_to_string(audio_channel_mask_t t)264 inline const char* audio_channel_index_mask_to_string(audio_channel_mask_t t) {
265     switch (t) {
266     AUDIO_CHANNEL_IN_OUT_MASK_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
267     AUDIO_CHANNEL_INDEX_MASK_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
268     default:
269         return "";
270     }
271 }
272 
273 // Note: parsing is only done for masks, individual channels are not used by HAL.
audio_channel_mask_from_string(const char * s,audio_channel_mask_t * t)274 inline bool audio_channel_mask_from_string(const char* s, audio_channel_mask_t* t) {
275     AUDIO_CHANNEL_IN_OUT_MASK_LIST_DEF(AUDIO_DEFINE_PARSE_CASE_V)
276     AUDIO_CHANNEL_OUT_MASK_LIST_DEF(AUDIO_DEFINE_PARSE_CASE_V)
277     AUDIO_CHANNEL_IN_MASK_LIST_DEF(AUDIO_DEFINE_PARSE_CASE_V)
278     AUDIO_CHANNEL_INDEX_MASK_LIST_DEF(AUDIO_DEFINE_PARSE_CASE_V)
279     return false;
280 }
281 
282 #undef AUDIO_CHANNEL_INDEX_MASK_LIST_DEF
283 #undef AUDIO_CHANNEL_IN_MASK_LIST_DEF
284 #undef AUDIO_CHANNEL_OUT_MASK_LIST_DEF
285 #undef AUDIO_CHANNEL_OUT_MASK_LIST_UNIQUE_DEF
286 #undef AUDIO_CHANNEL_IN_OUT_MASK_LIST_DEF
287 #undef AUDIO_CHANNEL_IN_DISCRETE_CHANNEL_LIST_DEF
288 #undef AUDIO_CHANNEL_OUT_DISCRETE_CHANNEL_LIST_DEF
289 
290 
291 #define AUDIO_CONTENT_TYPE_LIST_DEF(V) \
292     V(AUDIO_CONTENT_TYPE_UNKNOWN) \
293     V(AUDIO_CONTENT_TYPE_SPEECH) \
294     V(AUDIO_CONTENT_TYPE_MUSIC) \
295     V(AUDIO_CONTENT_TYPE_MOVIE) \
296     V(AUDIO_CONTENT_TYPE_SONIFICATION)
297 
298 typedef enum {
299     AUDIO_CONTENT_TYPE_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL)
300 } audio_content_type_t;
301 
audio_content_type_to_string(audio_content_type_t t)302 inline const char* audio_content_type_to_string(audio_content_type_t t) {
303     switch (t) {
304     AUDIO_CONTENT_TYPE_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE)
305     }
306     return "";
307 }
308 
audio_content_type_from_string(const char * s,audio_content_type_t * t)309 inline bool audio_content_type_from_string(const char* s, audio_content_type_t* t) {
310     AUDIO_CONTENT_TYPE_LIST_DEF(AUDIO_DEFINE_PARSE_CASE)
311     return false;
312 }
313 
314 #undef AUDIO_CONTENT_TYPE_LIST_DEF
315 
316 
317 // Flags that never appear on their own.
318 enum {
319     AUDIO_DEVICE_BIT_IN = 0x80000000u,
320     AUDIO_DEVICE_BIT_DEFAULT = 0x40000000u,
321 };
322 
323 #define AUDIO_DEVICE_LIST_UNIQUE_DEF(V) \
324     V(AUDIO_DEVICE_NONE, 0x0u) \
325     V(AUDIO_DEVICE_OUT_EARPIECE, 0x1u) \
326     V(AUDIO_DEVICE_OUT_SPEAKER, 0x2u) \
327     V(AUDIO_DEVICE_OUT_WIRED_HEADSET, 0x4u) \
328     V(AUDIO_DEVICE_OUT_WIRED_HEADPHONE, 0x8u) \
329     V(AUDIO_DEVICE_OUT_BLUETOOTH_SCO, 0x10u) \
330     V(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET, 0x20u) \
331     V(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT, 0x40u) \
332     V(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP, 0x80u) \
333     V(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES, 0x100u) \
334     V(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER, 0x200u) \
335     V(AUDIO_DEVICE_OUT_HDMI, 0x400u) \
336     V(AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, 0x800u) \
337     V(AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, 0x1000u) \
338     V(AUDIO_DEVICE_OUT_USB_ACCESSORY, 0x2000u) \
339     V(AUDIO_DEVICE_OUT_USB_DEVICE, 0x4000u) \
340     V(AUDIO_DEVICE_OUT_REMOTE_SUBMIX, 0x8000u) \
341     V(AUDIO_DEVICE_OUT_TELEPHONY_TX, 0x10000u) \
342     V(AUDIO_DEVICE_OUT_LINE, 0x20000u) \
343     V(AUDIO_DEVICE_OUT_HDMI_ARC, 0x40000u) \
344     V(AUDIO_DEVICE_OUT_HDMI_EARC, 0x40001u) \
345     V(AUDIO_DEVICE_OUT_SPDIF, 0x80000u) \
346     V(AUDIO_DEVICE_OUT_FM, 0x100000u) \
347     V(AUDIO_DEVICE_OUT_AUX_LINE, 0x200000u) \
348     V(AUDIO_DEVICE_OUT_SPEAKER_SAFE, 0x400000u) \
349     V(AUDIO_DEVICE_OUT_IP, 0x800000u) \
350     V(AUDIO_DEVICE_OUT_BUS, 0x1000000u) \
351     V(AUDIO_DEVICE_OUT_PROXY, 0x2000000u) \
352     V(AUDIO_DEVICE_OUT_USB_HEADSET, 0x4000000u) \
353     V(AUDIO_DEVICE_OUT_HEARING_AID, 0x8000000u) \
354     V(AUDIO_DEVICE_OUT_ECHO_CANCELLER, 0x10000000u) \
355     V(AUDIO_DEVICE_OUT_BLE_HEADSET, 0x20000000u) \
356     V(AUDIO_DEVICE_OUT_BLE_SPEAKER, 0x20000001u) \
357     V(AUDIO_DEVICE_OUT_DEFAULT, AUDIO_DEVICE_BIT_DEFAULT) \
358     V(AUDIO_DEVICE_IN_COMMUNICATION, AUDIO_DEVICE_BIT_IN | 0x1u) \
359     V(AUDIO_DEVICE_IN_AMBIENT, AUDIO_DEVICE_BIT_IN | 0x2u) \
360     V(AUDIO_DEVICE_IN_BUILTIN_MIC, AUDIO_DEVICE_BIT_IN | 0x4u) \
361     V(AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET, AUDIO_DEVICE_BIT_IN | 0x8u) \
362     V(AUDIO_DEVICE_IN_WIRED_HEADSET, AUDIO_DEVICE_BIT_IN | 0x10u) \
363     V(AUDIO_DEVICE_IN_HDMI, AUDIO_DEVICE_BIT_IN | 0x20u) \
364     V(AUDIO_DEVICE_IN_TELEPHONY_RX, AUDIO_DEVICE_BIT_IN | 0x40u) \
365     V(AUDIO_DEVICE_IN_BACK_MIC, AUDIO_DEVICE_BIT_IN | 0x80u) \
366     V(AUDIO_DEVICE_IN_REMOTE_SUBMIX, AUDIO_DEVICE_BIT_IN | 0x100u) \
367     V(AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET, AUDIO_DEVICE_BIT_IN | 0x200u) \
368     V(AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET, AUDIO_DEVICE_BIT_IN | 0x400u) \
369     V(AUDIO_DEVICE_IN_USB_ACCESSORY, AUDIO_DEVICE_BIT_IN | 0x800u) \
370     V(AUDIO_DEVICE_IN_USB_DEVICE, AUDIO_DEVICE_BIT_IN | 0x1000u) \
371     V(AUDIO_DEVICE_IN_FM_TUNER, AUDIO_DEVICE_BIT_IN | 0x2000u) \
372     V(AUDIO_DEVICE_IN_TV_TUNER, AUDIO_DEVICE_BIT_IN | 0x4000u) \
373     V(AUDIO_DEVICE_IN_LINE, AUDIO_DEVICE_BIT_IN | 0x8000u) \
374     V(AUDIO_DEVICE_IN_SPDIF, AUDIO_DEVICE_BIT_IN | 0x10000u) \
375     V(AUDIO_DEVICE_IN_BLUETOOTH_A2DP, AUDIO_DEVICE_BIT_IN | 0x20000u) \
376     V(AUDIO_DEVICE_IN_LOOPBACK, AUDIO_DEVICE_BIT_IN | 0x40000u) \
377     V(AUDIO_DEVICE_IN_IP, AUDIO_DEVICE_BIT_IN | 0x80000u) \
378     V(AUDIO_DEVICE_IN_BUS, AUDIO_DEVICE_BIT_IN | 0x100000u) \
379     V(AUDIO_DEVICE_IN_PROXY, AUDIO_DEVICE_BIT_IN | 0x1000000u) \
380     V(AUDIO_DEVICE_IN_USB_HEADSET, AUDIO_DEVICE_BIT_IN | 0x2000000u) \
381     V(AUDIO_DEVICE_IN_BLUETOOTH_BLE, AUDIO_DEVICE_BIT_IN | 0x4000000u) \
382     V(AUDIO_DEVICE_IN_HDMI_ARC, AUDIO_DEVICE_BIT_IN | 0x8000000u) \
383     V(AUDIO_DEVICE_IN_HDMI_EARC, AUDIO_DEVICE_BIT_IN | 0x8000001u) \
384     V(AUDIO_DEVICE_IN_ECHO_REFERENCE, AUDIO_DEVICE_BIT_IN | 0x10000000u) \
385     V(AUDIO_DEVICE_IN_BLE_HEADSET, AUDIO_DEVICE_BIT_IN | 0x20000000u) \
386     V(AUDIO_DEVICE_IN_DEFAULT, AUDIO_DEVICE_BIT_IN | AUDIO_DEVICE_BIT_DEFAULT)
387 // Some of the device enums have aliases. They can not appear in the 'to string'
388 // converter as case values must be unique.
389 #define AUDIO_DEVICE_LIST_DEF(V) \
390     AUDIO_DEVICE_LIST_UNIQUE_DEF(V) \
391     V(AUDIO_DEVICE_OUT_AUX_DIGITAL, AUDIO_DEVICE_OUT_HDMI) \
392     V(AUDIO_DEVICE_OUT_STUB, AUDIO_DEVICE_OUT_DEFAULT) \
393     V(AUDIO_DEVICE_IN_VOICE_CALL, AUDIO_DEVICE_IN_TELEPHONY_RX) \
394     V(AUDIO_DEVICE_IN_AUX_DIGITAL, AUDIO_DEVICE_IN_HDMI) \
395     V(AUDIO_DEVICE_IN_STUB, AUDIO_DEVICE_IN_DEFAULT)
396 
397 typedef enum {
398     AUDIO_DEVICE_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
399 } audio_devices_t;
400 
audio_device_to_string(audio_devices_t t)401 inline const char* audio_device_to_string(audio_devices_t t) {
402     switch (t) {
403     AUDIO_DEVICE_LIST_UNIQUE_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
404     }
405     return "";
406 }
407 
audio_device_from_string(const char * s,audio_devices_t * t)408 inline bool audio_device_from_string(const char* s, audio_devices_t* t) {
409     AUDIO_DEVICE_LIST_DEF(AUDIO_DEFINE_PARSE_CASE_V)
410     return false;
411 }
412 
413 #undef AUDIO_DEVICE_LIST_DEF
414 #undef AUDIO_DEVICE_LIST_UNIQUE_DEF
415 
416 
417 #define AUDIO_OUTPUT_FLAG_LIST_DEF(V) \
418     V(AUDIO_OUTPUT_FLAG_NONE, 0x0) \
419     V(AUDIO_OUTPUT_FLAG_DIRECT, 0x1) \
420     V(AUDIO_OUTPUT_FLAG_PRIMARY, 0x2) \
421     V(AUDIO_OUTPUT_FLAG_FAST, 0x4) \
422     V(AUDIO_OUTPUT_FLAG_DEEP_BUFFER, 0x8) \
423     V(AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD, 0x10) \
424     V(AUDIO_OUTPUT_FLAG_NON_BLOCKING, 0x20) \
425     V(AUDIO_OUTPUT_FLAG_HW_AV_SYNC, 0x40) \
426     V(AUDIO_OUTPUT_FLAG_TTS, 0x80) \
427     V(AUDIO_OUTPUT_FLAG_RAW, 0x100) \
428     V(AUDIO_OUTPUT_FLAG_SYNC, 0x200) \
429     V(AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO, 0x400) \
430     V(AUDIO_OUTPUT_FLAG_DIRECT_PCM, 0x2000) \
431     V(AUDIO_OUTPUT_FLAG_MMAP_NOIRQ, 0x4000) \
432     V(AUDIO_OUTPUT_FLAG_VOIP_RX, 0x8000) \
433     V(AUDIO_OUTPUT_FLAG_INCALL_MUSIC, 0x10000) \
434     V(AUDIO_OUTPUT_FLAG_GAPLESS_OFFLOAD, 0x20000)
435 
436 typedef enum {
437     AUDIO_OUTPUT_FLAG_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
438 } audio_output_flags_t;
439 
audio_output_flag_to_string(audio_output_flags_t t)440 inline const char* audio_output_flag_to_string(audio_output_flags_t t) {
441     switch (t) {
442     AUDIO_OUTPUT_FLAG_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
443     }
444     return "";
445 }
446 
audio_output_flag_from_string(const char * s,audio_output_flags_t * t)447 inline bool audio_output_flag_from_string(const char* s, audio_output_flags_t* t) {
448     AUDIO_OUTPUT_FLAG_LIST_DEF(AUDIO_DEFINE_PARSE_CASE_V)
449     return false;
450 }
451 
452 #undef AUDIO_OUTPUT_FLAG_LIST_DEF
453 
454 
455 #define AUDIO_INPUT_FLAG_LIST_DEF(V) \
456     V(AUDIO_INPUT_FLAG_NONE, 0x0) \
457     V(AUDIO_INPUT_FLAG_FAST, 0x1) \
458     V(AUDIO_INPUT_FLAG_HW_HOTWORD, 0x2) \
459     V(AUDIO_INPUT_FLAG_RAW, 0x4) \
460     V(AUDIO_INPUT_FLAG_SYNC, 0x8) \
461     V(AUDIO_INPUT_FLAG_MMAP_NOIRQ, 0x10) \
462     V(AUDIO_INPUT_FLAG_VOIP_TX, 0x20) \
463     V(AUDIO_INPUT_FLAG_HW_AV_SYNC, 0x40) \
464     V(AUDIO_INPUT_FLAG_DIRECT, 0x80)
465 
466 typedef enum {
467     AUDIO_INPUT_FLAG_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
468 } audio_input_flags_t;
469 
audio_input_flag_to_string(audio_input_flags_t t)470 inline const char* audio_input_flag_to_string(audio_input_flags_t t) {
471     switch (t) {
472     AUDIO_INPUT_FLAG_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
473     }
474     return "";
475 }
476 
audio_input_flag_from_string(const char * s,audio_input_flags_t * t)477 inline bool audio_input_flag_from_string(const char* s, audio_input_flags_t* t) {
478     AUDIO_INPUT_FLAG_LIST_DEF(AUDIO_DEFINE_PARSE_CASE_V)
479     return false;
480 }
481 
482 #undef AUDIO_INPUT_FLAG_LIST_DEF
483 
484 
485 // Anonymous enum that provides building blocks for audio format enums.
486 // Because some of them are used on their own (e.g. masks), they retain 'AUDIO_FORMAT_' prefix.
487 enum {
488     AUDIO_FORMAT_MAIN_MASK             = 0xFF000000u,
489     AUDIO_FORMAT_SUB_MASK              = 0x00FFFFFFu,
490 
491     AUDIO_FORMAT_PCM_MAIN              = 0u,
492     AUDIO_FORMAT_PCM_SUB_16_BIT        = 0x1u,
493     AUDIO_FORMAT_PCM_SUB_8_BIT         = 0x2u,
494     AUDIO_FORMAT_PCM_SUB_32_BIT        = 0x3u,
495     AUDIO_FORMAT_PCM_SUB_8_24_BIT      = 0x4u,
496     AUDIO_FORMAT_PCM_SUB_FLOAT         = 0x5u,
497     AUDIO_FORMAT_PCM_SUB_24_BIT_PACKED = 0x6u,
498 
499     AUDIO_FORMAT_AAC_SUB_MAIN          = 0x1u,
500     AUDIO_FORMAT_AAC_SUB_LC            = 0x2u,
501     AUDIO_FORMAT_AAC_SUB_SSR           = 0x4u,
502     AUDIO_FORMAT_AAC_SUB_LTP           = 0x8u,
503     AUDIO_FORMAT_AAC_SUB_HE_V1         = 0x10u,
504     AUDIO_FORMAT_AAC_SUB_SCALABLE      = 0x20u,
505     AUDIO_FORMAT_AAC_SUB_ERLC          = 0x40u,
506     AUDIO_FORMAT_AAC_SUB_LD            = 0x80u,
507     AUDIO_FORMAT_AAC_SUB_HE_V2         = 0x100u,
508     AUDIO_FORMAT_AAC_SUB_ELD           = 0x200u,
509     AUDIO_FORMAT_AAC_SUB_XHE           = 0x300u,
510 
511     AUDIO_FORMAT_E_AC3_SUB_JOC         = 0x1u,
512 
513     AUDIO_FORMAT_MAT_SUB_1_0           = 0x1u,
514     AUDIO_FORMAT_MAT_SUB_2_0           = 0x2u,
515     AUDIO_FORMAT_MAT_SUB_2_1           = 0x3u,
516 
517     AUDIO_FORMAT_MPEGH_SUB_BL_L3       = 0x13u,
518     AUDIO_FORMAT_MPEGH_SUB_BL_L4       = 0x14u,
519     AUDIO_FORMAT_MPEGH_SUB_LC_L3       = 0x23u,
520     AUDIO_FORMAT_MPEGH_SUB_LC_L4       = 0x24u,
521 };
522 
523 #define AUDIO_FORMAT_LIST_UNIQUE_DEF(V) \
524     V(AUDIO_FORMAT_DEFAULT, AUDIO_FORMAT_PCM_MAIN) \
525     V(AUDIO_FORMAT_PCM_16_BIT, AUDIO_FORMAT_PCM_MAIN | AUDIO_FORMAT_PCM_SUB_16_BIT) \
526     V(AUDIO_FORMAT_PCM_8_BIT, AUDIO_FORMAT_PCM_MAIN | AUDIO_FORMAT_PCM_SUB_8_BIT) \
527     V(AUDIO_FORMAT_PCM_32_BIT, AUDIO_FORMAT_PCM_MAIN | AUDIO_FORMAT_PCM_SUB_32_BIT) \
528     V(AUDIO_FORMAT_PCM_8_24_BIT, AUDIO_FORMAT_PCM_MAIN | AUDIO_FORMAT_PCM_SUB_8_24_BIT) \
529     V(AUDIO_FORMAT_PCM_FLOAT, AUDIO_FORMAT_PCM_MAIN | AUDIO_FORMAT_PCM_SUB_FLOAT) \
530     V(AUDIO_FORMAT_PCM_24_BIT_PACKED, AUDIO_FORMAT_PCM_MAIN | AUDIO_FORMAT_PCM_SUB_24_BIT_PACKED) \
531     V(AUDIO_FORMAT_MP3, 0x01000000u) \
532     V(AUDIO_FORMAT_AMR_NB, 0x02000000u) \
533     V(AUDIO_FORMAT_AMR_WB, 0x03000000u) \
534     V(AUDIO_FORMAT_AAC, 0x04000000u) \
535     V(AUDIO_FORMAT_AAC_MAIN, AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_MAIN) \
536     V(AUDIO_FORMAT_AAC_LC, AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_LC) \
537     V(AUDIO_FORMAT_AAC_SSR, AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_SSR) \
538     V(AUDIO_FORMAT_AAC_LTP, AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_LTP) \
539     V(AUDIO_FORMAT_AAC_HE_V1, AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_HE_V1) \
540     V(AUDIO_FORMAT_AAC_SCALABLE, AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_SCALABLE) \
541     V(AUDIO_FORMAT_AAC_ERLC, AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_ERLC) \
542     V(AUDIO_FORMAT_AAC_LD, AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_LD) \
543     V(AUDIO_FORMAT_AAC_HE_V2, AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_HE_V2) \
544     V(AUDIO_FORMAT_AAC_ELD, AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_ELD) \
545     V(AUDIO_FORMAT_AAC_XHE, AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_XHE) \
546     V(AUDIO_FORMAT_HE_AAC_V1, 0x05000000u) \
547     V(AUDIO_FORMAT_HE_AAC_V2, 0x06000000u) \
548     V(AUDIO_FORMAT_VORBIS, 0x07000000u) \
549     V(AUDIO_FORMAT_OPUS, 0x08000000u) \
550     V(AUDIO_FORMAT_AC3, 0x09000000u) \
551     V(AUDIO_FORMAT_E_AC3, 0x0A000000u) \
552     V(AUDIO_FORMAT_E_AC3_JOC, AUDIO_FORMAT_E_AC3 | AUDIO_FORMAT_E_AC3_SUB_JOC) \
553     V(AUDIO_FORMAT_DTS, 0x0B000000u) \
554     V(AUDIO_FORMAT_DTS_HD, 0x0C000000u) \
555     V(AUDIO_FORMAT_IEC61937, 0x0D000000u) \
556     V(AUDIO_FORMAT_DOLBY_TRUEHD, 0x0E000000u) \
557     V(AUDIO_FORMAT_EVRC, 0x10000000u) \
558     V(AUDIO_FORMAT_EVRCB, 0x11000000u) \
559     V(AUDIO_FORMAT_EVRCWB, 0x12000000u) \
560     V(AUDIO_FORMAT_EVRCNW, 0x13000000u) \
561     V(AUDIO_FORMAT_AAC_ADIF, 0x14000000u) \
562     V(AUDIO_FORMAT_WMA, 0x15000000u) \
563     V(AUDIO_FORMAT_WMA_PRO, 0x16000000u) \
564     V(AUDIO_FORMAT_AMR_WB_PLUS, 0x17000000u) \
565     V(AUDIO_FORMAT_MP2, 0x18000000u) \
566     V(AUDIO_FORMAT_QCELP, 0x19000000u) \
567     V(AUDIO_FORMAT_DSD, 0x1A000000u) \
568     V(AUDIO_FORMAT_FLAC, 0x1B000000u) \
569     V(AUDIO_FORMAT_ALAC, 0x1C000000u) \
570     V(AUDIO_FORMAT_APE, 0x1D000000u) \
571     V(AUDIO_FORMAT_AAC_ADTS, 0x1E000000u) \
572     V(AUDIO_FORMAT_AAC_ADTS_MAIN, AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_MAIN) \
573     V(AUDIO_FORMAT_AAC_ADTS_LC, AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_LC) \
574     V(AUDIO_FORMAT_AAC_ADTS_SSR, AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_SSR) \
575     V(AUDIO_FORMAT_AAC_ADTS_LTP, AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_LTP) \
576     V(AUDIO_FORMAT_AAC_ADTS_HE_V1, AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_HE_V1) \
577     V(AUDIO_FORMAT_AAC_ADTS_SCALABLE, AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_SCALABLE) \
578     V(AUDIO_FORMAT_AAC_ADTS_ERLC, AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_ERLC) \
579     V(AUDIO_FORMAT_AAC_ADTS_LD, AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_LD) \
580     V(AUDIO_FORMAT_AAC_ADTS_HE_V2, AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_HE_V2) \
581     V(AUDIO_FORMAT_AAC_ADTS_ELD, AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_ELD) \
582     V(AUDIO_FORMAT_AAC_ADTS_XHE, AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_XHE) \
583     V(AUDIO_FORMAT_SBC, 0x1F000000u) \
584     V(AUDIO_FORMAT_APTX, 0x20000000u) \
585     V(AUDIO_FORMAT_APTX_HD, 0x21000000u) \
586     V(AUDIO_FORMAT_AC4, 0x22000000u) \
587     V(AUDIO_FORMAT_LDAC, 0x23000000u) \
588     V(AUDIO_FORMAT_MAT, 0x24000000u) \
589     V(AUDIO_FORMAT_MAT_1_0, AUDIO_FORMAT_MAT | AUDIO_FORMAT_MAT_SUB_1_0) \
590     V(AUDIO_FORMAT_MAT_2_0, AUDIO_FORMAT_MAT | AUDIO_FORMAT_MAT_SUB_2_0) \
591     V(AUDIO_FORMAT_MAT_2_1, AUDIO_FORMAT_MAT | AUDIO_FORMAT_MAT_SUB_2_1) \
592     V(AUDIO_FORMAT_AAC_LATM, 0x25000000u) \
593     V(AUDIO_FORMAT_AAC_LATM_LC, AUDIO_FORMAT_AAC_LATM | AUDIO_FORMAT_AAC_SUB_LC) \
594     V(AUDIO_FORMAT_AAC_LATM_HE_V1, AUDIO_FORMAT_AAC_LATM | AUDIO_FORMAT_AAC_SUB_HE_V1) \
595     V(AUDIO_FORMAT_AAC_LATM_HE_V2, AUDIO_FORMAT_AAC_LATM | AUDIO_FORMAT_AAC_SUB_HE_V2) \
596     V(AUDIO_FORMAT_CELT, 0x26000000u) \
597     V(AUDIO_FORMAT_APTX_ADAPTIVE, 0x27000000u) \
598     V(AUDIO_FORMAT_LHDC, 0x28000000u) \
599     V(AUDIO_FORMAT_LHDC_LL, 0x29000000u) \
600     V(AUDIO_FORMAT_APTX_TWSP, 0x2A000000u) \
601     V(AUDIO_FORMAT_LC3, 0x2B000000u) \
602     V(AUDIO_FORMAT_MPEGH, 0x2C000000u) \
603     V(AUDIO_FORMAT_MPEGH_BL_L3, AUDIO_FORMAT_MPEGH | AUDIO_FORMAT_MPEGH_SUB_BL_L3) \
604     V(AUDIO_FORMAT_MPEGH_BL_L4, AUDIO_FORMAT_MPEGH | AUDIO_FORMAT_MPEGH_SUB_BL_L4) \
605     V(AUDIO_FORMAT_MPEGH_LC_L3, AUDIO_FORMAT_MPEGH | AUDIO_FORMAT_MPEGH_SUB_LC_L3) \
606     V(AUDIO_FORMAT_MPEGH_LC_L4, AUDIO_FORMAT_MPEGH | AUDIO_FORMAT_MPEGH_SUB_LC_L4) \
607     V(AUDIO_FORMAT_IEC60958, 0x2D000000u) \
608     V(AUDIO_FORMAT_DTS_UHD, 0x2E000000u) \
609     V(AUDIO_FORMAT_DRA, 0x2F000000u)
610 
611 #define AUDIO_FORMAT_LIST_DEF(V) \
612     AUDIO_FORMAT_LIST_UNIQUE_DEF(V) \
613     V(VX_AUDIO_FORMAT_LC3, AUDIO_FORMAT_LC3)
614 
615 typedef enum {
616     AUDIO_FORMAT_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
617     // These values must be part of the enum, but they are not valid formats,
618     // and thus don't participate in to/from string conversions.
619     AUDIO_FORMAT_INVALID = 0xFFFFFFFFu,
620     AUDIO_FORMAT_PCM = AUDIO_FORMAT_PCM_MAIN,
621 } audio_format_t;
622 
audio_format_to_string(audio_format_t t)623 inline const char* audio_format_to_string(audio_format_t t) {
624     switch (t) {
625     AUDIO_FORMAT_LIST_UNIQUE_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
626     default:
627         return "";
628     }
629 }
630 
audio_format_from_string(const char * s,audio_format_t * t)631 inline bool audio_format_from_string(const char* s, audio_format_t* t) {
632     AUDIO_FORMAT_LIST_DEF(AUDIO_DEFINE_PARSE_CASE_V)
633     return false;
634 }
635 
636 #undef AUDIO_FORMAT_LIST_DEF
637 #undef AUDIO_FORMAT_LIST_UNIQUE_DEF
638 
639 #define AUDIO_GAIN_MODE_LIST_DEF(V) \
640     V(AUDIO_GAIN_MODE_JOINT, 1) \
641     V(AUDIO_GAIN_MODE_CHANNELS, 2) \
642     V(AUDIO_GAIN_MODE_RAMP, 4)
643 
644 typedef enum {
645     AUDIO_GAIN_MODE_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
646 } audio_gain_mode_t;
647 
audio_gain_mode_to_string(audio_gain_mode_t t)648 inline const char* audio_gain_mode_to_string(audio_gain_mode_t t) {
649     switch (t) {
650     AUDIO_GAIN_MODE_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
651     }
652     return "";
653 }
654 
audio_gain_mode_from_string(const char * s,audio_gain_mode_t * t)655 inline bool audio_gain_mode_from_string(const char* s, audio_gain_mode_t* t) {
656     AUDIO_GAIN_MODE_LIST_DEF(AUDIO_DEFINE_PARSE_CASE_V)
657     return false;
658 }
659 
660 #undef AUDIO_GAIN_MODE_LIST_DEF
661 
662 
663 #define AUDIO_SOURCE_LIST_NO_SYS_DEF(V) \
664     V(AUDIO_SOURCE_DEFAULT, 0) \
665     V(AUDIO_SOURCE_MIC, 1) \
666     V(AUDIO_SOURCE_VOICE_UPLINK, 2) \
667     V(AUDIO_SOURCE_VOICE_DOWNLINK, 3) \
668     V(AUDIO_SOURCE_VOICE_CALL, 4) \
669     V(AUDIO_SOURCE_CAMCORDER, 5) \
670     V(AUDIO_SOURCE_VOICE_RECOGNITION, 6) \
671     V(AUDIO_SOURCE_VOICE_COMMUNICATION, 7) \
672     V(AUDIO_SOURCE_REMOTE_SUBMIX, 8) \
673     V(AUDIO_SOURCE_UNPROCESSED, 9) \
674     V(AUDIO_SOURCE_VOICE_PERFORMANCE, 10) \
675     V(AUDIO_SOURCE_ECHO_REFERENCE, 1997) \
676     V(AUDIO_SOURCE_FM_TUNER, 1998) \
677     V(AUDIO_SOURCE_HOTWORD, 1999)
678 #ifdef AUDIO_NO_SYSTEM_DECLARATIONS
679 #define AUDIO_SOURCE_LIST_DEF AUDIO_SOURCE_LIST_NO_SYS_DEF
680 #else
681 #define AUDIO_SOURCE_LIST_DEF(V) \
682     AUDIO_SOURCE_LIST_NO_SYS_DEF(V) \
683     V(AUDIO_SOURCE_INVALID, -1)
684 #endif  // AUDIO_NO_SYSTEM_DECLARATIONS
685 
686 typedef enum {
687     AUDIO_SOURCE_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
688 } audio_source_t;
689 
audio_source_to_string(audio_source_t t)690 inline const char* audio_source_to_string(audio_source_t t) {
691     switch (t) {
692     AUDIO_SOURCE_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
693     }
694     return "";
695 }
696 
audio_source_from_string(const char * s,audio_source_t * t)697 inline bool audio_source_from_string(const char* s, audio_source_t* t) {
698     AUDIO_SOURCE_LIST_NO_SYS_DEF(AUDIO_DEFINE_PARSE_CASE_V)
699     return false;
700 }
701 
702 #undef AUDIO_SOURCE_LIST_DEF
703 #undef AUDIO_SOURCE_LIST_NO_SYS_DEF
704 
705 #define AUDIO_STREAM_LIST_NO_SYS_DEF(V) \
706     V(AUDIO_STREAM_VOICE_CALL, 0) \
707     V(AUDIO_STREAM_SYSTEM, 1) \
708     V(AUDIO_STREAM_RING, 2) \
709     V(AUDIO_STREAM_MUSIC, 3) \
710     V(AUDIO_STREAM_ALARM, 4) \
711     V(AUDIO_STREAM_NOTIFICATION, 5) \
712     V(AUDIO_STREAM_BLUETOOTH_SCO, 6) \
713     V(AUDIO_STREAM_ENFORCED_AUDIBLE, 7) \
714     V(AUDIO_STREAM_DTMF, 8) \
715     V(AUDIO_STREAM_TTS, 9) \
716     V(AUDIO_STREAM_ACCESSIBILITY, 10) \
717     V(AUDIO_STREAM_ASSISTANT, 11) \
718     V(AUDIO_STREAM_REROUTING, 12) \
719     V(AUDIO_STREAM_PATCH, 13) \
720     V(AUDIO_STREAM_CALL_ASSISTANT, 14)
721 #ifdef AUDIO_NO_SYSTEM_DECLARATIONS
722 #define AUDIO_STREAM_LIST_DEF AUDIO_STREAM_LIST_NO_SYS_DEF
723 #else
724 #define AUDIO_STREAM_LIST_DEF(V) \
725     AUDIO_STREAM_LIST_NO_SYS_DEF(V) \
726     V(AUDIO_STREAM_DEFAULT, -1)
727 #endif  // AUDIO_NO_SYSTEM_DECLARATIONS
728 
729 typedef enum {
730     AUDIO_STREAM_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
731 } audio_stream_type_t;
732 
audio_stream_type_to_string(audio_stream_type_t t)733 inline const char* audio_stream_type_to_string(audio_stream_type_t t) {
734     switch (t) {
735     AUDIO_STREAM_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
736     }
737     return "";
738 }
739 
audio_stream_type_from_string(const char * s,audio_stream_type_t * t)740 inline bool audio_stream_type_from_string(const char* s, audio_stream_type_t* t) {
741     AUDIO_STREAM_LIST_NO_SYS_DEF(AUDIO_DEFINE_PARSE_CASE_V)
742     return false;
743 }
744 
745 #undef AUDIO_STREAM_LIST_DEF
746 #undef AUDIO_STREAM_LIST_NO_SYS_DEF
747 
748 
749 #define AUDIO_USAGE_LIST_NO_SYS_DEF(V) \
750     V(AUDIO_USAGE_UNKNOWN, 0) \
751     V(AUDIO_USAGE_MEDIA, 1) \
752     V(AUDIO_USAGE_VOICE_COMMUNICATION, 2) \
753     V(AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING, 3) \
754     V(AUDIO_USAGE_ALARM, 4) \
755     V(AUDIO_USAGE_NOTIFICATION, 5) \
756     V(AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE, 6) \
757     V(AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY, 11) \
758     V(AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE, 12) \
759     V(AUDIO_USAGE_ASSISTANCE_SONIFICATION, 13) \
760     V(AUDIO_USAGE_GAME, 14) \
761     V(AUDIO_USAGE_VIRTUAL_SOURCE, 15) \
762     V(AUDIO_USAGE_ASSISTANT, 16) \
763     V(AUDIO_USAGE_CALL_ASSISTANT, 17) \
764     V(AUDIO_USAGE_EMERGENCY, 1000) \
765     V(AUDIO_USAGE_SAFETY, 1001) \
766     V(AUDIO_USAGE_VEHICLE_STATUS, 1002) \
767     V(AUDIO_USAGE_ANNOUNCEMENT, 1003)
768 #ifdef AUDIO_NO_SYSTEM_DECLARATIONS
769 #define AUDIO_USAGE_LIST_DEF AUDIO_USAGE_LIST_NO_SYS_DEF
770 #else
771 #define AUDIO_USAGE_LIST_DEF(V) \
772     AUDIO_USAGE_LIST_NO_SYS_DEF(V) \
773     V(AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST, 7) \
774     V(AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT, 8) \
775     V(AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED, 9) \
776     V(AUDIO_USAGE_NOTIFICATION_EVENT, 10)
777 #endif  // AUDIO_NO_SYSTEM_DECLARATIONS
778 
779 typedef enum {
780     AUDIO_USAGE_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
781 } audio_usage_t;
782 
audio_usage_to_string(audio_usage_t t)783 inline const char* audio_usage_to_string(audio_usage_t t) {
784     switch (t) {
785     AUDIO_USAGE_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
786     }
787     return "";
788 }
789 
audio_usage_from_string(const char * s,audio_usage_t * t)790 inline bool audio_usage_from_string(const char* s, audio_usage_t* t) {
791     AUDIO_USAGE_LIST_NO_SYS_DEF(AUDIO_DEFINE_PARSE_CASE_V)
792     return false;
793 }
794 
795 #undef AUDIO_USAGE_LIST_NO_SYS_DEF
796 #undef AUDIO_USAGE_LIST_DEF
797 
798 #define AUDIO_ENCAPSULATION_TYPE_LIST_DEF(V) \
799     V(AUDIO_ENCAPSULATION_TYPE_NONE, 0) \
800     V(AUDIO_ENCAPSULATION_TYPE_IEC61937, 1)
801 
802 typedef enum {
803     AUDIO_ENCAPSULATION_TYPE_LIST_DEF(AUDIO_DEFINE_ENUM_SYMBOL_V)
804 } audio_encapsulation_type_t;
805 
audio_encapsulation_type_to_string(audio_encapsulation_type_t t)806 inline const char* audio_encapsulation_type_to_string(audio_encapsulation_type_t t) {
807     switch (t) {
808     AUDIO_ENCAPSULATION_TYPE_LIST_DEF(AUDIO_DEFINE_STRINGIFY_CASE_V)
809     }
810     return "";
811 }
812 
audio_encapsulation_type_from_string(const char * s,audio_encapsulation_type_t * t)813 inline bool audio_encapsulation_type_from_string(const char* s, audio_encapsulation_type_t* t) {
814     AUDIO_ENCAPSULATION_TYPE_LIST_DEF(AUDIO_DEFINE_PARSE_CASE_V)
815     return false;
816 }
817 
818 #undef AUDIO_ENCAPSULATION_TYPE_LIST_DEF
819 
820 #undef AUDIO_DEFINE_PARSE_CASE_V
821 #undef AUDIO_DEFINE_PARSE_CASE
822 #undef AUDIO_DEFINE_STRINGIFY_CASE_V
823 #undef AUDIO_DEFINE_STRINGIFY_CASE
824 #undef AUDIO_DEFINE_BIT_MASK_V
825 #undef AUDIO_DEFINE_BIT_MASK
826 #undef AUDIO_DEFINE_ENUM_SYMBOL_V
827 #undef AUDIO_DEFINE_ENUM_SYMBOL
828 #undef AUDIO_ENUM_STRINGIFY
829 #undef AUDIO_ENUM_QUOTE
830 
831 __END_DECLS
832 
833 #endif  // ANDROID_AUDIO_HAL_ENUMS_H
834