Skip to content

Commit 2c5b925

Browse files
chore(docs): update code docs
1 parent d6d8b86 commit 2c5b925

6 files changed

Lines changed: 89 additions & 39 deletions

docs/components_ItemGrid_LoadVideoContentTask.bs.html

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -352,30 +352,8 @@
352352
tryDirectPlay = tryDirectPlay or (userSettings.playbackTryDirectHevcProfileLevel and videoStream.codec = "hevc")
353353

354354
' Check source resolution against hardware ceiling before allowing override
355-
if tryDirectPlay
356-
sourceHeight = 0
357-
sourceWidth = 0
358-
359-
if isValid(videoStream.Height)
360-
sourceHeight = videoStream.Height
361-
if type(sourceHeight) = "roString" or type(sourceHeight) = "String"
362-
sourceHeight = sourceHeight.toInt()
363-
end if
364-
end if
365-
366-
if isValid(videoStream.Width)
367-
sourceWidth = videoStream.Width
368-
if type(sourceWidth) = "roString" or type(sourceWidth) = "String"
369-
sourceWidth = sourceWidth.toInt()
370-
end if
371-
end if
372-
373-
' h264: Roku hardware ceiling is 1080p — 4K h264 is physically impossible to decode
374-
' Check both dimensions to catch ultrawide or non-standard aspect ratios
375-
if videoStream.codec = "h264" and (sourceHeight > 1080 or sourceWidth > 1920)
376-
tryDirectPlay = false
377-
end if
378-
' hevc: no additional guard needed — Roku supports up to 4K hevc natively
355+
if tryDirectPlay and not isWithinH264HardwareCeiling(videoStream)
356+
tryDirectPlay = false
379357
end if
380358
else
381359
tryDirectPlay = false

docs/data/search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/module-deviceCapabilities.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/source_api_Items.bs.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@
146146
end for
147147

148148
for each codecProfile in postData.DeviceProfile.CodecProfiles
149-
' Codec field is a comma-separated list of aliases (e.g. "h264,avc")
149+
' Codec field is a comma-separated list of aliases set by getCodecProfiles().
150+
' Known values: "h264,avc", "h265,hevc", "vp9", "vp8", "av1", "mpeg2video", "mpeg4".
151+
' Substring match is safe: no other codec contains "h264" as a substring.
150152
if isValid(codecProfile.Codec) and Instr(1, LCase(codecProfile.Codec), "h264") > 0
151153
applyResolutionCapToProfile(codecProfile, h264CapHeight, h264CapWidth, true)
152154
end if

docs/source_data_SessionDataTransformer.bs.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
settingsNode.playbackPlayDefaultAudioTrack = settingsData["playbackPlayDefaultAudioTrack"] ?? ""
142142
settingsNode.playbackPreferredMultichannelCodec = settingsData["playbackPreferredMultichannelCodec"] ?? ""
143143
settingsNode.playbackSubsOnlyText = toBoolean(settingsData["playbackSubsOnlyText"])
144+
settingsNode.playbackForceTranscodeAnamorphic = toBoolean(settingsData["playbackForceTranscodeAnamorphic"])
144145
settingsNode.playbackMpeg2 = toBoolean(settingsData["playbackMpeg2"])
145146
settingsNode.playbackMpeg4 = toBoolean(settingsData["playbackMpeg4"])
146147
settingsNode.playbackTryDirectH264ProfileLevel = toBoolean(settingsData["playbackTryDirectH264ProfileLevel"])

docs/source_utils_deviceCapabilities.bs.html

Lines changed: 81 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -836,12 +836,6 @@
836836
"Type": "Video",
837837
"Codec": "h264,avc",
838838
"Conditions": [
839-
{
840-
"Condition": "NotEquals",
841-
"Property": "IsAnamorphic",
842-
"Value": "true",
843-
"IsRequired": false
844-
},
845839
{
846840
"Condition": "EqualsAny",
847841
"Property": "VideoProfile",
@@ -869,6 +863,11 @@
869863
"IsRequired": false
870864
})
871865

866+
anamorphicCondition = getAnamorphicCondition()
867+
if anamorphicCondition.count() > 0
868+
h264ProfileArray.Conditions.push(anamorphicCondition)
869+
end if
870+
872871
' set max resolution
873872
h264ProfileArray.Conditions.Append(resolutionConditions)
874873

@@ -912,6 +911,11 @@
912911
mpeg2ProfileArray.Conditions.push(bitRateArray)
913912
end if
914913

914+
anamorphicCondition = getAnamorphicCondition()
915+
if anamorphicCondition.count() > 0
916+
mpeg2ProfileArray.Conditions.push(anamorphicCondition)
917+
end if
918+
915919
codecProfiles.push(mpeg2ProfileArray)
916920
end if
917921

@@ -933,6 +937,11 @@
933937
' set max resolution
934938
mpeg4ProfileArray.Conditions.Append(resolutionConditions)
935939

