• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_AUDIOPROFILE_H
18 #define ANDROID_MEDIA_AUDIOPROFILE_H
19 
20 #include <system/audio.h>
21 #include <utils/Errors.h>
22 
23 namespace android {
24 
25 // keep these values in sync with AudioProfile.java
26 #define ENCAPSULATION_TYPE_NONE 0
27 #define ENCAPSULATION_TYPE_IEC61937 1
28 #define ENCAPSULATION_TYPE_PCM 2
29 
audioEncapsulationTypeFromNative(audio_encapsulation_type_t nEncapsulationType,int * encapsulationType)30 static inline status_t audioEncapsulationTypeFromNative(
31         audio_encapsulation_type_t nEncapsulationType, int* encapsulationType) {
32     status_t result = NO_ERROR;
33     switch (nEncapsulationType) {
34         case AUDIO_ENCAPSULATION_TYPE_NONE:
35             *encapsulationType = ENCAPSULATION_TYPE_NONE;
36             break;
37         case AUDIO_ENCAPSULATION_TYPE_IEC61937:
38             *encapsulationType = ENCAPSULATION_TYPE_IEC61937;
39             break;
40         case AUDIO_ENCAPSULATION_TYPE_PCM:
41             *encapsulationType = ENCAPSULATION_TYPE_PCM;
42             break;
43         default:
44             result = BAD_VALUE;
45     }
46     return result;
47 }
48 
49 } // namespace android
50 
51 #endif // ANDROID_MEDIA_AUDIOPROFILE_H