• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #pragma once
18 #include <array>
19 #include PATH(android/hardware/audio/common/COMMON_TYPES_FILE_VERSION/types.h)
20 #include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/types.h)
21 #include <utils/Timers.h>
22 
23 namespace android {
24 namespace hardware {
25 namespace audio {
26 namespace CPP_VERSION {
27 namespace implementation {
28 namespace util {
29 
30 using ::android::hardware::hidl_bitfield;
31 using ::android::hardware::hidl_string;
32 using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::AudioFormat;
33 using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::AudioChannelMask;
34 using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::AudioConfig;
35 using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::AudioPortConfig;
36 using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::MicrophoneInfo;
37 using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::TimeSpec;
38 
39 MicrophoneInfo getMicrophoneInfo();
40 
41 size_t countChannels(const AudioChannelMask &mask);
42 size_t getBytesPerSample(const AudioFormat &format);
43 
44 bool checkAudioConfig(const AudioConfig &cfg);
45 bool checkAudioConfig(bool isOut,
46                       size_t duration_ms,
47                       const AudioConfig &cfg,
48                       AudioConfig &suggested);
49 
50 bool checkAudioPortConfig(const AudioPortConfig& cfg);
51 
52 TimeSpec nsecs2TimeSpec(nsecs_t);
53 
54 void setThreadPriority(int prio);
55 
56 }  // namespace util
57 }  // namespace implementation
58 }  // namespace CPP_VERSION
59 }  // namespace audio
60 }  // namespace hardware
61 }  // namespace android
62