From e049fb9c1f0a5ebc621facc648ca70d0daf7a282 Mon Sep 17 00:00:00 2001 From: whiteowl3 <71030468+whiteowl3@users.noreply.github.com> Date: Thu, 7 Jul 2022 15:58:01 -0400 Subject: [PATCH 01/10] vp9, av1, hdr --- source/utils/deviceCapabilities.brs | 73 ++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index b31f69a1..0f83a540 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -34,6 +34,11 @@ function getDeviceProfile() as object if di.CanDecodeVideo({ Codec: "hevc" }).Result = true tsVideoCodecs = tsVideoCodecs + ",h265,hevc" + if di.CanDecodeVideo({ Codec: "hevc", Profile: "main 10" }).Result + MAIN10 = ",main 10" + else + MAIN10 = "" + end if end if if di.CanDecodeAudio({ Codec: "ac3" }).result @@ -41,10 +46,46 @@ function getDeviceProfile() as object else tsAudioCodecs = "aac" end if + + addAv1Profile = false + if di.CanDecodeVideo({ Codec: "av1" }).result + tsVideoCodecs = tsVideoCodecs + ",av1" + addAv1Profile = true + end if + addVp9Profile = false + if di.CanDecodeVideo({ Codec: "vp9" }).result + tsVideoCodecs = tsVideoCodecs + ",vp9" + addVp9Profile = true + end if + + tsVideoCodecs = tsVideoCodecs + ",h265,hevc" + + hevcVideoRangeTypes = "SDR" + vp9VideoRangeTypes = "SDR" + av1VideoRangeTypes = "SDR" + + dp = di.GetDisplayProperties() + if dp.Hdr10 ' or dp.Hdr10Plus? + hevcVideoRangeTypes = hevcVideoRangeTypes + ",HDR10" + vp9VideoRangeTypes = vp9VideoRangeTypes + ",HDR10" + av1VideoRangeTypes = av1VideoRangeTypes + ",HDR10" + end if + if dp.HLG + hevcVideoRangeTypes = hevcVideoRangeTypes + ",HLG" + vp9VideoRangeTypes = vp9VideoRangeTypes + ",HLG" + av1VideoRangeTypes = av1VideoRangeTypes + ",HLG" + end if + if dp.DolbyVision + hevcVideoRangeTypes = hevcVideoRangeTypes + ",DOVI" + 'vp9VideoRangeTypes = vp9VideoRangeTypes + ",DOVI" no evidence that vp9 can hold DOVI + av1VideoRangeTypes = av1VideoRangeTypes + ",DOVI" + end if + + DirectPlayProfile = GetDirectPlayProfiles() - return { + deviceProfile = { "MaxStreamingBitrate": 120000000, "MaxStaticBitrate": 100000000, "MusicStreamingTranscodingBitrate": 192000, @@ -154,6 +195,36 @@ function getDeviceProfile() as object } ] } + if addAv1Profile + deviceProfile.CodecProfiles.push({ + "Type": "Video", + "Codec": "av1", + "Conditions": [ + { + "Condition": "EqualsAny", + "Property": "VideoRangeType", + "Value": av1VideoRangeTypes, + "IsRequired": false + } + ] + }) + end if + if addVp9Profile + deviceProfile.CodecProfiles.push({ + "Type": "Video", + "Codec": "vp9", + "Conditions": [ + { + "Condition": "EqualsAny", + "Property": "VideoRangeType", + "Value": vp9VideoRangeTypes, + "IsRequired": false + } + ] + }) + end if + + return deviceProfile end function From bce88287be074331d28b3354268d547d3a7bd8b1 Mon Sep 17 00:00:00 2001 From: whiteowl3 <71030468+whiteowl3@users.noreply.github.com> Date: Thu, 7 Jul 2022 16:05:58 -0400 Subject: [PATCH 02/10] add missing hevc profile block --- source/utils/deviceCapabilities.brs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index 0f83a540..eb9197d2 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -174,6 +174,30 @@ function getDeviceProfile() as object "IsRequired": false } ] + }, + { + "Type": "Video", + "Codec": "hevc", + "Conditions": [ + { + "Condition": "EqualsAny", + "Property": "VideoProfile", + "Value": "main"+MAIN10, + "IsRequired": false + }, + { + "Condition": "EqualsAny", + "Property": "VideoRangeType", + "Value": hevcVideoRangeTypes, + "IsRequired": false + }, + { + "Condition": "LessThanEqual", + "Property": "VideoLevel", + "Value": "153", + "IsRequired": false + } + ] } ], "SubtitleProfiles": [ From 6de17618eb4137a7bbad6df769eb1e44a1a7d4f6 Mon Sep 17 00:00:00 2001 From: whiteowl3 <71030468+whiteowl3@users.noreply.github.com> Date: Thu, 7 Jul 2022 16:13:30 -0400 Subject: [PATCH 03/10] Update deviceCapabilities.brs --- source/utils/deviceCapabilities.brs | 57 +++++++++++++++-------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index eb9197d2..61cd6267 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -32,12 +32,13 @@ function getDeviceProfile() as object tsVideoCodecs = "h264" end if + addHevcProfile = false + MAIN10 = "" if di.CanDecodeVideo({ Codec: "hevc" }).Result = true tsVideoCodecs = tsVideoCodecs + ",h265,hevc" + addHevcProfile = true if di.CanDecodeVideo({ Codec: "hevc", Profile: "main 10" }).Result MAIN10 = ",main 10" - else - MAIN10 = "" end if end if @@ -174,30 +175,6 @@ function getDeviceProfile() as object "IsRequired": false } ] - }, - { - "Type": "Video", - "Codec": "hevc", - "Conditions": [ - { - "Condition": "EqualsAny", - "Property": "VideoProfile", - "Value": "main"+MAIN10, - "IsRequired": false - }, - { - "Condition": "EqualsAny", - "Property": "VideoRangeType", - "Value": hevcVideoRangeTypes, - "IsRequired": false - }, - { - "Condition": "LessThanEqual", - "Property": "VideoLevel", - "Value": "153", - "IsRequired": false - } - ] } ], "SubtitleProfiles": [ @@ -232,7 +209,33 @@ function getDeviceProfile() as object } ] }) - end if + end if + if addHevcProfile + deviceProfile.CodecProfiles.push({ + "Type": "Video", + "Codec": "hevc", + "Conditions": [ + { + "Condition": "EqualsAny", + "Property": "VideoProfile", + "Value": "main"+MAIN10, + "IsRequired": false + }, + { + "Condition": "EqualsAny", + "Property": "VideoRangeType", + "Value": hevcVideoRangeTypes, + "IsRequired": false + }, + { + "Condition": "LessThanEqual", + "Property": "VideoLevel", + "Value": "153", + "IsRequired": false + } + ] + }) + end if if addVp9Profile deviceProfile.CodecProfiles.push({ "Type": "Video", From 67ce600eba59cc14f2b0e737dd8c68661d87f472 Mon Sep 17 00:00:00 2001 From: whiteowl3 <71030468+whiteowl3@users.noreply.github.com> Date: Thu, 7 Jul 2022 16:23:49 -0400 Subject: [PATCH 04/10] remove duplicate line --- source/utils/deviceCapabilities.brs | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index 61cd6267..6f788db6 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -60,8 +60,6 @@ function getDeviceProfile() as object addVp9Profile = true end if - tsVideoCodecs = tsVideoCodecs + ",h265,hevc" - hevcVideoRangeTypes = "SDR" vp9VideoRangeTypes = "SDR" av1VideoRangeTypes = "SDR" From a0796642613f9a4359e59e4f1ce4b75a2b719952 Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Sun, 16 Oct 2022 11:45:53 +0100 Subject: [PATCH 05/10] Fix separator for conditional properties and change defautl supported videoLevels Also make linter happy --- source/utils/deviceCapabilities.brs | 119 ++++++++++++++-------------- 1 file changed, 59 insertions(+), 60 deletions(-) diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index 6f788db6..e9e7ef9f 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -38,7 +38,7 @@ function getDeviceProfile() as object tsVideoCodecs = tsVideoCodecs + ",h265,hevc" addHevcProfile = true if di.CanDecodeVideo({ Codec: "hevc", Profile: "main 10" }).Result - MAIN10 = ",main 10" + MAIN10 = "|main 10" end if end if @@ -47,7 +47,7 @@ function getDeviceProfile() as object else tsAudioCodecs = "aac" end if - + addAv1Profile = false if di.CanDecodeVideo({ Codec: "av1" }).result tsVideoCodecs = tsVideoCodecs + ",av1" @@ -66,25 +66,24 @@ function getDeviceProfile() as object dp = di.GetDisplayProperties() if dp.Hdr10 ' or dp.Hdr10Plus? - hevcVideoRangeTypes = hevcVideoRangeTypes + ",HDR10" - vp9VideoRangeTypes = vp9VideoRangeTypes + ",HDR10" - av1VideoRangeTypes = av1VideoRangeTypes + ",HDR10" + hevcVideoRangeTypes = hevcVideoRangeTypes + "|HDR10" + vp9VideoRangeTypes = vp9VideoRangeTypes + "|HDR10" + av1VideoRangeTypes = av1VideoRangeTypes + "|HDR10" end if if dp.HLG - hevcVideoRangeTypes = hevcVideoRangeTypes + ",HLG" - vp9VideoRangeTypes = vp9VideoRangeTypes + ",HLG" - av1VideoRangeTypes = av1VideoRangeTypes + ",HLG" + hevcVideoRangeTypes = hevcVideoRangeTypes + "|HLG" + vp9VideoRangeTypes = vp9VideoRangeTypes + "|HLG" + av1VideoRangeTypes = av1VideoRangeTypes + "|HLG" end if if dp.DolbyVision - hevcVideoRangeTypes = hevcVideoRangeTypes + ",DOVI" + hevcVideoRangeTypes = hevcVideoRangeTypes + "|DOVI" 'vp9VideoRangeTypes = vp9VideoRangeTypes + ",DOVI" no evidence that vp9 can hold DOVI - av1VideoRangeTypes = av1VideoRangeTypes + ",DOVI" + av1VideoRangeTypes = av1VideoRangeTypes + "|DOVI" end if - - + DirectPlayProfile = GetDirectPlayProfiles() - deviceProfile = { + deviceProfile = { "MaxStreamingBitrate": 120000000, "MaxStaticBitrate": 100000000, "MusicStreamingTranscodingBitrate": 192000, @@ -169,7 +168,7 @@ function getDeviceProfile() as object { "Condition": "LessThanEqual", "Property": "VideoLevel", - "Value": "51", + "Value": "41", "IsRequired": false } ] @@ -196,59 +195,59 @@ function getDeviceProfile() as object } if addAv1Profile deviceProfile.CodecProfiles.push({ - "Type": "Video", - "Codec": "av1", - "Conditions": [ - { - "Condition": "EqualsAny", - "Property": "VideoRangeType", - "Value": av1VideoRangeTypes, - "IsRequired": false - } - ] - }) + "Type": "Video", + "Codec": "av1", + "Conditions": [ + { + "Condition": "EqualsAny", + "Property": "VideoRangeType", + "Value": av1VideoRangeTypes, + "IsRequired": false + } + ] + }) end if if addHevcProfile deviceProfile.CodecProfiles.push({ - "Type": "Video", - "Codec": "hevc", - "Conditions": [ - { - "Condition": "EqualsAny", - "Property": "VideoProfile", - "Value": "main"+MAIN10, - "IsRequired": false - }, - { - "Condition": "EqualsAny", - "Property": "VideoRangeType", - "Value": hevcVideoRangeTypes, - "IsRequired": false - }, - { - "Condition": "LessThanEqual", - "Property": "VideoLevel", - "Value": "153", - "IsRequired": false - } - ] - }) + "Type": "Video", + "Codec": "hevc", + "Conditions": [ + { + "Condition": "EqualsAny", + "Property": "VideoProfile", + "Value": "main" + MAIN10, + "IsRequired": false + }, + { + "Condition": "EqualsAny", + "Property": "VideoRangeType", + "Value": hevcVideoRangeTypes, + "IsRequired": false + }, + { + "Condition": "LessThanEqual", + "Property": "VideoLevel", + "Value": (120 * 5.1).ToStr(), + "IsRequired": false + } + ] + }) end if if addVp9Profile deviceProfile.CodecProfiles.push({ - "Type": "Video", - "Codec": "vp9", - "Conditions": [ - { - "Condition": "EqualsAny", - "Property": "VideoRangeType", - "Value": vp9VideoRangeTypes, - "IsRequired": false - } - ] - }) + "Type": "Video", + "Codec": "vp9", + "Conditions": [ + { + "Condition": "EqualsAny", + "Property": "VideoRangeType", + "Value": vp9VideoRangeTypes, + "IsRequired": false + } + ] + }) end if - + return deviceProfile end function From 7c4a1b8b214df144d95c02dabe161b5b1be01716 Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Thu, 1 Dec 2022 08:23:32 +0000 Subject: [PATCH 06/10] Change codec order (Patch from @nijave) --- source/utils/deviceCapabilities.brs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index 96df7b31..37bb7852 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -26,22 +26,21 @@ function getDeviceProfile() as object maxAudioChannels = 6 end if - if playMpeg2 and di.CanDecodeVideo({ Codec: "mpeg2" }).Result = true - tsVideoCodecs = "h264,mpeg2video" - else - tsVideoCodecs = "h264" - end if - addHevcProfile = false MAIN10 = "" + tsVideoCodecs = "h264" if di.CanDecodeVideo({ Codec: "hevc" }).Result = true - tsVideoCodecs = tsVideoCodecs + ",h265,hevc" + tsVideoCodecs = "h265,hevc," + tsVideoCodecs addHevcProfile = true if di.CanDecodeVideo({ Codec: "hevc", Profile: "main 10" }).Result MAIN10 = "|main 10" end if end if + if playMpeg2 and di.CanDecodeVideo({ Codec: "mpeg2" }).Result = true + tsVideoCodecs = tsVideoCodecs + ",mpeg2video" + end if + if di.CanDecodeAudio({ Codec: "ac3" }).result tsAudioCodecs = "aac,ac3" else From d5120396c8822de95df6c71b8b8b9f6e6f11706f Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Thu, 1 Dec 2022 08:34:49 +0000 Subject: [PATCH 07/10] Add AV1 playback user preference --- locale/en_US/translations.ts | 10 ++++++++++ settings/settings.json | 7 +++++++ source/utils/deviceCapabilities.brs | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/locale/en_US/translations.ts b/locale/en_US/translations.ts index 53ab194d..a6d33540 100644 --- a/locale/en_US/translations.ts +++ b/locale/en_US/translations.ts @@ -489,6 +489,16 @@ Support Direct Play of MPEG-2 content (e.g., Live TV). This will prevent transcoding of MPEG-2 content, but uses significantly more bandwidth. Settings Menu - Description for option + + AV1 Support + AV1 Support + Settings Menu - Title for option + + + ** EXPERIMENTAL** Support Direct Play of AV1 content when this Roku device supports it. + ** EXPERIMENTAL** Support Direct Play of AV1 content when this Roku device supports it. + Settings Menu - Description for option + Enabled Enabled diff --git a/settings/settings.json b/settings/settings.json index 8a860c9b..92a7e47c 100644 --- a/settings/settings.json +++ b/settings/settings.json @@ -3,6 +3,13 @@ "title": "Playback", "description": "Settings relating to playback and supported codec and media types.", "children": [ + { + "title": "AV1 Support", + "description": "** EXPERIMENTAL** Support Direct Play of AV1 content when this Roku device supports it.", + "settingName": "playback.av1", + "type": "bool", + "default": "false" + }, { "title": "MPEG-2 Support", "description": "Support Direct Play of MPEG-2 content (e.g., Live TV). This will prevent transcoding of MPEG-2 content, but uses significantly more bandwidth.", diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index 37bb7852..b776b387 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -18,6 +18,7 @@ end function function getDeviceProfile() as object playMpeg2 = get_user_setting("playback.mpeg2") = "true" + playAv1 = get_user_setting("playback.av1") = "true" 'Check if 5.1 Audio Output connected maxAudioChannels = 2 @@ -48,7 +49,7 @@ function getDeviceProfile() as object end if addAv1Profile = false - if di.CanDecodeVideo({ Codec: "av1" }).result + if playAv1 and di.CanDecodeVideo({ Codec: "av1" }).result tsVideoCodecs = tsVideoCodecs + ",av1" addAv1Profile = true end if From 2f04fdc7e04d1a5f009e42395a54badd18d74a28 Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Tue, 6 Dec 2022 07:27:45 +0000 Subject: [PATCH 08/10] Update locale/en_US/translations.ts Co-authored-by: 1hitsong <3330318+1hitsong@users.noreply.github.com> --- locale/en_US/translations.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/en_US/translations.ts b/locale/en_US/translations.ts index a6d33540..5675377d 100644 --- a/locale/en_US/translations.ts +++ b/locale/en_US/translations.ts @@ -495,7 +495,7 @@ Settings Menu - Title for option - ** EXPERIMENTAL** Support Direct Play of AV1 content when this Roku device supports it. + ** EXPERIMENTAL** Support Direct Play of AV1 content if this Roku device supports it. ** EXPERIMENTAL** Support Direct Play of AV1 content when this Roku device supports it. Settings Menu - Description for option From 2b1320f5118d2e36794cf5296a43e35a44ff6c75 Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Tue, 6 Dec 2022 07:27:55 +0000 Subject: [PATCH 09/10] Update settings/settings.json Co-authored-by: 1hitsong <3330318+1hitsong@users.noreply.github.com> --- settings/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/settings.json b/settings/settings.json index 92a7e47c..aa301ebd 100644 --- a/settings/settings.json +++ b/settings/settings.json @@ -5,7 +5,7 @@ "children": [ { "title": "AV1 Support", - "description": "** EXPERIMENTAL** Support Direct Play of AV1 content when this Roku device supports it.", + "description": "** EXPERIMENTAL** Support Direct Play of AV1 content if this Roku device supports it.", "settingName": "playback.av1", "type": "bool", "default": "false" From 9c114624dd0f4edbabd26da722738ec3e3b7ea2b Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Tue, 6 Dec 2022 07:28:03 +0000 Subject: [PATCH 10/10] Update locale/en_US/translations.ts Co-authored-by: 1hitsong <3330318+1hitsong@users.noreply.github.com> --- locale/en_US/translations.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/en_US/translations.ts b/locale/en_US/translations.ts index 5675377d..fb97b77c 100644 --- a/locale/en_US/translations.ts +++ b/locale/en_US/translations.ts @@ -496,7 +496,7 @@ ** EXPERIMENTAL** Support Direct Play of AV1 content if this Roku device supports it. - ** EXPERIMENTAL** Support Direct Play of AV1 content when this Roku device supports it. + ** EXPERIMENTAL** Support Direct Play of AV1 content if this Roku device supports it. Settings Menu - Description for option