1 /*
2  * Copyright (c) 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 /**
17  * @addtogroup OH_Camera
18  * @{
19  *
20  * @brief Provide the definition of the C interface for the camera module.
21  *
22  * @syscap SystemCapability.Multimedia.Camera.Core
23  *
24  * @since 11
25  * @version 1.0
26  */
27 
28 /**
29  * @file capture_session.h
30  *
31  * @brief Declare the capture Session concepts.
32  *
33  * @library libohcamera.so
34  * @kit CameraKit
35  * @syscap SystemCapability.Multimedia.Camera.Core
36  * @since 11
37  * @version 1.0
38  */
39 
40 #ifndef NATIVE_INCLUDE_CAMERA_CAMERA_SESSION_H
41 #define NATIVE_INCLUDE_CAMERA_CAMERA_SESSION_H
42 
43 #include <stdint.h>
44 #include <stdio.h>
45 #include "camera.h"
46 #include "camera_input.h"
47 #include "preview_output.h"
48 #include "photo_output.h"
49 #include "video_output.h"
50 #include "metadata_output.h"
51 #include "native_buffer.h"
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /**
58  * @brief Capture session object
59  *
60  * A pointer can be created using {@link Camera_CaptureSession} method.
61  *
62  * @since 11
63  * @version 1.0
64  */
65 typedef struct Camera_CaptureSession Camera_CaptureSession;
66 
67 /**
68  * @brief Capture session focus state callback to be called in {@link CaptureSession_Callbacks}.
69  *
70  * @param session the {@link Camera_CaptureSession} which deliver the callback.
71  * @param focusState the {@link Camera_FocusState} which delivered by the callback.
72  * @since 11
73  */
74 typedef void (*OH_CaptureSession_OnFocusStateChange)(Camera_CaptureSession* session, Camera_FocusState focusState);
75 
76 /**
77  * @brief Capture session error callback to be called in {@link CaptureSession_Callbacks}.
78  *
79  * @param session the {@link Camera_CaptureSession} which deliver the callback.
80  * @param errorCode the {@link Camera_ErrorCode} of the capture session.
81  *
82  * @see CAMERA_SERVICE_FATAL_ERROR
83  * @since 11
84  */
85 typedef void (*OH_CaptureSession_OnError)(Camera_CaptureSession* session, Camera_ErrorCode errorCode);
86 
87 /**
88  * @brief Capture session smooth zoom info callback.
89  *
90  * @param session the {@link Camera_CaptureSession} which deliver the callback.
91  * @param smoothZoomInfo the {@link Camera_SmoothZoomInfo} which delivered by the callback.
92  * @since 12
93  */
94 typedef void (*OH_CaptureSession_OnSmoothZoomInfo)(Camera_CaptureSession* session,
95     Camera_SmoothZoomInfo* smoothZoomInfo);
96 
97 /**
98  * @brief Capture session device switch status callback.
99  *
100  * @param session the {@link Camera_CaptureSession} which deliver the callback.
101  * @param autoDeviceSwitchStatusInfo the {@link Camera_AutoDeviceSwitchStatusInfo} which delivered by the callback.
102  * @since 13
103  */
104 typedef void (*OH_CaptureSession_OnAutoDeviceSwitchStatusChange)(Camera_CaptureSession* session,
105     Camera_AutoDeviceSwitchStatusInfo* autoDeviceSwitchStatusInfo);
106 
107 /**
108  * @brief A listener for capture session.
109  *
110  * @see OH_CaptureSession_RegisterCallback
111  * @since 11
112  * @version 1.0
113  */
114 typedef struct CaptureSession_Callbacks {
115     /**
116      * Capture session focus state change event.
117      */
118     OH_CaptureSession_OnFocusStateChange onFocusStateChange;
119 
120     /**
121      * Capture session error event.
122      */
123     OH_CaptureSession_OnError onError;
124 } CaptureSession_Callbacks;
125 
126 /**
127  * @brief Register capture session event callback.
128  *
129  * @param session the {@link Camera_CaptureSession} instance.
130  * @param callback the {@link CaptureSession_Callbacks} to be registered.
131  * @return {@link #CAMERA_OK} if the method call succeeds.
132  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
133  * @since 11
134  */
135 Camera_ErrorCode OH_CaptureSession_RegisterCallback(Camera_CaptureSession* session,
136     CaptureSession_Callbacks* callback);
137 
138 /**
139  * @brief Unregister capture session event callback.
140  *
141  * @param session the {@link Camera_CaptureSession} instance.
142  * @param callback the {@link CaptureSession_Callbacks} to be unregistered.
143  * @return {@link #CAMERA_OK} if the method call succeeds.
144  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
145  * @since 11
146  */
147 Camera_ErrorCode OH_CaptureSession_UnregisterCallback(Camera_CaptureSession* session,
148     CaptureSession_Callbacks* callback);
149 
150 /**
151  * @brief Register smooth zoom information event callback.
152  *
153  * @param session the {@link Camera_CaptureSession} instance.
154  * @param smoothZoomInfoCallback the {@link OH_CaptureSession_OnSmoothZoomInfo} to be registered.
155  * @return {@link #CAMERA_OK} if the method call succeeds.
156  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
157  * @since 12
158  */
159 Camera_ErrorCode OH_CaptureSession_RegisterSmoothZoomInfoCallback(Camera_CaptureSession* session,
160     OH_CaptureSession_OnSmoothZoomInfo smoothZoomInfoCallback);
161 
162 /**
163  * @brief Unregister smooth zoom information event callback.
164  *
165  * @param session the {@link Camera_CaptureSession} instance.
166  * @param smoothZoomInfoCallback the {@link OH_CaptureSession_OnSmoothZoomInfo} to be unregistered.
167  * @return {@link #CAMERA_OK} if the method call succeeds.
168  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
169  * @since 12
170  */
171 Camera_ErrorCode OH_CaptureSession_UnregisterSmoothZoomInfoCallback(Camera_CaptureSession* session,
172     OH_CaptureSession_OnSmoothZoomInfo smoothZoomInfoCallback);
173 
174 /**
175  * @brief Specifies the specific mode.
176  *
177  * This interface cannot be used after {@link OH_CaptureSession_BeginConfig}.
178  * We recommend using this interface immediately after using {@link OH_CameraManager_CreateCaptureSession}.
179  *
180  * @param session the {@link Camera_CaptureSession} instance.
181  * @param sceneMode the {@link CaptureSession_SceneMode} instance.
182  * @return {@link #CAMERA_OK} if the method call succeeds.
183  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
184  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
185  *         {@link #CAMERA_SESSION_CONFIG_LOCKED} if session config locked.
186  * @since 12
187  */
188 Camera_ErrorCode OH_CaptureSession_SetSessionMode(Camera_CaptureSession* session, Camera_SceneMode sceneMode);
189 
190 /**
191  * @brief Add Secure output for camera.
192  *
193  * @param session the {@link Camera_CaptureSession} instance.
194  * @param previewOutput the target {@link Camera_PreviewOutput} to Set as a secure flow.
195  * @return {@link #CAMERA_OK} if the method call succeeds.
196  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
197  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
198  *         {@link #CAMERA_SESSION_CONFIG_LOCKED} if session config locked.
199  * @since 12
200  */
201 Camera_ErrorCode OH_CaptureSession_AddSecureOutput(Camera_CaptureSession* session, Camera_PreviewOutput* previewOutput);
202 
203 /**
204  * @brief Begin capture session config.
205  *
206  * @param session the {@link Camera_CaptureSession} instance.
207  * @return {@link #CAMERA_OK} if the method call succeeds.
208  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
209  *         {@link #CAMERA_SESSION_CONFIG_LOCKED} if session config locked.
210  * @since 11
211  */
212 Camera_ErrorCode OH_CaptureSession_BeginConfig(Camera_CaptureSession* session);
213 
214 /**
215  * @brief Commit capture session config.
216  *
217  * @param session the {@link Camera_CaptureSession} instance.
218  * @return {@link #CAMERA_OK} if the method call succeeds.
219  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
220  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
221  *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
222  * @since 11
223  */
224 Camera_ErrorCode OH_CaptureSession_CommitConfig(Camera_CaptureSession* session);
225 
226 /**
227  * @brief Add a camera input.
228  *
229  * @param session the {@link Camera_CaptureSession} instance.
230  * @param cameraInput the target {@link Camera_Input} to add.
231  * @return {@link #CAMERA_OK} if the method call succeeds.
232  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
233  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
234  * @since 11
235  */
236 Camera_ErrorCode OH_CaptureSession_AddInput(Camera_CaptureSession* session, Camera_Input* cameraInput);
237 
238 /**
239  * @brief Remove a camera input.
240  *
241  * @param session the {@link Camera_CaptureSession} instance.
242  * @param cameraInput the target {@link Camera_Input} to remove.
243  * @return {@link #CAMERA_OK} if the method call succeeds.
244  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
245  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
246  * @since 11
247  */
248 Camera_ErrorCode OH_CaptureSession_RemoveInput(Camera_CaptureSession* session, Camera_Input* cameraInput);
249 
250 /**
251  * @brief Add a preview output.
252  *
253  * @param session the {@link Camera_CaptureSession} instance.
254  * @param previewOutput the target {@link Camera_PreviewOutput} to add.
255  * @return {@link #CAMERA_OK} if the method call succeeds.
256  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
257  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
258  * @since 11
259  */
260 Camera_ErrorCode OH_CaptureSession_AddPreviewOutput(Camera_CaptureSession* session,
261     Camera_PreviewOutput* previewOutput);
262 
263 /**
264  * @brief Remove a preview output.
265  *
266  * @param session the {@link Camera_CaptureSession} instance.
267  * @param previewOutput the target {@link Camera_PreviewOutput} to remove.
268  * @return {@link #CAMERA_OK} if the method call succeeds.
269  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
270  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
271  * @since 11
272  */
273 Camera_ErrorCode OH_CaptureSession_RemovePreviewOutput(Camera_CaptureSession* session,
274     Camera_PreviewOutput* previewOutput);
275 
276 /**
277  * @brief Add a photo output.
278  *
279  * @param session the {@link Camera_CaptureSession} instance.
280  * @param photoOutput the target {@link Camera_PhotoOutput} to add.
281  * @return {@link #CAMERA_OK} if the method call succeeds.
282  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
283  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
284  * @since 11
285  */
286 Camera_ErrorCode OH_CaptureSession_AddPhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput);
287 
288 /**
289  * @brief Remove a photo output.
290  *
291  * @param session the {@link Camera_CaptureSession} instance.
292  * @param photoOutput the target {@link Camera_PhotoOutput} to remove.
293  * @return {@link #CAMERA_OK} if the method call succeeds.
294  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
295  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
296  * @since 11
297  */
298 Camera_ErrorCode OH_CaptureSession_RemovePhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput);
299 
300 /**
301  * @brief Add a video output.
302  *
303  * @param session the {@link Camera_CaptureSession} instance.
304  * @param videoOutput the target {@link Camera_VideoOutput} to add.
305  * @return {@link #CAMERA_OK} if the method call succeeds.
306  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
307  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
308  * @since 11
309  */
310 Camera_ErrorCode OH_CaptureSession_AddVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput);
311 
312 /**
313  * @brief Remove a video output.
314  *
315  * @param session the {@link Camera_CaptureSession} instance.
316  * @param videoOutput the target {@link Camera_VideoOutput} to remove.
317  * @return {@link #CAMERA_OK} if the method call succeeds.
318  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
319  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
320  * @since 11
321  */
322 Camera_ErrorCode OH_CaptureSession_RemoveVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput);
323 
324 /**
325  * @brief Add a metadata output.
326  *
327  * @param session the {@link Camera_CaptureSession} instance.
328  * @param metadataOutput the target {@link Camera_MetadataOutput} to add.
329  * @return {@link #CAMERA_OK} if the method call succeeds.
330  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
331  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
332  * @since 11
333  */
334 Camera_ErrorCode OH_CaptureSession_AddMetadataOutput(Camera_CaptureSession* session,
335     Camera_MetadataOutput* metadataOutput);
336 
337 /**
338  * @brief Remove a metadata output.
339  *
340  * @param session the {@link Camera_CaptureSession} instance.
341  * @param metadataOutput the target {@link Camera_MetadataOutput} to remove.
342  * @return {@link #CAMERA_OK} if the method call succeeds.
343  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
344  *         {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed.
345  * @since 11
346  */
347 Camera_ErrorCode OH_CaptureSession_RemoveMetadataOutput(Camera_CaptureSession* session,
348     Camera_MetadataOutput* metadataOutput);
349 
350 /**
351  * @brief Start capture session.
352  *
353  * @param session the {@link Camera_CaptureSession} instance to be started.
354  * @return {@link #CAMERA_OK} if the method call succeeds.
355  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
356  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
357  *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
358  * @since 11
359  */
360 Camera_ErrorCode OH_CaptureSession_Start(Camera_CaptureSession* session);
361 
362 /**
363  * @brief Stop capture session.
364  *
365  * @param session the {@link Camera_CaptureSession} instance to be stoped.
366  * @return {@link #CAMERA_OK} if the method call succeeds.
367  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
368  *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
369  * @since 11
370  */
371 Camera_ErrorCode OH_CaptureSession_Stop(Camera_CaptureSession* session);
372 
373 /**
374  * @brief Release capture session.
375  *
376  * @param session the {@link Camera_CaptureSession} instance to be release.
377  * @return {@link #CAMERA_OK} if the method call succeeds.
378  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
379  *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
380  * @since 11
381  */
382 Camera_ErrorCode OH_CaptureSession_Release(Camera_CaptureSession* session);
383 
384 /**
385  * @brief Check if device has flash light.
386  *
387  * @param session the {@link Camera_CaptureSession} instance.
388  * @param hasFlash the result of whether flash supported.
389  * @return {@link #CAMERA_OK} if the method call succeeds.
390  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
391  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
392  * @since 11
393  */
394 Camera_ErrorCode OH_CaptureSession_HasFlash(Camera_CaptureSession* session, bool* hasFlash);
395 
396 /**
397  * @brief Check whether a specified flash mode is supported.
398  *
399  * @param session the {@link Camera_CaptureSession} instance.
400  * @param flashMode the {@link Camera_FlashMode} to be checked.
401  * @param isSupported the result of whether flash mode supported.
402  * @return {@link #CAMERA_OK} if the method call succeeds.
403  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
404  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
405  * @since 11
406  */
407 Camera_ErrorCode OH_CaptureSession_IsFlashModeSupported(Camera_CaptureSession* session,
408     Camera_FlashMode flashMode, bool* isSupported);
409 
410 /**
411  * @brief Get current flash mode.
412  *
413  * @param session the {@link Camera_CaptureSession} instance.
414  * @param flashMode the current {@link Camera_FlashMode}.
415  * @return {@link #CAMERA_OK} if the method call succeeds.
416  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
417  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
418  * @since 11
419  */
420 Camera_ErrorCode OH_CaptureSession_GetFlashMode(Camera_CaptureSession* session, Camera_FlashMode* flashMode);
421 
422 /**
423  * @brief Set flash mode.
424  *
425  * @param session the {@link Camera_CaptureSession} instance.
426  * @param flashMode the target {@link Camera_FlashMode} to set.
427  * @return {@link #CAMERA_OK} if the method call succeeds.
428  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
429  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
430  * @since 11
431  */
432 Camera_ErrorCode OH_CaptureSession_SetFlashMode(Camera_CaptureSession* session, Camera_FlashMode flashMode);
433 
434 /**
435  * @brief Check whether a specified exposure mode is supported.
436  *
437  * @param session the {@link Camera_CaptureSession} instance.
438  * @param exposureMode the {@link Camera_ExposureMode} to be checked.
439  * @param isSupported the result of whether exposure mode supported.
440  * @return {@link #CAMERA_OK} if the method call succeeds.
441  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
442  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
443  * @since 11
444  */
445 Camera_ErrorCode OH_CaptureSession_IsExposureModeSupported(Camera_CaptureSession* session,
446     Camera_ExposureMode exposureMode, bool* isSupported);
447 
448 /**
449  * @brief Get current exposure mode.
450  *
451  * @param session the {@link Camera_CaptureSession} instance.
452  * @param exposureMode the current {@link Camera_ExposureMode}.
453  * @return {@link #CAMERA_OK} if the method call succeeds.
454  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
455  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
456  * @since 11
457  */
458 Camera_ErrorCode OH_CaptureSession_GetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode* exposureMode);
459 
460 /**
461  * @brief Set exposure mode.
462  *
463  * @param session the {@link Camera_CaptureSession} instance.
464  * @param exposureMode the target {@link Camera_ExposureMode} to set.
465  * @return {@link #CAMERA_OK} if the method call succeeds.
466  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
467  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
468  * @since 11
469  */
470 Camera_ErrorCode OH_CaptureSession_SetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode exposureMode);
471 
472 /**
473  * @brief Get current metering point.
474  *
475  * @param session the {@link Camera_CaptureSession} instance.
476  * @param point the current {@link Camera_Point} metering point.
477  * @return {@link #CAMERA_OK} if the method call succeeds.
478  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
479  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
480  * @since 11
481  */
482 Camera_ErrorCode OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession* session, Camera_Point* point);
483 
484 /**
485  * @brief Set the center point of the metering area.
486  *
487  * @param session the {@link Camera_CaptureSession} instance.
488  * @param point the target {@link Camera_Point} to set.
489  * @return {@link #CAMERA_OK} if the method call succeeds.
490  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
491  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
492  * @since 11
493  */
494 Camera_ErrorCode OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession* session, Camera_Point point);
495 
496 /**
497  * @brief Query the exposure compensation range.
498  *
499  * @param session the {@link Camera_CaptureSession} instance.
500  * @param minExposureBias the minimum of exposure compensation.
501  * @param maxExposureBias the Maximum of exposure compensation.
502  * @param step the step of exposure compensation between each level.
503  * @return {@link #CAMERA_OK} if the method call succeeds.
504  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
505  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
506  * @since 11
507  */
508 Camera_ErrorCode OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession* session, float* minExposureBias,
509     float* maxExposureBias, float* step);
510 
511 /**
512  * @brief Set exposure compensation.
513  *
514  * @param session the {@link Camera_CaptureSession} instance.
515  * @param exposureBias the target exposure compensation to set.
516  * @return {@link #CAMERA_OK} if the method call succeeds.
517  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
518  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
519  * @since 11
520  */
521 Camera_ErrorCode OH_CaptureSession_SetExposureBias(Camera_CaptureSession* session, float exposureBias);
522 
523 /**
524  * @brief Get current exposure compensation.
525  *
526  * @param session the {@link Camera_CaptureSession} instance.
527  * @param exposureBias the current exposure compensation.
528  * @return {@link #CAMERA_OK} if the method call succeeds.
529  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
530  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
531  * @since 11
532  */
533 Camera_ErrorCode OH_CaptureSession_GetExposureBias(Camera_CaptureSession* session, float* exposureBias);
534 
535 /**
536  * @brief Check whether a specified focus mode is supported.
537  *
538  * @param session the {@link Camera_CaptureSession} instance.
539  * @param focusMode the {@link Camera_FocusMode} to be checked.
540  * @param isSupported the result of whether focus mode supported.
541  * @return {@link #CAMERA_OK} if the method call succeeds.
542  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
543  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
544  * @since 11
545  */
546 Camera_ErrorCode OH_CaptureSession_IsFocusModeSupported(Camera_CaptureSession* session,
547     Camera_FocusMode focusMode, bool* isSupported);
548 
549 /**
550  * @brief Get current focus mode.
551  *
552  * @param session the {@link Camera_CaptureSession} instance.
553  * @param exposureBias the current {@link Camera_FocusMode}.
554  * @return {@link #CAMERA_OK} if the method call succeeds.
555  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
556  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
557  * @since 11
558  */
559 Camera_ErrorCode OH_CaptureSession_GetFocusMode(Camera_CaptureSession* session, Camera_FocusMode* focusMode);
560 
561 /**
562  * @brief Set focus mode.
563  *
564  * @param session the {@link Camera_CaptureSession} instance.
565  * @param focusMode the target {@link Camera_FocusMode} to set.
566  * @return {@link #CAMERA_OK} if the method call succeeds.
567  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
568  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
569  * @since 11
570  */
571 Camera_ErrorCode OH_CaptureSession_SetFocusMode(Camera_CaptureSession* session, Camera_FocusMode focusMode);
572 
573 /**
574  * @brief Get current focus point.
575  *
576  * @param session the {@link Camera_CaptureSession} instance.
577  * @param focusPoint the current {@link Camera_Point}.
578  * @return {@link #CAMERA_OK} if the method call succeeds.
579  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
580  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
581  * @since 11
582  */
583 Camera_ErrorCode OH_CaptureSession_GetFocusPoint(Camera_CaptureSession* session, Camera_Point* focusPoint);
584 
585 /**
586  * @brief Set focus point.
587  *
588  * @param session the {@link Camera_CaptureSession} instance.
589  * @param focusPoint the target {@link Camera_Point} to set.
590  * @return {@link #CAMERA_OK} if the method call succeeds.
591  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
592  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
593  * @since 11
594  */
595 Camera_ErrorCode OH_CaptureSession_SetFocusPoint(Camera_CaptureSession* session, Camera_Point focusPoint);
596 
597 /**
598  * @brief Get all supported zoom ratio range.
599  *
600  * @param session the {@link Camera_CaptureSession} instance.
601  * @param minZoom the minimum of zoom ratio range.
602  * @param maxZoom the Maximum of zoom ratio range.
603  * @return {@link #CAMERA_OK} if the method call succeeds.
604  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
605  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
606  * @since 11
607  */
608 Camera_ErrorCode OH_CaptureSession_GetZoomRatioRange(Camera_CaptureSession* session, float* minZoom, float* maxZoom);
609 
610 /**
611  * @brief Get current zoom ratio.
612  *
613  * @param session the {@link Camera_CaptureSession} instance.
614  * @param zoom the current zoom ratio.
615  * @return {@link #CAMERA_OK} if the method call succeeds.
616  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
617  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
618  * @since 11
619  */
620 Camera_ErrorCode OH_CaptureSession_GetZoomRatio(Camera_CaptureSession* session, float* zoom);
621 
622 /**
623  * @brief Set zoom ratio.
624  *
625  * @param session the {@link Camera_CaptureSession} instance.
626  * @param zoom the target zoom ratio to set.
627  * @return {@link #CAMERA_OK} if the method call succeeds.
628  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
629  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
630  * @since 11
631  */
632 Camera_ErrorCode OH_CaptureSession_SetZoomRatio(Camera_CaptureSession* session, float zoom);
633 
634 /**
635  * @brief Check whether a specified video stabilization mode is supported.
636  *
637  * @param session the {@link Camera_CaptureSession} instance.
638  * @param mode the {@link Camera_VideoStabilizationMode} to be checked.
639  * @param isSupported the result of whether video stabilization mode supported.
640  * @return {@link #CAMERA_OK} if the method call succeeds.
641  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
642  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
643  * @since 11
644  */
645 Camera_ErrorCode OH_CaptureSession_IsVideoStabilizationModeSupported(Camera_CaptureSession* session,
646     Camera_VideoStabilizationMode mode, bool* isSupported);
647 
648 /**
649  * @brief Get current video stabilization mode.
650  *
651  * @param session the {@link Camera_CaptureSession} instance.
652  * @param mode the current {@link Camera_VideoStabilizationMode}.
653  * @return {@link #CAMERA_OK} if the method call succeeds.
654  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
655  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
656  * @since 11
657  */
658 Camera_ErrorCode OH_CaptureSession_GetVideoStabilizationMode(Camera_CaptureSession* session,
659     Camera_VideoStabilizationMode* mode);
660 
661 /**
662  * @brief Set video stabilization mode.
663  *
664  * @param session the {@link Camera_CaptureSession} instance.
665  * @param mode the target {@link Camera_VideoStabilizationMode} to set.
666  * @return {@link #CAMERA_OK} if the method call succeeds.
667  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
668  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
669  * @since 11
670  */
671 Camera_ErrorCode OH_CaptureSession_SetVideoStabilizationMode(Camera_CaptureSession* session,
672     Camera_VideoStabilizationMode mode);
673 
674 /**
675  * @brief Determines whether the camera input can be added into the session.
676  *
677  * @param session the {@link Camera_CaptureSession} instance.
678  * @param cameraInput the target {@link Camera_Input} to set.
679  * @param isSuccessful the result of whether the camera input can be added into the session.
680  * @return {@link #CAMERA_OK} if the method call succeeds.
681  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
682  * @since 12
683  */
684 Camera_ErrorCode OH_CaptureSession_CanAddInput(Camera_CaptureSession* session,
685     Camera_Input* cameraInput, bool* isSuccessful);
686 
687 /**
688  * @brief Determines whether the camera preview output can be added into the session.
689  *
690  * @param session the {@link Camera_CaptureSession} instance.
691  * @param cameraOutput the target {@link Camera_PreviewOutput} to set.
692  * @param isSuccessful the result of whether the camera preview output can be added into the session.
693  * @return {@link #CAMERA_OK} if the method call succeeds.
694  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
695  * @since 12
696  */
697 Camera_ErrorCode OH_CaptureSession_CanAddPreviewOutput(Camera_CaptureSession* session,
698     Camera_PreviewOutput* cameraOutput, bool* isSuccessful);
699 
700 /**
701  * @brief Determines whether the camera photo output can be added into the session.
702  *
703  * @param session the {@link Camera_CaptureSession} instance.
704  * @param cameraOutput the target {@link Camera_PhotoOutput} to set.
705  * @param isSuccessful the result of whether the camera photo output can be added into the session.
706  * @return {@link #CAMERA_OK} if the method call succeeds.
707  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
708  * @since 12
709  */
710 Camera_ErrorCode OH_CaptureSession_CanAddPhotoOutput(Camera_CaptureSession* session,
711     Camera_PhotoOutput* cameraOutput, bool* isSuccessful);
712 
713 /**
714  * @brief Determines whether the camera video output can be added into the session.
715  *
716  * @param session the {@link Camera_CaptureSession} instance.
717  * @param cameraOutput the target {@link Camera_VideoOutput} to set.
718  * @param isSuccessful the result of whether the camera video output can be added into the session.
719  * @return {@link #CAMERA_OK} if the method call succeeds.
720  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
721  * @since 12
722  */
723 Camera_ErrorCode OH_CaptureSession_CanAddVideoOutput(Camera_CaptureSession* session,
724     Camera_VideoOutput* cameraOutput, bool* isSuccessful);
725 
726 /**
727  * @brief Check the preconfig type is supported or not.
728  *
729  * @param session the {@link Camera_CaptureSession} instance.
730  * @param preconfigType The type {@link Camera_PreconfigType} to check support for.
731  * @param canPreconfig The result of whether preconfiguration supported.
732  * @return {@link #CAMERA_OK} if the method call succeeds.
733  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
734  * @since 12
735  */
736 Camera_ErrorCode OH_CaptureSession_CanPreconfig(Camera_CaptureSession* session,
737     Camera_PreconfigType preconfigType, bool* canPreconfig);
738 
739 /**
740  * @brief Check the preconfig type with ratio is supported or not.
741  *
742  * @param session the {@link Camera_CaptureSession} instance.
743  * @param preconfigType The type {@link Camera_PreconfigType} to check support for.
744  * @param preconfigRatio The ratio {@link Camera_PreconfigRatio} to check support for.
745  * @param canPreconfig The result of whether preconfiguration supported.
746  * @return {@link #CAMERA_OK} if the method call succeeds.
747  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
748  * @since 12
749  */
750 Camera_ErrorCode OH_CaptureSession_CanPreconfigWithRatio(Camera_CaptureSession* session,
751     Camera_PreconfigType preconfigType, Camera_PreconfigRatio preconfigRatio, bool* canPreconfig);
752 
753 /**
754  * @brief Set the preconfig type.
755  *
756  * @param session the {@link Camera_CaptureSession} instance.
757  * @param preconfigType The type {@link Camera_PreconfigType} to check support for.
758  * @return {@link #CAMERA_OK} if the method call succeeds.
759  *         {@link #CAMERA_SERVICE_FATAL_ERROR} if the internal preconfiguration fails.
760  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
761  * @since 12
762  */
763 Camera_ErrorCode OH_CaptureSession_Preconfig(Camera_CaptureSession* session,
764     Camera_PreconfigType preconfigType);
765 
766 /**
767  * @brief Set the preconfig type with ratio.
768  *
769  * @param session the {@link Camera_CaptureSession} instance.
770  * @param preconfigType The type {@link Camera_PreconfigType} to check support for.
771  * @param preconfigRatio The ratio {@link Camera_PreconfigRatio} to check support for.
772  * @return {@link #CAMERA_OK} if the method call succeeds.
773  *         {@link #CAMERA_SERVICE_FATAL_ERROR} if the internal preconfiguration fails.
774  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
775  * @since 12
776  */
777 Camera_ErrorCode OH_CaptureSession_PreconfigWithRatio(Camera_CaptureSession* session,
778     Camera_PreconfigType preconfigType, Camera_PreconfigRatio preconfigRatio);
779 
780 /**
781  * @brief Query the exposure value.
782  *
783  * @param session the {@link Camera_CaptureSession} instance.
784  * @param exposureValue the current exposure value.
785  * @return {@link #CAMERA_OK} if the method call succeeds.
786  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
787  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
788  * @since 12
789  */
790 Camera_ErrorCode OH_CaptureSession_GetExposureValue(Camera_CaptureSession* session, float* exposureValue);
791 
792 /**
793  * @brief Get current focal length.
794  *
795  * @param session the {@link Camera_CaptureSession} instance.
796  * @param focalLength the current focal length.
797  * @return {@link #CAMERA_OK} if the method call succeeds.
798  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
799  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
800  * @since 12
801  */
802 Camera_ErrorCode OH_CaptureSession_GetFocalLength(Camera_CaptureSession* session, float* focalLength);
803 
804 /**
805  * @brief Set target zoom ratio by smooth method.
806  *
807  * @param session the {@link Camera_CaptureSession} instance.
808  * @param targetZoom the target zoom ratio to set.
809  * @param smoothZoomMode the {@link Camera_SmoothZoomMode} instance.
810  * @return {@link #CAMERA_OK} if the method call succeeds.
811  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
812  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
813  * @since 12
814  */
815 Camera_ErrorCode OH_CaptureSession_SetSmoothZoom(Camera_CaptureSession* session,
816     float targetZoom, Camera_SmoothZoomMode smoothZoomMode);
817 
818 /**
819  * @brief Get the supported color spaces.
820  *
821  * @param session the {@link Camera_CaptureSession} instance.
822  * @param colorSpace the supported {@link OH_NativeBuffer_ColorSpace} list to be filled if the method call succeeds.
823  * @param size the size of supported color Spaces queried.
824  * @return {@link #CAMERA_OK} if the method call succeeds.
825  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
826  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
827  * @since 12
828  */
829 Camera_ErrorCode OH_CaptureSession_GetSupportedColorSpaces(Camera_CaptureSession* session,
830     OH_NativeBuffer_ColorSpace** colorSpace, uint32_t* size);
831 
832 /**
833  * @brief Delete the color spaces.
834  *
835  * @param session the {@link Camera_CaptureSession} instance.
836  * @param colorSpace the target {@link OH_NativeBuffer_ColorSpace} list to be deleted if the method call succeeds.
837  * @return {@link #CAMERA_OK} if the method call succeeds.
838  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
839  * @since 12
840  */
841 Camera_ErrorCode OH_CaptureSession_DeleteColorSpaces(Camera_CaptureSession* session,
842     OH_NativeBuffer_ColorSpace* colorSpace);
843 
844 /**
845  * @brief Get current color space.
846  *
847  * @param session the {@link Camera_CaptureSession} instance.
848  * @param colorSpace the current {@link OH_NativeBuffer_ColorSpace} .
849  * @return {@link #CAMERA_OK} if the method call succeeds.
850  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
851  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
852  * @since 12
853  */
854 Camera_ErrorCode OH_CaptureSession_GetActiveColorSpace(Camera_CaptureSession* session,
855     OH_NativeBuffer_ColorSpace* colorSpace);
856 
857 /**
858  * @brief Set current color space.
859  *
860  * @param session the {@link Camera_CaptureSession} instance.
861  * @param colorSpace the target {@link OH_NativeBuffer_ColorSpace} to set.
862  * @return {@link #CAMERA_OK} if the method call succeeds.
863  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
864  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
865  * @since 12
866  */
867 Camera_ErrorCode OH_CaptureSession_SetActiveColorSpace(Camera_CaptureSession* session,
868     OH_NativeBuffer_ColorSpace colorSpace);
869 
870 /**
871  * @brief Register device switch event callback.
872  *
873  * @param session the {@link Camera_CaptureSession} instance.
874  * @param autoDeviceSwitchStatusChange the {@link OH_CaptureSession_OnAutoDeviceSwitchStatusChange} to be registered.
875  * @return {@link #CAMERA_OK} if the method call succeeds.
876  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
877  * @since 13
878  */
879 Camera_ErrorCode OH_CaptureSession_RegisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession* session,
880     OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange);
881 
882 /**
883  * @brief Unregister device switch event callback.
884  *
885  * @param session the {@link Camera_CaptureSession} instance.
886  * @param autoDeviceSwitchStatusChange the {@link OH_CaptureSession_OnAutoDeviceSwitchStatusChange} to be unregistered.
887  * @return {@link #CAMERA_OK} if the method call succeeds.
888  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
889  * @since 13
890  */
891 Camera_ErrorCode OH_CaptureSession_UnregisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession* session,
892     OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange);
893 
894 /**
895  * @brief Check whether auto device switch is supported.
896  *
897  * @param session the {@link Camera_CaptureSession} instance.
898  * @param isSupported the result of whether auto device switch supported.
899  * @return {@link #CAMERA_OK} if the method call succeeds.
900  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
901  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
902  * @since 13
903  */
904 Camera_ErrorCode OH_CaptureSession_IsAutoDeviceSwitchSupported(Camera_CaptureSession* session, bool* isSupported);
905 
906 /**
907  * @brief Enable auto switch or not for the camera device.
908  *
909  * @param session the {@link Camera_CaptureSession} instance.
910  * @param enabled the flag of enable auto switch or not.
911  * @return {@link #CAMERA_OK} if the method call succeeds.
912  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
913  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
914  *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
915  * @since 13
916  */
917 Camera_ErrorCode OH_CaptureSession_EnableAutoDeviceSwitch(Camera_CaptureSession* session, bool enabled);
918 
919 /**
920  * @brief Set quality prioritization.
921  *
922  * @param session the {@link Camera_CaptureSession} instance.
923  * @param qualityPrioritization the target {@link Camera_QualityPrioritization} to set.
924  * @return {@link #CAMERA_OK} if the method call succeeds.
925  *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
926  *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
927  * @since 14
928  */
929 Camera_ErrorCode OH_CaptureSession_SetQualityPrioritization(
930     Camera_CaptureSession* session, Camera_QualityPrioritization qualityPrioritization);
931 
932 #ifdef __cplusplus
933 }
934 #endif
935 
936 #endif // NATIVE_INCLUDE_CAMERA_CAMERA_SESSION_H
937 /** @} */