Rework profile selection

This commit is contained in:
shirt 2022-10-09 12:22:13 -04:00
parent a4bc5f94cd
commit 0c6844c4bb
5 changed files with 68 additions and 68 deletions

View file

@ -39,31 +39,61 @@ request.send();
var cadmium_src = request.responseText; var cadmium_src = request.responseText;
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
function get_profile_list() { function get_profile_list(original_profiles) {
var profiles = original_profiles;
// Always add h264 main profiles // Always add h264 main profiles
var custom_profiles = [ if (original_profiles.includes("playready-h264mpl30-dash")) {
profiles = profiles.concat([
"playready-h264mpl30-dash", "playready-h264mpl30-dash",
"playready-h264mpl31-dash", "playready-h264mpl31-dash",
"playready-h264mpl40-dash", "playready-h264mpl40-dash",
];
if (window.MSMediaKeys) {
// PlayReady Specific
// Always add 2.0 AAC profiles, some manifests fail without them
custom_profiles = custom_profiles.concat([
"heaac-2-dash",
"heaac-2hq-dash",
]); ]);
}
if (globalOptions.useDDPlus) { if (original_profiles.includes("playready-h264hpl30-dash")) {
profiles = profiles.concat([
"playready-h264hpl30-dash",
"playready-h264hpl31-dash",
"playready-h264hpl40-dash",
]);
}
if (original_profiles.includes("h264hpl30-dash-playready-live")) {
profiles = profiles.concat([
"h264hpl30-dash-playready-live",
"h264hpl31-dash-playready-live",
"h264hpl40-dash-playready-live",
]);
}
if (!globalOptions.disableVP9 && original_profiles.includes("vp9-profile0-L30-dash-cenc")) {
profiles = profiles.concat([
"vp9-profile0-L30-dash-cenc",
"vp9-profile0-L31-dash-cenc",
"vp9-profile0-L40-dash-cenc",
]);
} else {
profiles = profiles.filter(val => !val.includes("vp9-"));
}
if (!globalOptions.disableAV1 && original_profiles.includes("av1-main-L30-dash-cbcs-prk")) {
profiles = profiles.concat([
"av1-main-L30-dash-cbcs-prk",
"av1-main-L31-dash-cbcs-prk",
"av1-main-L40-dash-cbcs-prk",
]);
} else {
profiles = profiles.filter(val => !val.includes("av1-"));
}
if (globalOptions.useDDPlus && MediaSource.isTypeSupported('audio/mp4; codecs="ec-3"')) {
// Dolby Digital // Dolby Digital
custom_profiles = custom_profiles.concat([ profiles = profiles.concat([
"ddplus-2.0-dash", "ddplus-2.0-dash",
]); ]);
if (globalOptions.use6Channels) { if (globalOptions.use6Channels) {
custom_profiles = custom_profiles.concat([ profiles = profiles.concat([
"ddplus-5.1-dash", "ddplus-5.1-dash",
"ddplus-5.1hq-dash", "ddplus-5.1hq-dash",
"ddplus-atmos-dash", "ddplus-atmos-dash",
@ -72,53 +102,14 @@ function get_profile_list() {
} else { } else {
// No Dolby Digital // No Dolby Digital
if (globalOptions.use6Channels) { if (globalOptions.use6Channels) {
custom_profiles = custom_profiles.concat([ profiles = profiles.concat([
"heaac-5.1-dash", "heaac-5.1-dash",
]); ]);
} }
} }
profiles = [...new Set(profiles)].sort();
} else { return profiles;
// Widevine Specific
custom_profiles = custom_profiles.concat([
"playready-h264hpl30-dash",
"playready-h264hpl31-dash",
"playready-h264hpl40-dash",
]);
if (!globalOptions.disableVP9) {
// Add VP9 Profiles if wanted
custom_profiles = custom_profiles.concat([
"vp9-profile0-L30-dash-cenc",
"vp9-profile0-L31-dash-cenc",
"vp9-profile0-L40-dash-cenc",
]);
}
custom_profiles = custom_profiles.concat([
"heaac-2-dash",
"heaac-2hq-dash",
]);
if (globalOptions.use6Channels) {
custom_profiles = custom_profiles.concat([
"heaac-5.1-dash",
]);
}
}
// Always add subtitles
custom_profiles = custom_profiles.concat([
"dfxp-ls-sdh",
"simplesdh",
"nflx-cmisc",
"imsc1.1",
"BIF240",
"BIF320",
]);
return custom_profiles;
} }
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
@ -139,14 +130,14 @@ do_patch(
do_patch( do_patch(
"Custom profiles", "Custom profiles",
/(viewableId:.,profiles:).,/, /(viewableId:.,profiles:)(.),/,
"$1 get_profile_list()," "$1 get_profile_list($2),"
); );
do_patch( do_patch(
"Custom profiles 2", "Custom profiles 2",
/(name:"default",profiles:).}/, /(name:"default",profiles:)(.)}/,
"$1 get_profile_list()}" "$1 get_profile_list($2)}"
); );
do_patch( do_patch(

View file

@ -46,6 +46,7 @@ chromeStorageGet({
showAllTracks: true, showAllTracks: true,
setMaxBitrate: false, setMaxBitrate: false,
disableVP9: false, disableVP9: false,
disableAV1: true,
useDDPlus: false, useDDPlus: false,
preferredLocale: null, preferredLocale: null,
preferredTextLocale: null, preferredTextLocale: null,

View file

@ -2,7 +2,7 @@
"manifest_version": 2, "manifest_version": 2,
"name": "Netflix International", "name": "Netflix International",
"description": "Displays all available Netflix audio and subtitle tracks.", "description": "Displays all available Netflix audio and subtitle tracks.",
"version": "2.0.15", "version": "2.0.16",
"author": "shirt", "author": "shirt",
"browser_action": { "browser_action": {
"default_icon": "img/icon128.png", "default_icon": "img/icon128.png",

View file

@ -19,6 +19,8 @@
<br> <br>
<input type="checkbox" id="disableVP9"><label for="disableVP9">Disable VP9 codec (Chrome/Firefox)</label> <input type="checkbox" id="disableVP9"><label for="disableVP9">Disable VP9 codec (Chrome/Firefox)</label>
<br> <br>
<input type="checkbox" id="disableAV1"><label for="disableAV1">Disable AV1 codec (Chrome/Firefox)</label>
<br>
<input type="checkbox" id="useDDPlus"><label for="useDDPlus">Use Dolby Digital Plus (Chromium Edge)</label> <input type="checkbox" id="useDDPlus"><label for="useDDPlus">Use Dolby Digital Plus (Chromium Edge)</label>
<br> <br>
<label for="preferredLocale">Preferred audio language</label> <label for="preferredLocale">Preferred audio language</label>

View file

@ -4,6 +4,7 @@ function save_options() {
const showAllTracks = document.getElementById("showAllTracks").checked; const showAllTracks = document.getElementById("showAllTracks").checked;
const setMaxBitrate = document.getElementById("setMaxBitrate").checked; const setMaxBitrate = document.getElementById("setMaxBitrate").checked;
const disableVP9 = document.getElementById("disableVP9").checked; const disableVP9 = document.getElementById("disableVP9").checked;
const disableAV1 = document.getElementById("disableAV1").checked;
const useDDPlus = document.getElementById("useDDPlus").checked; const useDDPlus = document.getElementById("useDDPlus").checked;
const preferredLocale = document.getElementById("preferredLocale").value; const preferredLocale = document.getElementById("preferredLocale").value;
const preferredTextLocale = document.getElementById("preferredTextLocale").value; const preferredTextLocale = document.getElementById("preferredTextLocale").value;
@ -13,6 +14,7 @@ function save_options() {
showAllTracks: showAllTracks, showAllTracks: showAllTracks,
setMaxBitrate: setMaxBitrate, setMaxBitrate: setMaxBitrate,
disableVP9: disableVP9, disableVP9: disableVP9,
disableAV1: disableAV1,
useDDPlus: useDDPlus, useDDPlus: useDDPlus,
preferredLocale: preferredLocale, preferredLocale: preferredLocale,
preferredTextLocale: preferredTextLocale, preferredTextLocale: preferredTextLocale,
@ -30,6 +32,7 @@ function reset_options() {
document.getElementById("showAllTracks").checked = true; document.getElementById("showAllTracks").checked = true;
document.getElementById("setMaxBitrate").checked = false; document.getElementById("setMaxBitrate").checked = false;
document.getElementById("disableVP9").checked = false; document.getElementById("disableVP9").checked = false;
document.getElementById("disableAV1").checked = true;
document.getElementById("useDDPlus").checked = false; document.getElementById("useDDPlus").checked = false;
document.getElementById("preferredLocale").value = null; document.getElementById("preferredLocale").value = null;
document.getElementById("preferredTextLocale").value = null; document.getElementById("preferredTextLocale").value = null;
@ -39,6 +42,7 @@ function reset_options() {
showAllTracks: true, showAllTracks: true,
setMaxBitrate: false, setMaxBitrate: false,
disableVP9: false, disableVP9: false,
disableAV1: true,
useDDPlus: false, useDDPlus: false,
preferredLocale: null, preferredLocale: null,
preferredTextLocale: null, preferredTextLocale: null,
@ -57,6 +61,7 @@ function restore_options() {
showAllTracks: true, showAllTracks: true,
setMaxBitrate: false, setMaxBitrate: false,
disableVP9: false, disableVP9: false,
disableAV1: true,
useDDPlus: false, useDDPlus: false,
preferredLocale: null, preferredLocale: null,
preferredTextLocale: null, preferredTextLocale: null,
@ -65,6 +70,7 @@ function restore_options() {
document.getElementById("showAllTracks").checked = items.showAllTracks; document.getElementById("showAllTracks").checked = items.showAllTracks;
document.getElementById("setMaxBitrate").checked = items.setMaxBitrate; document.getElementById("setMaxBitrate").checked = items.setMaxBitrate;
document.getElementById("disableVP9").checked = items.disableVP9; document.getElementById("disableVP9").checked = items.disableVP9;
document.getElementById("disableAV1").checked = items.disableAV1;
document.getElementById("useDDPlus").checked = items.useDDPlus; document.getElementById("useDDPlus").checked = items.useDDPlus;
document.getElementById("preferredLocale").value = items.preferredLocale; document.getElementById("preferredLocale").value = items.preferredLocale;
document.getElementById("preferredTextLocale").value = items.preferredTextLocale; document.getElementById("preferredTextLocale").value = items.preferredTextLocale;