• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 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 
19 #include <hardware/audio.h>
20 
21 #include <bitset>
22 #include <vector>
23 
24 #include "le_audio_types.h"
25 
26 namespace le_audio {
27 namespace utils {
28 types::LeAudioContextType AudioContentToLeAudioContext(
29     audio_content_type_t content_type, audio_usage_t usage);
30 types::AudioContexts GetAllowedAudioContextsFromSourceMetadata(
31     const std::vector<struct playback_track_metadata>& source_metadata,
32     types::AudioContexts allowed_contexts);
33 types::AudioContexts GetAllowedAudioContextsFromSinkMetadata(
34     const std::vector<struct record_track_metadata>& source_metadata,
35     types::AudioContexts allowed_contexts);
36 std::vector<uint8_t> GetAllCcids(const types::AudioContexts& contexts);
37 
IsContextForAudioSource(types::LeAudioContextType c)38 static inline bool IsContextForAudioSource(types::LeAudioContextType c) {
39   if (c == types::LeAudioContextType::CONVERSATIONAL ||
40       c == types::LeAudioContextType::VOICEASSISTANTS ||
41       c == types::LeAudioContextType::LIVE ||
42       c == types::LeAudioContextType::GAME) {
43     return true;
44   }
45   return false;
46 }
47 
48 }  // namespace utils
49 }  // namespace le_audio
50