Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve direct play support for HDR files #1989

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 25 additions & 43 deletions source/utils/deviceCapabilities.bs
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,7 @@ end function
function getCodecProfiles() as object
myGlobal = m.global
globalUserSettings = myGlobal.session.user.settings
displayMaxBitDepth = myGlobal.device.videoBitDepth
if displayMaxBitDepth = invalid
displayMaxBitDepth = "8"
else
displayMaxBitDepth = displayMaxBitDepth.toStr()
end if

codecProfiles = []
profileSupport = {
"h264": {},
Expand Down Expand Up @@ -562,27 +557,44 @@ function getCodecProfiles() as object
hevcVideoRangeTypes = "SDR"
vp9VideoRangeTypes = "SDR"
av1VideoRangeTypes = "SDR"
canPlayDovi = false

if canPlay4k()
dp = di.GetDisplayProperties()

if dp.DolbyVision
canPlayDovi = true

h264VideoRangeTypes = h264VideoRangeTypes + "|DOVI|DOVIWithSDR"
hevcVideoRangeTypes = hevcVideoRangeTypes + "|DOVI|DOVIWithSDR"
av1VideoRangeTypes = av1VideoRangeTypes + "|DOVI|DOVIWithSDR"
end if

if dp.Hdr10
hevcVideoRangeTypes = hevcVideoRangeTypes + "|HDR10"
vp9VideoRangeTypes = vp9VideoRangeTypes + "|HDR10"
av1VideoRangeTypes = av1VideoRangeTypes + "|HDR10"

if canPlayDovi
hevcVideoRangeTypes = hevcVideoRangeTypes + "|DOVIWithHDR10"
av1VideoRangeTypes = av1VideoRangeTypes + "|DOVIWithHDR10"
end if
end if

if dp.Hdr10Plus
av1VideoRangeTypes = av1VideoRangeTypes + "|HDR10+"
end if

if dp.HLG
hevcVideoRangeTypes = hevcVideoRangeTypes + "|HLG"
vp9VideoRangeTypes = vp9VideoRangeTypes + "|HLG"
av1VideoRangeTypes = av1VideoRangeTypes + "|HLG"
end if
if dp.DolbyVision
h264VideoRangeTypes = h264VideoRangeTypes + "|DOVI"
hevcVideoRangeTypes = hevcVideoRangeTypes + "|DOVI"
'vp9VideoRangeTypes = vp9VideoRangeTypes + ",DOVI" no evidence that vp9 can hold DOVI
av1VideoRangeTypes = av1VideoRangeTypes + "|DOVI"

if canPlayDovi
hevcVideoRangeTypes = hevcVideoRangeTypes + "|DOVIWithHLG"
vp9VideoRangeTypes = vp9VideoRangeTypes + "|DOVIWithHLG"
av1VideoRangeTypes = av1VideoRangeTypes + "|DOVIWithHLG"
end if
end if
end if

Expand Down Expand Up @@ -614,12 +626,6 @@ function getCodecProfiles() as object
"Value": "true",
"IsRequired": false
},
{
"Condition": "LessThanEqual",
"Property": "VideoBitDepth",
"Value": "8",
"IsRequired": false
},
{
"Condition": "EqualsAny",
"Property": "VideoProfile",
Expand Down Expand Up @@ -679,13 +685,7 @@ function getCodecProfiles() as object
"Property": "VideoLevel",
"Value": mpeg2Levels.join("|"),
"IsRequired": false
},
{
"Condition": "LessThanEqual",
"Property": "VideoBitDepth",
"Value": displayMaxBitDepth,
"IsRequired": false
},
}
]
}

Expand Down Expand Up @@ -721,12 +721,6 @@ function getCodecProfiles() as object
"Type": "Video",
"Codec": "av1",
"Conditions": [
{
"Condition": "LessThanEqual",
"Property": "VideoBitDepth",
"Value": displayMaxBitDepth,
"IsRequired": false
},
{
"Condition": "EqualsAny",
"Property": "VideoProfile",
Expand Down Expand Up @@ -786,12 +780,6 @@ function getCodecProfiles() as object
"Type": "Video",
"Codec": "hevc",
"Conditions": [
{
"Condition": "LessThanEqual",
"Property": "VideoBitDepth",
"Value": displayMaxBitDepth,
"IsRequired": false
},
{
"Condition": "NotEquals",
"Property": "IsAnamorphic",
Expand Down Expand Up @@ -861,12 +849,6 @@ function getCodecProfiles() as object
"Type": "Video",
"Codec": "vp9",
"Conditions": [
{
"Condition": "LessThanEqual",
"Property": "VideoBitDepth",
"Value": displayMaxBitDepth,
"IsRequired": false
},
{
"Condition": "EqualsAny",
"Property": "VideoProfile",
Expand Down
7 changes: 2 additions & 5 deletions source/utils/globals.bs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,8 @@ sub SaveDeviceToGlobal()
print "ERROR parsing deviceInfo.GetVideoMode()"
end if
videoWidth = heightToWidth[videoHeight]
if videoHeight = "2160" and extraData = "b10"
bitDepth = 10
else if videoHeight = "4320"
bitDepth = 12
end if
if extraData <> invalid and extraData = "b10" then bitDepth = 10
if videoHeight = "4320" then bitDepth = 12

m.global.addFields({
device: {
Expand Down
Loading