From d3e5b0b580a478a95d37013e72968b29d3600825 Mon Sep 17 00:00:00 2001 From: wangruikang Date: Tue, 15 Jul 2025 21:41:32 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=9B=B8=E6=9C=BA=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=99=A8NDK=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 | 36 ++++++++ multimedia/camera_framework/camera.ndk.json | 24 +++++ multimedia/camera_framework/capture_session.h | 88 +++++++++++++++++++ 3 files changed, 148 insertions(+) diff --git a/multimedia/camera_framework/camera.h b/multimedia/camera_framework/camera.h index ea423122440..afab4d863c9 100644 --- a/multimedia/camera_framework/camera.h +++ b/multimedia/camera_framework/camera.h @@ -1195,6 +1195,42 @@ typedef enum Camera_WhiteBalanceMode { CAMERA_WHITE_BALANCE_MODE_LOCKED = 6 } Camera_WhiteBalanceMode; +/** + * @brief Enumerates the control center effect types. + * + * @since 20 + * @version 1.0 + */ +typedef enum Camera_ControlCenterEffectType { + /** + * Control center beauty effect type. + */ + CONTROL_CENTER_EFFECT_TYPE_BEAUTY = 0, + + /** + * Control center portrait effect type. + */ + CONTROL_CENTER_EFFECT_TYPE_PORTRAIT = 1 +} Camera_ControlCenterEffectType; + +/** + * @brief Control center status info. + * + * @since 20 + * @version 1.0 + */ +typedef struct Camera_ControlCenterStatusInfo { + /** + * Control center effect type. + */ + Camera_ControlCenterEffectType effectType; + + /** + * If control center effect is active. + */ + bool isActive; +} Camera_ControlCenterStatusInfo; + #ifdef __cplusplus } #endif diff --git a/multimedia/camera_framework/camera.ndk.json b/multimedia/camera_framework/camera.ndk.json index 5bb71a86e19..d17baabe694 100644 --- a/multimedia/camera_framework/camera.ndk.json +++ b/multimedia/camera_framework/camera.ndk.json @@ -694,5 +694,29 @@ { "first_introduced": "20", "name": "OH_CaptureSession_SetWhiteBalanceMode" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_IsControlCenterSupported" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_GetSupportedEffectTypes" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_DeleteSupportedEffectTypes" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_EnableControlCenter" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_RegisterControlCenterEffectStatusChangeCallback" + }, + { + "first_introduced": "20", + "name": "OH_CaptureSession_UnregisterControlCenterEffectStatusChangeCallback" } ] diff --git a/multimedia/camera_framework/capture_session.h b/multimedia/camera_framework/capture_session.h index 6448626cf26..07ae537e3d3 100644 --- a/multimedia/camera_framework/capture_session.h +++ b/multimedia/camera_framework/capture_session.h @@ -1040,6 +1040,94 @@ Camera_ErrorCode OH_CaptureSession_SetWhiteBalance(Camera_CaptureSession *sessio Camera_ErrorCode OH_CaptureSession_SetWhiteBalanceMode( Camera_CaptureSession *session, Camera_WhiteBalanceMode whiteBalanceMode); +/** + * @brief Checks whether the control center is supported. + * + * @param session Pointer to an {@link Camera_CaptureSession} instance. + * @param isSupported Pointer to the check result. The value true means that the control center is supported, and false means the opposite. + * @return {@link Camera_ErrorCode}: + * CAMERA_OK = 0: The function call is successful.\n + * CAMERA_INVALID_ARGUMENT = 7400101: A parameter is missing or the parameter type is incorrect.\n + * CAMERA_SESSION_NOT_CONFIG = 7400103: The capture session is not configured. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_IsControlCenterSupported(Camera_CaptureSession* session, bool* isSupported); + +/** + * @brief Get the supported effect types . + * + * @param session the {@link Camera_CaptureSession} instance. + * @param types the supported {@link Camera_ControlCenterEffectType} list to be filled if the method call succeeds. + * @param size the size of supported effect types queried. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_GetSupportedEffectTypes( + Camera_CaptureSession* session, Camera_ControlCenterEffectType** types, uint32_t* size); + +/** + * @brief Delete the effect types. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param types the target {@link Camera_ControlCenterEffectType} list to be deleted if the method call succeeds. + * @param size the size of supported effect types to be deleted. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_DeleteSupportedEffectTypes(Camera_CaptureSession* session, + Camera_ControlCenterEffectType* types, uint32_t size); + +/** + * @brief Enables or disables the control center. + * + * @param session Pointer to an {@link Camera_CaptureSession} instance. + * @param enabled Whether to enable the control center. The value true means to enable the control center, and false means to disable it. + * @return {@link Camera_ErrorCode}: + * CAMERA_OK = 0: The function call is successful.\n + * CAMERA_INVALID_ARGUMENT = 7400101: A parameter is missing or the parameter type is incorrect.\n + * CAMERA_SESSION_NOT_CONFIG = 7400103: The capture session is not configured.\n + * CAMERA_OPERATION_NOT_ALLOWED = 7400102: The operation is not allowed. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_EnableControlCenter(Camera_CaptureSession* session, bool enable); + +/** + * @brief Capture session control center effect status info callback. + * + * @param session the {@link Camera_CaptureSession} which deliver the callback. + * @param controlCenterStatusInfo the {@link Camera_ControlCenterStatusInfo} which delivered by the callback. + * @since 20 + */ +typedef void (*OH_CaptureSession_OnControlCenterEffectStatusChange)(Camera_CaptureSession* session, + Camera_ControlCenterStatusInfo* controlCenterStatusInfo); + +/** + * @brief Register control center effect status information event callback. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param controlCenterEffectStatusChange the {@link OH_CaptureSession_OnControlCenterEffectStatusChange} to be registered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_RegisterControlCenterEffectStatusChangeCallback(Camera_CaptureSession* session, + OH_CaptureSession_OnControlCenterEffectStatusChange controlCenterEffectStatusChange); + +/** + * @brief Unregister control center effect status information event callback. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param controlCenterEffectStatusChange the {@link OH_CaptureSession_OnControlCenterEffectStatusChange} to be unregistered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 20 + */ +Camera_ErrorCode OH_CaptureSession_UnregisterControlCenterEffectStatusChangeCallback(Camera_CaptureSession* session, + OH_CaptureSession_OnControlCenterEffectStatusChange controlCenterEffectStatusChange); + #ifdef __cplusplus } #endif -- Gitee From 38167712e012ed1f5975e81a9f12e5a5c90c11a3 Mon Sep 17 00:00:00 2001 From: plutowang Date: Fri, 18 Jul 2025 12:44:33 +0000 Subject: [PATCH 2/4] pressure-c Signed-off-by: plutowang --- pressure-c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 pressure-c diff --git a/pressure-c b/pressure-c new file mode 100644 index 00000000000..f06b728ffb5 --- /dev/null +++ b/pressure-c @@ -0,0 +1,116 @@ +diff --git a/multimedia/camera_framework/camera.h b/multimedia/camera_framework/camera.h +index ea42312..2390edb 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 5bb71a8..16b5ef3 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 6448626..08beb5f 100644 +--- a/multimedia/camera_framework/capture_session.h ++++ b/multimedia/camera_framework/capture_session.h +@@ -104,6 +104,16 @@ 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 +1050,31 @@ 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 c1fd5fc4ce4bc93533d460b8a45cd8ef2dda8ec8 Mon Sep 17 00:00:00 2001 From: plutowang Date: Fri, 18 Jul 2025 12:54:18 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20pres?= =?UTF-8?q?sure-c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pressure-c | 116 ----------------------------------------------------- 1 file changed, 116 deletions(-) delete mode 100644 pressure-c diff --git a/pressure-c b/pressure-c deleted file mode 100644 index f06b728ffb5..00000000000 --- a/pressure-c +++ /dev/null @@ -1,116 +0,0 @@ -diff --git a/multimedia/camera_framework/camera.h b/multimedia/camera_framework/camera.h -index ea42312..2390edb 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 5bb71a8..16b5ef3 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 6448626..08beb5f 100644 ---- a/multimedia/camera_framework/capture_session.h -+++ b/multimedia/camera_framework/capture_session.h -@@ -104,6 +104,16 @@ 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 +1050,31 @@ 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 04d6f19223c8fe8cc64bfe02862b14822a58fcfc Mon Sep 17 00:00:00 2001 From: wangruikang Date: Sat, 19 Jul 2025 15:11:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E7=9B=B8=E6=9C=BA=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=99=A8NDK=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 | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/multimedia/camera_framework/capture_session.h b/multimedia/camera_framework/capture_session.h index 07ae537e3d3..914a3039442 100644 --- a/multimedia/camera_framework/capture_session.h +++ b/multimedia/camera_framework/capture_session.h @@ -1043,12 +1043,12 @@ Camera_ErrorCode OH_CaptureSession_SetWhiteBalanceMode( /** * @brief Checks whether the control center is supported. * - * @param session Pointer to an {@link Camera_CaptureSession} instance. + * @param session Pointer to a {@link Camera_CaptureSession} instance. * @param isSupported Pointer to the check result. The value true means that the control center is supported, and false means the opposite. - * @return {@link Camera_ErrorCode}: - * CAMERA_OK = 0: The function call is successful.\n - * CAMERA_INVALID_ARGUMENT = 7400101: A parameter is missing or the parameter type is incorrect.\n - * CAMERA_SESSION_NOT_CONFIG = 7400103: The capture session is not configured. + * @return Result code. + * {@link #CAMERA_OK} is returned if the function is called successfully. + * {@link #CAMERA_INVALID_ARGUMENT} is returned if the input parameter is missing or the parameter type is incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} is returned if the camera session is not configured. * @since 20 */ Camera_ErrorCode OH_CaptureSession_IsControlCenterSupported(Camera_CaptureSession* session, bool* isSupported); @@ -1083,13 +1083,12 @@ Camera_ErrorCode OH_CaptureSession_DeleteSupportedEffectTypes(Camera_CaptureSess /** * @brief Enables or disables the control center. * - * @param session Pointer to an {@link Camera_CaptureSession} instance. + * @param session the {@link Camera_CaptureSession} instance. * @param enabled Whether to enable the control center. The value true means to enable the control center, and false means to disable it. - * @return {@link Camera_ErrorCode}: - * CAMERA_OK = 0: The function call is successful.\n - * CAMERA_INVALID_ARGUMENT = 7400101: A parameter is missing or the parameter type is incorrect.\n - * CAMERA_SESSION_NOT_CONFIG = 7400103: The capture session is not configured.\n - * CAMERA_OPERATION_NOT_ALLOWED = 7400102: The operation is not allowed. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 20 */ Camera_ErrorCode OH_CaptureSession_EnableControlCenter(Camera_CaptureSession* session, bool enable); -- Gitee