openharmony 鸿蒙 capi-camera-input-h

2026-08-25 浏览 (1)

camera_input.h

Overview

The file declares the camera input concepts.

File to include: <ohcamera/camera_input.h>

Library: libohcamera.so

System capability: SystemCapability.Multimedia.Camera.Core

Since: 11

Related module: OH_Camera

Summary

Structs

Nametypedef KeywordDescription
CameraInput_CallbacksCameraInput_CallbacksDescribes the callbacks used to listen for camera input errors.
Camera_InputCamera_InputDescribes the camera input object. You can use OH_CameraManager_CreateCameraInput to create such an object.

Functions

Nametypedef KeywordDescription
typedef void (*OH_CameraInput_OnError)(const Camera_Input* cameraInput, Camera_ErrorCode errorCode)OH_CameraInput_OnErrorDefines the callback defined in the CameraInput_Callbacks struct and used to report camera input errors.
Camera_ErrorCode OH_CameraInput_RegisterCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback)-Registers a callback to listen for camera input events.
Camera_ErrorCode OH_CameraInput_UnregisterCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback)-Unregisters the callback used to listen for camera input events.
Camera_ErrorCode OH_CameraInput_Open(Camera_Input* cameraInput)-Opens a camera.
Camera_ErrorCode OH_CameraInput_OpenSecureCamera(Camera_Input* cameraInput, uint64_t* secureSeqId)-Opens a camera in secure mode.
Camera_ErrorCode OH_CameraInput_OpenConcurrentCameras(Camera_Input* cameraInput, Camera_ConcurrentType type)-Opens the camera based on the specified concurrency type.
Camera_ErrorCode OH_CameraInput_Close(Camera_Input* cameraInput)-Closes a camera.
Camera_ErrorCode OH_CameraInput_Release(Camera_Input* cameraInput)-Releases a Camera_Input instance.
Either this function or OH_CameraInput_Close needs to be called.
Camera_ErrorCode OH_CameraInput_IsPhysicalCameraOrientationVariable(Camera_Input* cameraInput, bool* isVariable)-Checks whether the physical camera orientation is adjustable in different fold states of the device.
Camera_ErrorCode OH_CameraInput_GetPhysicalCameraOrientation(Camera_Input* cameraInput, uint32_t* orientation)-Obtains the physical camera orientation in the current fold state of the device.
Camera_ErrorCode OH_CameraInput_UsePhysicalCameraOrientation(Camera_Input* cameraInput, bool isUsed)-Enables or disables the use of the physical camera orientation.
typedef void (*OH_CameraInput_OnOcclusionDetectionCallback)(const Camera_Input* cameraInput, Camera_OcclusionDetectionResult occlusionDetectionResult)OH_CameraInput_OnOcclusionDetectionCallbackDefines a callback used to return the check result for whether a camera lens is blocked or dirty.
Camera_ErrorCode OH_CameraInput_RegisterOcclusionDetectionCallback(Camera_Input* cameraInput, OH_CameraInput_OnOcclusionDetectionCallback occlusionDetectionCallback)-Registers a callback used to check whether a camera lens is blocked or dirty.
Camera_ErrorCode OH_CameraInput_UnregisterOcclusionDetectionCallback(Camera_Input* cameraInput, OH_CameraInput_OnOcclusionDetectionCallback occlusionDetectionCallback)-Unregisters the callback used to check whether a camera lens is blocked or dirty.

Function Description

OH_CameraInput_OnError()

typedef void (*OH_CameraInput_OnError)(const Camera_Input* cameraInput, Camera_ErrorCode errorCode)

Description

Defines the callback defined in the CameraInput_Callbacks struct and used to report camera input errors.

Since: 11

Parameters

NameDescription
const Camera_Input* cameraInputPointer to the target Camera_Input instance.
Camera_ErrorCode errorCodeError code reported during camera input and defined in the Camera_ErrorCode struct.

See also

CAMERA_CONFLICT_CAMERA

CAMERA_DEVICE_DISABLED

CAMERA_DEVICE_PREEMPTED

CAMERA_SERVICE_FATAL_ERROR

OH_CameraInput_RegisterCallback()

Camera_ErrorCode OH_CameraInput_RegisterCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback)

Description

Registers a callback to listen for camera input events.

Since: 11

Parameters

NameDescription
Camera_Input* cameraInputPointer to the target Camera_Input instance.
CameraInput_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_CameraInput_UnregisterCallback()

Camera_ErrorCode OH_CameraInput_UnregisterCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback)

Description

Unregisters the callback used to listen for camera input events.

Since: 11

Parameters

NameDescription
Camera_Input* cameraInputPointer to the target Camera_Input instance.
CameraInput_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_CameraInput_Open()

Camera_ErrorCode OH_CameraInput_Open(Camera_Input* cameraInput)

Description

Opens a camera.

Since: 11

Parameters

NameDescription
Camera_Input* cameraInputPointer to the target Camera_Input instance.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_CONFLICT_CAMERA: The camera cannot be used due to a conflict.
CAMERA_DEVICE_DISABLED: The camera is disabled due to security reasons.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraInput_OpenSecureCamera()

