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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
29     CHECK_AND_RETURN_RET_LOG(autoDeviceSwitchStatusChange != nullptr, CAMERA_INVALID_ARGUMENT,
30         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
43     CHECK_AND_RETURN_RET_LOG(autoDeviceSwitchStatusChange != nullptr, CAMERA_INVALID_ARGUMENT,
44         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
57         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
69         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
79     CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, callback is null!");
80     CHECK_AND_RETURN_RET_LOG(callback->onFocusStateChange != nullptr || callback->onError != nullptr,
81         CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
91     CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, callback is null!");
92     CHECK_AND_RETURN_RET_LOG(callback->onFocusStateChange != nullptr || callback->onError != nullptr,
93         CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
103     CHECK_AND_RETURN_RET_LOG(smoothZoomInfoCallback != nullptr, CAMERA_INVALID_ARGUMENT,
104         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
113     CHECK_AND_RETURN_RET_LOG(smoothZoomInfoCallback != nullptr, CAMERA_INVALID_ARGUMENT,
114         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
151     CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT,
152         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
160     CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT,
161         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
170     CHECK_AND_RETURN_RET_LOG(previewOutput != nullptr, CAMERA_INVALID_ARGUMENT,
171         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
180     CHECK_AND_RETURN_RET_LOG(previewOutput != nullptr, CAMERA_INVALID_ARGUMENT,
181         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
190     CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT,
191         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
200     CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT,
201         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
211     CHECK_AND_RETURN_RET_LOG(metadataOutput != nullptr, CAMERA_INVALID_ARGUMENT,
212         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
222     CHECK_AND_RETURN_RET_LOG(metadataOutput != nullptr, CAMERA_INVALID_ARGUMENT,
223         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
233     CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT,
234         "Invaild argument, isSupported is null!");
235     CHECK_AND_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, "Invaild argument,mode is invaild!");
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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
250     CHECK_AND_RETURN_RET_LOG(mode != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
260     CHECK_AND_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, "Invaild argument,mode is invaild!");
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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
274     CHECK_AND_RETURN_RET_LOG(minZoom != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, minZoom is null!");
275     CHECK_AND_RETURN_RET_LOG(maxZoom != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
284     CHECK_AND_RETURN_RET_LOG(zoom != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
302     CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT,
303         "Invaild argument, isSupported is null!");
304     CHECK_AND_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, "Invaild argument, focusMode is invaild!");
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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
317     CHECK_AND_RETURN_RET_LOG(focusMode != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
326     CHECK_AND_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, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
347     CHECK_AND_RETURN_RET_LOG(focusPoint != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
355     CHECK_AND_RETURN_RET_LOG(videoOutput != nullptr, CAMERA_INVALID_ARGUMENT,
356         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
364     CHECK_AND_RETURN_RET_LOG(videoOutput != nullptr, CAMERA_INVALID_ARGUMENT,
365         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
398     CHECK_AND_RETURN_RET_LOG(hasFlash != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
407     CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT,
408         "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
416     CHECK_AND_RETURN_RET_LOG(flashMode != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
424 
425     CHECK_AND_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, "Invaild argument, flashMode is invaild!");
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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
439     CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, isSupported is null!");
440     CHECK_AND_RETURN_RET_LOG(exposureMode == EXPOSURE_MODE_LOCKED ||
441         exposureMode == EXPOSURE_MODE_AUTO ||
442         exposureMode == EXPOSURE_MODE_CONTINUOUS_AUTO,
443         CAMERA_INVALID_ARGUMENT, "Invaild argument,exposureMode is invalid");
444     return session->IsExposureModeSupported(exposureMode, isSupported);
445 }
446 
OH_CaptureSession_GetExposureMode(Camera_CaptureSession * session,Camera_ExposureMode * exposureMode)447 Camera_ErrorCode OH_CaptureSession_GetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode* exposureMode)
448 {
449     MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureMode is called");
450     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
451     CHECK_AND_RETURN_RET_LOG(exposureMode != nullptr, CAMERA_INVALID_ARGUMENT,
452         "Invaild argument, exposureMode is null!");
453     return session->GetExposureMode(exposureMode);
454 }
455 
OH_CaptureSession_SetExposureMode(Camera_CaptureSession * session,Camera_ExposureMode exposureMode)456 Camera_ErrorCode OH_CaptureSession_SetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode exposureMode)
457 {
458     MEDIA_DEBUG_LOG("OH_CaptureSession_SetExposureMode is called");
459     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
460     CHECK_AND_RETURN_RET_LOG(exposureMode == EXPOSURE_MODE_LOCKED ||
461         exposureMode == EXPOSURE_MODE_AUTO ||
462         exposureMode == EXPOSURE_MODE_CONTINUOUS_AUTO,
463         CAMERA_INVALID_ARGUMENT, "Invaild argument,exposureMode is invalid");
464     return session->SetExposureMode(exposureMode);
465 }
466 
OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession * session,Camera_Point * point)467 Camera_ErrorCode OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession* session, Camera_Point* point)
468 {
469     MEDIA_DEBUG_LOG("OH_CaptureSession_GetMeteringPoint is called");
470     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
471     CHECK_AND_RETURN_RET_LOG(point != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, point is null!");
472     return session->GetMeteringPoint(point);
473 }
474 
OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession * session,Camera_Point point)475 Camera_ErrorCode OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession* session, Camera_Point point)
476 {
477     MEDIA_DEBUG_LOG("OH_CaptureSession_SetMeteringPoint is called");
478     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
479     CHECK_AND_RETURN_RET_LOG(point.x >= 0 && point.y >= 0, CAMERA_INVALID_ARGUMENT,
480         "Invaild argument, point is illeagal!");
481     return session->SetMeteringPoint(point);
482 }
483 
OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession * session,float * minExposureBias,float * maxExposureBias,float * step)484 Camera_ErrorCode OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession* session,
485     float* minExposureBias, float* maxExposureBias, float* step)
486 {
487     MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureBiasRange is called");
488     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
489     CHECK_AND_RETURN_RET_LOG(minExposureBias != nullptr, CAMERA_INVALID_ARGUMENT,
490         "Invaild argument, minExposureBias is null!");
491     CHECK_AND_RETURN_RET_LOG(maxExposureBias != nullptr, CAMERA_INVALID_ARGUMENT,
492         "Invaild argument, maxExposureBias is null!");
493     CHECK_AND_RETURN_RET_LOG(step != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, step is null!");
494     return session->GetExposureBiasRange(minExposureBias, maxExposureBias, step);
495 }
496 
OH_CaptureSession_SetExposureBias(Camera_CaptureSession * session,float exposureBias)497 Camera_ErrorCode OH_CaptureSession_SetExposureBias(Camera_CaptureSession* session, float exposureBias)
498 {
499     MEDIA_DEBUG_LOG("OH_CaptureSession_SetExposureBias is called");
500     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
501     return session->SetExposureBias(exposureBias);
502 }
OH_CaptureSession_GetExposureBias(Camera_CaptureSession * session,float * exposureBias)503 Camera_ErrorCode OH_CaptureSession_GetExposureBias(Camera_CaptureSession* session, float* exposureBias)
504 {
505     MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureBias is called");
506     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invaild argument, session is null!");
507     CHECK_AND_RETURN_RET_LOG(exposureBias != nullptr, CAMERA_INVALID_ARGUMENT,
508         "Invaild argument, exposureBias is null!");
509     return session->GetExposureBias(exposureBias);
510 }
511 
OH_CaptureSession_CanAddInput(Camera_CaptureSession * session,Camera_Input * cameraInput,bool * isSuccessful)512 Camera_ErrorCode OH_CaptureSession_CanAddInput(Camera_CaptureSession* session,
513     Camera_Input* cameraInput, bool* isSuccessful)
514 {
515     MEDIA_DEBUG_LOG("OH_CaptureSession_CanAddInput is called");
516     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
517         "Invaild argument, session is null!");
518     CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT,
519         "Invaild argument, cameraInput is null!");
520     CHECK_AND_RETURN_RET_LOG(isSuccessful != nullptr, CAMERA_INVALID_ARGUMENT,
521         "Invaild argument, isSuccessful is null!");
522 
523     return session->CanAddInput(cameraInput, isSuccessful);
524 }
525 
OH_CaptureSession_CanAddPreviewOutput(Camera_CaptureSession * session,Camera_PreviewOutput * cameraOutput,bool * isSuccessful)526 Camera_ErrorCode OH_CaptureSession_CanAddPreviewOutput(Camera_CaptureSession* session,
527     Camera_PreviewOutput* cameraOutput, bool* isSuccessful)
528 {
529     MEDIA_DEBUG_LOG("OH_CaptureSession_CanAddPreviewOutput is called");
530     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
531         "Invaild argument, session is null!");
532     CHECK_AND_RETURN_RET_LOG(cameraOutput != nullptr, CAMERA_INVALID_ARGUMENT,
533         "Invaild argument, cameraOutput is null!");
534     CHECK_AND_RETURN_RET_LOG(isSuccessful != nullptr, CAMERA_INVALID_ARGUMENT,
535         "Invaild argument, isSuccessful is null!");
536 
537     return session->CanAddPreviewOutput(cameraOutput, isSuccessful);
538 }
539 
OH_CaptureSession_CanAddPhotoOutput(Camera_CaptureSession * session,Camera_PhotoOutput * cameraOutput,bool * isSuccessful)540 Camera_ErrorCode OH_CaptureSession_CanAddPhotoOutput(Camera_CaptureSession* session,
541     Camera_PhotoOutput* cameraOutput, bool* isSuccessful)
542 {
543     MEDIA_DEBUG_LOG("OH_CaptureSession_CanAddPhotoOutput is called");
544     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
545         "Invaild argument, session is null!");
546     CHECK_AND_RETURN_RET_LOG(cameraOutput != nullptr, CAMERA_INVALID_ARGUMENT,
547         "Invaild argument, cameraOutput is null!");
548     CHECK_AND_RETURN_RET_LOG(isSuccessful != nullptr, CAMERA_INVALID_ARGUMENT,
549         "Invaild argument, isSuccessful is null!");
550 
551     return session->CanAddPhotoOutput(cameraOutput, isSuccessful);
552 }
553 
OH_CaptureSession_CanAddVideoOutput(Camera_CaptureSession * session,Camera_VideoOutput * cameraOutput,bool * isSuccessful)554 Camera_ErrorCode OH_CaptureSession_CanAddVideoOutput(Camera_CaptureSession* session,
555     Camera_VideoOutput* cameraOutput, bool* isSuccessful)
556 {
557     MEDIA_DEBUG_LOG("OH_CaptureSession_CanAddVideoOutput is called");
558     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
559         "Invaild argument, session is null!");
560     CHECK_AND_RETURN_RET_LOG(cameraOutput != nullptr, CAMERA_INVALID_ARGUMENT,
561         "Invaild argument, cameraOutput is null!");
562     CHECK_AND_RETURN_RET_LOG(isSuccessful != nullptr, CAMERA_INVALID_ARGUMENT,
563         "Invaild argument, isSuccessful is null!");
564 
565     return session->CanAddVideoOutput(cameraOutput, isSuccessful);
566 }
567 
OH_CaptureSession_CanPreconfig(Camera_CaptureSession * session,Camera_PreconfigType preconfigType,bool * canPreconfig)568 Camera_ErrorCode OH_CaptureSession_CanPreconfig(Camera_CaptureSession* session,
569     Camera_PreconfigType preconfigType, bool* canPreconfig)
570 {
571     MEDIA_DEBUG_LOG("OH_CaptureSession_CanPreconfig is called.");
572     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
573         "Invaild argument, session is null!");
574     CHECK_AND_RETURN_RET_LOG(canPreconfig != nullptr, CAMERA_INVALID_ARGUMENT,
575         "Invaild argument, canPreconfig is null!");
576 
577     return session->CanPreconfig(preconfigType, canPreconfig);
578 }
579 
OH_CaptureSession_CanPreconfigWithRatio(Camera_CaptureSession * session,Camera_PreconfigType preconfigType,Camera_PreconfigRatio preconfigRatio,bool * canPreconfig)580 Camera_ErrorCode OH_CaptureSession_CanPreconfigWithRatio(Camera_CaptureSession* session,
581     Camera_PreconfigType preconfigType, Camera_PreconfigRatio preconfigRatio, bool* canPreconfig)
582 {
583     MEDIA_DEBUG_LOG("OH_CaptureSession_CanPreconfigWithRatio is called.");
584     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
585         "Invaild argument, session is null!");
586     CHECK_AND_RETURN_RET_LOG(canPreconfig != nullptr, CAMERA_INVALID_ARGUMENT,
587         "Invaild argument, canPreconfig is null!");
588 
589     return session->CanPreconfigWithRatio(preconfigType, preconfigRatio, canPreconfig);
590 }
591 
OH_CaptureSession_Preconfig(Camera_CaptureSession * session,Camera_PreconfigType preconfigType)592 Camera_ErrorCode OH_CaptureSession_Preconfig(Camera_CaptureSession* session, Camera_PreconfigType preconfigType)
593 {
594     MEDIA_DEBUG_LOG("OH_CaptureSession_Preconfig is called.");
595     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
596         "Invaild argument, session is null!");
597 
598     return session->Preconfig(preconfigType);
599 }
600 
OH_CaptureSession_PreconfigWithRatio(Camera_CaptureSession * session,Camera_PreconfigType preconfigType,Camera_PreconfigRatio preconfigRatio)601 Camera_ErrorCode OH_CaptureSession_PreconfigWithRatio(Camera_CaptureSession* session,
602     Camera_PreconfigType preconfigType, Camera_PreconfigRatio preconfigRatio)
603 {
604     MEDIA_DEBUG_LOG("OH_CaptureSession_PreconfigWithRatio is called.");
605     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
606         "Invaild argument, session is null!");
607 
608     return session->PreconfigWithRatio(preconfigType, preconfigRatio);
609 }
610 
611 /**
612  * @since 12
613  * @version 1.0
614  */
OH_CaptureSession_GetExposureValue(Camera_CaptureSession * session,float * exposureValue)615 Camera_ErrorCode OH_CaptureSession_GetExposureValue(Camera_CaptureSession* session, float* exposureValue)
616 {
617     MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureValue is called");
618     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
619         "Invaild argument, session is null!");
620     CHECK_AND_RETURN_RET_LOG(exposureValue != nullptr, CAMERA_INVALID_ARGUMENT,
621         "Invaild argument, exposureValue is null!");
622 
623     return session->GetExposureValue(exposureValue);
624 }
625 
626 /**
627  * @since 12
628  * @version 1.0
629  */
OH_CaptureSession_GetFocalLength(Camera_CaptureSession * session,float * focalLength)630 Camera_ErrorCode OH_CaptureSession_GetFocalLength(Camera_CaptureSession* session, float* focalLength)
631 {
632     MEDIA_DEBUG_LOG("OH_CaptureSession_GetFocalLength is called");
633     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
634         "Invaild argument, session is null!");
635     CHECK_AND_RETURN_RET_LOG(focalLength != nullptr, CAMERA_INVALID_ARGUMENT,
636         "Invaild argument, focalLength is null!");
637 
638     return session->GetFocalLength(focalLength);
639 }
640 
641 /**
642  * @since 12
643  * @version 1.0
644  */
OH_CaptureSession_SetSmoothZoom(Camera_CaptureSession * session,float targetZoom,Camera_SmoothZoomMode smoothZoomMode)645 Camera_ErrorCode OH_CaptureSession_SetSmoothZoom(Camera_CaptureSession *session, float targetZoom,
646     Camera_SmoothZoomMode smoothZoomMode)
647 {
648     MEDIA_DEBUG_LOG("OH_CaptureSession_SetSmoothZoom is called");
649     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
650         "Invaild argument, session is null!");
651 
652     return session->SetSmoothZoom(targetZoom, smoothZoomMode);
653 }
654 
655 /**
656  * @since 12
657  * @version 1.0
658  */
OH_CaptureSession_GetSupportedColorSpaces(Camera_CaptureSession * session,OH_NativeBuffer_ColorSpace ** colorSpace,uint32_t * size)659 Camera_ErrorCode OH_CaptureSession_GetSupportedColorSpaces(Camera_CaptureSession* session,
660     OH_NativeBuffer_ColorSpace** colorSpace, uint32_t* size)
661 {
662     MEDIA_DEBUG_LOG("OH_CaptureSession_GetSupportedColorSpaces is called");
663     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
664         "Invaild argument, session is null!");
665     CHECK_AND_RETURN_RET_LOG(colorSpace != nullptr, CAMERA_INVALID_ARGUMENT,
666         "Invaild argument, colorSpace is null!");
667     CHECK_AND_RETURN_RET_LOG(size != nullptr, CAMERA_INVALID_ARGUMENT,
668         "Invaild argument, size is null!");
669 
670     return session->GetSupportedColorSpaces(colorSpace, size);
671 }
672 
673 /**
674  * @since 12
675  * @version 1.0
676  */
OH_CaptureSession_DeleteColorSpaces(Camera_CaptureSession * session,OH_NativeBuffer_ColorSpace * colorSpace)677 Camera_ErrorCode OH_CaptureSession_DeleteColorSpaces(Camera_CaptureSession* session,
678     OH_NativeBuffer_ColorSpace* colorSpace)
679 {
680     MEDIA_DEBUG_LOG("OH_CaptureSession_DeleteSupportedColorSpaces is called");
681     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
682         "Invaild argument, session is null!");
683     CHECK_AND_RETURN_RET_LOG(colorSpace != nullptr, CAMERA_INVALID_ARGUMENT,
684         "Invaild argument, colorSpace is null!");
685 
686     return session->DeleteColorSpaces(colorSpace);
687 }
688 
689 /**
690  * @since 12
691  * @version 1.0
692  */
OH_CaptureSession_GetActiveColorSpace(Camera_CaptureSession * session,OH_NativeBuffer_ColorSpace * colorSpace)693 Camera_ErrorCode OH_CaptureSession_GetActiveColorSpace(Camera_CaptureSession* session,
694     OH_NativeBuffer_ColorSpace* colorSpace)
695 {
696     MEDIA_DEBUG_LOG("OH_CaptureSession_GetActiveColorSpace is called");
697     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
698         "Invaild argument, session is null!");
699     CHECK_AND_RETURN_RET_LOG(colorSpace != nullptr, CAMERA_INVALID_ARGUMENT,
700         "Invaild argument, colorSpace is null!");
701 
702     return session->GetActiveColorSpace(colorSpace);
703 }
704 
705 /**
706  * @since 12
707  * @version 1.0
708  */
OH_CaptureSession_SetActiveColorSpace(Camera_CaptureSession * session,OH_NativeBuffer_ColorSpace colorSpace)709 Camera_ErrorCode OH_CaptureSession_SetActiveColorSpace(Camera_CaptureSession* session,
710     OH_NativeBuffer_ColorSpace colorSpace)
711 {
712     MEDIA_DEBUG_LOG("OH_CaptureSession_SetActiveColorSpace is called");
713     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT,
714         "Invaild argument, session is null!");
715 
716     return session->SetActiveColorSpace(colorSpace);
717 }
718 
719 /**
720  * @since 14
721  * @version 1.0
722  */
OH_CaptureSession_SetQualityPrioritization(Camera_CaptureSession * session,Camera_QualityPrioritization qualityPrioritization)723 Camera_ErrorCode OH_CaptureSession_SetQualityPrioritization(
724     Camera_CaptureSession* session, Camera_QualityPrioritization qualityPrioritization)
725 {
726     MEDIA_DEBUG_LOG("OH_CaptureSession_SetQualityPrioritization is called");
727     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "Invalid argument, session is null!");
728 
729     return session->SetQualityPrioritization(qualityPrioritization);
730 }
731 
732 #ifdef __cplusplus
733 }
734 #endif