From b4f912be46ed637d06aeb4ee711b96022ba3c6eb Mon Sep 17 00:00:00 2001 From: George Haidos Date: Thu, 14 Mar 2024 01:52:44 +0200 Subject: [PATCH 1/8] Add DoVi fallback types as per pull #10469 on main repo --- src/scripts/browserDeviceProfile.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index 7f9e236022..3e8914a8c4 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -1,6 +1,6 @@ +import browser from './browser'; import appSettings from './settings/appSettings'; import * as userSettings from './settings/userSettings'; -import browser from './browser'; function canPlayH264(videoTestElement) { return !!(videoTestElement.canPlayType?.('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, '')); @@ -932,14 +932,18 @@ export default function (options) { if (supportsHdr10(options)) { hevcVideoRangeTypes += '|HDR10'; + // Should also be able to play DoVi with HDR10 fallback + hevcVideoRangeTypes += '|DOVIWithHDR10' vp9VideoRangeTypes += '|HDR10'; av1VideoRangeTypes += '|HDR10'; } if (supportsHlg(options)) { - hevcVideoRangeTypes += '|HLG'; - vp9VideoRangeTypes += '|HLG'; - av1VideoRangeTypes += '|HLG'; + hevcVideoRangeTypes += "|HLG"; + // Should also be able to play DoVi with HLG fallback + hevcVideoRangeTypes += "|DOVIWithHLG"; + vp9VideoRangeTypes += "|HLG"; + av1VideoRangeTypes += "|HLG"; } if (supportsDolbyVision(options) && canPlayDolbyVisionHevc(videoTestElement)) { @@ -1250,4 +1254,3 @@ export default function (options) { return profile; } - From ea63120bffcf8bb534e00817f275bcf34a332b7b Mon Sep 17 00:00:00 2001 From: George Haidos Date: Sat, 16 Mar 2024 02:11:26 +0200 Subject: [PATCH 2/8] Styling fixes --- src/scripts/browserDeviceProfile.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index 3e8914a8c4..daf6d4a7d0 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -933,17 +933,17 @@ export default function (options) { if (supportsHdr10(options)) { hevcVideoRangeTypes += '|HDR10'; // Should also be able to play DoVi with HDR10 fallback - hevcVideoRangeTypes += '|DOVIWithHDR10' + hevcVideoRangeTypes += '|DOVIWithHDR10'; vp9VideoRangeTypes += '|HDR10'; av1VideoRangeTypes += '|HDR10'; } if (supportsHlg(options)) { - hevcVideoRangeTypes += "|HLG"; + hevcVideoRangeTypes += '|HLG'; // Should also be able to play DoVi with HLG fallback - hevcVideoRangeTypes += "|DOVIWithHLG"; - vp9VideoRangeTypes += "|HLG"; - av1VideoRangeTypes += "|HLG"; + hevcVideoRangeTypes += '|DOVIWithHLG'; + vp9VideoRangeTypes += '|HLG'; + av1VideoRangeTypes += '|HLG'; } if (supportsDolbyVision(options) && canPlayDolbyVisionHevc(videoTestElement)) { From 49552d0c9de1ba70b5df3377daa7dc430cd4b9d3 Mon Sep 17 00:00:00 2001 From: George Haidos Date: Sat, 16 Mar 2024 21:10:14 +0200 Subject: [PATCH 3/8] Report DOVIWith{HDR10,HLG} only if dvh1 is supported as the codec tag --- src/scripts/browserDeviceProfile.js | 33 +++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index daf6d4a7d0..3f7d038f09 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -210,12 +210,21 @@ function supportsDolbyVision(options) { ); } -function canPlayDolbyVisionHevc(videoTestElement) { +function supportedDolbyVisionProfilesHevc(videoTestElement) { + const supportedProfiles = []; // Profiles 5/7/8 4k@60fps - return !!videoTestElement.canPlayType - && (videoTestElement.canPlayType('video/mp4; codecs="dvh1.05.09"').replace(/no/, '') - && videoTestElement.canPlayType('video/mp4; codecs="dvh1.07.09"').replace(/no/, '') - && videoTestElement.canPlayType('video/mp4; codecs="dvh1.08.09"').replace(/no/, '')); + if (videoTestElement.canPlayType) { + if (videoTestElement + .canPlayType('video/mp4; codecs="dvh1.05.09"') + .replace(/no/, '')) supportedProfiles.push(5); + if ( videoTestElement + .canPlayType('video/mp4; codecs="dvh1.07.09"') + .replace(/no/, '')) supportedProfiles.push(7); + if ( videoTestElement + .canPlayType('video/mp4; codecs="dvh1.08.09"') + .replace(/no/, '')) supportedProfiles.push(8); + } + return supportedProfiles; } function getDirectPlayProfileForVideoContainer(container, videoAudioCodecs, videoTestElement, options) { @@ -932,22 +941,24 @@ export default function (options) { if (supportsHdr10(options)) { hevcVideoRangeTypes += '|HDR10'; - // Should also be able to play DoVi with HDR10 fallback - hevcVideoRangeTypes += '|DOVIWithHDR10'; vp9VideoRangeTypes += '|HDR10'; av1VideoRangeTypes += '|HDR10'; } if (supportsHlg(options)) { hevcVideoRangeTypes += '|HLG'; - // Should also be able to play DoVi with HLG fallback - hevcVideoRangeTypes += '|DOVIWithHLG'; vp9VideoRangeTypes += '|HLG'; av1VideoRangeTypes += '|HLG'; } - if (supportsDolbyVision(options) && canPlayDolbyVisionHevc(videoTestElement)) { - hevcVideoRangeTypes += '|DOVI'; + if (supportsDolbyVision(options)) { + const profiles = supportedDolbyVisionProfilesHevc(videoTestElement); + if (profiles.includes(5) || profiles.includes(7)) { + hevcVideoRangeTypes += '|DOVI'; + } + if (profiles.includes(8)) { + hevcVideoRangeTypes += '|DOVIWithHDR10|DOVIWithHLG'; + } } const h264CodecProfileConditions = [ From e4fdd3ee94a05e6d3b085a05d3413a4756946658 Mon Sep 17 00:00:00 2001 From: George Haidos Date: Sun, 17 Mar 2024 21:47:29 +0200 Subject: [PATCH 4/8] Update browserDeviceProfile with the new Dolby Vision types --- src/scripts/browserDeviceProfile.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index 3f7d038f09..fbc87ec8cc 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -217,9 +217,6 @@ function supportedDolbyVisionProfilesHevc(videoTestElement) { if (videoTestElement .canPlayType('video/mp4; codecs="dvh1.05.09"') .replace(/no/, '')) supportedProfiles.push(5); - if ( videoTestElement - .canPlayType('video/mp4; codecs="dvh1.07.09"') - .replace(/no/, '')) supportedProfiles.push(7); if ( videoTestElement .canPlayType('video/mp4; codecs="dvh1.08.09"') .replace(/no/, '')) supportedProfiles.push(8); @@ -953,11 +950,11 @@ export default function (options) { if (supportsDolbyVision(options)) { const profiles = supportedDolbyVisionProfilesHevc(videoTestElement); - if (profiles.includes(5) || profiles.includes(7)) { + if (profiles.includes(5)) { hevcVideoRangeTypes += '|DOVI'; } if (profiles.includes(8)) { - hevcVideoRangeTypes += '|DOVIWithHDR10|DOVIWithHLG'; + hevcVideoRangeTypes += '|DOVIWithHDR10|DOVIWithHLG|DOVIWithSDR'; } } From fbfdcd22e8eb2853d4da7e4b8e4d70c0e85d7ba9 Mon Sep 17 00:00:00 2001 From: George Haidos Date: Mon, 18 Mar 2024 02:23:36 +0200 Subject: [PATCH 5/8] Add self to contributors --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index c87ab0c92b..b2c6b246e9 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -82,6 +82,7 @@ - [András Maróy](https://github.com/andrasmaroy) - [Chris-Codes-It](https://github.com/Chris-Codes-It) - [Vedant](https://github.com/viktory36) +- [GeorgeH005](https://github.com/GeorgeH005) ## Emby Contributors From 59cae8ce2f40bb2f88afe48ad1d4a5da4c50e0a8 Mon Sep 17 00:00:00 2001 From: George Haidos Date: Mon, 18 Mar 2024 12:55:54 +0200 Subject: [PATCH 6/8] Fix annotations --- src/scripts/browserDeviceProfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index fbc87ec8cc..9beec5427f 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -212,7 +212,7 @@ function supportsDolbyVision(options) { function supportedDolbyVisionProfilesHevc(videoTestElement) { const supportedProfiles = []; - // Profiles 5/7/8 4k@60fps + // Profiles 5/8 4k@60fps if (videoTestElement.canPlayType) { if (videoTestElement .canPlayType('video/mp4; codecs="dvh1.05.09"') From d094d0cbb712a2185ac86c217e7a826d0580179a Mon Sep 17 00:00:00 2001 From: George Haidos Date: Sat, 23 Mar 2024 18:38:41 +0200 Subject: [PATCH 7/8] Styling fixes --- src/scripts/browserDeviceProfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index 9beec5427f..f28b4bfb84 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -217,7 +217,7 @@ function supportedDolbyVisionProfilesHevc(videoTestElement) { if (videoTestElement .canPlayType('video/mp4; codecs="dvh1.05.09"') .replace(/no/, '')) supportedProfiles.push(5); - if ( videoTestElement + if (videoTestElement .canPlayType('video/mp4; codecs="dvh1.08.09"') .replace(/no/, '')) supportedProfiles.push(8); } From e49c66f250b59415df95bfb5833ebdc7667cb18e Mon Sep 17 00:00:00 2001 From: George Haidos Date: Sun, 24 Mar 2024 12:35:36 +0200 Subject: [PATCH 8/8] Readability fixes --- src/scripts/browserDeviceProfile.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index f28b4bfb84..288d55c04f 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -216,10 +216,14 @@ function supportedDolbyVisionProfilesHevc(videoTestElement) { if (videoTestElement.canPlayType) { if (videoTestElement .canPlayType('video/mp4; codecs="dvh1.05.09"') - .replace(/no/, '')) supportedProfiles.push(5); + .replace(/no/, '')) { + supportedProfiles.push(5); + } if (videoTestElement .canPlayType('video/mp4; codecs="dvh1.08.09"') - .replace(/no/, '')) supportedProfiles.push(8); + .replace(/no/, '')) { + supportedProfiles.push(8); + } } return supportedProfiles; }