1 /* 2 * Copyright (c) 2021 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 * http://www.apache.org/licenses/LICENSE-2.0 7 * Unless required by applicable law or agreed to in writing, software 8 * distributed under the License is distributed on an "AS IS" BASIS, 9 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 * See the License for the specific language governing permissions and 11 * limitations under the License. 12 */ 13 14 #ifndef HOS_CAMERA_RKSCALE_NODE_H 15 #define HOS_CAMERA_RKSCALE_NODE_H 16 17 #include <vector> 18 #include <condition_variable> 19 #include <ctime> 20 #include <mutex> 21 #include "device_manager_adapter.h" 22 #include "utils.h" 23 #include "camera.h" 24 #include "source_node.h" 25 #include "RockchipRga.h" 26 #include "RgaUtils.h" 27 #include "RgaApi.h" 28 #include "rk_mpi.h" 29 #include "mpp_env.h" 30 #include "mpp_mem.h" 31 #include "mpp_log.h" 32 #include "mpp_common.h" 33 34 namespace OHOS::Camera { 35 class RKScaleNode : public NodeBase { 36 public: 37 RKScaleNode(const std::string& name, const std::string& type, const std::string &cameraId); 38 ~RKScaleNode() override; 39 RetCode Start(const int32_t streamId) override; 40 RetCode Stop(const int32_t streamId) override; 41 void DeliverBuffer(std::shared_ptr<IBuffer>& buffer) override; 42 virtual RetCode Capture(const int32_t streamId, const int32_t captureId) override; 43 RetCode CancelCapture(const int32_t streamId) override; 44 RetCode Flush(const int32_t streamId); 45 private: 46 void PreviewScaleConver(std::shared_ptr<IBuffer>& buffer); 47 void ScaleConver(std::shared_ptr<IBuffer>& buffer); 48 std::vector<std::shared_ptr<IPort>> outPutPorts_; 49 std::shared_ptr<IBufferPool> bufferPool_ = nullptr; // buffer pool of branch stream 50 }; 51 } // namespace OHOS::Camera 52 #endif 53