From 231002f3c98f4480b615bc4f58b52f2c5a04f2ba Mon Sep 17 00:00:00 2001 From: Trouvaille Date: Fri, 16 May 2025 17:09:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=95=E5=B1=8F=E6=96=B0=E5=A2=9E=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E8=AE=A2=E9=98=85=E7=AA=97=E5=8F=A3=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E9=80=9A=E7=9F=A5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Trouvaille --- .../libnative_avscreen_capture.ndk.json | 4 +++ .../native_avscreen_capture.h | 16 ++++++++++ .../native_avscreen_capture_base.h | 29 +++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json b/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json index e99fd6d40..0c790e079 100644 --- a/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json +++ b/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json @@ -126,5 +126,9 @@ { "first_introduced": "20", "name": "OH_AVScreenCapture_StrategyForKeepCaptureDuringCall" + }, + { + "first_introduced": "20", + "name": "OH_AVScreenCapture_SetCaptureContentChangedCallback" } ] \ No newline at end of file diff --git a/multimedia/player_framework/native_avscreen_capture.h b/multimedia/player_framework/native_avscreen_capture.h index 4636665d3..f63d40b26 100644 --- a/multimedia/player_framework/native_avscreen_capture.h +++ b/multimedia/player_framework/native_avscreen_capture.h @@ -510,6 +510,22 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCaptureStrategy( */ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StrategyForKeepCaptureDuringCall( OH_AVScreenCapture_CaptureStrategy *strategy, bool value); + +/** + * @brief Set the Capture Content Changed callback function so that your application can + * customize event handler generated by the av screen capture. This interface must be called before Start is called. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture Pointer to an OH_AVScreenCapture instance + * @param callback contentchanged callback function, see {@link OH_AVScreenCapture_OnCaptureContentChanged} + * @param userData Pointer to user specific data + * @return Function result code. + * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} input capture is nullptr or input callback is nullptr. + * {@link AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT} opertation not be permitted, set ErrorCallback failed. + * @since 20 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCaptureContentChangedCallback(struct OH_AVScreenCapture *capture, + OH_AVScreenCapture_OnCaptureContentChanged callback, void *userData); #ifdef __cplusplus } #endif diff --git a/multimedia/player_framework/native_avscreen_capture_base.h b/multimedia/player_framework/native_avscreen_capture_base.h index 6c97667f1..52412d56a 100644 --- a/multimedia/player_framework/native_avscreen_capture_base.h +++ b/multimedia/player_framework/native_avscreen_capture_base.h @@ -481,6 +481,21 @@ typedef enum OH_AVScreenCaptureFilterableAudioContent { OH_SCREEN_CAPTURE_CURRENT_APP_AUDIO = 1, } OH_AVScreenCaptureFilterableAudioContent; +/** + * @brief Enumerates screen capture content state. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 20 + */ +typedef enum OH_AVScreenCaptureContentChangedEvent { + /* Content is hiden */ + OH_SCREEN_CAPTURE_CONTENT_HIDE = 0, + /* Content is visible */ + OH_SCREEN_CAPTURE_CONTENT_VISIBLE = 1, + /* ScreenCapture stopped by user */ + OH_SCREEN_CAPTURE_CONTENT_UNAVAILABLE = 2, +} OH_AVScreenCaptureContentChangedEvent; + /** * @brief When state of OH_AVScreenCapture is changed, the function pointer will be called. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture @@ -540,6 +555,20 @@ typedef void (*OH_AVScreenCapture_OnDisplaySelected)(OH_AVScreenCapture *capture */ typedef struct OH_AVScreenCapture_CaptureStrategy OH_AVScreenCapture_CaptureStrategy; +/** + * @brief When Capture Content info changes, the function will be called to notify user + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param {OH_AVScreenCapture*} capture Pointer to an OH_AVScreenCapture instance + * @param {OH_AVScreenCaptureContentChangedEvent} event enum for content change event + * @param {OH_Rect*} area capture content rect position + * @param { void*} userData Pointer to user specific data + * + * @since 20 + * @version 1.0 + */ +typedef void (*OH_AVScreenCapture_OnCaptureContentChanged)(OH_AVScreenCapture* capture, + OH_AVScreenCaptureContentChangedEvent event, OH_Rect* area, void *userData); + #ifdef __cplusplus } #endif -- Gitee