From 0de12dd0b0e17f5481acf935645a87d9ae15e038 Mon Sep 17 00:00:00 2001 From: wangruikang Date: Fri, 18 Jul 2025 21:07:20 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=8E=8B=E5=8A=9B=E7=AE=A1=E6=8E=A7NDK?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangruikang --- multimedia/camera_framework/camera.h | 34 +++++++++++++++++++ multimedia/camera_framework/camera.ndk.json | 8 +++++ multimedia/camera_framework/capture_session.h | 33 ++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/multimedia/camera_framework/camera.h b/multimedia/camera_framework/camera.h index ea423122440..2390edbe142 100644 --- a/multimedia/camera_framework/camera.h +++ b/multimedia/camera_framework/camera.h @@ -1195,6 +1195,40 @@ typedef enum Camera_WhiteBalanceMode { CAMERA_WHITE_BALANCE_MODE_LOCKED = 6 } Camera_WhiteBalanceMode; +/** + * @brief Enumerates the system pressure levels of the current camera session. When the system pressure + * increases, you are advised to reduce the load of the current camera session. + * + * @since 20 + * @version 1.0 + */ +typedef enum Camera_SystemPressureLevel { + /** + * Normal level. This level indicates the system pressure is normal. + */ + SYSTEM_PRESSURE_NORMAL = 0, + + /** + * Mild level. This level indicates the system pressure is slightly elevated. + */ + SYSTEM_PRESSURE_MILD = 1, + + /** + * Severe level. This level indicates the system pressure is severely elevated. + */ + SYSTEM_PRESSURE_SEVERE = 2, + + /** + * Critical level. This level indicates the system pressure is critically elevated. + */ + SYSTEM_PRESSURE_CRITICAL = 3, + + /** + * Shutdown level. This level indicates the system pressure is fatal, so the camera session will be shut down soon. + */ + SYSTEM_PRESSURE_SHUTDOWN = 4 +} Camera_SystemPressureLevel + #ifdef __cplusplus } #endif diff --git a/multimedia/camera_framework/camera.ndk.json b/multimedia/camera_framework/camera.ndk.json index 5bb71a86e19..16b5ef3eca0 100644 --- a/multimedia/camera_framework/camera.ndk.json +++ b/multimedia/camera_framework/camera.ndk.json @@ -694,5 +694,13 @@ { "first_introduced": "20", "name": "OH_CaptureSession_SetWhiteBalanceMode" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_RegisterSystemPressureLevelChangeCallback" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_UnregisterSystemPressureLevelChangeCallback" } ] diff --git a/multimedia/camera_framework/capture_session.h b/multimedia/camera_framework/capture_session.h index 6448626cf26..d2bd8352d7b 100644 --- a/multimedia/camera_framework/capture_session.h +++ b/multimedia/camera_framework/capture_session.h @@ -103,6 +103,15 @@ typedef void (*OH_CaptureSession_OnSmoothZoomInfo)(Camera_CaptureSession* sessio */ typedef void (*OH_CaptureSession_OnAutoDeviceSwitchStatusChange)(Camera_CaptureSession* session, Camera_AutoDeviceSwitchStatusInfo* autoDeviceSwitchStatusInfo); +/** + * @brief Capture session system pressure level callback. + * + * @param session the {@link Camera_CaptureSession} which deliver the callback. + * @param systemPressureLevel the {@link Camera_SystemPressureLevel} which delivered by the callback. + * @since 20 + */ +typedef void (*OH_CaptureSession_OnSystemPressureLevelChange)(Camera_CaptureSession* session, + Camera_SystemPressureLevel* systemPressureLevel); /** * @brief A listener for capture session. @@ -1040,6 +1049,30 @@ Camera_ErrorCode OH_CaptureSession_SetWhiteBalance(Camera_CaptureSession *sessio Camera_ErrorCode OH_CaptureSession_SetWhiteBalanceMode( Camera_CaptureSession *session, Camera_WhiteBalanceMode whiteBalanceMode); +/** + * @brief Subscribes to system pressure level changes. + * + * @param session Pointer to a CaptureSession instance. + * @param systemPressureLevelChange Callback used for subscription. + * @return Execution result of the function. CAMERA_OK is returned if the execution is successful; + * CAMERA_INVALID_ARGUMENT is returned if a parameter is missing or incorrect. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_RegisterSystemPressureLevelChangeCallback(Camera_CaptureSession* session, + OH_CaptureSession_OnSystemPressureLevelChange systemPressureLevelChange); + +/** + * @brief Unsubscribes from system pressure level changes. + * + * @param session Pointer to a CaptureSession instance. + * @param systemPressureLevelChange Callback used for unsubscription. + * @return Execution result of the function. CAMERA_OK is returned if the execution is successful; + * CAMERA_INVALID_ARGUMENT is returned if a parameter is missing or incorrect. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_UnregisterSystemPressureLevelChangeCallback(Camera_CaptureSession* session, + OH_CaptureSession_OnSystemPressureLevelChange systemPressureLevelChange); + #ifdef __cplusplus } #endif -- Gitee From 9d7a1a920118cb0921bd49edfd18b81f7805a840 Mon Sep 17 00:00:00 2001 From: wangruikang Date: Sat, 19 Jul 2025 14:29:02 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8E=8B=E5=8A=9B=E7=AE=A1=E6=8E=A7NDK?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangruikang --- multimedia/camera_framework/camera.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multimedia/camera_framework/camera.h b/multimedia/camera_framework/camera.h index 2390edbe142..f415dacc218 100644 --- a/multimedia/camera_framework/camera.h +++ b/multimedia/camera_framework/camera.h @@ -1227,7 +1227,7 @@ typedef enum Camera_SystemPressureLevel { * Shutdown level. This level indicates the system pressure is fatal, so the camera session will be shut down soon. */ SYSTEM_PRESSURE_SHUTDOWN = 4 -} Camera_SystemPressureLevel +} Camera_SystemPressureLevel; #ifdef __cplusplus } -- Gitee From a96b38092430a9db6fd8cf53a724c703d17222f4 Mon Sep 17 00:00:00 2001 From: wangruikang Date: Sat, 19 Jul 2025 16:01:07 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=8E=8B=E5=8A=9B=E7=AE=A1=E6=8E=A7NDK?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangruikang --- multimedia/camera_framework/capture_session.h | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/multimedia/camera_framework/capture_session.h b/multimedia/camera_framework/capture_session.h index d2bd8352d7b..7e711ce63db 100644 --- a/multimedia/camera_framework/capture_session.h +++ b/multimedia/camera_framework/capture_session.h @@ -1050,24 +1050,26 @@ Camera_ErrorCode OH_CaptureSession_SetWhiteBalanceMode( Camera_CaptureSession *session, Camera_WhiteBalanceMode whiteBalanceMode); /** - * @brief Subscribes to system pressure level changes. + * @brief Register system pressure level changes callback. * - * @param session Pointer to a CaptureSession instance. - * @param systemPressureLevelChange Callback used for subscription. - * @return Execution result of the function. CAMERA_OK is returned if the execution is successful; - * CAMERA_INVALID_ARGUMENT is returned if a parameter is missing or incorrect. + * @param session Pointer to a {@link Camera_CaptureSession} instance. + * @param systemPressureLevelChange the {@link OH_CaptureSession_OnSystemPressureLevelChange} to be registered. + * @return Result code. + * {@link #CAMERA_OK} is returned if the function is called successfully. + * {@link #CAMERA_INVALID_ARGUMENT} is returned if an input parameter is missing or the parameter type is incorrect. * @since 20 */ Camera_ErrorCode OH_CaptureSession_RegisterSystemPressureLevelChangeCallback(Camera_CaptureSession* session, OH_CaptureSession_OnSystemPressureLevelChange systemPressureLevelChange); /** - * @brief Unsubscribes from system pressure level changes. + * @brief Unregister system pressure level changes callback. * - * @param session Pointer to a CaptureSession instance. - * @param systemPressureLevelChange Callback used for unsubscription. - * @return Execution result of the function. CAMERA_OK is returned if the execution is successful; - * CAMERA_INVALID_ARGUMENT is returned if a parameter is missing or incorrect. + * @param session Pointer to a {@link Camera_CaptureSession} instance. + * @param systemPressureLevelChange the {@link OH_CaptureSession_OnSystemPressureLevelChange} to be unregistered. + * @return Result code. + * {@link #CAMERA_OK} is returned if the function is called successfully. + * {@link #CAMERA_INVALID_ARGUMENT} is returned if an input parameter is missing or the parameter type is incorrect. * @since 20 */ Camera_ErrorCode OH_CaptureSession_UnregisterSystemPressureLevelChangeCallback(Camera_CaptureSession* session, -- Gitee