/* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OHOS_DCAMERA_CLIENT_H #define OHOS_DCAMERA_CLIENT_H #include "icamera_operator.h" #include #include "camera_info.h" #include "camera_input.h" #include "camera_manager.h" #include "camera_output_capability.h" #include "capture_input.h" #include "capture_output.h" #include "capture_session.h" #include "photo_output.h" #include "preview_output.h" #include "dcamera_photo_surface_listener.h" namespace OHOS { namespace DistributedHardware { class DCameraClient : public ICameraOperator { public: explicit DCameraClient(const std::string& dhId); ~DCameraClient() override; int32_t Init() override; int32_t UnInit() override; int32_t UpdateSettings(std::vector>& settings) override; int32_t StartCapture(std::vector>& captureInfos, sptr& surface, int32_t sceneMode) override; int32_t StopCapture() override; int32_t SetStateCallback(std::shared_ptr& callback) override; int32_t SetResultCallback(std::shared_ptr& callback) override; int32_t PauseCapture() override; int32_t ResumeCapture() override; private: int32_t ConfigCaptureSession(std::vector>& captureInfos, int32_t sceneMode); int32_t ConfigCaptureSessionInner(); int32_t CreateCaptureOutput(std::vector>& captureInfos); int32_t CreatePhotoOutput(std::shared_ptr& info); int32_t CreatePreviewOutput(std::shared_ptr& info); int32_t StartCaptureInner(std::shared_ptr& info); int32_t StartPhotoOutput(std::shared_ptr& info); void FindCameraMetadata(const std::string& metadataStr); void SetPhotoCaptureRotation(const std::shared_ptr& cameraMetadata, std::shared_ptr& photoCaptureSetting); void SetPhotoCaptureQuality(const std::shared_ptr& cameraMetadata, std::shared_ptr& photoCaptureSetting); void SetPhotoCaptureLocation(const std::shared_ptr& cameraMetadata, std::shared_ptr& photoCaptureSetting); void StopOutput(); void ReleaseCaptureSession(); int32_t CameraServiceErrorType(const int32_t errorType); CameraStandard::CameraFormat ConvertToCameraFormat(int32_t format); void UpdateSettingCache(const std::string& metadataStr); private: constexpr static uint32_t DCAMERA_MAX_METADATA_SIZE = 20; bool isInit_; std::string cameraId_; std::queue cameraMetadatas_; sptr photoSurface_; sptr previewSurface_; sptr cameraInfo_; sptr cameraManager_; sptr captureSession_; sptr cameraInput_; sptr photoOutput_; sptr previewOutput_; sptr photoListener_; std::shared_ptr stateCallback_; std::shared_ptr resultCallback_; }; } // namespace DistributedHardware } // namespace OHOS #endif // OHOS_DCAMERA_CLIENT_H