940+
anamorphicCondition = getAnamorphicCondition()
941+
if anamorphicCondition.count() > 0
942+
mpeg4ProfileArray.Conditions.push(anamorphicCondition)
943+
end if
944+
936945
codecProfiles.push(mpeg4ProfileArray)
937946
end if
938947

@@ -983,6 +992,11 @@
983992
av1ProfileArray.Conditions.push(bitRateArray)
984993
end if
985994

995+
anamorphicCondition = getAnamorphicCondition()
996+
if anamorphicCondition.count() > 0
997+
av1ProfileArray.Conditions.push(anamorphicCondition)
998+
end if
999+
9861000
codecProfiles.push(av1ProfileArray)
9871001
end if
9881002

@@ -1006,12 +1020,6 @@
10061020
"Type": "Video",
10071021
"Codec": "h265,hevc",
10081022
"Conditions": [
1009-
{
1010-
"Condition": "NotEquals",
1011-
"Property": "IsAnamorphic",
1012-
"Value": "true",
1013-
"IsRequired": false
1014-
},
10151023
{
10161024
"Condition": "EqualsAny",
10171025
"Property": "VideoProfile",
@@ -1047,6 +1055,11 @@
10471055
hevcProfileArray.Conditions.push(bitRateArray)
10481056
end if
10491057

1058+
anamorphicCondition = getAnamorphicCondition()
1059+
if anamorphicCondition.count() > 0
1060+
hevcProfileArray.Conditions.push(anamorphicCondition)
1061+
end if
1062+
10501063
codecProfiles.push(hevcProfileArray)
10511064
end if
10521065

@@ -1085,6 +1098,11 @@
10851098
vp9ProfileArray.Conditions.push(bitRateArray)
10861099
end if
10871100

1101+
anamorphicCondition = getAnamorphicCondition()
1102+
if anamorphicCondition.count() > 0
1103+
vp9ProfileArray.Conditions.push(anamorphicCondition)
1104+
end if
1105+
10881106
codecProfiles.push(vp9ProfileArray)
10891107
end if
10901108

@@ -1107,6 +1125,11 @@
11071125
' set max resolution
11081126
vp8ProfileArray.Conditions.Append(resolutionConditions)
11091127

1128+
anamorphicCondition = getAnamorphicCondition()
1129+
if anamorphicCondition.count() > 0
1130+
vp8ProfileArray.Conditions.push(anamorphicCondition)
1131+
end if
1132+
11101133
codecProfiles.push(vp8ProfileArray)
11111134
end if
11121135

@@ -1237,6 +1260,52 @@
12371260
return {}
12381261
end function
12391262

1263+
' Returns an IsAnamorphic codec profile condition when the user has enabled
1264+
' forced transcoding of anamorphic video. Returns empty object when disabled.
1265+
' @return {object} - Condition AA or empty AA
1266+
function getAnamorphicCondition() as object
1267+
if m.global.user.settings.playbackForceTranscodeAnamorphic
1268+
return {
1269+
"Condition": "NotEquals",
1270+
"Property": "IsAnamorphic",
1271+
"Value": "true",
1272+
"IsRequired": false
1273+
}
1274+
end if
1275+
return {}
1276+
end function
1277+
1278+
' Checks whether a video stream's resolution is within the h264 hardware
1279+
' decoding ceiling (1080p / 1920x1080). Returns true for non-h264 codecs
1280+
' since they have higher ceilings handled elsewhere.
1281+
' Handles Height/Width fields arriving as strings or integers, and defaults
1282+
' to 0 (within ceiling) when metadata is missing.
1283+
' @param videoStream {object} - MediaStream object with codec, Height, Width
1284+
' @return {boolean} - true if within ceiling or not h264, false if exceeds ceiling
1285+
function isWithinH264HardwareCeiling(videoStream as object) as boolean
1286+
if not isValid(videoStream) or not isValid(videoStream.codec) then return false
1287+
if videoStream.codec <> "h264" then return true
1288+
1289+
sourceHeight = 0
1290+
sourceWidth = 0
1291+
1292+
if isValid(videoStream.Height)
1293+
sourceHeight = videoStream.Height
1294+
if type(sourceHeight) = "roString" or type(sourceHeight) = "String"
1295+
sourceHeight = sourceHeight.toInt()
1296+
end if
1297+
end if
1298+
1299+
if isValid(videoStream.Width)
1300+
sourceWidth = videoStream.Width
1301+
if type(sourceWidth) = "roString" or type(sourceWidth) = "String"
1302+
sourceWidth = sourceWidth.toInt()
1303+
end if
1304+
end if
1305+
1306+
return sourceHeight <= 1080 and sourceWidth <= 1920
1307+
end function
1308+
12401309
function getResolutionConditions(isRequired = false as boolean) as object
12411310
userMaxHeight = m.global.user.settings.playbackResolutionMax
12421311
if userMaxHeight = invalid or userMaxHeight = "" then userMaxHeight = "auto"

0 commit comments

Comments
 (0)