openharmony 鸿蒙 capi-camera-manager-h

2026-08-25 浏览 (1)

camera_manager.h

Overview

The file declares the camera manager concepts.

File to include: <ohcamera/camera_manager.h>

Library: libohcamera.so

System capability: SystemCapability.Multimedia.Camera.Core

Since: 11

Related module: OH_Camera

Summary

Structs

Nametypedef KeywordDescription
CameraManager_CallbacksCameraManager_CallbacksDescribes the callbacks used to listen for camera status changes.

Functions

Nametypedef KeywordDescription
typedef void (*OH_CameraManager_StatusCallback)(Camera_Manager* cameraManager, Camera_StatusInfo* status)OH_CameraManager_StatusCallbackDefines the callback defined in the CameraManager_Callbacks struct and used to report the camera manager status.
typedef void (*OH_CameraManager_TorchStatusCallback)(Camera_Manager* cameraManager, Camera_TorchStatusInfo* status)OH_CameraManager_TorchStatusCallbackDefines the callback to listen for flashlight status changes.
typedef void (*OH_CameraManager_OnFoldStatusInfoChange)(Camera_Manager* cameraManager, Camera_FoldStatusInfo* foldStatusInfo)OH_CameraManager_OnFoldStatusInfoChangeDefines the callback to listen for fold status changes of the camera manager.
Camera_ErrorCode OH_CameraManager_RegisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback)-Registers a callback to listen for camera status changes.
Camera_ErrorCode OH_CameraManager_UnregisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback)-Unregisters the callback used to listen for camera status changes.
Camera_ErrorCode OH_CameraManager_RegisterTorchStatusCallback(Camera_Manager* cameraManager, OH_CameraManager_TorchStatusCallback torchStatusCallback)-Registers a callback to listen for flashlight status changes.
Camera_ErrorCode OH_CameraManager_UnregisterTorchStatusCallback(Camera_Manager* cameraManager, OH_CameraManager_TorchStatusCallback torchStatusCallback)-Unregisters the callback used to listen for flashlight status changes.
Camera_ErrorCode OH_CameraManager_RegisterFoldStatusInfoCallback(Camera_Manager* cameraManager, OH_CameraManager_OnFoldStatusInfoChange foldStatusInfoCallback)-Registers a callback to listen for fold status changes.
Camera_ErrorCode OH_CameraManager_UnregisterFoldStatusInfoCallback(Camera_Manager* cameraManager, OH_CameraManager_OnFoldStatusInfoChange foldStatusInfoCallback)-Unregisters the callback used to listen for fold status changes.
Camera_ErrorCode OH_CameraManager_GetSupportedCameras(Camera_Manager* cameraManager, Camera_Device** cameras, uint32_t* size)-Obtains the supported cameras.
Camera_ErrorCode OH_CameraManager_DeleteSupportedCameras(Camera_Manager* cameraManager, Camera_Device* cameras, uint32_t size)-Deletes supported cameras.
Camera_ErrorCode OH_CameraManager_GetSupportedCameraOutputCapability(Camera_Manager* cameraManager, const Camera_Device* camera, Camera_OutputCapability** cameraOutputCapability)-Obtains the output capability supported by a camera.
Camera_ErrorCode OH_CameraManager_GetSupportedCameraOutputCapabilityWithSceneMode(Camera_Manager* cameraManager, const Camera_Device* camera, Camera_SceneMode sceneMode, Camera_OutputCapability** cameraOutputCapability)-Obtains the output capability supported by a camera in the specified mode.
Camera_ErrorCode OH_CameraManager_GetSupportedFullCameraOutputCapabilityWithSceneMode(Camera_Manager* cameraManager, const Camera_Device* camera, Camera_SceneMode sceneMode, Camera_OutputCapability** cameraOutputCapability)-Obtains the complete output capabilities supported by a specified camera in a specified mode, including YUV, HEIF, and HDR. Before using YUV, HEIF, or HDR, you need to explicitly call this method to ensure that the complete output capabilities are obtained.
Camera_ErrorCode OH_CameraManager_DeleteSupportedCameraOutputCapability(Camera_Manager* cameraManager, Camera_OutputCapability* cameraOutputCapability)-Deletes the output capability supported by a camera.
Camera_ErrorCode OH_CameraManager_IsCameraMuted(Camera_Manager* cameraManager, bool* isCameraMuted)-Checks whether a camera is muted.
Camera_ErrorCode OH_CameraManager_CreateCaptureSession(Camera_Manager* cameraManager, Camera_CaptureSession** captureSession)-Creates a CaptureSession instance.
Camera_ErrorCode OH_CameraManager_CreateCameraInput(Camera_Manager* cameraManager, const Camera_Device* camera, Camera_Input** cameraInput)-Creates a Camera_Input instance.
Camera_ErrorCode OH_CameraManager_CreateCameraInput_WithPositionAndType(Camera_Manager* cameraManager, Camera_Position position, Camera_Type type, Camera_Input** cameraInput)-Creates a Camera_Input instance with the specified camera position and type.
Camera_ErrorCode OH_CameraManager_CreatePreviewOutput(Camera_Manager* cameraManager, const Camera_Profile* profile, const char* surfaceId, Camera_PreviewOutput** previewOutput)-Creates a PreviewOutput instance.
Camera_ErrorCode OH_CameraManager_CreateDeferredPreviewOutput(const Camera_Manager* cameraManager, const Camera_Profile* profile, Camera_PreviewOutput** previewOutput)-Creates a deferred PreviewOutput instance. After using the instance, call OH_PreviewOutput_Release to release it.
Camera_ErrorCode OH_CameraManager_CreatePreviewOutputUsedInPreconfig(Camera_Manager* cameraManager, const char* surfaceId, Camera_PreviewOutput** previewOutput)-Creates a PreviewOutput instance to be used in a preconfiguration stream.
Camera_ErrorCode OH_CameraManager_CreatePhotoOutput(Camera_Manager* cameraManager, const Camera_Profile* profile, const char* surfaceId, Camera_PhotoOutput** photoOutput)-Creates a PhotoOutput instance. This API can only be used to create a PhotoOutput object in JPEG format.
Camera_ErrorCode OH_CameraManager_CreatePhotoOutputUsedInPreconfig(Camera_Manager* cameraManager, const char* surfaceId, Camera_PhotoOutput** photoOutput)-Creates a PhotoOutput instance to be used in a preconfiguration stream.
Camera_ErrorCode OH_CameraManager_CreatePhotoOutputWithoutSurface(Camera_Manager *cameraManager, const Camera_Profile *profile, Camera_PhotoOutput **photoOutput)-Creates a PhotoOutput instance. surfaceId is not required in this function.
Camera_ErrorCode OH_CameraManager_CreateVideoOutput(Camera_Manager* cameraManager, const Camera_VideoProfile* profile, const char* surfaceId, Camera_VideoOutput** videoOutput)-Creates a VideoOutput instance.
Camera_ErrorCode OH_CameraManager_CreateVideoOutputUsedInPreconfig(Camera_Manager* cameraManager, const char* surfaceId, Camera_VideoOutput** videoOutput)-Creates a VideoOutput instance to be used in a preconfiguration stream.
Camera_ErrorCode OH_CameraManager_CreateMetadataOutput(Camera_Manager* cameraManager, const Camera_MetadataObjectType* profile, Camera_MetadataOutput** metadataOutput)-Creates a MetadataOutput instance.
Camera_ErrorCode OH_CameraManager_CreateMetadataOutputWithObjectTypes(Camera_Manager* cameraManager, const Camera_MetadataObjectType* metadataObjectTypes, uint32_t size, Camera_MetadataOutput** metadataOutput)-Creates a metadataOutput instance using an array of metadata object types.
Camera_ErrorCode OH_CameraManager_GetSupportedSceneModes(Camera_Device* camera, Camera_SceneMode** sceneModes, uint32_t* size)-Obtains the scene modes supported by a camera.
Camera_ErrorCode OH_CameraManager_DeleteSceneModes(Camera_Manager* cameraManager, Camera_SceneMode* sceneModes)-Deletes scene modes.
Camera_ErrorCode OH_CameraManager_IsTorchSupported(Camera_Manager* cameraManager, bool* isTorchSupported)-Checks whether the device supports the flashlight.
Camera_ErrorCode OH_CameraManager_IsTorchSupportedByTorchMode(Camera_Manager* cameraManager, Camera_TorchMode torchMode, bool* isTorchSupported)-Checks whether the device supports the specified flashlight mode.
Camera_ErrorCode OH_CameraManager_SetTorchMode(Camera_Manager* cameraManager, Camera_TorchMode torchMode)-Sets a flashlight mode.
Camera_ErrorCode OH_CameraManager_IsTorchLevelControlSupported(const Camera_Manager* cameraManager, bool* isTorchLevelControlSupported)-Checks whether the device supports flashlight brightness control.
Camera_ErrorCode OH_CameraManager_SetTorchModeOnWithLevel(const Camera_Manager* cameraManager, double torchLevel)-Turns on the flashlight and sets the brightness level.
Camera_ErrorCode OH_CameraManager_GetCameraDevice(Camera_Manager* cameraManager, Camera_Position position, Camera_Type type, Camera_Device* camera)-Obtains the specified camera based on the camera position and type.
Camera_ErrorCode OH_CameraManager_GetCameraDevices(Camera_Manager* cameraManager, Camera_DeviceQueryInfo* deviceQueryInfo, uint32_t* cameraSize, Camera_Device** cameras)-Obtains the list of cameras that meet the search criteria based on the camera position, camera types, and connection type.
Camera_ErrorCode OH_CameraManager_DeleteCameraDevices(Camera_Manager* cameraManager, Camera_Device* cameras)-Deletes the specified camera.
Camera_ErrorCode OH_CameraManager_GetCameraConcurrentInfos(Camera_Manager* cameraManager, const Camera_Device* camera, uint32_t deviceSize, Camera_ConcurrentInfo** cameraConcurrentInfo, uint32_t* infoSize)-Obtains the concurrency information of the specified cameras.

