From 0965b9b5a0545d131682103f12728eac8f7e5f9e Mon Sep 17 00:00:00 2001 From: huqinglong Date: Mon, 25 Aug 2025 10:23:29 +0800 Subject: [PATCH] =?UTF-8?q?ndk=E5=A2=9E=E5=8A=A0=E9=9F=B3=E9=87=8F?= =?UTF-8?q?=E5=A2=9E=E7=9B=8A=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huqinglong --- multimedia/player_framework/avplayer.h | 23 +++++++++++++++++++ .../avplayer/libavplayer.ndk.json | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/multimedia/player_framework/avplayer.h b/multimedia/player_framework/avplayer.h index 1261bdd3b10..9f89bc00c2a 100644 --- a/multimedia/player_framework/avplayer.h +++ b/multimedia/player_framework/avplayer.h @@ -621,6 +621,29 @@ OH_AVErrCode OH_AVPlayer_SetOnErrorCallback(OH_AVPlayer *player, OH_AVPlayerOnEr */ OH_AVErrCode OH_AVPlayer_SetVolumeMode(OH_AVPlayer *player, OH_AudioStream_VolumeMode volumeMode); +/** + * @brief Sets the loudness gain of current media. The default gain is 0.0 dB. + * This API can be called only when the AVPlayer is in the prepared, playing, paused completed or stopped state. + * The default loudness gain is 0.0dB. The stream usage of the player must be + * {@link OH_AudioStream_Usage#AUDIOSTREAM_USAGE_MUSIC}, {@link OH_AudioStream_Usage#AUDIOSTREAM_USAGE_MOVIE} + * or {@link OH_AudioStream_Usage#AUDIOSTREAM_USAGE_AUDIOBOOK}. + * The latency mode of the audio renderer must be {@link OH_AudioStream_LatencyMode#AUDIOSTREAM_LATENCY_MODE_NORMAL}. + * If AudioRenderer is played through the high-resolution pipe, this operation is not supported. + * + * @param player Pointer to an OH_AVPlayer instance. + * @param loudnessGain Loudness gain to set which changes from -90.0 to 24.0, expressing in dB. + * @return Function result code: + * {@link AV_ERR_OK} If the execution is successful. + * {@link AV_ERR_INVALID_VAL}:The value of player is a null pointer or + * the value of loudnessGain is invalid. + * {@link AV_ERR_INVALID_STATE}: The function is called in an incorrect state. or the stream usage of + * audioRendererInfo is not one of {@link StreamUsage#STREAM_USAGE_MUSIC}, + * {@link StreamUsage#STREAM_USAGE_MOVIE} or {@link StreamUsage#STREAM_USAGE_AUDIOBOOK}. + * {@link AV_ERR_SERVICE_DIED}: System errors such as media service breakdown. + * @since 21 + */ +OH_AVErrCode OH_AVPlayer_SetLoudnessGain(OH_AVPlayer *player, float loudnessGain); + #ifdef __cplusplus } #endif diff --git a/multimedia/player_framework/avplayer/libavplayer.ndk.json b/multimedia/player_framework/avplayer/libavplayer.ndk.json index 7f6d8b5bb7e..787c34354f8 100644 --- a/multimedia/player_framework/avplayer/libavplayer.ndk.json +++ b/multimedia/player_framework/avplayer/libavplayer.ndk.json @@ -146,5 +146,9 @@ { "first_introduced": "20", "name": "OH_AVPlayer_SetPlaybackRate" + }, + { + "first_introduced": "21", + "name": "OH_AVPlayer_SetLoudnessGain" } ] \ No newline at end of file -- Gitee