1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #5688 from Arcus92/native-pgs

Add support for native PGS subtitle rendering without transcoding
This commit is contained in:
Bill Thornton 2024-09-20 15:55:30 -04:00 committed by GitHub
commit 6d0f0e85a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 89 additions and 2 deletions

View file

@ -48,6 +48,15 @@ function supportsTextTracks() {
return _supportsTextTracks;
}
let _supportsCanvas2D;
function supportsCanvas2D() {
if (_supportsCanvas2D == null) {
_supportsCanvas2D = document.createElement('canvas').getContext('2d') != null;
}
return _supportsCanvas2D;
}
let _canPlayHls;
function canPlayHls() {
if (_canPlayHls == null) {
@ -1424,6 +1433,7 @@ export default function (options) {
// External vtt or burn in
profile.SubtitleProfiles = [];
const subtitleBurninSetting = appSettings.get('subtitleburnin');
const subtitleRenderPgsSetting = appSettings.get('subtitlerenderpgs') === 'true';
if (subtitleBurninSetting !== 'all') {
if (supportsTextTracks()) {
profile.SubtitleProfiles.push({
@ -1441,6 +1451,14 @@ export default function (options) {
Method: 'External'
});
}
if (supportsCanvas2D() && options.enablePgsRender !== false && !options.isRetry && subtitleRenderPgsSetting
&& subtitleBurninSetting !== 'allcomplexformats' && subtitleBurninSetting !== 'onlyimageformats') {
profile.SubtitleProfiles.push({
Format: 'pgssub',
Method: 'External'
});
}
}
profile.ResponseProfiles = [];