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
| Name | typedef Keyword | Description |
|---|---|---|
| CameraInput_Callbacks | CameraInput_Callbacks | Describes the callbacks used to listen for camera input errors. |
| Camera_Input | Camera_Input | Describes the camera input object. You can use OH_CameraManager_CreateCameraInput to create such an object. |
Functions
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
| Name | Description |
|---|---|
| const Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
| Camera_ErrorCode errorCode | Error code reported during camera input and defined in the Camera_ErrorCode struct. |
See also
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
| Name | Description |
|---|---|
| Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
| CameraInput_Callbacks* callback | Pointer to the target callback. |
Returns
| Type | Description |
|---|---|
| Camera_ErrorCode | CAMERA_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
| Name | Description |
|---|---|
| Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
| CameraInput_Callbacks* callback | Pointer to the target callback. |
Returns
| Type | Description |
|---|---|
| Camera_ErrorCode | CAMERA_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
| Name | Description |
|---|---|
| Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
Returns
| Type | Description |
|---|---|
| Camera_ErrorCode | CAMERA_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
| Name | Description |
|---|---|
| Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
| uint64_t* secureSeqId | Pointer to the sequence ID of the camera. |
Returns
| Type | Description |
|---|---|
| Camera_ErrorCode | CAMERA_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
| Name | Description |
|---|---|
| Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
| Camera_ConcurrentType type | Concurrency type. |
Returns
| Type | Description |
|---|---|
| Camera_ErrorCode | CAMERA_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
| Name | Description |
|---|---|
| Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
Returns
| Type | Description |
|---|---|
| Camera_ErrorCode | CAMERA_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
| Name | Description |
|---|---|
| Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
Returns
| Type | Description |
|---|---|
| Camera_ErrorCode | CAMERA_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
| Name | Description |
|---|---|
| Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
| bool* isVariable | Checks whether the physical camera orientation is adjustable in different fold states of the device. true if adjustable, false otherwise. |
Returns
| Type | Description |
|---|---|
| Camera_ErrorCode | CAMERA_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
| Name | Description |
|---|---|
| Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
| uint32_t* orientation | Pointer to the physical camera orientation if the operation is successful. |
Returns
| Type | Description |
|---|---|
| Camera_ErrorCode | CAMERA_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
| Name | Description |
|---|---|
| Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
| bool isUsed | Enables or disables the use of the physical camera orientation. true to enable, false otherwise. |
Returns
| Type | Description |
|---|---|
| Camera_ErrorCode | CAMERA_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
| Name | Description |
|---|---|
| const Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
| Camera_OcclusionDetectionResult occlusionDetectionResult | Check 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
| Name | Description |
|---|---|
| Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
| OH_CameraInput_OnOcclusionDetectionCallback occlusionDetectionCallback | Callback used to check whether a camera lens is blocked or dirty. |
Returns
| Type | Description |
|---|---|
| Camera_ErrorCode | CAMERA_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
| Name | Description |
|---|---|
| Camera_Input* cameraInput | Pointer to the target Camera_Input instance. |
| OH_CameraInput_OnOcclusionDetectionCallback occlusionDetectionCallback | Callback used to check whether a camera lens is blocked or dirty. |
Returns
| Type | Description |
|---|---|
| Camera_ErrorCode | CAMERA_OK: The operation is successful. CAMERA_INVALID_ARGUMENT: A parameter is missing or the parameter type is incorrect. |