@@ -59,23 +59,24 @@ sub PostDeviceProfile()
59
59
end sub
60
60
61
61
function getDeviceProfile () as object
62
+ globalDevice = m .global .device
62
63
return {
63
64
"Name" : "Official Roku Client" ,
64
- "Id" : m . global . device .id ,
65
+ "Id" : globalDevice .id ,
65
66
"Identification" : {
66
- "FriendlyName" : m . global . device .friendlyName ,
67
- "ModelNumber" : m . global . device .model ,
67
+ "FriendlyName" : globalDevice .friendlyName ,
68
+ "ModelNumber" : globalDevice .model ,
68
69
"SerialNumber" : "string" ,
69
- "ModelName" : m . global . device .name ,
70
- "ModelDescription" : "Type: " + m . global . device .modelType ,
71
- "Manufacturer" : m . global . device .modelDetails .VendorName
70
+ "ModelName" : globalDevice .name ,
71
+ "ModelDescription" : "Type: " + globalDevice .modelType ,
72
+ "Manufacturer" : globalDevice .modelDetails .VendorName
72
73
},
73
- "FriendlyName" : m . global . device .friendlyName ,
74
- "Manufacturer" : m . global . device .modelDetails .VendorName ,
75
- "ModelName" : m . global . device .name ,
76
- "ModelDescription" : "Type: " + m . global . device .modelType ,
77
- "ModelNumber" : m . global . device .model ,
78
- "SerialNumber" : m . global . device .serial ,
74
+ "FriendlyName" : globalDevice .friendlyName ,
75
+ "Manufacturer" : globalDevice .modelDetails .VendorName ,
76
+ "ModelName" : globalDevice .name ,
77
+ "ModelDescription" : "Type: " + globalDevice .modelType ,
78
+ "ModelNumber" : globalDevice .model ,
79
+ "SerialNumber" : globalDevice .serial ,
79
80
"MaxStreamingBitrate" : 120000000 ,
80
81
"MaxStaticBitrate" : 100000000 ,
81
82
"MusicStreamingTranscodingBitrate" : 192000 ,
@@ -88,6 +89,7 @@ function getDeviceProfile() as object
88
89
end function
89
90
90
91
function GetDirectPlayProfiles () as object
92
+ globalUserSettings = m .global .session .user .settings
91
93
directPlayProfiles = []
92
94
di = CreateObject ("roDeviceInfo " )
93
95
' all possible containers
@@ -122,7 +124,7 @@ function GetDirectPlayProfiles() as object
122
124
audioCodecs = ["mp3" , "mp2" , "pcm" , "lpcm" , "wav" , "ac3" , "ac4" , "aiff" , "wma" , "flac" , "alac" , "aac" , "opus" , "dts" , "wmapro" , "vorbis" , "eac3" , "mpg123" ]
123
125
124
126
' check if hevc is disabled
125
- if m . global . session . user . settings ["playback.compatibility.disablehevc" ] = false
127
+ if globalUserSettings ["playback.compatibility.disablehevc" ] = false
126
128
videoCodecs .push ("hevc" )
127
129
end if
128
130
@@ -142,12 +144,12 @@ function GetDirectPlayProfiles() as object
142
144
end for
143
145
144
146
' user setting overrides
145
- if m . global . session . user . settings ["playback.mpeg4" ]
147
+ if globalUserSettings ["playback.mpeg4" ]
146
148
for each container in supportedCodecs
147
149
supportedCodecs [container ]["video" ].push ("mpeg4" )
148
150
end for
149
151
end if
150
- if m . global . session . user . settings ["playback.mpeg2" ]
152
+ if globalUserSettings ["playback.mpeg2" ]
151
153
for each container in supportedCodecs
152
154
supportedCodecs [container ]["video" ].push ("mpeg2video" )
153
155
end for
@@ -208,6 +210,7 @@ function GetDirectPlayProfiles() as object
208
210
end function
209
211
210
212
function getTranscodingProfiles () as object
213
+ globalUserSettings = m .global .session .user .settings
211
214
transcodingProfiles = []
212
215
213
216
di = CreateObject ("roDeviceInfo " )
@@ -224,7 +227,7 @@ function getTranscodingProfiles() as object
224
227
' in order of preference from left to right
225
228
audioCodecs = ["mp3" , "vorbis" , "opus" , "flac" , "alac" , "ac4" , "pcm" , "wma" , "wmapro" ]
226
229
surroundSoundCodecs = ["eac3" , "ac3" , "dts" ]
227
- if m . global . session . user . settings ["playback.forceDTS" ] = true
230
+ if globalUserSettings ["playback.forceDTS" ] = true
228
231
surroundSoundCodecs = ["dts" , "eac3" , "ac3" ]
229
232
end if
230
233
@@ -275,7 +278,7 @@ function getTranscodingProfiles() as object
275
278
end for
276
279
277
280
' HEVC / h265
278
- if m . global . session . user . settings ["playback.compatibility.disablehevc" ] = false
281
+ if globalUserSettings ["playback.compatibility.disablehevc" ] = false
279
282
for each container in transcodingContainers
280
283
if di .CanDecodeVideo ({ Codec : "hevc" , Container : container }).Result
281
284
if container = "mp4"
@@ -317,7 +320,7 @@ function getTranscodingProfiles() as object
317
320
end for
318
321
319
322
' MPEG2
320
- if m . global . session . user . settings ["playback.mpeg2" ]
323
+ if globalUserSettings ["playback.mpeg2" ]
321
324
for each container in transcodingContainers
322
325
if di .CanDecodeVideo ({ Codec : "mpeg2" , Container : container }).Result
323
326
if container = "mp4"
@@ -425,7 +428,7 @@ function getTranscodingProfiles() as object
425
428
}
426
429
427
430
' apply max res to transcoding profile
428
- if m . global . session . user . settings ["playback.resolution.max" ] <> "off"
431
+ if globalUserSettings ["playback.resolution.max" ] <> "off"
429
432
tsArray .Conditions = [getMaxHeightArray (), getMaxWidthArray ()]
430
433
mp4Array .Conditions = [getMaxHeightArray (), getMaxWidthArray ()]
431
434
end if
@@ -477,6 +480,7 @@ function getContainerProfiles() as object
477
480
end function
478
481
479
482
function getCodecProfiles () as object
483
+ globalUserSettings = m .global .session .user .settings
480
484
codecProfiles = []
481
485
profileSupport = {
482
486
"h264" : {},
@@ -487,7 +491,7 @@ function getCodecProfiles() as object
487
491
"mpeg2" : {},
488
492
"av1" : {}
489
493
}
490
- maxResSetting = m . global . session . user . settings ["playback.resolution.max" ]
494
+ maxResSetting = globalUserSettings ["playback.resolution.max" ]
491
495
di = CreateObject ("roDeviceInfo " )
492
496
maxHeightArray = getMaxHeightArray ()
493
497
maxWidthArray = getMaxWidthArray ()
@@ -662,7 +666,7 @@ function getCodecProfiles() as object
662
666
}
663
667
664
668
' check user setting before adding video level restrictions
665
- if not m . global . session . user . settings ["playback.tryDirect.h264ProfileLevel" ]
669
+ if not globalUserSettings ["playback.tryDirect.h264ProfileLevel" ]
666
670
h264ProfileArray .Conditions .push ({
667
671
"Condition" : "LessThanEqual" ,
668
672
"Property" : "VideoLevel" ,
@@ -672,7 +676,7 @@ function getCodecProfiles() as object
672
676
end if
673
677
674
678
' set max resolution
675
- if m . global . session . user . settings ["playback.resolution.mode" ] = "everything" and maxResSetting <> "off"
679
+ if globalUserSettings ["playback.resolution.mode" ] = "everything" and maxResSetting <> "off"
676
680
h264ProfileArray .Conditions .push (maxHeightArray )
677
681
h264ProfileArray .Conditions .push (maxWidthArray )
678
682
end if
@@ -687,7 +691,7 @@ function getCodecProfiles() as object
687
691
688
692
' MPEG2
689
693
' NOTE: the mpeg2 levels are being saved in the profileSupport array as if they were profiles
690
- if m . global . session . user . settings ["playback.mpeg2" ]
694
+ if globalUserSettings ["playback.mpeg2" ]
691
695
mpeg2Levels = []
692
696
for each level in profileSupport ["mpeg2" ]
693
697
if not arrayHasValue (mpeg2Levels , level )
@@ -709,7 +713,7 @@ function getCodecProfiles() as object
709
713
}
710
714
711
715
' set max resolution
712
- if m . global . session . user . settings ["playback.resolution.mode" ] = "everything" and maxResSetting <> "off"
716
+ if globalUserSettings ["playback.resolution.mode" ] = "everything" and maxResSetting <> "off"
713
717
mpeg2ProfileArray .Conditions .push (maxHeightArray )
714
718
mpeg2ProfileArray .Conditions .push (maxWidthArray )
715
719
end if
@@ -762,7 +766,7 @@ function getCodecProfiles() as object
762
766
}
763
767
764
768
' set max resolution
765
- if m . global . session . user . settings ["playback.resolution.mode" ] = "everything" and maxResSetting <> "off"
769
+ if globalUserSettings ["playback.resolution.mode" ] = "everything" and maxResSetting <> "off"
766
770
av1ProfileArray .Conditions .push (maxHeightArray )
767
771
av1ProfileArray .Conditions .push (maxWidthArray )
768
772
end if
@@ -776,7 +780,7 @@ function getCodecProfiles() as object
776
780
codecProfiles .push (av1ProfileArray )
777
781
end if
778
782
779
- if not m . global . session . user . settings ["playback.compatibility.disablehevc" ] and di .CanDecodeVideo ({ Codec : "hevc" }).Result
783
+ if not globalUserSettings ["playback.compatibility.disablehevc" ] and di .CanDecodeVideo ({ Codec : "hevc" }).Result
780
784
hevcLevelSupported = 0.0
781
785
hevcAssProfiles = {}
782
786
@@ -821,7 +825,7 @@ function getCodecProfiles() as object
821
825
}
822
826
823
827
' check user setting before adding VideoLevel restrictions
824
- if not m . global . session . user . settings ["playback.tryDirect.hevcProfileLevel" ]
828
+ if not globalUserSettings ["playback.tryDirect.hevcProfileLevel" ]
825
829
hevcProfileArray .Conditions .push ({
826
830
"Condition" : "LessThanEqual" ,
827
831
"Property" : "VideoLevel" ,
@@ -831,7 +835,7 @@ function getCodecProfiles() as object
831
835
end if
832
836
833
837
' set max resolution
834
- if m . global . session . user . settings ["playback.resolution.mode" ] = "everything" and maxResSetting <> "off"
838
+ if globalUserSettings ["playback.resolution.mode" ] = "everything" and maxResSetting <> "off"
835
839
hevcProfileArray .Conditions .push (maxHeightArray )
836
840
hevcProfileArray .Conditions .push (maxWidthArray )
837
841
end if
@@ -890,7 +894,7 @@ function getCodecProfiles() as object
890
894
}
891
895
892
896
' set max resolution
893
- if m . global . session . user . settings ["playback.resolution.mode" ] = "everything" and maxResSetting <> "off"
897
+ if globalUserSettings ["playback.resolution.mode" ] = "everything" and maxResSetting <> "off"
894
898
vp9ProfileArray .Conditions .push (maxHeightArray )
895
899
vp9ProfileArray .Conditions .push (maxWidthArray )
896
900
end if
@@ -931,8 +935,9 @@ function getSubtitleProfiles() as object
931
935
end function
932
936
933
937
function GetBitRateLimit (codec as string ) as object
934
- if m .global .session .user .settings ["playback.bitrate.maxlimited" ] = true
935
- userSetLimit = m .global .session .user .settings ["playback.bitrate.limit" ].ToInt ()
938
+ globalUserSettings = m .global .session .user .settings
939
+ if globalUserSettings ["playback.bitrate.maxlimited" ]
940
+ userSetLimit = globalUserSettings ["playback.bitrate.limit" ].ToInt ()
936
941
if isValid (userSetLimit ) and type (userSetLimit ) = "Integer" and userSetLimit > 0
937
942
userSetLimit *= 1000000
938
943
return {
@@ -984,13 +989,15 @@ function GetBitRateLimit(codec as string) as object
984
989
end function
985
990
986
991
function getMaxHeightArray () as object
987
- maxResSetting = m .global .session .user .settings ["playback.resolution.max" ]
992
+ myGlobal = m .global
993
+
994
+ maxResSetting = myGlobal .session .user .settings ["playback.resolution.max" ]
988
995
if maxResSetting = "off" then return {}
989
996
990
997
maxVideoHeight = maxResSetting
991
998
992
999
if maxResSetting = "auto"
993
- maxVideoHeight = m . global .device .videoHeight
1000
+ maxVideoHeight = myGlobal .device .videoHeight
994
1001
end if
995
1002
996
1003
return {
@@ -1002,13 +1009,15 @@ function getMaxHeightArray() as object
1002
1009
end function
1003
1010
1004
1011
function getMaxWidthArray () as object
1005
- maxResSetting = m .global .session .user .settings ["playback.resolution.max" ]
1012
+ myGlobal = m .global
1013
+
1014
+ maxResSetting = myGlobal .session .user .settings ["playback.resolution.max" ]
1006
1015
if maxResSetting = "off" then return {}
1007
1016
1008
1017
maxVideoWidth = invalid
1009
1018
1010
1019
if maxResSetting = "auto"
1011
- maxVideoWidth = m . global .device .videoWidth
1020
+ maxVideoWidth = myGlobal .device .videoWidth
1012
1021
else if maxResSetting = "360"
1013
1022
maxVideoWidth = "480"
1014
1023
else if maxResSetting = "480"
0 commit comments