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 #ifndef HPAE_PLUGIN_NODE_H 16 #define HPAE_PLUGIN_NODE_H 17 #include <memory> 18 #include "hpae_node.h" 19 20 namespace OHOS { 21 namespace AudioStandard { 22 namespace HPAE { 23 24 class HpaePluginNode : public OutputNode<HpaePcmBuffer *>, public InputNode<HpaePcmBuffer *> { 25 public: 26 HpaePluginNode(HpaeNodeInfo& nodeInfo); ~HpaePluginNode()27 virtual ~HpaePluginNode() {}; 28 virtual void DoProcess() override; 29 virtual bool Reset() override; 30 virtual bool ResetAll() override; 31 32 std::shared_ptr<HpaeNode> GetSharedInstance() override; 33 OutputPort<HpaePcmBuffer*>* GetOutputPort() override; 34 void Connect(const std::shared_ptr<OutputNode<HpaePcmBuffer*>>& preNode) override; 35 void DisConnect(const std::shared_ptr<OutputNode<HpaePcmBuffer*>>& preNode) override; 36 virtual size_t GetPreOutNum(); 37 virtual size_t GetOutputPortNum(); 38 virtual int32_t EnableProcess(bool enable); 39 virtual bool IsEnableProcess(); 40 HpaePluginNode(const HpaePluginNode& others) = delete; 41 void SetSourceNode(bool isSourceNode); 42 private: 43 PcmBufferInfo pcmBufferInfo_; 44 protected: 45 virtual HpaePcmBuffer* SignalProcess(const std::vector<HpaePcmBuffer*>& inputs) = 0; 46 OutputPort<HpaePcmBuffer *> outputStream_; 47 InputPort<HpaePcmBuffer*> inputStream_; 48 bool enableProcess_; 49 HpaePcmBuffer silenceData_; 50 bool isSourceNode_ = false; 51 }; 52 } // namespace HPAE 53 } // namespace AudioStandard 54 } // namespace OHOS 55 #endif