Function Description

OH_CameraManager_StatusCallback()

typedef void (*OH_CameraManager_StatusCallback)(Camera_Manager* cameraManager, Camera_StatusInfo* status)

Description

Defines the callback defined in the CameraManager_Callbacks struct and used to report the camera manager status.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance that transfers the callback.
Camera_StatusInfo* statusPointer to the status information of each camera.

OH_CameraManager_TorchStatusCallback()

typedef void (*OH_CameraManager_TorchStatusCallback)(Camera_Manager* cameraManager, Camera_TorchStatusInfo* status)

Description

Defines the callback to listen for flashlight status changes.

Since: 12

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance that transfers the callback.
Camera_TorchStatusInfo* statusPointer to the flashlight status information.

OH_CameraManager_OnFoldStatusInfoChange()

typedef void (*OH_CameraManager_OnFoldStatusInfoChange)(Camera_Manager* cameraManager, Camera_FoldStatusInfo* foldStatusInfo)

Description

Defines the callback to listen for fold status changes of the camera manager.

Since: 13

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance that transfers the callback.
Camera_FoldStatusInfo* foldStatusInfoPointer to the fold status information of the device.

OH_CameraManager_RegisterCallback()

Camera_ErrorCode OH_CameraManager_RegisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback)

Description

