1 /* 2 * Copyright (c) 2025 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 PIPE_INFO_H 17 #define PIPE_INFO_H 18 #define HDI_INVALID_ID 0xFFFFFFFF 19 20 #include <memory> 21 #include "parcel.h" 22 23 #include "audio_module_info.h" 24 #include "audio_stream_descriptor.h" 25 26 namespace OHOS { 27 namespace AudioStandard { 28 29 enum AudioPipeAction { 30 PIPE_ACTION_DEFAULT = 0, 31 PIPE_ACTION_NEW, 32 PIPE_ACTION_UPDATE, 33 }; 34 35 class AudioPipeInfo { 36 public: 37 uint32_t id_ = HDI_INVALID_ID; 38 39 uint32_t paIndex_ = 0; 40 41 AudioPipeRole pipeRole_ = PIPE_ROLE_OUTPUT; 42 43 std::string name_ = "undefine"; 44 45 uint32_t routeFlag_ = 0; 46 47 std::string adapterName_ = ""; 48 49 AudioModuleInfo moduleInfo_ = {}; 50 AudioStreamInfo audioStreamInfo_ = {}; 51 void InitAudioStreamInfo(); 52 53 AudioPipeAction pipeAction_ = PIPE_ACTION_DEFAULT; 54 55 bool softLinkFlag_ = false; 56 57 std::vector<std::shared_ptr<AudioStreamDescriptor>> streamDescriptors_ = {}; 58 59 std::unordered_map<uint32_t, std::shared_ptr<AudioStreamDescriptor>> streamDescMap_ = {}; 60 61 AudioPipeInfo(); 62 63 virtual ~AudioPipeInfo(); 64 65 AudioPipeInfo(const std::shared_ptr<AudioPipeInfo> pipeInfo); 66 67 void Dump(std::string &dumpString); 68 69 std::string ToString(); 70 71 private: IsOutput()72 bool IsOutput() 73 { 74 return pipeRole_ == PIPE_ROLE_OUTPUT; 75 } 76 77 void DumpCommonAttrs(std::string &dumpString); 78 79 void DumpOutputAttrs(std::string &dumpString); 80 81 void DumpInputAttrs(std::string &dumpString); 82 }; 83 } // namespace AudioStandard 84 } // namespace OHOS 85 #endif // PIPE_INFO_H 86