|
362 | 362 | } |
363 | 363 |
|
364 | 364 | ' 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 |
367 | 370 |
|
368 | 371 | ' add user-selected preferred codec to the front of the list |
369 | 372 | if globalUserSettings["playback.preferredAudioCodec"] <> "auto" |
|
397 | 400 | "mpeg2": {}, |
398 | 401 | "av1": {} |
399 | 402 | } |
400 | | - maxResSetting = globalUserSettings["playback.resolution.max"] |
401 | 403 | di = CreateObject("roDeviceInfo") |
402 | 404 | maxHeightArray = getMaxHeightArray() |
403 | 405 |
|
|
622 | 624 | end if |
623 | 625 |
|
624 | 626 | ' set max resolution |
625 | | - if globalUserSettings["playback.resolution.mode"] = "everything" and maxResSetting <> "off" |
| 627 | + if maxHeightArray.count() > 0 |
626 | 628 | h264ProfileArray.Conditions.push(maxHeightArray) |
627 | 629 | end if |
628 | 630 |
|
|
658 | 660 | } |
659 | 661 |
|
660 | 662 | ' set max resolution |
661 | | - if globalUserSettings["playback.resolution.mode"] = "everything" and maxResSetting <> "off" |
| 663 | + if maxHeightArray.count() > 0 |
662 | 664 | mpeg2ProfileArray.Conditions.push(maxHeightArray) |
663 | 665 | end if |
664 | 666 |
|
|
710 | 712 | } |
711 | 713 |
|
712 | 714 | ' set max resolution |
713 | | - if globalUserSettings["playback.resolution.mode"] = "everything" and maxResSetting <> "off" |
| 715 | + if maxHeightArray.count() > 0 |
714 | 716 | av1ProfileArray.Conditions.push(maxHeightArray) |
715 | 717 | end if |
716 | 718 |
|
|
778 | 780 | end if |
779 | 781 |
|
780 | 782 | ' set max resolution |
781 | | - if globalUserSettings["playback.resolution.mode"] = "everything" and maxResSetting <> "off" |
| 783 | + if maxHeightArray.count() > 0 |
782 | 784 | hevcProfileArray.Conditions.push(maxHeightArray) |
783 | 785 | end if |
784 | 786 |
|
|
836 | 838 | } |
837 | 839 |
|
838 | 840 | ' set max resolution |
839 | | - if globalUserSettings["playback.resolution.mode"] = "everything" and maxResSetting <> "off" |
| 841 | + if maxHeightArray.count() > 0 |
840 | 842 | vp9ProfileArray.Conditions.push(maxHeightArray) |
841 | 843 | end if |
842 | 844 |
|
|
929 | 931 | return {} |
930 | 932 | end function |
931 | 933 |
|
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() |
934 | 940 |
|
935 | | - maxVideoHeight = maxResSetting |
936 | | - autoVideoHeight = m.global.device.videoHeight |
| 941 | + maxVideoHeight = 1080 ' default to 1080p in case all our validation checks fail |
937 | 942 |
|
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 |
940 | 952 | end if |
941 | 953 |
|
942 | 954 | return { |
943 | 955 | "Condition": "LessThanEqual", |
944 | 956 | "Property": "Height", |
945 | | - "Value": maxVideoHeight, |
946 | | - "IsRequired": true |
| 957 | + "Value": maxVideoHeight.toStr(), |
| 958 | + "IsRequired": isRequired |
947 | 959 | } |
948 | 960 | end function |
949 | 961 |
|
|
0 commit comments