• 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_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
28     CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! callback is null!");
29     CHECK_AND_RETURN_RET_LOG(callback->onFocusStateChange!= nullptr, CAMERA_INVALID_ARGUMENT,
30         "invaild argument! callback onFocusStateChange is null!");
31     CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT,
32         "invaild argument! callback onError is null!");
33 
34     session->RegisterCallback(callback);
35     return CAMERA_OK;
36 }
37 
OH_CaptureSession_UnregisterCallback(Camera_CaptureSession * session,CaptureSession_Callbacks * callback)38 Camera_ErrorCode OH_CaptureSession_UnregisterCallback(Camera_CaptureSession* session,
39     CaptureSession_Callbacks* callback)
40 {
41     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
42     CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! callback is null!");
43     CHECK_AND_RETURN_RET_LOG(callback->onFocusStateChange!= nullptr, CAMERA_INVALID_ARGUMENT,
44         "invaild argument! callback onFocusStateChange is null!");
45     CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT,
46         "invaild argument! callback onError is null!");
47 
48     session->UnregisterCallback(callback);
49     return CAMERA_OK;
50 }
51 
OH_CaptureSession_BeginConfig(Camera_CaptureSession * session)52 Camera_ErrorCode OH_CaptureSession_BeginConfig(Camera_CaptureSession* session)
53 {
54     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
55 
56     return session->BeginConfig();
57 }
58 
OH_CaptureSession_CommitConfig(Camera_CaptureSession * session)59 Camera_ErrorCode OH_CaptureSession_CommitConfig(Camera_CaptureSession* session)
60 {
61     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
62 
63     return session->CommitConfig();
64 }
65 
OH_CaptureSession_AddInput(Camera_CaptureSession * session,Camera_Input * cameraInput)66 Camera_ErrorCode OH_CaptureSession_AddInput(Camera_CaptureSession* session, Camera_Input* cameraInput)
67 {
68     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
69     CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT,
70         "invaild argument! cameraInput is null!");
71 
72     return session->AddInput(cameraInput);
73 }
74 
OH_CaptureSession_RemoveInput(Camera_CaptureSession * session,Camera_Input * cameraInput)75 Camera_ErrorCode OH_CaptureSession_RemoveInput(Camera_CaptureSession* session, Camera_Input* cameraInput)
76 {
77     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
78     CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT,
79         "invaild argument! cameraInput is null!");
80 
81     return session->RemoveInput(cameraInput);
82 }
83 
OH_CaptureSession_AddPreviewOutput(Camera_CaptureSession * session,Camera_PreviewOutput * previewOutput)84 Camera_ErrorCode OH_CaptureSession_AddPreviewOutput(Camera_CaptureSession* session,
85     Camera_PreviewOutput* previewOutput)
86 {
87     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
88     CHECK_AND_RETURN_RET_LOG(previewOutput != nullptr, CAMERA_INVALID_ARGUMENT,
89         "invaild argument! previewOutput is null!");
90 
91     return session->AddPreviewOutput(previewOutput);
92 }
93 
OH_CaptureSession_RemovePreviewOutput(Camera_CaptureSession * session,Camera_PreviewOutput * previewOutput)94 Camera_ErrorCode OH_CaptureSession_RemovePreviewOutput(Camera_CaptureSession* session,
95     Camera_PreviewOutput* previewOutput)
96 {
97     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
98     CHECK_AND_RETURN_RET_LOG(previewOutput != nullptr, CAMERA_INVALID_ARGUMENT,
99         "invaild argument! previewOutput is null!");
100 
101     return session->RemovePreviewOutput(previewOutput);
102 }
103 
OH_CaptureSession_AddPhotoOutput(Camera_CaptureSession * session,Camera_PhotoOutput * photoOutput)104 Camera_ErrorCode OH_CaptureSession_AddPhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput)
105 {
106     MEDIA_DEBUG_LOG("OH_CaptureSession_AddPhotoOutput is called");
107     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
108     CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT,
109         "invaild argument! photoOutput is null!");
110 
111     return session->AddPhotoOutput(photoOutput);
112 }
113 
OH_CaptureSession_RemovePhotoOutput(Camera_CaptureSession * session,Camera_PhotoOutput * photoOutput)114 Camera_ErrorCode OH_CaptureSession_RemovePhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput)
115 {
116     MEDIA_DEBUG_LOG("OH_CaptureSession_RemovePhotoOutput is called");
117     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
118     CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT,
119         "invaild argument! photoOutput is null!");
120 
121     return session->RemovePhotoOutput(photoOutput);
122 }
123 
OH_CaptureSession_AddMetadataOutput(Camera_CaptureSession * session,Camera_MetadataOutput * metadataOutput)124 Camera_ErrorCode OH_CaptureSession_AddMetadataOutput(Camera_CaptureSession* session,
125     Camera_MetadataOutput* metadataOutput)
126 {
127     MEDIA_DEBUG_LOG("OH_CaptureSession_AddMetadataOutput is called");
128     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
129     CHECK_AND_RETURN_RET_LOG(metadataOutput != nullptr, CAMERA_INVALID_ARGUMENT,
130         "invaild argument! metadataOutput is null!");
131 
132     return session->AddMetaDataOutput(metadataOutput);
133 }
134 
OH_CaptureSession_RemoveMetadataOutput(Camera_CaptureSession * session,Camera_MetadataOutput * metadataOutput)135 Camera_ErrorCode OH_CaptureSession_RemoveMetadataOutput(Camera_CaptureSession* session,
136     Camera_MetadataOutput* metadataOutput)
137 {
138     MEDIA_DEBUG_LOG("OH_CaptureSession_RemoveMetadataOutput is called");
139     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
140     CHECK_AND_RETURN_RET_LOG(metadataOutput != nullptr, CAMERA_INVALID_ARGUMENT,
141         "invaild argument! metadataOutput is null!");
142 
143     return session->RemoveMetaDataOutput(metadataOutput);
144 }
145 
OH_CaptureSession_IsVideoStabilizationModeSupported(Camera_CaptureSession * session,Camera_VideoStabilizationMode mode,bool * isSupported)146 Camera_ErrorCode OH_CaptureSession_IsVideoStabilizationModeSupported(Camera_CaptureSession* session,
147     Camera_VideoStabilizationMode mode, bool* isSupported)
148 {
149     MEDIA_DEBUG_LOG("OH_CaptureSession_IsVideoStabilizationModeSupported is called");
150     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
151     CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT,
152         "invaild argument! isSupported is null!");
153 
154     return session->IsVideoStabilizationModeSupported(mode, isSupported);
155 }
156 
OH_CaptureSession_GetVideoStabilizationMode(Camera_CaptureSession * session,Camera_VideoStabilizationMode * mode)157 Camera_ErrorCode OH_CaptureSession_GetVideoStabilizationMode(Camera_CaptureSession* session,
158     Camera_VideoStabilizationMode* mode)
159 {
160     MEDIA_DEBUG_LOG("OH_CaptureSession_GetVideoStabilizationMode is called");
161     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
162     CHECK_AND_RETURN_RET_LOG(mode != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! mode is null!");
163 
164     return session->GetVideoStabilizationMode(mode);
165 }
166 
OH_CaptureSession_SetVideoStabilizationMode(Camera_CaptureSession * session,Camera_VideoStabilizationMode mode)167 Camera_ErrorCode OH_CaptureSession_SetVideoStabilizationMode(Camera_CaptureSession* session,
168     Camera_VideoStabilizationMode mode)
169 {
170     MEDIA_DEBUG_LOG("OH_CaptureSession_SetVideoStabilizationMode is called");
171     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
172 
173     return session->SetVideoStabilizationMode(mode);
174 }
175 
OH_CaptureSession_GetZoomRatioRange(Camera_CaptureSession * session,float * minZoom,float * maxZoom)176 Camera_ErrorCode OH_CaptureSession_GetZoomRatioRange(Camera_CaptureSession* session, float* minZoom, float* maxZoom)
177 {
178     MEDIA_DEBUG_LOG("OH_CaptureSession_GetZoomRatioRange is called");
179     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
180     CHECK_AND_RETURN_RET_LOG(minZoom != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! minZoom is null!");
181     CHECK_AND_RETURN_RET_LOG(maxZoom != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! maxZoom is null!");
182 
183     return session->GetZoomRatioRange(minZoom, maxZoom);
184 }
185 
OH_CaptureSession_GetZoomRatio(Camera_CaptureSession * session,float * zoom)186 Camera_ErrorCode OH_CaptureSession_GetZoomRatio(Camera_CaptureSession* session, float* zoom)
187 {
188     MEDIA_DEBUG_LOG("OH_CaptureSession_GetZoomRatio is called");
189     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
190     CHECK_AND_RETURN_RET_LOG(zoom != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! zoom is null!");
191 
192     return session->GetZoomRatio(zoom);
193 }
194 
OH_CaptureSession_SetZoomRatio(Camera_CaptureSession * session,float zoom)195 Camera_ErrorCode OH_CaptureSession_SetZoomRatio(Camera_CaptureSession* session, float zoom)
196 {
197     MEDIA_DEBUG_LOG("OH_CaptureSession_SetZoomRatio is called");
198     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
199 
200     return session->SetZoomRatio(zoom);
201 }
202 
OH_CaptureSession_IsFocusModeSupported(Camera_CaptureSession * session,Camera_FocusMode focusMode,bool * isSupported)203 Camera_ErrorCode OH_CaptureSession_IsFocusModeSupported(Camera_CaptureSession* session,
204     Camera_FocusMode focusMode, bool* isSupported)
205 {
206     MEDIA_DEBUG_LOG("OH_CaptureSession_IsFocusModeSupported is called");
207     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
208     CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT,
209         "invaild argument! isSupported is null!");
210 
211     return session->IsFocusModeSupported(focusMode, isSupported);
212 }
213 
OH_CaptureSession_GetFocusMode(Camera_CaptureSession * session,Camera_FocusMode * focusMode)214 Camera_ErrorCode OH_CaptureSession_GetFocusMode(Camera_CaptureSession* session, Camera_FocusMode* focusMode)
215 {
216     MEDIA_DEBUG_LOG("OH_CaptureSession_GetFocusMode is called");
217     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
218     CHECK_AND_RETURN_RET_LOG(focusMode != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! focusMode is null!");
219 
220     return session->GetFocusMode(focusMode);
221 }
222 
OH_CaptureSession_SetFocusMode(Camera_CaptureSession * session,Camera_FocusMode focusMode)223 Camera_ErrorCode OH_CaptureSession_SetFocusMode(Camera_CaptureSession* session, Camera_FocusMode focusMode)
224 {
225     MEDIA_DEBUG_LOG("OH_CaptureSession_SetFocusMode is called");
226     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
227 
228     return session->SetFocusMode(focusMode);
229 }
230 
OH_CaptureSession_SetFocusPoint(Camera_CaptureSession * session,Camera_Point focusPoint)231 Camera_ErrorCode OH_CaptureSession_SetFocusPoint(Camera_CaptureSession* session, Camera_Point focusPoint)
232 {
233     MEDIA_DEBUG_LOG("OH_CaptureSession_SetFocusPoint is called");
234     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
235 
236     return session->SetFocusPoint(focusPoint);
237 }
238 
OH_CaptureSession_GetFocusPoint(Camera_CaptureSession * session,Camera_Point * focusPoint)239 Camera_ErrorCode OH_CaptureSession_GetFocusPoint(Camera_CaptureSession* session, Camera_Point* focusPoint)
240 {
241     MEDIA_DEBUG_LOG("OH_CaptureSession_GetFocusPoint is called");
242     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
243     CHECK_AND_RETURN_RET_LOG(focusPoint != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! focusPoint is null!");
244 
245     return session->GetFocusPoint(focusPoint);
246 }
247 
OH_CaptureSession_AddVideoOutput(Camera_CaptureSession * session,Camera_VideoOutput * videoOutput)248 Camera_ErrorCode OH_CaptureSession_AddVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput)
249 {
250     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
251     CHECK_AND_RETURN_RET_LOG(videoOutput != nullptr, CAMERA_INVALID_ARGUMENT,
252         "invaild argument! videoOutput is null!");
253 
254     return session->AddVideoOutput(videoOutput);
255 }
256 
OH_CaptureSession_RemoveVideoOutput(Camera_CaptureSession * session,Camera_VideoOutput * videoOutput)257 Camera_ErrorCode OH_CaptureSession_RemoveVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput)
258 {
259     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
260     CHECK_AND_RETURN_RET_LOG(videoOutput != nullptr, CAMERA_INVALID_ARGUMENT,
261         "invaild argument! videoOutput is null!");
262 
263     return session->RemoveVideoOutput(videoOutput);
264 }
265 
OH_CaptureSession_Start(Camera_CaptureSession * session)266 Camera_ErrorCode OH_CaptureSession_Start(Camera_CaptureSession* session)
267 {
268     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
269 
270     return session->Start();
271 }
272 
OH_CaptureSession_Stop(Camera_CaptureSession * session)273 Camera_ErrorCode OH_CaptureSession_Stop(Camera_CaptureSession* session)
274 {
275     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
276 
277     return session->Stop();
278 }
279 
OH_CaptureSession_Release(Camera_CaptureSession * session)280 Camera_ErrorCode OH_CaptureSession_Release(Camera_CaptureSession* session)
281 {
282     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
283 
284     Camera_ErrorCode retCode = session->Release();
285     if (session != nullptr) {
286         delete session;
287     }
288     return retCode;
289 }
290 
OH_CaptureSession_HasFlash(Camera_CaptureSession * session,bool * hasFlash)291 Camera_ErrorCode OH_CaptureSession_HasFlash(Camera_CaptureSession* session, bool* hasFlash)
292 {
293     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
294     CHECK_AND_RETURN_RET_LOG(hasFlash != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! hasFlash is null!");
295 
296     return session->HasFlash(hasFlash);
297 }
298 
OH_CaptureSession_IsFlashModeSupported(Camera_CaptureSession * session,Camera_FlashMode flashMode,bool * isSupported)299 Camera_ErrorCode OH_CaptureSession_IsFlashModeSupported(Camera_CaptureSession* session,
300     Camera_FlashMode flashMode, bool* isSupported)
301 {
302     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
303     CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT,
304         "invaild argument! isSupported is null!");
305 
306     return session->IsFlashModeSupported(flashMode, isSupported);
307 }
308 
OH_CaptureSession_GetFlashMode(Camera_CaptureSession * session,Camera_FlashMode * flashMode)309 Camera_ErrorCode OH_CaptureSession_GetFlashMode(Camera_CaptureSession* session, Camera_FlashMode* flashMode)
310 {
311     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
312     CHECK_AND_RETURN_RET_LOG(flashMode != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! flashMode is null!");
313 
314     return session->GetFlashMode(flashMode);
315 }
316 
OH_CaptureSession_SetFlashMode(Camera_CaptureSession * session,Camera_FlashMode flashMode)317 Camera_ErrorCode OH_CaptureSession_SetFlashMode(Camera_CaptureSession* session, Camera_FlashMode flashMode)
318 {
319     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
320 
321     return session->SetFlashMode(flashMode);
322 }
323 
OH_CaptureSession_IsExposureModeSupported(Camera_CaptureSession * session,Camera_ExposureMode exposureMode,bool * isSupported)324 Camera_ErrorCode OH_CaptureSession_IsExposureModeSupported(Camera_CaptureSession* session,
325     Camera_ExposureMode exposureMode, bool* isSupported)
326 {
327     MEDIA_DEBUG_LOG("OH_CaptureSession_IsExposureModeSupported is called");
328     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
329     CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! isSupported is null!");
330     return session->IsExposureModeSupported(exposureMode, isSupported);
331 }
332 
OH_CaptureSession_GetExposureMode(Camera_CaptureSession * session,Camera_ExposureMode * exposureMode)333 Camera_ErrorCode OH_CaptureSession_GetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode* exposureMode)
334 {
335     MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureMode is called");
336     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
337     CHECK_AND_RETURN_RET_LOG(exposureMode != nullptr, CAMERA_INVALID_ARGUMENT,
338         "invaild argument! exposureMode is null!");
339     return session->GetExposureMode(exposureMode);
340 }
341 
OH_CaptureSession_SetExposureMode(Camera_CaptureSession * session,Camera_ExposureMode exposureMode)342 Camera_ErrorCode OH_CaptureSession_SetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode exposureMode)
343 {
344     MEDIA_DEBUG_LOG("OH_CaptureSession_SetExposureMode is called");
345     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
346     return session->SetExposureMode(exposureMode);
347 }
348 
OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession * session,Camera_Point * point)349 Camera_ErrorCode OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession* session, Camera_Point* point)
350 {
351     MEDIA_DEBUG_LOG("OH_CaptureSession_GetMeteringPoint is called");
352     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
353     CHECK_AND_RETURN_RET_LOG(point != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! point is null!");
354     return session->GetMeteringPoint(point);
355 }
356 
OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession * session,Camera_Point point)357 Camera_ErrorCode OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession* session, Camera_Point point)
358 {
359     MEDIA_DEBUG_LOG("OH_CaptureSession_SetMeteringPoint is called");
360     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
361     return session->SetMeteringPoint(point);
362 }
363 
OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession * session,float * minExposureBias,float * maxExposureBias,float * step)364 Camera_ErrorCode OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession* session,
365     float* minExposureBias, float* maxExposureBias, float* step)
366 {
367     MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureBiasRange is called");
368     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
369     CHECK_AND_RETURN_RET_LOG(minExposureBias != nullptr, CAMERA_INVALID_ARGUMENT,
370         "invaild argument! minExposureBias is null!");
371     CHECK_AND_RETURN_RET_LOG(maxExposureBias != nullptr, CAMERA_INVALID_ARGUMENT,
372         "invaild argument! maxExposureBias is null!");
373     CHECK_AND_RETURN_RET_LOG(step != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! step is null!");
374     return session->GetExposureBiasRange(minExposureBias, maxExposureBias, step);
375 }
376 
OH_CaptureSession_SetExposureBias(Camera_CaptureSession * session,float exposureBias)377 Camera_ErrorCode OH_CaptureSession_SetExposureBias(Camera_CaptureSession* session, float exposureBias)
378 {
379     MEDIA_DEBUG_LOG("OH_CaptureSession_SetExposureBias is called");
380     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
381     return session->SetExposureBias(exposureBias);
382 }
OH_CaptureSession_GetExposureBias(Camera_CaptureSession * session,float * exposureBias)383 Camera_ErrorCode OH_CaptureSession_GetExposureBias(Camera_CaptureSession* session, float* exposureBias)
384 {
385     MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureBias is called");
386     CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!");
387     CHECK_AND_RETURN_RET_LOG(exposureBias != nullptr, CAMERA_INVALID_ARGUMENT,
388         "invaild argument! exposureBias is null!");
389     return session->GetExposureBias(exposureBias);
390 }
391 
392 #ifdef __cplusplus
393 }
394 #endif