From bf9d13417c2d3c1f3471333b06487043fe9783cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=80=E9=B8=A3?= Date: Wed, 4 Jun 2025 16:19:48 +0800 Subject: [PATCH 1/7] add UserSelection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李一鸣 --- .../native_avscreen_capture.h | 41 +++++++++++++++++++ .../native_avscreen_capture_base.h | 22 +++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/multimedia/player_framework/native_avscreen_capture.h b/multimedia/player_framework/native_avscreen_capture.h index 5bf1e8487..e7833c49b 100644 --- a/multimedia/player_framework/native_avscreen_capture.h +++ b/multimedia/player_framework/native_avscreen_capture.h @@ -540,6 +540,47 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCaptureContentChangedCallback( */ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCaptureArea(struct OH_AVScreenCapture *capture, uint64_t displayId, OH_Rect* area); +/** + * @brief Register user selection notification callback function + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param {OH_AVScreenCapture*} capture Pointer to OH_AVScreenCapture which want to handle user selection info + * @param {OH_AVScreenCapture_OnUserSelected} callback user selection callback function, see + * {@link OH_AVScreenCapture_OnUserSelected} + * @param {void*} userData The control block pointer passed by the application is carried to the application when it + * is returned + * @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. + * @since 20 + */ + OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetSelectionCallback(struct OH_AVScreenCapture *capture, + OH_AVScreenCapture_OnUserSelected callback, void *userData); + +/** + * @brief Get the recording content type selected by the user in the confirmation interface + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param {OH_AVScreenCapture_UserSelectionInfo*} selection Pointer to an OH_AVScreenCapture_UserSelectionInfo instance + * @param {int32_t*} type The capture object type selected by the user, 0: represents the screen, 1: represents the + * window. + * @return Function result code. + * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} if selections is nullptr. + * @since 20 + */ +OH_AVErrCode OH_AVScreenCapture_GetCaptureTypeSelected(OH_AVScreenCapture_UserSelectionInfo *selection, int32_t* type); + +/** + * @brief Get the Display ID of user selections in the confirmation interface + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param {OH_AVScreenCapture_UserSelectionInfo*} selection Pointer to an OH_AVScreenCapture_UserSelectionInfo instance + * @param {uint64_t*} displayId Returns the screen ID value selected by the user + * @return Function result code. + * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} if selections is nullptr. + * @since 20 + */ +OH_AVErrCode OH_AVScreenCapture_GetDisplayIdSelected(OH_AVScreenCapture_UserSelectionInfo *selection, + uint64_t* displayId); #ifdef __cplusplus } #endif diff --git a/multimedia/player_framework/native_avscreen_capture_base.h b/multimedia/player_framework/native_avscreen_capture_base.h index 7b00c4201..918cf9b28 100644 --- a/multimedia/player_framework/native_avscreen_capture_base.h +++ b/multimedia/player_framework/native_avscreen_capture_base.h @@ -568,7 +568,27 @@ typedef struct OH_AVScreenCapture_CaptureStrategy OH_AVScreenCapture_CaptureStra */ typedef void (*OH_AVScreenCapture_OnCaptureContentChanged)(OH_AVScreenCapture* capture, OH_AVScreenCaptureContentChangedEvent event, OH_Rect* area, void *userData); - +/** + * @brief Initialization of OH_AVScreenCapture_UserSelectionInfo + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 20 + */ +typedef struct OH_AVScreenCapture_UserSelectionInfo OH_AVScreenCapture_UserSelectionInfo; + +/** +* @brief When the user selects parameters in the authorization interface (selection interface), +* the function interface returns the parameters to the application. +* @syscap SystemCapability.Multimedia.Media.AVScreenCapture +* @param {OH_AVScreenCapture*} capture Pointer to an OH_AVScreenCapture instance +* @param {OH_AVScreenCapture_UserSelectionInfo*} selections The recording parameter information +* selected by the user on the authorization interface +* @param {void*} userData Pointer to user specific data +* +* @since 20 +*/ +typedef void (*OH_AVScreenCapture_OnUserSelected)(OH_AVScreenCapture* capture, + OH_AVScreenCapture_UserSelectionInfo* selections, void *userData); #ifdef __cplusplus } #endif -- Gitee From a0760132e100956451492c5ee0a967dd884df9a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=80=E9=B8=A3?= Date: Wed, 4 Jun 2025 16:31:56 +0800 Subject: [PATCH 2/7] add json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李一鸣 --- .../libnative_avscreen_capture.ndk.json | 12 ++++++++++++ 1 file changed, 12 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 48aa9a0d4..410f3d3a1 100644 --- a/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json +++ b/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json @@ -131,8 +131,20 @@ "first_introduced": "20", "name": "OH_AVScreenCapture_SetCaptureContentChangedCallback" }, + { + "first_introduced": "20", + "name": "OH_AVScreenCapture_SetSelectionCallback" + }, { "first_introduced": "20", "name": "OH_AVScreenCapture_SetCaptureArea" + }, + { + "first_introduced": "20", + "name": "OH_AVScreenCapture_GetCaptureTypeSelected" + }, + { + "first_introduced": "20", + "name": "OH_AVScreenCapture_GetDisplayIdSelected" } ] \ No newline at end of file -- Gitee From 0670a4cea30318c5c0c70a381b64caca6a34dac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=80=E9=B8=A3?= Date: Wed, 4 Jun 2025 16:32:42 +0800 Subject: [PATCH 3/7] fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李一鸣 --- .../avscreen_capture/libnative_avscreen_capture.ndk.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 410f3d3a1..d910cc1e3 100644 --- a/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json +++ b/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json @@ -133,11 +133,11 @@ }, { "first_introduced": "20", - "name": "OH_AVScreenCapture_SetSelectionCallback" + "name": "OH_AVScreenCapture_SetCaptureArea" }, { "first_introduced": "20", - "name": "OH_AVScreenCapture_SetCaptureArea" + "name": "OH_AVScreenCapture_SetSelectionCallback" }, { "first_introduced": "20", -- Gitee From 3083638ae39a7f07826c180a29db401fa1cb9ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=80=E9=B8=A3?= Date: Wed, 4 Jun 2025 16:33:28 +0800 Subject: [PATCH 4/7] fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李一鸣 --- multimedia/player_framework/native_avscreen_capture_base.h | 1 + 1 file changed, 1 insertion(+) diff --git a/multimedia/player_framework/native_avscreen_capture_base.h b/multimedia/player_framework/native_avscreen_capture_base.h index 918cf9b28..966a09b4e 100644 --- a/multimedia/player_framework/native_avscreen_capture_base.h +++ b/multimedia/player_framework/native_avscreen_capture_base.h @@ -568,6 +568,7 @@ typedef struct OH_AVScreenCapture_CaptureStrategy OH_AVScreenCapture_CaptureStra */ typedef void (*OH_AVScreenCapture_OnCaptureContentChanged)(OH_AVScreenCapture* capture, OH_AVScreenCaptureContentChangedEvent event, OH_Rect* area, void *userData); + /** * @brief Initialization of OH_AVScreenCapture_UserSelectionInfo * @syscap SystemCapability.Multimedia.Media.AVScreenCapture -- Gitee From fd56fb6bf11f3b4d66b3c80b717974b91cd5edb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=80=E9=B8=A3?= Date: Wed, 4 Jun 2025 16:33:57 +0800 Subject: [PATCH 5/7] fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李一鸣 --- multimedia/player_framework/native_avscreen_capture.h | 1 + 1 file changed, 1 insertion(+) diff --git a/multimedia/player_framework/native_avscreen_capture.h b/multimedia/player_framework/native_avscreen_capture.h index e7833c49b..d4bd2e5f7 100644 --- a/multimedia/player_framework/native_avscreen_capture.h +++ b/multimedia/player_framework/native_avscreen_capture.h @@ -540,6 +540,7 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCaptureContentChangedCallback( */ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCaptureArea(struct OH_AVScreenCapture *capture, uint64_t displayId, OH_Rect* area); + /** * @brief Register user selection notification callback function * @syscap SystemCapability.Multimedia.Media.AVScreenCapture -- Gitee From 5c4389b814be03cbbb865c143b3743948fc0dacb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=80=E9=B8=A3?= Date: Thu, 5 Jun 2025 14:55:13 +0800 Subject: [PATCH 6/7] change return MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李一鸣 --- multimedia/player_framework/native_avscreen_capture.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/multimedia/player_framework/native_avscreen_capture.h b/multimedia/player_framework/native_avscreen_capture.h index d4bd2e5f7..6c961789c 100644 --- a/multimedia/player_framework/native_avscreen_capture.h +++ b/multimedia/player_framework/native_avscreen_capture.h @@ -554,7 +554,7 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCaptureArea(struct OH_AVScreen * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} input capture is nullptr. * @since 20 */ - OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetSelectionCallback(struct OH_AVScreenCapture *capture, +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetSelectionCallback(struct OH_AVScreenCapture *capture, OH_AVScreenCapture_OnUserSelected callback, void *userData); /** @@ -568,7 +568,8 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCaptureArea(struct OH_AVScreen * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} if selections is nullptr. * @since 20 */ -OH_AVErrCode OH_AVScreenCapture_GetCaptureTypeSelected(OH_AVScreenCapture_UserSelectionInfo *selection, int32_t* type); +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_GetCaptureTypeSelected(OH_AVScreenCapture_UserSelectionInfo *selection, + int32_t* type); /** * @brief Get the Display ID of user selections in the confirmation interface @@ -580,7 +581,7 @@ OH_AVErrCode OH_AVScreenCapture_GetCaptureTypeSelected(OH_AVScreenCapture_UserSe * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} if selections is nullptr. * @since 20 */ -OH_AVErrCode OH_AVScreenCapture_GetDisplayIdSelected(OH_AVScreenCapture_UserSelectionInfo *selection, +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_GetDisplayIdSelected(OH_AVScreenCapture_UserSelectionInfo *selection, uint64_t* displayId); #ifdef __cplusplus } -- Gitee From 02cc1f57b38154d95989c952d1034ab4ef9d3272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=80=E9=B8=A3?= Date: Fri, 6 Jun 2025 12:09:28 +0000 Subject: [PATCH 7/7] update multimedia/player_framework/native_avscreen_capture.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李一鸣 --- multimedia/player_framework/native_avscreen_capture.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multimedia/player_framework/native_avscreen_capture.h b/multimedia/player_framework/native_avscreen_capture.h index d3a3839df..091e3ccf8 100644 --- a/multimedia/player_framework/native_avscreen_capture.h +++ b/multimedia/player_framework/native_avscreen_capture.h @@ -547,8 +547,8 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCaptureArea(struct OH_AVScreen * @param {OH_AVScreenCapture_CaptureStrategy*} strategy Pointer to an OH_AVScreenCapture_CaptureStrategy instance * @param {int32_t} value * If set to 0, it means that when there is a privacy window interface, the output screen image is completely black. - * If set to 1, it means that when there is a privacy window interface, only the privacy window area of the output screen becomes black, - * and other values returns an error. + * If set to 1, it means that when there is a privacy window interface, only the privacy window area of the output + * screen becomes black, and other values returns an error. * @return Function result code. * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} strategy is nullptr or value is invalid. -- Gitee