Registers a callback to listen for camera status changes.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
CameraManager_Callbacks* callbackPointer to the target callback.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_UnregisterCallback()

Camera_ErrorCode OH_CameraManager_UnregisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback)

Description

Unregisters the callback used to listen for camera status changes.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
CameraManager_Callbacks* callbackPointer to the target callback.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_RegisterTorchStatusCallback()

Camera_ErrorCode OH_CameraManager_RegisterTorchStatusCallback(Camera_Manager* cameraManager, OH_CameraManager_TorchStatusCallback torchStatusCallback)

Description

Registers a callback to listen for flashlight status changes.

Since: 12

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
OH_CameraManager_TorchStatusCallback torchStatusCallbackTarget callback.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_UnregisterTorchStatusCallback()

Camera_ErrorCode OH_CameraManager_UnregisterTorchStatusCallback(Camera_Manager* cameraManager, OH_CameraManager_TorchStatusCallback torchStatusCallback)

Description

Unregisters the callback used to listen for flashlight status changes.

Since: 12

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
OH_CameraManager_TorchStatusCallback torchStatusCallbackTarget callback.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_RegisterFoldStatusInfoCallback()

Camera_ErrorCode OH_CameraManager_RegisterFoldStatusInfoCallback(Camera_Manager* cameraManager, OH_CameraManager_OnFoldStatusInfoChange foldStatusInfoCallback)

Description

Registers a callback to listen for fold status changes.

Since: 13

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
OH_CameraManager_OnFoldStatusInfoChange foldStatusInfoCallbackTarget callback.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_UnregisterFoldStatusInfoCallback()

