movi-player 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -7
- package/dist/core/MoviPlayer.d.ts +77 -1
- package/dist/core/MoviPlayer.d.ts.map +1 -1
- package/dist/core/MoviPlayer.js +667 -121
- package/dist/core/MoviPlayer.js.map +1 -1
- package/dist/core/PlayerState.js +1 -1
- package/dist/core/PlayerState.js.map +1 -1
- package/dist/demuxer.cjs +314 -128
- package/dist/demuxer.js +313 -127
- package/dist/element.cjs +58274 -16562
- package/dist/element.js +59481 -17769
- package/dist/index.cjs +58274 -16562
- package/dist/index.js +59481 -17769
- package/dist/player.cjs +56818 -15360
- package/dist/player.js +57818 -16360
- package/dist/render/DASHPlayerWrapper.d.ts +65 -0
- package/dist/render/DASHPlayerWrapper.d.ts.map +1 -0
- package/dist/render/DASHPlayerWrapper.js +540 -0
- package/dist/render/DASHPlayerWrapper.js.map +1 -0
- package/dist/render/HLSPlayerWrapper.d.ts.map +1 -1
- package/dist/render/HLSPlayerWrapper.js +47 -11
- package/dist/render/HLSPlayerWrapper.js.map +1 -1
- package/dist/render/MoviElement.d.ts +96 -0
- package/dist/render/MoviElement.d.ts.map +1 -1
- package/dist/render/MoviElement.js +784 -118
- package/dist/render/MoviElement.js.map +1 -1
- package/dist/render/ShakaPlayerWrapper.d.ts +111 -0
- package/dist/render/ShakaPlayerWrapper.d.ts.map +1 -0
- package/dist/render/ShakaPlayerWrapper.js +956 -0
- package/dist/render/ShakaPlayerWrapper.js.map +1 -0
- package/dist/source/DashFallback.d.ts +32 -0
- package/dist/source/DashFallback.d.ts.map +1 -0
- package/dist/source/DashFallback.js +142 -0
- package/dist/source/DashFallback.js.map +1 -0
- package/dist/source/DashManifest.d.ts +34 -0
- package/dist/source/DashManifest.d.ts.map +1 -0
- package/dist/source/DashManifest.js +194 -0
- package/dist/source/DashManifest.js.map +1 -0
- package/dist/source/DashSegmentSource.d.ts +32 -0
- package/dist/source/DashSegmentSource.d.ts.map +1 -0
- package/dist/source/DashSegmentSource.js +86 -0
- package/dist/source/DashSegmentSource.js.map +1 -0
- package/dist/source/HttpSource.d.ts +64 -0
- package/dist/source/HttpSource.d.ts.map +1 -1
- package/dist/source/HttpSource.js +444 -57
- package/dist/source/HttpSource.js.map +1 -1
- package/dist/source/ThumbnailHttpSource.d.ts +13 -0
- package/dist/source/ThumbnailHttpSource.d.ts.map +1 -1
- package/dist/source/ThumbnailHttpSource.js +70 -8
- package/dist/source/ThumbnailHttpSource.js.map +1 -1
- package/dist/source/index.d.ts +2 -0
- package/dist/source/index.d.ts.map +1 -1
- package/dist/source/index.js +1 -0
- package/dist/source/index.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -5
package/dist/demuxer.js
CHANGED
|
@@ -75,14 +75,14 @@ class CodecParser {
|
|
|
75
75
|
case 3:
|
|
76
76
|
e2 = "C";
|
|
77
77
|
}
|
|
78
|
-
let
|
|
79
|
-
for (let A3 = 0; A3 < 32; A3++)
|
|
80
|
-
let
|
|
78
|
+
let i2 = 0, s2 = F2;
|
|
79
|
+
for (let A3 = 0; A3 < 32; A3++) i2 = 2 * i2 + (1 & s2), s2 = Math.floor(s2 / 2);
|
|
80
|
+
let a2 = `hvc1.${e2}${n2}.${(i2 >>> 0).toString(16)}.${0 === f2 ? "L" : "H"}${k2}`, u2 = false;
|
|
81
81
|
for (let A3 = 5; A3 >= 0; A3--) {
|
|
82
82
|
const v3 = l2[A3];
|
|
83
|
-
(0 !== v3 ||
|
|
83
|
+
(0 !== v3 || u2) && (a2 += "." + v3.toString(16), u2 = true);
|
|
84
84
|
}
|
|
85
|
-
return r.debug(t, `HEVC codec string: ${
|
|
85
|
+
return r.debug(t, `HEVC codec string: ${a2}`), a2;
|
|
86
86
|
}
|
|
87
87
|
static getAvcCodecString(A2) {
|
|
88
88
|
if (A2.length < 4) return "avc1.420028";
|
|
@@ -644,24 +644,24 @@ class MoviVideoDecoder {
|
|
|
644
644
|
}
|
|
645
645
|
if (0 === t2.length) return r.warn(f, "No SPS found in Annex B extradata"), null;
|
|
646
646
|
const n2 = b2[0] || t2[0], F2 = this.removeEpb(n2), l2 = 32 == (F2[0] >> 1 & 63) ? 6 : 3;
|
|
647
|
-
let k2 = v2?.profile ?? 2, e2 = 0,
|
|
647
|
+
let k2 = v2?.profile ?? 2, e2 = 0, i2 = new Uint8Array([32, 0, 0, 0]), s2 = new Uint8Array(6), a2 = v2?.level ?? 153;
|
|
648
648
|
if (F2.length >= l2 + 12) {
|
|
649
649
|
const A3 = F2[l2];
|
|
650
|
-
k2 = 31 & A3, e2 = A3 >> 5 & 1,
|
|
651
|
-
} else null == v2?.profile && null == v2?.level || r.debug(f, `hvcC from track metadata: profile=${k2}, level=${
|
|
652
|
-
const
|
|
653
|
-
b2.length > 0 &&
|
|
650
|
+
k2 = 31 & A3, e2 = A3 >> 5 & 1, i2 = F2.slice(l2 + 1, l2 + 5), s2 = F2.slice(l2 + 5, l2 + 11), a2 = F2[l2 + 11], r.debug(f, `hvcC from NAL: profile=${k2}, tier=${e2}, level=${a2}`);
|
|
651
|
+
} else null == v2?.profile && null == v2?.level || r.debug(f, `hvcC from track metadata: profile=${k2}, level=${a2}`);
|
|
652
|
+
const u2 = [];
|
|
653
|
+
b2.length > 0 && u2.push({ type: 32, nalus: b2 }), t2.length > 0 && u2.push({ type: 33, nalus: t2 }), E2.length > 0 && u2.push({ type: 34, nalus: E2 });
|
|
654
654
|
let o2 = 23;
|
|
655
|
-
for (const A3 of
|
|
655
|
+
for (const A3 of u2) {
|
|
656
656
|
o2 += 3;
|
|
657
657
|
for (const v3 of A3.nalus) o2 += 2 + v3.length;
|
|
658
658
|
}
|
|
659
659
|
const x2 = new Uint8Array(o2), q2 = new DataView(x2.buffer);
|
|
660
660
|
let B2 = 0;
|
|
661
|
-
x2[B2++] = 1, x2[B2++] = e2 << 5 | 31 & k2, x2[B2++] =
|
|
662
|
-
for (let A3 = 0; A3 < 6; A3++) x2[B2++] =
|
|
663
|
-
x2[B2++] =
|
|
664
|
-
for (const A3 of
|
|
661
|
+
x2[B2++] = 1, x2[B2++] = e2 << 5 | 31 & k2, x2[B2++] = i2[0], x2[B2++] = i2[1], x2[B2++] = i2[2], x2[B2++] = i2[3];
|
|
662
|
+
for (let A3 = 0; A3 < 6; A3++) x2[B2++] = s2[A3];
|
|
663
|
+
x2[B2++] = a2, q2.setUint16(B2, 61440), B2 += 2, x2[B2++] = 252, x2[B2++] = 253, x2[B2++] = 250, x2[B2++] = 250, q2.setUint16(B2, 0), B2 += 2, x2[B2++] = 15, x2[B2++] = u2.length;
|
|
664
|
+
for (const A3 of u2) {
|
|
665
665
|
x2[B2++] = 128 | 63 & A3.type, q2.setUint16(B2, A3.nalus.length), B2 += 2;
|
|
666
666
|
for (const v3 of A3.nalus) q2.setUint16(B2, v3.length), B2 += 2, x2.set(v3, B2), B2 += v3.length;
|
|
667
667
|
}
|
|
@@ -760,17 +760,17 @@ class ThumbnailRenderer {
|
|
|
760
760
|
this.hdrEnabled = f2, this.lastColorPrimaries = t2, this.lastColorTransfer = E2, this.rotation = b2;
|
|
761
761
|
const F2 = b2 % 180 != 0;
|
|
762
762
|
this.canvas.width = F2 ? j2 : v2, this.canvas.height = F2 ? v2 : j2;
|
|
763
|
-
const l2 = (t2 || "").toLowerCase(), k2 = (E2 || "").toLowerCase(), e2 = k2.includes("pq") || k2.includes("hlg") || k2.includes("smpte2084") || k2.includes("arib-std-b67"),
|
|
764
|
-
this.isHDRSource = e2 ||
|
|
765
|
-
const
|
|
763
|
+
const l2 = (t2 || "").toLowerCase(), k2 = (E2 || "").toLowerCase(), e2 = k2.includes("pq") || k2.includes("hlg") || k2.includes("smpte2084") || k2.includes("arib-std-b67"), i2 = l2.includes("bt2020") || l2.includes("rec2020");
|
|
764
|
+
this.isHDRSource = e2 || i2;
|
|
765
|
+
const s2 = this.detectHDRColorSpace(t2, E2);
|
|
766
766
|
if (this.gl = this.canvas.getContext("webgl2", { alpha: false, antialias: false, depth: false, preserveDrawingBuffer: true }), !this.gl) throw new Error("WebGL2 not supported");
|
|
767
767
|
try {
|
|
768
|
-
"srgb" !==
|
|
768
|
+
"srgb" !== s2 && void 0 !== this.gl.drawingBufferColorSpace && (this.gl.drawingBufferColorSpace = s2, this.gl.unpackColorSpace = s2, r.debug(n, `WebGL color space set to: ${s2}`));
|
|
769
769
|
} catch (A3) {
|
|
770
770
|
r.warn(n, "Failed to set drawingBufferColorSpace", A3);
|
|
771
771
|
}
|
|
772
|
-
const
|
|
773
|
-
this.hasNativeHDRSupport =
|
|
772
|
+
const a2 = this.detectChromium();
|
|
773
|
+
this.hasNativeHDRSupport = a2, !this.hasNativeHDRSupport && this.isHDRSource ? (r.debug(n, "Using shader-based HDR tone mapping (non-Chromium)"), this.initWebGLWithHDR()) : (r.debug(n, "Using simple passthrough (Chromium native HDR)"), this.initWebGLSimple()), r.info(n, `Initialized: ${v2}x${j2}, isChromium=${a2}, isHDR=${this.isHDRSource}, colorSpace=${s2}`);
|
|
774
774
|
}
|
|
775
775
|
initWebGLSimple() {
|
|
776
776
|
if (!this.gl) return;
|
|
@@ -977,11 +977,11 @@ function k(v2) {
|
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
979
|
const e = /* @__PURE__ */ new Set();
|
|
980
|
-
function
|
|
980
|
+
function i(A2, v2) {
|
|
981
981
|
const r2 = new DataView(A2.HEAPU8.buffer, v2, F), j2 = A2.HEAPU8.subarray(v2 + 12, v2 + 12 + 32), b2 = new TextDecoder().decode(j2.subarray(0, j2.indexOf(0))), t2 = A2.HEAPU8.subarray(v2 + 100, v2 + 100 + 8), E2 = new TextDecoder().decode(t2.subarray(0, t2.indexOf(0))), f2 = A2.HEAPU8.subarray(v2 + 108, v2 + 108 + 64), n2 = new TextDecoder().decode(f2.subarray(0, f2.indexOf(0)));
|
|
982
|
-
return { index: r2.getInt32(0, true), type: r2.getInt32(4, true), codecId: r2.getInt32(8, true), codecName: b2, width: r2.getInt32(44, true), height: r2.getInt32(48, true), frameRate: r2.getFloat64(56, true), channels: r2.getInt32(64, true), sampleRate: r2.getInt32(68, true), duration: r2.getFloat64(72, true), bitRate: Number(r2.getBigInt64(80, true)), extradataSize: r2.getInt32(88, true), profile: r2.getInt32(92, true), level: r2.getInt32(96, true), language: E2 || "", label: n2 || "", rotation: r2.getInt32(172, true), colorPrimaries:
|
|
982
|
+
return { index: r2.getInt32(0, true), type: r2.getInt32(4, true), codecId: r2.getInt32(8, true), codecName: b2, width: r2.getInt32(44, true), height: r2.getInt32(48, true), frameRate: r2.getFloat64(56, true), channels: r2.getInt32(64, true), sampleRate: r2.getInt32(68, true), duration: r2.getFloat64(72, true), bitRate: Number(r2.getBigInt64(80, true)), extradataSize: r2.getInt32(88, true), profile: r2.getInt32(92, true), level: r2.getInt32(96, true), language: E2 || "", label: n2 || "", rotation: r2.getInt32(172, true), colorPrimaries: s(A2, v2 + 176, 32), colorTransfer: s(A2, v2 + 208, 32), colorMatrix: s(A2, v2 + 240, 32), pixelFormat: s(A2, v2 + 272, 32), colorRange: s(A2, v2 + 304, 32), isAttachedPic: 0 !== r2.getInt32(336, true) };
|
|
983
983
|
}
|
|
984
|
-
function
|
|
984
|
+
function s(A2, v2, r2) {
|
|
985
985
|
const j2 = A2.HEAPU8.subarray(v2, v2 + r2), b2 = j2.indexOf(0);
|
|
986
986
|
return new TextDecoder().decode(j2.subarray(0, b2 >= 0 ? b2 : r2));
|
|
987
987
|
}
|
|
@@ -995,7 +995,7 @@ class WasmBindings {
|
|
|
995
995
|
lastError = null;
|
|
996
996
|
constructor(A2) {
|
|
997
997
|
this.module = A2, this.setupAsyncHandlers(), e.add(this);
|
|
998
|
-
const v2 = null !==
|
|
998
|
+
const v2 = null !== a ? a : r.getLevel();
|
|
999
999
|
this.setLogLevel(k(v2));
|
|
1000
1000
|
}
|
|
1001
1001
|
getHumanReadableError(A2) {
|
|
@@ -1103,7 +1103,7 @@ class WasmBindings {
|
|
|
1103
1103
|
const v2 = this.module._malloc(F);
|
|
1104
1104
|
this.module.HEAPU8.fill(0, v2, v2 + F);
|
|
1105
1105
|
try {
|
|
1106
|
-
return 0 !== this.module._movi_get_stream_info(this.contextPtr, A2, v2) ? null :
|
|
1106
|
+
return 0 !== this.module._movi_get_stream_info(this.contextPtr, A2, v2) ? null : i(this.module, v2);
|
|
1107
1107
|
} finally {
|
|
1108
1108
|
this.module._free(v2);
|
|
1109
1109
|
}
|
|
@@ -1353,7 +1353,7 @@ class WasmBindings {
|
|
|
1353
1353
|
this.contextPtr && this.module._movi_set_skip_frame(this.contextPtr, A2, v2);
|
|
1354
1354
|
}
|
|
1355
1355
|
}
|
|
1356
|
-
let
|
|
1356
|
+
let a = A.SILENT;
|
|
1357
1357
|
class ThumbnailBindings {
|
|
1358
1358
|
module;
|
|
1359
1359
|
contextPtr = 0;
|
|
@@ -1437,7 +1437,7 @@ class ThumbnailBindings {
|
|
|
1437
1437
|
const A2 = this.module._malloc(F);
|
|
1438
1438
|
this.module.HEAPU8.fill(0, A2, A2 + F);
|
|
1439
1439
|
try {
|
|
1440
|
-
return 0 !== this.module._movi_thumbnail_get_stream_info(this.contextPtr, A2) ? null :
|
|
1440
|
+
return 0 !== this.module._movi_thumbnail_get_stream_info(this.contextPtr, A2) ? null : i(this.module, A2);
|
|
1441
1441
|
} finally {
|
|
1442
1442
|
this.module._free(A2);
|
|
1443
1443
|
}
|
|
@@ -1498,12 +1498,12 @@ async function createMoviModule(A2 = {}) {
|
|
|
1498
1498
|
throw new Error(v3.status + " : " + v3.url);
|
|
1499
1499
|
};
|
|
1500
1500
|
}
|
|
1501
|
-
var n2, F2, l2, k2, e2, HEAP32,
|
|
1501
|
+
var n2, F2, l2, k2, e2, HEAP32, i2, s2, a2, HEAPU8, u2 = function() {
|
|
1502
1502
|
}.bind(), o2 = function() {
|
|
1503
1503
|
}.bind(), x2 = false, q2 = false;
|
|
1504
1504
|
function B2() {
|
|
1505
1505
|
var A3 = I2.buffer;
|
|
1506
|
-
|
|
1506
|
+
s2 = new Int8Array(A3), e2 = new Int16Array(A3), Module.HEAPU8 = HEAPU8 = new Uint8Array(A3), HEAP32 = new Int32Array(A3), a2 = new Uint32Array(A3), Module.HEAPF32 = new Float32Array(A3), i2 = new BigInt64Array(A3), new BigUint64Array(A3);
|
|
1507
1507
|
}
|
|
1508
1508
|
function d2(A3) {
|
|
1509
1509
|
Module.onAbort?.(A3), o2(A3 = `Aborted(${A3})`), x2 = true, A3 += ". Build with -sASSERTIONS for more info.";
|
|
@@ -1635,9 +1635,9 @@ async function createMoviModule(A2 = {}) {
|
|
|
1635
1635
|
}
|
|
1636
1636
|
return z.shift();
|
|
1637
1637
|
})(), put_char(A3, v3) {
|
|
1638
|
-
null === v3 || 10 === v3 ? (
|
|
1638
|
+
null === v3 || 10 === v3 ? (u2(V(A3.output)), A3.output = []) : 0 != v3 && A3.output.push(v3);
|
|
1639
1639
|
}, fsync(A3) {
|
|
1640
|
-
A3.output?.length > 0 && (
|
|
1640
|
+
A3.output?.length > 0 && (u2(V(A3.output)), A3.output = []);
|
|
1641
1641
|
}, ioctl_tcgets: (A3) => ({ c_iflag: 25856, c_oflag: 5, c_cflag: 191, c_lflag: 35387, c_cc: [3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }), ioctl_tcsets: (A3, v3, r3) => 0, ioctl_tiocgwinsz: (A3) => [24, 80] }, default_tty1_ops: { put_char(A3, v3) {
|
|
1642
1642
|
null === v3 || 10 === v3 ? (o2(V(A3.output)), A3.output = []) : 0 != v3 && A3.output.push(v3);
|
|
1643
1643
|
}, fsync(A3) {
|
|
@@ -1698,7 +1698,7 @@ async function createMoviModule(A2 = {}) {
|
|
|
1698
1698
|
var E3 = Math.min(A3.node.usedBytes - b3, j3);
|
|
1699
1699
|
return v3.set(t3.subarray(b3, b3 + E3), r3), E3;
|
|
1700
1700
|
}, write(A3, v3, r3, j3, b3, t3) {
|
|
1701
|
-
if (v3.buffer ===
|
|
1701
|
+
if (v3.buffer === s2.buffer && (t3 = false), !j3) return 0;
|
|
1702
1702
|
var E3 = A3.node;
|
|
1703
1703
|
return E3.mtime = E3.ctime = Date.now(), t3 ? (E3.contents = v3.subarray(r3, r3 + j3), E3.usedBytes = j3) : 0 === E3.usedBytes && 0 === b3 ? (E3.contents = v3.slice(r3, r3 + j3), E3.usedBytes = j3) : (vA.expandFileStorage(E3, b3 + j3), E3.contents.set(v3.subarray(r3, r3 + j3), b3), E3.usedBytes = Math.max(E3.usedBytes, b3 + j3)), j3;
|
|
1704
1704
|
}, llseek(A3, v3, r3) {
|
|
@@ -1708,9 +1708,9 @@ async function createMoviModule(A2 = {}) {
|
|
|
1708
1708
|
}, mmap(A3, v3, r3, j3, b3) {
|
|
1709
1709
|
if (!FS.isFile(A3.node.mode)) throw new FS.ErrnoError(43);
|
|
1710
1710
|
var t3, E3, f3 = A3.node.contents;
|
|
1711
|
-
if (2 & b3 || f3.buffer !==
|
|
1711
|
+
if (2 & b3 || f3.buffer !== s2.buffer) {
|
|
1712
1712
|
if (E3 = true, !(t3 = AA())) throw new FS.ErrnoError(48);
|
|
1713
|
-
f3 && ((r3 > 0 || r3 + v3 < f3.length) && (f3 = f3.subarray ? f3.subarray(r3, r3 + v3) : Array.prototype.slice.call(f3, r3, r3 + v3)),
|
|
1713
|
+
f3 && ((r3 > 0 || r3 + v3 < f3.length) && (f3 = f3.subarray ? f3.subarray(r3, r3 + v3) : Array.prototype.slice.call(f3, r3, r3 + v3)), s2.set(f3, t3 >>> 0));
|
|
1714
1714
|
} else E3 = false, t3 = f3.byteOffset;
|
|
1715
1715
|
return { ptr: t3, allocated: E3 };
|
|
1716
1716
|
}, msync: (A3, v3, r3, j3, b3) => (vA.stream_ops.write(A3, v3, 0, j3, r3, false), 0) } }, rA = (A3) => ("string" == typeof A3 && (A3 = W(A3)), A3.subarray || (A3 = new Uint8Array(A3)), A3), jA = (A3, v3) => {
|
|
@@ -2312,7 +2312,7 @@ async function createMoviModule(A2 = {}) {
|
|
|
2312
2312
|
var b6 = new XMLHttpRequest();
|
|
2313
2313
|
return b6.open("GET", j3, false), r3 !== E4 && b6.setRequestHeader("Range", "bytes=" + A6 + "-" + v6), b6.responseType = "arraybuffer", b6.overrideMimeType && b6.overrideMimeType("text/plain; charset=x-user-defined"), b6.send(null), b6.status >= 200 && b6.status < 300 || 304 === b6.status || d2("Couldn't load " + j3 + ". Status: " + b6.status), void 0 !== b6.response ? new Uint8Array(b6.response || []) : W(b6.responseText || "");
|
|
2314
2314
|
})(v5, b5)), void 0 === f4.chunks[A5] && d2("doXHR failed!"), f4.chunks[A5];
|
|
2315
|
-
}), !t4 && r3 || (E4 = r3 = 1, r3 = this.getter(0).length, E4 = r3,
|
|
2315
|
+
}), !t4 && r3 || (E4 = r3 = 1, r3 = this.getter(0).length, E4 = r3, u2("LazyFiles on gzip forces download of the whole file when length is accessed")), this._length = r3, this._chunkSize = E4, this.lengthKnown = true;
|
|
2316
2316
|
}
|
|
2317
2317
|
get length() {
|
|
2318
2318
|
return this.lengthKnown || this.cacheLength(), this._length;
|
|
@@ -2343,7 +2343,7 @@ async function createMoviModule(A2 = {}) {
|
|
|
2343
2343
|
FS.forceLoadFile(f3);
|
|
2344
2344
|
var t4 = AA();
|
|
2345
2345
|
if (!t4) throw new FS.ErrnoError(48);
|
|
2346
|
-
return F3(A4,
|
|
2346
|
+
return F3(A4, s2, t4, v4, r3), { ptr: t4, allocated: true };
|
|
2347
2347
|
}, f3.stream_ops = n3, f3;
|
|
2348
2348
|
} }, nA = { currentUmask: 18, calculateAt(A3, v3, r3) {
|
|
2349
2349
|
if (R.isAbs(v3)) return v3;
|
|
@@ -2354,11 +2354,11 @@ async function createMoviModule(A2 = {}) {
|
|
|
2354
2354
|
}
|
|
2355
2355
|
return j3 + "/" + v3;
|
|
2356
2356
|
}, writeStat(A3, v3) {
|
|
2357
|
-
|
|
2357
|
+
a2[A3 >>> 2 >>> 0] = v3.dev, a2[A3 + 4 >>> 2 >>> 0] = v3.mode, a2[A3 + 8 >>> 2 >>> 0] = v3.nlink, a2[A3 + 12 >>> 2 >>> 0] = v3.uid, a2[A3 + 16 >>> 2 >>> 0] = v3.gid, a2[A3 + 20 >>> 2 >>> 0] = v3.rdev, i2[A3 + 24 >>> 3 >>> 0] = BigInt(v3.size), HEAP32[A3 + 32 >>> 2 >>> 0] = 4096, HEAP32[A3 + 36 >>> 2 >>> 0] = v3.blocks;
|
|
2358
2358
|
var r3 = v3.atime.getTime(), j3 = v3.mtime.getTime(), b3 = v3.ctime.getTime();
|
|
2359
|
-
return
|
|
2359
|
+
return i2[A3 + 40 >>> 3 >>> 0] = BigInt(Math.floor(r3 / 1e3)), a2[A3 + 48 >>> 2 >>> 0] = r3 % 1e3 * 1e3 * 1e3, i2[A3 + 56 >>> 3 >>> 0] = BigInt(Math.floor(j3 / 1e3)), a2[A3 + 64 >>> 2 >>> 0] = j3 % 1e3 * 1e3 * 1e3, i2[A3 + 72 >>> 3 >>> 0] = BigInt(Math.floor(b3 / 1e3)), a2[A3 + 80 >>> 2 >>> 0] = b3 % 1e3 * 1e3 * 1e3, i2[A3 + 88 >>> 3 >>> 0] = BigInt(v3.ino), 0;
|
|
2360
2360
|
}, writeStatFs(A3, v3) {
|
|
2361
|
-
|
|
2361
|
+
a2[A3 + 4 >>> 2 >>> 0] = v3.bsize, a2[A3 + 60 >>> 2 >>> 0] = v3.bsize, i2[A3 + 8 >>> 3 >>> 0] = BigInt(v3.blocks), i2[A3 + 16 >>> 3 >>> 0] = BigInt(v3.bfree), i2[A3 + 24 >>> 3 >>> 0] = BigInt(v3.bavail), i2[A3 + 32 >>> 3 >>> 0] = BigInt(v3.files), i2[A3 + 40 >>> 3 >>> 0] = BigInt(v3.ffree), a2[A3 + 48 >>> 2 >>> 0] = v3.fsid, a2[A3 + 64 >>> 2 >>> 0] = v3.flags, a2[A3 + 56 >>> 2 >>> 0] = v3.namelen;
|
|
2362
2362
|
}, doMsync(A3, v3, r3, j3, b3) {
|
|
2363
2363
|
if (!FS.isFile(v3.node.mode)) throw new FS.ErrnoError(43);
|
|
2364
2364
|
if (2 & j3) return 0;
|
|
@@ -2367,22 +2367,22 @@ async function createMoviModule(A2 = {}) {
|
|
|
2367
2367
|
}, getStreamFromFD: (A3) => FS.getStreamChecked(A3), varargs: void 0, getStr: (A3) => w(A3) }, FA = () => {
|
|
2368
2368
|
var A3 = HEAP32[+nA.varargs >>> 2 >>> 0];
|
|
2369
2369
|
return nA.varargs += 4, A3;
|
|
2370
|
-
}, lA = FA, kA = (A3, v3, r3) => Y(A3, HEAPU8, v3, r3), eA = 0,
|
|
2370
|
+
}, lA = FA, kA = (A3, v3, r3) => Y(A3, HEAPU8, v3, r3), eA = 0, iA = {}, sA = (A3) => {
|
|
2371
2371
|
if (A3 instanceof ExitStatus || "unwind" == A3) return n2;
|
|
2372
2372
|
E2(0, A3);
|
|
2373
|
-
},
|
|
2374
|
-
n2 = A3,
|
|
2373
|
+
}, aA = () => C || eA > 0, uA = (A3) => {
|
|
2374
|
+
n2 = A3, aA() || (Module.onExit?.(A3), x2 = true), E2(0, new ExitStatus(A3));
|
|
2375
2375
|
}, oA = (A3) => {
|
|
2376
2376
|
if (!x2) try {
|
|
2377
2377
|
return A3();
|
|
2378
2378
|
} catch (A4) {
|
|
2379
|
-
|
|
2379
|
+
sA(A4);
|
|
2380
2380
|
} finally {
|
|
2381
2381
|
(() => {
|
|
2382
|
-
if (!
|
|
2383
|
-
n2 = A4 = n2,
|
|
2382
|
+
if (!aA()) try {
|
|
2383
|
+
n2 = A4 = n2, uA(A4);
|
|
2384
2384
|
} catch (A5) {
|
|
2385
|
-
|
|
2385
|
+
sA(A5);
|
|
2386
2386
|
}
|
|
2387
2387
|
var A4;
|
|
2388
2388
|
})();
|
|
@@ -2442,7 +2442,7 @@ async function createMoviModule(A2 = {}) {
|
|
|
2442
2442
|
var A3 = c2(12 + pA.StackSize);
|
|
2443
2443
|
return pA.setDataHeader(A3, A3 + 12, pA.StackSize), pA.setDataRewindFunc(A3), A3;
|
|
2444
2444
|
}, setDataHeader(A3, v3, r3) {
|
|
2445
|
-
|
|
2445
|
+
a2[A3 >>> 2 >>> 0] = v3, a2[A3 + 4 >>> 2 >>> 0] = v3 + r3;
|
|
2446
2446
|
}, setDataRewindFunc(A3) {
|
|
2447
2447
|
var v3 = pA.exportCallStack[0], r3 = pA.getCallStackId(v3);
|
|
2448
2448
|
HEAP32[A3 + 8 >>> 2 >>> 0] = r3;
|
|
@@ -2487,27 +2487,27 @@ async function createMoviModule(A2 = {}) {
|
|
|
2487
2487
|
})(A4)), v4;
|
|
2488
2488
|
}, array: (A4) => {
|
|
2489
2489
|
var v4, r4, j4 = GA(A4.length);
|
|
2490
|
-
return v4 = A4, r4 = j4,
|
|
2490
|
+
return v4 = A4, r4 = j4, s2.set(v4, r4 >>> 0), j4;
|
|
2491
2491
|
} }, E3 = mA(A3), f3 = [], n3 = 0;
|
|
2492
2492
|
if (j3) for (var F3 = 0; F3 < j3.length; F3++) {
|
|
2493
2493
|
var l3 = t3[r3[F3]];
|
|
2494
2494
|
l3 ? (0 === n3 && (n3 = _A()), f3[F3] = l3(j3[F3])) : f3[F3] = j3[F3];
|
|
2495
2495
|
}
|
|
2496
2496
|
var k3 = pA.currData, e3 = E3(...f3);
|
|
2497
|
-
function
|
|
2497
|
+
function i3(A4) {
|
|
2498
2498
|
return eA -= 1, 0 !== n3 && m2(n3), function(A5) {
|
|
2499
2499
|
return "string" === v3 ? w(A5) : "pointer" === v3 ? A5 >>> 0 : "boolean" === v3 ? Boolean(A5) : A5;
|
|
2500
2500
|
}(A4);
|
|
2501
2501
|
}
|
|
2502
|
-
var
|
|
2503
|
-
return eA += 1, pA.currData != k3 ? pA.whenDone().then(
|
|
2502
|
+
var a3 = b3?.async;
|
|
2503
|
+
return eA += 1, pA.currData != k3 ? pA.whenDone().then(i3) : (e3 = i3(e3), a3 ? Promise.resolve(e3) : e3);
|
|
2504
2504
|
}, hA = (A3) => P2.get(A3), NA = [], gA = (A3, v3) => P2.set(A3, v3), IA = (A3) => {
|
|
2505
2505
|
const v3 = A3.length;
|
|
2506
2506
|
return [v3 % 128 | 128, v3 >> 7, ...A3];
|
|
2507
2507
|
}, PA = { i: 127, p: 127, j: 126, f: 125, d: 124, e: 111 }, DA = (A3) => IA(Array.from(A3, (A4) => PA[A4]));
|
|
2508
2508
|
if (FS.createPreloadedFile = (A3, v3, r3, j3, b3, t3, E3, f3, n3, F3) => {
|
|
2509
2509
|
fA(A3, v3, r3, j3, b3, f3, n3, F3).then(t3).catch(E3);
|
|
2510
|
-
}, FS.preloadFile = fA, FS.staticInit(), Module.noExitRuntime && (C = Module.noExitRuntime), Module.preloadPlugins && (EA = Module.preloadPlugins), Module.print && (
|
|
2510
|
+
}, FS.preloadFile = fA, FS.staticInit(), Module.noExitRuntime && (C = Module.noExitRuntime), Module.preloadPlugins && (EA = Module.preloadPlugins), Module.print && (u2 = Module.print), Module.printErr && (o2 = Module.printErr), Module.wasmBinary && Module.wasmBinary, Module.arguments && Module.arguments, Module.thisProgram && (t2 = Module.thisProgram), Module.preInit) for ("function" == typeof Module.preInit && (Module.preInit = [Module.preInit]); Module.preInit.length > 0; ) Module.preInit.shift()();
|
|
2511
2511
|
Module.ccall = JA, Module.cwrap = (A3, v3, r3, j3) => {
|
|
2512
2512
|
var b3 = !r3 || r3.every((A4) => "number" === A4 || "boolean" === A4);
|
|
2513
2513
|
return "string" !== v3 && b3 && !j3 ? mA(A3) : (...b4) => JA(A3, v3, r3, b4, j3);
|
|
@@ -2590,20 +2590,20 @@ async function createMoviModule(A2 = {}) {
|
|
|
2590
2590
|
var j3 = nA.getStreamFromFD(A3);
|
|
2591
2591
|
j3.getdents ||= FS.readdir(j3.path);
|
|
2592
2592
|
for (var b3 = 280, t3 = 0, E3 = FS.llseek(j3, 0, 1), f3 = Math.floor(E3 / b3), n3 = Math.min(j3.getdents.length, f3 + Math.floor(r3 / b3)), F3 = f3; F3 < n3; F3++) {
|
|
2593
|
-
var l3, k3,
|
|
2594
|
-
if ("." ===
|
|
2595
|
-
else if (".." ===
|
|
2593
|
+
var l3, k3, a3 = j3.getdents[F3];
|
|
2594
|
+
if ("." === a3) l3 = j3.node.id, k3 = 4;
|
|
2595
|
+
else if (".." === a3) l3 = FS.lookupPath(j3.path, { parent: true }).node.id, k3 = 4;
|
|
2596
2596
|
else {
|
|
2597
|
-
var
|
|
2597
|
+
var u3;
|
|
2598
2598
|
try {
|
|
2599
|
-
|
|
2599
|
+
u3 = FS.lookupNode(j3.node, a3);
|
|
2600
2600
|
} catch (A4) {
|
|
2601
2601
|
if (28 === A4?.errno) continue;
|
|
2602
2602
|
throw A4;
|
|
2603
2603
|
}
|
|
2604
|
-
l3 =
|
|
2604
|
+
l3 = u3.id, k3 = FS.isChrdev(u3.mode) ? 2 : FS.isDir(u3.mode) ? 4 : FS.isLink(u3.mode) ? 10 : 8;
|
|
2605
2605
|
}
|
|
2606
|
-
|
|
2606
|
+
i2[v3 + t3 >>> 3 >>> 0] = BigInt(l3), i2[v3 + t3 + 8 >>> 3 >>> 0] = BigInt((F3 + 1) * b3), e2[v3 + t3 + 16 >>> 1 >>> 0] = 280, s2[v3 + t3 + 18 >>> 0] = k3, kA(a3, v3 + t3 + 19, 256), t3 += b3;
|
|
2607
2607
|
}
|
|
2608
2608
|
return FS.llseek(j3, F3 * b3, 0), t3;
|
|
2609
2609
|
} catch (A4) {
|
|
@@ -2627,7 +2627,7 @@ async function createMoviModule(A2 = {}) {
|
|
|
2627
2627
|
if (j3.tty.ops.ioctl_tcgets) {
|
|
2628
2628
|
var b3 = j3.tty.ops.ioctl_tcgets(j3), t3 = lA();
|
|
2629
2629
|
HEAP32[t3 >>> 2 >>> 0] = b3.c_iflag || 0, HEAP32[t3 + 4 >>> 2 >>> 0] = b3.c_oflag || 0, HEAP32[t3 + 8 >>> 2 >>> 0] = b3.c_cflag || 0, HEAP32[t3 + 12 >>> 2 >>> 0] = b3.c_lflag || 0;
|
|
2630
|
-
for (var E3 = 0; E3 < 32; E3++)
|
|
2630
|
+
for (var E3 = 0; E3 < 32; E3++) s2[t3 + E3 + 17 >>> 0] = b3.c_cc[E3] || 0;
|
|
2631
2631
|
return 0;
|
|
2632
2632
|
}
|
|
2633
2633
|
return 0;
|
|
@@ -2638,7 +2638,7 @@ async function createMoviModule(A2 = {}) {
|
|
|
2638
2638
|
if (j3.tty.ops.ioctl_tcsets) {
|
|
2639
2639
|
t3 = lA();
|
|
2640
2640
|
var f3 = HEAP32[t3 >>> 2 >>> 0], n3 = HEAP32[t3 + 4 >>> 2 >>> 0], F3 = HEAP32[t3 + 8 >>> 2 >>> 0], l3 = HEAP32[t3 + 12 >>> 2 >>> 0], k3 = [];
|
|
2641
|
-
for (E3 = 0; E3 < 32; E3++) k3.push(
|
|
2641
|
+
for (E3 = 0; E3 < 32; E3++) k3.push(s2[t3 + E3 + 17 >>> 0]);
|
|
2642
2642
|
return j3.tty.ops.ioctl_tcsets(j3.tty, v3, { c_iflag: f3, c_oflag: n3, c_cflag: F3, c_lflag: l3, c_cc: k3 });
|
|
2643
2643
|
}
|
|
2644
2644
|
return 0;
|
|
@@ -2652,8 +2652,8 @@ async function createMoviModule(A2 = {}) {
|
|
|
2652
2652
|
case 21523:
|
|
2653
2653
|
if (!j3.tty) return -59;
|
|
2654
2654
|
if (j3.tty.ops.ioctl_tiocgwinsz) {
|
|
2655
|
-
var
|
|
2656
|
-
t3 = lA(), e2[t3 >>> 1 >>> 0] =
|
|
2655
|
+
var i3 = j3.tty.ops.ioctl_tiocgwinsz(j3.tty);
|
|
2656
|
+
t3 = lA(), e2[t3 >>> 1 >>> 0] = i3[0], e2[t3 + 2 >>> 1 >>> 0] = i3[1];
|
|
2657
2657
|
}
|
|
2658
2658
|
return 0;
|
|
2659
2659
|
default:
|
|
@@ -2736,15 +2736,15 @@ async function createMoviModule(A2 = {}) {
|
|
|
2736
2736
|
var j3 = Date.UTC(r3.getUTCFullYear(), 0, 1, 0, 0, 0, 0), b3 = (r3.getTime() - j3) / 864e5 | 0;
|
|
2737
2737
|
HEAP32[v3 + 28 >>> 2 >>> 0] = b3;
|
|
2738
2738
|
}, k: (A3, v3) => {
|
|
2739
|
-
if (
|
|
2739
|
+
if (iA[A3] && (clearTimeout(iA[A3].id), delete iA[A3]), !v3) return 0;
|
|
2740
2740
|
var r3 = setTimeout(() => {
|
|
2741
|
-
delete
|
|
2741
|
+
delete iA[A3], oA(() => p2(A3, xA()));
|
|
2742
2742
|
}, v3);
|
|
2743
|
-
return
|
|
2743
|
+
return iA[A3] = { id: r3, timeout_ms: v3 }, 0;
|
|
2744
2744
|
}, v: function(A3, v3, r3, j3) {
|
|
2745
2745
|
A3 >>>= 0, v3 >>>= 0, r3 >>>= 0, j3 >>>= 0;
|
|
2746
2746
|
var b3 = (/* @__PURE__ */ new Date()).getFullYear(), t3 = new Date(b3, 0, 1), E3 = new Date(b3, 6, 1), f3 = t3.getTimezoneOffset(), n3 = E3.getTimezoneOffset(), F3 = Math.max(f3, n3);
|
|
2747
|
-
|
|
2747
|
+
a2[A3 >>> 2 >>> 0] = 60 * F3, HEAP32[v3 >>> 2 >>> 0] = Number(f3 != n3);
|
|
2748
2748
|
var l3 = (A4) => {
|
|
2749
2749
|
var v4 = A4 >= 0 ? "-" : "+", r4 = Math.abs(A4);
|
|
2750
2750
|
return `UTC${v4}${String(Math.floor(r4 / 60)).padStart(2, "0")}${String(r4 % 60).padStart(2, "0")}`;
|
|
@@ -2755,7 +2755,7 @@ async function createMoviModule(A2 = {}) {
|
|
|
2755
2755
|
var j3, b3;
|
|
2756
2756
|
b3 = 0 === A3 ? qA() : xA();
|
|
2757
2757
|
var t3 = Math.round(1e3 * b3 * 1e3);
|
|
2758
|
-
return
|
|
2758
|
+
return i2[r3 >>> 3 >>> 0] = BigInt(t3), 0;
|
|
2759
2759
|
}, E: qA, e: xA, m: function(A3) {
|
|
2760
2760
|
A3 >>>= 0;
|
|
2761
2761
|
var v3 = HEAPU8.length, r3 = 4294901760;
|
|
@@ -2772,16 +2772,16 @@ async function createMoviModule(A2 = {}) {
|
|
|
2772
2772
|
var r3 = 0, j3 = 0;
|
|
2773
2773
|
for (var b3 of HA()) {
|
|
2774
2774
|
var t3 = v3 + r3;
|
|
2775
|
-
|
|
2775
|
+
a2[A3 + j3 >>> 2 >>> 0] = t3, r3 += kA(b3, t3, 1 / 0) + 1, j3 += 4;
|
|
2776
2776
|
}
|
|
2777
2777
|
return 0;
|
|
2778
2778
|
}, z: function(A3, v3) {
|
|
2779
2779
|
A3 >>>= 0, v3 >>>= 0;
|
|
2780
2780
|
var r3 = HA();
|
|
2781
|
-
|
|
2781
|
+
a2[A3 >>> 2 >>> 0] = r3.length;
|
|
2782
2782
|
var j3 = 0;
|
|
2783
2783
|
for (var b3 of r3) j3 += Q(b3) + 1;
|
|
2784
|
-
return
|
|
2784
|
+
return a2[v3 >>> 2 >>> 0] = j3, 0;
|
|
2785
2785
|
}, c: function(A3) {
|
|
2786
2786
|
try {
|
|
2787
2787
|
var v3 = nA.getStreamFromFD(A3);
|
|
@@ -2794,7 +2794,7 @@ async function createMoviModule(A2 = {}) {
|
|
|
2794
2794
|
v3 >>>= 0;
|
|
2795
2795
|
try {
|
|
2796
2796
|
var r3 = nA.getStreamFromFD(A3), j3 = r3.tty ? 2 : FS.isDir(r3.mode) ? 3 : FS.isLink(r3.mode) ? 7 : 4;
|
|
2797
|
-
return
|
|
2797
|
+
return s2[v3 >>> 0] = j3, e2[v3 + 2 >>> 1 >>> 0] = 0, i2[v3 + 8 >>> 3 >>> 0] = BigInt(0), i2[v3 + 16 >>> 3 >>> 0] = BigInt(0), 0;
|
|
2798
2798
|
} catch (A4) {
|
|
2799
2799
|
if (void 0 === FS || "ErrnoError" !== A4.name) throw A4;
|
|
2800
2800
|
return A4.errno;
|
|
@@ -2804,15 +2804,15 @@ async function createMoviModule(A2 = {}) {
|
|
|
2804
2804
|
try {
|
|
2805
2805
|
var b3 = ((A4, v4, r4) => {
|
|
2806
2806
|
for (var j4 = 0, b4 = 0; b4 < r4; b4++) {
|
|
2807
|
-
var t3 =
|
|
2807
|
+
var t3 = a2[v4 >>> 2 >>> 0], E3 = a2[v4 + 4 >>> 2 >>> 0];
|
|
2808
2808
|
v4 += 8;
|
|
2809
|
-
var f3 = FS.read(A4,
|
|
2809
|
+
var f3 = FS.read(A4, s2, t3, E3, void 0);
|
|
2810
2810
|
if (f3 < 0) return -1;
|
|
2811
2811
|
if (j4 += f3, f3 < E3) break;
|
|
2812
2812
|
}
|
|
2813
2813
|
return j4;
|
|
2814
2814
|
})(nA.getStreamFromFD(A3), v3, r3);
|
|
2815
|
-
return
|
|
2815
|
+
return a2[j3 >>> 2 >>> 0] = b3, 0;
|
|
2816
2816
|
} catch (A4) {
|
|
2817
2817
|
if (void 0 === FS || "ErrnoError" !== A4.name) throw A4;
|
|
2818
2818
|
return A4.errno;
|
|
@@ -2822,7 +2822,7 @@ async function createMoviModule(A2 = {}) {
|
|
|
2822
2822
|
try {
|
|
2823
2823
|
if (isNaN(v3)) return 22;
|
|
2824
2824
|
var b3 = nA.getStreamFromFD(A3);
|
|
2825
|
-
return FS.llseek(b3, v3, r3),
|
|
2825
|
+
return FS.llseek(b3, v3, r3), i2[j3 >>> 3 >>> 0] = BigInt(b3.position), b3.getdents && 0 === v3 && 0 === r3 && (b3.getdents = null), 0;
|
|
2826
2826
|
} catch (A4) {
|
|
2827
2827
|
if (void 0 === FS || "ErrnoError" !== A4.name) throw A4;
|
|
2828
2828
|
return A4.errno;
|
|
@@ -2832,15 +2832,15 @@ async function createMoviModule(A2 = {}) {
|
|
|
2832
2832
|
try {
|
|
2833
2833
|
var b3 = ((A4, v4, r4) => {
|
|
2834
2834
|
for (var j4 = 0, b4 = 0; b4 < r4; b4++) {
|
|
2835
|
-
var t3 =
|
|
2835
|
+
var t3 = a2[v4 >>> 2 >>> 0], E3 = a2[v4 + 4 >>> 2 >>> 0];
|
|
2836
2836
|
v4 += 8;
|
|
2837
|
-
var f3 = FS.write(A4,
|
|
2837
|
+
var f3 = FS.write(A4, s2, t3, E3, void 0);
|
|
2838
2838
|
if (f3 < 0) return -1;
|
|
2839
2839
|
if (j4 += f3, f3 < E3) break;
|
|
2840
2840
|
}
|
|
2841
2841
|
return j4;
|
|
2842
2842
|
})(nA.getStreamFromFD(A3), v3, r3);
|
|
2843
|
-
return
|
|
2843
|
+
return a2[j3 >>> 2 >>> 0] = b3, 0;
|
|
2844
2844
|
} catch (A4) {
|
|
2845
2845
|
if (void 0 === FS || "ErrnoError" !== A4.name) throw A4;
|
|
2846
2846
|
return A4.errno;
|
|
@@ -2856,7 +2856,7 @@ async function createMoviModule(A2 = {}) {
|
|
|
2856
2856
|
});
|
|
2857
2857
|
}, a: function(A3, v3) {
|
|
2858
2858
|
globalThis.__movilog?.log("[library_movi] Thumbnail packet ready:", A3, v3), Module._pendingThumbnail && (Module._pendingThumbnail.resolve({ size: A3, pts: v3 }), Module._pendingThumbnail = null);
|
|
2859
|
-
}, r:
|
|
2859
|
+
}, r: uA, l: function(A3, v3) {
|
|
2860
2860
|
return A3 >>>= 0, v3 >>>= 0, X(HEAPU8.subarray(A3 >>> 0, A3 + v3 >>> 0));
|
|
2861
2861
|
} };
|
|
2862
2862
|
return LA = await async function() {
|
|
@@ -49091,11 +49091,11 @@ RR\vR\bR\x07R;\fR\rRR RSQR@#RRRRRRRRRR\x1BRRR(.RJ!LRR R!R"R
|
|
|
49091
49091
|
F2 = A3, l2 = v3;
|
|
49092
49092
|
});
|
|
49093
49093
|
}
|
|
49094
|
-
const
|
|
49094
|
+
const u = "FFmpegLoader";
|
|
49095
49095
|
let o = null, x = null;
|
|
49096
49096
|
async function q(A2 = {}) {
|
|
49097
49097
|
return x || o || (o = (async () => {
|
|
49098
|
-
r.info(
|
|
49098
|
+
r.info(u, "Loading WASM module...");
|
|
49099
49099
|
const wasmBinary = A2.wasmBinary || null;
|
|
49100
49100
|
try {
|
|
49101
49101
|
const A3 = createMoviModule, v2 = { print: (A4) => {
|
|
@@ -49105,14 +49105,14 @@ async function q(A2 = {}) {
|
|
|
49105
49105
|
} };
|
|
49106
49106
|
wasmBinary && (v2.wasmBinary = wasmBinary);
|
|
49107
49107
|
const j2 = await A3(v2);
|
|
49108
|
-
return r.info(
|
|
49108
|
+
return r.info(u, "WASM module loaded successfully"), j2.FS ? r.debug(u, "FS is present on module") : r.error(u, "FS is MISSING from module!"), x = j2, j2;
|
|
49109
49109
|
} catch (A3) {
|
|
49110
|
-
throw r.error(
|
|
49110
|
+
throw r.error(u, "Failed to load WASM module", A3), o = null, A3;
|
|
49111
49111
|
}
|
|
49112
49112
|
})(), o);
|
|
49113
49113
|
}
|
|
49114
49114
|
async function B(A2 = {}) {
|
|
49115
|
-
r.info(
|
|
49115
|
+
r.info(u, "Loading NEW WASM module instance (isolated)...");
|
|
49116
49116
|
const wasmBinary = A2.wasmBinary || null;
|
|
49117
49117
|
try {
|
|
49118
49118
|
const A3 = createMoviModule, v2 = { print: (A4) => {
|
|
@@ -49122,9 +49122,9 @@ async function B(A2 = {}) {
|
|
|
49122
49122
|
} };
|
|
49123
49123
|
wasmBinary && (v2.wasmBinary = wasmBinary);
|
|
49124
49124
|
const j2 = await A3(v2);
|
|
49125
|
-
return r.info(
|
|
49125
|
+
return r.info(u, "NEW WASM module instance loaded"), j2;
|
|
49126
49126
|
} catch (A3) {
|
|
49127
|
-
throw r.error(
|
|
49127
|
+
throw r.error(u, "Failed to load new WASM module", A3), A3;
|
|
49128
49128
|
}
|
|
49129
49129
|
}
|
|
49130
49130
|
function d() {
|
|
@@ -49156,6 +49156,11 @@ class HttpSource {
|
|
|
49156
49156
|
streamError = null;
|
|
49157
49157
|
maxBufferedEnd = 0;
|
|
49158
49158
|
fullyBuffered = false;
|
|
49159
|
+
rangeUnsupported = false;
|
|
49160
|
+
linearMode = false;
|
|
49161
|
+
onLinearMode = null;
|
|
49162
|
+
readMax = 0;
|
|
49163
|
+
recentReads = [];
|
|
49159
49164
|
consecutiveForceRestarts = 0;
|
|
49160
49165
|
lastForceRestartTime = 0;
|
|
49161
49166
|
MAX_FORCE_RESTARTS = 3;
|
|
@@ -49178,6 +49183,15 @@ class HttpSource {
|
|
|
49178
49183
|
this.resizeBuffer(r2);
|
|
49179
49184
|
}
|
|
49180
49185
|
}
|
|
49186
|
+
setOnLinearMode(A2) {
|
|
49187
|
+
this.onLinearMode = A2, this.linearMode && A2();
|
|
49188
|
+
}
|
|
49189
|
+
isLinearMode() {
|
|
49190
|
+
return this.linearMode;
|
|
49191
|
+
}
|
|
49192
|
+
isRangeUnsupported() {
|
|
49193
|
+
return this.rangeUnsupported;
|
|
49194
|
+
}
|
|
49181
49195
|
resizeBuffer(A2) {
|
|
49182
49196
|
const v2 = 1024 * this.maxBufferSizeMB * 1024, j2 = Math.max(c, Math.min(v2, A2));
|
|
49183
49197
|
if (this.bufferSize !== j2 || !this.sharedBuffer && !this.fallbackBuffer) {
|
|
@@ -49220,34 +49234,85 @@ class HttpSource {
|
|
|
49220
49234
|
this.useSharedBuffer && this.headerView && Atomics.store(this.headerView, 3, 0);
|
|
49221
49235
|
}
|
|
49222
49236
|
async resolveSize() {
|
|
49223
|
-
|
|
49224
|
-
|
|
49225
|
-
|
|
49226
|
-
|
|
49227
|
-
|
|
49228
|
-
|
|
49237
|
+
let A2 = new Error("Content-Length missing");
|
|
49238
|
+
for (let v2 = 0; v2 < 4; v2++) {
|
|
49239
|
+
try {
|
|
49240
|
+
const v3 = await fetch(this.url, { method: "HEAD", headers: await this.buildRequestHeaders() });
|
|
49241
|
+
if (v3.ok) {
|
|
49242
|
+
this.setFilenameFromDisposition(v3.headers.get("Content-Disposition"));
|
|
49243
|
+
const r2 = v3.headers.get("Content-Length");
|
|
49244
|
+
if (r2) return parseInt(r2, 10);
|
|
49245
|
+
const j2 = await this.resolveSizeViaRange();
|
|
49246
|
+
if (null !== j2) return j2;
|
|
49247
|
+
const b2 = await this.resolveSizeViaPlainGet();
|
|
49248
|
+
if (null !== b2) return b2;
|
|
49249
|
+
A2 = new Error("Content-Length missing");
|
|
49250
|
+
} else {
|
|
49251
|
+
if (403 === v3.status) throw new Error("Access denied. Check video permissions.");
|
|
49252
|
+
if (401 === v3.status) throw new Error("Authentication required.");
|
|
49253
|
+
if (404 === v3.status) throw new Error("Video not found.");
|
|
49254
|
+
A2 = new Error(`HTTP ${v3.status}`);
|
|
49255
|
+
}
|
|
49256
|
+
} catch (v3) {
|
|
49257
|
+
if (/Access denied|Authentication required|Video not found/.test(v3?.message || "")) throw v3;
|
|
49258
|
+
A2 = v3 instanceof Error ? v3 : new Error(String(v3));
|
|
49259
|
+
}
|
|
49260
|
+
v2 < 3 && await new Promise((A3) => setTimeout(A3, 400 * (v2 + 1)));
|
|
49261
|
+
}
|
|
49262
|
+
throw A2;
|
|
49263
|
+
}
|
|
49264
|
+
async resolveSizeViaRange() {
|
|
49265
|
+
let A2;
|
|
49266
|
+
try {
|
|
49267
|
+
A2 = await fetch(this.url, { method: "GET", headers: await this.buildRequestHeaders({ offset: 0, length: 1 }) });
|
|
49268
|
+
} catch {
|
|
49269
|
+
return null;
|
|
49270
|
+
}
|
|
49271
|
+
if (A2.body?.cancel().catch(() => {
|
|
49272
|
+
}), !A2.ok && 206 !== A2.status) return null;
|
|
49273
|
+
const v2 = A2.headers.get("Content-Range");
|
|
49274
|
+
if (v2) {
|
|
49275
|
+
const A3 = /\/\s*(\d+)\s*$/.exec(v2);
|
|
49276
|
+
if (A3) return parseInt(A3[1], 10);
|
|
49277
|
+
}
|
|
49278
|
+
const r2 = A2.headers.get("Content-Length");
|
|
49279
|
+
return 200 === A2.status && r2 ? parseInt(r2, 10) : null;
|
|
49280
|
+
}
|
|
49281
|
+
async resolveSizeViaPlainGet() {
|
|
49282
|
+
let A2;
|
|
49283
|
+
try {
|
|
49284
|
+
A2 = await fetch(this.url, { method: "GET", headers: await this.buildRequestHeaders() });
|
|
49285
|
+
} catch {
|
|
49286
|
+
return null;
|
|
49229
49287
|
}
|
|
49288
|
+
if (A2.body?.cancel().catch(() => {
|
|
49289
|
+
}), !A2.ok) return null;
|
|
49230
49290
|
const v2 = A2.headers.get("Content-Length");
|
|
49231
|
-
if (
|
|
49232
|
-
const
|
|
49233
|
-
if (
|
|
49234
|
-
|
|
49235
|
-
if (A3)
|
|
49236
|
-
|
|
49291
|
+
if (200 === A2.status && v2) return parseInt(v2, 10);
|
|
49292
|
+
const r2 = A2.headers.get("Content-Range");
|
|
49293
|
+
if (r2) {
|
|
49294
|
+
const A3 = /\/\s*(\d+)\s*$/.exec(r2);
|
|
49295
|
+
if (A3) return parseInt(A3[1], 10);
|
|
49296
|
+
}
|
|
49297
|
+
return null;
|
|
49298
|
+
}
|
|
49299
|
+
setFilenameFromDisposition(A2) {
|
|
49300
|
+
if (!A2) return;
|
|
49301
|
+
let v2 = A2.match(/filename\*\s*=\s*(?:UTF-8''|utf-8'')([^;]+)/i);
|
|
49302
|
+
if (v2) try {
|
|
49303
|
+
this._contentDispositionFilename = decodeURIComponent(v2[1].trim());
|
|
49304
|
+
} catch {
|
|
49305
|
+
this._contentDispositionFilename = v2[1].trim();
|
|
49306
|
+
}
|
|
49307
|
+
if (!this._contentDispositionFilename && (v2 = A2.match(/filename\s*=\s*"([^"]+)"/i), v2 || (v2 = A2.match(/filename\s*=\s*([^;]+)/i)), v2)) {
|
|
49308
|
+
const A3 = v2[1].trim();
|
|
49309
|
+
try {
|
|
49310
|
+
this._contentDispositionFilename = decodeURIComponent(A3);
|
|
49237
49311
|
} catch {
|
|
49238
|
-
this._contentDispositionFilename = A3
|
|
49239
|
-
}
|
|
49240
|
-
if (!this._contentDispositionFilename && (A3 = j2.match(/filename\s*=\s*"([^"]+)"/i), A3 || (A3 = j2.match(/filename\s*=\s*([^;]+)/i)), A3)) {
|
|
49241
|
-
const v3 = A3[1].trim();
|
|
49242
|
-
try {
|
|
49243
|
-
this._contentDispositionFilename = decodeURIComponent(v3);
|
|
49244
|
-
} catch {
|
|
49245
|
-
this._contentDispositionFilename = v3;
|
|
49246
|
-
}
|
|
49312
|
+
this._contentDispositionFilename = A3;
|
|
49247
49313
|
}
|
|
49248
|
-
this._contentDispositionFilename && r.debug(H, `Content-Disposition filename: ${this._contentDispositionFilename}`);
|
|
49249
49314
|
}
|
|
49250
|
-
|
|
49315
|
+
this._contentDispositionFilename && r.debug(H, `Content-Disposition filename: ${this._contentDispositionFilename}`);
|
|
49251
49316
|
}
|
|
49252
49317
|
async buildRequestHeaders(A2) {
|
|
49253
49318
|
return A2 ? { ...this.headers, Range: `bytes=${A2.offset}-${A2.offset + A2.length - 1}` } : { ...this.headers };
|
|
@@ -49332,16 +49397,21 @@ class HttpSource {
|
|
|
49332
49397
|
r.debug(H, `Fetching range: ${n2}-${l2} (max ${(F2 / 1024 / 1024).toFixed(1)}MB)`);
|
|
49333
49398
|
const k2 = await fetch(this.url, { headers: await this.buildRequestHeaders({ offset: n2, length: l2 - n2 + 1 }), cache: "no-store", signal: this.abortController.signal });
|
|
49334
49399
|
if (200 === k2.status) {
|
|
49400
|
+
if (b2++, b2 <= 3) {
|
|
49401
|
+
try {
|
|
49402
|
+
k2.body?.cancel();
|
|
49403
|
+
} catch {
|
|
49404
|
+
}
|
|
49405
|
+
r.warn(H, `Server returned 200 instead of 206 (attempt ${b2}/3). CDN may be caching — retrying in 1500ms...`), await new Promise((A3) => setTimeout(A3, 1500));
|
|
49406
|
+
continue;
|
|
49407
|
+
}
|
|
49408
|
+
if (0 === A2) return r.warn(H, "No Range support after 3 retries — falling back to sequential playback."), void await this.consumeNonRangeStream(k2);
|
|
49335
49409
|
try {
|
|
49336
49410
|
k2.body?.cancel();
|
|
49337
49411
|
} catch {
|
|
49338
49412
|
}
|
|
49339
|
-
|
|
49340
|
-
|
|
49341
|
-
continue;
|
|
49342
|
-
}
|
|
49343
|
-
const A3 = new Error("Server does not support range requests.");
|
|
49344
|
-
throw r.error(H, "Server returned 200 after 3 retries. Range requests not supported."), this.abortController?.abort(), this.atomicSetStreaming(false), this.streamError = A3, A3;
|
|
49413
|
+
const v3 = new Error("Server does not support range requests.");
|
|
49414
|
+
throw r.error(H, `Server returned 200 for offset ${A2}; range requests not supported.`), this.abortController?.abort(), this.atomicSetStreaming(false), this.streamError = v3, v3;
|
|
49345
49415
|
}
|
|
49346
49416
|
if (b2 = 0, !k2.ok && 206 !== k2.status) {
|
|
49347
49417
|
if (k2.status >= 400 && k2.status < 500) {
|
|
@@ -49354,9 +49424,9 @@ class HttpSource {
|
|
|
49354
49424
|
throw new Error(`HTTP ${k2.status}`);
|
|
49355
49425
|
}
|
|
49356
49426
|
this.reader = k2.body.getReader(), v2 = 0, t2 = 0, j2 || (this.atomicSetBufferStart(A2), this.atomicSetWritePos(0), j2 = true);
|
|
49357
|
-
let e2 = 0,
|
|
49358
|
-
const
|
|
49359
|
-
for (0 === this.streamStartTime && (this.streamStartTime =
|
|
49427
|
+
let e2 = 0, i2 = 0;
|
|
49428
|
+
const s2 = Date.now();
|
|
49429
|
+
for (0 === this.streamStartTime && (this.streamStartTime = s2, this.lastSpeedTime = s2); this.atomicIsStreaming(); ) {
|
|
49360
49430
|
const { done: A3, value: v3 } = await this.reader.read();
|
|
49361
49431
|
if (A3) {
|
|
49362
49432
|
this.atomicSetStreaming(false);
|
|
@@ -49369,9 +49439,9 @@ class HttpSource {
|
|
|
49369
49439
|
const v4 = this.totalBytesDownloaded - this.lastSpeedBytes;
|
|
49370
49440
|
this.currentSpeed = v4 / j3, this.lastSpeedBytes = this.totalBytesDownloaded, this.lastSpeedTime = A4;
|
|
49371
49441
|
}
|
|
49372
|
-
if (e2 -
|
|
49373
|
-
const A5 = (Date.now() -
|
|
49374
|
-
r.debug(H, `Stream progress: ${(e2 / 1024 / 1024).toFixed(2)} MB read @ ${v4.toFixed(2)} MB/s`),
|
|
49442
|
+
if (e2 - i2 > 1048576) {
|
|
49443
|
+
const A5 = (Date.now() - s2) / 1e3, v4 = A5 > 0 ? e2 / 1024 / 1024 / A5 : 0;
|
|
49444
|
+
r.debug(H, `Stream progress: ${(e2 / 1024 / 1024).toFixed(2)} MB read @ ${v4.toFixed(2)} MB/s`), i2 = e2;
|
|
49375
49445
|
}
|
|
49376
49446
|
let b3 = this.atomicGetWritePos();
|
|
49377
49447
|
if (!(b3 + v3.length <= f2.length)) {
|
|
@@ -49486,6 +49556,87 @@ class HttpSource {
|
|
|
49486
49556
|
this.reader = null;
|
|
49487
49557
|
}
|
|
49488
49558
|
}
|
|
49559
|
+
async consumeNonRangeStream(A2) {
|
|
49560
|
+
if (this.rangeUnsupported = true, this.size > 0) {
|
|
49561
|
+
const A3 = this.useSharedBuffer && this.headerView ? Atomics.load(this.headerView, 5) : 0;
|
|
49562
|
+
this.resizeBuffer(this.size), this.useSharedBuffer && this.headerView && Atomics.store(this.headerView, 5, A3);
|
|
49563
|
+
}
|
|
49564
|
+
const v2 = this.getBuffer(), j2 = this.size > 0 && this.bufferSize >= this.size;
|
|
49565
|
+
if (j2) r.info(H, `Caching entire ${(this.size / 1048576).toFixed(1)}MB file in memory (no Range support).`);
|
|
49566
|
+
else {
|
|
49567
|
+
this.linearMode = true, r.warn(H, `Linear (non-seekable) playback: ${this.size > 0 ? (this.size / 1048576).toFixed(0) + "MB" : "unknown size"} exceeds the ${this.maxBufferSizeMB}MB cache cap or size is unknown.`);
|
|
49568
|
+
try {
|
|
49569
|
+
this.onLinearMode?.();
|
|
49570
|
+
} catch {
|
|
49571
|
+
}
|
|
49572
|
+
}
|
|
49573
|
+
if (this.atomicSetBufferStart(0), this.atomicSetWritePos(0), this.maxBufferedEnd = 0, this.fullyBuffered = false, this.atomicSetStreaming(true), !A2.body) return this.streamError = new Error("Empty response body"), void this.atomicSetStreaming(false);
|
|
49574
|
+
const b2 = A2.body.getReader();
|
|
49575
|
+
this.reader = b2;
|
|
49576
|
+
try {
|
|
49577
|
+
for (; this.atomicIsStreaming(); ) {
|
|
49578
|
+
const { done: A3, value: r2 } = await b2.read();
|
|
49579
|
+
if (A3) break;
|
|
49580
|
+
r2 && 0 !== r2.length && (this.totalBytesDownloaded += r2.length, await this.writeSequential(r2, v2, j2));
|
|
49581
|
+
}
|
|
49582
|
+
} catch (A3) {
|
|
49583
|
+
"AbortError" !== A3?.name && (this.streamError = A3 instanceof Error ? A3 : new Error(String(A3)), r.error(H, "Non-range stream failed", A3));
|
|
49584
|
+
} finally {
|
|
49585
|
+
try {
|
|
49586
|
+
await b2.cancel();
|
|
49587
|
+
} catch {
|
|
49588
|
+
}
|
|
49589
|
+
this.reader = null;
|
|
49590
|
+
}
|
|
49591
|
+
const t2 = this.atomicGetBufferStart() + this.atomicGetWritePos();
|
|
49592
|
+
this.size <= 0 && (this.size = t2), j2 && 0 === this.atomicGetBufferStart() && this.size > 0 && t2 >= this.size && (this.fullyBuffered = true, r.info(H, `Entire file cached (${(this.size / 1048576).toFixed(1)}MB) — full random access.`)), this.atomicSetStreaming(false);
|
|
49593
|
+
}
|
|
49594
|
+
async writeSequential(A2, v2, r2) {
|
|
49595
|
+
let j2 = 0;
|
|
49596
|
+
for (; j2 < A2.length; ) {
|
|
49597
|
+
if (!this.atomicIsStreaming()) return;
|
|
49598
|
+
let b2 = this.atomicGetWritePos();
|
|
49599
|
+
if (b2 >= v2.length) {
|
|
49600
|
+
if (r2) return;
|
|
49601
|
+
if (!await this.slideWindow(v2)) {
|
|
49602
|
+
await new Promise((A3) => setTimeout(A3, 5));
|
|
49603
|
+
continue;
|
|
49604
|
+
}
|
|
49605
|
+
b2 = this.atomicGetWritePos();
|
|
49606
|
+
}
|
|
49607
|
+
const t2 = v2.length - b2, E2 = Math.min(t2, A2.length - j2);
|
|
49608
|
+
let f2 = false;
|
|
49609
|
+
for (let A3 = 0; A3 < 50; A3++) {
|
|
49610
|
+
if (this.tryLock()) {
|
|
49611
|
+
f2 = true;
|
|
49612
|
+
break;
|
|
49613
|
+
}
|
|
49614
|
+
await new Promise((A4) => setTimeout(A4, 1));
|
|
49615
|
+
}
|
|
49616
|
+
if (!f2) {
|
|
49617
|
+
await new Promise((A3) => setTimeout(A3, 5));
|
|
49618
|
+
continue;
|
|
49619
|
+
}
|
|
49620
|
+
v2.set(A2.subarray(j2, j2 + E2), b2);
|
|
49621
|
+
const n2 = b2 + E2;
|
|
49622
|
+
this.atomicSetWritePos(n2);
|
|
49623
|
+
const F2 = this.atomicGetBufferStart() + n2;
|
|
49624
|
+
F2 > this.maxBufferedEnd && (this.maxBufferedEnd = F2), this.unlock(), j2 += E2;
|
|
49625
|
+
}
|
|
49626
|
+
}
|
|
49627
|
+
async slideWindow(A2) {
|
|
49628
|
+
const v2 = this.atomicGetBufferStart(), r2 = this.atomicGetWritePos(), j2 = Math.floor(this.bufferSize / 2), b2 = this.recentReads.length ? Math.min(...this.recentReads) : this.readMax, t2 = Math.max(0, Math.min(b2, this.readMax - j2)), E2 = Math.min(t2 - v2, r2);
|
|
49629
|
+
if (E2 <= 0) return false;
|
|
49630
|
+
let f2 = false;
|
|
49631
|
+
for (let A3 = 0; A3 < 50; A3++) {
|
|
49632
|
+
if (this.tryLock()) {
|
|
49633
|
+
f2 = true;
|
|
49634
|
+
break;
|
|
49635
|
+
}
|
|
49636
|
+
await new Promise((A4) => setTimeout(A4, 1));
|
|
49637
|
+
}
|
|
49638
|
+
return !!f2 && (A2.copyWithin(0, E2, r2), this.atomicSetBufferStart(v2 + E2), this.atomicSetWritePos(r2 - E2), this.unlock(), true);
|
|
49639
|
+
}
|
|
49489
49640
|
async stopStream() {
|
|
49490
49641
|
if (this.atomicSetStreaming(false), this.abortController && (this.abortController.abort(), this.abortController = null), this.reader) {
|
|
49491
49642
|
try {
|
|
@@ -49534,6 +49685,14 @@ class HttpSource {
|
|
|
49534
49685
|
return j3.set(this.headBuffer.subarray(A2, A2 + v2)), this.position = A2 + v2, r.debug(H, "Read: served from head cache"), j3.buffer;
|
|
49535
49686
|
}
|
|
49536
49687
|
if (this.isInBuffer(A2, v2)) return this.consecutiveForceRestarts = 0, r.debug(H, "Read: serving from buffer"), this.readFromBuffer(A2, v2);
|
|
49688
|
+
if (this.rangeUnsupported) {
|
|
49689
|
+
if (A2 < this.atomicGetBufferStart()) throw new Error("Server does not support range requests.");
|
|
49690
|
+
if (this.linearMode && A2 + v2 > this.atomicGetBufferStart() + this.bufferSize) throw new Error("Server does not support range requests.");
|
|
49691
|
+
if (this.atomicIsStreaming() && await this.waitForData(A2, v2)) return this.readFromBuffer(A2, v2);
|
|
49692
|
+
if (this.isInBuffer(A2, v2)) return this.readFromBuffer(A2, v2);
|
|
49693
|
+
if (this.streamError) throw this.streamError;
|
|
49694
|
+
throw new Error("Server does not support range requests.");
|
|
49695
|
+
}
|
|
49537
49696
|
const j2 = this.atomicGetBufferStart(), b2 = A2 - this.bufferEnd, t2 = 2097152, E2 = this.atomicIsStreaming() && A2 >= j2 && A2 < j2 + this.bufferSize && b2 <= t2;
|
|
49538
49697
|
if (r.debug(H, `Read: isCoveredByStream=${E2}, gap=${(b2 / 1024).toFixed(0)}KB`), E2) {
|
|
49539
49698
|
r.debug(H, "Read: waiting for data from active stream...");
|
|
@@ -49568,7 +49727,7 @@ class HttpSource {
|
|
|
49568
49727
|
}
|
|
49569
49728
|
readFromBuffer(A2, v2) {
|
|
49570
49729
|
const r2 = this.getBuffer(), j2 = A2 - this.atomicGetBufferStart(), b2 = Math.min(v2, this.bufferEnd - A2), t2 = new Uint8Array(b2);
|
|
49571
|
-
return t2.set(r2.subarray(j2, j2 + b2)), this.position = A2 + b2, t2.buffer;
|
|
49730
|
+
return t2.set(r2.subarray(j2, j2 + b2)), this.position = A2 + b2, this.position > this.readMax && (this.readMax = this.position), this.recentReads.push(A2), this.recentReads.length > 64 && this.recentReads.shift(), t2.buffer;
|
|
49572
49731
|
}
|
|
49573
49732
|
seek(A2) {
|
|
49574
49733
|
return this.position = A2, this.position;
|
|
@@ -49842,6 +50001,7 @@ class ThumbnailHttpSource {
|
|
|
49842
50001
|
size = -1;
|
|
49843
50002
|
position = 0;
|
|
49844
50003
|
abortController = null;
|
|
50004
|
+
rangeUnsupported = false;
|
|
49845
50005
|
buffer = null;
|
|
49846
50006
|
bufferStart = 0;
|
|
49847
50007
|
bufferEnd = 0;
|
|
@@ -49852,13 +50012,38 @@ class ThumbnailHttpSource {
|
|
|
49852
50012
|
setBorrowSource(A2) {
|
|
49853
50013
|
this.borrowSource = A2;
|
|
49854
50014
|
}
|
|
50015
|
+
seedSize(A2) {
|
|
50016
|
+
A2 > 0 && (this.size = A2);
|
|
50017
|
+
}
|
|
49855
50018
|
async getSize() {
|
|
49856
50019
|
if (this.size >= 0) return this.size;
|
|
49857
50020
|
const A2 = await fetch(this.url, { method: "HEAD", headers: this.headers });
|
|
49858
50021
|
if (!A2.ok) throw new Error(`HTTP ${A2.status}`);
|
|
49859
50022
|
const v2 = A2.headers.get("Content-Length");
|
|
49860
|
-
if (
|
|
49861
|
-
|
|
50023
|
+
if (v2) this.size = parseInt(v2, 10);
|
|
50024
|
+
else {
|
|
50025
|
+
const A3 = await this.resolveSizeViaRange();
|
|
50026
|
+
if (null === A3) throw new Error("Content-Length missing");
|
|
50027
|
+
this.size = A3;
|
|
50028
|
+
}
|
|
50029
|
+
return r.debug(g, `File size: ${this.size} bytes`), this.size;
|
|
50030
|
+
}
|
|
50031
|
+
async resolveSizeViaRange() {
|
|
50032
|
+
let A2;
|
|
50033
|
+
try {
|
|
50034
|
+
A2 = await fetch(this.url, { method: "GET", headers: { ...this.headers, Range: "bytes=0-0" } });
|
|
50035
|
+
} catch {
|
|
50036
|
+
return null;
|
|
50037
|
+
}
|
|
50038
|
+
if (A2.body?.cancel().catch(() => {
|
|
50039
|
+
}), !A2.ok && 206 !== A2.status) return null;
|
|
50040
|
+
const v2 = A2.headers.get("Content-Range");
|
|
50041
|
+
if (v2) {
|
|
50042
|
+
const A3 = /\/\s*(\d+)\s*$/.exec(v2);
|
|
50043
|
+
if (A3) return parseInt(A3[1], 10);
|
|
50044
|
+
}
|
|
50045
|
+
const r2 = A2.headers.get("Content-Length");
|
|
50046
|
+
return 200 === A2.status && r2 ? parseInt(r2, 10) : null;
|
|
49862
50047
|
}
|
|
49863
50048
|
isInBuffer(A2, v2) {
|
|
49864
50049
|
return null !== this.buffer && A2 >= this.bufferStart && A2 + v2 <= this.bufferEnd;
|
|
@@ -49875,6 +50060,7 @@ class ThumbnailHttpSource {
|
|
|
49875
50060
|
const b3 = this.borrowSource.peekRange(A2, v2);
|
|
49876
50061
|
if (b3) return this.position = A2 + v2, r.debug(g, `Read borrowed from main window: offset=${A2}, length=${v2}`), b3.buffer;
|
|
49877
50062
|
}
|
|
50063
|
+
if (this.rangeUnsupported) return new ArrayBuffer(0);
|
|
49878
50064
|
const j2 = A2, b2 = Math.min(Math.max(2097152, v2), 5242880), t2 = this.size > 0 ? Math.min(j2 + b2 - 1, this.size - 1) : j2 + b2 - 1;
|
|
49879
50065
|
r.debug(g, `Fetching: range=${j2}-${t2} (${((t2 - j2 + 1) / 1024).toFixed(1)} KB)`);
|
|
49880
50066
|
for (let b3 = 0; b3 <= 5; b3++) {
|
|
@@ -49887,7 +50073,7 @@ class ThumbnailHttpSource {
|
|
|
49887
50073
|
const E2 = new AbortController(), f2 = setTimeout(() => E2.abort(), 1e4);
|
|
49888
50074
|
try {
|
|
49889
50075
|
const b4 = await fetch(this.url, { headers: { ...this.headers, Range: `bytes=${j2}-${t2}` }, cache: "no-store", signal: E2.signal });
|
|
49890
|
-
if (clearTimeout(f2), 200 === b4.status)
|
|
50076
|
+
if (clearTimeout(f2), 200 === b4.status) return r.info(g, "Server returned 200 (no Range support) — thumbnails switch to borrow-only."), E2.abort(), this.rangeUnsupported = true, new ArrayBuffer(0);
|
|
49891
50077
|
if (!b4.ok && 206 !== b4.status) {
|
|
49892
50078
|
if (416 === b4.status) return r.warn(g, `HTTP 416 (Range Not Satisfiable) at ${j2}-${t2}. Treating as EOF.`), new ArrayBuffer(0);
|
|
49893
50079
|
throw b4.status >= 500 || 429 === b4.status ? new Error(`HTTP ${b4.status}`) : new Error(`HTTP ${b4.status} (Fatal)`);
|