mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #5391 from dmitrylyzo/user-codec-configure
User configurable codecs (DTS, TrueHD)
This commit is contained in:
commit
d76db0b0db
5 changed files with 80 additions and 8 deletions
|
@ -173,6 +173,8 @@ function loadForm(context, user, userSettings, systemInfo, apiClient) {
|
|||
|
||||
context.querySelector('.chkPlayDefaultAudioTrack').checked = user.Configuration.PlayDefaultAudioTrack || false;
|
||||
context.querySelector('.chkPreferFmp4HlsContainer').checked = userSettings.preferFmp4HlsContainer();
|
||||
context.querySelector('.chkEnableDts').checked = appSettings.enableDts();
|
||||
context.querySelector('.chkEnableTrueHd').checked = appSettings.enableTrueHd();
|
||||
context.querySelector('.chkEnableCinemaMode').checked = userSettings.enableCinemaMode();
|
||||
context.querySelector('#selectAudioNormalization').value = userSettings.selectAudioNormalization();
|
||||
context.querySelector('.chkEnableNextVideoOverlay').checked = userSettings.enableNextVideoInfoOverlay();
|
||||
|
@ -216,6 +218,9 @@ function saveUser(context, user, userSettingsInstance, apiClient) {
|
|||
appSettings.maxVideoWidth(context.querySelector('.selectMaxVideoWidth').value);
|
||||
appSettings.limitSupportedVideoResolution(context.querySelector('.chkLimitSupportedVideoResolution').checked);
|
||||
|
||||
appSettings.enableDts(context.querySelector('.chkEnableDts').checked);
|
||||
appSettings.enableTrueHd(context.querySelector('.chkEnableTrueHd').checked);
|
||||
|
||||
setMaxBitrateFromField(context.querySelector('.selectVideoInNetworkQuality'), true, 'Video');
|
||||
setMaxBitrateFromField(context.querySelector('.selectVideoInternetQuality'), false, 'Video');
|
||||
setMaxBitrateFromField(context.querySelector('.selectMusicInternetQuality'), false, 'Audio');
|
||||
|
|
|
@ -159,6 +159,28 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="verticalSection verticalSection-extrabottompadding">
|
||||
<h2 class="sectionTitle">
|
||||
${HeaderVideoAdvanced}
|
||||
</h2>
|
||||
|
||||
<div class="checkboxContainer checkboxContainer-withDescription fldEnableDts">
|
||||
<label>
|
||||
<input type="checkbox" is="emby-checkbox" class="chkEnableDts" />
|
||||
<span>${EnableDts}</span>
|
||||
</label>
|
||||
<div class="fieldDescription checkboxFieldDescription">${EnableDtsHelp}</div>
|
||||
</div>
|
||||
|
||||
<div class="checkboxContainer checkboxContainer-withDescription fldEnableTrueHd">
|
||||
<label>
|
||||
<input type="checkbox" is="emby-checkbox" class="chkEnableTrueHd" />
|
||||
<span>${EnableTrueHd}</span>
|
||||
</label>
|
||||
<div class="fieldDescription checkboxFieldDescription">${EnableTrueHdHelp}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button is="emby-button" type="submit" class="raised button-submit block btnSave hide">
|
||||
<span>${Save}</span>
|
||||
</button>
|
||||
|
|
|
@ -94,6 +94,25 @@ function supportsAc3(videoTestElement) {
|
|||
return videoTestElement.canPlayType('audio/mp4; codecs="ac-3"').replace(/no/, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the device supports DTS (DCA).
|
||||
* @param {HTMLVideoElement} videoTestElement The video test element
|
||||
* @returns {boolean|null} _true_ if the device supports DTS (DCA). _false_ if the device doesn't support DTS (DCA). _null_ if support status is unknown.
|
||||
*/
|
||||
function canPlayDts(videoTestElement) {
|
||||
// DTS audio is not supported by Samsung TV 2018+ (Tizen 4.0+) and LG TV 2020-2022 (webOS 5.0, 6.0 and 22) models
|
||||
if (browser.tizenVersion >= 4 || (browser.web0sVersion >= 5 && browser.web0sVersion < 23)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (videoTestElement.canPlayType('video/mp4; codecs="dts-"').replace(/no/, '')
|
||||
|| videoTestElement.canPlayType('video/mp4; codecs="dts+"').replace(/no/, '')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function supportsEac3(videoTestElement) {
|
||||
if (browser.tizen || browser.web0s) {
|
||||
return true;
|
||||
|
@ -528,14 +547,9 @@ export default function (options) {
|
|||
hlsInFmp4VideoAudioCodecs.push('mp2');
|
||||
}
|
||||
|
||||
let supportsDts = options.supportsDts;
|
||||
let supportsDts = appSettings.enableDts() || options.supportsDts;
|
||||
if (supportsDts == null) {
|
||||
supportsDts = browser.tizen || browser.web0sVersion || videoTestElement.canPlayType('video/mp4; codecs="dts-"').replace(/no/, '') || videoTestElement.canPlayType('video/mp4; codecs="dts+"').replace(/no/, '');
|
||||
|
||||
// DTS audio is not supported by Samsung TV 2018+ (Tizen 4.0+) and LG TV 2020-2022 (webOS 5.0, 6.0 and 22) models
|
||||
if (browser.tizenVersion >= 4 || (browser.web0sVersion >= 5 && browser.web0sVersion < 23)) {
|
||||
supportsDts = false;
|
||||
}
|
||||
supportsDts = canPlayDts(videoTestElement);
|
||||
}
|
||||
|
||||
if (supportsDts) {
|
||||
|
@ -548,7 +562,7 @@ export default function (options) {
|
|||
videoAudioCodecs.push('pcm_s24le');
|
||||
}
|
||||
|
||||
if (options.supportsTrueHd) {
|
||||
if (appSettings.enableTrueHd() || options.supportsTrueHd) {
|
||||
videoAudioCodecs.push('truehd');
|
||||
}
|
||||
|
||||
|
|
|
@ -132,6 +132,32 @@ class AppSettings {
|
|||
return toBoolean(this.get('limitSupportedVideoResolution'), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set 'Enable DTS' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Enable DTS' or undefined.
|
||||
* @return {boolean} 'Enable DTS' state.
|
||||
*/
|
||||
enableDts(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('enableDts', val.toString());
|
||||
}
|
||||
|
||||
return toBoolean(this.get('enableDts'), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set 'Enable TrueHD' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Enable TrueHD' or undefined.
|
||||
* @return {boolean} 'Enable TrueHD' state.
|
||||
*/
|
||||
enableTrueHd(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('enableTrueHd', val.toString());
|
||||
}
|
||||
|
||||
return toBoolean(this.get('enableTrueHd'), false);
|
||||
}
|
||||
|
||||
set(name, value, userId) {
|
||||
const currentValue = this.get(name, userId);
|
||||
localStorage.setItem(this.#getKey(name, userId), value);
|
||||
|
|
|
@ -246,6 +246,8 @@
|
|||
"EnableDetailsBanner": "Details Banner",
|
||||
"EnableDetailsBannerHelp": "Display a banner image at the top of the item details page.",
|
||||
"EnableDisplayMirroring": "Display mirroring",
|
||||
"EnableDts": "Enable DTS (DCA)",
|
||||
"EnableDtsHelp": "Only enable if your device supports DTS or is connected to a compatible audio receiver, otherwise it may cause playback failure.",
|
||||
"EnableExternalVideoPlayers": "External video players",
|
||||
"EnableExternalVideoPlayersHelp": "An external player menu will be shown when starting video playback.",
|
||||
"EnableFasterAnimations": "Faster animations",
|
||||
|
@ -267,6 +269,8 @@
|
|||
"EnableThemeSongsHelp": "Play the theme songs in background while browsing the library.",
|
||||
"EnableThemeVideosHelp": "Play theme videos in the background while browsing the library.",
|
||||
"EnableTonemapping": "Enable Tone mapping",
|
||||
"EnableTrueHd": "Enable TrueHD",
|
||||
"EnableTrueHdHelp": "Only enable if your device supports TrueHD or is connected to a compatible audio receiver, otherwise it may cause playback failure.",
|
||||
"EncoderPresetHelp": "Pick a faster value to improve performance, or a slower value to improve quality.",
|
||||
"Ended": "Ended",
|
||||
"EndsAtValue": "Ends at {0}",
|
||||
|
@ -501,6 +505,7 @@
|
|||
"HeaderUploadSubtitle": "Upload Subtitle",
|
||||
"HeaderUser": "User",
|
||||
"HeaderUsers": "Users",
|
||||
"HeaderVideoAdvanced": "Video Advanced",
|
||||
"HeaderVideoQuality": "Video Quality",
|
||||
"HeaderVideos": "Videos",
|
||||
"HeaderVideoType": "Video Type",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue