From 66e6ae39829ce5fb8f111f00fce2f390bd01cbfa Mon Sep 17 00:00:00 2001 From: zhangwt3652 Date: Fri, 9 May 2025 17:40:49 +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: I10fc377bf8b623993e5216c3bb9c1089f70ed7d1 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 6b1fb6cb6..ae1c5820b 100644 --- a/multimedia/audio_framework/common/native_audiostream_base.h +++ b/multimedia/audio_framework/common/native_audiostream_base.h @@ -404,7 +404,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 5fb946d81..1676339d7 100644 --- a/multimedia/audio_framework/common/native_audiostreambuilder.h +++ b/multimedia/audio_framework/common/native_audiostreambuilder.h @@ -488,6 +488,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 9366ddd75..a69d82c1d 100644 --- a/multimedia/audio_framework/ohaudio.ndk.json +++ b/multimedia/audio_framework/ohaudio.ndk.json @@ -410,5 +410,9 @@ { "first_introduced": "18", "name": "OH_AudioStreamBuilder_SetCapturerErrorCallback" + }, + { + "first_introduced": "20", + "name": "OH_AudioStreamBuilder_SetCapturerWillMuteWhenInterrupted" } ] diff --git a/multimedia/player_framework/avrecorder.h b/multimedia/player_framework/avrecorder.h index b94e92b97..444dcab6e 100644 --- a/multimedia/player_framework/avrecorder.h +++ b/multimedia/player_framework/avrecorder.h @@ -229,6 +229,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