From 889d46ad0a683bd18f1797c096329cc6a94d28f3 Mon Sep 17 00:00:00 2001 From: magekkkk Date: Mon, 24 Mar 2025 06:59:37 +0000 Subject: [PATCH] add apis for mute when interrupt for capture Signed-off-by: magekkkk --- .../common/native_audiostream_base.h | 14 +++++++++++++- .../common/native_audiostreambuilder.h | 14 ++++++++++++++ multimedia/player_framework/avrecorder.h | 13 +++++++++++++ 3 files changed, 40 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/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 -- Gitee