From 4cd6b78f8f0f69ea0f280c6b2cf3f184b9100c1b Mon Sep 17 00:00:00 2001 From: yang-jihai Date: Mon, 11 Aug 2025 21:02:43 +0800 Subject: [PATCH 1/3] setLoadnessGain interface --- multimedia/player_framework/avplayer.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/multimedia/player_framework/avplayer.h b/multimedia/player_framework/avplayer.h index 1261bdd3b10..6f124faeb1e 100644 --- a/multimedia/player_framework/avplayer.h +++ b/multimedia/player_framework/avplayer.h @@ -239,6 +239,25 @@ OH_AVErrCode OH_AVPlayer_ReleaseSync(OH_AVPlayer *player); */ OH_AVErrCode OH_AVPlayer_SetVolume(OH_AVPlayer *player, float leftVolume, float rightVolume); +/** + * @brief Sets the loudness gain of current avplayer. + * The default loudness gain is 0.0dB. The stream usage of the avplayer 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 avplayer must be {@link OH_AudioStream_LatencyMode#AUDIOSTREAM_LATENCY_MODE_NORMAL}. + * If avplayer is played through the high-resolution pipe, this operation is not supported. + * + * @param renderer 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 AUDIOSTREAM_SUCCESS} If the execution is successful. + * {@link AUDIOSTREAM_ERROR_INVALID_PARAM}: + * 1.The param of player is nullptr or not supported to set gain; + * 2.The param of loudnessGain is invalid. + * @since 20 + */ +OH_AVErrCode OH_AVPlayer_SetLoudnessGain(OH_AVPlayer* player, float loudnessGain); + /** * @brief Changes the playback position. * -- Gitee From c670a3412761738d0b098b6b38ff8bcba666311c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E7=BB=A7=E6=B5=B7?= Date: Tue, 12 Aug 2025 01:02:04 +0000 Subject: [PATCH 2/3] update multimedia/player_framework/avplayer.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨继海 --- multimedia/player_framework/avplayer.h | 42 ++++++++++++++------------ 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/multimedia/player_framework/avplayer.h b/multimedia/player_framework/avplayer.h index 6f124faeb1e..9b6abaee02c 100644 --- a/multimedia/player_framework/avplayer.h +++ b/multimedia/player_framework/avplayer.h @@ -239,25 +239,6 @@ OH_AVErrCode OH_AVPlayer_ReleaseSync(OH_AVPlayer *player); */ OH_AVErrCode OH_AVPlayer_SetVolume(OH_AVPlayer *player, float leftVolume, float rightVolume); -/** - * @brief Sets the loudness gain of current avplayer. - * The default loudness gain is 0.0dB. The stream usage of the avplayer 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 avplayer must be {@link OH_AudioStream_LatencyMode#AUDIOSTREAM_LATENCY_MODE_NORMAL}. - * If avplayer is played through the high-resolution pipe, this operation is not supported. - * - * @param renderer 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 AUDIOSTREAM_SUCCESS} If the execution is successful. - * {@link AUDIOSTREAM_ERROR_INVALID_PARAM}: - * 1.The param of player is nullptr or not supported to set gain; - * 2.The param of loudnessGain is invalid. - * @since 20 - */ -OH_AVErrCode OH_AVPlayer_SetLoudnessGain(OH_AVPlayer* player, float loudnessGain); - /** * @brief Changes the playback position. * @@ -640,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 20 + */ +OH_AVErrCode OH_AVPlayer_SetLoudnessGain(OH_AVPlayer *player, float loudnessGain); + #ifdef __cplusplus } #endif -- Gitee From 3924e7c01f6545225d142f972f10ff9ad054b928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E7=BB=A7=E6=B5=B7?= Date: Mon, 18 Aug 2025 01:41:28 +0000 Subject: [PATCH 3/3] update multimedia/player_framework/avplayer.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨继海 --- multimedia/player_framework/avplayer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multimedia/player_framework/avplayer.h b/multimedia/player_framework/avplayer.h index 9b6abaee02c..29741964597 100644 --- a/multimedia/player_framework/avplayer.h +++ b/multimedia/player_framework/avplayer.h @@ -637,10 +637,10 @@ OH_AVErrCode OH_AVPlayer_SetVolumeMode(OH_AVPlayer *player, OH_AudioStream_Volum * {@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}, + * 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 20 + * @since 21 */ OH_AVErrCode OH_AVPlayer_SetLoudnessGain(OH_AVPlayer *player, float loudnessGain); -- Gitee