From da87b4aadc5c56c4853bc618eab31568521c06bb Mon Sep 17 00:00:00 2001 From: peng1xiao Date: Thu, 21 Mar 2024 17:31:08 +0800 Subject: [PATCH] [M120 Migration][MM] Supporting ATMOS decoding & checking ATMOS decoding capability - 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 --- packaging/chromium-efl.spec | 9 +++++++ .../renderer/modules/mediasource/media_source.cc | 29 +++++++++++++++++++++- tizen_src/build/BUILD.gn | 13 ++++++++++ tizen_src/build/config/BUILD.gn | 3 +++ tizen_src/build/config/tizen_features.gni | 1 + tizen_src/chromium_impl/media/media_efl.gni | 7 ++++++ tizen_src/ewk/efl_integration/eweb_context.cc | 3 +++ 7 files changed, 64 insertions(+), 1 deletion(-) diff --git a/packaging/chromium-efl.spec b/packaging/chromium-efl.spec index ccc8e52..030e38f 100644 --- a/packaging/chromium-efl.spec +++ b/packaging/chromium-efl.spec @@ -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}\"" \ diff --git a/third_party/blink/renderer/modules/mediasource/media_source.cc b/third_party/blink/renderer/modules/mediasource/media_source.cc index 4a8adf9..1f886fd 100644 --- a/third_party/blink/renderer/modules/mediasource/media_source.cc +++ b/third_party/blink/renderer/modules/mediasource/media_source.cc @@ -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 +#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; } diff --git a/tizen_src/build/BUILD.gn b/tizen_src/build/BUILD.gn index 7d3f2a8..4721b99 100644 --- a/tizen_src/build/BUILD.gn +++ b/tizen_src/build/BUILD.gn @@ -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) { diff --git a/tizen_src/build/config/BUILD.gn b/tizen_src/build/config/BUILD.gn index 0c73e19..0773b06 100644 --- a/tizen_src/build/config/BUILD.gn +++ b/tizen_src/build/config/BUILD.gn @@ -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) { diff --git a/tizen_src/build/config/tizen_features.gni b/tizen_src/build/config/tizen_features.gni index c754301..027b580 100644 --- a/tizen_src/build/config/tizen_features.gni +++ b/tizen_src/build/config/tizen_features.gni @@ -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 diff --git a/tizen_src/chromium_impl/media/media_efl.gni b/tizen_src/chromium_impl/media/media_efl.gni index 02bc620..7b41f67 100644 --- a/tizen_src/chromium_impl/media/media_efl.gni +++ b/tizen_src/chromium_impl/media/media_efl.gni @@ -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", diff --git a/tizen_src/ewk/efl_integration/eweb_context.cc b/tizen_src/ewk/efl_integration/eweb_context.cc index 9da8a8c..dd84743 100644 --- a/tizen_src/ewk/efl_integration/eweb_context.cc +++ b/tizen_src/ewk/efl_integration/eweb_context.cc @@ -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 } -- 2.7.4