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 #include "kits/native/include/camera/capture_session.h"
17 #include "camera.h"
18 #include "impl/capture_session_impl.h"
19 #include "camera_log.h"
20 #include "hilog/log.h"
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
OH_CaptureSession_RegisterCallback(Camera_CaptureSession * session,CaptureSession_Callbacks * callback)26 Camera_ErrorCode OH_CaptureSession_RegisterCallback(Camera_CaptureSession* session, CaptureSession_Callbacks* callback)
27 {
28 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
29 CHECK_RETURN_RET_ELOG(callback == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, callback is null!");
30 CHECK_RETURN_RET_ELOG(callback->onFocusStateChange == nullptr && callback->onError == nullptr,
31 CAMERA_INVALID_ARGUMENT, "Invalid argument, callback onFocusStateChange and onError are null!");
32
33 session->RegisterCallback(callback);
34 return CAMERA_OK;
35 }
36
OH_CaptureSession_UnregisterCallback(Camera_CaptureSession * session,CaptureSession_Callbacks * callback)37 Camera_ErrorCode OH_CaptureSession_UnregisterCallback(Camera_CaptureSession* session,
38 CaptureSession_Callbacks* callback)
39 {
40 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
41 CHECK_RETURN_RET_ELOG(callback == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, callback is null!");
42 CHECK_RETURN_RET_ELOG(callback->onFocusStateChange == nullptr && callback->onError == nullptr,
43 CAMERA_INVALID_ARGUMENT, "Invalid argument, callback onFocusStateChange and onError are null!");
44
45 session->UnregisterCallback(callback);
46 return CAMERA_OK;
47 }
48
OH_CaptureSession_RegisterSmoothZoomInfoCallback(Camera_CaptureSession * session,OH_CaptureSession_OnSmoothZoomInfo smoothZoomInfoCallback)49 Camera_ErrorCode OH_CaptureSession_RegisterSmoothZoomInfoCallback(Camera_CaptureSession* session,
50 OH_CaptureSession_OnSmoothZoomInfo smoothZoomInfoCallback)
51 {
52 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
53 CHECK_RETURN_RET_ELOG(smoothZoomInfoCallback == nullptr, CAMERA_INVALID_ARGUMENT,
54 "Invalid argument, callback is null!");
55 session->RegisterSmoothZoomInfoCallback(smoothZoomInfoCallback);
56 return CAMERA_OK;
57 }
58
OH_CaptureSession_UnregisterSmoothZoomInfoCallback(Camera_CaptureSession * session,OH_CaptureSession_OnSmoothZoomInfo smoothZoomInfoCallback)59 Camera_ErrorCode OH_CaptureSession_UnregisterSmoothZoomInfoCallback(Camera_CaptureSession* session,
60 OH_CaptureSession_OnSmoothZoomInfo smoothZoomInfoCallback)
61 {
62 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
63 CHECK_RETURN_RET_ELOG(smoothZoomInfoCallback == nullptr, CAMERA_INVALID_ARGUMENT,
64 "Invalid argument, callback is null!");
65 session->UnregisterSmoothZoomInfoCallback(smoothZoomInfoCallback);
66 return CAMERA_OK;
67 }
68
69 /**
70 * @since 20
71 * @version 1.0
72 */
OH_CaptureSession_RegisterSystemPressureLevelChangeCallback(Camera_CaptureSession * session,OH_CaptureSession_OnSystemPressureLevelChange systemPressureLevel)73 Camera_ErrorCode OH_CaptureSession_RegisterSystemPressureLevelChangeCallback(Camera_CaptureSession* session,
74 OH_CaptureSession_OnSystemPressureLevelChange systemPressureLevel)
75 {
76 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
77 CHECK_RETURN_RET_ELOG(systemPressureLevel == nullptr, CAMERA_INVALID_ARGUMENT,
78 "Invalid argument, callback is null!");
79 return session->RegisterSystemPressureLevelCallback(systemPressureLevel);
80 }
81
82 /**
83 * @since 20
84 * @version 1.0
85 */
OH_CaptureSession_UnregisterSystemPressureLevelChangeCallback(Camera_CaptureSession * session,OH_CaptureSession_OnSystemPressureLevelChange systemPressureLevel)86 Camera_ErrorCode OH_CaptureSession_UnregisterSystemPressureLevelChangeCallback(Camera_CaptureSession* session,
87 OH_CaptureSession_OnSystemPressureLevelChange systemPressureLevel)
88 {
89 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
90 CHECK_RETURN_RET_ELOG(systemPressureLevel == nullptr, CAMERA_INVALID_ARGUMENT,
91 "Invalid argument, callback is null!");
92 session->UnRegisterSystemPressureLevelCallback(systemPressureLevel);
93 return CAMERA_OK;
94 }
95
OH_CaptureSession_SetSessionMode(Camera_CaptureSession * session,Camera_SceneMode sceneMode)96 Camera_ErrorCode OH_CaptureSession_SetSessionMode(Camera_CaptureSession* session, Camera_SceneMode sceneMode)
97 {
98 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
99
100 return session->SetSessionMode(sceneMode);
101 }
102
OH_CaptureSession_AddSecureOutput(Camera_CaptureSession * session,Camera_PreviewOutput * previewOutput)103 Camera_ErrorCode OH_CaptureSession_AddSecureOutput(Camera_CaptureSession* session, Camera_PreviewOutput* previewOutput)
104 {
105 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
106 CHECK_RETURN_RET_ELOG(previewOutput == nullptr,
107 CAMERA_INVALID_ARGUMENT, "Invalid argument, previewOutput is null!");
108 return session->AddSecureOutput(previewOutput);
109 }
110
OH_CaptureSession_BeginConfig(Camera_CaptureSession * session)111 Camera_ErrorCode OH_CaptureSession_BeginConfig(Camera_CaptureSession* session)
112 {
113 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
114
115 return session->BeginConfig();
116 }
117
OH_CaptureSession_CommitConfig(Camera_CaptureSession * session)118 Camera_ErrorCode OH_CaptureSession_CommitConfig(Camera_CaptureSession* session)
119 {
120 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
121
122 return session->CommitConfig();
123 }
124
OH_CaptureSession_AddInput(Camera_CaptureSession * session,Camera_Input * cameraInput)125 Camera_ErrorCode OH_CaptureSession_AddInput(Camera_CaptureSession* session, Camera_Input* cameraInput)
126 {
127 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
128 CHECK_RETURN_RET_ELOG(cameraInput == nullptr, CAMERA_INVALID_ARGUMENT,
129 "Invalid argument, cameraInput is null!");
130
131 return session->AddInput(cameraInput);
132 }
133
OH_CaptureSession_RemoveInput(Camera_CaptureSession * session,Camera_Input * cameraInput)134 Camera_ErrorCode OH_CaptureSession_RemoveInput(Camera_CaptureSession* session, Camera_Input* cameraInput)
135 {
136 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
137 CHECK_RETURN_RET_ELOG(cameraInput == nullptr, CAMERA_INVALID_ARGUMENT,
138 "Invalid argument, cameraInput is null!");
139
140 return session->RemoveInput(cameraInput);
141 }
142
OH_CaptureSession_AddPreviewOutput(Camera_CaptureSession * session,Camera_PreviewOutput * previewOutput)143 Camera_ErrorCode OH_CaptureSession_AddPreviewOutput(Camera_CaptureSession* session,
144 Camera_PreviewOutput* previewOutput)
145 {
146 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
147 CHECK_RETURN_RET_ELOG(previewOutput == nullptr, CAMERA_INVALID_ARGUMENT,
148 "Invalid argument, previewOutput is null!");
149
150 return session->AddPreviewOutput(previewOutput);
151 }
152
OH_CaptureSession_RemovePreviewOutput(Camera_CaptureSession * session,Camera_PreviewOutput * previewOutput)153 Camera_ErrorCode OH_CaptureSession_RemovePreviewOutput(Camera_CaptureSession* session,
154 Camera_PreviewOutput* previewOutput)
155 {
156 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
157 CHECK_RETURN_RET_ELOG(previewOutput == nullptr, CAMERA_INVALID_ARGUMENT,
158 "Invalid argument, previewOutput is null!");
159
160 return session->RemovePreviewOutput(previewOutput);
161 }
162
OH_CaptureSession_AddPhotoOutput(Camera_CaptureSession * session,Camera_PhotoOutput * photoOutput)163 Camera_ErrorCode OH_CaptureSession_AddPhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput)
164 {
165 MEDIA_DEBUG_LOG("OH_CaptureSession_AddPhotoOutput is called");
166 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
167 CHECK_RETURN_RET_ELOG(photoOutput == nullptr, CAMERA_INVALID_ARGUMENT,
168 "Invalid argument, photoOutput is null!");
169
170 return session->AddPhotoOutput(photoOutput);
171 }
172
OH_CaptureSession_RemovePhotoOutput(Camera_CaptureSession * session,Camera_PhotoOutput * photoOutput)173 Camera_ErrorCode OH_CaptureSession_RemovePhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput)
174 {
175 MEDIA_DEBUG_LOG("OH_CaptureSession_RemovePhotoOutput is called");
176 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
177 CHECK_RETURN_RET_ELOG(photoOutput == nullptr, CAMERA_INVALID_ARGUMENT,
178 "Invalid argument, photoOutput is null!");
179
180 return session->RemovePhotoOutput(photoOutput);
181 }
182
OH_CaptureSession_AddMetadataOutput(Camera_CaptureSession * session,Camera_MetadataOutput * metadataOutput)183 Camera_ErrorCode OH_CaptureSession_AddMetadataOutput(Camera_CaptureSession* session,
184 Camera_MetadataOutput* metadataOutput)
185 {
186 MEDIA_DEBUG_LOG("OH_CaptureSession_AddMetadataOutput is called");
187 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
188 CHECK_RETURN_RET_ELOG(metadataOutput == nullptr, CAMERA_INVALID_ARGUMENT,
189 "Invalid argument, metadataOutput is null!");
190
191 return session->AddMetaDataOutput(metadataOutput);
192 }
193
OH_CaptureSession_RemoveMetadataOutput(Camera_CaptureSession * session,Camera_MetadataOutput * metadataOutput)194 Camera_ErrorCode OH_CaptureSession_RemoveMetadataOutput(Camera_CaptureSession* session,
195 Camera_MetadataOutput* metadataOutput)
196 {
197 MEDIA_DEBUG_LOG("OH_CaptureSession_RemoveMetadataOutput is called");
198 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
199 CHECK_RETURN_RET_ELOG(metadataOutput == nullptr, CAMERA_INVALID_ARGUMENT,
200 "Invalid argument, metadataOutput is null!");
201
202 return session->RemoveMetaDataOutput(metadataOutput);
203 }
204
OH_CaptureSession_IsVideoStabilizationModeSupported(Camera_CaptureSession * session,Camera_VideoStabilizationMode mode,bool * isSupported)205 Camera_ErrorCode OH_CaptureSession_IsVideoStabilizationModeSupported(Camera_CaptureSession* session,
206 Camera_VideoStabilizationMode mode, bool* isSupported)
207 {
208 MEDIA_DEBUG_LOG("OH_CaptureSession_IsVideoStabilizationModeSupported is called");
209 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
210 CHECK_RETURN_RET_ELOG(isSupported == nullptr, CAMERA_INVALID_ARGUMENT,
211 "Invalid argument, isSupported is null!");
212 CHECK_RETURN_RET_ELOG(mode != STABILIZATION_MODE_OFF &&
213 mode != STABILIZATION_MODE_LOW &&
214 mode != STABILIZATION_MODE_MIDDLE &&
215 mode != STABILIZATION_MODE_HIGH &&
216 mode != STABILIZATION_MODE_AUTO,
217 CAMERA_INVALID_ARGUMENT, "Invalid argument, mode is invaid!");
218
219 return session->IsVideoStabilizationModeSupported(mode, isSupported);
220 }
221
OH_CaptureSession_GetVideoStabilizationMode(Camera_CaptureSession * session,Camera_VideoStabilizationMode * mode)222 Camera_ErrorCode OH_CaptureSession_GetVideoStabilizationMode(Camera_CaptureSession* session,
223 Camera_VideoStabilizationMode* mode)
224 {
225 MEDIA_DEBUG_LOG("OH_CaptureSession_GetVideoStabilizationMode is called");
226 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
227 CHECK_RETURN_RET_ELOG(mode == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, mode is null!");
228
229 return session->GetVideoStabilizationMode(mode);
230 }
231
OH_CaptureSession_SetVideoStabilizationMode(Camera_CaptureSession * session,Camera_VideoStabilizationMode mode)232 Camera_ErrorCode OH_CaptureSession_SetVideoStabilizationMode(Camera_CaptureSession* session,
233 Camera_VideoStabilizationMode mode)
234 {
235 MEDIA_DEBUG_LOG("OH_CaptureSession_SetVideoStabilizationMode is called");
236 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
237 CHECK_RETURN_RET_ELOG(mode != STABILIZATION_MODE_OFF &&
238 mode != STABILIZATION_MODE_LOW &&
239 mode != STABILIZATION_MODE_MIDDLE &&
240 mode != STABILIZATION_MODE_HIGH &&
241 mode != STABILIZATION_MODE_AUTO,
242 CAMERA_INVALID_ARGUMENT, "Invalid argument, mode is invaid!");
243
244 return session->SetVideoStabilizationMode(mode);
245 }
246
OH_CaptureSession_GetZoomRatioRange(Camera_CaptureSession * session,float * minZoom,float * maxZoom)247 Camera_ErrorCode OH_CaptureSession_GetZoomRatioRange(Camera_CaptureSession* session, float* minZoom, float* maxZoom)
248 {
249 MEDIA_DEBUG_LOG("OH_CaptureSession_GetZoomRatioRange is called");
250 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
251 CHECK_RETURN_RET_ELOG(minZoom == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, minZoom is null!");
252 CHECK_RETURN_RET_ELOG(maxZoom == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, maxZoom is null!");
253
254 return session->GetZoomRatioRange(minZoom, maxZoom);
255 }
256
OH_CaptureSession_GetZoomRatio(Camera_CaptureSession * session,float * zoom)257 Camera_ErrorCode OH_CaptureSession_GetZoomRatio(Camera_CaptureSession* session, float* zoom)
258 {
259 MEDIA_DEBUG_LOG("OH_CaptureSession_GetZoomRatio is called");
260 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
261 CHECK_RETURN_RET_ELOG(zoom == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, zoom is null!");
262
263 return session->GetZoomRatio(zoom);
264 }
265
OH_CaptureSession_SetZoomRatio(Camera_CaptureSession * session,float zoom)266 Camera_ErrorCode OH_CaptureSession_SetZoomRatio(Camera_CaptureSession* session, float zoom)
267 {
268 MEDIA_DEBUG_LOG("OH_CaptureSession_SetZoomRatio is called");
269 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
270
271 return session->SetZoomRatio(zoom);
272 }
273
OH_CaptureSession_IsFocusModeSupported(Camera_CaptureSession * session,Camera_FocusMode focusMode,bool * isSupported)274 Camera_ErrorCode OH_CaptureSession_IsFocusModeSupported(Camera_CaptureSession* session,
275 Camera_FocusMode focusMode, bool* isSupported)
276 {
277 MEDIA_DEBUG_LOG("OH_CaptureSession_IsFocusModeSupported is called");
278 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
279 CHECK_RETURN_RET_ELOG(focusMode != FOCUS_MODE_MANUAL &&
280 focusMode != FOCUS_MODE_CONTINUOUS_AUTO &&
281 focusMode != FOCUS_MODE_AUTO &&
282 focusMode != FOCUS_MODE_LOCKED,
283 CAMERA_INVALID_ARGUMENT, "Invalid argument,focusMode is invaild!");
284 CHECK_RETURN_RET_ELOG(isSupported == nullptr, CAMERA_INVALID_ARGUMENT,
285 "Invalid argument, isSupported is null!");
286
287 return session->IsFocusModeSupported(focusMode, isSupported);
288 }
289
OH_CaptureSession_GetFocusMode(Camera_CaptureSession * session,Camera_FocusMode * focusMode)290 Camera_ErrorCode OH_CaptureSession_GetFocusMode(Camera_CaptureSession* session, Camera_FocusMode* focusMode)
291 {
292 MEDIA_DEBUG_LOG("OH_CaptureSession_GetFocusMode is called");
293 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
294 CHECK_RETURN_RET_ELOG(focusMode == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, focusMode is null!");
295
296 return session->GetFocusMode(focusMode);
297 }
298
OH_CaptureSession_SetFocusMode(Camera_CaptureSession * session,Camera_FocusMode focusMode)299 Camera_ErrorCode OH_CaptureSession_SetFocusMode(Camera_CaptureSession* session, Camera_FocusMode focusMode)
300 {
301 MEDIA_DEBUG_LOG("OH_CaptureSession_SetFocusMode is called");
302 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
303 CHECK_RETURN_RET_ELOG(focusMode != FOCUS_MODE_MANUAL &&
304 focusMode != FOCUS_MODE_CONTINUOUS_AUTO &&
305 focusMode != FOCUS_MODE_AUTO &&
306 focusMode != FOCUS_MODE_LOCKED,
307 CAMERA_INVALID_ARGUMENT, "Invalid argument,focusMode is invaild!");
308
309 return session->SetFocusMode(focusMode);
310 }
311
OH_CaptureSession_SetFocusPoint(Camera_CaptureSession * session,Camera_Point focusPoint)312 Camera_ErrorCode OH_CaptureSession_SetFocusPoint(Camera_CaptureSession* session, Camera_Point focusPoint)
313 {
314 MEDIA_DEBUG_LOG("OH_CaptureSession_SetFocusPoint is called");
315 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
316
317 return session->SetFocusPoint(focusPoint);
318 }
319
OH_CaptureSession_GetFocusPoint(Camera_CaptureSession * session,Camera_Point * focusPoint)320 Camera_ErrorCode OH_CaptureSession_GetFocusPoint(Camera_CaptureSession* session, Camera_Point* focusPoint)
321 {
322 MEDIA_DEBUG_LOG("OH_CaptureSession_GetFocusPoint is called");
323 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
324 CHECK_RETURN_RET_ELOG(focusPoint == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, focusPoint is null!");
325
326 return session->GetFocusPoint(focusPoint);
327 }
328
OH_CaptureSession_AddVideoOutput(Camera_CaptureSession * session,Camera_VideoOutput * videoOutput)329 Camera_ErrorCode OH_CaptureSession_AddVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput)
330 {
331 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
332 CHECK_RETURN_RET_ELOG(videoOutput == nullptr, CAMERA_INVALID_ARGUMENT,
333 "Invalid argument, videoOutput is null!");
334
335 return session->AddVideoOutput(videoOutput);
336 }
337
OH_CaptureSession_RemoveVideoOutput(Camera_CaptureSession * session,Camera_VideoOutput * videoOutput)338 Camera_ErrorCode OH_CaptureSession_RemoveVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput)
339 {
340 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
341 CHECK_RETURN_RET_ELOG(videoOutput == nullptr, CAMERA_INVALID_ARGUMENT,
342 "Invalid argument, videoOutput is null!");
343
344 return session->RemoveVideoOutput(videoOutput);
345 }
346
OH_CaptureSession_Start(Camera_CaptureSession * session)347 Camera_ErrorCode OH_CaptureSession_Start(Camera_CaptureSession* session)
348 {
349 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
350
351 return session->Start();
352 }
353
OH_CaptureSession_Stop(Camera_CaptureSession * session)354 Camera_ErrorCode OH_CaptureSession_Stop(Camera_CaptureSession* session)
355 {
356 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
357
358 return session->Stop();
359 }
360
OH_CaptureSession_Release(Camera_CaptureSession * session)361 Camera_ErrorCode OH_CaptureSession_Release(Camera_CaptureSession* session)
362 {
363 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
364
365 Camera_ErrorCode retCode = session->Release();
366 if (session != nullptr) {
367 delete session;
368 }
369 return retCode;
370 }
371
OH_CaptureSession_HasFlash(Camera_CaptureSession * session,bool * hasFlash)372 Camera_ErrorCode OH_CaptureSession_HasFlash(Camera_CaptureSession* session, bool* hasFlash)
373 {
374 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
375 CHECK_RETURN_RET_ELOG(hasFlash == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, hasFlash is null!");
376
377 return session->HasFlash(hasFlash);
378 }
379
OH_CaptureSession_IsFlashModeSupported(Camera_CaptureSession * session,Camera_FlashMode flashMode,bool * isSupported)380 Camera_ErrorCode OH_CaptureSession_IsFlashModeSupported(Camera_CaptureSession* session,
381 Camera_FlashMode flashMode, bool* isSupported)
382 {
383 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
384 CHECK_RETURN_RET_ELOG(isSupported == nullptr, CAMERA_INVALID_ARGUMENT,
385 "Invalid argument, isSupported is null!");
386
387 return session->IsFlashModeSupported(flashMode, isSupported);
388 }
389
OH_CaptureSession_GetFlashMode(Camera_CaptureSession * session,Camera_FlashMode * flashMode)390 Camera_ErrorCode OH_CaptureSession_GetFlashMode(Camera_CaptureSession* session, Camera_FlashMode* flashMode)
391 {
392 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
393 CHECK_RETURN_RET_ELOG(flashMode == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, flashMode is null!");
394
395 return session->GetFlashMode(flashMode);
396 }
397
OH_CaptureSession_SetFlashMode(Camera_CaptureSession * session,Camera_FlashMode flashMode)398 Camera_ErrorCode OH_CaptureSession_SetFlashMode(Camera_CaptureSession* session, Camera_FlashMode flashMode)
399 {
400 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
401 CHECK_RETURN_RET_ELOG(flashMode != FLASH_MODE_CLOSE &&
402 flashMode != FLASH_MODE_OPEN &&
403 flashMode != FLASH_MODE_AUTO &&
404 flashMode != FLASH_MODE_ALWAYS_OPEN,
405 CAMERA_INVALID_ARGUMENT, "Invalid argument,flashMode is invaild!");
406 return session->SetFlashMode(flashMode);
407 }
408
OH_CaptureSession_IsExposureModeSupported(Camera_CaptureSession * session,Camera_ExposureMode exposureMode,bool * isSupported)409 Camera_ErrorCode OH_CaptureSession_IsExposureModeSupported(Camera_CaptureSession* session,
410 Camera_ExposureMode exposureMode, bool* isSupported)
411 {
412 MEDIA_DEBUG_LOG("OH_CaptureSession_IsExposureModeSupported is called");
413 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
414 CHECK_RETURN_RET_ELOG(isSupported == nullptr,
415 CAMERA_INVALID_ARGUMENT, "Invalid argument, isSupported is null!");
416 CHECK_RETURN_RET_ELOG(exposureMode != EXPOSURE_MODE_LOCKED &&
417 exposureMode != EXPOSURE_MODE_AUTO &&
418 exposureMode != EXPOSURE_MODE_CONTINUOUS_AUTO,
419 CAMERA_INVALID_ARGUMENT, "Invalid argument,exposureMode is invaild!");
420 return session->IsExposureModeSupported(exposureMode, isSupported);
421 }
422
OH_CaptureSession_GetExposureMode(Camera_CaptureSession * session,Camera_ExposureMode * exposureMode)423 Camera_ErrorCode OH_CaptureSession_GetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode* exposureMode)
424 {
425 MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureMode is called");
426 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
427 CHECK_RETURN_RET_ELOG(exposureMode == nullptr, CAMERA_INVALID_ARGUMENT,
428 "Invalid argument, exposureMode is null!");
429 return session->GetExposureMode(exposureMode);
430 }
431
OH_CaptureSession_SetExposureMode(Camera_CaptureSession * session,Camera_ExposureMode exposureMode)432 Camera_ErrorCode OH_CaptureSession_SetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode exposureMode)
433 {
434 MEDIA_DEBUG_LOG("OH_CaptureSession_SetExposureMode is called");
435 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
436 CHECK_RETURN_RET_ELOG(exposureMode != EXPOSURE_MODE_LOCKED &&
437 exposureMode != EXPOSURE_MODE_AUTO &&
438 exposureMode != EXPOSURE_MODE_CONTINUOUS_AUTO,
439 CAMERA_INVALID_ARGUMENT, "Invalid argument,exposureMode is invaild!");
440
441 return session->SetExposureMode(exposureMode);
442 }
443
OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession * session,Camera_Point * point)444 Camera_ErrorCode OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession* session, Camera_Point* point)
445 {
446 MEDIA_DEBUG_LOG("OH_CaptureSession_GetMeteringPoint is called");
447 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
448 CHECK_RETURN_RET_ELOG(point == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, point is null!");
449 return session->GetMeteringPoint(point);
450 }
451
OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession * session,Camera_Point point)452 Camera_ErrorCode OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession* session, Camera_Point point)
453 {
454 MEDIA_DEBUG_LOG("OH_CaptureSession_SetMeteringPoint is called");
455 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
456 CHECK_RETURN_RET_ELOG(point.x < 0 || point.y < 0,
457 CAMERA_INVALID_ARGUMENT, "Invalid argument, point is invaild!");
458
459 return session->SetMeteringPoint(point);
460 }
461
OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession * session,float * minExposureBias,float * maxExposureBias,float * step)462 Camera_ErrorCode OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession* session,
463 float* minExposureBias, float* maxExposureBias, float* step)
464 {
465 MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureBiasRange is called");
466 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
467 CHECK_RETURN_RET_ELOG(minExposureBias == nullptr, CAMERA_INVALID_ARGUMENT,
468 "Invalid argument, minExposureBias is null!");
469 CHECK_RETURN_RET_ELOG(maxExposureBias == nullptr, CAMERA_INVALID_ARGUMENT,
470 "Invalid argument, maxExposureBias is null!");
471 CHECK_RETURN_RET_ELOG(step == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, step is null!");
472 return session->GetExposureBiasRange(minExposureBias, maxExposureBias, step);
473 }
474
OH_CaptureSession_SetExposureBias(Camera_CaptureSession * session,float exposureBias)475 Camera_ErrorCode OH_CaptureSession_SetExposureBias(Camera_CaptureSession* session, float exposureBias)
476 {
477 MEDIA_DEBUG_LOG("OH_CaptureSession_SetExposureBias is called");
478 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
479 return session->SetExposureBias(exposureBias);
480 }
OH_CaptureSession_GetExposureBias(Camera_CaptureSession * session,float * exposureBias)481 Camera_ErrorCode OH_CaptureSession_GetExposureBias(Camera_CaptureSession* session, float* exposureBias)
482 {
483 MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureBias is called");
484 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
485 CHECK_RETURN_RET_ELOG(exposureBias == nullptr, CAMERA_INVALID_ARGUMENT,
486 "Invalid argument, exposureBias is null!");
487 return session->GetExposureBias(exposureBias);
488 }
489
OH_CaptureSession_CanAddInput(Camera_CaptureSession * session,Camera_Input * cameraInput,bool * isSuccessful)490 Camera_ErrorCode OH_CaptureSession_CanAddInput(Camera_CaptureSession* session,
491 Camera_Input* cameraInput, bool* isSuccessful)
492 {
493 MEDIA_DEBUG_LOG("OH_CaptureSession_CanAddInput is called");
494 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
495 "Invalid argument, session is null!");
496 CHECK_RETURN_RET_ELOG(cameraInput == nullptr, CAMERA_INVALID_ARGUMENT,
497 "Invalid argument, cameraInput is null!");
498 CHECK_RETURN_RET_ELOG(isSuccessful == nullptr, CAMERA_INVALID_ARGUMENT,
499 "Invalid argument, isSuccessful is null!");
500
501 return session->CanAddInput(cameraInput, isSuccessful);
502 }
503
OH_CaptureSession_CanAddPreviewOutput(Camera_CaptureSession * session,Camera_PreviewOutput * cameraOutput,bool * isSuccessful)504 Camera_ErrorCode OH_CaptureSession_CanAddPreviewOutput(Camera_CaptureSession* session,
505 Camera_PreviewOutput* cameraOutput, bool* isSuccessful)
506 {
507 MEDIA_DEBUG_LOG("OH_CaptureSession_CanAddPreviewOutput is called");
508 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
509 "Invalid argument, session is null!");
510 CHECK_RETURN_RET_ELOG(cameraOutput == nullptr, CAMERA_INVALID_ARGUMENT,
511 "Invalid argument, cameraOutput is null!");
512 CHECK_RETURN_RET_ELOG(isSuccessful == nullptr, CAMERA_INVALID_ARGUMENT,
513 "Invalid argument, isSuccessful is null!");
514
515 return session->CanAddPreviewOutput(cameraOutput, isSuccessful);
516 }
517
OH_CaptureSession_CanAddPhotoOutput(Camera_CaptureSession * session,Camera_PhotoOutput * cameraOutput,bool * isSuccessful)518 Camera_ErrorCode OH_CaptureSession_CanAddPhotoOutput(Camera_CaptureSession* session,
519 Camera_PhotoOutput* cameraOutput, bool* isSuccessful)
520 {
521 MEDIA_DEBUG_LOG("OH_CaptureSession_CanAddPhotoOutput is called");
522 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
523 "Invalid argument, session is null!");
524 CHECK_RETURN_RET_ELOG(cameraOutput == nullptr, CAMERA_INVALID_ARGUMENT,
525 "Invalid argument, cameraOutput is null!");
526 CHECK_RETURN_RET_ELOG(isSuccessful == nullptr, CAMERA_INVALID_ARGUMENT,
527 "Invalid argument, isSuccessful is null!");
528
529 return session->CanAddPhotoOutput(cameraOutput, isSuccessful);
530 }
531
OH_CaptureSession_CanAddVideoOutput(Camera_CaptureSession * session,Camera_VideoOutput * cameraOutput,bool * isSuccessful)532 Camera_ErrorCode OH_CaptureSession_CanAddVideoOutput(Camera_CaptureSession* session,
533 Camera_VideoOutput* cameraOutput, bool* isSuccessful)
534 {
535 MEDIA_DEBUG_LOG("OH_CaptureSession_CanAddVideoOutput is called");
536 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
537 "Invalid argument, session is null!");
538 CHECK_RETURN_RET_ELOG(cameraOutput == nullptr, CAMERA_INVALID_ARGUMENT,
539 "Invalid argument, cameraOutput is null!");
540 CHECK_RETURN_RET_ELOG(isSuccessful == nullptr, CAMERA_INVALID_ARGUMENT,
541 "Invalid argument, isSuccessful is null!");
542
543 return session->CanAddVideoOutput(cameraOutput, isSuccessful);
544 }
545
OH_CaptureSession_CanPreconfig(Camera_CaptureSession * session,Camera_PreconfigType preconfigType,bool * canPreconfig)546 Camera_ErrorCode OH_CaptureSession_CanPreconfig(Camera_CaptureSession* session,
547 Camera_PreconfigType preconfigType, bool* canPreconfig)
548 {
549 MEDIA_DEBUG_LOG("OH_CaptureSession_CanPreconfig is called.");
550 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
551 "Invalid argument, session is null!");
552 CHECK_RETURN_RET_ELOG(canPreconfig == nullptr, CAMERA_INVALID_ARGUMENT,
553 "Invalid argument, canPreconfig is null!");
554
555 return session->CanPreconfig(preconfigType, canPreconfig);
556 }
557
OH_CaptureSession_CanPreconfigWithRatio(Camera_CaptureSession * session,Camera_PreconfigType preconfigType,Camera_PreconfigRatio preconfigRatio,bool * canPreconfig)558 Camera_ErrorCode OH_CaptureSession_CanPreconfigWithRatio(Camera_CaptureSession* session,
559 Camera_PreconfigType preconfigType, Camera_PreconfigRatio preconfigRatio, bool* canPreconfig)
560 {
561 MEDIA_DEBUG_LOG("OH_CaptureSession_CanPreconfigWithRatio is called.");
562 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
563 "Invalid argument, session is null!");
564 CHECK_RETURN_RET_ELOG(canPreconfig == nullptr, CAMERA_INVALID_ARGUMENT,
565 "Invalid argument, canPreconfig is null!");
566
567 return session->CanPreconfigWithRatio(preconfigType, preconfigRatio, canPreconfig);
568 }
569
OH_CaptureSession_Preconfig(Camera_CaptureSession * session,Camera_PreconfigType preconfigType)570 Camera_ErrorCode OH_CaptureSession_Preconfig(Camera_CaptureSession* session, Camera_PreconfigType preconfigType)
571 {
572 MEDIA_DEBUG_LOG("OH_CaptureSession_Preconfig is called.");
573 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
574 "Invalid argument, session is null!");
575
576 return session->Preconfig(preconfigType);
577 }
578
OH_CaptureSession_PreconfigWithRatio(Camera_CaptureSession * session,Camera_PreconfigType preconfigType,Camera_PreconfigRatio preconfigRatio)579 Camera_ErrorCode OH_CaptureSession_PreconfigWithRatio(Camera_CaptureSession* session,
580 Camera_PreconfigType preconfigType, Camera_PreconfigRatio preconfigRatio)
581 {
582 MEDIA_DEBUG_LOG("OH_CaptureSession_PreconfigWithRatio is called.");
583 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
584 "Invalid argument, session is null!");
585
586 return session->PreconfigWithRatio(preconfigType, preconfigRatio);
587 }
588
589 /**
590 * @since 12
591 * @version 1.0
592 */
OH_CaptureSession_GetExposureValue(Camera_CaptureSession * session,float * exposureValue)593 Camera_ErrorCode OH_CaptureSession_GetExposureValue(Camera_CaptureSession* session, float* exposureValue)
594 {
595 MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureValue is called");
596 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
597 "Invalid argument, session is null!");
598 CHECK_RETURN_RET_ELOG(exposureValue == nullptr, CAMERA_INVALID_ARGUMENT,
599 "Invalid argument, exposureValue is null!");
600
601 return session->GetExposureValue(exposureValue);
602 }
603
604 /**
605 * @since 12
606 * @version 1.0
607 */
OH_CaptureSession_GetFocalLength(Camera_CaptureSession * session,float * focalLength)608 Camera_ErrorCode OH_CaptureSession_GetFocalLength(Camera_CaptureSession* session, float* focalLength)
609 {
610 MEDIA_DEBUG_LOG("OH_CaptureSession_GetFocalLength is called");
611 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
612 "Invalid argument, session is null!");
613 CHECK_RETURN_RET_ELOG(focalLength == nullptr, CAMERA_INVALID_ARGUMENT,
614 "Invalid argument, focalLength is null!");
615
616 return session->GetFocalLength(focalLength);
617 }
618
619 /**
620 * @since 12
621 * @version 1.0
622 */
OH_CaptureSession_SetSmoothZoom(Camera_CaptureSession * session,float targetZoom,Camera_SmoothZoomMode smoothZoomMode)623 Camera_ErrorCode OH_CaptureSession_SetSmoothZoom(Camera_CaptureSession *session, float targetZoom,
624 Camera_SmoothZoomMode smoothZoomMode)
625 {
626 MEDIA_DEBUG_LOG("OH_CaptureSession_SetSmoothZoom is called");
627 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
628 "Invalid argument, session is null!");
629
630 return session->SetSmoothZoom(targetZoom, smoothZoomMode);
631 }
632
633 /**
634 * @since 12
635 * @version 1.0
636 */
OH_CaptureSession_GetSupportedColorSpaces(Camera_CaptureSession * session,OH_NativeBuffer_ColorSpace ** colorSpace,uint32_t * size)637 Camera_ErrorCode OH_CaptureSession_GetSupportedColorSpaces(Camera_CaptureSession* session,
638 OH_NativeBuffer_ColorSpace** colorSpace, uint32_t* size)
639 {
640 MEDIA_DEBUG_LOG("OH_CaptureSession_GetSupportedColorSpaces is called");
641 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
642 "Invalid argument, session is null!");
643 CHECK_RETURN_RET_ELOG(colorSpace == nullptr, CAMERA_INVALID_ARGUMENT,
644 "Invalid argument, colorSpace is null!");
645 CHECK_RETURN_RET_ELOG(size == nullptr, CAMERA_INVALID_ARGUMENT,
646 "Invalid argument, size is null!");
647
648 return session->GetSupportedColorSpaces(colorSpace, size);
649 }
650
651 /**
652 * @since 12
653 * @version 1.0
654 */
OH_CaptureSession_DeleteColorSpaces(Camera_CaptureSession * session,OH_NativeBuffer_ColorSpace * colorSpace)655 Camera_ErrorCode OH_CaptureSession_DeleteColorSpaces(Camera_CaptureSession* session,
656 OH_NativeBuffer_ColorSpace* colorSpace)
657 {
658 MEDIA_DEBUG_LOG("OH_CaptureSession_DeleteSupportedColorSpaces is called");
659 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
660 "Invalid argument, session is null!");
661 CHECK_RETURN_RET_ELOG(colorSpace == nullptr, CAMERA_INVALID_ARGUMENT,
662 "Invalid argument, colorSpace is null!");
663
664 return session->DeleteColorSpaces(colorSpace);
665 }
666
667 /**
668 * @since 12
669 * @version 1.0
670 */
OH_CaptureSession_GetActiveColorSpace(Camera_CaptureSession * session,OH_NativeBuffer_ColorSpace * colorSpace)671 Camera_ErrorCode OH_CaptureSession_GetActiveColorSpace(Camera_CaptureSession* session,
672 OH_NativeBuffer_ColorSpace* colorSpace)
673 {
674 MEDIA_DEBUG_LOG("OH_CaptureSession_GetActiveColorSpace is called");
675 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
676 "Invalid argument, session is null!");
677 CHECK_RETURN_RET_ELOG(colorSpace == nullptr, CAMERA_INVALID_ARGUMENT,
678 "Invalid argument, colorSpace is null!");
679
680 return session->GetActiveColorSpace(colorSpace);
681 }
682
683 /**
684 * @since 12
685 * @version 1.0
686 */
OH_CaptureSession_SetActiveColorSpace(Camera_CaptureSession * session,OH_NativeBuffer_ColorSpace colorSpace)687 Camera_ErrorCode OH_CaptureSession_SetActiveColorSpace(Camera_CaptureSession* session,
688 OH_NativeBuffer_ColorSpace colorSpace)
689 {
690 MEDIA_DEBUG_LOG("OH_CaptureSession_SetActiveColorSpace is called");
691 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
692 "Invalid argument, session is null!");
693
694 return session->SetActiveColorSpace(colorSpace);
695 }
696
697 /**
698 * @since 13
699 * @version 1.0
700 */
OH_CaptureSession_RegisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession * session,OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange)701 Camera_ErrorCode OH_CaptureSession_RegisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession* session,
702 OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange)
703 {
704 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
705 CHECK_RETURN_RET_ELOG(autoDeviceSwitchStatusChange == nullptr, CAMERA_INVALID_ARGUMENT,
706 "Invalid argument, callback is null!");
707 session->RegisterAutoDeviceSwitchStatusCallback(autoDeviceSwitchStatusChange);
708 return CAMERA_OK;
709 }
710
711 /**
712 * @since 13
713 * @version 1.0
714 */
OH_CaptureSession_UnregisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession * session,OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange)715 Camera_ErrorCode OH_CaptureSession_UnregisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession* session,
716 OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange)
717 {
718 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
719 CHECK_RETURN_RET_ELOG(autoDeviceSwitchStatusChange == nullptr, CAMERA_INVALID_ARGUMENT,
720 "Invalid argument, callback is null!");
721 session->UnregisterAutoDeviceSwitchStatusCallback(autoDeviceSwitchStatusChange);
722 return CAMERA_OK;
723 }
724
725 /**
726 * @since 13
727 * @version 1.0
728 */
OH_CaptureSession_IsAutoDeviceSwitchSupported(Camera_CaptureSession * session,bool * isSupported)729 Camera_ErrorCode OH_CaptureSession_IsAutoDeviceSwitchSupported(Camera_CaptureSession* session, bool* isSupported)
730 {
731 MEDIA_DEBUG_LOG("OH_CaptureSession_IsAutoDeviceSwitchSupported is called");
732 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
733 "Invalid argument, session is null!");
734 return session->IsAutoDeviceSwitchSupported(isSupported);
735 }
736
737 /**
738 * @since 13
739 * @version 1.0
740 */
OH_CaptureSession_EnableAutoDeviceSwitch(Camera_CaptureSession * session,bool enabled)741 Camera_ErrorCode OH_CaptureSession_EnableAutoDeviceSwitch(Camera_CaptureSession* session, bool enabled)
742 {
743 MEDIA_DEBUG_LOG("OH_CaptureSession_EnableAutoDeviceSwitch is called");
744 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
745 "Invalid argument, session is null!");
746 return session->EnableAutoDeviceSwitch(enabled);
747 }
748
749 /**
750 * @since 14
751 * @version 1.0
752 */
OH_CaptureSession_SetQualityPrioritization(Camera_CaptureSession * session,Camera_QualityPrioritization qualityPrioritization)753 Camera_ErrorCode OH_CaptureSession_SetQualityPrioritization(
754 Camera_CaptureSession* session, Camera_QualityPrioritization qualityPrioritization)
755 {
756 MEDIA_DEBUG_LOG("OH_CaptureSession_SetQualityPrioritization is called");
757 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
758
759 return session->SetQualityPrioritization(qualityPrioritization);
760 }
761
762 /**
763 * @since 17
764 * @version 1.0
765 */
OH_CaptureSession_IsMacroSupported(Camera_CaptureSession * session,bool * isSupported)766 Camera_ErrorCode OH_CaptureSession_IsMacroSupported(Camera_CaptureSession* session, bool* isSupported)
767 {
768 MEDIA_DEBUG_LOG("OH_CaptureSession_IsMacroSupported is called");
769 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
770 return session->IsMacroSupported(isSupported);
771 }
772
773 /**
774 * @since 17
775 * @version 1.0
776 */
OH_CaptureSession_EnableMacro(Camera_CaptureSession * session,bool enabled)777 Camera_ErrorCode OH_CaptureSession_EnableMacro(Camera_CaptureSession* session, bool enabled)
778 {
779 MEDIA_DEBUG_LOG("OH_CaptureSession_EnableMacro is called");
780 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
781 return session->EnableMacro(enabled);
782 }
783
OH_CaptureSession_IsWhiteBalanceModeSupported(Camera_CaptureSession * session,Camera_WhiteBalanceMode whiteBalanceMode,bool * isSupported)784 Camera_ErrorCode OH_CaptureSession_IsWhiteBalanceModeSupported(
785 Camera_CaptureSession* session, Camera_WhiteBalanceMode whiteBalanceMode, bool* isSupported)
786 {
787 MEDIA_DEBUG_LOG("OH_CaptureSession_IsWhiteBalanceModeSupported is called");
788 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
789 "Invalid argument, session is null!");
790
791 return session->IsWhiteBalanceModeSupported(whiteBalanceMode, isSupported);
792 }
793
OH_CaptureSession_GetWhiteBalanceMode(Camera_CaptureSession * session,Camera_WhiteBalanceMode * whiteBalanceMode)794 Camera_ErrorCode OH_CaptureSession_GetWhiteBalanceMode(
795 Camera_CaptureSession* session, Camera_WhiteBalanceMode* whiteBalanceMode)
796 {
797 MEDIA_DEBUG_LOG("OH_CaptureSession_GetWhiteBalanceMode is called");
798 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
799 "Invalid argument, session is null!");
800
801 return session->GetWhiteBalanceMode(whiteBalanceMode);
802 }
803
OH_CaptureSession_GetWhiteBalanceRange(Camera_CaptureSession * session,int32_t * minColorTemperature,int32_t * maxColorTemperature)804 Camera_ErrorCode OH_CaptureSession_GetWhiteBalanceRange(Camera_CaptureSession* session, int32_t *minColorTemperature,
805 int32_t *maxColorTemperature)
806 {
807 MEDIA_DEBUG_LOG("OH_CaptureSession_GetWhiteBalanceRange is called");
808 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
809 return session->GetWhiteBalanceRange(minColorTemperature, maxColorTemperature);
810 }
811
OH_CaptureSession_GetWhiteBalance(Camera_CaptureSession * session,int32_t * colorTemperature)812 Camera_ErrorCode OH_CaptureSession_GetWhiteBalance(Camera_CaptureSession* session, int32_t *colorTemperature)
813 {
814 MEDIA_DEBUG_LOG("OH_CaptureSession_GetWhiteBalance is called");
815 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
816 return session->GetWhiteBalance(colorTemperature);
817 }
818
OH_CaptureSession_SetWhiteBalance(Camera_CaptureSession * session,int32_t colorTemperature)819 Camera_ErrorCode OH_CaptureSession_SetWhiteBalance(Camera_CaptureSession* session, int32_t colorTemperature)
820 {
821 MEDIA_DEBUG_LOG("OH_CaptureSession_SetWhiteBalance is called");
822 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
823 return session->SetWhiteBalance(colorTemperature);
824 }
825
OH_CaptureSession_SetWhiteBalanceMode(Camera_CaptureSession * session,Camera_WhiteBalanceMode whiteBalanceMode)826 Camera_ErrorCode OH_CaptureSession_SetWhiteBalanceMode(Camera_CaptureSession* session,
827 Camera_WhiteBalanceMode whiteBalanceMode)
828 {
829 MEDIA_DEBUG_LOG("OH_CaptureSession_SetWhiteBalanceMode is called");
830 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
831 return session->SetWhiteBalanceMode(whiteBalanceMode);
832 }
833
OH_CaptureSession_IsControlCenterSupported(Camera_CaptureSession * session,bool * isSupported)834 Camera_ErrorCode OH_CaptureSession_IsControlCenterSupported(Camera_CaptureSession* session, bool* isSupported)
835 {
836 MEDIA_DEBUG_LOG("OH_CaptureSession_IsControlCenterSupported is called");
837 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
838 "Invalid argument, session is null!");
839 return session->IsControlCenterSupported(isSupported);
840 }
841
OH_CaptureSession_GetSupportedEffectTypes(Camera_CaptureSession * session,Camera_ControlCenterEffectType ** types,uint32_t * size)842 Camera_ErrorCode OH_CaptureSession_GetSupportedEffectTypes(
843 Camera_CaptureSession* session, Camera_ControlCenterEffectType** types, uint32_t* size)
844 {
845 MEDIA_DEBUG_LOG("OH_CaptureSession_GetSupportedEffectTypes is called");
846 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
847 "Invalid argument, session is null!");
848 CHECK_RETURN_RET_ELOG(types == nullptr, CAMERA_INVALID_ARGUMENT,
849 "Invalid argument, types is null!");
850 CHECK_RETURN_RET_ELOG(size == nullptr, CAMERA_INVALID_ARGUMENT,
851 "Invalid argument, size is null!");
852
853 return session->GetSupportedEffectTypes(types, size);
854 }
855
OH_CaptureSession_DeleteSupportedEffectTypes(Camera_CaptureSession * session,Camera_ControlCenterEffectType * types,uint32_t size)856 Camera_ErrorCode OH_CaptureSession_DeleteSupportedEffectTypes(Camera_CaptureSession* session,
857 Camera_ControlCenterEffectType* types, uint32_t size)
858 {
859 MEDIA_DEBUG_LOG("OH_CaptureSession_DeleteSupportedEffectTypes is called");
860 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
861 "Invalid argument, session is null!");
862 CHECK_RETURN_RET_ELOG(types == nullptr, CAMERA_INVALID_ARGUMENT,
863 "Invalid argument, colorSpace is null!");
864
865 return session->DeleteEffectTypes(types);
866 }
867
OH_CaptureSession_EnableControlCenter(Camera_CaptureSession * session,bool enabled)868 Camera_ErrorCode OH_CaptureSession_EnableControlCenter(Camera_CaptureSession* session, bool enabled)
869 {
870 MEDIA_DEBUG_LOG("OH_CaptureSession_EnableControlCenter is called");
871 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
872 "Invalid argument, session is null!");
873 return session->EnableControlCenter(enabled);
874 }
875
OH_CaptureSession_RegisterControlCenterEffectStatusChangeCallback(Camera_CaptureSession * session,OH_CaptureSession_OnControlCenterEffectStatusChange controlCenterEffectStatusChange)876 Camera_ErrorCode OH_CaptureSession_RegisterControlCenterEffectStatusChangeCallback(
877 Camera_CaptureSession* session,
878 OH_CaptureSession_OnControlCenterEffectStatusChange controlCenterEffectStatusChange)
879 {
880 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
881 CHECK_RETURN_RET_ELOG(controlCenterEffectStatusChange == nullptr, CAMERA_INVALID_ARGUMENT,
882 "Invalid argument, callback is null!");
883 session->RegisterControlCenterEffectStatusChangeCallback(controlCenterEffectStatusChange);
884 return CAMERA_OK;
885 }
886
OH_CaptureSession_UnregisterControlCenterEffectStatusChangeCallback(Camera_CaptureSession * session,OH_CaptureSession_OnControlCenterEffectStatusChange controlCenterEffectStatusChange)887 Camera_ErrorCode OH_CaptureSession_UnregisterControlCenterEffectStatusChangeCallback(
888 Camera_CaptureSession* session,
889 OH_CaptureSession_OnControlCenterEffectStatusChange controlCenterEffectStatusChange)
890 {
891 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
892 CHECK_RETURN_RET_ELOG(controlCenterEffectStatusChange == nullptr, CAMERA_INVALID_ARGUMENT,
893 "Invalid argument, callback is null!");
894 session->UnregisterControlCenterEffectStatusChangeCallback(controlCenterEffectStatusChange);
895 return CAMERA_OK;
896 }
897
OH_CaptureSession_RegisterMacroStatusChangeCallback(Camera_CaptureSession * session,OH_CaptureSession_OnMacroStatusChange macroStatusChange)898 Camera_ErrorCode OH_CaptureSession_RegisterMacroStatusChangeCallback(
899 Camera_CaptureSession* session, OH_CaptureSession_OnMacroStatusChange macroStatusChange)
900 {
901 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
902 CHECK_RETURN_RET_ELOG(
903 macroStatusChange == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, callback is null!");
904 session->RegisterMacroStatusCallback(macroStatusChange);
905 return CAMERA_OK;
906 }
907
OH_CaptureSession_UnregisterMacroStatusChangeCallback(Camera_CaptureSession * session,OH_CaptureSession_OnMacroStatusChange macroStatusChange)908 Camera_ErrorCode OH_CaptureSession_UnregisterMacroStatusChangeCallback(
909 Camera_CaptureSession* session, OH_CaptureSession_OnMacroStatusChange macroStatusChange)
910 {
911 CHECK_RETURN_RET_ELOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
912 CHECK_RETURN_RET_ELOG(
913 macroStatusChange == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, callback is null!");
914 session->UnregisterMacroStatusCallback(macroStatusChange);
915 return CAMERA_OK;
916 }
917
918 #ifdef __cplusplus
919 }
920 #endif
921