• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# camera_manager.h
2<!--Kit: Camera Kit-->
3<!--Subsystem: Multimedia-->
4<!--Owner: @qano-->
5<!--SE: @leo_ysl-->
6<!--TSE: @xchaosioda-->
7
8## Overview
9
10The file declares the camera manager concepts.
11
12**File to include**: <ohcamera/camera_manager.h>
13
14**Library**: libohcamera.so
15
16**System capability**: SystemCapability.Multimedia.Camera.Core
17
18**Since**: 11
19
20**Related module**: [OH_Camera](capi-oh-camera.md)
21
22## Summary
23
24### Structs
25
26| Name| typedef Keyword| Description|
27| -- | -- | -- |
28| [CameraManager_Callbacks](capi-oh-camera-cameramanager-callbacks.md) | CameraManager_Callbacks | Describes the callbacks used to listen for camera status changes.|
29
30### Functions
31
32| Name| typedef Keyword| Description|
33| -- | -- | -- |
34| [typedef void (\*OH_CameraManager_StatusCallback)(Camera_Manager* cameraManager, Camera_StatusInfo* status)](#oh_cameramanager_statuscallback) | OH_CameraManager_StatusCallback | Defines the callback defined in the [CameraManager_Callbacks](capi-oh-camera-cameramanager-callbacks.md) struct and used to report the camera manager status.|
35| [typedef void (\*OH_CameraManager_TorchStatusCallback)(Camera_Manager* cameraManager, Camera_TorchStatusInfo* status)](#oh_cameramanager_torchstatuscallback) | OH_CameraManager_TorchStatusCallback | Defines the callback to listen for flashlight status changes.|
36| [typedef void (\*OH_CameraManager_OnFoldStatusInfoChange)(Camera_Manager* cameraManager,Camera_FoldStatusInfo* foldStatusInfo)](#oh_cameramanager_onfoldstatusinfochange) | OH_CameraManager_OnFoldStatusInfoChange | Defines the callback to listen for fold status changes of the camera manager.|
37| [Camera_ErrorCode OH_CameraManager_RegisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback)](#oh_cameramanager_registercallback) | - | Registers a callback to listen for camera status changes.|
38| [Camera_ErrorCode OH_CameraManager_UnregisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback)](#oh_cameramanager_unregistercallback) | - | Unregisters the callback used to listen for camera status changes.|
39| [Camera_ErrorCode OH_CameraManager_RegisterTorchStatusCallback(Camera_Manager* cameraManager,OH_CameraManager_TorchStatusCallback torchStatusCallback)](#oh_cameramanager_registertorchstatuscallback) | - | Registers a callback to listen for flashlight status changes.|
40| [Camera_ErrorCode OH_CameraManager_UnregisterTorchStatusCallback(Camera_Manager* cameraManager,OH_CameraManager_TorchStatusCallback torchStatusCallback)](#oh_cameramanager_unregistertorchstatuscallback) | - | Unregisters the callback used to listen for flashlight status changes.|
41| [Camera_ErrorCode OH_CameraManager_RegisterFoldStatusInfoCallback(Camera_Manager* cameraManager,OH_CameraManager_OnFoldStatusInfoChange foldStatusInfoCallback)](#oh_cameramanager_registerfoldstatusinfocallback) | - | Registers a callback to listen for fold status changes.|
42| [Camera_ErrorCode OH_CameraManager_UnregisterFoldStatusInfoCallback(Camera_Manager* cameraManager,OH_CameraManager_OnFoldStatusInfoChange foldStatusInfoCallback)](#oh_cameramanager_unregisterfoldstatusinfocallback) | - | Unregisters the callback used to listen for fold status changes.|
43| [Camera_ErrorCode OH_CameraManager_GetSupportedCameras(Camera_Manager* cameraManager,Camera_Device** cameras, uint32_t* size)](#oh_cameramanager_getsupportedcameras) | - | Obtains the supported cameras.|
44| [Camera_ErrorCode OH_CameraManager_DeleteSupportedCameras(Camera_Manager* cameraManager,Camera_Device* cameras, uint32_t size)](#oh_cameramanager_deletesupportedcameras) | - | Deletes supported cameras.|
45| [Camera_ErrorCode OH_CameraManager_GetSupportedCameraOutputCapability(Camera_Manager* cameraManager,const Camera_Device* camera, Camera_OutputCapability** cameraOutputCapability)](#oh_cameramanager_getsupportedcameraoutputcapability) | - | Obtains the output capability supported by a camera.|
46| [Camera_ErrorCode OH_CameraManager_GetSupportedCameraOutputCapabilityWithSceneMode(Camera_Manager* cameraManager,const Camera_Device* camera, Camera_SceneMode sceneMode, Camera_OutputCapability** cameraOutputCapability)](#oh_cameramanager_getsupportedcameraoutputcapabilitywithscenemode) | - | Obtains the output capability supported by a camera in the specified mode.|
47| [Camera_ErrorCode OH_CameraManager_DeleteSupportedCameraOutputCapability(Camera_Manager* cameraManager,Camera_OutputCapability* cameraOutputCapability)](#oh_cameramanager_deletesupportedcameraoutputcapability) | - | Deletes the output capability supported by a camera.|
48| [Camera_ErrorCode OH_CameraManager_IsCameraMuted(Camera_Manager* cameraManager, bool* isCameraMuted)](#oh_cameramanager_iscameramuted) | - | Checks whether a camera is muted.|
49| [Camera_ErrorCode OH_CameraManager_CreateCaptureSession(Camera_Manager* cameraManager,Camera_CaptureSession** captureSession)](#oh_cameramanager_createcapturesession) | - | Creates a CaptureSession instance.|
50| [Camera_ErrorCode OH_CameraManager_CreateCameraInput(Camera_Manager* cameraManager,const Camera_Device* camera, Camera_Input** cameraInput)](#oh_cameramanager_createcamerainput) | - | Creates a Camera_Input instance.|
51| [Camera_ErrorCode OH_CameraManager_CreateCameraInput_WithPositionAndType(Camera_Manager* cameraManager,Camera_Position position, Camera_Type type, Camera_Input** cameraInput)](#oh_cameramanager_createcamerainput_withpositionandtype) | - | Creates a Camera_Input instance with the specified camera location and type.|
52| [Camera_ErrorCode OH_CameraManager_CreatePreviewOutput(Camera_Manager* cameraManager, const Camera_Profile* profile,const char* surfaceId, Camera_PreviewOutput** previewOutput)](#oh_cameramanager_createpreviewoutput) | - | Creates a PreviewOutput instance.|
53| [Camera_ErrorCode OH_CameraManager_CreatePreviewOutputUsedInPreconfig(Camera_Manager* cameraManager,const char* surfaceId, Camera_PreviewOutput** previewOutput)](#oh_cameramanager_createpreviewoutputusedinpreconfig) | - | Creates a PreviewOutput instance to be used in a preconfiguration stream.|
54| [Camera_ErrorCode OH_CameraManager_CreatePhotoOutput(Camera_Manager* cameraManager, const Camera_Profile* profile,const char* surfaceId, Camera_PhotoOutput** photoOutput)](#oh_cameramanager_createphotooutput) | - | Creates a PhotoOutput instance.|
55| [Camera_ErrorCode OH_CameraManager_CreatePhotoOutputUsedInPreconfig(Camera_Manager* cameraManager,const char* surfaceId, Camera_PhotoOutput** photoOutput)](#oh_cameramanager_createphotooutputusedinpreconfig) | - | Creates a PhotoOutput instance to be used in a preconfiguration stream.|
56| [Camera_ErrorCode OH_CameraManager_CreatePhotoOutputWithoutSurface(Camera_Manager *cameraManager,const Camera_Profile *profile, Camera_PhotoOutput **photoOutput)](#oh_cameramanager_createphotooutputwithoutsurface) | - | Creates a PhotoOutput instance. **surfaceId** is not required in this function.|
57| [Camera_ErrorCode OH_CameraManager_CreateVideoOutput(Camera_Manager* cameraManager, const Camera_VideoProfile* profile,const char* surfaceId, Camera_VideoOutput** videoOutput)](#oh_cameramanager_createvideooutput) | - | Creates a VideoOutput instance.|
58| [Camera_ErrorCode OH_CameraManager_CreateVideoOutputUsedInPreconfig(Camera_Manager* cameraManager,const char* surfaceId, Camera_VideoOutput** videoOutput)](#oh_cameramanager_createvideooutputusedinpreconfig) | - | Creates a VideoOutput instance to be used in a preconfiguration stream.|
59| [Camera_ErrorCode OH_CameraManager_CreateMetadataOutput(Camera_Manager* cameraManager,const Camera_MetadataObjectType* profile, Camera_MetadataOutput** metadataOutput)](#oh_cameramanager_createmetadataoutput) | - | Creates a MetadataOutput instance.|
60| [Camera_ErrorCode OH_CameraManager_GetSupportedSceneModes(Camera_Device* camera,Camera_SceneMode** sceneModes, uint32_t* size)](#oh_cameramanager_getsupportedscenemodes) | - | Obtains the scene modes supported by a camera.|
61| [Camera_ErrorCode OH_CameraManager_DeleteSceneModes(Camera_Manager* cameraManager, Camera_SceneMode* sceneModes)](#oh_cameramanager_deletescenemodes) | - | Deletes scene modes.|
62| [Camera_ErrorCode OH_CameraManager_IsTorchSupported(Camera_Manager* cameraManager,bool* isTorchSupported)](#oh_cameramanager_istorchsupported) | - | Checks whether the device supports the flashlight.|
63| [Camera_ErrorCode OH_CameraManager_IsTorchSupportedByTorchMode(Camera_Manager* cameraManager,Camera_TorchMode torchMode, bool* isTorchSupported)](#oh_cameramanager_istorchsupportedbytorchmode) | - | Checks whether the device supports the specified flashlight mode.|
64| [Camera_ErrorCode OH_CameraManager_SetTorchMode(Camera_Manager* cameraManager,Camera_TorchMode torchMode)](#oh_cameramanager_settorchmode) | - | Sets a flashlight mode.|
65| [Camera_ErrorCode OH_CameraManager_GetCameraDevice(Camera_Manager* cameraManager, Camera_Position position,Camera_Type type, Camera_Device* camera)](#oh_cameramanager_getcameradevice) | - | Obtains the specified camera based on the camera position and type.|
66| [Camera_ErrorCode OH_CameraManager_GetCameraConcurrentInfos(Camera_Manager* cameraManager, const Camera_Device* camera,uint32_t deviceSize,Camera_ConcurrentInfo** cameraConcurrentInfo,uint32_t* infoSize)](#oh_cameramanager_getcameraconcurrentinfos) | - | Obtains the concurrency information of the specified cameras.|
67
68## Function Description
69
70### OH_CameraManager_StatusCallback()
71
72```
73typedef void (*OH_CameraManager_StatusCallback)(Camera_Manager* cameraManager, Camera_StatusInfo* status)
74```
75
76**Description**
77
78Defines the callback defined in the [CameraManager_Callbacks](capi-oh-camera-cameramanager-callbacks.md) struct and used to report the camera manager status.
79
80**Since**: 11
81
82
83**Parameters**
84
85| Name| Description|
86| -- | -- |
87| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance that transfers the callback.|
88| [Camera_StatusInfo](capi-oh-camera-camera-statusinfo.md)* status | Pointer to the status information of each camera.|
89
90### OH_CameraManager_TorchStatusCallback()
91
92```
93typedef void (*OH_CameraManager_TorchStatusCallback)(Camera_Manager* cameraManager, Camera_TorchStatusInfo* status)
94```
95
96**Description**
97
98Defines the callback to listen for flashlight status changes.
99
100**Since**: 12
101
102
103**Parameters**
104
105| Name| Description|
106| -- | -- |
107| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance that transfers the callback.|
108| [Camera_TorchStatusInfo](capi-oh-camera-camera-torchstatusinfo.md)* status | Pointer to the flashlight status information.|
109
110### OH_CameraManager_OnFoldStatusInfoChange()
111
112```
113typedef void (*OH_CameraManager_OnFoldStatusInfoChange)(Camera_Manager* cameraManager,Camera_FoldStatusInfo* foldStatusInfo)
114```
115
116**Description**
117
118Defines the callback to listen for fold status changes of the camera manager.
119
120**Since**: 13
121
122
123**Parameters**
124
125| Name| Description|
126| -- | -- |
127| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance that transfers the callback.|
128| [Camera_FoldStatusInfo](capi-oh-camera-camera-foldstatusinfo.md)* foldStatusInfo | Pointer to the fold status information of the device.|
129
130### OH_CameraManager_RegisterCallback()
131
132```
133Camera_ErrorCode OH_CameraManager_RegisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback)
134```
135
136**Description**
137
138Registers a callback to listen for camera status changes.
139
140**Since**: 11
141
142
143**Parameters**
144
145| Name| Description|
146| -- | -- |
147| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
148| [CameraManager_Callbacks](capi-oh-camera-cameramanager-callbacks.md)* callback | Pointer to the target callback.|
149
150**Returns**
151
152| Type| Description|
153| -- | -- |
154| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
155
156### OH_CameraManager_UnregisterCallback()
157
158```
159Camera_ErrorCode OH_CameraManager_UnregisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback)
160```
161
162**Description**
163
164Unregisters the callback used to listen for camera status changes.
165
166**Since**: 11
167
168
169**Parameters**
170
171| Name| Description|
172| -- | -- |
173| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
174| [CameraManager_Callbacks](capi-oh-camera-cameramanager-callbacks.md)* callback | Pointer to the target callback.|
175
176**Returns**
177
178| Type| Description|
179| -- | -- |
180| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
181
182### OH_CameraManager_RegisterTorchStatusCallback()
183
184```
185Camera_ErrorCode OH_CameraManager_RegisterTorchStatusCallback(Camera_Manager* cameraManager,OH_CameraManager_TorchStatusCallback torchStatusCallback)
186```
187
188**Description**
189
190Registers a callback to listen for flashlight status changes.
191
192**Since**: 12
193
194
195**Parameters**
196
197| Name| Description|
198| -- | -- |
199| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
200| [OH_CameraManager_TorchStatusCallback](#oh_cameramanager_torchstatuscallback) torchStatusCallback | Target callback.|
201
202**Returns**
203
204| Type| Description|
205| -- | -- |
206| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
207
208### OH_CameraManager_UnregisterTorchStatusCallback()
209
210```
211Camera_ErrorCode OH_CameraManager_UnregisterTorchStatusCallback(Camera_Manager* cameraManager,OH_CameraManager_TorchStatusCallback torchStatusCallback)
212```
213
214**Description**
215
216Unregisters the callback used to listen for flashlight status changes.
217
218**Since**: 12
219
220
221**Parameters**
222
223| Name| Description|
224| -- | -- |
225| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
226| [OH_CameraManager_TorchStatusCallback](#oh_cameramanager_torchstatuscallback) torchStatusCallback | Target callback.|
227
228**Returns**
229
230| Type| Description|
231| -- | -- |
232| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
233
234### OH_CameraManager_RegisterFoldStatusInfoCallback()
235
236```
237Camera_ErrorCode OH_CameraManager_RegisterFoldStatusInfoCallback(Camera_Manager* cameraManager,OH_CameraManager_OnFoldStatusInfoChange foldStatusInfoCallback)
238```
239
240**Description**
241
242Registers a callback to listen for fold status changes.
243
244**Since**: 13
245
246
247**Parameters**
248
249| Name| Description|
250| -- | -- |
251| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
252| [OH_CameraManager_OnFoldStatusInfoChange](#oh_cameramanager_onfoldstatusinfochange) foldStatusInfoCallback | Target callback.|
253
254**Returns**
255
256| Type| Description|
257| -- | -- |
258| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
259
260### OH_CameraManager_UnregisterFoldStatusInfoCallback()
261
262```
263Camera_ErrorCode OH_CameraManager_UnregisterFoldStatusInfoCallback(Camera_Manager* cameraManager,OH_CameraManager_OnFoldStatusInfoChange foldStatusInfoCallback)
264```
265
266**Description**
267
268Unregisters the callback used to listen for fold status changes.
269
270**Since**: 13
271
272
273**Parameters**
274
275| Name| Description|
276| -- | -- |
277| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
278| [OH_CameraManager_OnFoldStatusInfoChange](#oh_cameramanager_onfoldstatusinfochange) foldStatusInfoCallback | Target callback.|
279
280**Returns**
281
282| Type| Description|
283| -- | -- |
284| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
285
286### OH_CameraManager_GetSupportedCameras()
287
288```
289Camera_ErrorCode OH_CameraManager_GetSupportedCameras(Camera_Manager* cameraManager,Camera_Device** cameras, uint32_t* size)
290```
291
292**Description**
293
294Obtains the supported cameras.
295
296**Since**: 11
297
298
299**Parameters**
300
301| Name| Description|
302| -- | -- |
303| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
304| [Camera_Device](capi-oh-camera-camera-device.md)** cameras | Double pointer to the list of cameras, which are defined in the Camera_Device struct, if the function is successfully called.|
305| uint32_t* size | Pointer to the size of the list of cameras.|
306
307**Returns**
308
309| Type| Description|
310| -- | -- |
311| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
312
313### OH_CameraManager_DeleteSupportedCameras()
314
315```
316Camera_ErrorCode OH_CameraManager_DeleteSupportedCameras(Camera_Manager* cameraManager,Camera_Device* cameras, uint32_t size)
317```
318
319**Description**
320
321Deletes supported cameras.
322
323**Since**: 11
324
325
326**Parameters**
327
328| Name| Description|
329| -- | -- |
330| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
331| [Camera_Device](capi-oh-camera-camera-device.md)* cameras | Pointer to a list of cameras, which are defined in the Camera_Device struct.|
332
333**Returns**
334
335| Type| Description|
336| -- | -- |
337| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
338
339### OH_CameraManager_GetSupportedCameraOutputCapability()
340
341```
342Camera_ErrorCode OH_CameraManager_GetSupportedCameraOutputCapability(Camera_Manager* cameraManager,const Camera_Device* camera, Camera_OutputCapability** cameraOutputCapability)
343```
344
345**Description**
346
347Obtains the output capability supported by a camera.
348
349**Since**: 11
350
351
352**Parameters**
353
354| Name| Description|
355| -- | -- |
356| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
357| const [Camera_Device](capi-oh-camera-camera-device.md)* camera | Pointer to the Camera_Device instance.|
358| [Camera_OutputCapability](capi-oh-camera-camera-outputcapability.md)** cameraOutputCapability | Double pointer to the output capability, which is defined in the Camera_OutputCapability struct, if the function is successfully called.|
359
360**Returns**
361
362| Type| Description|
363| -- | -- |
364| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
365
366### OH_CameraManager_GetSupportedCameraOutputCapabilityWithSceneMode()
367
368```
369Camera_ErrorCode OH_CameraManager_GetSupportedCameraOutputCapabilityWithSceneMode(Camera_Manager* cameraManager,const Camera_Device* camera, Camera_SceneMode sceneMode, Camera_OutputCapability** cameraOutputCapability)
370```
371
372**Description**
373
374Obtains the output capability supported by a camera in the specified mode.
375
376**Since**: 12
377
378
379**Parameters**
380
381| Name| Description|
382| -- | -- |
383| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
384| const [Camera_Device](capi-oh-camera-camera-device.md)* camera | Pointer to the Camera_Device instance.|
385| [Camera_SceneMode](capi-camera-h.md#camera_scenemode) sceneMode | Scene mode.|
386| [Camera_OutputCapability](capi-oh-camera-camera-outputcapability.md)** cameraOutputCapability | Double pointer to output capability, which is defined in the Camera_OutputCapability struct, if the function is successfully called.|
387
388**Returns**
389
390| Type| Description|
391| -- | -- |
392| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
393
394### OH_CameraManager_DeleteSupportedCameraOutputCapability()
395
396```
397Camera_ErrorCode OH_CameraManager_DeleteSupportedCameraOutputCapability(Camera_Manager* cameraManager,Camera_OutputCapability* cameraOutputCapability)
398```
399
400**Description**
401
402Deletes the output capability supported by a camera.
403
404**Since**: 11
405
406
407**Parameters**
408
409| Name| Description|
410| -- | -- |
411| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
412| [Camera_OutputCapability](capi-oh-camera-camera-outputcapability.md)* cameraOutputCapability | Pointer to the output capability, which is defined in the Camera_OutputCapability struct.|
413
414**Returns**
415
416| Type| Description|
417| -- | -- |
418| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
419
420### OH_CameraManager_IsCameraMuted()
421
422```
423Camera_ErrorCode OH_CameraManager_IsCameraMuted(Camera_Manager* cameraManager, bool* isCameraMuted)
424```
425
426**Description**
427
428Checks whether a camera is muted.
429
430**Since**: 11
431
432
433**Parameters**
434
435| Name| Description|
436| -- | -- |
437| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
438| bool* isCameraMuted | Pointer to the check result for whether the camera is muted, if the function is successfully called.|
439
440**Returns**
441
442| Type| Description|
443| -- | -- |
444| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
445
446### OH_CameraManager_CreateCaptureSession()
447
448```
449Camera_ErrorCode OH_CameraManager_CreateCaptureSession(Camera_Manager* cameraManager,Camera_CaptureSession** captureSession)
450```
451
452**Description**
453
454Creates a CaptureSession instance.
455
456**Since**: 11
457
458
459**Parameters**
460
461| Name| Description|
462| -- | -- |
463| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
464| [Camera_CaptureSession](capi-oh-camera-camera-capturesession.md)** captureSession | Double pointer to the Camera_CaptureSession instance created, if the function is successfully called.|
465
466**Returns**
467
468| Type| Description|
469| -- | -- |
470| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
471
472### OH_CameraManager_CreateCameraInput()
473
474```
475Camera_ErrorCode OH_CameraManager_CreateCameraInput(Camera_Manager* cameraManager,const Camera_Device* camera, Camera_Input** cameraInput)
476```
477
478**Description**
479
480Creates a Camera_Input instance.
481
482**Required permissions**: ohos.permission.CAMERA
483
484**Since**: 11
485
486
487**Parameters**
488
489| Name| Description|
490| -- | -- |
491| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
492| const [Camera_Device](capi-oh-camera-camera-device.md)* camera | Pointer to the Camera_Device instance.|
493| [Camera_Input](capi-oh-camera-camera-input.md)** cameraInput | Double pointer to the Camera_Input instance created, if the function is successfully called.|
494
495**Returns**
496
497| Type| Description|
498| -- | -- |
499| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
500
501### OH_CameraManager_CreateCameraInput_WithPositionAndType()
502
503```
504Camera_ErrorCode OH_CameraManager_CreateCameraInput_WithPositionAndType(Camera_Manager* cameraManager,Camera_Position position, Camera_Type type, Camera_Input** cameraInput)
505```
506
507**Description**
508
509Creates a Camera_Input instance with the specified camera position and type.
510
511**Required permissions**: ohos.permission.CAMERA
512
513**Since**: 11
514
515
516**Parameters**
517
518| Name| Description|
519| -- | -- |
520| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
521| [Camera_Position](capi-camera-h.md#camera_position) position | Camera position.|
522| [Camera_Type](capi-camera-h.md#camera_type) type | Camera type.|
523| [Camera_Input](capi-oh-camera-camera-input.md)** cameraInput | Double pointer to the Camera_Input instance created, if the function is successfully called.|
524
525**Returns**
526
527| Type| Description|
528| -- | -- |
529| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
530
531### OH_CameraManager_CreatePreviewOutput()
532
533```
534Camera_ErrorCode OH_CameraManager_CreatePreviewOutput(Camera_Manager* cameraManager, const Camera_Profile* profile,const char* surfaceId, Camera_PreviewOutput** previewOutput)
535```
536
537**Description**
538
539Creates a PreviewOutput instance.
540
541**Since**: 11
542
543
544**Parameters**
545
546| Name| Description|
547| -- | -- |
548| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
549| const [Camera_Profile](capi-oh-camera-camera-profile.md)* profile | Pointer to the profile used for creating the Camera_PreviewOutput instance.|
550| const char* surfaceId | Pointer to the surface ID used for creating the Camera_PreviewOutput instance.|
551| [Camera_PreviewOutput](capi-oh-camera-camera-previewoutput.md)** previewOutput | Double pointer to the Camera_PreviewOutput instance created, if the function is successfully called.|
552
553**Returns**
554
555| Type| Description|
556| -- | -- |
557| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
558
559### OH_CameraManager_CreatePreviewOutputUsedInPreconfig()
560
561```
562Camera_ErrorCode OH_CameraManager_CreatePreviewOutputUsedInPreconfig(Camera_Manager* cameraManager,const char* surfaceId, Camera_PreviewOutput** previewOutput)
563```
564
565**Description**
566
567Creates a PreviewOutput instance to be used in a preconfiguration stream.
568
569**Since**: 12
570
571
572**Parameters**
573
574| Name| Description|
575| -- | -- |
576| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
577| const char* surfaceId | Pointer to the surface ID used for creating the Camera_PreviewOutput instance.|
578| [Camera_PreviewOutput](capi-oh-camera-camera-previewoutput.md)** previewOutput | Double pointer to the Camera_PreviewOutput instance created, if the function is successfully called.|
579
580**Returns**
581
582| Type| Description|
583| -- | -- |
584| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
585
586### OH_CameraManager_CreatePhotoOutput()
587
588```
589Camera_ErrorCode OH_CameraManager_CreatePhotoOutput(Camera_Manager* cameraManager, const Camera_Profile* profile,const char* surfaceId, Camera_PhotoOutput** photoOutput)
590```
591
592**Description**
593
594Creates a PhotoOutput instance.
595
596**Since**: 11
597
598
599**Parameters**
600
601| Name| Description|
602| -- | -- |
603| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
604| const [Camera_Profile](capi-oh-camera-camera-profile.md)* profile | Pointer to the profile used for creating the Camera_PhotoOutput instance.|
605| const char* surfaceId | Pointer to the surface ID used for creating the Camera_PhotoOutput instance.|
606| [Camera_PhotoOutput](capi-oh-camera-camera-photooutput.md)** photoOutput | Double pointer to the Camera_PhotoOutput instance created, if the function is successfully called.|
607
608**Returns**
609
610| Type| Description|
611| -- | -- |
612| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
613
614### OH_CameraManager_CreatePhotoOutputUsedInPreconfig()
615
616```
617Camera_ErrorCode OH_CameraManager_CreatePhotoOutputUsedInPreconfig(Camera_Manager* cameraManager,const char* surfaceId, Camera_PhotoOutput** photoOutput)
618```
619
620**Description**
621
622Creates a PhotoOutput instance to be used in a preconfiguration stream.
623
624**Since**: 12
625
626
627**Parameters**
628
629| Name| Description|
630| -- | -- |
631| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
632| const char* surfaceId | Pointer to the surface ID used for creating the Camera_PhotoOutput instance.|
633| [Camera_PhotoOutput](capi-oh-camera-camera-photooutput.md)** photoOutput | Double pointer to the Camera_PhotoOutput instance created, if the function is successfully called.|
634
635**Returns**
636
637| Type| Description|
638| -- | -- |
639| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
640
641### OH_CameraManager_CreatePhotoOutputWithoutSurface()
642
643```
644Camera_ErrorCode OH_CameraManager_CreatePhotoOutputWithoutSurface(Camera_Manager *cameraManager,const Camera_Profile *profile, Camera_PhotoOutput **photoOutput)
645```
646
647**Description**
648
649Creates a PhotoOutput instance. **surfaceId** is not required in this function.
650
651**Since**: 12
652
653
654**Parameters**
655
656| Name| Description|
657| -- | -- |
658| [Camera_Manager](capi-oh-camera-camera-manager.md) *cameraManager | Pointer to the Camera_Manager instance.|
659| const [Camera_Profile](capi-oh-camera-camera-profile.md) *profile | Pointer to the profile used for creating the Camera_PhotoOutput instance.|
660| [Camera_PhotoOutput](capi-oh-camera-camera-photooutput.md) **photoOutput | Double pointer to the Camera_PhotoOutput instance created, if the function is successfully called.|
661
662**Returns**
663
664| Type| Description|
665| -- | -- |
666| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
667
668### OH_CameraManager_CreateVideoOutput()
669
670```
671Camera_ErrorCode OH_CameraManager_CreateVideoOutput(Camera_Manager* cameraManager, const Camera_VideoProfile* profile,const char* surfaceId, Camera_VideoOutput** videoOutput)
672```
673
674**Description**
675
676Creates a VideoOutput instance.
677
678**Since**: 11
679
680
681**Parameters**
682
683| Name| Description|
684| -- | -- |
685| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
686| const [Camera_VideoProfile](capi-oh-camera-camera-videoprofile.md)* profile | Pointer to the profile for creating the Camera_VideoOutput instance.|
687| const char* surfaceId | Pointer to the surface ID used for creating the Camera_VideoOutput instance.|
688| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)** videoOutput | Double pointer to the Camera_VideoOutput instance created, if the function is successfully called.|
689
690**Returns**
691
692| Type| Description|
693| -- | -- |
694| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
695
696### OH_CameraManager_CreateVideoOutputUsedInPreconfig()
697
698```
699Camera_ErrorCode OH_CameraManager_CreateVideoOutputUsedInPreconfig(Camera_Manager* cameraManager,const char* surfaceId, Camera_VideoOutput** videoOutput)
700```
701
702**Description**
703
704Creates a VideoOutput instance to be used in a preconfiguration stream.
705
706**Since**: 12
707
708
709**Parameters**
710
711| Name| Description|
712| -- | -- |
713| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
714| const char* surfaceId | Pointer to the surface ID used for creating the Camera_VideoOutput instance.|
715| [Camera_VideoOutput](capi-oh-camera-camera-videooutput.md)** videoOutput | Double pointer to the Camera_VideoOutput instance created, if the function is successfully called.|
716
717**Returns**
718
719| Type| Description|
720| -- | -- |
721| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
722
723### OH_CameraManager_CreateMetadataOutput()
724
725```
726Camera_ErrorCode OH_CameraManager_CreateMetadataOutput(Camera_Manager* cameraManager,const Camera_MetadataObjectType* profile, Camera_MetadataOutput** metadataOutput)
727```
728
729**Description**
730
731Creates a MetadataOutput instance.
732
733**Since**: 11
734
735
736**Parameters**
737
738| Name| Description|
739| -- | -- |
740| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
741| const [Camera_MetadataObjectType](capi-camera-h.md#camera_metadataobjecttype)* profile | Pointer to the metadata object type used for creating the Camera_MetadataOutput instance.|
742| [Camera_MetadataOutput](capi-oh-camera-camera-metadataoutput.md)** metadataOutput | Double pointer to the Camera_MetadataOutput instance created, if the function is successfully called.|
743
744**Returns**
745
746| Type| Description|
747| -- | -- |
748| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
749
750### OH_CameraManager_GetSupportedSceneModes()
751
752```
753Camera_ErrorCode OH_CameraManager_GetSupportedSceneModes(Camera_Device* camera,Camera_SceneMode** sceneModes, uint32_t* size)
754```
755
756**Description**
757
758Obtains the scene modes supported by a camera.
759
760**Since**: 12
761
762
763**Parameters**
764
765| Name| Description|
766| -- | -- |
767| [Camera_Device](capi-oh-camera-camera-device.md)* camera | Pointer to the Camera_Device instance.|
768| [Camera_SceneMode](capi-camera-h.md#camera_scenemode)** sceneModes | Double pointer to the list of scene modes, which are defined in the Camera_SceneMode struct, if the function is successfully called.|
769| uint32_t* size | Pointer to the size of the list of scene modes.|
770
771**Returns**
772
773| Type| Description|
774| -- | -- |
775| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
776
777### OH_CameraManager_DeleteSceneModes()
778
779```
780Camera_ErrorCode OH_CameraManager_DeleteSceneModes(Camera_Manager* cameraManager, Camera_SceneMode* sceneModes)
781```
782
783**Description**
784
785Deletes scene modes.
786
787**Since**: 12
788
789
790**Parameters**
791
792| Name| Description|
793| -- | -- |
794| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
795| [Camera_SceneMode](capi-camera-h.md#camera_scenemode)* sceneModes | Pointer to the list of scene modes to delete.|
796
797**Returns**
798
799| Type| Description|
800| -- | -- |
801| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
802
803### OH_CameraManager_IsTorchSupported()
804
805```
806Camera_ErrorCode OH_CameraManager_IsTorchSupported(Camera_Manager* cameraManager,bool* isTorchSupported)
807```
808
809**Description**
810
811Checks whether the device supports the flashlight.
812
813**Since**: 12
814
815
816**Parameters**
817
818| Name| Description|
819| -- | -- |
820| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
821| bool* isTorchSupported | Pointer to the check result for the support of the flashlight.|
822
823**Returns**
824
825| Type| Description|
826| -- | -- |
827| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.|
828
829### OH_CameraManager_IsTorchSupportedByTorchMode()
830
831```
832Camera_ErrorCode OH_CameraManager_IsTorchSupportedByTorchMode(Camera_Manager* cameraManager,Camera_TorchMode torchMode, bool* isTorchSupported)
833```
834
835**Description**
836
837Checks whether the device supports the specified flashlight mode.
838
839**Since**: 12
840
841
842**Parameters**
843
844| Name| Description|
845| -- | -- |
846| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
847| [Camera_TorchMode](capi-camera-h.md#camera_torchmode) torchMode | Flashlight mode to check.|
848| bool* isTorchSupported | Pointer to the check result for the support of the flashlight mode.|
849
850**Returns**
851
852| Type| Description|
853| -- | -- |
854| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
855
856### OH_CameraManager_SetTorchMode()
857
858```
859Camera_ErrorCode OH_CameraManager_SetTorchMode(Camera_Manager* cameraManager,Camera_TorchMode torchMode)
860```
861
862**Description**
863
864Sets a flashlight mode.
865
866**Since**: 12
867
868
869**Parameters**
870
871| Name| Description|
872| -- | -- |
873| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
874| [Camera_TorchMode](capi-camera-h.md#camera_torchmode) torchMode | Flashlight mode to set.|
875
876**Returns**
877
878| Type| Description|
879| -- | -- |
880| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
881
882### OH_CameraManager_GetCameraDevice()
883
884```
885Camera_ErrorCode OH_CameraManager_GetCameraDevice(Camera_Manager* cameraManager, Camera_Position position,Camera_Type type, Camera_Device* camera)
886```
887
888**Description**
889
890Obtains the specified camera based on the camera position and type.
891
892**Since**: 18
893
894
895**Parameters**
896
897| Name| Description|
898| -- | -- |
899| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
900| [Camera_Position](capi-camera-h.md#camera_position) position | Camera position.|
901| [Camera_Type](capi-camera-h.md#camera_type) type | Camera type.|
902| [Camera_Device](capi-oh-camera-camera-device.md)* camera | Pointer to the Camera_Device instance.|
903
904**Returns**
905
906| Type| Description|
907| -- | -- |
908| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service.|
909
910### OH_CameraManager_GetCameraConcurrentInfos()
911
912```
913Camera_ErrorCode OH_CameraManager_GetCameraConcurrentInfos(Camera_Manager* cameraManager, const Camera_Device* camera,uint32_t deviceSize,Camera_ConcurrentInfo** cameraConcurrentInfo,uint32_t* infoSize)
914```
915
916**Description**
917
918Obtains the concurrency information of the specified cameras.
919
920**Since**: 18
921
922
923**Parameters**
924
925| Name| Description|
926| -- | -- |
927| [Camera_Manager](capi-oh-camera-camera-manager.md)* cameraManager | Pointer to the Camera_Manager instance.|
928| const [Camera_Device](capi-oh-camera-camera-device.md)* camera | Pointer to the list of cameras, which are defined in the Camera_Device struct. You are advised to include both front and rear cameras obtained by calling [OH_CameraManager_GetCameraDevice](#oh_cameramanager_getcameradevice).|
929| uint32_t deviceSize | Length of the camera device list. The value must be set to 2 (indicating that both the front and rear cameras are used for concurrency information query).|
930| [Camera_ConcurrentInfo](capi-oh-camera-camera-concurrentinfo.md)** cameraConcurrentInfo | Double pointer to an array of Camera_ConcurrentInfo objects representing the concurrency information of the cameras. This parameter must be set to NULL by default when being passed in.<br>If the camera supports concurrency, it is assigned the Camera_ConcurrentInfo array obtained.<br>If the camera does not support concurrency, the passed-in value is retained and the error code [Camera_ErrorCode](capi-camera-h.md#camera_errorcode).CAMERA_SERVICE_FATAL_ERROR is returned.|
931| uint32_t* infoSize | Pointer to the length of the array. This parameter must be set to NULL by default when being passed in.<br>If the camera supports concurrency, it is assigned the length of the Camera_ConcurrentInfo array obtained.<br>If the camera does not support concurrency, the passed-in value is retained and the error code [Camera_ErrorCode](capi-camera-h.md#camera_errorcode).CAMERA_SERVICE_FATAL_ERROR is returned.|
932
933**Returns**
934
935| Type| Description|
936| -- | -- |
937| [Camera_ErrorCode](capi-camera-h.md#camera_errorcode) | **CAMERA_OK**: The operation is successful.<br>**CAMERA_INVALID_ARGUMENT**: A parameter is missing or the parameter type is incorrect.<br>**CAMERA_SERVICE_FATAL_ERROR**: A fatal error occurs in the camera service, or the camera does not support concurrency.|
938