diff options
author | fuzzard <fuzzard@users.noreply.github.com> | 2023-03-04 04:54:56 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-04 04:54:56 +1000 |
commit | a792e413c3ae94b7ffbc87a3456269ba7ec19597 (patch) | |
tree | 4c7fee2e3abd0ca0034443bcf7be6324864acdde | |
parent | 691984402e2f4833d75408960e2a38cead5ddf4b (diff) | |
parent | 59317ccb46415c7aa5d698def283436354020029 (diff) |
Merge pull request #22882 from joseluismarti/color_range
[Android] Fix Color range mapping in MediaCodec
-rw-r--r-- | tools/depends/target/libandroidjni/LIBANDROIDJNI-VERSION | 4 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp | 35 |
2 files changed, 33 insertions, 6 deletions
diff --git a/tools/depends/target/libandroidjni/LIBANDROIDJNI-VERSION b/tools/depends/target/libandroidjni/LIBANDROIDJNI-VERSION index 7c066bc064..4dc5d9fceb 100644 --- a/tools/depends/target/libandroidjni/LIBANDROIDJNI-VERSION +++ b/tools/depends/target/libandroidjni/LIBANDROIDJNI-VERSION @@ -1,6 +1,6 @@ LIBNAME=libandroidjni -VERSION=6f2e746caa8a74af4ca56ac56ac529caadcde1cd +VERSION=4e2273a635aec4c51562f709d30bc10c3b14025a BASE_URL=https://github.com/xbmc/libandroidjni/archive ARCHIVE=$(VERSION).tar.gz -SHA512=a5e6c51f53ad008d3fe9bf87f025a1ea42f563ce2633dd571e5cccd2fce1dc2659ac7529120ae9df37256d1778a7eca01e802e6abd120eae6440d60690fdac4b +SHA512=5cebacf63a90bd61b6b2e511143645e97911287b093be4946a6f73063e2dae6088d4a443f0a719607609adaf89b281c0296b8f4efdd6faa3b835aee3488c5159 BYPRODUCT=libandroidjni.a diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp index 9abe25f38f..2d37fb8bb1 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp @@ -1391,8 +1391,25 @@ bool CDVDVideoCodecAndroidMediaCodec::ConfigureMediaCodec(void) if (CJNIBase::GetSDKVersion() >= 24) { - if (m_hints.colorRange != AVCOL_RANGE_UNSPECIFIED) - mediaformat.setInteger(CJNIMediaFormat::KEY_COLOR_RANGE, m_hints.colorRange); + switch (m_hints.colorRange) + { + case AVCOL_RANGE_UNSPECIFIED: + CLog::Log(LOGDEBUG, "CDVDVideoCodecAndroidMediaCodec::ConfigureMediaCodec Color range: " + "AVCOL_RANGE_UNSPECIFIED"); + break; + case AVCOL_RANGE_MPEG: + mediaformat.setInteger(CJNIMediaFormat::KEY_COLOR_RANGE, + CJNIMediaFormat::COLOR_RANGE_LIMITED); + break; + case AVCOL_RANGE_JPEG: + mediaformat.setInteger(CJNIMediaFormat::KEY_COLOR_RANGE, CJNIMediaFormat::COLOR_RANGE_FULL); + break; + default: + CLog::Log(LOGWARNING, + "CDVDVideoCodecAndroidMediaCodec::ConfigureMediaCodec Unhandled Color range: {}", + m_hints.colorRange); + break; + } if (m_hints.colorPrimaries != AVCOL_PRI_UNSPECIFIED) { @@ -1406,7 +1423,12 @@ bool CDVDVideoCodecAndroidMediaCodec::ConfigureMediaCodec(void) mediaformat.setInteger(CJNIMediaFormat::KEY_COLOR_STANDARD, CJNIMediaFormat::COLOR_STANDARD_BT2020); break; - default:; // do nothing + default: + CLog::Log( + LOGWARNING, + "CDVDVideoCodecAndroidMediaCodec::ConfigureMediaCodec Unhandled Color primaries: {}", + m_hints.colorPrimaries); + break; } } @@ -1430,7 +1452,12 @@ bool CDVDVideoCodecAndroidMediaCodec::ConfigureMediaCodec(void) mediaformat.setInteger(CJNIMediaFormat::KEY_COLOR_TRANSFER, CJNIMediaFormat::COLOR_TRANSFER_HLG); break; - default:; // do nothing + default: + CLog::Log(LOGWARNING, + "CDVDVideoCodecAndroidMediaCodec::ConfigureMediaCodec Unhandled Transfer " + "characteristic: {}", + m_hints.colorTransferCharacteristic); + break; } } std::vector<uint8_t> hdr_static_data = GetHDRStaticMetadata(); |