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 HPAE_SOURCE_PROCESS_CLUSTER_H 17 #define HPAE_SOURCE_PROCESS_CLUSTER_H 18 #include "hpae_capture_effect_node.h" 19 #include "hpae_audio_format_converter_node.h" 20 21 namespace OHOS { 22 namespace AudioStandard { 23 namespace HPAE { 24 class HpaeSourceProcessCluster : public OutputNode<HpaePcmBuffer *>, public InputNode<HpaePcmBuffer *> { 25 public: 26 HpaeSourceProcessCluster(HpaeNodeInfo &nodeInfo); 27 virtual ~HpaeSourceProcessCluster(); 28 virtual void DoProcess() override; 29 virtual bool Reset() override; 30 virtual bool ResetAll() override; 31 std::shared_ptr<HpaeNode> GetSharedInstance() override; 32 std::shared_ptr<HpaeNode> GetSharedInstance(HpaeNodeInfo &nodeInfo) override; 33 OutputPort<HpaePcmBuffer *> *GetOutputPort() override; 34 OutputPort<HpaePcmBuffer *> *GetOutputPort(HpaeNodeInfo &nodeInfo, bool isDisConnect = false) override; 35 36 // HpaeNodeInfo& GetOutputNodeInfo() override; 37 void Connect(const std::shared_ptr<OutputNode<HpaePcmBuffer*>>& preNode) override; 38 void DisConnect(const std::shared_ptr<OutputNode<HpaePcmBuffer*>>& preNode) override; 39 void ConnectWithInfo(const std::shared_ptr<OutputNode<HpaePcmBuffer*>>& preNode, HpaeNodeInfo &nodeInfo) override; 40 void DisConnectWithInfo(const std::shared_ptr<OutputNode<HpaePcmBuffer*>>& preNode, 41 HpaeNodeInfo &nodeInfo) override; 42 bool GetCapturerEffectConfig(HpaeNodeInfo& nodeInfo, HpaeSourceBufferType type = HPAE_SOURCE_BUFFER_TYPE_MIC); 43 44 size_t GetOutputPortNum(); 45 int32_t CaptureEffectCreate(uint64_t sceneKeyCode, CaptureEffectAttr attr); 46 int32_t CaptureEffectRelease(uint64_t sceneKeyCode); 47 48 // for ut test 49 uint32_t GetCapturerEffectNodeUseCount(); 50 uint32_t GetConverterNodeCount(); 51 size_t GetPreOutNum(); 52 private: 53 std::shared_ptr<HpaeCaptureEffectNode> captureEffectNode_; 54 std::unordered_map<std::string, std::shared_ptr<HpaeAudioFormatConverterNode>> fmtConverterNodeMap_; 55 }; 56 } // namespace HPAE 57 } // namespace AudioStandard 58 } // namespace OHOS 59 #endif