From 756f9ac0c8bfd72ec95f6a8db53049ea04397d19 Mon Sep 17 00:00:00 2001 From: hanKF Date: Mon, 27 Jan 2025 16:38:44 +0800 Subject: [PATCH 1/3] add display callback Signed-off-by: hanKF --- .../player_framework/native_avscreen_capture.h | 17 +++++++++++++++++ .../native_avscreen_capture_base.h | 11 +++++++++++ 2 files changed, 28 insertions(+) diff --git a/multimedia/player_framework/native_avscreen_capture.h b/multimedia/player_framework/native_avscreen_capture.h index c508cae4f..3ce096137 100644 --- a/multimedia/player_framework/native_avscreen_capture.h +++ b/multimedia/player_framework/native_avscreen_capture.h @@ -446,6 +446,23 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetMaxVideoFrameRate(struct OH_AV */ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ShowCursor(struct OH_AVScreenCapture *capture, bool showCursor); + +/** + * @brief Set the display selection callback function so that your application can respond to the + * display device selected events generated by the av screen capture. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture Pointer to an OH_AVScreenCapture instance + * @param callback State callback function, see {@link OH_AVScreenCapture_OnDisplaySelected} + * @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_NO_MEMORY} no memory, mem allocate failed. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_STATE} This interface should be called before Start is called. + * @since 15 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetDisplayCallback(struct OH_AVScreenCapture *capture, + OH_AVScreenCapture_OnDisplaySelected 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 deed04f4c..46296bf53 100644 --- a/multimedia/player_framework/native_avscreen_capture_base.h +++ b/multimedia/player_framework/native_avscreen_capture_base.h @@ -521,6 +521,17 @@ typedef void (*OH_AVScreenCapture_OnError)(OH_AVScreenCapture *capture, int32_t typedef void (*OH_AVScreenCapture_OnBufferAvailable)(OH_AVScreenCapture *capture, OH_AVBuffer *buffer, OH_AVScreenCaptureBufferType bufferType, int64_t timestamp, void *userData); +/** + * @brief When one of the display devices start being captured, the function pointer will be called + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture Pointer to an OH_AVScreenCapture instance + * @param displayId Id of the display device that being captured + * @param userData Pointer to user specific data + * + * @since 15 + */ +typedef void (*OH_AVScreenCapture_OnDisplaySelected)(OH_AVScreenCapture *capture, uint64_t displayId, void *userData); + #ifdef __cplusplus } #endif -- Gitee From 85d55e6d152c25d7a4323da33e66da9945681e7d Mon Sep 17 00:00:00 2001 From: hanKF Date: Thu, 6 Feb 2025 19:53:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hanKF --- multimedia/player_framework/native_avscreen_capture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multimedia/player_framework/native_avscreen_capture.h b/multimedia/player_framework/native_avscreen_capture.h index 3ce096137..7a9396d26 100644 --- a/multimedia/player_framework/native_avscreen_capture.h +++ b/multimedia/player_framework/native_avscreen_capture.h @@ -452,7 +452,7 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ShowCursor(struct OH_AVScreenCapt * display device selected events generated by the av screen capture. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture * @param capture Pointer to an OH_AVScreenCapture instance - * @param callback State callback function, see {@link OH_AVScreenCapture_OnDisplaySelected} + * @param callback display device selection callback function, see {@link OH_AVScreenCapture_OnDisplaySelected} * @param userData Pointer to user specific data * @return Function result code. * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. -- Gitee From c338d8a94c2c9e815f1600b0b714a6f711ac8da2 Mon Sep 17 00:00:00 2001 From: hanKF Date: Thu, 6 Feb 2025 20:22:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hanKF --- multimedia/player_framework/native_avscreen_capture_base.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multimedia/player_framework/native_avscreen_capture_base.h b/multimedia/player_framework/native_avscreen_capture_base.h index 46296bf53..85b1280d1 100644 --- a/multimedia/player_framework/native_avscreen_capture_base.h +++ b/multimedia/player_framework/native_avscreen_capture_base.h @@ -527,7 +527,7 @@ typedef void (*OH_AVScreenCapture_OnBufferAvailable)(OH_AVScreenCapture *capture * @param capture Pointer to an OH_AVScreenCapture instance * @param displayId Id of the display device that being captured * @param userData Pointer to user specific data - * + * * @since 15 */ typedef void (*OH_AVScreenCapture_OnDisplaySelected)(OH_AVScreenCapture *capture, uint64_t displayId, void *userData); -- Gitee