diff options
author | fuzzard <fuzzard@users.noreply.github.com> | 2023-09-02 14:33:06 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-02 14:33:06 +1000 |
commit | e6d107d9ae00259e4659ba583a6db99c0959f4c2 (patch) | |
tree | 1ff7d8a9cee8830a1baadb2cbf24b57d61bd59d7 | |
parent | b76433779a5cca839b913723f35d98d63532d5ed (diff) | |
parent | e8dc309944ee64c941d605a7d221ca65eb5c151d (diff) | |
download | xbmc-e6d107d9ae00259e4659ba583a6db99c0959f4c2.tar.xz |
Merge pull request #23595 from quietvoid/android_av1_dovi
[Android] MediaCodec: Add support for AV1 Dolby Vision codec selection
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp | 37 | ||||
-rw-r--r-- | xbmc/windowing/android/AndroidUtils.cpp | 11 | ||||
-rw-r--r-- | xbmc/windowing/android/AndroidUtils.h | 1 |
3 files changed, 40 insertions, 9 deletions
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp index b966607aef..31bf35bfe5 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp @@ -531,20 +531,17 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio if (isDvhe || isDvh1) { - bool displaySupportsDovi = CAndroidUtils::GetDisplayHDRCapabilities().SupportsDolbyVision(); - bool mediaCodecSupportsDovi = - CAndroidUtils::SupportsMediaCodecMimeType("video/dolby-vision"); - - CLog::Log(LOGDEBUG, - "CDVDVideoCodecAndroidMediaCodec::Open Dolby Vision playback support: " - "Display: {}, MediaCodec: {}", - displaySupportsDovi, mediaCodecSupportsDovi); + bool displaySupportsDovi{false}; + bool mediaCodecSupportsDovi{false}; + std::tie(displaySupportsDovi, mediaCodecSupportsDovi) = + CAndroidUtils::GetDolbyVisionCapabilities(); // For Dolby Vision profiles that don't have HDR10 fallback, always use // the dvhe decoder even if the display not supports Dolby Vision. // For profiles that has HDR10 fallback (7, 8) is better use HEVC decoder to // ensure HDR10 output if display is not DV capable. - bool notHasHDR10fallback = (m_hints.dovi.dv_profile == 4 || m_hints.dovi.dv_profile == 5); + const bool notHasHDR10fallback = + (m_hints.dovi.dv_profile == 4 || m_hints.dovi.dv_profile == 5); if (mediaCodecSupportsDovi && (displaySupportsDovi || notHasHDR10fallback)) { @@ -634,6 +631,28 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio } m_mime = "video/av01"; m_formatname = "amc-av1"; + + if (m_hints.hdrType == StreamHdrType::HDR_TYPE_DOLBYVISION && m_hints.dovi.dv_profile == 10) + { + bool displaySupportsDovi{false}; + bool mediaCodecSupportsDovi{false}; + std::tie(displaySupportsDovi, mediaCodecSupportsDovi) = + CAndroidUtils::GetDolbyVisionCapabilities(); + + const bool notHasHDRfallback = (m_hints.dovi.dv_bl_signal_compatibility_id == 0 || + m_hints.dovi.dv_bl_signal_compatibility_id == 2 || + m_hints.dovi.dv_bl_signal_compatibility_id == 3); + + if (mediaCodecSupportsDovi && (displaySupportsDovi || notHasHDRfallback)) + { + m_mime = "video/dolby-vision"; + m_formatname = "amc-dav1"; + profile = CJNIBase::GetSDKVersion() >= 30 + ? CJNIMediaCodecInfoCodecProfileLevel::DolbyVisionProfileDvav110 + : 1024; + } + } + m_hints.extradata = {}; break; } diff --git a/xbmc/windowing/android/AndroidUtils.cpp b/xbmc/windowing/android/AndroidUtils.cpp index 8c61faeedb..43f3c9e725 100644 --- a/xbmc/windowing/android/AndroidUtils.cpp +++ b/xbmc/windowing/android/AndroidUtils.cpp @@ -438,3 +438,14 @@ bool CAndroidUtils::SupportsMediaCodecMimeType(const std::string& mimeType) return false; } + +std::pair<bool, bool> CAndroidUtils::GetDolbyVisionCapabilities() +{ + const bool displaySupportsDovi = GetDisplayHDRCapabilities().SupportsDolbyVision(); + const bool mediaCodecSupportsDovi = SupportsMediaCodecMimeType("video/dolby-vision"); + + CLog::Log(LOGDEBUG, "CAndroidUtils::GetDolbyVisionCapabilities Display: {}, MediaCodec: {}", + displaySupportsDovi, mediaCodecSupportsDovi); + + return std::make_pair(displaySupportsDovi, mediaCodecSupportsDovi); +} diff --git a/xbmc/windowing/android/AndroidUtils.h b/xbmc/windowing/android/AndroidUtils.h index 426baee801..ee110654ff 100644 --- a/xbmc/windowing/android/AndroidUtils.h +++ b/xbmc/windowing/android/AndroidUtils.h @@ -46,6 +46,7 @@ public: static std::vector<int> GetDisplaySupportedHdrTypes(); static CHDRCapabilities GetDisplayHDRCapabilities(); + static std::pair<bool, bool> GetDolbyVisionCapabilities(); protected: mutable int m_width; |