Skip to content

Commit

Permalink
Improve Dolby Vision detection for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
enscobici committed Jan 8, 2023
1 parent 17f9214 commit ffabc92
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Expand Up @@ -501,6 +501,16 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio
bool isDvhe = (m_hints.codec_tag == MKTAG('d', 'v', 'h', 'e'));
bool isDvh1 = (m_hints.codec_tag == MKTAG('d', 'v', 'h', '1'));

// some files don't have dvhe or dvh1 tag set up but have Dolby Vision side data
if (!isDvhe && !isDvh1 && m_hints.hdrType == StreamHdrType::HDR_TYPE_DOLBYVISION)
{
// page 10, table 2 from https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby-vision-streams-within-the-http-live-streaming-format-v2.0-13-november-2018.pdf
if (m_hints.codec_tag == MKTAG('h', 'v', 'c', '1'))
isDvh1 = true;
else
isDvhe = true;
}

if (isDvhe || isDvh1)
{
bool displaySupportsDovi = CAndroidUtils::GetDisplayHDRCapabilities().SupportsDolbyVision();
Expand Down
4 changes: 4 additions & 0 deletions xbmc/cores/VideoPlayer/DVDStreamInfo.cpp
Expand Up @@ -56,6 +56,7 @@ void CDVDStreamInfo::Clear()
ptsinvalid = false;
forced_aspect = false;
bitsperpixel = 0;
hdrType = StreamHdrType::HDR_TYPE_NONE;
colorSpace = AVCOL_SPC_UNSPECIFIED;
colorRange = AVCOL_RANGE_UNSPECIFIED;
colorPrimaries = AVCOL_PRI_UNSPECIFIED;
Expand Down Expand Up @@ -106,6 +107,7 @@ bool CDVDStreamInfo::Equal(const CDVDStreamInfo& right, int compare)
|| bitsperpixel != right.bitsperpixel
|| bitdepth != right.bitdepth
|| vfr != right.vfr
|| hdrType != right.hdrType
|| colorSpace != right.colorSpace
|| colorRange != right.colorRange
|| colorPrimaries != right.colorPrimaries
Expand Down Expand Up @@ -227,6 +229,7 @@ void CDVDStreamInfo::Assign(const CDVDStreamInfo& right, bool withextradata)
bitdepth = right.bitdepth;
vfr = right.vfr;
codecOptions = right.codecOptions;
hdrType = right.hdrType;
colorSpace = right.colorSpace;
colorRange = right.colorRange;
colorPrimaries = right.colorPrimaries;
Expand Down Expand Up @@ -296,6 +299,7 @@ void CDVDStreamInfo::Assign(const CDemuxStream& right, bool withextradata)
orientation = stream->iOrientation;
bitsperpixel = stream->iBitsPerPixel;
bitdepth = stream->bitDepth;
hdrType = stream->hdr_type;
colorSpace = stream->colorSpace;
colorRange = stream->colorRange;
colorPrimaries = stream->colorPrimaries;
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/VideoPlayer/DVDStreamInfo.h
Expand Up @@ -68,6 +68,7 @@ class CDVDStreamInfo
int orientation; // orientation of the video in degrees counter clockwise
int bitsperpixel;
int bitdepth;
StreamHdrType hdrType;
AVColorSpace colorSpace;
AVColorRange colorRange;
AVColorPrimaries colorPrimaries;
Expand Down

0 comments on commit ffabc92

Please sign in to comment.