Camera_ErrorCode OH_CameraManager_UnregisterFoldStatusInfoCallback(Camera_Manager* cameraManager, OH_CameraManager_OnFoldStatusInfoChange foldStatusInfoCallback)

Description

Unregisters the callback used to listen for fold status changes.

Since: 13

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
OH_CameraManager_OnFoldStatusInfoChange foldStatusInfoCallbackTarget callback.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_GetSupportedCameras()

Camera_ErrorCode OH_CameraManager_GetSupportedCameras(Camera_Manager* cameraManager, Camera_Device** cameras, uint32_t* size)

Description

Obtains the supported cameras.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
Camera_Device** camerasDouble pointer to the list of cameras, which are defined in the Camera_Device struct, if the function is successfully called.
uint32_t* sizePointer to the size of the list of cameras.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_DeleteSupportedCameras()

Camera_ErrorCode OH_CameraManager_DeleteSupportedCameras(Camera_Manager* cameraManager, Camera_Device* cameras, uint32_t size)

Description

Deletes supported cameras.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
Camera_Device* camerasPointer to a list of cameras, which are defined in the Camera_Device struct.
uint32_t sizeNumber of cameras to delete.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_GetSupportedCameraOutputCapability()

Camera_ErrorCode OH_CameraManager_GetSupportedCameraOutputCapability(Camera_Manager* cameraManager, const Camera_Device* camera, Camera_OutputCapability** cameraOutputCapability)

Description

Obtains the output capability supported by a camera.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const Camera_Device* cameraPointer to the Camera_Device instance.
Camera_OutputCapability** cameraOutputCapabilityDouble pointer to the output capability, which is defined in the Camera_OutputCapability struct, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_GetSupportedCameraOutputCapabilityWithSceneMode()

Camera_ErrorCode OH_CameraManager_GetSupportedCameraOutputCapabilityWithSceneMode(Camera_Manager* cameraManager, const Camera_Device* camera, Camera_SceneMode sceneMode, Camera_OutputCapability** cameraOutputCapability)

Description

Obtains the output capability supported by a camera in the specified mode.

Since: 12

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const Camera_Device* cameraPointer to the Camera_Device instance.
Camera_SceneMode sceneModeScene mode.
Camera_OutputCapability** cameraOutputCapabilityDouble pointer to output capability, which is defined in the Camera_OutputCapability struct, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_GetSupportedFullCameraOutputCapabilityWithSceneMode()

Camera_ErrorCode OH_CameraManager_GetSupportedFullCameraOutputCapabilityWithSceneMode(Camera_Manager* cameraManager, const Camera_Device* camera, Camera_SceneMode sceneMode, Camera_OutputCapability** cameraOutputCapability)

Description

Obtains the complete output capabilities supported by a specified camera in a specified mode, including YUV, HEIF, and HDR. Before using YUV, HEIF, or HDR, you need to explicitly call this method to ensure that the complete output capabilities are obtained.

Since: 23

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const Camera_Device* cameraPointer to the Camera_Device instance.
Camera_SceneMode sceneModeScene mode.
Camera_OutputCapability** cameraOutputCapabilityDouble pointer to output capability, which is defined in the Camera_OutputCapability struct, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_DeleteSupportedCameraOutputCapability()

Camera_ErrorCode OH_CameraManager_DeleteSupportedCameraOutputCapability(Camera_Manager* cameraManager, Camera_OutputCapability* cameraOutputCapability)

Description

Deletes the output capability supported by a camera.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
Camera_OutputCapability* cameraOutputCapabilityPointer to the output capability, which is defined in the Camera_OutputCapability struct.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_IsCameraMuted()

Camera_ErrorCode OH_CameraManager_IsCameraMuted(Camera_Manager* cameraManager, bool* isCameraMuted)

Description

Checks whether a camera is muted.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
bool* isCameraMutedPointer to the check result for whether the camera is muted, if the function is successfully called. true if muted, false otherwise.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_CreateCaptureSession()

Camera_ErrorCode OH_CameraManager_CreateCaptureSession(Camera_Manager* cameraManager, Camera_CaptureSession** captureSession)

Description

Creates a CaptureSession instance.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
Camera_CaptureSession** captureSessionDouble pointer to the Camera_CaptureSession instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_CreateCameraInput()

