Set default playback route to headphone and change by route option 43/259043/4 accepted/tizen/unified/20210708.131518 submit/tizen/20210705.072009 submit/tizen/20210707.025110
authorSeungbae Shin <seungbae.shin@samsung.com>
Mon, 31 May 2021 08:18:06 +0000 (17:18 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 11 Jun 2021 03:57:56 +0000 (12:57 +0900)
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

Makefile.am
configure.ac
packaging/audio-hal-bcm2837.spec
tizen-audio-routing.c

index 4e477dc..ef2583e 100644 (file)
@@ -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)
index 199769c..4d5b7c5 100644 (file)
@@ -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)
index def5acb..dd53a1d 100644 (file)
@@ -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)
index 406c5d6..fbf0f8a 100644 (file)
@@ -29,8 +29,7 @@
 #include "tizen-audio-internal.h"
 #include "tizen-audio-impl.h"
 
-#include <system_info.h>
-#define FEATURE_DISPLAY "http://tizen.org/feature/display"
+#include <vconf.h>
 
 /* #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;
 }