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_ICAPTURE_SESSION_H 17 #define OHOS_CAMERA_ICAPTURE_SESSION_H 18 19 #include <cstdint> 20 #include "icamera_device_service.h" 21 #include "icapture_session_callback.h" 22 #include "iremote_broker.h" 23 #include "istream_common.h" 24 #include "camera_photo_proxy.h" 25 #include "ability/camera_ability.h" 26 27 namespace OHOS::Media { 28 class Picture; 29 } 30 namespace OHOS { 31 namespace CameraStandard { 32 enum class CaptureSessionState : uint32_t { 33 SESSION_INIT = 0, 34 SESSION_CONFIG_INPROGRESS = 1, 35 SESSION_CONFIG_COMMITTED = 2, 36 SESSION_RELEASED = 3, 37 SESSION_STARTED = 4, 38 SESSION_STATE_MAX = 5 39 }; 40 41 class ICaptureSession : public IRemoteBroker { 42 public: 43 virtual int32_t BeginConfig() = 0; 44 45 virtual int32_t AddInput(sptr<ICameraDeviceService> cameraDevice) = 0; 46 47 virtual int32_t CanAddInput(sptr<ICameraDeviceService> cameraDevice, bool& result) = 0; 48 49 virtual int32_t AddOutput(StreamType streamType, sptr<IStreamCommon> stream) = 0; 50 51 virtual int32_t RemoveInput(sptr<ICameraDeviceService> cameraDevice) = 0; 52 53 virtual int32_t RemoveOutput(StreamType streamType, sptr<IStreamCommon> stream) = 0; 54 55 virtual int32_t CommitConfig() = 0; 56 57 virtual int32_t Start() = 0; 58 59 virtual int32_t Stop() = 0; 60 61 virtual int32_t Release() = 0; 62 63 virtual int32_t SetCallback(sptr<ICaptureSessionCallback> &callback) = 0; 64 65 virtual int32_t GetSessionState(CaptureSessionState &sessionState) = 0; 66 67 virtual int32_t SetSmoothZoom(int32_t smoothZoomType, int32_t operationMode, 68 float targetZoomRatio, float &duration) = 0; 69 70 virtual int32_t GetActiveColorSpace(ColorSpace& colorSpace) = 0; 71 72 virtual int32_t SetColorSpace(ColorSpace colorSpace, ColorSpace captureColorSpace, bool isNeedUpdate) = 0; 73 74 virtual int32_t SetFeatureMode(int32_t featureMode) = 0; 75 76 virtual int32_t EnableMovingPhoto(bool isEnable) = 0; 77 78 virtual int32_t EnableMovingPhotoMirror(bool isMirror, bool isConfig) = 0; 79 80 virtual int32_t CreateMediaLibrary(sptr<CameraPhotoProxy> &photoProxy, 81 std::string &uri, int32_t &cameraShotType, std::string &burstKey, int64_t timestamp) = 0; 82 83 virtual int32_t CreateMediaLibrary(std::unique_ptr<Media::Picture> picture, sptr<CameraPhotoProxy> &photoProxy, 84 std::string &uri, int32_t &cameraShotType, std::string &burstKey, int64_t timestamp) = 0; 85 virtual int32_t SetPreviewRotation(std::string &deviceClass) = 0; 86 87 DECLARE_INTERFACE_DESCRIPTOR(u"ICaptureSession"); 88 }; 89 } // namespace CameraStandard 90 } // namespace OHOS 91 #endif // OHOS_CAMERA_ICAPTURE_SESSION_H 92