[M120 Migration][MM] Supporting ATMOS decoding & checking ATMOS decoding capability 29/308329/5
authorpeng1xiao <peng1.xiao@samsung.com>
Thu, 21 Mar 2024 09:31:08 +0000 (17:31 +0800)
committerYanqing Lu <yanqing.lu@samsung.com>
Mon, 25 Mar 2024 03:05:44 +0000 (03:05 +0000)
- HDMI CEC API is deprecated.
- Audio controller API can check soundBar/TV/receiver's capability.

Migrated from:
https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/291012/
https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/291239/

Change-Id: Ibf3813fe5f795fb472eebe2e3a6978951556c84c
Signed-off-by: peng1xiao <peng1.xiao@samsung.com>
packaging/chromium-efl.spec
third_party/blink/renderer/modules/mediasource/media_source.cc
tizen_src/build/BUILD.gn
tizen_src/build/config/BUILD.gn
tizen_src/build/config/tizen_features.gni
tizen_src/chromium_impl/media/media_efl.gni
tizen_src/ewk/efl_integration/eweb_context.cc

index ccc8e52..030e38f 100644 (file)
@@ -71,6 +71,11 @@ Source1: content_shell.in
 %else
 %define __enable_gamepad_latency_test 0
 %endif
+
+%if "%{_vd_cfg_product_type}" != "LFD" && "%{_vd_cfg_product_type}" != "IWB" && "%{?_with_emulator}" != "1" && "%{_vd_cfg_licensing}" == "n" && %{tizen_version} > 60
+%define _tizen_atmos_decoder_enable 1
+%endif
+
 %{?_use_system_icu: %define __use_system_icu %{_use_system_icu}}
 # Product tv can't utilize system icu due to nacl dependency.
 %if "%{?profile}" != "tv" && %{tizen_version} == 60 && %{?_use_system_icu: 0}%{!?_use_system_icu: 1}
@@ -203,6 +208,9 @@ BuildRequires: pkgconfig(tv-resource-manager)
 BuildRequires: pkgconfig(tv-resource-information)
 BuildRequires: pkgconfig(vd-win-util)
 BuildRequires: pkgconfig(WebProduct)
+%if "%{_tizen_atmos_decoder_enable}" == "1"
+BuildRequires: pkgconfig(ais-control-settings)
+%endif
 %if %{tizen_version} >= 60
 BuildRequires: pkgconfig(resource-center-api)
 %endif
@@ -549,6 +557,7 @@ touch ./tizen_src/downloadable/ewk_api_wrapper_generator.py
 %endif
   "ozone_auto_platforms=false" \
   "enable_wrt_js=%{macro_to_bool __enable_wrt_js}" \
+  "tizen_atmos_decoder_enable=%{macro_to_bool _tizen_atmos_decoder_enable}" \
 %if 0%{?__enable_wrt_js}
   "xwalk_extension_path=\"%{__xwalk_extension_path}\"" \
   "xwalk_extension_service_path=\"%{__xwalk_extension_service_path}\"" \
index 4a8adf9..1f886fd 100644 (file)
@@ -62,6 +62,9 @@
 #include "hdmicec_api.h"
 #include "tizen_src/chromium_impl/build/tizen_version.h"
 #include "tizen_src/chromium_impl/tizen/tizen_tv_platform.h"
+#if defined(ENABLE_ATMOS_DECODER)
+#include <audio_control_setting_managed.h>
+#endif
 #endif
 
 using blink::WebMediaSource;
@@ -1735,6 +1738,27 @@ bool MediaSource::IsAV1SupportedOnTizen() {
 #endif
 }
 
