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 CAMERA_IMAGE_SOURCE_PROXY_H 17 #define CAMERA_IMAGE_SOURCE_PROXY_H 18 19 #include "image_source_interface.h" 20 #include "camera_dynamic_loader.h" 21 22 namespace OHOS { 23 namespace CameraStandard { 24 class ImageSourceProxy : public ImageSourceIntf { 25 public: 26 explicit ImageSourceProxy( 27 std::shared_ptr<Dynamiclib> imageLib, std::shared_ptr<ImageSourceIntf> imageSourceIntf); 28 29 ~ImageSourceProxy() override; 30 static std::shared_ptr<ImageSourceProxy> CreateImageSourceProxy(); 31 int32_t CreateImageSource(const uint8_t *data, uint32_t size, const Media::SourceOptions& opts, 32 uint32_t& errorCode) override; 33 std::unique_ptr<Media::PixelMap> CreatePixelMap(const Media::DecodeOptions& opts, uint32_t& errorCode) override; 34 35 private: 36 // Keep the order of members in this class, the bottom member will be destroyed first 37 std::shared_ptr<Dynamiclib> imageLib_ = {nullptr}; 38 std::shared_ptr<ImageSourceIntf> imageSourceIntf_ = {nullptr}; 39 }; 40 } // namespace CameraStandard 41 } // namespace OHOS 42 #endif // CAMERA_IMAGE_SOURCE_PROXY_H