Camera_ErrorCode OH_CameraManager_CreateCameraInput(Camera_Manager* cameraManager, const Camera_Device* camera, Camera_Input** cameraInput)

Description

Creates a Camera_Input instance.

Required permissions: ohos.permission.CAMERA

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const Camera_Device* cameraPointer to the Camera_Device instance.
Camera_Input** cameraInputDouble pointer to the Camera_Input instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_CreateCameraInput_WithPositionAndType()

Camera_ErrorCode OH_CameraManager_CreateCameraInput_WithPositionAndType(Camera_Manager* cameraManager, Camera_Position position, Camera_Type type, Camera_Input** cameraInput)

Description

Creates a Camera_Input instance with the specified camera position and type.

Required permissions: ohos.permission.CAMERA

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
Camera_Position positionCamera position.
Camera_Type typeCamera type.
Camera_Input** cameraInputDouble pointer to the Camera_Input instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_CreatePreviewOutput()

Camera_ErrorCode OH_CameraManager_CreatePreviewOutput(Camera_Manager* cameraManager, const Camera_Profile* profile, const char* surfaceId, Camera_PreviewOutput** previewOutput)

Description

Creates a PreviewOutput instance.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const Camera_Profile* profilePointer to the profile used for creating the Camera_PreviewOutput instance.
const char* surfaceIdPointer to the surface ID used for creating the Camera_PreviewOutput instance.
Camera_PreviewOutput** previewOutputDouble pointer to the Camera_PreviewOutput instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_CreateDeferredPreviewOutput()

Camera_ErrorCode OH_CameraManager_CreateDeferredPreviewOutput(const Camera_Manager* cameraManager, const Camera_Profile* profile, Camera_PreviewOutput** previewOutput)

Description

Creates a deferred PreviewOutput instance. After using the instance, call OH_PreviewOutput_Release to release it.

Since: 24

Parameters

NameDescription
const Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const Camera_Profile* profilePointer to the profile used for creating the Camera_PreviewOutput instance.
Camera_PreviewOutput** previewOutputDouble pointer to the Camera_PreviewOutput instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_CreatePreviewOutputUsedInPreconfig()

Camera_ErrorCode OH_CameraManager_CreatePreviewOutputUsedInPreconfig(Camera_Manager* cameraManager, const char* surfaceId, Camera_PreviewOutput** previewOutput)

Description

Creates a PreviewOutput instance to be used in a preconfiguration stream.

Since: 12

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const char* surfaceIdPointer to the surface ID used for creating the Camera_PreviewOutput instance.
Camera_PreviewOutput** previewOutputDouble pointer to the Camera_PreviewOutput instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_CreatePhotoOutput()

Camera_ErrorCode OH_CameraManager_CreatePhotoOutput(Camera_Manager* cameraManager, const Camera_Profile* profile, const char* surfaceId, Camera_PhotoOutput** photoOutput)

Description

Creates a PhotoOutput instance. This API can only be used to create a PhotoOutput object in JPEG format.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const Camera_Profile* profilePointer to the profile used for creating the Camera_PhotoOutput instance.
const char* surfaceIdPointer to the surface ID used for creating the Camera_PhotoOutput instance.
Camera_PhotoOutput** photoOutputDouble pointer to the Camera_PhotoOutput instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_CreatePhotoOutputUsedInPreconfig()

Camera_ErrorCode OH_CameraManager_CreatePhotoOutputUsedInPreconfig(Camera_Manager* cameraManager, const char* surfaceId, Camera_PhotoOutput** photoOutput)

Description

Creates a PhotoOutput instance to be used in a preconfiguration stream.

Since: 12

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const char* surfaceIdPointer to the surface ID used for creating the Camera_PhotoOutput instance.
Camera_PhotoOutput** photoOutputDouble pointer to the Camera_PhotoOutput instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_CreatePhotoOutputWithoutSurface()

Camera_ErrorCode OH_CameraManager_CreatePhotoOutputWithoutSurface(Camera_Manager *cameraManager, const Camera_Profile *profile, Camera_PhotoOutput **photoOutput)

Description

Creates a PhotoOutput instance. surfaceId is not required in this function.

Since: 12

Parameters

NameDescription
Camera_Manager *cameraManagerPointer to the Camera_Manager instance.
const Camera_Profile *profilePointer to the profile used for creating the Camera_PhotoOutput instance.
Camera_PhotoOutput **photoOutputDouble pointer to the Camera_PhotoOutput instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_CreateVideoOutput()

