1 /*
2  * Copyright (C) 2021 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 #ifndef ANDROID_MEDIA_EXTRAAUDIODESCRIPTOR_H
18 #define ANDROID_MEDIA_EXTRAAUDIODESCRIPTOR_H
19 
20 #include <system/audio.h>
21 #include <utils/Errors.h>
22 
23 namespace android {
24 
25 // keep these values in sync with ExtraAudioDescriptor.java
26 #define STANDARD_NONE 0
27 #define STANDARD_EDID 1
28 #define STANDARD_SADB 2
29 #define STANDARD_VSADB 3
30 
audioStandardFromNative(audio_standard_t nStandard,int * standard)31 static inline status_t audioStandardFromNative(audio_standard_t nStandard, int* standard) {
32     status_t result = NO_ERROR;
33     switch (nStandard) {
34         case AUDIO_STANDARD_NONE:
35             *standard = STANDARD_NONE;
36             break;
37         case AUDIO_STANDARD_EDID:
38             *standard = STANDARD_EDID;
39             break;
40         case AUDIO_STANDARD_SADB:
41             *standard = STANDARD_SADB;
42             break;
43         case AUDIO_STANDARD_VSADB:
44             *standard = STANDARD_VSADB;
45             break;
46         default:
47             result = BAD_VALUE;
48     }
49     return result;
50 }
51 
52 } // namespace android
53 
54 #endif // ANDROID_MEDIA_EXTRAAUDIODESCRIPTOR_H