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