From 5a1879727c7470049b750430b6ecdce1ebeb29e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=99=93=E6=B8=AF?= Date: Fri, 5 Sep 2025 17:04:56 +0800 Subject: [PATCH] add AVPlayer capi SetDataSource MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李晓港 --- multimedia/player_framework/avplayer.h | 13 +++++++++++++ .../player_framework/avplayer/libavplayer.ndk.json | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/multimedia/player_framework/avplayer.h b/multimedia/player_framework/avplayer.h index 9f89bc00c2a..d206b6d46ed 100644 --- a/multimedia/player_framework/avplayer.h +++ b/multimedia/player_framework/avplayer.h @@ -47,6 +47,7 @@ #include "avplayer_base.h" #include "native_window/external_window.h" #include "ohaudio/native_audiostream_base.h" +#include "native_avcodec_base.h" #ifdef __cplusplus extern "C" { @@ -644,6 +645,18 @@ OH_AVErrCode OH_AVPlayer_SetVolumeMode(OH_AVPlayer *player, OH_AudioStream_Volum */ OH_AVErrCode OH_AVPlayer_SetLoudnessGain(OH_AVPlayer *player, float loudnessGain); +/** + * @brief Set the media source of the player. The data of this media source is provided by the application. + * @param {OH_AVPlayer*} player Pointer to an OH_AVPlayer instance + * @param {OH_AVDataSourceExt*} datasrc Pointer to an OH_AVDataSourceExt instance + * @param {void*} userData The handle passed in by the user is used to pass in the callback + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input player is nullptr or datasrc is nullptr. + * @since 21 + */ +OH_AVErrCode OH_AVPlayer_SetDataSource(OH_AVPlayer *player, OH_AVDataSourceExt* datasrc, void* userData); + #ifdef __cplusplus } #endif diff --git a/multimedia/player_framework/avplayer/libavplayer.ndk.json b/multimedia/player_framework/avplayer/libavplayer.ndk.json index 787c34354f8..2b372fe8fa0 100644 --- a/multimedia/player_framework/avplayer/libavplayer.ndk.json +++ b/multimedia/player_framework/avplayer/libavplayer.ndk.json @@ -150,5 +150,9 @@ { "first_introduced": "21", "name": "OH_AVPlayer_SetLoudnessGain" + }, + { + "first_introduced": "21", + "name": "OH_AVPlayer_SetDataSource" } ] \ No newline at end of file -- Gitee