Camera_ErrorCode OH_CameraInput_OpenSecureCamera(Camera_Input* cameraInput, uint64_t* secureSeqId)

Description

Opens a camera in secure mode.

Since: 12

Parameters

NameDescription
Camera_Input* cameraInputPointer to the target Camera_Input instance.
uint64_t* secureSeqIdPointer to the sequence ID of the camera.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_CONFLICT_CAMERA: The camera cannot be used due to a conflict.
CAMERA_DEVICE_DISABLED: The camera is disabled due to security reasons.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraInput_OpenConcurrentCameras()

Camera_ErrorCode OH_CameraInput_OpenConcurrentCameras(Camera_Input* cameraInput, Camera_ConcurrentType type)

Description

Opens the camera based on the specified concurrency type.

Since: 18

Parameters

NameDescription
Camera_Input* cameraInputPointer to the target Camera_Input instance.
Camera_ConcurrentType typeConcurrency type.

Returns

TypeDescription
Camera_ErrorCodeCAMERA_OK: The operation is successful.
CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect.
CAMERA_CONFLICT_CAMERA: The camera cannot be used due to a conflict.
CAMERA_DEVICE_DISABLED: The camera is disabled due to security reasons.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraInput_Close()

Camera_ErrorCode OH_CameraInput_Close(Camera_Input* cameraInput)

Description

Closes a camera.

Since: 11

Parameters

NameDescription
Camera_Input* cameraInputPointer to the target Camera_Input 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_CameraInput_Release()

Camera_ErrorCode OH_CameraInput_Release(Camera_Input* cameraInput)

Description

Releases a Camera_Input instance.
Either this function or OH_CameraInput_Close needs to be called.

Since: 11

Parameters

NameDescription
Camera_Input* cameraInputPointer to the target Camera_Input 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_CameraInput_IsPhysicalCameraOrientationVariable()

Camera_ErrorCode OH_CameraInput_IsPhysicalCameraOrientationVariable(Camera_Input* cameraInput, bool* isVariable)

Description

Checks whether the physical camera orientation is adjustable in different fold states of the device.

Since: 22

Parameters

NameDescription
Camera_Input* cameraInputPointer to the target Camera_Input instance.
bool* isVariableChecks whether the physical camera orientation is adjustable in different fold states of the device. true if adjustable, 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_CameraInput_GetPhysicalCameraOrientation()

Camera_ErrorCode OH_CameraInput_GetPhysicalCameraOrientation(Camera_Input* cameraInput, uint32_t* orientation)

Description

Obtains the physical camera orientation in the current fold state of the device.

Since: 22

Parameters

NameDescription
Camera_Input* cameraInputPointer to the target Camera_Input instance.
uint32_t* orientationPointer to the physical camera orientation if the operation is successful.

Returns

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

OH_CameraInput_UsePhysicalCameraOrientation()

Camera_ErrorCode OH_CameraInput_UsePhysicalCameraOrientation(Camera_Input* cameraInput, bool isUsed)

Description

Enables or disables the use of the physical camera orientation.

Since: 22

Parameters

NameDescription
Camera_Input* cameraInputPointer to the target Camera_Input instance.
bool isUsedEnables or disables the use of the physical camera orientation. true to enable, 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_OPERATION_NOT_ALLOWED: The operation is not allowed.
CAMERA_SERVICE_FATAL_ERROR: The camera service is abnormal.

OH_CameraInput_OnOcclusionDetectionCallback()

typedef void (*OH_CameraInput_OnOcclusionDetectionCallback)(const Camera_Input* cameraInput, Camera_OcclusionDetectionResult occlusionDetectionResult)

Description

Defines a callback used to return the check result for whether a camera lens is blocked or dirty.

Since: 23

Parameters

NameDescription
const Camera_Input* cameraInputPointer to the target Camera_Input instance.
Camera_OcclusionDetectionResult occlusionDetectionResultCheck result for whether a camera lens is blocked or dirty.

OH_CameraInput_RegisterOcclusionDetectionCallback()

Camera_ErrorCode OH_CameraInput_RegisterOcclusionDetectionCallback(Camera_Input* cameraInput, OH_CameraInput_OnOcclusionDetectionCallback occlusionDetectionCallback)

Description

Registers a callback used to check whether a camera lens is blocked or dirty.

Since: 23

Parameters

NameDescription
Camera_Input* cameraInputPointer to the target Camera_Input instance.
OH_CameraInput_OnOcclusionDetectionCallback occlusionDetectionCallbackCallback used to check whether a camera lens is blocked or dirty.

Returns

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

OH_CameraInput_UnregisterOcclusionDetectionCallback()

Camera_ErrorCode OH_CameraInput_UnregisterOcclusionDetectionCallback(Camera_Input* cameraInput, OH_CameraInput_OnOcclusionDetectionCallback occlusionDetectionCallback)

Description

Unregisters the callback used to check whether a camera lens is blocked or dirty.

Since: 23

Parameters

NameDescription
Camera_Input* cameraInputPointer to the target Camera_Input instance.
OH_CameraInput_OnOcclusionDetectionCallback occlusionDetectionCallbackCallback used to check whether a camera lens is blocked or dirty.

Returns

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

你可能感兴趣的鸿蒙文章

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/Ow0INAYZ