Skip to content

Commit 5268514

Browse files
committed
Update code docs
1 parent 1d15bdf commit 5268514

2 files changed

Lines changed: 29 additions & 17 deletions

File tree

docs/module-deviceCapabilities.html

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

docs/source_utils_deviceCapabilities.bs.html

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,11 @@
362362
}
363363

364364
' apply max res to transcoding profile
365-
tsArray.Conditions = [getMaxHeightArray()]
366-
mp4Array.Conditions = [getMaxHeightArray()]
365+
maxHeightArray = getMaxHeightArray(true)
366+
if maxHeightArray.count() > 0
367+
tsArray.Conditions = [maxHeightArray]
368+
mp4Array.Conditions = [maxHeightArray]
369+
end if
367370

368371
' add user-selected preferred codec to the front of the list
369372
if globalUserSettings["playback.preferredAudioCodec"] <> "auto"
@@ -397,7 +400,6 @@
397400
"mpeg2": {},
398401
"av1": {}
399402
}
400-
maxResSetting = globalUserSettings["playback.resolution.max"]
401403
di = CreateObject("roDeviceInfo")
402404
maxHeightArray = getMaxHeightArray()
403405

@@ -622,7 +624,7 @@
622624
end if
623625

624626
' set max resolution
625-
if globalUserSettings["playback.resolution.mode"] = "everything" and maxResSetting <> "off"
627+
if maxHeightArray.count() > 0
626628
h264ProfileArray.Conditions.push(maxHeightArray)
627629
end if
628630

@@ -658,7 +660,7 @@
658660
}
659661

660662
' set max resolution
661-
if globalUserSettings["playback.resolution.mode"] = "everything" and maxResSetting <> "off"
663+
if maxHeightArray.count() > 0
662664
mpeg2ProfileArray.Conditions.push(maxHeightArray)
663665
end if
664666

@@ -710,7 +712,7 @@
710712
}
711713

712714
' set max resolution
713-
if globalUserSettings["playback.resolution.mode"] = "everything" and maxResSetting <> "off"
715+
if maxHeightArray.count() > 0
714716
av1ProfileArray.Conditions.push(maxHeightArray)
715717
end if
716718

@@ -778,7 +780,7 @@
778780
end if
779781

780782
' set max resolution
781-
if globalUserSettings["playback.resolution.mode"] = "everything" and maxResSetting <> "off"
783+
if maxHeightArray.count() > 0
782784
hevcProfileArray.Conditions.push(maxHeightArray)
783785
end if
784786

@@ -836,7 +838,7 @@
836838
}
837839

838840
' set max resolution
839-
if globalUserSettings["playback.resolution.mode"] = "everything" and maxResSetting <> "off"
841+
if maxHeightArray.count() > 0
840842
vp9ProfileArray.Conditions.push(maxHeightArray)
841843
end if
842844

@@ -929,21 +931,31 @@
929931
return {}
930932
end function
931933

932-
function getMaxHeightArray() as object
933-
maxResSetting = m.global.session.user.settings["playback.resolution.max"]
934+
function getMaxHeightArray(isRequired = false as boolean) as object
935+
userMaxHeight = m.global.session.user.settings["playback.resolution.max"]
936+
if userMaxHeight = invalid or userMaxHeight = "" then userMaxHeight = "auto"
937+
if userMaxHeight = "off" then return {}
938+
939+
deviceMaxHeight = m.global.device.videoHeight.ToInt()
934940

935-
maxVideoHeight = maxResSetting
936-
autoVideoHeight = m.global.device.videoHeight
941+
maxVideoHeight = 1080 ' default to 1080p in case all our validation checks fail
937942

938-
if maxResSetting = "auto" or maxVideoHeight.ToInt() > autoVideoHeight.ToInt()
939-
maxVideoHeight = autoVideoHeight
943+
if userMaxHeight = "auto"
944+
if isValid(deviceMaxHeight) and deviceMaxHeight <> 0 and deviceMaxHeight > maxVideoHeight
945+
maxVideoHeight = deviceMaxHeight
946+
end if
947+
else
948+
userMaxHeight = userMaxHeight.ToInt()
949+
if isValid(userMaxHeight) and userMaxHeight > 0 and userMaxHeight < maxVideoHeight
950+
maxVideoHeight = userMaxHeight
951+
end if
940952
end if
941953

942954
return {
943955
"Condition": "LessThanEqual",
944956
"Property": "Height",
945-
"Value": maxVideoHeight,
946-
"IsRequired": true
957+
"Value": maxVideoHeight.toStr(),
958+
"IsRequired": isRequired
947959
}
948960
end function
949961

0 commit comments

Comments
 (0)