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