• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2023 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 "impl/capture_session_impl.h"
18 #include "camera_log.h"
19 #include "hilog/log.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
OH_CaptureSession_RegisterCallback(Camera_CaptureSession * session,CaptureSession_Callbacks * callback)25 Camera_ErrorCode OH_CaptureSession_RegisterCallback(Camera_CaptureSession* session, CaptureSession_Callbacks* callback)
26 {
27     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
28     CHECK_ERROR_RETURN_RET_LOG(callback == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, callback is null!");
29     CHECK_ERROR_RETURN_RET_LOG(callback->onFocusStateChange == nullptr && callback->onError == nullptr,
30         CAMERA_INVALID_ARGUMENT, "Invalid argument, callback onFocusStateChange and onError are null!");
31 
32     session->RegisterCallback(callback);
33     return CAMERA_OK;
34 }
35 
OH_CaptureSession_UnregisterCallback(Camera_CaptureSession * session,CaptureSession_Callbacks * callback)36 Camera_ErrorCode OH_CaptureSession_UnregisterCallback(Camera_CaptureSession* session,
37     CaptureSession_Callbacks* callback)
38 {
39     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
40     CHECK_ERROR_RETURN_RET_LOG(callback == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, callback is null!");
41     CHECK_ERROR_RETURN_RET_LOG(callback->onFocusStateChange == nullptr && callback->onError == nullptr,
42         CAMERA_INVALID_ARGUMENT, "Invalid argument, callback onFocusStateChange and onError are null!");
43 
44     session->UnregisterCallback(callback);
45     return CAMERA_OK;
46 }
47 
OH_CaptureSession_RegisterSmoothZoomInfoCallback(Camera_CaptureSession * session,OH_CaptureSession_OnSmoothZoomInfo smoothZoomInfoCallback)48 Camera_ErrorCode OH_CaptureSession_RegisterSmoothZoomInfoCallback(Camera_CaptureSession* session,
49     OH_CaptureSession_OnSmoothZoomInfo smoothZoomInfoCallback)
50 {
51     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
52     CHECK_ERROR_RETURN_RET_LOG(smoothZoomInfoCallback == nullptr, CAMERA_INVALID_ARGUMENT,
53         "Invalid argument, callback is null!");
54     session->RegisterSmoothZoomInfoCallback(smoothZoomInfoCallback);
55     return CAMERA_OK;
56 }
57 
OH_CaptureSession_UnregisterSmoothZoomInfoCallback(Camera_CaptureSession * session,OH_CaptureSession_OnSmoothZoomInfo smoothZoomInfoCallback)58 Camera_ErrorCode OH_CaptureSession_UnregisterSmoothZoomInfoCallback(Camera_CaptureSession* session,
59     OH_CaptureSession_OnSmoothZoomInfo smoothZoomInfoCallback)
60 {
61     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
62     CHECK_ERROR_RETURN_RET_LOG(smoothZoomInfoCallback == nullptr, CAMERA_INVALID_ARGUMENT,
63         "Invalid argument, callback is null!");
64     session->UnregisterSmoothZoomInfoCallback(smoothZoomInfoCallback);
65     return CAMERA_OK;
66 }
67 
OH_CaptureSession_SetSessionMode(Camera_CaptureSession * session,Camera_SceneMode sceneMode)68 Camera_ErrorCode OH_CaptureSession_SetSessionMode(Camera_CaptureSession* session, Camera_SceneMode sceneMode)
69 {
70     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
71 
72     return session->SetSessionMode(sceneMode);
73 }
74 
OH_CaptureSession_AddSecureOutput(Camera_CaptureSession * session,Camera_PreviewOutput * previewOutput)75 Camera_ErrorCode OH_CaptureSession_AddSecureOutput(Camera_CaptureSession* session, Camera_PreviewOutput* previewOutput)
76 {
77     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
78     CHECK_ERROR_RETURN_RET_LOG(previewOutput == nullptr,
79         CAMERA_INVALID_ARGUMENT, "Invalid argument, previewOutput is null!");
80     return session->AddSecureOutput(previewOutput);
81 }
82 
OH_CaptureSession_BeginConfig(Camera_CaptureSession * session)83 Camera_ErrorCode OH_CaptureSession_BeginConfig(Camera_CaptureSession* session)
84 {
85     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
86 
87     return session->BeginConfig();
88 }
89 
OH_CaptureSession_CommitConfig(Camera_CaptureSession * session)90 Camera_ErrorCode OH_CaptureSession_CommitConfig(Camera_CaptureSession* session)
91 {
92     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
93 
94     return session->CommitConfig();
95 }
96 
OH_CaptureSession_AddInput(Camera_CaptureSession * session,Camera_Input * cameraInput)97 Camera_ErrorCode OH_CaptureSession_AddInput(Camera_CaptureSession* session, Camera_Input* cameraInput)
98 {
99     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
100     CHECK_ERROR_RETURN_RET_LOG(cameraInput == nullptr, CAMERA_INVALID_ARGUMENT,
101         "Invalid argument, cameraInput is null!");
102 
103     return session->AddInput(cameraInput);
104 }
105 
OH_CaptureSession_RemoveInput(Camera_CaptureSession * session,Camera_Input * cameraInput)106 Camera_ErrorCode OH_CaptureSession_RemoveInput(Camera_CaptureSession* session, Camera_Input* cameraInput)
107 {
108     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
109     CHECK_ERROR_RETURN_RET_LOG(cameraInput == nullptr, CAMERA_INVALID_ARGUMENT,
110         "Invalid argument, cameraInput is null!");
111 
112     return session->RemoveInput(cameraInput);
113 }
114 
OH_CaptureSession_AddPreviewOutput(Camera_CaptureSession * session,Camera_PreviewOutput * previewOutput)115 Camera_ErrorCode OH_CaptureSession_AddPreviewOutput(Camera_CaptureSession* session,
116     Camera_PreviewOutput* previewOutput)
117 {
118     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
119     CHECK_ERROR_RETURN_RET_LOG(previewOutput == nullptr, CAMERA_INVALID_ARGUMENT,
120         "Invalid argument, previewOutput is null!");
121 
122     return session->AddPreviewOutput(previewOutput);
123 }
124 
OH_CaptureSession_RemovePreviewOutput(Camera_CaptureSession * session,Camera_PreviewOutput * previewOutput)125 Camera_ErrorCode OH_CaptureSession_RemovePreviewOutput(Camera_CaptureSession* session,
126     Camera_PreviewOutput* previewOutput)
127 {
128     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
129     CHECK_ERROR_RETURN_RET_LOG(previewOutput == nullptr, CAMERA_INVALID_ARGUMENT,
130         "Invalid argument, previewOutput is null!");
131 
132     return session->RemovePreviewOutput(previewOutput);
133 }
134 
OH_CaptureSession_AddPhotoOutput(Camera_CaptureSession * session,Camera_PhotoOutput * photoOutput)135 Camera_ErrorCode OH_CaptureSession_AddPhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput)
136 {
137     MEDIA_DEBUG_LOG("OH_CaptureSession_AddPhotoOutput is called");
138     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
139     CHECK_ERROR_RETURN_RET_LOG(photoOutput == nullptr, CAMERA_INVALID_ARGUMENT,
140         "Invalid argument, photoOutput is null!");
141 
142     return session->AddPhotoOutput(photoOutput);
143 }
144 
OH_CaptureSession_RemovePhotoOutput(Camera_CaptureSession * session,Camera_PhotoOutput * photoOutput)145 Camera_ErrorCode OH_CaptureSession_RemovePhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput)
146 {
147     MEDIA_DEBUG_LOG("OH_CaptureSession_RemovePhotoOutput is called");
148     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
149     CHECK_ERROR_RETURN_RET_LOG(photoOutput == nullptr, CAMERA_INVALID_ARGUMENT,
150         "Invalid argument, photoOutput is null!");
151 
152     return session->RemovePhotoOutput(photoOutput);
153 }
154 
OH_CaptureSession_AddMetadataOutput(Camera_CaptureSession * session,Camera_MetadataOutput * metadataOutput)155 Camera_ErrorCode OH_CaptureSession_AddMetadataOutput(Camera_CaptureSession* session,
156     Camera_MetadataOutput* metadataOutput)
157 {
158     MEDIA_DEBUG_LOG("OH_CaptureSession_AddMetadataOutput is called");
159     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
160     CHECK_ERROR_RETURN_RET_LOG(metadataOutput == nullptr, CAMERA_INVALID_ARGUMENT,
161         "Invalid argument, metadataOutput is null!");
162 
163     return session->AddMetaDataOutput(metadataOutput);
164 }
165 
OH_CaptureSession_RemoveMetadataOutput(Camera_CaptureSession * session,Camera_MetadataOutput * metadataOutput)166 Camera_ErrorCode OH_CaptureSession_RemoveMetadataOutput(Camera_CaptureSession* session,
167     Camera_MetadataOutput* metadataOutput)
168 {
169     MEDIA_DEBUG_LOG("OH_CaptureSession_RemoveMetadataOutput is called");
170     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
171     CHECK_ERROR_RETURN_RET_LOG(metadataOutput == nullptr, CAMERA_INVALID_ARGUMENT,
172         "Invalid argument, metadataOutput is null!");
173 
174     return session->RemoveMetaDataOutput(metadataOutput);
175 }
176 
OH_CaptureSession_IsVideoStabilizationModeSupported(Camera_CaptureSession * session,Camera_VideoStabilizationMode mode,bool * isSupported)177 Camera_ErrorCode OH_CaptureSession_IsVideoStabilizationModeSupported(Camera_CaptureSession* session,
178     Camera_VideoStabilizationMode mode, bool* isSupported)
179 {
180     MEDIA_DEBUG_LOG("OH_CaptureSession_IsVideoStabilizationModeSupported is called");
181     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
182     CHECK_ERROR_RETURN_RET_LOG(isSupported == nullptr, CAMERA_INVALID_ARGUMENT,
183         "Invalid argument, isSupported is null!");
184     CHECK_ERROR_RETURN_RET_LOG(mode != STABILIZATION_MODE_OFF &&
185         mode != STABILIZATION_MODE_LOW &&
186         mode != STABILIZATION_MODE_MIDDLE &&
187         mode != STABILIZATION_MODE_HIGH &&
188         mode != STABILIZATION_MODE_AUTO,
189         CAMERA_INVALID_ARGUMENT, "Invalid argument, mode is invaid!");
190 
191     return session->IsVideoStabilizationModeSupported(mode, isSupported);
192 }
193 
OH_CaptureSession_GetVideoStabilizationMode(Camera_CaptureSession * session,Camera_VideoStabilizationMode * mode)194 Camera_ErrorCode OH_CaptureSession_GetVideoStabilizationMode(Camera_CaptureSession* session,
195     Camera_VideoStabilizationMode* mode)
196 {
197     MEDIA_DEBUG_LOG("OH_CaptureSession_GetVideoStabilizationMode is called");
198     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
199     CHECK_ERROR_RETURN_RET_LOG(mode == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, mode is null!");
200 
201     return session->GetVideoStabilizationMode(mode);
202 }
203 
OH_CaptureSession_SetVideoStabilizationMode(Camera_CaptureSession * session,Camera_VideoStabilizationMode mode)204 Camera_ErrorCode OH_CaptureSession_SetVideoStabilizationMode(Camera_CaptureSession* session,
205     Camera_VideoStabilizationMode mode)
206 {
207     MEDIA_DEBUG_LOG("OH_CaptureSession_SetVideoStabilizationMode is called");
208     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
209     CHECK_ERROR_RETURN_RET_LOG(mode != STABILIZATION_MODE_OFF &&
210         mode != STABILIZATION_MODE_LOW &&
211         mode != STABILIZATION_MODE_MIDDLE &&
212         mode != STABILIZATION_MODE_HIGH &&
213         mode != STABILIZATION_MODE_AUTO,
214         CAMERA_INVALID_ARGUMENT, "Invalid argument, mode is invaid!");
215 
216     return session->SetVideoStabilizationMode(mode);
217 }
218 
OH_CaptureSession_GetZoomRatioRange(Camera_CaptureSession * session,float * minZoom,float * maxZoom)219 Camera_ErrorCode OH_CaptureSession_GetZoomRatioRange(Camera_CaptureSession* session, float* minZoom, float* maxZoom)
220 {
221     MEDIA_DEBUG_LOG("OH_CaptureSession_GetZoomRatioRange is called");
222     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
223     CHECK_ERROR_RETURN_RET_LOG(minZoom == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, minZoom is null!");
224     CHECK_ERROR_RETURN_RET_LOG(maxZoom == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, maxZoom is null!");
225 
226     return session->GetZoomRatioRange(minZoom, maxZoom);
227 }
228 
OH_CaptureSession_GetZoomRatio(Camera_CaptureSession * session,float * zoom)229 Camera_ErrorCode OH_CaptureSession_GetZoomRatio(Camera_CaptureSession* session, float* zoom)
230 {
231     MEDIA_DEBUG_LOG("OH_CaptureSession_GetZoomRatio is called");
232     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
233     CHECK_ERROR_RETURN_RET_LOG(zoom == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, zoom is null!");
234 
235     return session->GetZoomRatio(zoom);
236 }
237 
OH_CaptureSession_SetZoomRatio(Camera_CaptureSession * session,float zoom)238 Camera_ErrorCode OH_CaptureSession_SetZoomRatio(Camera_CaptureSession* session, float zoom)
239 {
240     MEDIA_DEBUG_LOG("OH_CaptureSession_SetZoomRatio is called");
241     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
242 
243     return session->SetZoomRatio(zoom);
244 }
245 
OH_CaptureSession_IsFocusModeSupported(Camera_CaptureSession * session,Camera_FocusMode focusMode,bool * isSupported)246 Camera_ErrorCode OH_CaptureSession_IsFocusModeSupported(Camera_CaptureSession* session,
247     Camera_FocusMode focusMode, bool* isSupported)
248 {
249     MEDIA_DEBUG_LOG("OH_CaptureSession_IsFocusModeSupported is called");
250     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
251     CHECK_ERROR_RETURN_RET_LOG(focusMode != FOCUS_MODE_MANUAL &&
252         focusMode != FOCUS_MODE_CONTINUOUS_AUTO &&
253         focusMode != FOCUS_MODE_AUTO &&
254         focusMode != FOCUS_MODE_LOCKED,
255         CAMERA_INVALID_ARGUMENT, "Invalid argument,focusMode is invaild!");
256     CHECK_ERROR_RETURN_RET_LOG(isSupported == nullptr, CAMERA_INVALID_ARGUMENT,
257         "Invalid argument, isSupported is null!");
258 
259     return session->IsFocusModeSupported(focusMode, isSupported);
260 }
261 
OH_CaptureSession_GetFocusMode(Camera_CaptureSession * session,Camera_FocusMode * focusMode)262 Camera_ErrorCode OH_CaptureSession_GetFocusMode(Camera_CaptureSession* session, Camera_FocusMode* focusMode)
263 {
264     MEDIA_DEBUG_LOG("OH_CaptureSession_GetFocusMode is called");
265     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
266     CHECK_ERROR_RETURN_RET_LOG(focusMode == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, focusMode is null!");
267 
268     return session->GetFocusMode(focusMode);
269 }
270 
OH_CaptureSession_SetFocusMode(Camera_CaptureSession * session,Camera_FocusMode focusMode)271 Camera_ErrorCode OH_CaptureSession_SetFocusMode(Camera_CaptureSession* session, Camera_FocusMode focusMode)
272 {
273     MEDIA_DEBUG_LOG("OH_CaptureSession_SetFocusMode is called");
274     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
275     CHECK_ERROR_RETURN_RET_LOG(focusMode != FOCUS_MODE_MANUAL &&
276         focusMode != FOCUS_MODE_CONTINUOUS_AUTO &&
277         focusMode != FOCUS_MODE_AUTO &&
278         focusMode != FOCUS_MODE_LOCKED,
279         CAMERA_INVALID_ARGUMENT, "Invalid argument,focusMode is invaild!");
280 
281     return session->SetFocusMode(focusMode);
282 }
283 
OH_CaptureSession_SetFocusPoint(Camera_CaptureSession * session,Camera_Point focusPoint)284 Camera_ErrorCode OH_CaptureSession_SetFocusPoint(Camera_CaptureSession* session, Camera_Point focusPoint)
285 {
286     MEDIA_DEBUG_LOG("OH_CaptureSession_SetFocusPoint is called");
287     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
288 
289     return session->SetFocusPoint(focusPoint);
290 }
291 
OH_CaptureSession_GetFocusPoint(Camera_CaptureSession * session,Camera_Point * focusPoint)292 Camera_ErrorCode OH_CaptureSession_GetFocusPoint(Camera_CaptureSession* session, Camera_Point* focusPoint)
293 {
294     MEDIA_DEBUG_LOG("OH_CaptureSession_GetFocusPoint is called");
295     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
296     CHECK_ERROR_RETURN_RET_LOG(focusPoint == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, focusPoint is null!");
297 
298     return session->GetFocusPoint(focusPoint);
299 }
300 
OH_CaptureSession_AddVideoOutput(Camera_CaptureSession * session,Camera_VideoOutput * videoOutput)301 Camera_ErrorCode OH_CaptureSession_AddVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput)
302 {
303     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
304     CHECK_ERROR_RETURN_RET_LOG(videoOutput == nullptr, CAMERA_INVALID_ARGUMENT,
305         "Invalid argument, videoOutput is null!");
306 
307     return session->AddVideoOutput(videoOutput);
308 }
309 
OH_CaptureSession_RemoveVideoOutput(Camera_CaptureSession * session,Camera_VideoOutput * videoOutput)310 Camera_ErrorCode OH_CaptureSession_RemoveVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput)
311 {
312     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
313     CHECK_ERROR_RETURN_RET_LOG(videoOutput == nullptr, CAMERA_INVALID_ARGUMENT,
314         "Invalid argument, videoOutput is null!");
315 
316     return session->RemoveVideoOutput(videoOutput);
317 }
318 
OH_CaptureSession_Start(Camera_CaptureSession * session)319 Camera_ErrorCode OH_CaptureSession_Start(Camera_CaptureSession* session)
320 {
321     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
322 
323     return session->Start();
324 }
325 
OH_CaptureSession_Stop(Camera_CaptureSession * session)326 Camera_ErrorCode OH_CaptureSession_Stop(Camera_CaptureSession* session)
327 {
328     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
329 
330     return session->Stop();
331 }
332 
OH_CaptureSession_Release(Camera_CaptureSession * session)333 Camera_ErrorCode OH_CaptureSession_Release(Camera_CaptureSession* session)
334 {
335     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
336 
337     Camera_ErrorCode retCode = session->Release();
338     if (session != nullptr) {
339         delete session;
340     }
341     return retCode;
342 }
343 
OH_CaptureSession_HasFlash(Camera_CaptureSession * session,bool * hasFlash)344 Camera_ErrorCode OH_CaptureSession_HasFlash(Camera_CaptureSession* session, bool* hasFlash)
345 {
346     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
347     CHECK_ERROR_RETURN_RET_LOG(hasFlash == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, hasFlash is null!");
348 
349     return session->HasFlash(hasFlash);
350 }
351 
OH_CaptureSession_IsFlashModeSupported(Camera_CaptureSession * session,Camera_FlashMode flashMode,bool * isSupported)352 Camera_ErrorCode OH_CaptureSession_IsFlashModeSupported(Camera_CaptureSession* session,
353     Camera_FlashMode flashMode, bool* isSupported)
354 {
355     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
356     CHECK_ERROR_RETURN_RET_LOG(isSupported == nullptr, CAMERA_INVALID_ARGUMENT,
357         "Invalid argument, isSupported is null!");
358 
359     return session->IsFlashModeSupported(flashMode, isSupported);
360 }
361 
OH_CaptureSession_GetFlashMode(Camera_CaptureSession * session,Camera_FlashMode * flashMode)362 Camera_ErrorCode OH_CaptureSession_GetFlashMode(Camera_CaptureSession* session, Camera_FlashMode* flashMode)
363 {
364     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
365     CHECK_ERROR_RETURN_RET_LOG(flashMode == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, flashMode is null!");
366 
367     return session->GetFlashMode(flashMode);
368 }
369 
OH_CaptureSession_SetFlashMode(Camera_CaptureSession * session,Camera_FlashMode flashMode)370 Camera_ErrorCode OH_CaptureSession_SetFlashMode(Camera_CaptureSession* session, Camera_FlashMode flashMode)
371 {
372     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
373     CHECK_ERROR_RETURN_RET_LOG(flashMode != FLASH_MODE_CLOSE &&
374         flashMode != FLASH_MODE_OPEN &&
375         flashMode != FLASH_MODE_AUTO &&
376         flashMode != FLASH_MODE_ALWAYS_OPEN,
377         CAMERA_INVALID_ARGUMENT, "Invalid argument,flashMode is invaild!");
378     return session->SetFlashMode(flashMode);
379 }
380 
OH_CaptureSession_IsExposureModeSupported(Camera_CaptureSession * session,Camera_ExposureMode exposureMode,bool * isSupported)381 Camera_ErrorCode OH_CaptureSession_IsExposureModeSupported(Camera_CaptureSession* session,
382     Camera_ExposureMode exposureMode, bool* isSupported)
383 {
384     MEDIA_DEBUG_LOG("OH_CaptureSession_IsExposureModeSupported is called");
385     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
386     CHECK_ERROR_RETURN_RET_LOG(isSupported == nullptr,
387         CAMERA_INVALID_ARGUMENT, "Invalid argument, isSupported is null!");
388     CHECK_ERROR_RETURN_RET_LOG(exposureMode != EXPOSURE_MODE_LOCKED &&
389         exposureMode != EXPOSURE_MODE_AUTO &&
390         exposureMode != EXPOSURE_MODE_CONTINUOUS_AUTO,
391         CAMERA_INVALID_ARGUMENT, "Invalid argument,exposureMode is invaild!");
392     return session->IsExposureModeSupported(exposureMode, isSupported);
393 }
394 
OH_CaptureSession_GetExposureMode(Camera_CaptureSession * session,Camera_ExposureMode * exposureMode)395 Camera_ErrorCode OH_CaptureSession_GetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode* exposureMode)
396 {
397     MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureMode is called");
398     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
399     CHECK_ERROR_RETURN_RET_LOG(exposureMode == nullptr, CAMERA_INVALID_ARGUMENT,
400         "Invalid argument, exposureMode is null!");
401     return session->GetExposureMode(exposureMode);
402 }
403 
OH_CaptureSession_SetExposureMode(Camera_CaptureSession * session,Camera_ExposureMode exposureMode)404 Camera_ErrorCode OH_CaptureSession_SetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode exposureMode)
405 {
406     MEDIA_DEBUG_LOG("OH_CaptureSession_SetExposureMode is called");
407     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
408     CHECK_ERROR_RETURN_RET_LOG(exposureMode != EXPOSURE_MODE_LOCKED &&
409         exposureMode != EXPOSURE_MODE_AUTO &&
410         exposureMode != EXPOSURE_MODE_CONTINUOUS_AUTO,
411         CAMERA_INVALID_ARGUMENT, "Invalid argument,exposureMode is invaild!");
412 
413     return session->SetExposureMode(exposureMode);
414 }
415 
OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession * session,Camera_Point * point)416 Camera_ErrorCode OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession* session, Camera_Point* point)
417 {
418     MEDIA_DEBUG_LOG("OH_CaptureSession_GetMeteringPoint is called");
419     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
420     CHECK_ERROR_RETURN_RET_LOG(point == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, point is null!");
421     return session->GetMeteringPoint(point);
422 }
423 
OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession * session,Camera_Point point)424 Camera_ErrorCode OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession* session, Camera_Point point)
425 {
426     MEDIA_DEBUG_LOG("OH_CaptureSession_SetMeteringPoint is called");
427     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
428     CHECK_ERROR_RETURN_RET_LOG(point.x < 0 || point.y < 0,
429         CAMERA_INVALID_ARGUMENT, "Invalid argument, point is invaild!");
430 
431     return session->SetMeteringPoint(point);
432 }
433 
OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession * session,float * minExposureBias,float * maxExposureBias,float * step)434 Camera_ErrorCode OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession* session,
435     float* minExposureBias, float* maxExposureBias, float* step)
436 {
437     MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureBiasRange is called");
438     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
439     CHECK_ERROR_RETURN_RET_LOG(minExposureBias == nullptr, CAMERA_INVALID_ARGUMENT,
440         "Invalid argument, minExposureBias is null!");
441     CHECK_ERROR_RETURN_RET_LOG(maxExposureBias == nullptr, CAMERA_INVALID_ARGUMENT,
442         "Invalid argument, maxExposureBias is null!");
443     CHECK_ERROR_RETURN_RET_LOG(step == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, step is null!");
444     return session->GetExposureBiasRange(minExposureBias, maxExposureBias, step);
445 }
446 
OH_CaptureSession_SetExposureBias(Camera_CaptureSession * session,float exposureBias)447 Camera_ErrorCode OH_CaptureSession_SetExposureBias(Camera_CaptureSession* session, float exposureBias)
448 {
449     MEDIA_DEBUG_LOG("OH_CaptureSession_SetExposureBias is called");
450     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
451     return session->SetExposureBias(exposureBias);
452 }
OH_CaptureSession_GetExposureBias(Camera_CaptureSession * session,float * exposureBias)453 Camera_ErrorCode OH_CaptureSession_GetExposureBias(Camera_CaptureSession* session, float* exposureBias)
454 {
455     MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureBias is called");
456     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
457     CHECK_ERROR_RETURN_RET_LOG(exposureBias == nullptr, CAMERA_INVALID_ARGUMENT,
458         "Invalid argument, exposureBias is null!");
459     return session->GetExposureBias(exposureBias);
460 }
461 
OH_CaptureSession_CanAddInput(Camera_CaptureSession * session,Camera_Input * cameraInput,bool * isSuccessful)462 Camera_ErrorCode OH_CaptureSession_CanAddInput(Camera_CaptureSession* session,
463     Camera_Input* cameraInput, bool* isSuccessful)
464 {
465     MEDIA_DEBUG_LOG("OH_CaptureSession_CanAddInput is called");
466     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
467         "Invalid argument, session is null!");
468     CHECK_ERROR_RETURN_RET_LOG(cameraInput == nullptr, CAMERA_INVALID_ARGUMENT,
469         "Invalid argument, cameraInput is null!");
470     CHECK_ERROR_RETURN_RET_LOG(isSuccessful == nullptr, CAMERA_INVALID_ARGUMENT,
471         "Invalid argument, isSuccessful is null!");
472 
473     return session->CanAddInput(cameraInput, isSuccessful);
474 }
475 
OH_CaptureSession_CanAddPreviewOutput(Camera_CaptureSession * session,Camera_PreviewOutput * cameraOutput,bool * isSuccessful)476 Camera_ErrorCode OH_CaptureSession_CanAddPreviewOutput(Camera_CaptureSession* session,
477     Camera_PreviewOutput* cameraOutput, bool* isSuccessful)
478 {
479     MEDIA_DEBUG_LOG("OH_CaptureSession_CanAddPreviewOutput is called");
480     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
481         "Invalid argument, session is null!");
482     CHECK_ERROR_RETURN_RET_LOG(cameraOutput == nullptr, CAMERA_INVALID_ARGUMENT,
483         "Invalid argument, cameraOutput is null!");
484     CHECK_ERROR_RETURN_RET_LOG(isSuccessful == nullptr, CAMERA_INVALID_ARGUMENT,
485         "Invalid argument, isSuccessful is null!");
486 
487     return session->CanAddPreviewOutput(cameraOutput, isSuccessful);
488 }
489 
OH_CaptureSession_CanAddPhotoOutput(Camera_CaptureSession * session,Camera_PhotoOutput * cameraOutput,bool * isSuccessful)490 Camera_ErrorCode OH_CaptureSession_CanAddPhotoOutput(Camera_CaptureSession* session,
491     Camera_PhotoOutput* cameraOutput, bool* isSuccessful)
492 {
493     MEDIA_DEBUG_LOG("OH_CaptureSession_CanAddPhotoOutput is called");
494     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
495         "Invalid argument, session is null!");
496     CHECK_ERROR_RETURN_RET_LOG(cameraOutput == nullptr, CAMERA_INVALID_ARGUMENT,
497         "Invalid argument, cameraOutput is null!");
498     CHECK_ERROR_RETURN_RET_LOG(isSuccessful == nullptr, CAMERA_INVALID_ARGUMENT,
499         "Invalid argument, isSuccessful is null!");
500 
501     return session->CanAddPhotoOutput(cameraOutput, isSuccessful);
502 }
503 
OH_CaptureSession_CanAddVideoOutput(Camera_CaptureSession * session,Camera_VideoOutput * cameraOutput,bool * isSuccessful)504 Camera_ErrorCode OH_CaptureSession_CanAddVideoOutput(Camera_CaptureSession* session,
505     Camera_VideoOutput* cameraOutput, bool* isSuccessful)
506 {
507     MEDIA_DEBUG_LOG("OH_CaptureSession_CanAddVideoOutput is called");
508     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
509         "Invalid argument, session is null!");
510     CHECK_ERROR_RETURN_RET_LOG(cameraOutput == nullptr, CAMERA_INVALID_ARGUMENT,
511         "Invalid argument, cameraOutput is null!");
512     CHECK_ERROR_RETURN_RET_LOG(isSuccessful == nullptr, CAMERA_INVALID_ARGUMENT,
513         "Invalid argument, isSuccessful is null!");
514 
515     return session->CanAddVideoOutput(cameraOutput, isSuccessful);
516 }
517 
OH_CaptureSession_CanPreconfig(Camera_CaptureSession * session,Camera_PreconfigType preconfigType,bool * canPreconfig)518 Camera_ErrorCode OH_CaptureSession_CanPreconfig(Camera_CaptureSession* session,
519     Camera_PreconfigType preconfigType, bool* canPreconfig)
520 {
521     MEDIA_DEBUG_LOG("OH_CaptureSession_CanPreconfig is called.");
522     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
523         "Invalid argument, session is null!");
524     CHECK_ERROR_RETURN_RET_LOG(canPreconfig == nullptr, CAMERA_INVALID_ARGUMENT,
525         "Invalid argument, canPreconfig is null!");
526 
527     return session->CanPreconfig(preconfigType, canPreconfig);
528 }
529 
OH_CaptureSession_CanPreconfigWithRatio(Camera_CaptureSession * session,Camera_PreconfigType preconfigType,Camera_PreconfigRatio preconfigRatio,bool * canPreconfig)530 Camera_ErrorCode OH_CaptureSession_CanPreconfigWithRatio(Camera_CaptureSession* session,
531     Camera_PreconfigType preconfigType, Camera_PreconfigRatio preconfigRatio, bool* canPreconfig)
532 {
533     MEDIA_DEBUG_LOG("OH_CaptureSession_CanPreconfigWithRatio is called.");
534     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
535         "Invalid argument, session is null!");
536     CHECK_ERROR_RETURN_RET_LOG(canPreconfig == nullptr, CAMERA_INVALID_ARGUMENT,
537         "Invalid argument, canPreconfig is null!");
538 
539     return session->CanPreconfigWithRatio(preconfigType, preconfigRatio, canPreconfig);
540 }
541 
OH_CaptureSession_Preconfig(Camera_CaptureSession * session,Camera_PreconfigType preconfigType)542 Camera_ErrorCode OH_CaptureSession_Preconfig(Camera_CaptureSession* session, Camera_PreconfigType preconfigType)
543 {
544     MEDIA_DEBUG_LOG("OH_CaptureSession_Preconfig is called.");
545     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
546         "Invalid argument, session is null!");
547 
548     return session->Preconfig(preconfigType);
549 }
550 
OH_CaptureSession_PreconfigWithRatio(Camera_CaptureSession * session,Camera_PreconfigType preconfigType,Camera_PreconfigRatio preconfigRatio)551 Camera_ErrorCode OH_CaptureSession_PreconfigWithRatio(Camera_CaptureSession* session,
552     Camera_PreconfigType preconfigType, Camera_PreconfigRatio preconfigRatio)
553 {
554     MEDIA_DEBUG_LOG("OH_CaptureSession_PreconfigWithRatio is called.");
555     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
556         "Invalid argument, session is null!");
557 
558     return session->PreconfigWithRatio(preconfigType, preconfigRatio);
559 }
560 
561 /**
562  * @since 12
563  * @version 1.0
564  */
OH_CaptureSession_GetExposureValue(Camera_CaptureSession * session,float * exposureValue)565 Camera_ErrorCode OH_CaptureSession_GetExposureValue(Camera_CaptureSession* session, float* exposureValue)
566 {
567     MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureValue is called");
568     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
569         "Invalid argument, session is null!");
570     CHECK_ERROR_RETURN_RET_LOG(exposureValue == nullptr, CAMERA_INVALID_ARGUMENT,
571         "Invalid argument, exposureValue is null!");
572 
573     return session->GetExposureValue(exposureValue);
574 }
575 
576 /**
577  * @since 12
578  * @version 1.0
579  */
OH_CaptureSession_GetFocalLength(Camera_CaptureSession * session,float * focalLength)580 Camera_ErrorCode OH_CaptureSession_GetFocalLength(Camera_CaptureSession* session, float* focalLength)
581 {
582     MEDIA_DEBUG_LOG("OH_CaptureSession_GetFocalLength is called");
583     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
584         "Invalid argument, session is null!");
585     CHECK_ERROR_RETURN_RET_LOG(focalLength == nullptr, CAMERA_INVALID_ARGUMENT,
586         "Invalid argument, focalLength is null!");
587 
588     return session->GetFocalLength(focalLength);
589 }
590 
591 /**
592  * @since 12
593  * @version 1.0
594  */
OH_CaptureSession_SetSmoothZoom(Camera_CaptureSession * session,float targetZoom,Camera_SmoothZoomMode smoothZoomMode)595 Camera_ErrorCode OH_CaptureSession_SetSmoothZoom(Camera_CaptureSession *session, float targetZoom,
596     Camera_SmoothZoomMode smoothZoomMode)
597 {
598     MEDIA_DEBUG_LOG("OH_CaptureSession_SetSmoothZoom is called");
599     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
600         "Invalid argument, session is null!");
601 
602     return session->SetSmoothZoom(targetZoom, smoothZoomMode);
603 }
604 
605 /**
606  * @since 12
607  * @version 1.0
608  */
OH_CaptureSession_GetSupportedColorSpaces(Camera_CaptureSession * session,OH_NativeBuffer_ColorSpace ** colorSpace,uint32_t * size)609 Camera_ErrorCode OH_CaptureSession_GetSupportedColorSpaces(Camera_CaptureSession* session,
610     OH_NativeBuffer_ColorSpace** colorSpace, uint32_t* size)
611 {
612     MEDIA_DEBUG_LOG("OH_CaptureSession_GetSupportedColorSpaces is called");
613     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
614         "Invalid argument, session is null!");
615     CHECK_ERROR_RETURN_RET_LOG(colorSpace == nullptr, CAMERA_INVALID_ARGUMENT,
616         "Invalid argument, colorSpace is null!");
617     CHECK_ERROR_RETURN_RET_LOG(size == nullptr, CAMERA_INVALID_ARGUMENT,
618         "Invalid argument, size is null!");
619 
620     return session->GetSupportedColorSpaces(colorSpace, size);
621 }
622 
623 /**
624  * @since 12
625  * @version 1.0
626  */
OH_CaptureSession_DeleteColorSpaces(Camera_CaptureSession * session,OH_NativeBuffer_ColorSpace * colorSpace)627 Camera_ErrorCode OH_CaptureSession_DeleteColorSpaces(Camera_CaptureSession* session,
628     OH_NativeBuffer_ColorSpace* colorSpace)
629 {
630     MEDIA_DEBUG_LOG("OH_CaptureSession_DeleteSupportedColorSpaces is called");
631     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
632         "Invalid argument, session is null!");
633     CHECK_ERROR_RETURN_RET_LOG(colorSpace == nullptr, CAMERA_INVALID_ARGUMENT,
634         "Invalid argument, colorSpace is null!");
635 
636     return session->DeleteColorSpaces(colorSpace);
637 }
638 
639 /**
640  * @since 12
641  * @version 1.0
642  */
OH_CaptureSession_GetActiveColorSpace(Camera_CaptureSession * session,OH_NativeBuffer_ColorSpace * colorSpace)643 Camera_ErrorCode OH_CaptureSession_GetActiveColorSpace(Camera_CaptureSession* session,
644     OH_NativeBuffer_ColorSpace* colorSpace)
645 {
646     MEDIA_DEBUG_LOG("OH_CaptureSession_GetActiveColorSpace is called");
647     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
648         "Invalid argument, session is null!");
649     CHECK_ERROR_RETURN_RET_LOG(colorSpace == nullptr, CAMERA_INVALID_ARGUMENT,
650         "Invalid argument, colorSpace is null!");
651 
652     return session->GetActiveColorSpace(colorSpace);
653 }
654 
655 /**
656  * @since 12
657  * @version 1.0
658  */
OH_CaptureSession_SetActiveColorSpace(Camera_CaptureSession * session,OH_NativeBuffer_ColorSpace colorSpace)659 Camera_ErrorCode OH_CaptureSession_SetActiveColorSpace(Camera_CaptureSession* session,
660     OH_NativeBuffer_ColorSpace colorSpace)
661 {
662     MEDIA_DEBUG_LOG("OH_CaptureSession_SetActiveColorSpace is called");
663     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
664         "Invalid argument, session is null!");
665 
666     return session->SetActiveColorSpace(colorSpace);
667 }
668 
669 /**
670  * @since 13
671  * @version 1.0
672  */
OH_CaptureSession_RegisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession * session,OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange)673 Camera_ErrorCode OH_CaptureSession_RegisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession* session,
674     OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange)
675 {
676     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
677     CHECK_ERROR_RETURN_RET_LOG(autoDeviceSwitchStatusChange == nullptr, CAMERA_INVALID_ARGUMENT,
678         "Invalid argument, callback is null!");
679     session->RegisterAutoDeviceSwitchStatusCallback(autoDeviceSwitchStatusChange);
680     return CAMERA_OK;
681 }
682 
683 /**
684  * @since 13
685  * @version 1.0
686  */
OH_CaptureSession_UnregisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession * session,OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange)687 Camera_ErrorCode OH_CaptureSession_UnregisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession* session,
688     OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange)
689 {
690     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
691     CHECK_ERROR_RETURN_RET_LOG(autoDeviceSwitchStatusChange == nullptr, CAMERA_INVALID_ARGUMENT,
692         "Invalid argument, callback is null!");
693     session->UnregisterAutoDeviceSwitchStatusCallback(autoDeviceSwitchStatusChange);
694     return CAMERA_OK;
695 }
696 
697 /**
698  * @since 13
699  * @version 1.0
700  */
OH_CaptureSession_IsAutoDeviceSwitchSupported(Camera_CaptureSession * session,bool * isSupported)701 Camera_ErrorCode OH_CaptureSession_IsAutoDeviceSwitchSupported(Camera_CaptureSession* session, bool* isSupported)
702 {
703     MEDIA_DEBUG_LOG("OH_CaptureSession_IsAutoDeviceSwitchSupported is called");
704     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
705         "Invalid argument, session is null!");
706     return session->IsAutoDeviceSwitchSupported(isSupported);
707 }
708 
709 /**
710  * @since 13
711  * @version 1.0
712  */
OH_CaptureSession_EnableAutoDeviceSwitch(Camera_CaptureSession * session,bool enabled)713 Camera_ErrorCode OH_CaptureSession_EnableAutoDeviceSwitch(Camera_CaptureSession* session, bool enabled)
714 {
715     MEDIA_DEBUG_LOG("OH_CaptureSession_EnableAutoDeviceSwitch is called");
716     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT,
717         "Invalid argument, session is null!");
718     return session->EnableAutoDeviceSwitch(enabled);
719 }
720 
721 /**
722  * @since 14
723  * @version 1.0
724  */
OH_CaptureSession_SetQualityPrioritization(Camera_CaptureSession * session,Camera_QualityPrioritization qualityPrioritization)725 Camera_ErrorCode OH_CaptureSession_SetQualityPrioritization(
726     Camera_CaptureSession* session, Camera_QualityPrioritization qualityPrioritization)
727 {
728     MEDIA_DEBUG_LOG("OH_CaptureSession_SetQualityPrioritization is called");
729     CHECK_ERROR_RETURN_RET_LOG(session == nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
730 
731     return session->SetQualityPrioritization(qualityPrioritization);
732 }
733 
734 #ifdef __cplusplus
735 }
736 #endif
737