From 7fb1e27f2e8d4985d6bb4edc48b51d3e41c4f5d1 Mon Sep 17 00:00:00 2001 From: wuwenchao Date: Mon, 24 Feb 2025 17:31:35 +0800 Subject: [PATCH] cameras are enabled concurrently Signed-off-by: wuwenchao --- multimedia/camera_framework/camera.h | 51 ++++++++++++++++++++ multimedia/camera_framework/camera.ndk.json | 12 +++++ multimedia/camera_framework/camera_input.h | 14 ++++++ multimedia/camera_framework/camera_manager.h | 33 +++++++++++++ 4 files changed, 110 insertions(+) diff --git a/multimedia/camera_framework/camera.h b/multimedia/camera_framework/camera.h index eecc0d386b..c880b84390 100644 --- a/multimedia/camera_framework/camera.h +++ b/multimedia/camera_framework/camera.h @@ -1101,6 +1101,57 @@ typedef enum Camera_QualityPrioritization { POWER_BALANCE = 1 } Camera_QualityPrioritization; +/** + * @brief Enum for camera concurrent type. + * + * @since 16 + * @version 1.0 + */ +typedef enum Camera_ConcurrentType { + /** + * Cameras concurrency with limited capability. + */ + CAMERA_CONCURRENT_TYPE_LIMITED_CAPABILITY = 0, + + /** + * Cameras concurrenct with full capability. + */ + CAMERA_CONCURRENT_TYPE_FULL_CAPABILITY = 1 +} Camera_ConcurrentType; + +/** + * @brief Concurrency capability infos. + * + * @since 16 + * @version 1.0 + */ +typedef struct Camera_ConcurrentInfo { + /** + * Camera instance. + */ + Camera_Device camera; + + /** + * Supported concurrent type. + */ + Camera_ConcurrentType type; + + /** + * Supported Modes. + */ + Camera_SceneMode* sceneModes; + + /** + * Supported outputCapabilities + */ + Camera_OutputCapability* outputCapabilities; + + /** + * Supported outputCapabilities size. + */ + uint32_t modeAndCapabilitySize; +} Camera_ConcurrentInfo; + #ifdef __cplusplus } #endif diff --git a/multimedia/camera_framework/camera.ndk.json b/multimedia/camera_framework/camera.ndk.json index 8543be5773..eae79f139b 100644 --- a/multimedia/camera_framework/camera.ndk.json +++ b/multimedia/camera_framework/camera.ndk.json @@ -650,5 +650,17 @@ { "first_introduced": "14", "name": "OH_CaptureSession_SetQualityPrioritization" + }, + { + "first_introduced": "16", + "name": "OH_CameraInput_OpenConcurrentCameras" + }, + { + "first_introduced": "16", + "name": "OH_CameraManager_GetCameraDevice" + }, + { + "first_introduced": "16", + "name": "OH_CameraManager_GetCameraConcurrentInfos" } ] diff --git a/multimedia/camera_framework/camera_input.h b/multimedia/camera_framework/camera_input.h index 1438eda3e6..dd768f42be 100644 --- a/multimedia/camera_framework/camera_input.h +++ b/multimedia/camera_framework/camera_input.h @@ -135,6 +135,20 @@ Camera_ErrorCode OH_CameraInput_Open(Camera_Input* cameraInput); */ Camera_ErrorCode OH_CameraInput_OpenSecureCamera(Camera_Input* cameraInput, uint64_t* secureSeqId); +/** + * @brief Open camera with specified concurrent type. + * + * @param cameraInput the {@link Camera_Input} instance to be opened. + * @param type the {@link Camera_ConcurrentType} instance. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_CONFLICT_CAMERA} if can not use camera cause of conflict. + * {@link #CAMERA_DEVICE_DISABLED} if camera disabled cause of security reason. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 16 + */ +Camera_ErrorCode OH_CameraInput_OpenConcurrentCameras(Camera_Input* cameraInput, Camera_ConcurrentType type); + /** * @brief Close camera. * diff --git a/multimedia/camera_framework/camera_manager.h b/multimedia/camera_framework/camera_manager.h index 71a8f46166..42623cd98a 100644 --- a/multimedia/camera_framework/camera_manager.h +++ b/multimedia/camera_framework/camera_manager.h @@ -470,6 +470,39 @@ Camera_ErrorCode OH_CameraManager_IsTorchSupportedByTorchMode(Camera_Manager* ca Camera_ErrorCode OH_CameraManager_SetTorchMode(Camera_Manager* cameraManager, Camera_TorchMode torchMode); +/** + * @brief Queries a specified device based on position and type. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param position the {@link Camera_Position} instance. + * @param type the {@link Camera_Type} instance. + * @param camera the {@link Camera_Device} to be set. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 16 + */ +Camera_ErrorCode OH_CameraManager_GetCameraDevice(Camera_Manager* cameraManager, Camera_Position position, + Camera_Type type, Camera_Device* camera); + +/** + * @brief Obtains the concurrent information of specified cameras, the empty return means concurrency is not supported. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param camera the {@link Camera_Device} instance. + * @param deviceSize length of the input device array. + * @param cameraConcurrentInfo the {@link Camera_ConcurrentInfo} to be set. + * @param infoSize length of the returned concurrency information array. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 16 + */ +Camera_ErrorCode OH_CameraManager_GetCameraConcurrentInfos(Camera_Manager* cameraManager, const Camera_Device* camera, + uint32_t deviceSize, + Camera_ConcurrentInfo** cameraConcurrentInfo, + uint32_t* infoSize); + #ifdef __cplusplus } #endif -- Gitee