Skip to content

Commit

Permalink
override DV codecs
Browse files Browse the repository at this point in the history
  • Loading branch information
tykus160 committed Mar 6, 2025
1 parent 0f7b19c commit 2eb35c5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/device/abstract_device.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ shaka.device.AbstractDevice = class {
return Promise.resolve({width: Infinity, height: Infinity});
}

/**
* @override
*/
shouldOverrideDolbyVisionCodecs() {
return false;
}

/**
* @override
*/
Expand Down
7 changes: 7 additions & 0 deletions lib/device/i_device.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ shaka.device.IDevice = class {
* @return {shaka.extern.PlayerConfiguration}
*/
adjustConfig(config) {}

/**
* Checks should Dolby Vision codecs be overridden to their H.264 and H.265
* equivalents.
* @return {boolean}
*/
shouldOverrideDolbyVisionCodecs() {}
};

/**
Expand Down
7 changes: 7 additions & 0 deletions lib/device/xbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ shaka.device.Xbox = class extends shaka.device.AbstractDevice {
return true;
}

/**
* @override
*/
shouldOverrideDolbyVisionCodecs() {
return this.isLegacyEdge_;
}

/**
* @override
*/
Expand Down
3 changes: 2 additions & 1 deletion lib/util/stream_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ shaka.util.StreamUtils = class {
goog.asserts.assert(navigator.mediaCapabilities,
'MediaCapabilities should be valid.');

if (shaka.util.Platform.isXboxOne()) {
if (shaka.device.DeviceFactory.getDevice()
.shouldOverrideDolbyVisionCodecs()) {
shaka.util.StreamUtils.overrideDolbyVisionCodecs(manifest.variants);
}
await shaka.util.StreamUtils.getDecodingInfosForVariants(
Expand Down

0 comments on commit 2eb35c5

Please sign in to comment.