aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Entities
diff options
context:
space:
mode:
authorvedant <12881174+viktory36@users.noreply.github.com>2024-03-23 16:39:49 +0300
committerGitHub <noreply@github.com>2024-03-23 07:39:49 -0600
commit3bbb57eb833f2ae0ada312da03ac0e15b6bb1f59 (patch)
treec18c1bf7e133241aceebb2fb902a245e2f9f1764 /MediaBrowser.Model/Entities
parent564fdfec93cfb03b987f1afe1f5edbd9160fdc12 (diff)
Add new VideoRangeTypes to fully support DoVi on webOS (#10469)
Diffstat (limited to 'MediaBrowser.Model/Entities')
-rw-r--r--MediaBrowser.Model/Entities/MediaStream.cs44
1 files changed, 28 insertions, 16 deletions
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs
index ae4a008bb..a620bc9b5 100644
--- a/MediaBrowser.Model/Entities/MediaStream.cs
+++ b/MediaBrowser.Model/Entities/MediaStream.cs
@@ -707,34 +707,46 @@ namespace MediaBrowser.Model.Entities
return (VideoRange.Unknown, VideoRangeType.Unknown);
}
- var colorTransfer = ColorTransfer;
-
- if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase))
- {
- return (VideoRange.HDR, VideoRangeType.HDR10);
- }
-
- if (string.Equals(colorTransfer, "arib-std-b67", StringComparison.OrdinalIgnoreCase))
- {
- return (VideoRange.HDR, VideoRangeType.HLG);
- }
-
var codecTag = CodecTag;
var dvProfile = DvProfile;
var rpuPresentFlag = RpuPresentFlag == 1;
var blPresentFlag = BlPresentFlag == 1;
var dvBlCompatId = DvBlSignalCompatibilityId;
- var isDoViHDRProfile = dvProfile == 5 || dvProfile == 7 || dvProfile == 8;
- var isDoViHDRFlag = rpuPresentFlag && blPresentFlag && (dvBlCompatId == 0 || dvBlCompatId == 1 || dvBlCompatId == 4);
+ var isDoViProfile = dvProfile == 5 || dvProfile == 7 || dvProfile == 8;
+ var isDoViFlag = rpuPresentFlag && blPresentFlag && (dvBlCompatId == 0 || dvBlCompatId == 1 || dvBlCompatId == 4 || dvBlCompatId == 2 || dvBlCompatId == 6);
- if ((isDoViHDRProfile && isDoViHDRFlag)
+ if ((isDoViProfile && isDoViFlag)
|| string.Equals(codecTag, "dovi", StringComparison.OrdinalIgnoreCase)
|| string.Equals(codecTag, "dvh1", StringComparison.OrdinalIgnoreCase)
|| string.Equals(codecTag, "dvhe", StringComparison.OrdinalIgnoreCase)
|| string.Equals(codecTag, "dav1", StringComparison.OrdinalIgnoreCase))
{
- return (VideoRange.HDR, VideoRangeType.DOVI);
+ return dvProfile switch
+ {
+ 5 => (VideoRange.HDR, VideoRangeType.DOVI),
+ 8 => dvBlCompatId switch
+ {
+ 1 => (VideoRange.HDR, VideoRangeType.DOVIWithHDR10),
+ 4 => (VideoRange.HDR, VideoRangeType.DOVIWithHLG),
+ 2 => (VideoRange.SDR, VideoRangeType.DOVIWithSDR),
+ // There is no other case to handle here as per Dolby Spec. Default case included for completeness and linting purposes
+ _ => (VideoRange.SDR, VideoRangeType.SDR)
+ },
+ 7 => (VideoRange.HDR, VideoRangeType.HDR10),
+ _ => (VideoRange.SDR, VideoRangeType.SDR)
+ };
+ }
+
+ var colorTransfer = ColorTransfer;
+
+ if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase))
+ {
+ return (VideoRange.HDR, VideoRangeType.HDR10);
+ }
+ else if (string.Equals(colorTransfer, "arib-std-b67", StringComparison.OrdinalIgnoreCase))
+ {
+ return (VideoRange.HDR, VideoRangeType.HLG);
}
return (VideoRange.SDR, VideoRangeType.SDR);