From 5c2f3d8ddc5d36b8771a053d1fbeaf914feff8af Mon Sep 17 00:00:00 2001 From: hanKF Date: Mon, 27 Jan 2025 16:38:44 +0800 Subject: [PATCH] add display callback --- .../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