From: Seungbae Shin Date: Mon, 31 May 2021 08:18:06 +0000 (+0900) Subject: Set default playback route to headphone and change by route option X-Git-Tag: submit/tizen/20210705.072009^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9e0264041cbf6b9e8a1902959325e730088bf19;p=platform%2Fadaptation%2Fap_broadcom%2Faudio-hal-bcm2837.git Set default playback route to headphone and change by route option Previously playback route was initialize to headphone only if headless case. Now we will handle route option for that through sound-manager internal api, so set default as headphone always. [Version] 0.1.14 [Issue Type] Feature Change-Id: Ie95585900aef0cf561494b401d04c9070052567b --- diff --git a/Makefile.am b/Makefile.am index 4e477dc..ef2583e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,8 +12,8 @@ libhal_backend_audio_la_SOURCES = tizen-audio.c \ tizen-audio-impl-ctrl.c \ hal-backend-audio.c libhal_backend_audio_la_LDFLAGS = $(AM_LDFLAGS) -disable-static -avoid-version -libhal_backend_audio_la_LIBADD = $(AM_LDADD) $(ASOUNDLIB_LIBS) $(VCONF_LIBS) $(DLOG_LIBS) $(INIPARSER_LIBS) $(SYSTEM_INFO_LIBS) -libhal_backend_audio_la_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS) $(VCONF_CFLAGS) $(DLOG_CFLAGS) $(INIPARSER_CFLAGS) $(SYSTEM_INFO_CFLAGS) $(HALAPICOMMON) -DUSE_DLOG +libhal_backend_audio_la_LIBADD = $(AM_LDADD) $(ASOUNDLIB_LIBS) $(VCONF_LIBS) $(DLOG_LIBS) $(INIPARSER_LIBS) +libhal_backend_audio_la_CFLAGS = $(AM_CFLAGS) $(ASOUNDLIB_CFLAGS) $(VCONF_CFLAGS) $(DLOG_CFLAGS) $(INIPARSER_CFLAGS) $(HALAPICOMMON) -DUSE_DLOG if USE_TINYALSA libhal_backend_audio_la_LIBADD += $(TINYALSA_LIBS) diff --git a/configure.ac b/configure.ac index 199769c..4d5b7c5 100644 --- a/configure.ac +++ b/configure.ac @@ -47,10 +47,6 @@ PKG_CHECK_MODULES(DLOG, dlog) AC_SUBST(DLOG_CFLAGS) AC_SUBST(DLOG_LIBS) -PKG_CHECK_MODULES(SYSTEM_INFO, capi-system-info) -AC_SUBST(SYSTEM_INFO_CFLAGS) -AC_SUBST(SYSTEM_INFO_LIBS) - PKG_CHECK_MODULES(HALAPICOMMON, hal-api-common) AC_SUBST(HALAPICOMMON_CFLAGS) AC_SUBST(HALAPICOMMON_LIBS) diff --git a/packaging/audio-hal-bcm2837.spec b/packaging/audio-hal-bcm2837.spec index def5acb..dd53a1d 100644 --- a/packaging/audio-hal-bcm2837.spec +++ b/packaging/audio-hal-bcm2837.spec @@ -1,6 +1,6 @@ Name: audio-hal-bcm2837 Summary: TIZEN Audio HAL for BCM2837 -Version: 0.1.13 +Version: 0.1.14 Release: 0 Group: System/Libraries License: Apache-2.0 @@ -10,7 +10,6 @@ BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(iniparser) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(alsa) -BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(hal-api-common) BuildRequires: pkgconfig(hal-api-audio) #BuildRequires: pkgconfig(tinyalsa) diff --git a/tizen-audio-routing.c b/tizen-audio-routing.c index 406c5d6..fbf0f8a 100644 --- a/tizen-audio-routing.c +++ b/tizen-audio-routing.c @@ -29,8 +29,7 @@ #include "tizen-audio-internal.h" #include "tizen-audio-impl.h" -#include -#define FEATURE_DISPLAY "http://tizen.org/feature/display" +#include /* #define DEBUG_TIMING */ @@ -247,19 +246,16 @@ static audio_return_e __update_route_reset(audio_hal_s *ah, uint32_t direction) static void __audio_routing_playback_rpi3(audio_hal_s *ah) { - bool display_avail = false; - int ret = SYSTEM_INFO_ERROR_NONE; - - ret = system_info_get_platform_bool(FEATURE_DISPLAY, &display_avail); - AUDIO_LOG_INFO("system_info_platform [%s]=[%d], ret[%d]", FEATURE_DISPLAY, display_avail, ret); - if (ret != SYSTEM_INFO_ERROR_NONE) - AUDIO_LOG_ERROR("Failed to get feature..."); - - if (!display_avail) { - /* in case of headless (display is not available), force to use earjack(1) only. - supported value : (0)auto (1)earjack (2)hdmi */ - _mixer_control_set_value(ah, "PCM Playback Route", 1); + int type; + int ret; + + ret = vconf_get_int(VCONFKEY_SOUND_RPI_PLAYBACK_ROUTE, &type); + if (ret != 0) { + AUDIO_LOG_ERROR("Failed to get vconf [%s], err [%d]", VCONFKEY_SOUND_RPI_PLAYBACK_ROUTE, ret); + return; } + + _mixer_control_set_value(ah, "PCM Playback Route", type); } audio_return_e _audio_routing_init(audio_hal_s *ah) @@ -321,11 +317,23 @@ audio_return_e audio_update_route_option(void *audio_handle, audio_route_option_ { audio_return_e audio_ret = AUDIO_RET_OK; audio_hal_s *ah = (audio_hal_s *)audio_handle; + int ret; AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER); AUDIO_RETURN_VAL_IF_FAIL(option, AUDIO_ERR_PARAMETER); AUDIO_LOG_INFO("role:%s, name:%s, value:%d", option->role, option->name, option->value); + if (!strcmp("rpi playback route", option->name)) { + audio_ret = _mixer_control_set_value(ah, "PCM Playback Route", option->value); + if (audio_ret == AUDIO_RET_OK) { + ret = vconf_set_int(VCONFKEY_SOUND_RPI_PLAYBACK_ROUTE, option->value); + if (ret != 0) { + AUDIO_LOG_ERROR("Failed to set vconf [%s], err [%d]", VCONFKEY_SOUND_RPI_PLAYBACK_ROUTE, ret); + return AUDIO_ERR_INTERNAL; + } + } + } + return audio_ret; }