diff --git a/locale/en_US/translations.ts b/locale/en_US/translations.ts index 4dc3c490..363beafd 100644 --- a/locale/en_US/translations.ts +++ b/locale/en_US/translations.ts @@ -1129,14 +1129,34 @@ Audio Codec Support Settings Menu - Title of option - - Direct playing - Direct playing - + + Direct playing + Direct playing + The source file is entirely compatible with this client and the session is receiving the file without modifications. The source file is entirely compatible with this client and the session is receiving the file without modifications. Direct play info box text in GetPlaybackInfoTask.brs + + Maximum Resolution + Maximum Resolution + User Setting - Title + + + Set the maximum resolution when playing video files on this device. + Set the maximum resolution when playing video files on this device. + User Setting - Description + + + Off - Attempt to play all resolutions + Off - Attempt to play all resolutions + User Setting - Option title + + + Auto - Use TV resolution + Auto - Use TV resolution + User Setting - Option title + - + \ No newline at end of file diff --git a/settings/settings.json b/settings/settings.json index 1d9d17a3..d0e1df0e 100644 --- a/settings/settings.json +++ b/settings/settings.json @@ -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.", diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index 99074584..953c3f53 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -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