From d6734e505cad9924fed4e197ca3f7741189a650a Mon Sep 17 00:00:00 2001 From: catShark <1716967236@qq.com> Date: Mon, 19 Oct 2026 23:02:39 +0800 Subject: [PATCH] caps: probe hvc1.1.0.L120 so the HEVC gate is not blocked Chrome's decodingInfo rejects the constraint-byte-less 'hvc1.1.L120' and answers supported:false even on a machine that decodes HEVC fine. The override then blocked every spelling of tier 1:120, and 1:120 is exactly what browserDeviceProfile.js's supportsHevc() probes -- so hevc was dropped from every DirectPlayProfile and the whole HEVC library was transcoded. Probe the valid 'hvc1.1.0.L120' instead, and only act on 1:120 when no Main tier is usable at all. --- dist/jfvr.js | 33 ++++++++++++++++++++++++++++++++- src/00-core.js | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/dist/jfvr.js b/dist/jfvr.js index f46bae1..21102dd 100644 --- a/dist/jfvr.js +++ b/dist/jfvr.js @@ -403,8 +403,23 @@ // each level is probed at the resolution and bitrate it exists for. Main // (8-bit) is probed at the same levels as Main 10 because it is the control // that decides whether a level is really out of reach. + // + // NOTE on the codec strings: they MUST carry a constraint byte. Chrome's + // MediaCapabilities.decodingInfo does not recognise the bare 'hvc1.1.L120' + // spelling and answers supported:false for it even on a machine that decodes + // HEVC perfectly, while 'hvc1.1.0.L120' is answered correctly. That one + // character used to matter far more than it looks: browserDeviceProfile.js + // gates the WHOLE hevc entry on supportsHevc(), which is exactly + // + // canPlayType('...codecs="hvc1.1.L120"') || + // canPlayType('...codecs="hev1.1.L120"') || + // canPlayType('...codecs="hvc1.1.0.L120"') || ... + // + // so a spurious block of tier 1:120 (all spellings map to it) removes hevc + // from every DirectPlayProfile and transcode every HEVC file in the library. + // 1:120 is NOT part of Jellyfin's level chain; it is only that gate. var CODEC_PROBES = [ - { key: '1:120', name: 'Main L4.0', w: 1920, h: 1080, fps: 30, mbps: 8, codec: 'hvc1.1.L120' }, + { key: '1:120', name: 'Main L4.0', w: 1920, h: 1080, fps: 30, mbps: 8, codec: 'hvc1.1.0.L120' }, { key: '1:123', name: 'Main L4.1', w: 1920, h: 1080, fps: 60, mbps: 8, codec: 'hvc1.1.4.L123' }, { key: '1:153', name: 'Main L5.1 (4K)', w: 3840, h: 2160, fps: 60, mbps: 20, codec: 'hvc1.1.5.L153.B0' }, { key: '1:183', name: 'Main L6.1 (8K)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.1.6.L183.B0' }, @@ -501,6 +516,22 @@ var own = blockReason(v, keep); if (!own) return null; var parts = key.split(':'); + + // Base tier. 1:120 is not in Jellyfin's level chain -- it is only the + // coarse "does this client have HEVC at all" gate (supportsHevc() in + // browserDeviceProfile.js, which probes exactly this level). Blocking it + // drops hevc from every DirectPlayProfile, i.e. transcodes the entire + // HEVC library. Never act on it unless the device is unusable at EVERY + // Main tier, so one flaky/early probe cannot do that. + if (key === '1:120') { + var anyMainUsable = CODEC_PROBES.some(function (p) { + if (p.key === '1:120' || p.key.charAt(0) !== '1') return false; + var m = NS.caps.codec[p.key]; + return !!m && !m.error && m.supported !== false && m.smooth !== false; + }); + if (anyMainUsable) return null; + } + if (parts[0] === '2') { // Control: the same level in Main (8-bit). if (!tierUnusable('1:' + parts[1])) return null; diff --git a/src/00-core.js b/src/00-core.js index 49095b1..2981590 100644 --- a/src/00-core.js +++ b/src/00-core.js @@ -395,8 +395,23 @@ // each level is probed at the resolution and bitrate it exists for. Main // (8-bit) is probed at the same levels as Main 10 because it is the control // that decides whether a level is really out of reach. + // + // NOTE on the codec strings: they MUST carry a constraint byte. Chrome's + // MediaCapabilities.decodingInfo does not recognise the bare 'hvc1.1.L120' + // spelling and answers supported:false for it even on a machine that decodes + // HEVC perfectly, while 'hvc1.1.0.L120' is answered correctly. That one + // character used to matter far more than it looks: browserDeviceProfile.js + // gates the WHOLE hevc entry on supportsHevc(), which is exactly + // + // canPlayType('...codecs="hvc1.1.L120"') || + // canPlayType('...codecs="hev1.1.L120"') || + // canPlayType('...codecs="hvc1.1.0.L120"') || ... + // + // so a spurious block of tier 1:120 (all spellings map to it) removes hevc + // from every DirectPlayProfile and transcode every HEVC file in the library. + // 1:120 is NOT part of Jellyfin's level chain; it is only that gate. var CODEC_PROBES = [ - { key: '1:120', name: 'Main L4.0', w: 1920, h: 1080, fps: 30, mbps: 8, codec: 'hvc1.1.L120' }, + { key: '1:120', name: 'Main L4.0', w: 1920, h: 1080, fps: 30, mbps: 8, codec: 'hvc1.1.0.L120' }, { key: '1:123', name: 'Main L4.1', w: 1920, h: 1080, fps: 60, mbps: 8, codec: 'hvc1.1.4.L123' }, { key: '1:153', name: 'Main L5.1 (4K)', w: 3840, h: 2160, fps: 60, mbps: 20, codec: 'hvc1.1.5.L153.B0' }, { key: '1:183', name: 'Main L6.1 (8K)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.1.6.L183.B0' }, @@ -493,6 +508,22 @@ var own = blockReason(v, keep); if (!own) return null; var parts = key.split(':'); + + // Base tier. 1:120 is not in Jellyfin's level chain -- it is only the + // coarse "does this client have HEVC at all" gate (supportsHevc() in + // browserDeviceProfile.js, which probes exactly this level). Blocking it + // drops hevc from every DirectPlayProfile, i.e. transcodes the entire + // HEVC library. Never act on it unless the device is unusable at EVERY + // Main tier, so one flaky/early probe cannot do that. + if (key === '1:120') { + var anyMainUsable = CODEC_PROBES.some(function (p) { + if (p.key === '1:120' || p.key.charAt(0) !== '1') return false; + var m = NS.caps.codec[p.key]; + return !!m && !m.error && m.supported !== false && m.smooth !== false; + }); + if (anyMainUsable) return null; + } + if (parts[0] === '2') { // Control: the same level in Main (8-bit). if (!tierUnusable('1:' + parts[1])) return null;