1 /* 2 * Copyright (c) 2021-2022 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 OHOS_CAMERA_ICAMERA_SERVICE_H 17 #define OHOS_CAMERA_ICAMERA_SERVICE_H 18 19 #include <set> 20 #include "camera_metadata_info.h" 21 #include "icamera_service_callback.h" 22 #include "icamera_device_service.h" 23 #include "icapture_session.h" 24 #include "iremote_broker.h" 25 #include "istream_capture.h" 26 #include "istream_depth_data.h" 27 #include "istream_metadata.h" 28 #include "istream_repeat.h" 29 #include "surface.h" 30 #include "ideferred_photo_processing_session.h" 31 #include "ideferred_photo_processing_session_callback.h" 32 #include "ideferred_video_processing_session.h" 33 #include "ideferred_video_processing_session_callback.h" 34 35 namespace OHOS { 36 namespace CameraStandard { 37 enum RestoreParamTypeOhos { 38 NO_NEED_RESTORE_PARAM_OHOS = 0, 39 PERSISTENT_DEFAULT_PARAM_OHOS = 1, 40 TRANSIENT_ACTIVE_PARAM_OHOS = 2, 41 }; 42 43 struct EffectParam { 44 int skinSmoothLevel; 45 int faceSlender; 46 int skinTone; 47 }; 48 49 enum class PolicyType : int32_t { 50 EDM = 0, 51 PRIVACY = 1, 52 }; 53 54 class ICameraBroker : public IRemoteBroker { 55 public: 56 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Anco.Service.Camera"); 57 58 virtual int32_t NotifyCloseCamera(std::string cameraId) = 0; 59 virtual int32_t NotifyMuteCamera(bool muteMode) = 0; 60 }; 61 62 class ICameraService : public IRemoteBroker { 63 public: 64 virtual int32_t CreateCameraDevice(std::string cameraId, sptr<ICameraDeviceService>& device) = 0; 65 66 virtual int32_t SetCameraCallback(sptr<ICameraServiceCallback>& callback) = 0; 67 68 virtual int32_t SetMuteCallback(sptr<ICameraMuteServiceCallback>& callback) = 0; 69 70 virtual int32_t SetTorchCallback(sptr<ITorchServiceCallback>& callback) = 0; 71 72 virtual int32_t SetFoldStatusCallback(sptr<IFoldServiceCallback>& callback, bool isInnerCallback = false) = 0; 73 74 virtual int32_t GetCameras(std::vector<std::string> &cameraIds, 75 std::vector<std::shared_ptr<OHOS::Camera::CameraMetadata>> &cameraAbilityList) = 0; 76 77 virtual int32_t GetCameraIds(std::vector<std::string>& cameraIds) = 0; 78 79 virtual int32_t GetCameraAbility(std::string& cameraId, 80 std::shared_ptr<OHOS::Camera::CameraMetadata>& cameraAbility) = 0; 81 82 virtual int32_t CreateCaptureSession(sptr<ICaptureSession> &session, int32_t operationMode = 0) = 0; 83 84 virtual int32_t CreateDeferredPhotoProcessingSession(int32_t userId, 85 sptr<DeferredProcessing::IDeferredPhotoProcessingSessionCallback>& callback, 86 sptr<DeferredProcessing::IDeferredPhotoProcessingSession>& session) = 0; 87 88 virtual int32_t CreateDeferredVideoProcessingSession(int32_t userId, 89 sptr<DeferredProcessing::IDeferredVideoProcessingSessionCallback>& callback, 90 sptr<DeferredProcessing::IDeferredVideoProcessingSession>& session) = 0; 91 92 virtual int32_t CreatePhotoOutput(const sptr<OHOS::IBufferProducer> &producer, int32_t format, 93 int32_t width, int32_t height, sptr<IStreamCapture> &photoOutput) = 0; 94 95 virtual int32_t CreatePreviewOutput(const sptr<OHOS::IBufferProducer> &producer, int32_t format, 96 int32_t width, int32_t height, sptr<IStreamRepeat> &previewOutput) = 0; 97 98 virtual int32_t CreateDeferredPreviewOutput(int32_t format, int32_t width, int32_t height, 99 sptr<IStreamRepeat> &previewOutput) = 0; 100 101 virtual int32_t CreateDepthDataOutput(const sptr<OHOS::IBufferProducer> &producer, int32_t format, 102 int32_t width, int32_t height, sptr<IStreamDepthData> &depthDataOutput) = 0; 103 104 virtual int32_t CreateMetadataOutput(const sptr<OHOS::IBufferProducer> &producer, int32_t format, 105 std::vector<int32_t> metadataTypes, 106 sptr<IStreamMetadata> &metadataOutput) = 0; 107 108 virtual int32_t CreateVideoOutput(const sptr<OHOS::IBufferProducer> &producer, int32_t format, 109 int32_t width, int32_t height, sptr<IStreamRepeat> &videoOutput) = 0; 110 111 virtual int32_t SetListenerObject(const sptr<IRemoteObject> &object) = 0; 112 113 virtual int32_t MuteCamera(bool muteMode) = 0; 114 115 virtual int32_t MuteCameraPersist(PolicyType policyType, bool isMute) = 0; 116 117 virtual int32_t PrelaunchCamera() = 0; 118 119 virtual int32_t PreSwitchCamera(const std::string cameraId) = 0; 120 121 virtual int32_t SetPrelaunchConfig(std::string cameraId, RestoreParamTypeOhos restoreParamType, int activeTime, 122 EffectParam effectParam) = 0; 123 124 virtual int32_t IsCameraMuted(bool &muteMode) = 0; 125 126 virtual int32_t SetTorchLevel(float level) = 0; 127 128 virtual int32_t AllowOpenByOHSide(std::string cameraId, int32_t state, bool &canOpenCamera) = 0; 129 130 virtual int32_t NotifyCameraState(std::string cameraId, int32_t state) = 0; 131 132 virtual int32_t SetPeerCallback(sptr<ICameraBroker>& callback) = 0; 133 134 virtual int32_t UnsetPeerCallback() = 0; 135 136 virtual int32_t DestroyStubObj() = 0; 137 138 virtual int32_t ProxyForFreeze(const std::set<int32_t>& pidList, bool isProxy) = 0; 139 140 virtual int32_t ResetAllFreezeStatus() = 0; 141 142 virtual int32_t GetDmDeviceInfo(std::vector<std::string> &deviceInfos) = 0; 143 144 virtual int32_t GetCameraOutputStatus(int32_t pid, int32_t &status) = 0; 145 146 virtual int32_t RequireMemorySize(int32_t memSize) = 0; 147 148 DECLARE_INTERFACE_DESCRIPTOR(u"ICameraService"); 149 }; 150 } // namespace CameraStandard 151 } // namespace OHOS 152 #endif // OHOS_CAMERA_ICAMERA_SERVICE_H 153