From 49342e1985b59ba62185ac485680e2ac0aa2df36 Mon Sep 17 00:00:00 2001 From: zhangwt3652 Date: Fri, 16 May 2025 10:38:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=BE=E7=BD=AE=E6=89=93?= =?UTF-8?q?=E6=96=AD=E6=A8=A1=E5=BC=8F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I43a466139c395f2f4c8837e471e2fcecc9ea6019 Signed-off-by: zhangwt3652 --- .../common/native_audiostream_base.h | 14 +++++++++++++- .../common/native_audiostreambuilder.h | 14 ++++++++++++++ multimedia/audio_framework/ohaudio.ndk.json | 4 ++++ multimedia/player_framework/avrecorder.h | 13 +++++++++++++ .../avrecorder/libavrecorder.ndk.json | 4 ++++ 5 files changed, 48 insertions(+), 1 deletion(-) diff --git a/multimedia/audio_framework/common/native_audiostream_base.h b/multimedia/audio_framework/common/native_audiostream_base.h index 2d05872a0..ff59b446d 100644 --- a/multimedia/audio_framework/common/native_audiostream_base.h +++ b/multimedia/audio_framework/common/native_audiostream_base.h @@ -476,7 +476,19 @@ typedef enum { * * @since 10 */ - AUDIOSTREAM_INTERRUPT_HINT_UNDUCK = 5 + AUDIOSTREAM_INTERRUPT_HINT_UNDUCK = 5, + /** + * Mute the stream. + * + * @since 20 + */ + AUDIOSTREAM_INTERRUPT_HINT_MUTE = 6, + /** + * Unmute the stream. + * + * @since 20 + */ + AUDIOSTREAM_INTERRUPT_HINT_UNMUTE = 7 } OH_AudioInterrupt_Hint; /** diff --git a/multimedia/audio_framework/common/native_audiostreambuilder.h b/multimedia/audio_framework/common/native_audiostreambuilder.h index 4fd3502b0..ab52198a5 100644 --- a/multimedia/audio_framework/common/native_audiostreambuilder.h +++ b/multimedia/audio_framework/common/native_audiostreambuilder.h @@ -503,6 +503,20 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerInterruptCallback(OH_Audi */ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerErrorCallback(OH_AudioStreamBuilder* builder, OH_AudioCapturer_OnErrorCallback callback, void* userData); + +/** + * @brief Set audio capturer configuration, if app want its recorder only to be muted instead of interrupted. + * + * @param builder reference provided by OH_AudioStreamBuilder_Create() + * @param muteWhenInterrupted use {@code true} if application want to be muted instead of interrupted. + * @return function result code: + * {@link AUDIOSTREAM_SUCCESS} if the execution is successful. + * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} the param of builder is nullptr. + * @since 20 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerWillMuteWhenInterrupted(OH_AudioStreamBuilder* builder, + bool muteWhenInterrupted); + #ifdef __cplusplus } #endif diff --git a/multimedia/audio_framework/ohaudio.ndk.json b/multimedia/audio_framework/ohaudio.ndk.json index 445447205..c1d3119af 100644 --- a/multimedia/audio_framework/ohaudio.ndk.json +++ b/multimedia/audio_framework/ohaudio.ndk.json @@ -422,5 +422,9 @@ { "first_introduced": "20", "name": "OH_AudioStreamManager_IsAcousticEchoCancelerSupported" + }, + { + "first_introduced": "20", + "name": "OH_AudioStreamBuilder_SetCapturerWillMuteWhenInterrupted" } ] diff --git a/multimedia/player_framework/avrecorder.h b/multimedia/player_framework/avrecorder.h index b5fc9847d..7a83727ef 100644 --- a/multimedia/player_framework/avrecorder.h +++ b/multimedia/player_framework/avrecorder.h @@ -231,6 +231,19 @@ OH_AVErrCode OH_AVRecorder_SetErrorCallback(OH_AVRecorder *recorder, OH_AVRecord */ OH_AVErrCode OH_AVRecorder_SetUriCallback(OH_AVRecorder *recorder, OH_AVRecorder_OnUri callback, void *userData); +/** + * @brief Set recorder configuration, if app want its recorder only to be muted instead of interrupted. + * + * @param recorder Pointer to an OH_AVRecorder instance + * @param muteWhenInterrupted use {@code true} if application want to be muted instead of interrupted. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr. + * {@link AV_ERR_INVALID_STATE} function called in invalid state, only available before prepare state. + * @since 20 + */ +OH_AVErrCode OH_AVRecorder_SetWillMuteWhenInterrupted(OH_AVRecorder *recorder, bool muteWhenInterrupted); + #ifdef __cplusplus } #endif diff --git a/multimedia/player_framework/avrecorder/libavrecorder.ndk.json b/multimedia/player_framework/avrecorder/libavrecorder.ndk.json index 29ca772eb..e0ff00144 100644 --- a/multimedia/player_framework/avrecorder/libavrecorder.ndk.json +++ b/multimedia/player_framework/avrecorder/libavrecorder.ndk.json @@ -58,5 +58,9 @@ { "first_introduced": "18", "name": "OH_AVRecorder_SetUriCallback" + }, + { + "first_introduced": "20", + "name": "OH_AVRecorder_SetWillMuteWhenInterrupted" } ] \ No newline at end of file -- Gitee