add maximum resolution user setting

This commit is contained in:
Charles Ewert 2023-09-01 12:45:00 -04:00
parent 5be0fea3fb
commit b1eaa25273
3 changed files with 136 additions and 70 deletions

View File

@ -1129,14 +1129,34 @@
<translation>Audio Codec Support</translation>
<extracomment>Settings Menu - Title of option</extracomment>
</message>
<message>
<source>Direct playing</source>
<translation>Direct playing</translation>
</message>
<message>
<source>Direct playing</source>
<translation>Direct playing</translation>
</message>
<message>
<source>The source file is entirely compatible with this client and the session is receiving the file without modifications.</source>
<translation>The source file is entirely compatible with this client and the session is receiving the file without modifications.</translation>
<extracomment>Direct play info box text in GetPlaybackInfoTask.brs</extracomment>
</message>
<message>
<source>Maximum Resolution</source>
<translation>Maximum Resolution</translation>
<extracomment>User Setting - Title</extracomment>
</message>
<message>
<source>Set the maximum resolution when playing video files on this device.</source>
<translation>Set the maximum resolution when playing video files on this device.</translation>
<extracomment>User Setting - Description</extracomment>
</message>
<message>
<source>Off - Attempt to play all resolutions</source>
<translation>Off - Attempt to play all resolutions</translation>
<extracomment>User Setting - Option title</extracomment>
</message>
<message>
<source>Auto - Use TV resolution</source>
<translation>Auto - Use TV resolution</translation>
<extracomment>User Setting - Option title</extracomment>
</message>
</context>
</TS>
</TS>

View File

@ -36,6 +36,47 @@
}
]
},
{
"title": "Maximum Resolution",
"description": "Set the maximum resolution when playing video files on this device.",
"settingName": "playback.resolution",
"type": "radio",
"default": "auto",
"options": [
{
"title": "Off - Attempt to play all resolutions",
"id": "off"
},
{
"title": "Auto - Use TV resolution",
"id": "auto"
},
{
"title": "360p",
"id": "360"
},
{
"title": "480p",
"id": "480"
},
{
"title": "720p",
"id": "720"
},
{
"title": "10800p",
"id": "1080"
},
{
"title": "4k",
"id": "2160"
},
{
"title": "8k",
"id": "4320"
}
]
},
{
"title": "Video Codec Support",
"description": "Enable or disable Direct Play support for certain codecs.",

View File

@ -411,7 +411,42 @@ function getDeviceProfile() as object
deviceProfile.TranscodingProfiles.push(mp4Array)
' Build CodecProfiles
'
' max resolution
maxResSetting = m.global.session.user.settings["playback.resolution"]
maxVideoHeight = invalid
maxVideoWidth = invalid
maxVideoHeight = maxResSetting
if maxResSetting = "auto"
maxVideoHeight = m.global.device.videoHeight
maxVideoWidth = m.global.device.videoWidth
else if maxResSetting = "360"
maxVideoWidth = "480"
else if maxResSetting = "480"
maxVideoWidth = "640"
else if maxResSetting = "720"
maxVideoWidth = "1280"
else if maxResSetting = "1080"
maxVideoWidth = "1920"
else if maxResSetting = "2160"
maxVideoWidth = "3840"
else if maxResSetting = "4320"
maxVideoWidth = "7680"
end if
maxVideoHeightArray = {
"Condition": "LessThanEqual",
"Property": "Width",
"Value": maxVideoWidth,
"IsRequired": true
}
maxVideoWidthArray = {
"Condition": "LessThanEqual",
"Property": "Height",
"Value": maxVideoHeight,
"IsRequired": true
}
' H264
h264Mp4LevelSupported = 0.0
h264TsLevelSupported = 0.0
@ -465,21 +500,15 @@ function getDeviceProfile() as object
"Property": "VideoRangeType",
"Value": h264VideoRangeTypes,
"IsRequired": false
},
{
"Condition": "LessThanEqual",
"Property": "Width",
"Value": m.global.device.videoWidth,
"IsRequired": true
},
{
"Condition": "LessThanEqual",
"Property": "Height",
"Value": m.global.device.videoHeight,
"IsRequired": true
}
]
}
' set max resolution
if maxResSetting <> "off"
codecProfileArray.Conditions.push(maxVideoHeightArray)
codecProfileArray.Conditions.push(maxVideoWidthArray)
end if
' check user setting before adding video level restrictions
if not m.global.session.user.settings["playback.tryDirect.h264ProfileLevel"]
codecProfileArray.Conditions.push({
@ -519,22 +548,16 @@ function getDeviceProfile() as object
"Property": "VideoLevel",
"Value": mpeg2Levels.join("|"),
"IsRequired": false
},
{
"Condition": "LessThanEqual",
"Property": "Width",
"Value": m.global.device.videoWidth,
"IsRequired": true
},
{
"Condition": "LessThanEqual",
"Property": "Height",
"Value": m.global.device.videoHeight,
"IsRequired": true
},
}
]
}
' set max resolution
if maxResSetting <> "off"
codecProfileArray.Conditions.push(maxVideoHeightArray)
codecProfileArray.Conditions.push(maxVideoWidthArray)
end if
' set bitrate restrictions based on user settings
bitRateArray = GetBitRateLimit("mpeg2")
if bitRateArray.count() > 0
@ -593,22 +616,16 @@ function getDeviceProfile() as object
"Property": "VideoLevel",
"Value": (120 * av1HighestLevel).ToStr(),
"IsRequired": false
},
{
"Condition": "LessThanEqual",
"Property": "Width",
"Value": m.global.device.videoWidth,
"IsRequired": true
},
{
"Condition": "LessThanEqual",
"Property": "Height",
"Value": m.global.device.videoHeight,
"IsRequired": true
},
}
]
}
' set max resolution
if maxResSetting <> "off"
codecProfileArray.Conditions.push(maxVideoHeightArray)
codecProfileArray.Conditions.push(maxVideoWidthArray)
end if
' set bitrate restrictions based on user settings
bitRateArray = GetBitRateLimit("av1")
if bitRateArray.count() > 0
@ -672,22 +689,16 @@ function getDeviceProfile() as object
"Property": "VideoRangeType",
"Value": hevcVideoRangeTypes,
"IsRequired": false
},
{
"Condition": "LessThanEqual",
"Property": "Width",
"Value": m.global.device.videoWidth,
"IsRequired": true
},
{
"Condition": "LessThanEqual",
"Property": "Height",
"Value": m.global.device.videoHeight,
"IsRequired": true
},
}
]
}
' set max resolution
if maxResSetting <> "off"
codecProfileArray.Conditions.push(maxVideoHeightArray)
codecProfileArray.Conditions.push(maxVideoWidthArray)
end if
' check user setting before adding VideoLevel restrictions
if not m.global.session.user.settings["playback.tryDirect.hevcProfileLevel"]
codecProfileArray.Conditions.push({
@ -732,22 +743,16 @@ function getDeviceProfile() as object
"Property": "VideoRangeType",
"Value": vp9VideoRangeTypes,
"IsRequired": false
},
{
"Condition": "LessThanEqual",
"Property": "Width",
"Value": m.global.device.videoWidth,
"IsRequired": true
},
{
"Condition": "LessThanEqual",
"Property": "Height",
"Value": m.global.device.videoHeight,
"IsRequired": true
},
}
]
}
' set max resolution
if maxResSetting <> "off"
codecProfileArray.Conditions.push(maxVideoHeightArray)
codecProfileArray.Conditions.push(maxVideoWidthArray)
end if
' set bitrate restrictions based on user settings
bitRateArray = GetBitRateLimit("vp9")
if bitRateArray.count() > 0