• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-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 OHOS_CAPTURE_SESSION_IMPL_H
17 #define OHOS_CAPTURE_SESSION_IMPL_H
18 
19 #include "input/camera_manager.h"
20 #include "kits/native/include/camera/camera.h"
21 #include "kits/native/include/camera/capture_session.h"
22 #include "session/capture_session.h"
23 #include "camera_input_impl.h"
24 #include "preview_output_impl.h"
25 #include "video_output_impl.h"
26 #include "photo_output_impl.h"
27 #include "metadata_output_impl.h"
28 
29 struct Camera_CaptureSession {
30 public:
31     explicit Camera_CaptureSession(OHOS::sptr<OHOS::CameraStandard::CaptureSession> &innerCaptureSession);
32     ~Camera_CaptureSession();
33 
34     Camera_ErrorCode RegisterCallback(CaptureSession_Callbacks* callback);
35 
36     Camera_ErrorCode UnregisterCallback(CaptureSession_Callbacks* callback);
37 
38     Camera_ErrorCode RegisterSmoothZoomInfoCallback(OH_CaptureSession_OnSmoothZoomInfo smoothZoomInfoCallback);
39 
40     Camera_ErrorCode UnregisterSmoothZoomInfoCallback(OH_CaptureSession_OnSmoothZoomInfo smoothZoomInfoCallback);
41 
42     Camera_ErrorCode SetSessionMode(Camera_SceneMode sceneMode);
43 
44     Camera_ErrorCode AddSecureOutput(Camera_PreviewOutput* previewOutput);
45 
46     Camera_ErrorCode BeginConfig();
47 
48     Camera_ErrorCode CommitConfig();
49 
50     Camera_ErrorCode AddInput(Camera_Input* cameraInput);
51 
52     Camera_ErrorCode RemoveInput(Camera_Input* cameraInput);
53 
54     Camera_ErrorCode AddPreviewOutput(Camera_PreviewOutput* previewOutput);
55 
56     Camera_ErrorCode RemovePreviewOutput(Camera_PreviewOutput* previewOutput);
57 
58     Camera_ErrorCode AddPhotoOutput(Camera_PhotoOutput* photoOutput);
59 
60     Camera_ErrorCode RemovePhotoOutput(Camera_PhotoOutput* photoOutput);
61 
62     Camera_ErrorCode AddVideoOutput(Camera_VideoOutput* videoOutput);
63 
64     Camera_ErrorCode RemoveVideoOutput(Camera_VideoOutput* videoOutput);
65 
66     Camera_ErrorCode AddMetaDataOutput(Camera_MetadataOutput* metadataOutput);
67 
68     Camera_ErrorCode RemoveMetaDataOutput(Camera_MetadataOutput* metadataOutput);
69 
70     Camera_ErrorCode IsVideoStabilizationModeSupported(Camera_VideoStabilizationMode mode, bool* isSupported);
71 
72     Camera_ErrorCode GetVideoStabilizationMode(Camera_VideoStabilizationMode* mode);
73 
74     Camera_ErrorCode SetVideoStabilizationMode(Camera_VideoStabilizationMode mode);
75 
76     Camera_ErrorCode GetZoomRatioRange(float* minZoom, float* maxZoom);
77 
78     Camera_ErrorCode GetZoomRatio(float* zoom);
79 
80     Camera_ErrorCode SetZoomRatio(float zoom);
81 
82     Camera_ErrorCode SetSmoothZoom(float targetZoom, Camera_SmoothZoomMode smoothZoomMode);
83 
84     Camera_ErrorCode IsFocusModeSupported(Camera_FocusMode focusMode, bool* isSupported);
85 
86     Camera_ErrorCode GetFocusMode(Camera_FocusMode* focusMode);
87 
88     Camera_ErrorCode SetFocusMode(Camera_FocusMode focusMode);
89 
90     Camera_ErrorCode SetQualityPrioritization(Camera_QualityPrioritization qualityPrioritization);
91 
92     Camera_ErrorCode SetFocusPoint(Camera_Point focusPoint);
93 
94     Camera_ErrorCode GetFocusPoint(Camera_Point* focusPoint);
95 
96     Camera_ErrorCode GetFocalLength(float* focalLength);
97 
98     Camera_ErrorCode HasFlash(bool* hasFlash);
99 
100     Camera_ErrorCode IsFlashModeSupported(Camera_FlashMode flashMode, bool* isSupported);
101 
102     Camera_ErrorCode GetFlashMode(Camera_FlashMode* flashMode);
103 
104     Camera_ErrorCode SetFlashMode(Camera_FlashMode flashMode);
105 
106     Camera_ErrorCode IsExposureModeSupported(Camera_ExposureMode exposureMode, bool* isSupported);
107 
108     Camera_ErrorCode GetExposureMode(Camera_ExposureMode* exposureMode);
109 
110     Camera_ErrorCode SetExposureMode(Camera_ExposureMode exposureMode);
111 
112     Camera_ErrorCode GetMeteringPoint(Camera_Point* point);
113 
114     Camera_ErrorCode SetMeteringPoint(Camera_Point point);
115 
116     Camera_ErrorCode GetExposureBiasRange(float* minExposureBias, float* maxExposureBias, float* step);
117 
118     Camera_ErrorCode SetExposureBias(float exposureBias);
119 
120     Camera_ErrorCode GetExposureBias(float* exposureBias);
121 
122     Camera_ErrorCode GetExposureValue(float* exposureValue);
123 
124     Camera_ErrorCode GetSupportedColorSpaces(OH_NativeBuffer_ColorSpace** colorSpace, uint32_t* size);
125 
126     Camera_ErrorCode GetActiveColorSpace(OH_NativeBuffer_ColorSpace* colorSpace);
127 
128     Camera_ErrorCode DeleteColorSpaces(OH_NativeBuffer_ColorSpace* colorSpace);
129 
130     Camera_ErrorCode GetSupportedEffectTypes(Camera_ControlCenterEffectType** types, uint32_t* size);
131 
132     Camera_ErrorCode DeleteEffectTypes(Camera_ControlCenterEffectType* types);
133 
134     Camera_ErrorCode EnableControlCenter(bool enabled);
135 
136     Camera_ErrorCode SetActiveColorSpace(OH_NativeBuffer_ColorSpace colorSpace);
137 
138     Camera_ErrorCode Start();
139 
140     Camera_ErrorCode Stop();
141 
142     Camera_ErrorCode Release();
143 
144     Camera_ErrorCode CanAddInput(Camera_Input* cameraInput, bool* isSuccessful);
145 
146     Camera_ErrorCode CanAddPreviewOutput(Camera_PreviewOutput* previewOutput, bool* isSuccessful);
147 
148     Camera_ErrorCode CanAddPhotoOutput(Camera_PhotoOutput* photoOutput, bool* isSuccessful);
149 
150     Camera_ErrorCode CanAddVideoOutput(Camera_VideoOutput* cameraOutput, bool* isSuccessful);
151 
152     Camera_ErrorCode CanPreconfig(Camera_PreconfigType preconfigType, bool* canPreconfig);
153 
154     Camera_ErrorCode CanPreconfigWithRatio(Camera_PreconfigType preconfigType, Camera_PreconfigRatio preconfigRatio,
155         bool* canPreconfig);
156 
157     Camera_ErrorCode Preconfig(Camera_PreconfigType preconfigType);
158 
159     Camera_ErrorCode PreconfigWithRatio(Camera_PreconfigType preconfigType, Camera_PreconfigRatio preconfigRatio);
160 
161     Camera_ErrorCode RegisterAutoDeviceSwitchStatusCallback(
162         OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange);
163 
164     Camera_ErrorCode UnregisterAutoDeviceSwitchStatusCallback(
165         OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange);
166 
167     Camera_ErrorCode RegisterSystemPressureLevelCallback(
168         OH_CaptureSession_OnSystemPressureLevelChange systemPressureLevel);
169 
170     Camera_ErrorCode UnRegisterSystemPressureLevelCallback(
171         OH_CaptureSession_OnSystemPressureLevelChange systemPressureLevel);
172 
173     Camera_ErrorCode RegisterControlCenterEffectStatusChangeCallback(
174         OH_CaptureSession_OnControlCenterEffectStatusChange controlCenterStatusChange);
175 
176     Camera_ErrorCode UnregisterControlCenterEffectStatusChangeCallback(
177         OH_CaptureSession_OnControlCenterEffectStatusChange controlCenterStatusChange);
178 
179     Camera_ErrorCode IsAutoDeviceSwitchSupported(bool* isSupported);
180 
181     Camera_ErrorCode IsControlCenterSupported(bool* isSupported);
182 
183     Camera_ErrorCode EnableAutoDeviceSwitch(bool enabled);
184 
185     Camera_ErrorCode IsMacroSupported(bool* isSupported);
186 
187     Camera_ErrorCode EnableMacro(bool enabled);
188 
189     Camera_ErrorCode IsWhiteBalanceModeSupported(
190             Camera_WhiteBalanceMode whiteBalanceMode, bool* isSupported);
191 
192     Camera_ErrorCode GetWhiteBalanceMode(Camera_WhiteBalanceMode* whiteBalanceMode);
193 
194     Camera_ErrorCode GetWhiteBalanceRange(int32_t *minColorTemperature, int32_t *maxColorTemperature);
195 
196     Camera_ErrorCode GetWhiteBalance(int32_t *colorTemperature);
197 
198     Camera_ErrorCode SetWhiteBalance(int32_t colorTemperature);
199 
200     Camera_ErrorCode SetWhiteBalanceMode(Camera_WhiteBalanceMode whiteBalanceMode);
201 
202     Camera_ErrorCode RegisterMacroStatusCallback(OH_CaptureSession_OnMacroStatusChange controlMacroStatusChange);
203 
204     Camera_ErrorCode UnregisterMacroStatusCallback(OH_CaptureSession_OnMacroStatusChange controlMacroStatusChange);
205 
206 private:
207     OHOS::sptr<OHOS::CameraStandard::CaptureSession> innerCaptureSession_;
208 };
209 #endif // OHOS_CAPTURE_SESSION_IMPL_H