1 /* 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ST_AUDIO_CONFIG_H 17 #define ST_AUDIO_CONFIG_H 18 19 #include <list> 20 #include <set> 21 #include <string> 22 #include <vector> 23 24 #include "audio_info.h" 25 #include "audio_policy_log.h" 26 27 namespace OHOS { 28 namespace AudioStandard { 29 static const std::string PRIMARY_CLASS = "primary"; 30 static const std::string A2DP_CLASS = "a2dp"; 31 static const std::string USB_CLASS = "usb"; 32 static const std::string DP_CLASS = "dp"; 33 static const std::string FILE_CLASS = "file_io"; 34 static const std::string REMOTE_CLASS = "remote"; 35 static const std::string OFFLOAD_CLASS = "offload"; 36 static const std::string MCH_CLASS = "multichannel"; 37 static const std::string INVALID_CLASS = "invalid"; 38 static const std::string BLUETOOTH_SPEAKER = "Bt_Speaker"; 39 static const std::string PRIMARY_SPEAKER = "Speaker"; 40 static const std::string OFFLOAD_PRIMARY_SPEAKER = "Offload_Speaker"; 41 static const std::string MCH_PRIMARY_SPEAKER = "MCH_Speaker"; 42 static const std::string USB_SPEAKER = "Usb_arm_speaker"; 43 static const std::string DP_SINK = "DP_speaker"; 44 static const std::string USB_MIC = "Usb_arm_mic"; 45 static const std::string PRIMARY_MIC = "Built_in_mic"; 46 static const std::string PRIMARY_WAKEUP_MIC = "Built_in_wakeup"; 47 static const std::string FILE_SINK = "file_sink"; 48 static const std::string FILE_SOURCE = "file_source"; 49 static const std::string PIPE_SINK = "fifo_output"; 50 static const std::string PIPE_SOURCE = "fifo_input"; 51 static const std::string INTERNAL_PORT = "internal"; 52 static const std::string ROLE_SOURCE = "source"; 53 static const std::string ROLE_SINK = "sink"; 54 static const std::string PORT_NONE = "none"; 55 56 const std::vector<std::string> SourceNames = { 57 std::string(PRIMARY_MIC), 58 std::string(USB_MIC), 59 std::string(PRIMARY_WAKEUP), 60 std::string(FILE_SOURCE) 61 }; 62 63 enum NodeName { 64 DEVICE_CLASS, 65 MODULES, 66 MODULE, 67 PORTS, 68 PORT, 69 AUDIO_INTERRUPT_ENABLE, 70 UPDATE_ROUTE_SUPPORT, 71 AUDIO_LATENCY, 72 SINK_LATENCY, 73 VOLUME_GROUP_CONFIG, 74 INTERRUPT_GROUP_CONFIG, 75 UNKNOWN 76 }; 77 78 enum ClassType { 79 TYPE_PRIMARY, 80 TYPE_A2DP, 81 TYPE_USB, 82 TYPE_FILE_IO, 83 TYPE_REMOTE_AUDIO, 84 TYPE_DP, 85 TYPE_INVALID 86 }; 87 88 struct AudioModuleInfo { 89 public: 90 AudioModuleInfo() = default; 91 virtual ~AudioModuleInfo() = default; 92 93 std::string className; 94 std::string name; 95 std::string adapterName; 96 std::string id; 97 std::string lib; 98 std::string role; 99 100 std::string rate; 101 102 std::set<uint32_t> supportedRate_; 103 std::set<uint32_t> supportedChannels_; 104 105 std::string format; 106 std::string channels; 107 std::string bufferSize; 108 std::string fixedLatency; 109 std::string sinkLatency; 110 std::string renderInIdleState; 111 std::string OpenMicSpeaker; 112 std::string fileName; 113 std::string networkId; 114 std::string deviceType; 115 std::string sceneName; 116 std::string sourceType; 117 std::string offloadEnable; 118 std::list<AudioModuleInfo> ports; 119 std::string extra; 120 }; 121 122 } // namespace AudioStandard 123 } // namespace OHOS 124 125 #endif // ST_AUDIO_CONFIG_H 126