+bool IsAtmosDecodingSupportedOnTizen(const ContentType& content_type) {
+#if defined(ENABLE_ATMOS_DECODER)
+  int atmos_support = 0;
+  // audio_ctrl_setting_get_atmos_capability() checks if TV can decode ATMOS
+  // itself. The function returns 0 when 1) The sound output is not a TV
+  // speaker. 2) Menu > Sound > Expert Settings > Dolby ATMOS menu OFF. 3) In
+  // case of Multiview mode. 4) In VR360 mode.
+  AUDIO_CTRL_SETTING_E ret = AUDIO_CTRL_SETTING_ERR_NONE;
+  ret = audio_ctrl_setting_get_atmos_capability(&atmos_support);
+  if (ret != AUDIO_CTRL_SETTING_ERR_NONE) {
+    LOG(WARNING) << "[ATMOS] AUDIO_CTRL_SETTING_ERR: " << ret;
+  }
+  if (atmos_support == 1 &&
+      content_type.Parameter("codecs").FindIgnoringCase("ec-3") != kNotFound &&
+      content_type.Parameter("channels").ToInt() <= 8) {
+    return true;
+  }
+#endif
+  return false;
+}
+
 bool MediaSource::IsCodecAndMediaTypeSupported(
     const ContentType& content_type) {
   DVLOG(1) << __func__ << "MediaSource Extention Type (W="
@@ -1763,7 +1787,10 @@ bool MediaSource::IsCodecAndMediaTypeSupported(
   }
 
   String features = content_type.Parameter("features");
-  if (!features.empty()) {
+  if (features == dolby_eac3_atmos) {
+    return IsAtmosDecodingSupportedOnTizen(content_type);
+  } else if (!features.empty()) {
+    LOG(WARNING) << "The features has invalid parameter: " << features;
     return false;
   }
 
index 7d3f2a8..4721b99 100644 (file)
@@ -670,6 +670,19 @@ if (tizen_multimedia) {
   }
 }
 
+config("audio_ctrl_setting") {
+  if (tizen_atmos_decoder_enable) {
+    ldflags = [ "-laudio_ctrl_setting" ]
+  }
+}
+
+tizen_pkg_config("libaudio_ctrl_setting") {
+  packages = []
+  if (tizen_atmos_decoder_enable) {
+    packages = [ "ais-control-settings" ]
+  }
+}
+
 tizen_pkg_config("libmm-player") {
   packages = []
   if (is_tizen) {
index 0c73e19..0773b06 100644 (file)
@@ -71,6 +71,9 @@ config("tizen_feature_flags") {
     if (tizen_audio_io) {
       defines += [ "TIZEN_MULTIMEDIA_USE_CAPI_AUDIO_IO" ]
     }
+    if (tizen_atmos_decoder_enable) {
+      defines += [ "ENABLE_ATMOS_DECODER" ]
+    }
     if (tizen_autofill) {
       defines += [ "TIZEN_AUTOFILL" ]
       if (tizen_autofill_fw) {
index c754301..027b580 100644 (file)
@@ -53,6 +53,7 @@ declare_args() {
   enable_ewk_interface = false
 
   enable_wrt_js = false
+  tizen_atmos_decoder_enable = false
   tizen_pepper_extensions = false
 
   # Tizen multimedia related
index 02bc620..7b41f67 100644 (file)
@@ -120,6 +120,13 @@ if (tizen_multimedia) {
     ]
   }
 
+  if (tizen_atmos_decoder_enable) {
+    external_media_video_decode_config += [
+      "//tizen_src/build:libaudio_ctrl_setting",
+      "//tizen_src/build:audio_ctrl_setting",
+    ]
+  }
+
   external_media_capture_config += [
     "//tizen_src/build:capi-media-camera",
     "//tizen_src/build:libcapi-media-camera",
index 9da8a8c..dd84743 100644 (file)
@@ -277,6 +277,9 @@ void EWebContext::SetTizenAppId(const std::string& tizen_app_id) {
     auto* plugin = &HbbtvDynamicPlugin::Get();
     plugin->Init(injected_bundle_path_);
   }
+  // Keep tizen app id into CommandLine in order to access it
+  // from all over the browser process.
+  command_line.AppendSwitchASCII(switches::kTizenAppId, tizen_app_id_);
 #endif  // IS_TIZEN_TV
 #endif  // IS_TIZEN
 }