From 4b2a90033bf2985ac98e0b7dd57d4be0aa405677 Mon Sep 17 00:00:00 2001 From: river wong Date: Wed, 30 Dec 2020 20:20:01 +0800 Subject: [PATCH] [BTVSBOX-313] Audio Routing: Unmute/mute HDMI audio when UI passthrough mode is enable/disable. [2/2] --- Android.mk | 2 ++ hal_a_mixer.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/Android.mk b/Android.mk index a235ceb..ee60ea1 100644 --- a/Android.mk +++ b/Android.mk @@ -18,6 +18,8 @@ LOCAL_C_INCLUDES += $(TOP)/system/core/libutils/include LOCAL_C_INCLUDES += $(TOP)/system/core/libcutils/include LOCAL_SRC_FILES := amp_wrapper.c hal_av_pipeline.c hal_a_mixer.c +#Vas add for notify passthroug mode +LOCAL_SHARED_LIBRARIES := libAudioHalInf LOCAL_MODULE_TAGS := optional LOCAL_PROPRIETARY_MODULE := true diff --git a/hal_a_mixer.c b/hal_a_mixer.c index 63c621a..b2f22af 100644 --- a/hal_a_mixer.c +++ b/hal_a_mixer.c @@ -21,6 +21,8 @@ extern "C" { #endif +static AVP_AudioOutputMode gCurPassthroughMode=AVP_AUDIO_PCM; //Vas add for audio routing; River 2020/12/25 + int AMIXER_Create(AMIXER_HANDLE *amixer) { ALOGD("BTF|%s|%d|IN|\n", __FUNCTION__,__LINE__); @@ -230,6 +232,20 @@ int AMIXER_SetAudioOutputMode(AMIXER_HANDLE amixer, AVP_AudioOutputMode mode) { ALOGD("++%s mode : %d ", __FUNCTION__, mode); + //Vas add start for audio routing; River 2020/12/25 + if(gCurPassthroughMode != mode){ + gCurPassthroughMode = mode; + if(mode == AVP_AUDIO_PASSTHROUGH){ + ALOGD("%s: Set enable passthrough mode\n", __FUNCTION__); + notify_passthrough_settings_status(true); + } + else{ + ALOGD("%s: Set disble passthrough mode\n", __FUNCTION__); + notify_passthrough_settings_status(false); + } + } + //Vas add end; River 2020/12/25 + setHdmiFormat(amixer, mode); ALOGD("BTF|%s|%d|OUT| \n", __FUNCTION__,__LINE__); -- 2.7.4