Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for H264 High 10 Profile on Safari #5901

Merged
merged 6 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/components/playbackSettings/playbackSettings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import appSettings from '../../scripts/settings/appSettings';
import { appHost } from '../apphost';
import browser from '../../scripts/browser';
import focusManager from '../focusManager';
import qualityoptions from '../qualityOptions';
import globalize from '../../scripts/globalize';
Expand Down Expand Up @@ -143,6 +144,10 @@ function loadForm(context, user, userSettings, systemInfo, apiClient) {

showHideQualityFields(context, user, apiClient);

if (browser.safari) {
context.querySelector('.enableHi10pSection').classList.remove('hide');
}

context.querySelector('#selectAllowedAudioChannels').value = userSettings.allowedAudioChannels();

apiClient.getCultures().then(allCultures => {
Expand Down Expand Up @@ -175,6 +180,7 @@ function loadForm(context, user, userSettings, systemInfo, apiClient) {
context.querySelector('.chkPreferFmp4HlsContainer').checked = userSettings.preferFmp4HlsContainer();
context.querySelector('.chkEnableDts').checked = appSettings.enableDts();
context.querySelector('.chkEnableTrueHd').checked = appSettings.enableTrueHd();
context.querySelector('.chkEnableHi10p').checked = appSettings.enableHi10p();
context.querySelector('.chkEnableCinemaMode').checked = userSettings.enableCinemaMode();
context.querySelector('#selectAudioNormalization').value = userSettings.selectAudioNormalization();
context.querySelector('.chkEnableNextVideoOverlay').checked = userSettings.enableNextVideoInfoOverlay();
Expand Down Expand Up @@ -225,6 +231,8 @@ function saveUser(context, user, userSettingsInstance, apiClient) {
appSettings.enableDts(context.querySelector('.chkEnableDts').checked);
appSettings.enableTrueHd(context.querySelector('.chkEnableTrueHd').checked);

appSettings.enableHi10p(context.querySelector('.chkEnableHi10p').checked);

setMaxBitrateFromField(context.querySelector('.selectVideoInNetworkQuality'), true, 'Video');
setMaxBitrateFromField(context.querySelector('.selectVideoInternetQuality'), false, 'Video');
setMaxBitrateFromField(context.querySelector('.selectMusicInternetQuality'), false, 'Audio');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ <h2 class="sectionTitle">
<div class="fieldDescription checkboxFieldDescription">${EnableTrueHdHelp}</div>
</div>

<div class="enableHi10pSection checkboxContainer checkboxContainer-withDescription fldEnableDts hide">
gnattu marked this conversation as resolved.
Show resolved Hide resolved
<label>
<input type="checkbox" is="emby-checkbox" class="chkEnableHi10p" />
<span>${EnableHi10p}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${EnableHi10pHelp}</div>
</div>

<div class="selectContainer">
<select is="emby-select" id="selectPreferredTranscodeVideoCodec" label="${LabelSelectPreferredTranscodeVideoCodec}">
<option value="">${Auto}</option>
Expand Down
17 changes: 17 additions & 0 deletions src/scripts/browserDeviceProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,23 @@ export default function (options) {
});
}

if (browser.safari && appSettings.enableHi10p()) {
profile.CodecProfiles.push({
Type: 'Video',
Container: 'hls',
SubContainer: 'mp4',
Codec: 'h264',
Conditions: [
{
Condition: 'EqualsAny',
Property: 'VideoProfile',
Value: h264Profiles + '|high 10',
IsRequired: false
}
]
});
}

profile.CodecProfiles.push({
Type: 'Video',
Codec: 'hevc',
Expand Down
13 changes: 13 additions & 0 deletions src/scripts/settings/appSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,19 @@ class AppSettings {
return toBoolean(this.get('enableTrueHd'), false);
}

/**
* Get or set 'Enable H.264 High 10 Profile' state.
* @param {boolean|undefined} val - Flag to enable 'Enable H.264 High 10 Profile' or undefined.
* @return {boolean} 'Enable H.264 High 10 Profile' state.
*/
enableHi10p(val) {
if (val !== undefined) {
return this.set('enableHi10p', val.toString());
}

return toBoolean(this.get('enableHi10p'), false);
}

set(name, value, userId) {
const currentValue = this.get(name, userId);
localStorage.setItem(this.#getKey(name, userId), value);
Expand Down
2 changes: 2 additions & 0 deletions src/strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@
"EnableFasterAnimations": "Faster animations",
"EnableFasterAnimationsHelp": "Use faster animations and transitions.",
"EnableHardwareEncoding": "Enable hardware encoding",
"EnableHi10p": "Enable H.264 High 10 Profile",
"EnableHi10pHelp": "Enable to avoid transcoding H.264 10-bit videos. Disable this option if the video displays blank frames.",
"EnableLibrary": "Enable the library",
"EnableLibraryHelp": "Disabling the library will hide it from all user views.",
"EnableNextVideoInfoOverlay": "Show next video info during playback",
Expand Down
Loading