Camera_ErrorCode OH_CameraManager_CreateVideoOutput(Camera_Manager* cameraManager, const Camera_VideoProfile* profile, const char* surfaceId, Camera_VideoOutput** videoOutput)

Description

Creates a VideoOutput instance.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const Camera_VideoProfile* profilePointer to the profile for creating the Camera_VideoOutput instance.
const char* surfaceIdPointer to the surface ID used for creating the Camera_VideoOutput instance.
Camera_VideoOutput** videoOutputDouble pointer to the Camera_VideoOutput instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_CreateVideoOutputUsedInPreconfig()

Camera_ErrorCode OH_CameraManager_CreateVideoOutputUsedInPreconfig(Camera_Manager* cameraManager, const char* surfaceId, Camera_VideoOutput** videoOutput)

Description

Creates a VideoOutput instance to be used in a preconfiguration stream.

Since: 12

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const char* surfaceIdPointer to the surface ID used for creating the Camera_VideoOutput instance.
Camera_VideoOutput** videoOutputDouble pointer to the Camera_VideoOutput instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_CreateMetadataOutput()

Camera_ErrorCode OH_CameraManager_CreateMetadataOutput(Camera_Manager* cameraManager, const Camera_MetadataObjectType* profile, Camera_MetadataOutput** metadataOutput)

Description

Creates a MetadataOutput instance.

Since: 11

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const Camera_MetadataObjectType* profilePointer to the metadata object type used for creating the Camera_MetadataOutput instance.
Camera_MetadataOutput** metadataOutputDouble pointer to the Camera_MetadataOutput instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_CreateMetadataOutputWithObjectTypes()

Camera_ErrorCode OH_CameraManager_CreateMetadataOutputWithObjectTypes(Camera_Manager* cameraManager, const Camera_MetadataObjectType* metadataObjectTypes, uint32_t size, Camera_MetadataOutput** metadataOutput)

Description

Creates a metadataOutput instance using an array of metadata object types.

Since: 23

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const Camera_MetadataObjectType* metadataObjectTypesPointer to the metadata object types used for creating the Camera_MetadataOutput instance.
uint32_t sizeLength of the metadata object type array.
Camera_MetadataOutput** metadataOutputDouble pointer to the Camera_MetadataOutput instance created, if the function is successfully called.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_GetSupportedSceneModes()

Camera_ErrorCode OH_CameraManager_GetSupportedSceneModes(Camera_Device* camera, Camera_SceneMode** sceneModes, uint32_t* size)

Description

Obtains the scene modes supported by a camera.

Since: 12

Parameters

NameDescription
Camera_Device* cameraPointer to the Camera_Device instance.
Camera_SceneMode** sceneModesDouble pointer to the list of scene modes, which are defined in the Camera_SceneMode struct, if the function is successfully called.
uint32_t* sizePointer to the size of the list of scene modes.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_DeleteSceneModes()

Camera_ErrorCode OH_CameraManager_DeleteSceneModes(Camera_Manager* cameraManager, Camera_SceneMode* sceneModes)

Description

Deletes scene modes.

Since: 12

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
Camera_SceneMode* sceneModesPointer to the list of scene modes to delete.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_IsTorchSupported()

Camera_ErrorCode OH_CameraManager_IsTorchSupported(Camera_Manager* cameraManager, bool* isTorchSupported)

Description

Checks whether the device supports the flashlight.

Since: 12

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
bool* isTorchSupportedPointer to the check result for the support of the flashlight. true if supported, false otherwise.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_IsTorchSupportedByTorchMode()

Camera_ErrorCode OH_CameraManager_IsTorchSupportedByTorchMode(Camera_Manager* cameraManager, Camera_TorchMode torchMode, bool* isTorchSupported)

Description

Checks whether the device supports the specified flashlight mode.

Since: 12

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
Camera_TorchMode torchModeFlashlight mode to check.
bool* isTorchSupportedPointer to the check result for the support of the flashlight mode. true if supported, false otherwise.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_SetTorchMode()

Camera_ErrorCode OH_CameraManager_SetTorchMode(Camera_Manager* cameraManager, Camera_TorchMode torchMode)

Description

Sets a flashlight mode.

Since: 12

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
Camera_TorchMode torchModeFlashlight mode to set.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_IsTorchLevelControlSupported()

Camera_ErrorCode OH_CameraManager_IsTorchLevelControlSupported(const Camera_Manager* cameraManager, bool* isTorchLevelControlSupported)

Description

Checks whether the device supports flashlight brightness control.

Since: 26.0.0

Parameters

NameDescription
const Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
bool* isTorchLevelControlSupportedWhether the device supports flashlight brightness control.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_SetTorchModeOnWithLevel()

Camera_ErrorCode OH_CameraManager_SetTorchModeOnWithLevel(const Camera_Manager* cameraManager, double torchLevel)

Description

Turns on the flashlight and sets the brightness level.

Since: 26.0.0

Parameters

NameDescription
const Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
double torchLevelTarget brightness level. The value range is [0.0, 1.0].

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_GetCameraDevice()

Camera_ErrorCode OH_CameraManager_GetCameraDevice(Camera_Manager* cameraManager, Camera_Position position, Camera_Type type, Camera_Device* camera)

Description

Obtains the specified camera based on the camera position and type.

Obtains the camera lens of the specified Camera_Position and Camera_Type. If the returned result is CAMERA_SERVICE_FATAL_ERROR, the camera lens is not found on the current device.

Since: 18

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
Camera_Position positionCamera position.
Camera_Type typeCamera type.
Camera_Device* cameraPointer to the Camera_Device instance.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_GetCameraDevices()

Camera_ErrorCode OH_CameraManager_GetCameraDevices(Camera_Manager* cameraManager, Camera_DeviceQueryInfo* deviceQueryInfo, uint32_t* cameraSize, Camera_Device** cameras)

Description

Obtains the list of cameras that meet the search criteria based on the camera position, camera types, and connection type.

Since: 23

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
Camera_DeviceQueryInfo* deviceQueryInfoCamera device query information instance.
uint32_t* cameraSizeSize of the list of supported cameras.
Camera_Device** camerasList of supported cameras.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraManager_DeleteCameraDevices()

Camera_ErrorCode OH_CameraManager_DeleteCameraDevices(Camera_Manager* cameraManager, Camera_Device* cameras)

Description

Deletes the specified camera.

Since: 23

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
Camera_Device* camerasList of cameras to be deleted.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.

OH_CameraManager_GetCameraConcurrentInfos()

Camera_ErrorCode OH_CameraManager_GetCameraConcurrentInfos(Camera_Manager* cameraManager, const Camera_Device* camera, uint32_t deviceSize, Camera_ConcurrentInfo** cameraConcurrentInfo, uint32_t* infoSize)

Description

Obtains the concurrency information of the specified cameras.

Since: 18

Parameters

NameDescription
Camera_Manager* cameraManagerPointer to the Camera_Manager instance.
const Camera_Device* cameraList of cameras used for query. You are advised to set this parameter to the camera list that contains the front and rear cameras obtained using OH_CameraManager_GetCameraDevice.
uint32_t deviceSizeLength 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).
Camera_ConcurrentInfo** cameraConcurrentInfoDouble 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.
If the camera supports concurrency, it is assigned the Camera_ConcurrentInfo array obtained.
If the camera does not support concurrency, the passed-in value is retained and the error code Camera_ErrorCode.CAMERA_SERVICE_FATAL_ERROR is returned.
uint32_t* infoSizePointer to the length of the array. This parameter must be set to 0 by default when being passed in.
If the camera supports concurrency, it is assigned the length of the Camera_ConcurrentInfo array obtained.
If the camera does not support concurrency, the passed-in value is retained and the error code Camera_ErrorCode.CAMERA_SERVICE_FATAL_ERROR is returned.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal, or the camera does not support concurrency.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-oh-camera-capturesession-callbacks

openharmony 鸿蒙 arkts-apis-camera-OIS

openharmony 鸿蒙 capi-oh-camera-camera-devicequeryinfo

openharmony 鸿蒙 capi-oh-camera-camera-frameraterange

openharmony 鸿蒙 capi-oh-camera-camera-outputcapability

openharmony 鸿蒙 arkts-apis-camera-Photo

openharmony 鸿蒙 capi-oh-camera-camera-profile

openharmony 鸿蒙 capi-oh-camera-camera-manager

openharmony 鸿蒙 capi-oh-camera-previewoutput-callbacks

openharmony 鸿蒙 arkts-apis-camera-ManualExposureQuery

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/yW4bdFSy