From 85d14185ac2cbcc92a17b9ff2a65a5e0434405fb Mon Sep 17 00:00:00 2001 From: rchdlee Date: Wed, 14 Aug 2024 20:44:24 +0800 Subject: [PATCH 01/11] add key OH_MD_KEY_VIDEO_DECODER_OUTPUT_COLOR_SPACE info in json field Signed-off-by: rchdlee --- .../av_codec/codec_base/libnative_media_codecbase.ndk.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json index 74292f25c..f988c383e 100644 --- a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json +++ b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json @@ -387,6 +387,10 @@ "first_introduced": "12", "name": "OH_MD_KEY_START_TIME" }, + { + "first_introduced": "12", + "name": "OH_MD_KEY_VIDEO_DECODER_OUTPUT_COLOR_SPACE" + }, { "first_introduced": "10", "name": "OH_AVCodec_GetCapability" -- Gitee From 2a2a5193841fc838f245ef00896171f556ed7b70 Mon Sep 17 00:00:00 2001 From: peng Date: Mon, 12 Aug 2024 08:04:14 +0000 Subject: [PATCH 02/11] del lbvc Signed-off-by: peng --- .../codec_base/libnative_media_codecbase.ndk.json | 4 ---- multimedia/av_codec/native_avcodec_base.h | 8 -------- 2 files changed, 12 deletions(-) diff --git a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json index f988c383e..91de38d1c 100644 --- a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json +++ b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json @@ -59,10 +59,6 @@ "first_introduced": "11", "name": "OH_AVCODEC_MIMETYPE_AUDIO_G711MU" }, - { - "first_introduced": "12", - "name": "OH_AVCODEC_MIMETYPE_AUDIO_LBVC" - }, { "first_introduced": "12", "name": "OH_AVCODEC_MIMETYPE_AUDIO_APE" diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index bde35e6ec..9c7574362 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -312,14 +312,6 @@ extern const char *OH_AVCODEC_MIMETYPE_AUDIO_OPUS; */ extern const char *OH_AVCODEC_MIMETYPE_AUDIO_G711MU; -/** - * @brief Enumerates the mime type of audio low bitrate voice codec. - * - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 12 - */ -extern const char *OH_AVCODEC_MIMETYPE_AUDIO_LBVC; - /** * @brief Enumerates the mime type of audio ape codec. * -- Gitee From 333244982a80a474bfaa0a33fc68647ffbf15b30 Mon Sep 17 00:00:00 2001 From: wisdom Date: Thu, 15 Aug 2024 09:43:39 +0800 Subject: [PATCH 03/11] Description: Update NDK interface BUILD.gn Signed-off-by: wisdom --- multimedia/audio_framework/BUILD.gn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/multimedia/audio_framework/BUILD.gn b/multimedia/audio_framework/BUILD.gn index 3445ac0be..2928db509 100644 --- a/multimedia/audio_framework/BUILD.gn +++ b/multimedia/audio_framework/BUILD.gn @@ -19,6 +19,7 @@ ohos_ndk_headers("ohaudio_header") { sources = [ "audio_capturer/native_audiocapturer.h", "audio_manager/native_audio_routing_manager.h", + "audio_manager/native_audio_session_manager.h", "audio_renderer/native_audiorenderer.h", "common/native_audio_common.h", "common/native_audio_device_base.h", @@ -40,5 +41,6 @@ ohos_ndk_library("libohaudio_ndk") { "ohaudio/native_audio_routing_manager.h", "ohaudio/native_audio_common.h", "ohaudio/native_audio_device_base.h", + "ohaudio/native_audio_session_manager.h", ] } -- Gitee From f64762687fe807007db20d2e706d83c34902fe2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E6=AC=A3=E7=91=B6?= Date: Mon, 12 Aug 2024 02:02:09 +0000 Subject: [PATCH 04/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A0=E5=BD=A2?= =?UTF-8?q?=E5=8F=82=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 任欣瑶 --- multimodalinput/kits/c/input/oh_input_manager.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multimodalinput/kits/c/input/oh_input_manager.h b/multimodalinput/kits/c/input/oh_input_manager.h index 1e6c0dd85..f55c4f32a 100644 --- a/multimodalinput/kits/c/input/oh_input_manager.h +++ b/multimodalinput/kits/c/input/oh_input_manager.h @@ -1187,7 +1187,7 @@ Input_Result OH_Input_AddInputEventInterceptor(Input_InterceptorEventCallback *c * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ -Input_Result OH_Input_RemoveKeyEventInterceptor(); +Input_Result OH_Input_RemoveKeyEventInterceptor(void); /** * @brief Removes an interceptor for input events, including mouse, touch, and axis events. @@ -1200,7 +1200,7 @@ Input_Result OH_Input_RemoveKeyEventInterceptor(); * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ -Input_Result OH_Input_RemoveInputEventInterceptor(); +Input_Result OH_Input_RemoveInputEventInterceptor(void); #ifdef __cplusplus } #endif -- Gitee From 1771f508327c15d74247cda8702cfbcae9292658 Mon Sep 17 00:00:00 2001 From: j00466033 Date: Fri, 9 Aug 2024 20:24:29 +0800 Subject: [PATCH 05/11] postmessage ndk interfaces Signed-off-by: j00466033 Change-Id: Ie9d9c49f0e279f24beb04ba9f8f62076d6711d05 Signed-off-by: j00466033 --- .../interfaces/native/arkweb_error_code.h | 6 + .../interfaces/native/arkweb_interface.h | 4 + web/webview/interfaces/native/arkweb_type.h | 178 +++++++++++++++++- 3 files changed, 187 insertions(+), 1 deletion(-) diff --git a/web/webview/interfaces/native/arkweb_error_code.h b/web/webview/interfaces/native/arkweb_error_code.h index 2162e368c..0ebf021f9 100644 --- a/web/webview/interfaces/native/arkweb_error_code.h +++ b/web/webview/interfaces/native/arkweb_error_code.h @@ -33,6 +33,12 @@ #define ARKWEB_ERROR_CODE_H typedef enum ArkWeb_ErrorCode { +/** @error Success. */ +ARKWEB_SUCCESS = 0, + +/** @error Init error. */ +ARKWEB_INIT_ERROR = 17100001, + /** @error Unknown error. */ ARKWEB_ERROR_UNKNOWN = 17100100, diff --git a/web/webview/interfaces/native/arkweb_interface.h b/web/webview/interfaces/native/arkweb_interface.h index d0b1fa45a..7b60c5bcb 100644 --- a/web/webview/interfaces/native/arkweb_interface.h +++ b/web/webview/interfaces/native/arkweb_interface.h @@ -59,6 +59,10 @@ typedef enum { ARKWEB_NATIVE_COMPONENT, /** API type related to ArkWeb controller. */ ARKWEB_NATIVE_CONTROLLER, + /** API type related to ArkWeb WebMessagePort. */ + ARKWEB_NATIVE_WEB_MESSAGE_PORT, + /** API type related to ArkWeb WebMessage. */ + ARKWEB_NATIVE_WEB_MESSAGE, } ArkWeb_NativeAPIVariantKind; /* diff --git a/web/webview/interfaces/native/arkweb_type.h b/web/webview/interfaces/native/arkweb_type.h index c63cfc26f..2a1d56d64 100644 --- a/web/webview/interfaces/native/arkweb_type.h +++ b/web/webview/interfaces/native/arkweb_type.h @@ -36,6 +36,8 @@ #include #include +#include "arkweb_error_code.h" + #ifdef __cplusplus extern "C" { #endif @@ -52,6 +54,27 @@ typedef struct { size_t size; } ArkWeb_JavaScriptBridgeData; +/** + * @brief Defines the data type carried in a ArkWeb_WebMessage. + * + * @since 12 + */ +typedef enum ArkWeb_WebMessageType { + /** Represent error data */ + ARKWEB_NONE = 0, + /** The data carried in the ArkWeb_WebMessage is string. */ + ARKWEB_STRING, + /** The data carried in the ArkWeb_WebMessage is buffer(uint8_t). */ + ARKWEB_BUFFER +} ArkWeb_WebMessageType; + +/** + * @brief Defines the ArkWeb_WebMessage. + * + * @since 12 + */ +typedef struct ArkWeb_WebMessage* ArkWeb_WebMessagePtr; + /** * @brief Defines the javascript callback of the native ArkWeb. * @@ -75,6 +98,26 @@ typedef void (*ArkWeb_OnJavaScriptProxyCallback)( */ typedef void (*ArkWeb_OnComponentCallback)(const char* webTag, void* userData); +/** + * @brief Defines the ArkWeb_WebMessagePort that represent a HTML5 message port. + * + * @since 12 + */ +typedef struct ArkWeb_WebMessagePort* ArkWeb_WebMessagePortPtr; + +/** + * @brief Defines the callback to receive message from HTML. + * + * @param webTag The name of the web component. + * @param port The ArkWeb_WebMessagePort for registering the ArkWeb_OnMessageEventHandler. + * @param message The received ArkWeb_WebMessage. + * @param userData The data set by user. + * + * @since 12 + */ +typedef void (*ArkWeb_OnMessageEventHandler)( + const char* webTag, const ArkWeb_WebMessagePortPtr port, const ArkWeb_WebMessagePtr message, void* userData); + /** * @brief Defines the javascript object. * @@ -121,6 +164,9 @@ typedef struct { /** * @brief Defines the controller API for native ArkWeb. + * Before invoking an API, you are advised to use ARKWEB_MEMBER_MISSING to check + * whether the function structure has a corresponding function pointer to avoid crash + * caused by mismatch between the SDK and the device ROM. * * @since 12 */ @@ -137,6 +183,37 @@ typedef struct { void (*refresh)(const char* webTag); /** Register the JavaScript object and async method list. */ void (*registerAsyncJavaScriptProxy)(const char* webTag, const ArkWeb_ProxyObject* proxyObject); + /** + * @brief Creates a message channel to communicate with HTML and returns + * the message ports representing the message channel endpoints. + * + * @param webTag The name of the web component. + * @param size The quantity of message ports. + */ + ArkWeb_WebMessagePortPtr* (*createWebMessagePorts)(const char* webTag, size_t* size); + + /** + * @brief Destroy message ports. + * + * @param ports Address of the message ports array pointer. + * @param size The quantity of message ports. + */ + void (*destroyWebMessagePorts)(ArkWeb_WebMessagePortPtr** ports, size_t size); + + /** + * @brief Post message ports to main frame. + * + * @param webTag The name of the web component. + * @param name Name of the message to be sent. + * @param size The quantity of message ports. + * @param url Indicates the URI for receiving the message. + * @return Post web message result code. + * {@link ARKWEB_SUCCESS} post web message success. + * {@link ARKWEB_INVALID_PARAM} the parameter verification fails. + * {@link ARKWEB_INIT_ERROR} no web associated with this webTag. + */ + ArkWeb_ErrorCode (*postWebMessage)( + const char* webTag, const char* name, ArkWeb_WebMessagePortPtr* webMessagePorts, size_t size, const char* url); } ArkWeb_ControllerAPI; /** @@ -157,6 +234,105 @@ typedef struct { void (*onDestroy)(const char* webTag, ArkWeb_OnComponentCallback callback, void* userData); } ArkWeb_ComponentAPI; +/** + * @brief Defines the web message API for native ArkWeb. + * Before invoking an API, you are advised to use ARKWEB_MEMBER_MISSING to check + * whether the function structure has a corresponding function pointer to avoid crash + * caused by mismatch between the SDK and the device ROM. + * + * @since 12 + */ +typedef struct { + /** The ArkWeb_WebMessagePortAPI struct size. */ + size_t size; + /** + * @brief Post message to HTML. + * + * @param webMessagePort The ArkWeb_WebMessagePort. + * @param webTag The name of the web component. + * @param webMessage The ArkWeb_WebMessage to send. + * @return Post message result code. + * {@link ARKWEB_SUCCESS} post message success. + * {@link ARKWEB_INVALID_PARAM} the parameter verification fails. + * {@link ARKWEB_INIT_ERROR} no web associated with this webTag. + */ + ArkWeb_ErrorCode (*postMessage)( + const ArkWeb_WebMessagePortPtr webMessagePort, const char* webTag, const ArkWeb_WebMessagePtr webMessage); + /** + * @brief Close the message port. + * + * @param webMessagePort The ArkWeb_WebMessagePort. + * @param webTag The name of the web component. + */ + void (*close)(const ArkWeb_WebMessagePortPtr webMessagePort, const char* webTag); + /** + * @brief Set a callback to receive message from HTML. + * + * @param webMessagePort The ArkWeb_WebMessagePort. + * @param webTag The name of the web component. + * @param messageEventHandler The handler to receive message from HTML. + * @param userData The data set by user. + */ + void (*setMessageEventHandler)(const ArkWeb_WebMessagePortPtr webMessagePort, const char* webTag, + ArkWeb_OnMessageEventHandler messageEventHandler, void* userData); +} ArkWeb_WebMessagePortAPI; + +/** + * @brief Defines the web message data API for native ArkWeb. + * Before invoking an API, you are advised to use ARKWEB_MEMBER_MISSING to check + * whether the function structure has a corresponding function pointer to avoid crash + * caused by mismatch between the SDK and the device ROM. + * + * @since 12 + */ +typedef struct { + /** The ArkWeb_WebMessageAPI struct size. */ + size_t size; + /** + * @brief Used to create a ArkWeb_WebMessage. + * + * @return The created ArkWeb_WebMessage, destroy it through + * destroyWebMessage after it is no longer used. + */ + ArkWeb_WebMessagePtr (*createWebMessage)(); + /** + * @brief Used to destroy a ArkWeb_WebMessage. + * + * @param webMessage The ArkWeb_WebMessage to destroy. + */ + void (*destroyWebMessage)(ArkWeb_WebMessagePtr* webMessage); + /** + * @brief Set the type of ArkWeb_WebMessage. + * + * @param webMessage The ArkWeb_WebMessage. + * @param type The type of ArkWeb_WebMessage. + */ + void (*setType)(ArkWeb_WebMessagePtr webMessage, ArkWeb_WebMessageType type); + /** + * @brief Get the type of ArkWeb_WebMessage. + * + * @param webMessage The ArkWeb_WebMessage. + * @return The type of ArkWeb_WebMessage. + */ + ArkWeb_WebMessageType (*getType)(ArkWeb_WebMessagePtr webMessage); + /** + * @brief Set the data of ArkWeb_WebMessage. + * + * @param webMessage The ArkWeb_WebMessage. + * @param data The data of ArkWeb_WebMessage. + * @param dataLength The length of data. + */ + void (*setData)(ArkWeb_WebMessagePtr webMessage, void* data, size_t dataLength); + /** + * @brief Get the data of ArkWeb_WebMessage. + * + * @param webMessage The ArkWeb_WebMessage. + * @param dataLength The length of data. + * @return The data of ArkWeb_WebMessage. + */ + void* (*getData)(ArkWeb_WebMessagePtr webMessage, size_t* dataLength); +} ArkWeb_WebMessageAPI; + /** * @brief Check whether the member variables of the current struct exist. * @@ -173,6 +349,6 @@ typedef struct { #define ARKWEB_MEMBER_MISSING(s, f) (!ARKWEB_MEMBER_EXISTS(s, f) || !((s)->f)) #ifdef __cplusplus -}; +} #endif #endif // ARKWEB_TYPE_H \ No newline at end of file -- Gitee From 178621d88ccdc400e9b930daf370adaa0e2f6877 Mon Sep 17 00:00:00 2001 From: y30025806 Date: Tue, 13 Aug 2024 14:46:30 +0800 Subject: [PATCH 06/11] add track start time Signed-off-by: y30025806 Change-Id: Iae8638ba8a25919bf8a0f03844aea4f05f9a4203 --- multimedia/av_codec/native_avcodec_base.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index 9c7574362..a3d3fb9a2 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -932,6 +932,13 @@ extern const char *OH_MD_KEY_VIDEO_SAR; * @since 12 */ extern const char *OH_MD_KEY_START_TIME; +/** + * @brief Key for start time of track, value type is int64_t. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 12 + */ +extern const char *OH_MD_KEY_TRACK_START_TIME; /** * @brief Key for setting the output color space of video decoder. The value type is int32_t. * The supported value is {@link OH_COLORSPACE_BT709_LIMIT}, see {@link OH_NativeBuffer_ColorSpace}. It is used in -- Gitee From 39a24ec18b99b2dd7e5d7e73ec44ac547391f1ff Mon Sep 17 00:00:00 2001 From: y30025806 Date: Wed, 14 Aug 2024 20:26:11 +0800 Subject: [PATCH 07/11] add start time Signed-off-by: y30025806 Change-Id: I114d276a486588630c97c443eb426f8209c359f6 --- .../av_codec/codec_base/libnative_media_codecbase.ndk.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json index 91de38d1c..589823ef3 100644 --- a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json +++ b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json @@ -383,6 +383,10 @@ "first_introduced": "12", "name": "OH_MD_KEY_START_TIME" }, + { + "first_introduced": "12", + "name": "OH_MD_KEY_TRACK_START_TIME" + }, { "first_introduced": "12", "name": "OH_MD_KEY_VIDEO_DECODER_OUTPUT_COLOR_SPACE" -- Gitee From 431dc870434bc6ce46bac980a9ce22ebf9e0d41f Mon Sep 17 00:00:00 2001 From: y30025806 Date: Wed, 14 Aug 2024 20:29:45 +0800 Subject: [PATCH 08/11] fix conflic Signed-off-by: y30025806 Change-Id: I3b4c70769c72b330a6e2275501b453210faa4320 --- multimedia/av_codec/native_avcodec_base.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index a3d3fb9a2..e591b5fcd 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -932,6 +932,20 @@ extern const char *OH_MD_KEY_VIDEO_SAR; * @since 12 */ extern const char *OH_MD_KEY_START_TIME; +/** + * @brief Key for setting the output color space of video decoder. The value type is int32_t. + * The supported value is {@link OH_COLORSPACE_BT709_LIMIT}, see {@link OH_NativeBuffer_ColorSpace}. It is used in + * {@link OH_VideoDecoder_Configure}. If the color space conversion capability is supported and this key is configured, + * the video decoder will automatically transcode an HDR Vivid video to an SDR video with color space BT709. + * If color space conversion capability is not supported, {@link OH_VideoDecoder_Configure} returns + * {@link AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION}. + * If the input video is not an HDR vivid video, an error {@link AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION} will + * be reported by callback function {@link OH_AVCodecOnError}. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 12 + */ +extern const char *OH_MD_KEY_VIDEO_DECODER_OUTPUT_COLOR_SPACE; /** * @brief Key for start time of track, value type is int64_t. * @@ -939,6 +953,7 @@ extern const char *OH_MD_KEY_START_TIME; * @since 12 */ extern const char *OH_MD_KEY_TRACK_START_TIME; + /** * @brief Key for setting the output color space of video decoder. The value type is int32_t. * The supported value is {@link OH_COLORSPACE_BT709_LIMIT}, see {@link OH_NativeBuffer_ColorSpace}. It is used in -- Gitee From 53ba9d8648946666977ceaea7bc80f4f670d7971 Mon Sep 17 00:00:00 2001 From: y30025806 Date: Wed, 14 Aug 2024 20:37:22 +0800 Subject: [PATCH 09/11] fix conflic Signed-off-by: y30025806 Change-Id: Iec966d60ae4cfcf3f844ba6ce9242eec1dbd2b63 --- multimedia/av_codec/native_avcodec_base.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index e591b5fcd..51d7d5a97 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -932,6 +932,13 @@ extern const char *OH_MD_KEY_VIDEO_SAR; * @since 12 */ extern const char *OH_MD_KEY_START_TIME; +/** + * @brief Key for start time of track, value type is int64_t. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 12 + */ +extern const char *OH_MD_KEY_TRACK_START_TIME; /** * @brief Key for setting the output color space of video decoder. The value type is int32_t. * The supported value is {@link OH_COLORSPACE_BT709_LIMIT}, see {@link OH_NativeBuffer_ColorSpace}. It is used in @@ -946,13 +953,6 @@ extern const char *OH_MD_KEY_START_TIME; * @since 12 */ extern const char *OH_MD_KEY_VIDEO_DECODER_OUTPUT_COLOR_SPACE; -/** - * @brief Key for start time of track, value type is int64_t. - * - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 12 - */ -extern const char *OH_MD_KEY_TRACK_START_TIME; /** * @brief Key for setting the output color space of video decoder. The value type is int32_t. -- Gitee From f2adcdc605d374185661b9674e0a632c094cd1fb Mon Sep 17 00:00:00 2001 From: y30025806 Date: Thu, 15 Aug 2024 08:52:44 +0800 Subject: [PATCH 10/11] add err code Signed-off-by: y30025806 Change-Id: I37ce49dabb9d592e9533c2e35d5f7bba6106b7b1 --- multimedia/media_foundation/native_averrors.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/multimedia/media_foundation/native_averrors.h b/multimedia/media_foundation/native_averrors.h index 0a2a54d60..edecfa2a8 100644 --- a/multimedia/media_foundation/native_averrors.h +++ b/multimedia/media_foundation/native_averrors.h @@ -78,6 +78,11 @@ typedef enum OH_AVErrCode { * @error unsupport interface. */ AV_ERR_UNSUPPORT = 9, + /** + * @error input data error. + * @since 12 + */ + AV_ERR_INPUT_DATA_ERROR = 10, /** * @error extend err start. */ -- Gitee From 083a082c1bdebb171a67f8f2a9eb16a8c8d611fa Mon Sep 17 00:00:00 2001 From: wangyulie Date: Thu, 15 Aug 2024 17:35:56 +0800 Subject: [PATCH 11/11] ffrt add interfaces in API12 Signed-off-by: wangyulie --- resourceschedule/ffrt/c/task.h | 40 +++++++++++++++++++++++++++++ resourceschedule/ffrt/ffrt.ndk.json | 16 ++++++++++++ 2 files changed, 56 insertions(+) diff --git a/resourceschedule/ffrt/c/task.h b/resourceschedule/ffrt/c/task.h index 066493f9e..b789fdc74 100644 --- a/resourceschedule/ffrt/c/task.h +++ b/resourceschedule/ffrt/c/task.h @@ -141,6 +141,26 @@ FFRT_C_API void ffrt_task_attr_set_queue_priority(ffrt_task_attr_t* attr, ffrt_q */ FFRT_C_API ffrt_queue_priority_t ffrt_task_attr_get_queue_priority(const ffrt_task_attr_t* attr); +/** + * @brief Sets the task stack size. + * + * @param attr Indicates a pointer to the task attribute. + * @param size Indicates the task stack size, unit is byte. + * @since 12 + * @version 1.0 + */ +FFRT_C_API void ffrt_task_attr_set_stack_size(ffrt_task_attr_t* attr, uint64_t size); + +/** + * @brief Obtains the task stack size. + * + * @param attr Indicates a pointer to the task attribute. + * @return Returns the task stack size, unit is byte. + * @since 12 + * @version 1.0 + */ +FFRT_C_API uint64_t ffrt_task_attr_get_stack_size(const ffrt_task_attr_t* attr); + /** * @brief Updates the QoS of this task. * @@ -209,6 +229,26 @@ FFRT_C_API void ffrt_submit_base(ffrt_function_header_t* f, const ffrt_deps_t* i FFRT_C_API ffrt_task_handle_t ffrt_submit_h_base(ffrt_function_header_t* f, const ffrt_deps_t* in_deps, const ffrt_deps_t* out_deps, const ffrt_task_attr_t* attr); +/** + * @brief increase reference count of task handle. + * + * @param handle Indicates a task handle. + * @return return the task handle original reference count. + * @since 12 + * @version 1.0 + */ +FFRT_C_API uint32_t ffrt_task_handle_inc_ref(ffrt_task_handle_t handle); + +/** + * @brief decrease reference count of task handle. + * + * @param handle Indicates a task handle. + * @return return the task handle original reference count. + * @since 12 + * @version 1.0 + */ +FFRT_C_API uint32_t ffrt_task_handle_dec_ref(ffrt_task_handle_t handle); + /** * @brief Destroys a task handle. * diff --git a/resourceschedule/ffrt/ffrt.ndk.json b/resourceschedule/ffrt/ffrt.ndk.json index 397494c37..ed52dcc3b 100644 --- a/resourceschedule/ffrt/ffrt.ndk.json +++ b/resourceschedule/ffrt/ffrt.ndk.json @@ -50,11 +50,27 @@ { "name": "ffrt_task_attr_get_qos" }, { "name": "ffrt_task_attr_set_delay" }, { "name": "ffrt_task_attr_get_delay" }, + { + "first_introduced": "12", + "name": "ffrt_task_attr_set_stack_size" + }, + { + "first_introduced": "12", + "name": "ffrt_task_attr_get_stack_size" + }, { "name": "ffrt_this_task_update_qos" }, { "name": "ffrt_this_task_get_id" }, { "name": "ffrt_alloc_auto_managed_function_storage_base" }, { "name": "ffrt_submit_base" }, { "name": "ffrt_submit_h_base" }, + { + "first_introduced": "12", + "name": "ffrt_task_handle_inc_ref" + }, + { + "first_introduced": "12", + "name": "ffrt_task_handle_dec_ref" + }, { "name": "ffrt_task_handle_destroy" }, { "name": "ffrt_wait_deps" }, { "name": "ffrt_wait" }, -- Gitee