Merge pull request #5282 from GeorgeH005/support-dovi-hdr-fallback

This commit is contained in:
Bill Thornton
2024-03-24 14:52:52 -04:00
committed by GitHub
2 changed files with 26 additions and 10 deletions
+1
View File
@@ -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
+25 -10
View File
@@ -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/, ''));
@@ -210,12 +210,22 @@ function supportsDolbyVision(options) {
);
}
function canPlayDolbyVisionHevc(videoTestElement) {
// 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/, ''));
function supportedDolbyVisionProfilesHevc(videoTestElement) {
const supportedProfiles = [];
// Profiles 5/8 4k@60fps
if (videoTestElement.canPlayType) {
if (videoTestElement
.canPlayType('video/mp4; codecs="dvh1.05.09"')
.replace(/no/, '')) {
supportedProfiles.push(5);
}
if (videoTestElement
.canPlayType('video/mp4; codecs="dvh1.08.09"')
.replace(/no/, '')) {
supportedProfiles.push(8);
}
}
return supportedProfiles;
}
function getDirectPlayProfileForVideoContainer(container, videoAudioCodecs, videoTestElement, options) {
@@ -942,8 +952,14 @@ export default function (options) {
av1VideoRangeTypes += '|HLG';
}
if (supportsDolbyVision(options) && canPlayDolbyVisionHevc(videoTestElement)) {
hevcVideoRangeTypes += '|DOVI';
if (supportsDolbyVision(options)) {
const profiles = supportedDolbyVisionProfilesHevc(videoTestElement);
if (profiles.includes(5)) {
hevcVideoRangeTypes += '|DOVI';
}
if (profiles.includes(8)) {
hevcVideoRangeTypes += '|DOVIWithHDR10|DOVIWithHLG|DOVIWithSDR';
}
}
const h264CodecProfileConditions = [
@@ -1250,4 +1266,3 @@ export default function (options) {
return profile;
}