@meframe/server 0.0.6 → 0.0.7
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/dist/cjs/ServerExporterBase.js +1 -0
- package/dist/cjs/ServerExporterBase.js.map +1 -1
- package/dist/cjs/runner/runner.js +2 -1
- package/dist/cjs/runner/runner.js.map +1 -1
- package/dist/esm/ServerExporterBase.d.ts.map +1 -1
- package/dist/esm/ServerExporterBase.js +1 -0
- package/dist/esm/ServerExporterBase.js.map +1 -1
- package/dist/esm/runner/runner.d.ts +2 -1
- package/dist/esm/runner/runner.d.ts.map +1 -1
- package/dist/esm/runner/runner.js +2 -1
- package/dist/esm/runner/runner.js.map +1 -1
- package/dist/esm/types.d.ts +9 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/runner-browser/runner.mjs +645 -644
- package/docs/INTEGRATION.md +13 -0
- package/package.json +1 -1
|
@@ -2097,41 +2097,41 @@ var Gi = {};
|
|
|
2097
2097
|
(function(a) {
|
|
2098
2098
|
var e = /* @__PURE__ */ function() {
|
|
2099
2099
|
var t = /* @__PURE__ */ new Date(), n = 4, c = 3, d = 2, f = 1, y = n, _ = {
|
|
2100
|
-
setLogLevel: function(
|
|
2101
|
-
|
|
2100
|
+
setLogLevel: function(k) {
|
|
2101
|
+
k == this.debug ? y = f : k == this.info ? y = d : k == this.warn ? y = c : (k == this.error, y = n);
|
|
2102
2102
|
},
|
|
2103
|
-
debug: function(
|
|
2104
|
-
console.debug === void 0 && (console.debug = console.log), f >= y && console.debug("[" + e.getDurationString(/* @__PURE__ */ new Date() - t, 1e3) + "]", "[" +
|
|
2103
|
+
debug: function(k, b) {
|
|
2104
|
+
console.debug === void 0 && (console.debug = console.log), f >= y && console.debug("[" + e.getDurationString(/* @__PURE__ */ new Date() - t, 1e3) + "]", "[" + k + "]", b);
|
|
2105
2105
|
},
|
|
2106
|
-
log: function(
|
|
2107
|
-
this.debug(
|
|
2106
|
+
log: function(k, b) {
|
|
2107
|
+
this.debug(k.msg);
|
|
2108
2108
|
},
|
|
2109
|
-
info: function(
|
|
2110
|
-
d >= y && console.info("[" + e.getDurationString(/* @__PURE__ */ new Date() - t, 1e3) + "]", "[" +
|
|
2109
|
+
info: function(k, b) {
|
|
2110
|
+
d >= y && console.info("[" + e.getDurationString(/* @__PURE__ */ new Date() - t, 1e3) + "]", "[" + k + "]", b);
|
|
2111
2111
|
},
|
|
2112
|
-
warn: function(
|
|
2113
|
-
c >= y && console.warn("[" + e.getDurationString(/* @__PURE__ */ new Date() - t, 1e3) + "]", "[" +
|
|
2112
|
+
warn: function(k, b) {
|
|
2113
|
+
c >= y && console.warn("[" + e.getDurationString(/* @__PURE__ */ new Date() - t, 1e3) + "]", "[" + k + "]", b);
|
|
2114
2114
|
},
|
|
2115
|
-
error: function(
|
|
2116
|
-
n >= y && console.error("[" + e.getDurationString(/* @__PURE__ */ new Date() - t, 1e3) + "]", "[" +
|
|
2115
|
+
error: function(k, b) {
|
|
2116
|
+
n >= y && console.error("[" + e.getDurationString(/* @__PURE__ */ new Date() - t, 1e3) + "]", "[" + k + "]", b);
|
|
2117
2117
|
}
|
|
2118
2118
|
};
|
|
2119
2119
|
return _;
|
|
2120
2120
|
}();
|
|
2121
2121
|
e.getDurationString = function(t, n) {
|
|
2122
2122
|
var c;
|
|
2123
|
-
function d(
|
|
2124
|
-
for (var I = "" +
|
|
2123
|
+
function d(U, E) {
|
|
2124
|
+
for (var I = "" + U, B = I.split("."); B[0].length < E; )
|
|
2125
2125
|
B[0] = "0" + B[0];
|
|
2126
2126
|
return B.join(".");
|
|
2127
2127
|
}
|
|
2128
2128
|
t < 0 ? (c = !0, t = -t) : c = !1;
|
|
2129
2129
|
var f = n || 1, y = t / f, _ = Math.floor(y / 3600);
|
|
2130
2130
|
y -= _ * 3600;
|
|
2131
|
-
var
|
|
2132
|
-
y -=
|
|
2133
|
-
var
|
|
2134
|
-
return y = Math.floor(y),
|
|
2131
|
+
var k = Math.floor(y / 60);
|
|
2132
|
+
y -= k * 60;
|
|
2133
|
+
var b = y * 1e3;
|
|
2134
|
+
return y = Math.floor(y), b -= y * 1e3, b = Math.floor(b), (c ? "-" : "") + _ + ":" + d(k, 2) + ":" + d(y, 2) + "." + d(b, 3);
|
|
2135
2135
|
}, e.printRanges = function(t) {
|
|
2136
2136
|
var n = t.length;
|
|
2137
2137
|
if (n > 0) {
|
|
@@ -2709,8 +2709,8 @@ var Gi = {};
|
|
|
2709
2709
|
break;
|
|
2710
2710
|
default:
|
|
2711
2711
|
if (t.length == 3) {
|
|
2712
|
-
for (var
|
|
2713
|
-
this.writeType(
|
|
2712
|
+
for (var k = t[1], b = 0; b < n.length; b++)
|
|
2713
|
+
this.writeType(k, n[b]);
|
|
2714
2714
|
break;
|
|
2715
2715
|
} else {
|
|
2716
2716
|
this.writeStruct(t, n);
|
|
@@ -2794,12 +2794,12 @@ var Gi = {};
|
|
|
2794
2794
|
}
|
|
2795
2795
|
n && (e.debug("MultiBufferStream", "Appending new buffer (fileStart: " + t.fileStart + " - Length: " + t.byteLength + ")"), this.buffers.push(t), c === 0 && (this.buffer = t));
|
|
2796
2796
|
}, l.prototype.logBufferLevel = function(t) {
|
|
2797
|
-
var n, c, d, f, y = [], _,
|
|
2797
|
+
var n, c, d, f, y = [], _, k = "";
|
|
2798
2798
|
for (d = 0, f = 0, n = 0; n < this.buffers.length; n++)
|
|
2799
|
-
c = this.buffers[n], n === 0 ? (_ = {}, y.push(_), _.start = c.fileStart, _.end = c.fileStart + c.byteLength,
|
|
2800
|
-
y.length > 0 && (
|
|
2801
|
-
var
|
|
2802
|
-
this.buffers.length === 0 ?
|
|
2799
|
+
c = this.buffers[n], n === 0 ? (_ = {}, y.push(_), _.start = c.fileStart, _.end = c.fileStart + c.byteLength, k += "[" + _.start + "-") : _.end === c.fileStart ? _.end = c.fileStart + c.byteLength : (_ = {}, _.start = c.fileStart, k += y[y.length - 1].end - 1 + "], [" + _.start + "-", _.end = c.fileStart + c.byteLength, y.push(_)), d += c.usedBytes, f += c.byteLength;
|
|
2800
|
+
y.length > 0 && (k += _.end - 1 + "]");
|
|
2801
|
+
var b = t ? e.info : e.debug;
|
|
2802
|
+
this.buffers.length === 0 ? b("MultiBufferStream", "No more buffer in memory") : b("MultiBufferStream", "" + this.buffers.length + " stored buffer(s) (" + d + "/" + f + " bytes), continuous ranges: " + k);
|
|
2803
2803
|
}, l.prototype.cleanBuffers = function() {
|
|
2804
2804
|
var t, n;
|
|
2805
2805
|
for (t = 0; t < this.buffers.length; t++)
|
|
@@ -2850,58 +2850,58 @@ var Gi = {};
|
|
|
2850
2850
|
}, a.MultiBufferStream = l;
|
|
2851
2851
|
var u = function() {
|
|
2852
2852
|
var t = 3, n = 4, c = 5, d = 6, f = [];
|
|
2853
|
-
f[t] = "ES_Descriptor", f[n] = "DecoderConfigDescriptor", f[c] = "DecoderSpecificInfo", f[d] = "SLConfigDescriptor", this.getDescriptorName = function(
|
|
2854
|
-
return f[
|
|
2853
|
+
f[t] = "ES_Descriptor", f[n] = "DecoderConfigDescriptor", f[c] = "DecoderSpecificInfo", f[d] = "SLConfigDescriptor", this.getDescriptorName = function(k) {
|
|
2854
|
+
return f[k];
|
|
2855
2855
|
};
|
|
2856
2856
|
var y = this, _ = {};
|
|
2857
|
-
return this.parseOneDescriptor = function(
|
|
2858
|
-
var
|
|
2859
|
-
for (
|
|
2860
|
-
|
|
2861
|
-
return
|
|
2862
|
-
}, _.Descriptor = function(
|
|
2863
|
-
this.tag =
|
|
2864
|
-
}, _.Descriptor.prototype.parse = function(
|
|
2865
|
-
this.data =
|
|
2866
|
-
}, _.Descriptor.prototype.findDescriptor = function(
|
|
2867
|
-
for (var
|
|
2868
|
-
if (this.descs[
|
|
2869
|
-
return this.descs[
|
|
2857
|
+
return this.parseOneDescriptor = function(k) {
|
|
2858
|
+
var b = 0, U, E, I;
|
|
2859
|
+
for (U = k.readUint8(), I = k.readUint8(); I & 128; )
|
|
2860
|
+
b = (b << 7) + (I & 127), I = k.readUint8();
|
|
2861
|
+
return b = (b << 7) + (I & 127), e.debug("MPEG4DescriptorParser", "Found " + (f[U] || "Descriptor " + U) + ", size " + b + " at position " + k.getPosition()), f[U] ? E = new _[f[U]](b) : E = new _.Descriptor(b), E.parse(k), E;
|
|
2862
|
+
}, _.Descriptor = function(k, b) {
|
|
2863
|
+
this.tag = k, this.size = b, this.descs = [];
|
|
2864
|
+
}, _.Descriptor.prototype.parse = function(k) {
|
|
2865
|
+
this.data = k.readUint8Array(this.size);
|
|
2866
|
+
}, _.Descriptor.prototype.findDescriptor = function(k) {
|
|
2867
|
+
for (var b = 0; b < this.descs.length; b++)
|
|
2868
|
+
if (this.descs[b].tag == k)
|
|
2869
|
+
return this.descs[b];
|
|
2870
2870
|
return null;
|
|
2871
|
-
}, _.Descriptor.prototype.parseRemainingDescriptors = function(
|
|
2872
|
-
for (var
|
|
2873
|
-
var
|
|
2874
|
-
this.descs.push(
|
|
2875
|
-
}
|
|
2876
|
-
}, _.ES_Descriptor = function(
|
|
2877
|
-
_.Descriptor.call(this, t,
|
|
2878
|
-
}, _.ES_Descriptor.prototype = new _.Descriptor(), _.ES_Descriptor.prototype.parse = function(
|
|
2879
|
-
if (this.ES_ID =
|
|
2880
|
-
var
|
|
2881
|
-
this.URL =
|
|
2871
|
+
}, _.Descriptor.prototype.parseRemainingDescriptors = function(k) {
|
|
2872
|
+
for (var b = k.position; k.position < b + this.size; ) {
|
|
2873
|
+
var U = y.parseOneDescriptor(k);
|
|
2874
|
+
this.descs.push(U);
|
|
2875
|
+
}
|
|
2876
|
+
}, _.ES_Descriptor = function(k) {
|
|
2877
|
+
_.Descriptor.call(this, t, k);
|
|
2878
|
+
}, _.ES_Descriptor.prototype = new _.Descriptor(), _.ES_Descriptor.prototype.parse = function(k) {
|
|
2879
|
+
if (this.ES_ID = k.readUint16(), this.flags = k.readUint8(), this.size -= 3, this.flags & 128 ? (this.dependsOn_ES_ID = k.readUint16(), this.size -= 2) : this.dependsOn_ES_ID = 0, this.flags & 64) {
|
|
2880
|
+
var b = k.readUint8();
|
|
2881
|
+
this.URL = k.readString(b), this.size -= b + 1;
|
|
2882
2882
|
} else
|
|
2883
2883
|
this.URL = "";
|
|
2884
|
-
this.flags & 32 ? (this.OCR_ES_ID =
|
|
2885
|
-
}, _.ES_Descriptor.prototype.getOTI = function(
|
|
2886
|
-
var
|
|
2887
|
-
return
|
|
2888
|
-
}, _.ES_Descriptor.prototype.getAudioConfig = function(
|
|
2889
|
-
var
|
|
2890
|
-
if (!
|
|
2891
|
-
var
|
|
2892
|
-
if (
|
|
2893
|
-
var E = (
|
|
2894
|
-
return E === 31 &&
|
|
2884
|
+
this.flags & 32 ? (this.OCR_ES_ID = k.readUint16(), this.size -= 2) : this.OCR_ES_ID = 0, this.parseRemainingDescriptors(k);
|
|
2885
|
+
}, _.ES_Descriptor.prototype.getOTI = function(k) {
|
|
2886
|
+
var b = this.findDescriptor(n);
|
|
2887
|
+
return b ? b.oti : 0;
|
|
2888
|
+
}, _.ES_Descriptor.prototype.getAudioConfig = function(k) {
|
|
2889
|
+
var b = this.findDescriptor(n);
|
|
2890
|
+
if (!b) return null;
|
|
2891
|
+
var U = b.findDescriptor(c);
|
|
2892
|
+
if (U && U.data) {
|
|
2893
|
+
var E = (U.data[0] & 248) >> 3;
|
|
2894
|
+
return E === 31 && U.data.length >= 2 && (E = 32 + ((U.data[0] & 7) << 3) + ((U.data[1] & 224) >> 5)), E;
|
|
2895
2895
|
} else
|
|
2896
2896
|
return null;
|
|
2897
|
-
}, _.DecoderConfigDescriptor = function(
|
|
2898
|
-
_.Descriptor.call(this, n,
|
|
2899
|
-
}, _.DecoderConfigDescriptor.prototype = new _.Descriptor(), _.DecoderConfigDescriptor.prototype.parse = function(
|
|
2900
|
-
this.oti =
|
|
2901
|
-
}, _.DecoderSpecificInfo = function(
|
|
2902
|
-
_.Descriptor.call(this, c,
|
|
2903
|
-
}, _.DecoderSpecificInfo.prototype = new _.Descriptor(), _.SLConfigDescriptor = function(
|
|
2904
|
-
_.Descriptor.call(this, d,
|
|
2897
|
+
}, _.DecoderConfigDescriptor = function(k) {
|
|
2898
|
+
_.Descriptor.call(this, n, k);
|
|
2899
|
+
}, _.DecoderConfigDescriptor.prototype = new _.Descriptor(), _.DecoderConfigDescriptor.prototype.parse = function(k) {
|
|
2900
|
+
this.oti = k.readUint8(), this.streamType = k.readUint8(), this.upStream = (this.streamType >> 1 & 1) !== 0, this.streamType = this.streamType >>> 2, this.bufferSize = k.readUint24(), this.maxBitrate = k.readUint32(), this.avgBitrate = k.readUint32(), this.size -= 13, this.parseRemainingDescriptors(k);
|
|
2901
|
+
}, _.DecoderSpecificInfo = function(k) {
|
|
2902
|
+
_.Descriptor.call(this, c, k);
|
|
2903
|
+
}, _.DecoderSpecificInfo.prototype = new _.Descriptor(), _.SLConfigDescriptor = function(k) {
|
|
2904
|
+
_.Descriptor.call(this, d, k);
|
|
2905
2905
|
}, _.SLConfigDescriptor.prototype = new _.Descriptor(), this;
|
|
2906
2906
|
};
|
|
2907
2907
|
a.MPEG4DescriptorParser = u;
|
|
@@ -3067,28 +3067,28 @@ var Gi = {};
|
|
|
3067
3067
|
}
|
|
3068
3068
|
return n;
|
|
3069
3069
|
}, o.parseOneBox = function(t, n, c) {
|
|
3070
|
-
var d, f = t.getPosition(), y = 0, _,
|
|
3070
|
+
var d, f = t.getPosition(), y = 0, _, k;
|
|
3071
3071
|
if (t.getEndPosition() - f < 8)
|
|
3072
3072
|
return e.debug("BoxParser", "Not enough data in stream to parse the type and size of the box"), { code: o.ERR_NOT_ENOUGH_DATA };
|
|
3073
3073
|
if (c && c < 8)
|
|
3074
3074
|
return e.debug("BoxParser", "Not enough bytes left in the parent box to parse a new box"), { code: o.ERR_NOT_ENOUGH_DATA };
|
|
3075
|
-
var
|
|
3076
|
-
if (e.debug("BoxParser", "Found box of type '" +
|
|
3075
|
+
var b = t.readUint32(), U = t.readString(4), E = U;
|
|
3076
|
+
if (e.debug("BoxParser", "Found box of type '" + U + "' and size " + b + " at position " + f), y = 8, U == "uuid") {
|
|
3077
3077
|
if (t.getEndPosition() - t.getPosition() < 16 || c - y < 16)
|
|
3078
3078
|
return t.seek(f), e.debug("BoxParser", "Not enough bytes left in the parent box to parse a UUID box"), { code: o.ERR_NOT_ENOUGH_DATA };
|
|
3079
|
-
|
|
3079
|
+
k = o.parseUUID(t), y += 16, E = k;
|
|
3080
3080
|
}
|
|
3081
|
-
if (
|
|
3081
|
+
if (b == 1) {
|
|
3082
3082
|
if (t.getEndPosition() - t.getPosition() < 8 || c && c - y < 8)
|
|
3083
|
-
return t.seek(f), e.warn("BoxParser", 'Not enough data in stream to parse the extended size of the "' +
|
|
3084
|
-
|
|
3085
|
-
} else if (
|
|
3083
|
+
return t.seek(f), e.warn("BoxParser", 'Not enough data in stream to parse the extended size of the "' + U + '" box'), { code: o.ERR_NOT_ENOUGH_DATA };
|
|
3084
|
+
b = t.readUint64(), y += 8;
|
|
3085
|
+
} else if (b === 0) {
|
|
3086
3086
|
if (c)
|
|
3087
|
-
|
|
3088
|
-
else if (
|
|
3089
|
-
return e.error("BoxParser", "Unlimited box size not supported for type: '" +
|
|
3087
|
+
b = c;
|
|
3088
|
+
else if (U !== "mdat")
|
|
3089
|
+
return e.error("BoxParser", "Unlimited box size not supported for type: '" + U + "'"), d = new o.Box(U, b), { code: o.OK, box: d, size: d.size };
|
|
3090
3090
|
}
|
|
3091
|
-
return
|
|
3091
|
+
return b !== 0 && b < y ? (e.error("BoxParser", "Box of type " + U + " has an invalid size " + b + " (too small to be a box)"), { code: o.ERR_NOT_ENOUGH_DATA, type: U, size: b, hdr_size: y, start: f }) : b !== 0 && c && b > c ? (e.error("BoxParser", "Box of type '" + U + "' has a size " + b + " greater than its container size " + c), { code: o.ERR_NOT_ENOUGH_DATA, type: U, size: b, hdr_size: y, start: f }) : b !== 0 && f + b > t.getEndPosition() ? (t.seek(f), e.info("BoxParser", "Not enough data in stream to parse the entire '" + U + "' box"), { code: o.ERR_NOT_ENOUGH_DATA, type: U, size: b, hdr_size: y, start: f }) : n ? { code: o.OK, type: U, size: b, hdr_size: y, start: f } : (o[U + "Box"] ? d = new o[U + "Box"](b) : U !== "uuid" ? (e.warn("BoxParser", "Unknown box type: '" + U + "'"), d = new o.Box(U, b), d.has_unparsed_data = !0) : o.UUIDBoxes[k] ? d = new o.UUIDBoxes[k](b) : (e.warn("BoxParser", "Unknown uuid type: '" + k + "'"), d = new o.Box(U, b), d.uuid = k, d.has_unparsed_data = !0), d.hdr_size = y, d.start = f, d.write === o.Box.prototype.write && d.type !== "mdat" && (e.info("BoxParser", "'" + E + "' box writing not yet implemented, keeping unparsed data in memory for later write"), d.parseDataAndRewind(t)), d.parse(t), _ = t.getPosition() - (d.start + d.size), _ < 0 ? (e.warn("BoxParser", "Parsing of box '" + E + "' did not read the entire indicated box data size (missing " + -_ + " bytes), seeking forward"), t.seek(d.start + d.size)) : _ > 0 && (e.error("BoxParser", "Parsing of box '" + E + "' read " + _ + " more bytes than the indicated box data size, seeking backwards"), d.size !== 0 && t.seek(d.start + d.size)), { code: o.OK, box: d, size: d.size });
|
|
3092
3092
|
}, o.Box.prototype.parse = function(t) {
|
|
3093
3093
|
this.type != "mdat" ? this.data = t.readUint8Array(this.size - this.hdr_size) : this.size === 0 ? t.seek(t.getEndPosition()) : t.seek(this.start + this.size);
|
|
3094
3094
|
}, o.Box.prototype.parseDataAndRewind = function(t) {
|
|
@@ -3339,28 +3339,28 @@ var Gi = {};
|
|
|
3339
3339
|
}), o.createBoxCtor("hvcC", "HEVCConfigurationBox", function(t) {
|
|
3340
3340
|
var n, c, d, f;
|
|
3341
3341
|
this.configurationVersion = t.readUint8(), f = t.readUint8(), this.general_profile_space = f >> 6, this.general_tier_flag = (f & 32) >> 5, this.general_profile_idc = f & 31, this.general_profile_compatibility = t.readUint32(), this.general_constraint_indicator = t.readUint8Array(6), this.general_level_idc = t.readUint8(), this.min_spatial_segmentation_idc = t.readUint16() & 4095, this.parallelismType = t.readUint8() & 3, this.chroma_format_idc = t.readUint8() & 3, this.bit_depth_luma_minus8 = t.readUint8() & 7, this.bit_depth_chroma_minus8 = t.readUint8() & 7, this.avgFrameRate = t.readUint16(), f = t.readUint8(), this.constantFrameRate = f >> 6, this.numTemporalLayers = (f & 13) >> 3, this.temporalIdNested = (f & 4) >> 2, this.lengthSizeMinusOne = f & 3, this.nalu_arrays = [], this.nalu_arrays.toString = function() {
|
|
3342
|
-
var
|
|
3343
|
-
|
|
3342
|
+
var U = "<table class='inner-table'>";
|
|
3343
|
+
U += "<thead><tr><th>completeness</th><th>nalu_type</th><th>nalu_data</th></tr></thead>", U += "<tbody>";
|
|
3344
3344
|
for (var E = 0; E < this.length; E++) {
|
|
3345
3345
|
var I = this[E];
|
|
3346
|
-
|
|
3346
|
+
U += "<tr>", U += "<td rowspan='" + I.length + "'>" + I.completeness + "</td>", U += "<td rowspan='" + I.length + "'>" + I.nalu_type + "</td>";
|
|
3347
3347
|
for (var B = 0; B < I.length; B++) {
|
|
3348
3348
|
var A = I[B];
|
|
3349
|
-
B !== 0 && (
|
|
3350
|
-
return
|
|
3351
|
-
}, "0x"),
|
|
3349
|
+
B !== 0 && (U += "<tr>"), U += "<td>", U += A.data.reduce(function(R, F) {
|
|
3350
|
+
return R + F.toString(16).padStart(2, "0");
|
|
3351
|
+
}, "0x"), U += "</td></tr>";
|
|
3352
3352
|
}
|
|
3353
3353
|
}
|
|
3354
|
-
return
|
|
3354
|
+
return U += "</tbody></table>", U;
|
|
3355
3355
|
};
|
|
3356
3356
|
var y = t.readUint8();
|
|
3357
3357
|
for (n = 0; n < y; n++) {
|
|
3358
3358
|
var _ = [];
|
|
3359
3359
|
this.nalu_arrays.push(_), f = t.readUint8(), _.completeness = (f & 128) >> 7, _.nalu_type = f & 63;
|
|
3360
|
-
var
|
|
3361
|
-
for (c = 0; c <
|
|
3362
|
-
var
|
|
3363
|
-
_.push(
|
|
3360
|
+
var k = t.readUint16();
|
|
3361
|
+
for (c = 0; c < k; c++) {
|
|
3362
|
+
var b = {};
|
|
3363
|
+
_.push(b), d = t.readUint16(), b.data = t.readUint8Array(d);
|
|
3364
3364
|
}
|
|
3365
3365
|
}
|
|
3366
3366
|
}), o.createFullBoxCtor("iinf", "ItemInfoBox", function(t) {
|
|
@@ -3405,43 +3405,43 @@ var Gi = {};
|
|
|
3405
3405
|
var y = t.readUint16();
|
|
3406
3406
|
f.extents = [];
|
|
3407
3407
|
for (var _ = 0; _ < y; _++) {
|
|
3408
|
-
var
|
|
3409
|
-
if (f.extents.push(
|
|
3408
|
+
var k = {};
|
|
3409
|
+
if (f.extents.push(k), this.version === 1 || this.version === 2)
|
|
3410
3410
|
switch (this.index_size) {
|
|
3411
3411
|
case 0:
|
|
3412
|
-
|
|
3412
|
+
k.extent_index = 0;
|
|
3413
3413
|
break;
|
|
3414
3414
|
case 4:
|
|
3415
|
-
|
|
3415
|
+
k.extent_index = t.readUint32();
|
|
3416
3416
|
break;
|
|
3417
3417
|
case 8:
|
|
3418
|
-
|
|
3418
|
+
k.extent_index = t.readUint64();
|
|
3419
3419
|
break;
|
|
3420
3420
|
default:
|
|
3421
3421
|
throw "Error reading extent index";
|
|
3422
3422
|
}
|
|
3423
3423
|
switch (this.offset_size) {
|
|
3424
3424
|
case 0:
|
|
3425
|
-
|
|
3425
|
+
k.extent_offset = 0;
|
|
3426
3426
|
break;
|
|
3427
3427
|
case 4:
|
|
3428
|
-
|
|
3428
|
+
k.extent_offset = t.readUint32();
|
|
3429
3429
|
break;
|
|
3430
3430
|
case 8:
|
|
3431
|
-
|
|
3431
|
+
k.extent_offset = t.readUint64();
|
|
3432
3432
|
break;
|
|
3433
3433
|
default:
|
|
3434
3434
|
throw "Error reading extent index";
|
|
3435
3435
|
}
|
|
3436
3436
|
switch (this.length_size) {
|
|
3437
3437
|
case 0:
|
|
3438
|
-
|
|
3438
|
+
k.extent_length = 0;
|
|
3439
3439
|
break;
|
|
3440
3440
|
case 4:
|
|
3441
|
-
|
|
3441
|
+
k.extent_length = t.readUint32();
|
|
3442
3442
|
break;
|
|
3443
3443
|
case 8:
|
|
3444
|
-
|
|
3444
|
+
k.extent_length = t.readUint64();
|
|
3445
3445
|
break;
|
|
3446
3446
|
default:
|
|
3447
3447
|
throw "Error reading extent index";
|
|
@@ -3509,19 +3509,19 @@ var Gi = {};
|
|
|
3509
3509
|
}), o.createBoxCtor("lhvC", "LHEVCConfigurationBox", function(t) {
|
|
3510
3510
|
var n, c, d;
|
|
3511
3511
|
this.configurationVersion = t.readUint8(), this.min_spatial_segmentation_idc = t.readUint16() & 4095, this.parallelismType = t.readUint8() & 3, d = t.readUint8(), this.numTemporalLayers = (d & 13) >> 3, this.temporalIdNested = (d & 4) >> 2, this.lengthSizeMinusOne = d & 3, this.nalu_arrays = [], this.nalu_arrays.toString = function() {
|
|
3512
|
-
var
|
|
3513
|
-
|
|
3512
|
+
var U = "<table class='inner-table'>";
|
|
3513
|
+
U += "<thead><tr><th>completeness</th><th>nalu_type</th><th>nalu_data</th></tr></thead>", U += "<tbody>";
|
|
3514
3514
|
for (var E = 0; E < this.length; E++) {
|
|
3515
3515
|
var I = this[E];
|
|
3516
|
-
|
|
3516
|
+
U += "<tr>", U += "<td rowspan='" + I.length + "'>" + I.completeness + "</td>", U += "<td rowspan='" + I.length + "'>" + I.nalu_type + "</td>";
|
|
3517
3517
|
for (var B = 0; B < I.length; B++) {
|
|
3518
3518
|
var A = I[B];
|
|
3519
|
-
B !== 0 && (
|
|
3520
|
-
return
|
|
3521
|
-
}, "0x"),
|
|
3519
|
+
B !== 0 && (U += "<tr>"), U += "<td>", U += A.data.reduce(function(R, F) {
|
|
3520
|
+
return R + F.toString(16).padStart(2, "0");
|
|
3521
|
+
}, "0x"), U += "</td></tr>";
|
|
3522
3522
|
}
|
|
3523
3523
|
}
|
|
3524
|
-
return
|
|
3524
|
+
return U += "</tbody></table>", U;
|
|
3525
3525
|
};
|
|
3526
3526
|
var f = t.readUint8();
|
|
3527
3527
|
for (n = 0; n < f; n++) {
|
|
@@ -3529,10 +3529,10 @@ var Gi = {};
|
|
|
3529
3529
|
this.nalu_arrays.push(y), d = t.readUint8(), y.completeness = (d & 128) >> 7, y.nalu_type = d & 63;
|
|
3530
3530
|
var _ = t.readUint16();
|
|
3531
3531
|
for (c = 0; c < _; c++) {
|
|
3532
|
-
var
|
|
3533
|
-
y.push(
|
|
3534
|
-
var
|
|
3535
|
-
|
|
3532
|
+
var k = {};
|
|
3533
|
+
y.push(k);
|
|
3534
|
+
var b = t.readUint16();
|
|
3535
|
+
k.data = t.readUint8Array(b);
|
|
3536
3536
|
}
|
|
3537
3537
|
}
|
|
3538
3538
|
}), o.createBoxCtor("lsel", "LayerSelectorProperty", function(t) {
|
|
@@ -4050,8 +4050,8 @@ var Gi = {};
|
|
|
4050
4050
|
this.held_bits = A.readUint16(), this.num_held_bits = 16;
|
|
4051
4051
|
},
|
|
4052
4052
|
extract_bits: function(A) {
|
|
4053
|
-
var
|
|
4054
|
-
return this.num_held_bits -= A,
|
|
4053
|
+
var R = this.held_bits >> this.num_held_bits - A & (1 << A) - 1;
|
|
4054
|
+
return this.num_held_bits -= A, R;
|
|
4055
4055
|
}
|
|
4056
4056
|
};
|
|
4057
4057
|
if (d.stream_read_1_bytes(t), d.extract_bits(5), this.lengthSizeMinusOne = d.extract_bits(2), this.ptl_present_flag = d.extract_bits(1), this.ptl_present_flag) {
|
|
@@ -4083,14 +4083,14 @@ var Gi = {};
|
|
|
4083
4083
|
}
|
|
4084
4084
|
this.max_picture_width = t.readUint16(), this.max_picture_height = t.readUint16(), this.avg_frame_rate = t.readUint16();
|
|
4085
4085
|
}
|
|
4086
|
-
var
|
|
4086
|
+
var k = 12, b = 13;
|
|
4087
4087
|
this.nalu_arrays = [];
|
|
4088
|
-
var
|
|
4089
|
-
for (n = 0; n <
|
|
4088
|
+
var U = t.readUint8();
|
|
4089
|
+
for (n = 0; n < U; n++) {
|
|
4090
4090
|
var E = [];
|
|
4091
4091
|
this.nalu_arrays.push(E), d.stream_read_1_bytes(t), E.completeness = d.extract_bits(1), d.extract_bits(2), E.nalu_type = d.extract_bits(5);
|
|
4092
4092
|
var I = 1;
|
|
4093
|
-
for (E.nalu_type !=
|
|
4093
|
+
for (E.nalu_type != b && E.nalu_type != k && (I = t.readUint16()), c = 0; c < I; c++) {
|
|
4094
4094
|
var B = t.readUint16();
|
|
4095
4095
|
E.push({
|
|
4096
4096
|
data: t.readUint8Array(B),
|
|
@@ -4192,13 +4192,13 @@ var Gi = {};
|
|
|
4192
4192
|
c = ".CA";
|
|
4193
4193
|
else {
|
|
4194
4194
|
c = ".C";
|
|
4195
|
-
var _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",
|
|
4195
|
+
var _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", k = 0, b = 0;
|
|
4196
4196
|
for (t = 0; t <= y; ++t)
|
|
4197
|
-
for (
|
|
4198
|
-
var
|
|
4199
|
-
c += _[
|
|
4197
|
+
for (k = k << 8 | d[t], b += 8; b >= 5; ) {
|
|
4198
|
+
var U = k >> b - 5 & 31;
|
|
4199
|
+
c += _[U], b -= 5, k &= (1 << b) - 1;
|
|
4200
4200
|
}
|
|
4201
|
-
|
|
4201
|
+
b && (k <<= 5 - b, c += _[k & 31]);
|
|
4202
4202
|
}
|
|
4203
4203
|
}
|
|
4204
4204
|
n += c;
|
|
@@ -4481,17 +4481,17 @@ var Gi = {};
|
|
|
4481
4481
|
c = o.parseOneBox(d, !1), c.code === o.OK && c.box.type === "vttc" && n.push(c.box);
|
|
4482
4482
|
return n;
|
|
4483
4483
|
}, w.prototype.getText = function(t, n, c) {
|
|
4484
|
-
function d(
|
|
4485
|
-
return I = I || "0",
|
|
4484
|
+
function d(U, E, I) {
|
|
4485
|
+
return I = I || "0", U = U + "", U.length >= E ? U : new Array(E - U.length + 1).join(I) + U;
|
|
4486
4486
|
}
|
|
4487
|
-
function f(
|
|
4488
|
-
var E = Math.floor(
|
|
4487
|
+
function f(U) {
|
|
4488
|
+
var E = Math.floor(U / 3600), I = Math.floor((U - E * 3600) / 60), B = Math.floor(U - E * 3600 - I * 60), A = Math.floor((U - E * 3600 - I * 60 - B) * 1e3);
|
|
4489
4489
|
return "" + d(E, 2) + ":" + d(I, 2) + ":" + d(B, 2) + "." + d(A, 3);
|
|
4490
4490
|
}
|
|
4491
|
-
for (var y = this.parseSample(c), _ = "",
|
|
4492
|
-
var
|
|
4491
|
+
for (var y = this.parseSample(c), _ = "", k = 0; k < y.length; k++) {
|
|
4492
|
+
var b = y[k];
|
|
4493
4493
|
_ += f(t) + " --> " + f(n) + `\r
|
|
4494
|
-
`, _ +=
|
|
4494
|
+
`, _ += b.payl.text;
|
|
4495
4495
|
}
|
|
4496
4496
|
return _;
|
|
4497
4497
|
};
|
|
@@ -4587,13 +4587,13 @@ var Gi = {};
|
|
|
4587
4587
|
if (this.checkBuffer(t))
|
|
4588
4588
|
return this.parse(), this.moovStartFound && !this.moovStartSent && (this.moovStartSent = !0, this.onMoovStart && this.onMoovStart()), this.moov ? (this.sampleListBuilt || (this.buildSampleLists(), this.sampleListBuilt = !0), this.updateSampleLists(), this.onReady && !this.readySent && (this.readySent = !0, this.onReady(this.getInfo())), this.processSamples(n), this.nextSeekPosition ? (c = this.nextSeekPosition, this.nextSeekPosition = void 0) : c = this.nextParsePosition, this.stream.getEndFilePositionAfter && (c = this.stream.getEndFilePositionAfter(c))) : this.nextParsePosition ? c = this.nextParsePosition : c = 0, this.sidx && this.onSidx && !this.sidxSent && (this.onSidx(this.sidx), this.sidxSent = !0), this.meta && (this.flattenItemInfo && !this.itemListBuilt && (this.flattenItemInfo(), this.itemListBuilt = !0), this.processItems && this.processItems(this.onItem)), this.stream.cleanBuffers && (e.info("ISOFile", "Done processing buffer (fileStart: " + t.fileStart + ") - next buffer to fetch should have a fileStart position of " + c), this.stream.logBufferLevel(), this.stream.cleanBuffers(), this.stream.logBufferLevel(!0), e.info("ISOFile", "Sample data size in memory: " + this.getAllocatedSampleDataSize())), c;
|
|
4589
4589
|
}, v.prototype.getInfo = function() {
|
|
4590
|
-
var t, n, c = {}, d, f, y, _,
|
|
4590
|
+
var t, n, c = {}, d, f, y, _, k = (/* @__PURE__ */ new Date("1904-01-01T00:00:00Z")).getTime();
|
|
4591
4591
|
if (this.moov)
|
|
4592
|
-
for (c.hasMoov = !0, c.duration = this.moov.mvhd.duration, c.timescale = this.moov.mvhd.timescale, c.isFragmented = this.moov.mvex != null, c.isFragmented && this.moov.mvex.mehd && (c.fragment_duration = this.moov.mvex.mehd.fragment_duration), c.isProgressive = this.isProgressive, c.hasIOD = this.moov.iods != null, c.brands = [], c.brands.push(this.ftyp.major_brand), c.brands = c.brands.concat(this.ftyp.compatible_brands), c.created = new Date(
|
|
4592
|
+
for (c.hasMoov = !0, c.duration = this.moov.mvhd.duration, c.timescale = this.moov.mvhd.timescale, c.isFragmented = this.moov.mvex != null, c.isFragmented && this.moov.mvex.mehd && (c.fragment_duration = this.moov.mvex.mehd.fragment_duration), c.isProgressive = this.isProgressive, c.hasIOD = this.moov.iods != null, c.brands = [], c.brands.push(this.ftyp.major_brand), c.brands = c.brands.concat(this.ftyp.compatible_brands), c.created = new Date(k + this.moov.mvhd.creation_time * 1e3), c.modified = new Date(k + this.moov.mvhd.modification_time * 1e3), c.tracks = [], c.audioTracks = [], c.videoTracks = [], c.subtitleTracks = [], c.metadataTracks = [], c.hintTracks = [], c.otherTracks = [], t = 0; t < this.moov.traks.length; t++) {
|
|
4593
4593
|
if (d = this.moov.traks[t], _ = d.mdia.minf.stbl.stsd.entries[0], f = {}, c.tracks.push(f), f.id = d.tkhd.track_id, f.name = d.mdia.hdlr.name, f.references = [], d.tref)
|
|
4594
4594
|
for (n = 0; n < d.tref.boxes.length; n++)
|
|
4595
4595
|
y = {}, f.references.push(y), y.type = d.tref.boxes[n].type, y.track_ids = d.tref.boxes[n].track_ids;
|
|
4596
|
-
d.edts && (f.edits = d.edts.elst.entries), f.created = new Date(
|
|
4596
|
+
d.edts && (f.edits = d.edts.elst.entries), f.created = new Date(k + d.tkhd.creation_time * 1e3), f.modified = new Date(k + d.tkhd.modification_time * 1e3), f.movie_duration = d.tkhd.duration, f.movie_timescale = c.timescale, f.layer = d.tkhd.layer, f.alternate_group = d.tkhd.alternate_group, f.volume = d.tkhd.volume, f.matrix = d.tkhd.matrix, f.track_width = d.tkhd.width / 65536, f.track_height = d.tkhd.height / 65536, f.timescale = d.mdia.mdhd.timescale, f.cts_shift = d.mdia.minf.stbl.cslg, f.duration = d.mdia.mdhd.duration, f.samples_duration = d.samples_duration, f.codec = _.getCodec(), f.kind = d.udta && d.udta.kinds.length ? d.udta.kinds[0] : { schemeURI: "", value: "" }, f.language = d.mdia.elng ? d.mdia.elng.extended_language : d.mdia.mdhd.languageString, f.nb_samples = d.samples.length, f.size = d.samples_size, f.bitrate = f.size * 8 * f.timescale / f.samples_duration, _.isAudio() ? (f.type = "audio", c.audioTracks.push(f), f.audio = {}, f.audio.sample_rate = _.getSampleRate(), f.audio.channel_count = _.getChannelCount(), f.audio.sample_size = _.getSampleSize()) : _.isVideo() ? (f.type = "video", c.videoTracks.push(f), f.video = {}, f.video.width = _.getWidth(), f.video.height = _.getHeight()) : _.isSubtitle() ? (f.type = "subtitles", c.subtitleTracks.push(f)) : _.isHint() ? (f.type = "metadata", c.hintTracks.push(f)) : _.isMetadata() ? (f.type = "metadata", c.metadataTracks.push(f)) : (f.type = "metadata", c.otherTracks.push(f));
|
|
4597
4597
|
}
|
|
4598
4598
|
else
|
|
4599
4599
|
c.hasMoov = !1;
|
|
@@ -4671,21 +4671,21 @@ var Gi = {};
|
|
|
4671
4671
|
}, v.prototype.flush = function() {
|
|
4672
4672
|
e.info("ISOFile", "Flushing remaining samples"), this.updateSampleLists(), this.processSamples(!0), this.stream.cleanBuffers(), this.stream.logBufferLevel(!0);
|
|
4673
4673
|
}, v.prototype.seekTrack = function(t, n, c) {
|
|
4674
|
-
var d, f, y = 1 / 0, _ = 0,
|
|
4674
|
+
var d, f, y = 1 / 0, _ = 0, k = 0, b;
|
|
4675
4675
|
if (c.samples.length === 0)
|
|
4676
4676
|
return e.info("ISOFile", "No sample in track, cannot seek! Using time " + e.getDurationString(0, 1) + " and offset: 0"), { offset: 0, time: 0 };
|
|
4677
4677
|
for (d = 0; d < c.samples.length; d++) {
|
|
4678
4678
|
if (f = c.samples[d], d === 0)
|
|
4679
|
-
|
|
4679
|
+
k = 0, b = f.timescale;
|
|
4680
4680
|
else if (f.cts > t * f.timescale) {
|
|
4681
|
-
|
|
4681
|
+
k = d - 1;
|
|
4682
4682
|
break;
|
|
4683
4683
|
}
|
|
4684
4684
|
n && f.is_sync && (_ = d);
|
|
4685
4685
|
}
|
|
4686
|
-
for (n && (
|
|
4687
|
-
|
|
4688
|
-
return y = c.samples[
|
|
4686
|
+
for (n && (k = _), t = c.samples[k].cts, c.nextSample = k; c.samples[k].alreadyRead === c.samples[k].size && c.samples[k + 1]; )
|
|
4687
|
+
k++;
|
|
4688
|
+
return y = c.samples[k].offset + c.samples[k].alreadyRead, e.info("ISOFile", "Seeking to " + (n ? "RAP" : "") + " sample #" + c.nextSample + " on track " + c.tkhd.track_id + ", time " + e.getDurationString(t, b) + " and offset: " + y), { offset: y, time: t / b };
|
|
4689
4689
|
}, v.prototype.getTrackDuration = function(t) {
|
|
4690
4690
|
var n;
|
|
4691
4691
|
return t.samples ? (n = t.samples[t.samples.length - 1], (n.cts + n.duration) / n.timescale) : 1 / 0;
|
|
@@ -4737,10 +4737,10 @@ var Gi = {};
|
|
|
4737
4737
|
var y = new o[n.type + "SampleEntry"]();
|
|
4738
4738
|
y.data_reference_index = 1;
|
|
4739
4739
|
var _ = "";
|
|
4740
|
-
for (var
|
|
4741
|
-
for (var
|
|
4742
|
-
if (
|
|
4743
|
-
_ =
|
|
4740
|
+
for (var k in o.sampleEntryCodes)
|
|
4741
|
+
for (var b = o.sampleEntryCodes[k], U = 0; U < b.length; U++)
|
|
4742
|
+
if (b.indexOf(n.type) > -1) {
|
|
4743
|
+
_ = k;
|
|
4744
4744
|
break;
|
|
4745
4745
|
}
|
|
4746
4746
|
switch (_) {
|
|
@@ -4800,31 +4800,31 @@ var Gi = {};
|
|
|
4800
4800
|
var d = c.add("traf"), f = this.getTrackById(t.track_id);
|
|
4801
4801
|
return d.add("tfhd").set("track_id", t.track_id).set("flags", o.TFHD_FLAG_DEFAULT_BASE_IS_MOOF), d.add("tfdt").set("baseMediaDecodeTime", t.dts - (f.first_dts || 0)), d.add("trun").set("flags", o.TRUN_FLAGS_DATA_OFFSET | o.TRUN_FLAGS_DURATION | o.TRUN_FLAGS_SIZE | o.TRUN_FLAGS_FLAGS | o.TRUN_FLAGS_CTS_OFFSET).set("data_offset", 0).set("first_sample_flags", 0).set("sample_count", 1).set("sample_duration", [t.duration]).set("sample_size", [t.size]).set("sample_flags", [n]).set("sample_composition_time_offset", [t.cts - t.dts]), c;
|
|
4802
4802
|
}, v.prototype.lastMoofIndex = 0, v.prototype.samplesDataSize = 0, v.prototype.resetTables = function() {
|
|
4803
|
-
var t, n, c, d, f, y, _,
|
|
4803
|
+
var t, n, c, d, f, y, _, k;
|
|
4804
4804
|
for (this.initial_duration = this.moov.mvhd.duration, this.moov.mvhd.duration = 0, t = 0; t < this.moov.traks.length; t++) {
|
|
4805
|
-
n = this.moov.traks[t], n.tkhd.duration = 0, n.mdia.mdhd.duration = 0, c = n.mdia.minf.stbl.stco || n.mdia.minf.stbl.co64, c.chunk_offsets = [], d = n.mdia.minf.stbl.stsc, d.first_chunk = [], d.samples_per_chunk = [], d.sample_description_index = [], f = n.mdia.minf.stbl.stsz || n.mdia.minf.stbl.stz2, f.sample_sizes = [], y = n.mdia.minf.stbl.stts, y.sample_counts = [], y.sample_deltas = [], _ = n.mdia.minf.stbl.ctts, _ && (_.sample_counts = [], _.sample_offsets = []),
|
|
4806
|
-
var
|
|
4807
|
-
|
|
4805
|
+
n = this.moov.traks[t], n.tkhd.duration = 0, n.mdia.mdhd.duration = 0, c = n.mdia.minf.stbl.stco || n.mdia.minf.stbl.co64, c.chunk_offsets = [], d = n.mdia.minf.stbl.stsc, d.first_chunk = [], d.samples_per_chunk = [], d.sample_description_index = [], f = n.mdia.minf.stbl.stsz || n.mdia.minf.stbl.stz2, f.sample_sizes = [], y = n.mdia.minf.stbl.stts, y.sample_counts = [], y.sample_deltas = [], _ = n.mdia.minf.stbl.ctts, _ && (_.sample_counts = [], _.sample_offsets = []), k = n.mdia.minf.stbl.stss;
|
|
4806
|
+
var b = n.mdia.minf.stbl.boxes.indexOf(k);
|
|
4807
|
+
b != -1 && (n.mdia.minf.stbl.boxes[b] = null);
|
|
4808
4808
|
}
|
|
4809
4809
|
}, v.initSampleGroups = function(t, n, c, d, f) {
|
|
4810
|
-
var y, _,
|
|
4811
|
-
function
|
|
4810
|
+
var y, _, k, b;
|
|
4811
|
+
function U(E, I, B) {
|
|
4812
4812
|
this.grouping_type = E, this.grouping_type_parameter = I, this.sbgp = B, this.last_sample_in_run = -1, this.entry_index = -1;
|
|
4813
4813
|
}
|
|
4814
4814
|
for (n && (n.sample_groups_info = []), t.sample_groups_info || (t.sample_groups_info = []), _ = 0; _ < c.length; _++) {
|
|
4815
|
-
for (
|
|
4816
|
-
d[y].grouping_type === c[_].grouping_type && (
|
|
4815
|
+
for (b = c[_].grouping_type + "/" + c[_].grouping_type_parameter, k = new U(c[_].grouping_type, c[_].grouping_type_parameter, c[_]), n && (n.sample_groups_info[b] = k), t.sample_groups_info[b] || (t.sample_groups_info[b] = k), y = 0; y < d.length; y++)
|
|
4816
|
+
d[y].grouping_type === c[_].grouping_type && (k.description = d[y], k.description.used = !0);
|
|
4817
4817
|
if (f)
|
|
4818
4818
|
for (y = 0; y < f.length; y++)
|
|
4819
|
-
f[y].grouping_type === c[_].grouping_type && (
|
|
4819
|
+
f[y].grouping_type === c[_].grouping_type && (k.fragment_description = f[y], k.fragment_description.used = !0, k.is_fragment = !0);
|
|
4820
4820
|
}
|
|
4821
4821
|
if (n) {
|
|
4822
4822
|
if (f)
|
|
4823
4823
|
for (_ = 0; _ < f.length; _++)
|
|
4824
|
-
!f[_].used && f[_].version >= 2 && (
|
|
4824
|
+
!f[_].used && f[_].version >= 2 && (b = f[_].grouping_type + "/0", k = new U(f[_].grouping_type, 0), k.is_fragment = !0, n.sample_groups_info[b] || (n.sample_groups_info[b] = k));
|
|
4825
4825
|
} else
|
|
4826
4826
|
for (_ = 0; _ < d.length; _++)
|
|
4827
|
-
!d[_].used && d[_].version >= 2 && (
|
|
4827
|
+
!d[_].used && d[_].version >= 2 && (b = d[_].grouping_type + "/0", k = new U(d[_].grouping_type, 0), t.sample_groups_info[b] || (t.sample_groups_info[b] = k));
|
|
4828
4828
|
}, v.setSampleGroupProperties = function(t, n, c, d) {
|
|
4829
4829
|
var f, y;
|
|
4830
4830
|
n.sample_groups = [];
|
|
@@ -4840,26 +4840,26 @@ var Gi = {};
|
|
|
4840
4840
|
for (t = 0; t < this.moov.traks.length; t++)
|
|
4841
4841
|
n = this.moov.traks[t], this.buildTrakSampleLists(n);
|
|
4842
4842
|
}, v.prototype.buildTrakSampleLists = function(t) {
|
|
4843
|
-
var n, c, d, f, y, _,
|
|
4844
|
-
if (t.samples = [], t.samples_duration = 0, t.samples_size = 0, c = t.mdia.minf.stbl.stco || t.mdia.minf.stbl.co64, d = t.mdia.minf.stbl.stsc, f = t.mdia.minf.stbl.stsz || t.mdia.minf.stbl.stz2, y = t.mdia.minf.stbl.stts, _ = t.mdia.minf.stbl.ctts,
|
|
4843
|
+
var n, c, d, f, y, _, k, b, U, E, I, B, A, R, F, G, q, X, J, he, Be, Mt, _e, $e;
|
|
4844
|
+
if (t.samples = [], t.samples_duration = 0, t.samples_size = 0, c = t.mdia.minf.stbl.stco || t.mdia.minf.stbl.co64, d = t.mdia.minf.stbl.stsc, f = t.mdia.minf.stbl.stsz || t.mdia.minf.stbl.stz2, y = t.mdia.minf.stbl.stts, _ = t.mdia.minf.stbl.ctts, k = t.mdia.minf.stbl.stss, b = t.mdia.minf.stbl.stsd, U = t.mdia.minf.stbl.subs, B = t.mdia.minf.stbl.stdp, E = t.mdia.minf.stbl.sbgps, I = t.mdia.minf.stbl.sgpds, X = -1, J = -1, he = -1, Be = -1, Mt = 0, _e = 0, $e = 0, v.initSampleGroups(t, null, E, I), !(typeof f > "u")) {
|
|
4845
4845
|
for (n = 0; n < f.sample_sizes.length; n++) {
|
|
4846
4846
|
var W = {};
|
|
4847
|
-
W.number = n, W.track_id = t.tkhd.track_id, W.timescale = t.mdia.mdhd.timescale, W.alreadyRead = 0, t.samples[n] = W, W.size = f.sample_sizes[n], t.samples_size += W.size, n === 0 ? (
|
|
4847
|
+
W.number = n, W.track_id = t.tkhd.track_id, W.timescale = t.mdia.mdhd.timescale, W.alreadyRead = 0, t.samples[n] = W, W.size = f.sample_sizes[n], t.samples_size += W.size, n === 0 ? (R = 1, A = 0, W.chunk_index = R, W.chunk_run_index = A, q = d.samples_per_chunk[A], G = 0, A + 1 < d.first_chunk.length ? F = d.first_chunk[A + 1] - 1 : F = 1 / 0) : n < q ? (W.chunk_index = R, W.chunk_run_index = A) : (R++, W.chunk_index = R, G = 0, R <= F || (A++, A + 1 < d.first_chunk.length ? F = d.first_chunk[A + 1] - 1 : F = 1 / 0), W.chunk_run_index = A, q += d.samples_per_chunk[A]), W.description_index = d.sample_description_index[W.chunk_run_index] - 1, W.description = b.entries[W.description_index], W.offset = c.chunk_offsets[W.chunk_index - 1] + G, G += W.size, n > X && (J++, X < 0 && (X = 0), X += y.sample_counts[J]), n > 0 ? (t.samples[n - 1].duration = y.sample_deltas[J], t.samples_duration += t.samples[n - 1].duration, W.dts = t.samples[n - 1].dts + t.samples[n - 1].duration) : W.dts = 0, _ ? (n >= he && (Be++, he < 0 && (he = 0), he += _.sample_counts[Be]), W.cts = t.samples[n].dts + _.sample_offsets[Be]) : W.cts = W.dts, k ? (n == k.sample_numbers[Mt] - 1 ? (W.is_sync = !0, Mt++) : (W.is_sync = !1, W.degradation_priority = 0), U && U.entries[_e].sample_delta + $e == n + 1 && (W.subsamples = U.entries[_e].subsamples, $e += U.entries[_e].sample_delta, _e++)) : W.is_sync = !0, v.process_sdtp(t.mdia.minf.stbl.sdtp, W, W.number), B ? W.degradation_priority = B.priority[n] : W.degradation_priority = 0, U && U.entries[_e].sample_delta + $e == n && (W.subsamples = U.entries[_e].subsamples, $e += U.entries[_e].sample_delta), (E.length > 0 || I.length > 0) && v.setSampleGroupProperties(t, W, n, t.sample_groups_info);
|
|
4848
4848
|
}
|
|
4849
4849
|
n > 0 && (t.samples[n - 1].duration = Math.max(t.mdia.mdhd.duration - t.samples[n - 1].dts, 0), t.samples_duration += t.samples[n - 1].duration);
|
|
4850
4850
|
}
|
|
4851
4851
|
}, v.prototype.updateSampleLists = function() {
|
|
4852
|
-
var t, n, c, d, f, y, _,
|
|
4852
|
+
var t, n, c, d, f, y, _, k, b, U, E, I, B, A, R;
|
|
4853
4853
|
if (this.moov !== void 0) {
|
|
4854
4854
|
for (; this.lastMoofIndex < this.moofs.length; )
|
|
4855
|
-
if (
|
|
4856
|
-
for (
|
|
4857
|
-
for (E =
|
|
4858
|
-
var
|
|
4859
|
-
for (c = 0; c <
|
|
4860
|
-
A = {}, A.moof_number = this.lastMoofIndex, A.number_in_traf = E.sample_number, E.sample_number++, A.number = I.samples.length, E.first_sample_index = I.samples.length, I.samples.push(A), A.track_id = I.tkhd.track_id, A.timescale = I.mdia.mdhd.timescale, A.description_index = d - 1, A.description = I.mdia.minf.stbl.stsd.entries[A.description_index], A.size = y,
|
|
4861
|
-
var
|
|
4862
|
-
|
|
4855
|
+
if (b = this.moofs[this.lastMoofIndex], this.lastMoofIndex++, b.type == "moof")
|
|
4856
|
+
for (U = b, t = 0; t < U.trafs.length; t++) {
|
|
4857
|
+
for (E = U.trafs[t], I = this.getTrackById(E.tfhd.track_id), B = this.getTrexById(E.tfhd.track_id), E.tfhd.flags & o.TFHD_FLAG_SAMPLE_DESC ? d = E.tfhd.default_sample_description_index : d = B ? B.default_sample_description_index : 1, E.tfhd.flags & o.TFHD_FLAG_SAMPLE_DUR ? f = E.tfhd.default_sample_duration : f = B ? B.default_sample_duration : 0, E.tfhd.flags & o.TFHD_FLAG_SAMPLE_SIZE ? y = E.tfhd.default_sample_size : y = B ? B.default_sample_size : 0, E.tfhd.flags & o.TFHD_FLAG_SAMPLE_FLAGS ? _ = E.tfhd.default_sample_flags : _ = B ? B.default_sample_flags : 0, E.sample_number = 0, E.sbgps.length > 0 && v.initSampleGroups(I, E, E.sbgps, I.mdia.minf.stbl.sgpds, E.sgpds), n = 0; n < E.truns.length; n++) {
|
|
4858
|
+
var F = E.truns[n];
|
|
4859
|
+
for (c = 0; c < F.sample_count; c++) {
|
|
4860
|
+
A = {}, A.moof_number = this.lastMoofIndex, A.number_in_traf = E.sample_number, E.sample_number++, A.number = I.samples.length, E.first_sample_index = I.samples.length, I.samples.push(A), A.track_id = I.tkhd.track_id, A.timescale = I.mdia.mdhd.timescale, A.description_index = d - 1, A.description = I.mdia.minf.stbl.stsd.entries[A.description_index], A.size = y, F.flags & o.TRUN_FLAGS_SIZE && (A.size = F.sample_size[c]), I.samples_size += A.size, A.duration = f, F.flags & o.TRUN_FLAGS_DURATION && (A.duration = F.sample_duration[c]), I.samples_duration += A.duration, I.first_traf_merged || c > 0 ? A.dts = I.samples[I.samples.length - 2].dts + I.samples[I.samples.length - 2].duration : (E.tfdt ? A.dts = E.tfdt.baseMediaDecodeTime : A.dts = 0, I.first_traf_merged = !0), A.cts = A.dts, F.flags & o.TRUN_FLAGS_CTS_OFFSET && (A.cts = A.dts + F.sample_composition_time_offset[c]), R = _, F.flags & o.TRUN_FLAGS_FLAGS ? R = F.sample_flags[c] : c === 0 && F.flags & o.TRUN_FLAGS_FIRST_FLAG && (R = F.first_sample_flags), A.is_sync = !(R >> 16 & 1), A.is_leading = R >> 26 & 3, A.depends_on = R >> 24 & 3, A.is_depended_on = R >> 22 & 3, A.has_redundancy = R >> 20 & 3, A.degradation_priority = R & 65535;
|
|
4861
|
+
var G = !!(E.tfhd.flags & o.TFHD_FLAG_BASE_DATA_OFFSET), q = !!(E.tfhd.flags & o.TFHD_FLAG_DEFAULT_BASE_IS_MOOF), X = !!(F.flags & o.TRUN_FLAGS_DATA_OFFSET), J = 0;
|
|
4862
|
+
G ? J = E.tfhd.base_data_offset : q || n === 0 ? J = U.start : J = k, n === 0 && c === 0 ? X ? A.offset = J + F.data_offset : A.offset = J : A.offset = k, k = A.offset + A.size, (E.sbgps.length > 0 || E.sgpds.length > 0 || I.mdia.minf.stbl.sbgps.length > 0 || I.mdia.minf.stbl.sgpds.length > 0) && v.setSampleGroupProperties(I, A, A.number_in_traf, E.sample_groups_info);
|
|
4863
4863
|
}
|
|
4864
4864
|
}
|
|
4865
4865
|
if (E.subs) {
|
|
@@ -4955,15 +4955,15 @@ var Gi = {};
|
|
|
4955
4955
|
}
|
|
4956
4956
|
if (y.pitm && (t[y.pitm.item_id].primary = !0), y.iref)
|
|
4957
4957
|
for (c = 0; c < y.iref.references.length; c++) {
|
|
4958
|
-
var
|
|
4959
|
-
for (d = 0; d <
|
|
4960
|
-
t[
|
|
4958
|
+
var k = y.iref.references[c];
|
|
4959
|
+
for (d = 0; d < k.references.length; d++)
|
|
4960
|
+
t[k.from_item_ID].ref_to.push({ type: k.type, id: k.references[d] });
|
|
4961
4961
|
}
|
|
4962
4962
|
if (y.iprp)
|
|
4963
|
-
for (var
|
|
4964
|
-
var
|
|
4965
|
-
for (c = 0; c <
|
|
4966
|
-
var E =
|
|
4963
|
+
for (var b = 0; b < y.iprp.ipmas.length; b++) {
|
|
4964
|
+
var U = y.iprp.ipmas[b];
|
|
4965
|
+
for (c = 0; c < U.associations.length; c++) {
|
|
4966
|
+
var E = U.associations[c];
|
|
4967
4967
|
if (f = t[E.id], f || (f = n[E.id]), f)
|
|
4968
4968
|
for (f.properties === void 0 && (f.properties = {}, f.properties.boxes = []), d = 0; d < E.props.length; d++) {
|
|
4969
4969
|
var I = E.props[d];
|
|
@@ -5058,8 +5058,8 @@ var Gi = {};
|
|
|
5058
5058
|
y.endianness = r.BIG_ENDIAN;
|
|
5059
5059
|
var _ = this.createSingleSampleMoof(f);
|
|
5060
5060
|
_.write(y), _.trafs[0].truns[0].data_offset = _.size + 8, e.debug("MP4Box", "Adjusting data_offset with new value " + _.trafs[0].truns[0].data_offset), y.adjustUint32(_.trafs[0].truns[0].data_offset_position, _.trafs[0].truns[0].data_offset);
|
|
5061
|
-
var
|
|
5062
|
-
return
|
|
5061
|
+
var k = new o.mdatBox();
|
|
5062
|
+
return k.data = f.data, k.write(y), y;
|
|
5063
5063
|
}, v.writeInitializationSegment = function(t, n, c, d) {
|
|
5064
5064
|
var f;
|
|
5065
5065
|
e.debug("ISOFile", "Generating initialization segment");
|
|
@@ -5104,11 +5104,11 @@ var Gi = {};
|
|
|
5104
5104
|
}, o.tkhdBox.prototype.print = function(t) {
|
|
5105
5105
|
o.FullBox.prototype.printHeader.call(this, t), t.log(t.indent + "creation_time: " + this.creation_time), t.log(t.indent + "modification_time: " + this.modification_time), t.log(t.indent + "track_id: " + this.track_id), t.log(t.indent + "duration: " + this.duration), t.log(t.indent + "volume: " + (this.volume >> 8)), t.log(t.indent + "matrix: " + this.matrix.join(", ")), t.log(t.indent + "layer: " + this.layer), t.log(t.indent + "alternate_group: " + this.alternate_group), t.log(t.indent + "width: " + this.width), t.log(t.indent + "height: " + this.height);
|
|
5106
5106
|
};
|
|
5107
|
-
var
|
|
5108
|
-
|
|
5107
|
+
var T = {};
|
|
5108
|
+
T.createFile = function(t, n) {
|
|
5109
5109
|
var c = t !== void 0 ? t : !0, d = new v(n);
|
|
5110
5110
|
return d.discardMdatData = !c, d;
|
|
5111
|
-
}, a.createFile =
|
|
5111
|
+
}, a.createFile = T.createFile;
|
|
5112
5112
|
})(Gi);
|
|
5113
5113
|
const br = /* @__PURE__ */ vr(Gi), Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5114
5114
|
__proto__: null,
|
|
@@ -5444,7 +5444,7 @@ class kr {
|
|
|
5444
5444
|
extracted: !s?.onFirstFrameReady,
|
|
5445
5445
|
index: null,
|
|
5446
5446
|
buffer: new Uint8Array(0)
|
|
5447
|
-
},
|
|
5447
|
+
}, T = {
|
|
5448
5448
|
fileOffset: 0,
|
|
5449
5449
|
moovParsed: !1,
|
|
5450
5450
|
audioComplete: !1
|
|
@@ -5453,22 +5453,22 @@ class kr {
|
|
|
5453
5453
|
u?.(new Error(`MP4Box error: ${n}`));
|
|
5454
5454
|
}, h.onReady = (n) => {
|
|
5455
5455
|
try {
|
|
5456
|
-
|
|
5456
|
+
T.moovParsed = !0, x = n;
|
|
5457
5457
|
const c = this.buildIndex(h, n);
|
|
5458
5458
|
if (v.index = c, n.isProgressive === !0 && s?.onFirstFrameReady && c.tracks.video?.gopIndex[0]) {
|
|
5459
|
-
const
|
|
5459
|
+
const U = c.tracks.video.gopIndex[0], E = c.tracks.video.samples, I = U.keyframeSampleIndex, B = I + U.sampleCount;
|
|
5460
5460
|
let A = 0;
|
|
5461
|
-
for (let
|
|
5462
|
-
const
|
|
5463
|
-
if (!
|
|
5464
|
-
const
|
|
5465
|
-
|
|
5461
|
+
for (let R = I; R < B; R++) {
|
|
5462
|
+
const F = E[R];
|
|
5463
|
+
if (!F) continue;
|
|
5464
|
+
const G = F.byteOffset + F.byteLength;
|
|
5465
|
+
G > A && (A = G);
|
|
5466
5466
|
}
|
|
5467
5467
|
v.byteEnd = A;
|
|
5468
5468
|
}
|
|
5469
|
-
const { config: f, trackId: y, timescale: _, expectedSamples:
|
|
5470
|
-
p = f, m = y, g = _, w =
|
|
5471
|
-
|
|
5469
|
+
const { config: f, trackId: y, timescale: _, expectedSamples: k, isComplete: b } = this.setupAudioExtraction(h, n);
|
|
5470
|
+
p = f, m = y, g = _, w = k, T.audioComplete = b, !b && m && p && h.start(), b && setTimeout(() => {
|
|
5471
|
+
T.moovParsed && T.audioComplete && v.extracted && l?.({ index: c });
|
|
5472
5472
|
}, 0);
|
|
5473
5473
|
} catch (c) {
|
|
5474
5474
|
u?.(c);
|
|
@@ -5489,26 +5489,26 @@ class kr {
|
|
|
5489
5489
|
} catch (_) {
|
|
5490
5490
|
console.warn("[MP4IndexParser] Failed to create audio chunk:", _);
|
|
5491
5491
|
}
|
|
5492
|
-
w !== 1 / 0 && o.length >= w && (
|
|
5492
|
+
w !== 1 / 0 && o.length >= w && (T.audioComplete = !0);
|
|
5493
5493
|
}
|
|
5494
5494
|
}, await this.processStreamData(
|
|
5495
5495
|
e,
|
|
5496
5496
|
h,
|
|
5497
5497
|
s,
|
|
5498
5498
|
v,
|
|
5499
|
-
|
|
5499
|
+
T,
|
|
5500
5500
|
r
|
|
5501
|
-
), h.flush(), await new Promise((n) => setTimeout(n, 100)), !
|
|
5502
|
-
throw new Le(r,
|
|
5503
|
-
if (
|
|
5501
|
+
), h.flush(), await new Promise((n) => setTimeout(n, 100)), !T.moovParsed)
|
|
5502
|
+
throw new Le(r, T.fileOffset);
|
|
5503
|
+
if (T.moovParsed && T.audioComplete) {
|
|
5504
5504
|
const n = v.index || this.buildIndex(h, x);
|
|
5505
5505
|
l({
|
|
5506
5506
|
index: n,
|
|
5507
5507
|
audioSamples: o,
|
|
5508
5508
|
audioMetadata: p
|
|
5509
5509
|
});
|
|
5510
|
-
} else if (
|
|
5511
|
-
|
|
5510
|
+
} else if (T.moovParsed && !T.audioComplete && x) {
|
|
5511
|
+
T.audioComplete = !0;
|
|
5512
5512
|
const n = this.buildIndex(h, x);
|
|
5513
5513
|
o.length > 0 && p ? l({
|
|
5514
5514
|
index: n,
|
|
@@ -5520,7 +5520,7 @@ class kr {
|
|
|
5520
5520
|
setTimeout(() => {
|
|
5521
5521
|
c(
|
|
5522
5522
|
new Error(
|
|
5523
|
-
`MP4Box parsing timeout after reading ${
|
|
5523
|
+
`MP4Box parsing timeout after reading ${T.fileOffset} bytes. moovParsed=${T.moovParsed}, audioExtractionComplete=${T.audioComplete}`
|
|
5524
5524
|
)
|
|
5525
5525
|
);
|
|
5526
5526
|
}, 5e3);
|
|
@@ -5844,9 +5844,9 @@ class Er {
|
|
|
5844
5844
|
const x = `${m === 1 ? 1 : 2}-${g}`, C = Ur[x]?.[l] ?? null;
|
|
5845
5845
|
if (C === null)
|
|
5846
5846
|
return null;
|
|
5847
|
-
const v = this.getSamplesPerFrame(m, g),
|
|
5848
|
-
return !
|
|
5849
|
-
frameSize:
|
|
5847
|
+
const v = this.getSamplesPerFrame(m, g), T = this.calculateFrameSize(g, C, w, o);
|
|
5848
|
+
return !T || T < 24 ? null : {
|
|
5849
|
+
frameSize: T,
|
|
5850
5850
|
sampleRate: w,
|
|
5851
5851
|
channels: p === 3 ? 1 : 2,
|
|
5852
5852
|
bitrateKbps: C || null,
|
|
@@ -6519,28 +6519,28 @@ function Mr(a, e, s) {
|
|
|
6519
6519
|
} catch {
|
|
6520
6520
|
return !1;
|
|
6521
6521
|
}
|
|
6522
|
-
for (let
|
|
6523
|
-
const t =
|
|
6522
|
+
for (let T = 0; T < s; T += 1) {
|
|
6523
|
+
const t = T * e;
|
|
6524
6524
|
for (let n = 0; n < e; n += 1) {
|
|
6525
6525
|
const c = r[n];
|
|
6526
|
-
c && (C === "f32" ? c[
|
|
6526
|
+
c && (C === "f32" ? c[T] = v[t + n] ?? 0 : c[T] = h(v[t + n] ?? 0));
|
|
6527
6527
|
}
|
|
6528
6528
|
}
|
|
6529
6529
|
return !0;
|
|
6530
6530
|
}, u = (C) => {
|
|
6531
6531
|
try {
|
|
6532
6532
|
if (C === "f32-planar") {
|
|
6533
|
-
for (let
|
|
6534
|
-
const t = r[
|
|
6535
|
-
t && a.copyTo(t, { planeIndex:
|
|
6533
|
+
for (let T = 0; T < e; T += 1) {
|
|
6534
|
+
const t = r[T];
|
|
6535
|
+
t && a.copyTo(t, { planeIndex: T, format: "f32-planar" });
|
|
6536
6536
|
}
|
|
6537
6537
|
return !0;
|
|
6538
6538
|
}
|
|
6539
6539
|
const v = new Int16Array(s);
|
|
6540
|
-
for (let
|
|
6541
|
-
const t = r[
|
|
6540
|
+
for (let T = 0; T < e; T += 1) {
|
|
6541
|
+
const t = r[T];
|
|
6542
6542
|
if (t) {
|
|
6543
|
-
a.copyTo(v, { planeIndex:
|
|
6543
|
+
a.copyTo(v, { planeIndex: T, format: "s16-planar" });
|
|
6544
6544
|
for (let n = 0; n < s; n += 1)
|
|
6545
6545
|
t[n] = h(v[n] ?? 0);
|
|
6546
6546
|
}
|
|
@@ -6619,13 +6619,13 @@ class Fr {
|
|
|
6619
6619
|
x || (x = [], this.audioDataByClip.set(e, x));
|
|
6620
6620
|
const C = this.findInsertIndex(x, p), v = 0.5 * m;
|
|
6621
6621
|
if (C < x.length) {
|
|
6622
|
-
const
|
|
6623
|
-
if (Math.abs(
|
|
6622
|
+
const T = x[C];
|
|
6623
|
+
if (Math.abs(T.timestampUs - p) < v)
|
|
6624
6624
|
return;
|
|
6625
6625
|
}
|
|
6626
6626
|
if (C > 0) {
|
|
6627
|
-
const
|
|
6628
|
-
if (Math.abs(
|
|
6627
|
+
const T = x[C - 1];
|
|
6628
|
+
if (Math.abs(T.timestampUs - p) < v)
|
|
6629
6629
|
return;
|
|
6630
6630
|
}
|
|
6631
6631
|
x.splice(C, 0, w);
|
|
@@ -6669,21 +6669,21 @@ class Fr {
|
|
|
6669
6669
|
for (const C of l) {
|
|
6670
6670
|
const v = C.planes[0]?.length ?? 0;
|
|
6671
6671
|
if (v <= 0) continue;
|
|
6672
|
-
const
|
|
6672
|
+
const T = Math.round(
|
|
6673
6673
|
(C.timestampUs - s) / 1e6 * p
|
|
6674
|
-
), t =
|
|
6674
|
+
), t = T + v, n = Math.max(0, T), d = Math.min(w, t) - n;
|
|
6675
6675
|
if (d <= 0) continue;
|
|
6676
|
-
const f = n -
|
|
6676
|
+
const f = n - T;
|
|
6677
6677
|
for (let y = 0; y < m; y++) {
|
|
6678
|
-
const _ = C.planes[y],
|
|
6679
|
-
if (!_ || !
|
|
6680
|
-
const
|
|
6678
|
+
const _ = C.planes[y], k = x[y];
|
|
6679
|
+
if (!_ || !k) continue;
|
|
6680
|
+
const b = Math.min(
|
|
6681
6681
|
d,
|
|
6682
6682
|
_.length - f,
|
|
6683
|
-
|
|
6683
|
+
k.length - n
|
|
6684
6684
|
);
|
|
6685
|
-
|
|
6686
|
-
_.subarray(f, f +
|
|
6685
|
+
b <= 0 || k.set(
|
|
6686
|
+
_.subarray(f, f + b),
|
|
6687
6687
|
n
|
|
6688
6688
|
);
|
|
6689
6689
|
}
|
|
@@ -7447,7 +7447,7 @@ class Nr {
|
|
|
7447
7447
|
(r.startTimeUs === 0 || s >= r.startTimeUs) && (r.currentCount++, r.currentCount >= r.minFrameCount && (r.timeoutId && clearTimeout(r.timeoutId), r.resolve(!0), this.clipReadyWaiters.delete(e)));
|
|
7448
7448
|
}
|
|
7449
7449
|
}
|
|
7450
|
-
function
|
|
7450
|
+
function K(...a) {
|
|
7451
7451
|
const e = { name: "merged" };
|
|
7452
7452
|
for (const s of a)
|
|
7453
7453
|
s.textStyle && (e.textStyle = { ...e.textStyle, ...s.textStyle }), s.containerStyle && (e.containerStyle = { ...e.containerStyle, ...s.containerStyle }), s.globalPosition && (e.globalPosition = { ...e.globalPosition, ...s.globalPosition });
|
|
@@ -7534,21 +7534,21 @@ const Yi = {
|
|
|
7534
7534
|
}, Zi = {
|
|
7535
7535
|
name: "stroke-16",
|
|
7536
7536
|
textStyle: { strokeWidth: 16 }
|
|
7537
|
-
}, oi =
|
|
7537
|
+
}, oi = K(st, Tt);
|
|
7538
7538
|
oi.name = "stroke-black-4";
|
|
7539
|
-
const Ji =
|
|
7539
|
+
const Ji = K(st, Xi);
|
|
7540
7540
|
Ji.name = "stroke-black-6";
|
|
7541
|
-
const Ae =
|
|
7541
|
+
const Ae = K(st, Et);
|
|
7542
7542
|
Ae.name = "stroke-black-8";
|
|
7543
|
-
const es =
|
|
7543
|
+
const es = K(st, Zi);
|
|
7544
7544
|
es.name = "stroke-black-16";
|
|
7545
|
-
const ts =
|
|
7545
|
+
const ts = K(ri, Tt);
|
|
7546
7546
|
ts.name = "stroke-white-4";
|
|
7547
|
-
const ai =
|
|
7547
|
+
const ai = K(ri, Et);
|
|
7548
7548
|
ai.name = "stroke-white-8";
|
|
7549
|
-
const is =
|
|
7549
|
+
const is = K(ni, Tt);
|
|
7550
7550
|
is.name = "stroke-yellow-4";
|
|
7551
|
-
const ss =
|
|
7551
|
+
const ss = K(ni, Et);
|
|
7552
7552
|
ss.name = "stroke-yellow-8";
|
|
7553
7553
|
const Qr = {
|
|
7554
7554
|
name: "container-full",
|
|
@@ -7664,15 +7664,15 @@ const Qr = {
|
|
|
7664
7664
|
position: "absolute",
|
|
7665
7665
|
bottom: "15%"
|
|
7666
7666
|
}
|
|
7667
|
-
}, It =
|
|
7667
|
+
}, It = K(ve, Qi, Ae);
|
|
7668
7668
|
It.name = "yellowText";
|
|
7669
|
-
const hi =
|
|
7669
|
+
const hi = K(ve, Ie, Ae);
|
|
7670
7670
|
hi.name = "whiteText";
|
|
7671
|
-
const li =
|
|
7671
|
+
const li = K(ve, Ki, ai);
|
|
7672
7672
|
li.name = "blackText";
|
|
7673
|
-
const hs =
|
|
7673
|
+
const hs = K(ve, Ie, Ae, Pe);
|
|
7674
7674
|
hs.name = "baseSubtitle";
|
|
7675
|
-
const ls =
|
|
7675
|
+
const ls = K(
|
|
7676
7676
|
ve,
|
|
7677
7677
|
Ie,
|
|
7678
7678
|
Ae,
|
|
@@ -7680,24 +7680,24 @@ const ls = q(
|
|
|
7680
7680
|
rs
|
|
7681
7681
|
);
|
|
7682
7682
|
ls.name = "baseSubtitleCenter";
|
|
7683
|
-
const ds =
|
|
7683
|
+
const ds = K(ve, Ie, oi, cs);
|
|
7684
7684
|
ds.name = "baseSubtitle16_9";
|
|
7685
|
-
const us =
|
|
7685
|
+
const us = K(It, Pe);
|
|
7686
7686
|
us.name = "yellowSubtitle";
|
|
7687
|
-
const fs =
|
|
7687
|
+
const fs = K(hi, Pe);
|
|
7688
7688
|
fs.name = "whiteSubtitle";
|
|
7689
|
-
const ps =
|
|
7689
|
+
const ps = K(li, Pe);
|
|
7690
7690
|
ps.name = "blackSubtitle";
|
|
7691
|
-
const ms =
|
|
7691
|
+
const ms = K(
|
|
7692
7692
|
ve,
|
|
7693
7693
|
Ie,
|
|
7694
7694
|
Pe,
|
|
7695
7695
|
as
|
|
7696
7696
|
);
|
|
7697
7697
|
ms.name = "subtitleBackgroundBlack";
|
|
7698
|
-
const gs =
|
|
7698
|
+
const gs = K(It, qi, ci, os);
|
|
7699
7699
|
gs.name = "title";
|
|
7700
|
-
const ys =
|
|
7700
|
+
const ys = K(Yi, Ie, Ae, ci, ns);
|
|
7701
7701
|
ys.name = "subtitle";
|
|
7702
7702
|
const ln = {
|
|
7703
7703
|
"normal-30": Yi,
|
|
@@ -7776,7 +7776,7 @@ function dn(a) {
|
|
|
7776
7776
|
strokeWidth: 8,
|
|
7777
7777
|
lineHeight: 1.2
|
|
7778
7778
|
}
|
|
7779
|
-
} : s.length === 1 ? s[0] :
|
|
7779
|
+
} : s.length === 1 ? s[0] : K(...s);
|
|
7780
7780
|
}
|
|
7781
7781
|
const Ai = {
|
|
7782
7782
|
"zh-CN": '-apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif',
|
|
@@ -8507,17 +8507,17 @@ class vn {
|
|
|
8507
8507
|
throw y;
|
|
8508
8508
|
}
|
|
8509
8509
|
}
|
|
8510
|
-
const v = Math.max(0, e - g.startUs),
|
|
8510
|
+
const v = Math.max(0, e - g.startUs), T = Math.min(g.durationUs, s - g.startUs), t = g.trimStartUs ?? 0, n = g.trackKind === "audio" && g.loop === !0, d = this.deps.cacheManager.audioSampleCache.get(g.resourceId)?.durationUs ?? 0;
|
|
8511
8511
|
let f = wt({
|
|
8512
8512
|
clipRelativeStartUs: v,
|
|
8513
|
-
clipRelativeEndUs:
|
|
8513
|
+
clipRelativeEndUs: T,
|
|
8514
8514
|
trimStartUs: t,
|
|
8515
8515
|
resourceDurationUs: d,
|
|
8516
8516
|
loop: n
|
|
8517
8517
|
});
|
|
8518
|
-
f.length === 0 &&
|
|
8518
|
+
f.length === 0 && T > v && (f = wt({
|
|
8519
8519
|
clipRelativeStartUs: v,
|
|
8520
|
-
clipRelativeEndUs:
|
|
8520
|
+
clipRelativeEndUs: T,
|
|
8521
8521
|
trimStartUs: t,
|
|
8522
8522
|
resourceDurationUs: d,
|
|
8523
8523
|
loop: !1
|
|
@@ -8653,17 +8653,17 @@ class _s {
|
|
|
8653
8653
|
p.gain.value = 0, o.connect(p), p.connect(l.destination), o.start(0);
|
|
8654
8654
|
const m = this.getClipsInWindow(e, s);
|
|
8655
8655
|
for (const w of m) {
|
|
8656
|
-
const x = Math.max(e, w.startUs), C = Math.min(s, w.startUs + w.durationUs), v = x - w.startUs,
|
|
8656
|
+
const x = Math.max(e, w.startUs), C = Math.min(s, w.startUs + w.durationUs), v = x - w.startUs, T = C - w.startUs, t = this.getModel()?.findClip(w.clipId), n = t?.trimStartUs ?? 0, c = t?.trackKind === "audio" && t.loop === !0, d = t && re(t) ? this.cacheManager.audioSampleCache.get(t.resourceId)?.durationUs ?? 0 : 0;
|
|
8657
8657
|
let f = wt({
|
|
8658
8658
|
clipRelativeStartUs: v,
|
|
8659
|
-
clipRelativeEndUs:
|
|
8659
|
+
clipRelativeEndUs: T,
|
|
8660
8660
|
trimStartUs: n,
|
|
8661
8661
|
resourceDurationUs: d,
|
|
8662
8662
|
loop: c
|
|
8663
8663
|
});
|
|
8664
|
-
f.length === 0 &&
|
|
8664
|
+
f.length === 0 && T > v && (f = wt({
|
|
8665
8665
|
clipRelativeStartUs: v,
|
|
8666
|
-
clipRelativeEndUs:
|
|
8666
|
+
clipRelativeEndUs: T,
|
|
8667
8667
|
trimStartUs: n,
|
|
8668
8668
|
resourceDurationUs: d,
|
|
8669
8669
|
loop: !1
|
|
@@ -8676,20 +8676,20 @@ class _s {
|
|
|
8676
8676
|
);
|
|
8677
8677
|
if (!_ || _.planes.length === 0)
|
|
8678
8678
|
continue;
|
|
8679
|
-
const
|
|
8680
|
-
if (
|
|
8679
|
+
const k = _.planes[0]?.length ?? 0;
|
|
8680
|
+
if (k === 0)
|
|
8681
8681
|
continue;
|
|
8682
|
-
const
|
|
8682
|
+
const b = l.createBuffer(_.planes.length, k, _.sampleRate);
|
|
8683
8683
|
for (let A = 0; A < _.planes.length; A++) {
|
|
8684
|
-
const
|
|
8685
|
-
|
|
8684
|
+
const R = _.planes[A];
|
|
8685
|
+
R && b.copyToChannel(new Float32Array(R), A);
|
|
8686
8686
|
}
|
|
8687
|
-
const
|
|
8688
|
-
|
|
8687
|
+
const U = l.createBufferSource();
|
|
8688
|
+
U.buffer = b;
|
|
8689
8689
|
const E = l.createGain();
|
|
8690
|
-
E.gain.value = w.volume,
|
|
8690
|
+
E.gain.value = w.volume, U.connect(E), E.connect(l.destination);
|
|
8691
8691
|
const B = (w.startUs + y.clipRelativeStartUs - e) / 1e6;
|
|
8692
|
-
|
|
8692
|
+
U.start(B);
|
|
8693
8693
|
}
|
|
8694
8694
|
}
|
|
8695
8695
|
return await l.startRendering();
|
|
@@ -8962,8 +8962,8 @@ class Sn {
|
|
|
8962
8962
|
if (x <= 0) return;
|
|
8963
8963
|
const C = e.createBufferSource();
|
|
8964
8964
|
C.buffer = u, C.playbackRate.value = o;
|
|
8965
|
-
const v = e.createGain(),
|
|
8966
|
-
v.gain.setValueAtTime(0, m), v.gain.linearRampToValueAtTime(
|
|
8965
|
+
const v = e.createGain(), T = this.volume, t = Math.min(this.PREVIEW_BLOCK_FADE_SEC, x / 2);
|
|
8966
|
+
v.gain.setValueAtTime(0, m), v.gain.linearRampToValueAtTime(T, m + t), v.gain.setValueAtTime(T, m + Math.max(t, x - t)), v.gain.linearRampToValueAtTime(0, m + x), C.connect(v), v.connect(e.destination), C.start(m, g);
|
|
8967
8967
|
const n = { source: C, gain: v };
|
|
8968
8968
|
this.previewScheduledSources.add(n), C.onended = () => {
|
|
8969
8969
|
try {
|
|
@@ -9235,7 +9235,7 @@ var di = (a, e, s) => {
|
|
|
9235
9235
|
get _() {
|
|
9236
9236
|
return S(a, e, r);
|
|
9237
9237
|
}
|
|
9238
|
-
}), V = (a, e, s) => (di(a, e, "access private method"), s), H = new Uint8Array(8), fe = new DataView(H.buffer), Z = (a) => [(a % 256 + 256) % 256],
|
|
9238
|
+
}), V = (a, e, s) => (di(a, e, "access private method"), s), H = new Uint8Array(8), fe = new DataView(H.buffer), Z = (a) => [(a % 256 + 256) % 256], $ = (a) => (fe.setUint16(0, a, !1), [H[0], H[1]]), Un = (a) => (fe.setInt16(0, a, !1), [H[0], H[1]]), ws = (a) => (fe.setUint32(0, a, !1), [H[1], H[2], H[3]]), M = (a) => (fe.setUint32(0, a, !1), [H[0], H[1], H[2], H[3]]), Tn = (a) => (fe.setInt32(0, a, !1), [H[0], H[1], H[2], H[3]]), Ee = (a) => (fe.setUint32(0, Math.floor(a / 2 ** 32), !1), fe.setUint32(4, a, !1), [H[0], H[1], H[2], H[3], H[4], H[5], H[6], H[7]]), ui = (a) => (fe.setInt16(0, 2 ** 8 * a, !1), [H[0], H[1]]), de = (a) => (fe.setInt32(0, 2 ** 16 * a, !1), [H[0], H[1], H[2], H[3]]), Ft = (a) => (fe.setInt32(0, 2 ** 30 * a, !1), [H[0], H[1], H[2], H[3]]), ce = (a, e = !1) => {
|
|
9239
9239
|
let s = Array(a.length).fill(null).map((r, h) => a.charCodeAt(h));
|
|
9240
9240
|
return e && s.push(0), s;
|
|
9241
9241
|
}, vt = (a) => a && a[a.length - 1], fi = (a) => {
|
|
@@ -9282,7 +9282,7 @@ var di = (a, e, s) => {
|
|
|
9282
9282
|
return a.fragmented ? Q("ftyp", [
|
|
9283
9283
|
ce("iso5"),
|
|
9284
9284
|
// Major brand
|
|
9285
|
-
|
|
9285
|
+
M(e),
|
|
9286
9286
|
// Minor version
|
|
9287
9287
|
// Compatible brands
|
|
9288
9288
|
ce("iso5"),
|
|
@@ -9291,7 +9291,7 @@ var di = (a, e, s) => {
|
|
|
9291
9291
|
]) : Q("ftyp", [
|
|
9292
9292
|
ce("isom"),
|
|
9293
9293
|
// Major brand
|
|
9294
|
-
|
|
9294
|
+
M(e),
|
|
9295
9295
|
// Minor version
|
|
9296
9296
|
// Compatible brands
|
|
9297
9297
|
ce("isom"),
|
|
@@ -9309,13 +9309,13 @@ var di = (a, e, s) => {
|
|
|
9309
9309
|
const o = fi(u.samples);
|
|
9310
9310
|
return o.presentationTimestamp + o.duration;
|
|
9311
9311
|
})
|
|
9312
|
-
), jt), r = Math.max(...e.map((u) => u.id)) + 1, h = !He(a) || !He(s), l = h ? Ee :
|
|
9312
|
+
), jt), r = Math.max(...e.map((u) => u.id)) + 1, h = !He(a) || !He(s), l = h ? Ee : M;
|
|
9313
9313
|
return Y("mvhd", +h, 0, [
|
|
9314
9314
|
l(a),
|
|
9315
9315
|
// Creation time
|
|
9316
9316
|
l(a),
|
|
9317
9317
|
// Modification time
|
|
9318
|
-
|
|
9318
|
+
M(jt),
|
|
9319
9319
|
// Timescale
|
|
9320
9320
|
l(s),
|
|
9321
9321
|
// Duration
|
|
@@ -9329,7 +9329,7 @@ var di = (a, e, s) => {
|
|
|
9329
9329
|
// Matrix
|
|
9330
9330
|
Array(24).fill(0),
|
|
9331
9331
|
// Pre-defined
|
|
9332
|
-
|
|
9332
|
+
M(r)
|
|
9333
9333
|
// Next track ID
|
|
9334
9334
|
]);
|
|
9335
9335
|
}, Pn = (a, e) => Q("trak", null, [
|
|
@@ -9339,27 +9339,27 @@ var di = (a, e, s) => {
|
|
|
9339
9339
|
let s = fi(a.samples), r = ue(
|
|
9340
9340
|
s ? s.presentationTimestamp + s.duration : 0,
|
|
9341
9341
|
jt
|
|
9342
|
-
), h = !He(e) || !He(r), l = h ? Ee :
|
|
9342
|
+
), h = !He(e) || !He(r), l = h ? Ee : M, u;
|
|
9343
9343
|
return a.info.type === "video" ? u = typeof a.info.rotation == "number" ? vs(a.info.rotation) : a.info.rotation : u = bs, Y("tkhd", +h, 3, [
|
|
9344
9344
|
l(e),
|
|
9345
9345
|
// Creation time
|
|
9346
9346
|
l(e),
|
|
9347
9347
|
// Modification time
|
|
9348
|
-
|
|
9348
|
+
M(a.id),
|
|
9349
9349
|
// Track ID
|
|
9350
|
-
|
|
9350
|
+
M(0),
|
|
9351
9351
|
// Reserved
|
|
9352
9352
|
l(r),
|
|
9353
9353
|
// Duration
|
|
9354
9354
|
Array(8).fill(0),
|
|
9355
9355
|
// Reserved
|
|
9356
|
-
|
|
9356
|
+
$(0),
|
|
9357
9357
|
// Layer
|
|
9358
|
-
|
|
9358
|
+
$(0),
|
|
9359
9359
|
// Alternate group
|
|
9360
9360
|
ui(a.info.type === "audio" ? 1 : 0),
|
|
9361
9361
|
// Volume
|
|
9362
|
-
|
|
9362
|
+
$(0),
|
|
9363
9363
|
// Reserved
|
|
9364
9364
|
Ss(u),
|
|
9365
9365
|
// Matrix
|
|
@@ -9376,19 +9376,19 @@ var di = (a, e, s) => {
|
|
|
9376
9376
|
let s = fi(a.samples), r = ue(
|
|
9377
9377
|
s ? s.presentationTimestamp + s.duration : 0,
|
|
9378
9378
|
a.timescale
|
|
9379
|
-
), h = !He(e) || !He(r), l = h ? Ee :
|
|
9379
|
+
), h = !He(e) || !He(r), l = h ? Ee : M;
|
|
9380
9380
|
return Y("mdhd", +h, 0, [
|
|
9381
9381
|
l(e),
|
|
9382
9382
|
// Creation time
|
|
9383
9383
|
l(e),
|
|
9384
9384
|
// Modification time
|
|
9385
|
-
|
|
9385
|
+
M(a.timescale),
|
|
9386
9386
|
// Timescale
|
|
9387
9387
|
l(r),
|
|
9388
9388
|
// Duration
|
|
9389
|
-
|
|
9389
|
+
$(21956),
|
|
9390
9390
|
// Language ("und", undetermined)
|
|
9391
|
-
|
|
9391
|
+
$(0)
|
|
9392
9392
|
// Quality
|
|
9393
9393
|
]);
|
|
9394
9394
|
}, Fn = (a) => Y("hdlr", 0, 0, [
|
|
@@ -9396,11 +9396,11 @@ var di = (a, e, s) => {
|
|
|
9396
9396
|
// Component type
|
|
9397
9397
|
ce(a),
|
|
9398
9398
|
// Component subtype
|
|
9399
|
-
|
|
9399
|
+
M(0),
|
|
9400
9400
|
// Component manufacturer
|
|
9401
|
-
|
|
9401
|
+
M(0),
|
|
9402
9402
|
// Component flags
|
|
9403
|
-
|
|
9403
|
+
M(0),
|
|
9404
9404
|
// Component flags mask
|
|
9405
9405
|
ce("mp4-muxer-hdlr", !0)
|
|
9406
9406
|
// Component name
|
|
@@ -9409,23 +9409,23 @@ var di = (a, e, s) => {
|
|
|
9409
9409
|
On(),
|
|
9410
9410
|
Vn(a)
|
|
9411
9411
|
]), Ln = () => Y("vmhd", 0, 1, [
|
|
9412
|
-
|
|
9412
|
+
$(0),
|
|
9413
9413
|
// Graphics mode
|
|
9414
|
-
|
|
9414
|
+
$(0),
|
|
9415
9415
|
// Opcolor R
|
|
9416
|
-
|
|
9416
|
+
$(0),
|
|
9417
9417
|
// Opcolor G
|
|
9418
|
-
|
|
9418
|
+
$(0)
|
|
9419
9419
|
// Opcolor B
|
|
9420
9420
|
]), zn = () => Y("smhd", 0, 0, [
|
|
9421
|
-
|
|
9421
|
+
$(0),
|
|
9422
9422
|
// Balance
|
|
9423
|
-
|
|
9423
|
+
$(0)
|
|
9424
9424
|
// Reserved
|
|
9425
9425
|
]), On = () => Q("dinf", null, [
|
|
9426
9426
|
Nn()
|
|
9427
9427
|
]), Nn = () => Y("dref", 0, 0, [
|
|
9428
|
-
|
|
9428
|
+
M(1)
|
|
9429
9429
|
// Entry count
|
|
9430
9430
|
], [
|
|
9431
9431
|
Wn()
|
|
@@ -9441,7 +9441,7 @@ var di = (a, e, s) => {
|
|
|
9441
9441
|
e ? ao(a) : null
|
|
9442
9442
|
]);
|
|
9443
9443
|
}, Hn = (a) => Y("stsd", 0, 0, [
|
|
9444
|
-
|
|
9444
|
+
M(1)
|
|
9445
9445
|
// Entry count
|
|
9446
9446
|
], [
|
|
9447
9447
|
a.info.type === "video" ? Gn(
|
|
@@ -9454,29 +9454,29 @@ var di = (a, e, s) => {
|
|
|
9454
9454
|
]), Gn = (a, e) => Q(a, [
|
|
9455
9455
|
Array(6).fill(0),
|
|
9456
9456
|
// Reserved
|
|
9457
|
-
|
|
9457
|
+
$(1),
|
|
9458
9458
|
// Data reference index
|
|
9459
|
-
|
|
9459
|
+
$(0),
|
|
9460
9460
|
// Pre-defined
|
|
9461
|
-
|
|
9461
|
+
$(0),
|
|
9462
9462
|
// Reserved
|
|
9463
9463
|
Array(12).fill(0),
|
|
9464
9464
|
// Pre-defined
|
|
9465
|
-
|
|
9465
|
+
$(e.info.width),
|
|
9466
9466
|
// Width
|
|
9467
|
-
|
|
9467
|
+
$(e.info.height),
|
|
9468
9468
|
// Height
|
|
9469
|
-
|
|
9469
|
+
M(4718592),
|
|
9470
9470
|
// Horizontal resolution
|
|
9471
|
-
|
|
9471
|
+
M(4718592),
|
|
9472
9472
|
// Vertical resolution
|
|
9473
|
-
|
|
9473
|
+
M(0),
|
|
9474
9474
|
// Reserved
|
|
9475
|
-
|
|
9475
|
+
$(1),
|
|
9476
9476
|
// Frame count
|
|
9477
9477
|
Array(32).fill(0),
|
|
9478
9478
|
// Compressor name
|
|
9479
|
-
|
|
9479
|
+
$(24),
|
|
9480
9480
|
// Depth
|
|
9481
9481
|
Un(65535)
|
|
9482
9482
|
// Pre-defined
|
|
@@ -9509,11 +9509,11 @@ var di = (a, e, s) => {
|
|
|
9509
9509
|
}, qn = (a) => Q("colr", [
|
|
9510
9510
|
ce("nclx"),
|
|
9511
9511
|
// Colour type
|
|
9512
|
-
|
|
9512
|
+
$($n[a.info.decoderConfig.colorSpace.primaries]),
|
|
9513
9513
|
// Colour primaries
|
|
9514
|
-
|
|
9514
|
+
$(jn[a.info.decoderConfig.colorSpace.transfer]),
|
|
9515
9515
|
// Transfer characteristics
|
|
9516
|
-
|
|
9516
|
+
$(Yn[a.info.decoderConfig.colorSpace.matrix]),
|
|
9517
9517
|
// Matrix coefficients
|
|
9518
9518
|
Z((a.info.decoderConfig.colorSpace.fullRange ? 1 : 0) << 7)
|
|
9519
9519
|
// Full range flag
|
|
@@ -9543,7 +9543,7 @@ var di = (a, e, s) => {
|
|
|
9543
9543
|
// Transfer characteristics
|
|
9544
9544
|
Z(2),
|
|
9545
9545
|
// Matrix coefficients
|
|
9546
|
-
|
|
9546
|
+
$(0)
|
|
9547
9547
|
// Codec initialization data size
|
|
9548
9548
|
]);
|
|
9549
9549
|
}, Zn = () => {
|
|
@@ -9557,21 +9557,21 @@ var di = (a, e, s) => {
|
|
|
9557
9557
|
}, Jn = (a, e) => Q(a, [
|
|
9558
9558
|
Array(6).fill(0),
|
|
9559
9559
|
// Reserved
|
|
9560
|
-
|
|
9560
|
+
$(1),
|
|
9561
9561
|
// Data reference index
|
|
9562
|
-
|
|
9562
|
+
$(0),
|
|
9563
9563
|
// Version
|
|
9564
|
-
|
|
9564
|
+
$(0),
|
|
9565
9565
|
// Revision level
|
|
9566
|
-
|
|
9566
|
+
M(0),
|
|
9567
9567
|
// Vendor
|
|
9568
|
-
|
|
9568
|
+
$(e.info.numberOfChannels),
|
|
9569
9569
|
// Number of channels
|
|
9570
|
-
|
|
9570
|
+
$(16),
|
|
9571
9571
|
// Sample size (bits)
|
|
9572
|
-
|
|
9572
|
+
$(0),
|
|
9573
9573
|
// Compression ID
|
|
9574
|
-
|
|
9574
|
+
$(0),
|
|
9575
9575
|
// Packet size
|
|
9576
9576
|
de(e.info.sampleRate)
|
|
9577
9577
|
// Sample rate
|
|
@@ -9581,15 +9581,15 @@ var di = (a, e, s) => {
|
|
|
9581
9581
|
let e = new Uint8Array(a.info.decoderConfig.description);
|
|
9582
9582
|
return Y("esds", 0, 0, [
|
|
9583
9583
|
// https://stackoverflow.com/a/54803118
|
|
9584
|
-
|
|
9584
|
+
M(58753152),
|
|
9585
9585
|
// TAG(3) = Object Descriptor ([2])
|
|
9586
9586
|
Z(32 + e.byteLength),
|
|
9587
9587
|
// length of this OD (which includes the next 2 tags)
|
|
9588
|
-
|
|
9588
|
+
$(1),
|
|
9589
9589
|
// ES_ID = 1
|
|
9590
9590
|
Z(0),
|
|
9591
9591
|
// flags etc = 0
|
|
9592
|
-
|
|
9592
|
+
M(75530368),
|
|
9593
9593
|
// TAG(4) = ES Descriptor ([2]) embedded in above OD
|
|
9594
9594
|
Z(18 + e.byteLength),
|
|
9595
9595
|
// length of this ESD
|
|
@@ -9599,16 +9599,16 @@ var di = (a, e, s) => {
|
|
|
9599
9599
|
// stream type(6bits)=5 audio, flags(2bits)=1
|
|
9600
9600
|
ws(0),
|
|
9601
9601
|
// 24bit buffer size
|
|
9602
|
-
|
|
9602
|
+
M(130071),
|
|
9603
9603
|
// max bitrate
|
|
9604
|
-
|
|
9604
|
+
M(130071),
|
|
9605
9605
|
// avg bitrate
|
|
9606
|
-
|
|
9606
|
+
M(92307584),
|
|
9607
9607
|
// TAG(5) = ASC ([2],[3]) embedded in above OD
|
|
9608
9608
|
Z(e.byteLength),
|
|
9609
9609
|
// length
|
|
9610
9610
|
...e,
|
|
9611
|
-
|
|
9611
|
+
M(109084800),
|
|
9612
9612
|
// TAG(6)
|
|
9613
9613
|
Z(1),
|
|
9614
9614
|
// length
|
|
@@ -9629,8 +9629,8 @@ var di = (a, e, s) => {
|
|
|
9629
9629
|
// Version
|
|
9630
9630
|
Z(a.info.numberOfChannels),
|
|
9631
9631
|
// OutputChannelCount
|
|
9632
|
-
|
|
9633
|
-
|
|
9632
|
+
$(e),
|
|
9633
|
+
M(a.info.sampleRate),
|
|
9634
9634
|
// InputSampleRate
|
|
9635
9635
|
ui(s),
|
|
9636
9636
|
// OutputGain
|
|
@@ -9638,13 +9638,13 @@ var di = (a, e, s) => {
|
|
|
9638
9638
|
// ChannelMappingFamily
|
|
9639
9639
|
]);
|
|
9640
9640
|
}, io = (a) => Y("stts", 0, 0, [
|
|
9641
|
-
|
|
9641
|
+
M(a.timeToSampleTable.length),
|
|
9642
9642
|
// Number of entries
|
|
9643
9643
|
a.timeToSampleTable.map((e) => [
|
|
9644
9644
|
// Time-to-sample table
|
|
9645
|
-
|
|
9645
|
+
M(e.sampleCount),
|
|
9646
9646
|
// Sample count
|
|
9647
|
-
|
|
9647
|
+
M(e.sampleDelta)
|
|
9648
9648
|
// Sample duration
|
|
9649
9649
|
])
|
|
9650
9650
|
]), so = (a) => {
|
|
@@ -9652,66 +9652,66 @@ var di = (a, e, s) => {
|
|
|
9652
9652
|
return null;
|
|
9653
9653
|
let e = [...a.samples.entries()].filter(([, s]) => s.type === "key");
|
|
9654
9654
|
return Y("stss", 0, 0, [
|
|
9655
|
-
|
|
9655
|
+
M(e.length),
|
|
9656
9656
|
// Number of entries
|
|
9657
|
-
e.map(([s]) =>
|
|
9657
|
+
e.map(([s]) => M(s + 1))
|
|
9658
9658
|
// Sync sample table
|
|
9659
9659
|
]);
|
|
9660
9660
|
}, ro = (a) => Y("stsc", 0, 0, [
|
|
9661
|
-
|
|
9661
|
+
M(a.compactlyCodedChunkTable.length),
|
|
9662
9662
|
// Number of entries
|
|
9663
9663
|
a.compactlyCodedChunkTable.map((e) => [
|
|
9664
9664
|
// Sample-to-chunk table
|
|
9665
|
-
|
|
9665
|
+
M(e.firstChunk),
|
|
9666
9666
|
// First chunk
|
|
9667
|
-
|
|
9667
|
+
M(e.samplesPerChunk),
|
|
9668
9668
|
// Samples per chunk
|
|
9669
|
-
|
|
9669
|
+
M(1)
|
|
9670
9670
|
// Sample description index
|
|
9671
9671
|
])
|
|
9672
9672
|
]), no = (a) => Y("stsz", 0, 0, [
|
|
9673
|
-
|
|
9673
|
+
M(0),
|
|
9674
9674
|
// Sample size (0 means non-constant size)
|
|
9675
|
-
|
|
9675
|
+
M(a.samples.length),
|
|
9676
9676
|
// Number of entries
|
|
9677
|
-
a.samples.map((e) =>
|
|
9677
|
+
a.samples.map((e) => M(e.size))
|
|
9678
9678
|
// Sample size table
|
|
9679
9679
|
]), oo = (a) => a.finalizedChunks.length > 0 && vt(a.finalizedChunks).offset >= 2 ** 32 ? Y("co64", 0, 0, [
|
|
9680
|
-
|
|
9680
|
+
M(a.finalizedChunks.length),
|
|
9681
9681
|
// Number of entries
|
|
9682
9682
|
a.finalizedChunks.map((e) => Ee(e.offset))
|
|
9683
9683
|
// Chunk offset table
|
|
9684
9684
|
]) : Y("stco", 0, 0, [
|
|
9685
|
-
|
|
9685
|
+
M(a.finalizedChunks.length),
|
|
9686
9686
|
// Number of entries
|
|
9687
|
-
a.finalizedChunks.map((e) =>
|
|
9687
|
+
a.finalizedChunks.map((e) => M(e.offset))
|
|
9688
9688
|
// Chunk offset table
|
|
9689
9689
|
]), ao = (a) => Y("ctts", 0, 0, [
|
|
9690
|
-
|
|
9690
|
+
M(a.compositionTimeOffsetTable.length),
|
|
9691
9691
|
// Number of entries
|
|
9692
9692
|
a.compositionTimeOffsetTable.map((e) => [
|
|
9693
9693
|
// Time-to-sample table
|
|
9694
|
-
|
|
9694
|
+
M(e.sampleCount),
|
|
9695
9695
|
// Sample count
|
|
9696
|
-
|
|
9696
|
+
M(e.sampleCompositionTimeOffset)
|
|
9697
9697
|
// Sample offset
|
|
9698
9698
|
])
|
|
9699
9699
|
]), co = (a) => Q("mvex", null, a.map(ho)), ho = (a) => Y("trex", 0, 0, [
|
|
9700
|
-
|
|
9700
|
+
M(a.id),
|
|
9701
9701
|
// Track ID
|
|
9702
|
-
|
|
9702
|
+
M(1),
|
|
9703
9703
|
// Default sample description index
|
|
9704
|
-
|
|
9704
|
+
M(0),
|
|
9705
9705
|
// Default sample duration
|
|
9706
|
-
|
|
9706
|
+
M(0),
|
|
9707
9707
|
// Default sample size
|
|
9708
|
-
|
|
9708
|
+
M(0)
|
|
9709
9709
|
// Default sample flags
|
|
9710
9710
|
]), Ri = (a, e) => Q("moof", null, [
|
|
9711
9711
|
lo(a),
|
|
9712
9712
|
...e.map(uo)
|
|
9713
9713
|
]), lo = (a) => Y("mfhd", 0, 0, [
|
|
9714
|
-
|
|
9714
|
+
M(a)
|
|
9715
9715
|
// Sequence number
|
|
9716
9716
|
]), Cs = (a) => {
|
|
9717
9717
|
let e = 0, s = 0, r = 0, h = 0, l = a.type === "delta";
|
|
@@ -9729,32 +9729,32 @@ var di = (a, e, s) => {
|
|
|
9729
9729
|
flags: Cs(s)
|
|
9730
9730
|
};
|
|
9731
9731
|
return Y("tfhd", 0, e, [
|
|
9732
|
-
|
|
9732
|
+
M(a.id),
|
|
9733
9733
|
// Track ID
|
|
9734
|
-
|
|
9734
|
+
M(r.duration),
|
|
9735
9735
|
// Default sample duration
|
|
9736
|
-
|
|
9736
|
+
M(r.size),
|
|
9737
9737
|
// Default sample size
|
|
9738
|
-
|
|
9738
|
+
M(r.flags)
|
|
9739
9739
|
// Default sample flags
|
|
9740
9740
|
]);
|
|
9741
9741
|
}, po = (a) => Y("tfdt", 1, 0, [
|
|
9742
9742
|
Ee(ue(a.currentChunk.startTimestamp, a.timescale))
|
|
9743
9743
|
// Base Media Decode Time
|
|
9744
9744
|
]), mo = (a) => {
|
|
9745
|
-
let e = a.currentChunk.samples.map((
|
|
9745
|
+
let e = a.currentChunk.samples.map((T) => T.timescaleUnitsToNextSample), s = a.currentChunk.samples.map((T) => T.size), r = a.currentChunk.samples.map(Cs), h = a.currentChunk.samples.map((T) => ue(T.presentationTimestamp - T.decodeTimestamp, a.timescale)), l = new Set(e), u = new Set(s), o = new Set(r), p = new Set(h), m = o.size === 2 && r[0] !== r[1], g = l.size > 1, w = u.size > 1, x = !m && o.size > 1, C = p.size > 1 || [...p].some((T) => T !== 0), v = 0;
|
|
9746
9746
|
return v |= 1, v |= 4 * +m, v |= 256 * +g, v |= 512 * +w, v |= 1024 * +x, v |= 2048 * +C, Y("trun", 1, v, [
|
|
9747
|
-
|
|
9747
|
+
M(a.currentChunk.samples.length),
|
|
9748
9748
|
// Sample count
|
|
9749
|
-
|
|
9749
|
+
M(a.currentChunk.offset - a.currentChunk.moofOffset || 0),
|
|
9750
9750
|
// Data offset
|
|
9751
|
-
m ?
|
|
9752
|
-
a.currentChunk.samples.map((
|
|
9753
|
-
g ?
|
|
9751
|
+
m ? M(r[0]) : [],
|
|
9752
|
+
a.currentChunk.samples.map((T, t) => [
|
|
9753
|
+
g ? M(e[t]) : [],
|
|
9754
9754
|
// Sample duration
|
|
9755
|
-
w ?
|
|
9755
|
+
w ? M(s[t]) : [],
|
|
9756
9756
|
// Sample size
|
|
9757
|
-
x ?
|
|
9757
|
+
x ? M(r[t]) : [],
|
|
9758
9758
|
// Sample flags
|
|
9759
9759
|
// Sample composition time offsets
|
|
9760
9760
|
C ? Tn(h[t]) : []
|
|
@@ -9764,28 +9764,28 @@ var di = (a, e, s) => {
|
|
|
9764
9764
|
...a.map(yo),
|
|
9765
9765
|
_o()
|
|
9766
9766
|
]), yo = (a, e) => Y("tfra", 1, 0, [
|
|
9767
|
-
|
|
9767
|
+
M(a.id),
|
|
9768
9768
|
// Track ID
|
|
9769
|
-
|
|
9769
|
+
M(63),
|
|
9770
9770
|
// This specifies that traf number, trun number and sample number are 32-bit ints
|
|
9771
|
-
|
|
9771
|
+
M(a.finalizedChunks.length),
|
|
9772
9772
|
// Number of entries
|
|
9773
9773
|
a.finalizedChunks.map((r) => [
|
|
9774
9774
|
Ee(ue(r.startTimestamp, a.timescale)),
|
|
9775
9775
|
// Time
|
|
9776
9776
|
Ee(r.moofOffset),
|
|
9777
9777
|
// moof offset
|
|
9778
|
-
|
|
9778
|
+
M(e + 1),
|
|
9779
9779
|
// traf number
|
|
9780
|
-
|
|
9780
|
+
M(1),
|
|
9781
9781
|
// trun number
|
|
9782
|
-
|
|
9782
|
+
M(1)
|
|
9783
9783
|
// Sample number
|
|
9784
9784
|
])
|
|
9785
9785
|
]), _o = () => Y("mfro", 0, 0, [
|
|
9786
9786
|
// This value needs to be overwritten manually from the outside, where the actual size of the enclosing mfra box
|
|
9787
9787
|
// is known
|
|
9788
|
-
|
|
9788
|
+
M(0)
|
|
9789
9789
|
// Size
|
|
9790
9790
|
]), wo = {
|
|
9791
9791
|
avc: "avc1",
|
|
@@ -10019,9 +10019,9 @@ var To = class extends yi {
|
|
|
10019
10019
|
chunkSize: a.options?.chunkSize
|
|
10020
10020
|
}));
|
|
10021
10021
|
}
|
|
10022
|
-
}, jt = 1e3, Eo = ["avc", "hevc", "vp9", "av1"], Io = ["aac", "opus"], Ao = 2082844800, Po = ["strict", "offset", "cross-track-offset"],
|
|
10022
|
+
}, jt = 1e3, Eo = ["avc", "hevc", "vp9", "av1"], Io = ["aac", "opus"], Ao = 2082844800, Po = ["strict", "offset", "cross-track-offset"], D, L, Ct, oe, se, ee, ze, We, _i, xe, ke, Ze, Yt, Ts, qt, Es, wi, Is, Kt, As, vi, Ps, ut, Qt, le, pe, bi, Bs, Je, xt, kt, Si, Ge, rt, ft, Xt, Bo = class {
|
|
10023
10023
|
constructor(a) {
|
|
10024
|
-
if (N(this, Yt), N(this, qt), N(this, wi), N(this, Kt), N(this, vi), N(this, ut), N(this, le), N(this, bi), N(this, Je), N(this, kt), N(this, Ge), N(this, ft), N(this,
|
|
10024
|
+
if (N(this, Yt), N(this, qt), N(this, wi), N(this, Kt), N(this, vi), N(this, ut), N(this, le), N(this, bi), N(this, Je), N(this, kt), N(this, Ge), N(this, ft), N(this, D, void 0), N(this, L, void 0), N(this, Ct, void 0), N(this, oe, void 0), N(this, se, null), N(this, ee, null), N(this, ze, Math.floor(Date.now() / 1e3) + Ao), N(this, We, []), N(this, _i, 1), N(this, xe, []), N(this, ke, []), N(this, Ze, !1), V(this, Yt, Ts).call(this, a), a.video = Ke(a.video), a.audio = Ke(a.audio), a.fastStart = Ke(a.fastStart), this.target = a.target, te(this, D, {
|
|
10025
10025
|
firstTimestampBehavior: "strict",
|
|
10026
10026
|
...a
|
|
10027
10027
|
}), a.target instanceof Ht)
|
|
@@ -10072,12 +10072,12 @@ var To = class extends yi {
|
|
|
10072
10072
|
throw new TypeError(
|
|
10073
10073
|
"addVideoChunkRaw's sixth argument (compositionTimeOffset), when provided, must be a real number."
|
|
10074
10074
|
);
|
|
10075
|
-
if (V(this, ft, Xt).call(this), !S(this,
|
|
10075
|
+
if (V(this, ft, Xt).call(this), !S(this, D).video)
|
|
10076
10076
|
throw new Error("No video track declared.");
|
|
10077
|
-
if (typeof S(this,
|
|
10078
|
-
throw new Error(`Cannot add more video chunks than specified in 'fastStart' (${S(this,
|
|
10077
|
+
if (typeof S(this, D).fastStart == "object" && S(this, se).samples.length === S(this, D).fastStart.expectedVideoChunks)
|
|
10078
|
+
throw new Error(`Cannot add more video chunks than specified in 'fastStart' (${S(this, D).fastStart.expectedVideoChunks}).`);
|
|
10079
10079
|
let u = V(this, ut, Qt).call(this, S(this, se), a, e, s, r, h, l);
|
|
10080
|
-
if (S(this,
|
|
10080
|
+
if (S(this, D).fastStart === "fragmented" && S(this, ee)) {
|
|
10081
10081
|
for (; S(this, ke).length > 0 && S(this, ke)[0].decodeTimestamp <= u.decodeTimestamp; ) {
|
|
10082
10082
|
let o = S(this, ke).shift();
|
|
10083
10083
|
V(this, le, pe).call(this, S(this, ee), o);
|
|
@@ -10109,12 +10109,12 @@ var To = class extends yi {
|
|
|
10109
10109
|
throw new TypeError("addAudioChunkRaw's fourth argument (duration) must be a non-negative real number.");
|
|
10110
10110
|
if (h && typeof h != "object")
|
|
10111
10111
|
throw new TypeError("addAudioChunkRaw's fifth argument (meta), when provided, must be an object.");
|
|
10112
|
-
if (V(this, ft, Xt).call(this), !S(this,
|
|
10112
|
+
if (V(this, ft, Xt).call(this), !S(this, D).audio)
|
|
10113
10113
|
throw new Error("No audio track declared.");
|
|
10114
|
-
if (typeof S(this,
|
|
10115
|
-
throw new Error(`Cannot add more audio chunks than specified in 'fastStart' (${S(this,
|
|
10114
|
+
if (typeof S(this, D).fastStart == "object" && S(this, ee).samples.length === S(this, D).fastStart.expectedAudioChunks)
|
|
10115
|
+
throw new Error(`Cannot add more audio chunks than specified in 'fastStart' (${S(this, D).fastStart.expectedAudioChunks}).`);
|
|
10116
10116
|
let l = V(this, ut, Qt).call(this, S(this, ee), a, e, s, r, h);
|
|
10117
|
-
if (S(this,
|
|
10117
|
+
if (S(this, D).fastStart === "fragmented" && S(this, se)) {
|
|
10118
10118
|
for (; S(this, xe).length > 0 && S(this, xe)[0].decodeTimestamp <= l.decodeTimestamp; ) {
|
|
10119
10119
|
let u = S(this, xe).shift();
|
|
10120
10120
|
V(this, le, pe).call(this, S(this, se), u);
|
|
@@ -10127,7 +10127,7 @@ var To = class extends yi {
|
|
|
10127
10127
|
finalize() {
|
|
10128
10128
|
if (S(this, Ze))
|
|
10129
10129
|
throw new Error("Cannot finalize a muxer more than once.");
|
|
10130
|
-
if (S(this,
|
|
10130
|
+
if (S(this, D).fastStart === "fragmented") {
|
|
10131
10131
|
for (let e of S(this, xe))
|
|
10132
10132
|
V(this, le, pe).call(this, S(this, se), e);
|
|
10133
10133
|
for (let e of S(this, ke))
|
|
@@ -10136,7 +10136,7 @@ var To = class extends yi {
|
|
|
10136
10136
|
} else
|
|
10137
10137
|
S(this, se) && V(this, Je, xt).call(this, S(this, se)), S(this, ee) && V(this, Je, xt).call(this, S(this, ee));
|
|
10138
10138
|
let a = [S(this, se), S(this, ee)].filter(Boolean);
|
|
10139
|
-
if (S(this,
|
|
10139
|
+
if (S(this, D).fastStart === "in-memory") {
|
|
10140
10140
|
let e;
|
|
10141
10141
|
for (let r = 0; r < 2; r++) {
|
|
10142
10142
|
let h = ht(a, S(this, ze)), l = S(this, L).measureBox(h);
|
|
@@ -10156,7 +10156,7 @@ var To = class extends yi {
|
|
|
10156
10156
|
for (let r of S(this, We))
|
|
10157
10157
|
for (let h of r.samples)
|
|
10158
10158
|
S(this, L).write(h.data), h.data = null;
|
|
10159
|
-
} else if (S(this,
|
|
10159
|
+
} else if (S(this, D).fastStart === "fragmented") {
|
|
10160
10160
|
let e = S(this, L).pos, s = go(a);
|
|
10161
10161
|
S(this, L).writeBox(s);
|
|
10162
10162
|
let r = S(this, L).pos - e;
|
|
@@ -10165,7 +10165,7 @@ var To = class extends yi {
|
|
|
10165
10165
|
let e = S(this, L).offsets.get(S(this, oe)), s = S(this, L).pos - e;
|
|
10166
10166
|
S(this, oe).size = s, S(this, oe).largeSize = s >= 2 ** 32, S(this, L).patchBox(S(this, oe));
|
|
10167
10167
|
let r = ht(a, S(this, ze));
|
|
10168
|
-
if (typeof S(this,
|
|
10168
|
+
if (typeof S(this, D).fastStart == "object") {
|
|
10169
10169
|
S(this, L).seek(S(this, Ct)), S(this, L).writeBox(r);
|
|
10170
10170
|
let h = e - S(this, L).pos;
|
|
10171
10171
|
S(this, L).writeBox(In(h));
|
|
@@ -10175,7 +10175,7 @@ var To = class extends yi {
|
|
|
10175
10175
|
V(this, Ge, rt).call(this), S(this, L).finalize(), te(this, Ze, !0);
|
|
10176
10176
|
}
|
|
10177
10177
|
};
|
|
10178
|
-
|
|
10178
|
+
D = /* @__PURE__ */ new WeakMap();
|
|
10179
10179
|
L = /* @__PURE__ */ new WeakMap();
|
|
10180
10180
|
Ct = /* @__PURE__ */ new WeakMap();
|
|
10181
10181
|
oe = /* @__PURE__ */ new WeakMap();
|
|
@@ -10245,12 +10245,12 @@ Ts = function(a) {
|
|
|
10245
10245
|
qt = /* @__PURE__ */ new WeakSet();
|
|
10246
10246
|
Es = function() {
|
|
10247
10247
|
if (S(this, L).writeBox(En({
|
|
10248
|
-
holdsAvc: S(this,
|
|
10249
|
-
fragmented: S(this,
|
|
10250
|
-
})), te(this, Ct, S(this, L).pos), S(this,
|
|
10248
|
+
holdsAvc: S(this, D).video?.codec === "avc",
|
|
10249
|
+
fragmented: S(this, D).fastStart === "fragmented"
|
|
10250
|
+
})), te(this, Ct, S(this, L).pos), S(this, D).fastStart === "in-memory")
|
|
10251
10251
|
te(this, oe, Vt(!1));
|
|
10252
|
-
else if (S(this,
|
|
10253
|
-
if (typeof S(this,
|
|
10252
|
+
else if (S(this, D).fastStart !== "fragmented") {
|
|
10253
|
+
if (typeof S(this, D).fastStart == "object") {
|
|
10254
10254
|
let a = V(this, wi, Is).call(this);
|
|
10255
10255
|
S(this, L).seek(S(this, L).pos + a);
|
|
10256
10256
|
}
|
|
@@ -10260,11 +10260,11 @@ Es = function() {
|
|
|
10260
10260
|
};
|
|
10261
10261
|
wi = /* @__PURE__ */ new WeakSet();
|
|
10262
10262
|
Is = function() {
|
|
10263
|
-
if (typeof S(this,
|
|
10263
|
+
if (typeof S(this, D).fastStart != "object")
|
|
10264
10264
|
return;
|
|
10265
10265
|
let a = 0, e = [
|
|
10266
|
-
S(this,
|
|
10267
|
-
S(this,
|
|
10266
|
+
S(this, D).fastStart.expectedVideoChunks,
|
|
10267
|
+
S(this, D).fastStart.expectedAudioChunks
|
|
10268
10268
|
];
|
|
10269
10269
|
for (let s of e)
|
|
10270
10270
|
s && (a += 8 * Math.ceil(2 / 3 * s), a += 4 * s, a += 12 * Math.ceil(2 / 3 * s), a += 4 * s, a += 8 * s);
|
|
@@ -10272,18 +10272,18 @@ Is = function() {
|
|
|
10272
10272
|
};
|
|
10273
10273
|
Kt = /* @__PURE__ */ new WeakSet();
|
|
10274
10274
|
As = function() {
|
|
10275
|
-
if (S(this,
|
|
10275
|
+
if (S(this, D).video && te(this, se, {
|
|
10276
10276
|
id: 1,
|
|
10277
10277
|
info: {
|
|
10278
10278
|
type: "video",
|
|
10279
|
-
codec: S(this,
|
|
10280
|
-
width: S(this,
|
|
10281
|
-
height: S(this,
|
|
10282
|
-
rotation: S(this,
|
|
10279
|
+
codec: S(this, D).video.codec,
|
|
10280
|
+
width: S(this, D).video.width,
|
|
10281
|
+
height: S(this, D).video.height,
|
|
10282
|
+
rotation: S(this, D).video.rotation ?? 0,
|
|
10283
10283
|
decoderConfig: null
|
|
10284
10284
|
},
|
|
10285
10285
|
// The fallback contains many common frame rates as factors
|
|
10286
|
-
timescale: S(this,
|
|
10286
|
+
timescale: S(this, D).video.frameRate ?? 57600,
|
|
10287
10287
|
samples: [],
|
|
10288
10288
|
finalizedChunks: [],
|
|
10289
10289
|
currentChunk: null,
|
|
@@ -10294,16 +10294,16 @@ As = function() {
|
|
|
10294
10294
|
lastTimescaleUnits: null,
|
|
10295
10295
|
lastSample: null,
|
|
10296
10296
|
compactlyCodedChunkTable: []
|
|
10297
|
-
}), S(this,
|
|
10298
|
-
id: S(this,
|
|
10297
|
+
}), S(this, D).audio && (te(this, ee, {
|
|
10298
|
+
id: S(this, D).video ? 2 : 1,
|
|
10299
10299
|
info: {
|
|
10300
10300
|
type: "audio",
|
|
10301
|
-
codec: S(this,
|
|
10302
|
-
numberOfChannels: S(this,
|
|
10303
|
-
sampleRate: S(this,
|
|
10301
|
+
codec: S(this, D).audio.codec,
|
|
10302
|
+
numberOfChannels: S(this, D).audio.numberOfChannels,
|
|
10303
|
+
sampleRate: S(this, D).audio.sampleRate,
|
|
10304
10304
|
decoderConfig: null
|
|
10305
10305
|
},
|
|
10306
|
-
timescale: S(this,
|
|
10306
|
+
timescale: S(this, D).audio.sampleRate,
|
|
10307
10307
|
samples: [],
|
|
10308
10308
|
finalizedChunks: [],
|
|
10309
10309
|
currentChunk: null,
|
|
@@ -10314,19 +10314,19 @@ As = function() {
|
|
|
10314
10314
|
lastTimescaleUnits: null,
|
|
10315
10315
|
lastSample: null,
|
|
10316
10316
|
compactlyCodedChunkTable: []
|
|
10317
|
-
}), S(this,
|
|
10317
|
+
}), S(this, D).audio.codec === "aac")) {
|
|
10318
10318
|
let a = V(this, vi, Ps).call(
|
|
10319
10319
|
this,
|
|
10320
10320
|
2,
|
|
10321
10321
|
// Object type for AAC-LC, since it's the most common
|
|
10322
|
-
S(this,
|
|
10323
|
-
S(this,
|
|
10322
|
+
S(this, D).audio.sampleRate,
|
|
10323
|
+
S(this, D).audio.numberOfChannels
|
|
10324
10324
|
);
|
|
10325
10325
|
S(this, ee).info.decoderConfig = {
|
|
10326
|
-
codec: S(this,
|
|
10326
|
+
codec: S(this, D).audio.codec,
|
|
10327
10327
|
description: a,
|
|
10328
|
-
numberOfChannels: S(this,
|
|
10329
|
-
sampleRate: S(this,
|
|
10328
|
+
numberOfChannels: S(this, D).audio.numberOfChannels,
|
|
10329
|
+
sampleRate: S(this, D).audio.sampleRate
|
|
10330
10330
|
};
|
|
10331
10331
|
}
|
|
10332
10332
|
};
|
|
@@ -10357,11 +10357,11 @@ Qt = function(a, e, s, r, h, l, u) {
|
|
|
10357
10357
|
};
|
|
10358
10358
|
le = /* @__PURE__ */ new WeakSet();
|
|
10359
10359
|
pe = function(a, e) {
|
|
10360
|
-
S(this,
|
|
10360
|
+
S(this, D).fastStart !== "fragmented" && a.samples.push(e);
|
|
10361
10361
|
const s = ue(e.presentationTimestamp - e.decodeTimestamp, a.timescale);
|
|
10362
10362
|
if (a.lastTimescaleUnits !== null) {
|
|
10363
10363
|
let h = ue(e.decodeTimestamp, a.timescale, !1), l = Math.round(h - a.lastTimescaleUnits);
|
|
10364
|
-
if (a.lastTimescaleUnits += l, a.lastSample.timescaleUnitsToNextSample = l, S(this,
|
|
10364
|
+
if (a.lastTimescaleUnits += l, a.lastSample.timescaleUnitsToNextSample = l, S(this, D).fastStart !== "fragmented") {
|
|
10365
10365
|
let u = vt(a.timeToSampleTable);
|
|
10366
10366
|
u.sampleCount === 1 ? (u.sampleDelta = l, u.sampleCount++) : u.sampleDelta === l ? u.sampleCount++ : (u.sampleCount--, a.timeToSampleTable.push({
|
|
10367
10367
|
sampleCount: 2,
|
|
@@ -10374,7 +10374,7 @@ pe = function(a, e) {
|
|
|
10374
10374
|
});
|
|
10375
10375
|
}
|
|
10376
10376
|
} else
|
|
10377
|
-
a.lastTimescaleUnits = 0, S(this,
|
|
10377
|
+
a.lastTimescaleUnits = 0, S(this, D).fastStart !== "fragmented" && (a.timeToSampleTable.push({
|
|
10378
10378
|
sampleCount: 1,
|
|
10379
10379
|
sampleDelta: ue(e.duration, a.timescale)
|
|
10380
10380
|
}), a.compositionTimeOffsetTable.push({
|
|
@@ -10387,9 +10387,9 @@ pe = function(a, e) {
|
|
|
10387
10387
|
r = !0;
|
|
10388
10388
|
else {
|
|
10389
10389
|
let h = e.presentationTimestamp - a.currentChunk.startTimestamp;
|
|
10390
|
-
if (S(this,
|
|
10390
|
+
if (S(this, D).fastStart === "fragmented") {
|
|
10391
10391
|
let l = S(this, se) ?? S(this, ee);
|
|
10392
|
-
const u = S(this,
|
|
10392
|
+
const u = S(this, D).minFragmentDuration ?? 1;
|
|
10393
10393
|
a === l && e.type === "key" && h >= u && (r = !0, V(this, kt, Si).call(this));
|
|
10394
10394
|
} else
|
|
10395
10395
|
r = h >= 0.5;
|
|
@@ -10401,7 +10401,7 @@ pe = function(a, e) {
|
|
|
10401
10401
|
};
|
|
10402
10402
|
bi = /* @__PURE__ */ new WeakSet();
|
|
10403
10403
|
Bs = function(a, e, s) {
|
|
10404
|
-
const r = S(this,
|
|
10404
|
+
const r = S(this, D).firstTimestampBehavior === "strict", h = s.lastDecodeTimestamp === -1;
|
|
10405
10405
|
if (r && h && e !== 0)
|
|
10406
10406
|
throw new Error(
|
|
10407
10407
|
`The first chunk for your media track must have a timestamp of 0 (received DTS=${e}).Non-zero first timestamps are often caused by directly piping frames or audio data from a MediaStreamTrack into the encoder. Their timestamps are typically relative to the age of thedocument, which is probably what you want.
|
|
@@ -10409,10 +10409,10 @@ Bs = function(a, e, s) {
|
|
|
10409
10409
|
If you want to offset all timestamps of a track such that the first one is zero, set firstTimestampBehavior: 'offset' in the options.
|
|
10410
10410
|
`
|
|
10411
10411
|
);
|
|
10412
|
-
if (S(this,
|
|
10412
|
+
if (S(this, D).firstTimestampBehavior === "offset" || S(this, D).firstTimestampBehavior === "cross-track-offset") {
|
|
10413
10413
|
s.firstDecodeTimestamp === void 0 && (s.firstDecodeTimestamp = e);
|
|
10414
10414
|
let u;
|
|
10415
|
-
S(this,
|
|
10415
|
+
S(this, D).firstTimestampBehavior === "offset" ? u = s.firstDecodeTimestamp : u = Math.min(
|
|
10416
10416
|
S(this, se)?.firstDecodeTimestamp ?? 1 / 0,
|
|
10417
10417
|
S(this, ee)?.firstDecodeTimestamp ?? 1 / 0
|
|
10418
10418
|
), e -= u, a -= u;
|
|
@@ -10425,14 +10425,14 @@ If you want to offset all timestamps of a track such that the first one is zero,
|
|
|
10425
10425
|
};
|
|
10426
10426
|
Je = /* @__PURE__ */ new WeakSet();
|
|
10427
10427
|
xt = function(a) {
|
|
10428
|
-
if (S(this,
|
|
10428
|
+
if (S(this, D).fastStart === "fragmented")
|
|
10429
10429
|
throw new Error("Can't finalize individual chunks if 'fastStart' is set to 'fragmented'.");
|
|
10430
10430
|
if (a.currentChunk) {
|
|
10431
10431
|
if (a.finalizedChunks.push(a.currentChunk), S(this, We).push(a.currentChunk), (a.compactlyCodedChunkTable.length === 0 || vt(a.compactlyCodedChunkTable).samplesPerChunk !== a.currentChunk.samples.length) && a.compactlyCodedChunkTable.push({
|
|
10432
10432
|
firstChunk: a.finalizedChunks.length,
|
|
10433
10433
|
// 1-indexed
|
|
10434
10434
|
samplesPerChunk: a.currentChunk.samples.length
|
|
10435
|
-
}), S(this,
|
|
10435
|
+
}), S(this, D).fastStart === "in-memory") {
|
|
10436
10436
|
a.currentChunk.offset = 0;
|
|
10437
10437
|
return;
|
|
10438
10438
|
}
|
|
@@ -10444,7 +10444,7 @@ xt = function(a) {
|
|
|
10444
10444
|
};
|
|
10445
10445
|
kt = /* @__PURE__ */ new WeakSet();
|
|
10446
10446
|
Si = function(a = !0) {
|
|
10447
|
-
if (S(this,
|
|
10447
|
+
if (S(this, D).fastStart !== "fragmented")
|
|
10448
10448
|
throw new Error("Can't finalize a fragment unless 'fastStart' is set to 'fragmented'.");
|
|
10449
10449
|
let e = [S(this, se), S(this, ee)].filter((o) => o && o.currentChunk);
|
|
10450
10450
|
if (e.length === 0)
|
|
@@ -10626,11 +10626,11 @@ async function Lo(a, e, s, r = {}) {
|
|
|
10626
10626
|
let p = 0, m = null, g = null;
|
|
10627
10627
|
return await new Promise((w, x) => {
|
|
10628
10628
|
let C = !1, v = null;
|
|
10629
|
-
const
|
|
10629
|
+
const T = () => {
|
|
10630
10630
|
v !== null && (clearTimeout(v), v = null);
|
|
10631
10631
|
}, t = (d, f) => {
|
|
10632
10632
|
if (C) return;
|
|
10633
|
-
C = !0,
|
|
10633
|
+
C = !0, T();
|
|
10634
10634
|
const y = {
|
|
10635
10635
|
inputChunks: a.length,
|
|
10636
10636
|
outputFrames: p,
|
|
@@ -10725,7 +10725,7 @@ async function Fi(a, e, s = {}) {
|
|
|
10725
10725
|
let m = !1, g = null, w = null;
|
|
10726
10726
|
const x = () => {
|
|
10727
10727
|
g !== null && (clearInterval(g), g = null), w !== null && (clearTimeout(w), w = null);
|
|
10728
|
-
}, C = (
|
|
10728
|
+
}, C = (T, t) => {
|
|
10729
10729
|
if (m) return;
|
|
10730
10730
|
m = !0, x();
|
|
10731
10731
|
const n = {
|
|
@@ -10733,13 +10733,13 @@ async function Fi(a, e, s = {}) {
|
|
|
10733
10733
|
outputFrames: u.length,
|
|
10734
10734
|
durationMs: performance.now() - l
|
|
10735
10735
|
};
|
|
10736
|
-
|
|
10736
|
+
T && u.length > 0 ? o({ frames: u, stats: n }) : p(new Error(t || "Decode failed"));
|
|
10737
10737
|
}, v = new VideoDecoder({
|
|
10738
|
-
output: (
|
|
10739
|
-
u.push(
|
|
10738
|
+
output: (T) => {
|
|
10739
|
+
u.push(T);
|
|
10740
10740
|
},
|
|
10741
|
-
error: (
|
|
10742
|
-
C(!1,
|
|
10741
|
+
error: (T) => {
|
|
10742
|
+
C(!1, T.message);
|
|
10743
10743
|
}
|
|
10744
10744
|
});
|
|
10745
10745
|
v.configure({
|
|
@@ -10750,8 +10750,8 @@ async function Fi(a, e, s = {}) {
|
|
|
10750
10750
|
optimizeForLatency: !0,
|
|
10751
10751
|
...e.description && { description: e.description }
|
|
10752
10752
|
});
|
|
10753
|
-
for (const
|
|
10754
|
-
v.decode(
|
|
10753
|
+
for (const T of a)
|
|
10754
|
+
v.decode(T);
|
|
10755
10755
|
v.flush().catch(() => {
|
|
10756
10756
|
}), g = setInterval(() => {
|
|
10757
10757
|
v.decodeQueueSize === 0 && u.length > 0 && (v.close(), C(!0));
|
|
@@ -10930,7 +10930,7 @@ class Ve {
|
|
|
10930
10930
|
p
|
|
10931
10931
|
);
|
|
10932
10932
|
if (x.length === 0) return;
|
|
10933
|
-
const C = this.cacheManager.isExporting ? 15e3 : 2e3, { before: v, after:
|
|
10933
|
+
const C = this.cacheManager.isExporting ? 15e3 : 2e3, { before: v, after: T } = await Lo(
|
|
10934
10934
|
x,
|
|
10935
10935
|
{
|
|
10936
10936
|
codec: r.codec,
|
|
@@ -10946,10 +10946,10 @@ class Ve {
|
|
|
10946
10946
|
}
|
|
10947
10947
|
);
|
|
10948
10948
|
if (this.aborted) {
|
|
10949
|
-
v?.close(),
|
|
10949
|
+
v?.close(), T?.close();
|
|
10950
10950
|
return;
|
|
10951
10951
|
}
|
|
10952
|
-
for (const t of [v,
|
|
10952
|
+
for (const t of [v, T])
|
|
10953
10953
|
if (t)
|
|
10954
10954
|
try {
|
|
10955
10955
|
this.cacheFrame(t);
|
|
@@ -11032,11 +11032,11 @@ class Ve {
|
|
|
11032
11032
|
});
|
|
11033
11033
|
continue;
|
|
11034
11034
|
}
|
|
11035
|
-
const
|
|
11035
|
+
const T = o.slice(v, v + C.byteLength), t = new EncodedVideoChunk({
|
|
11036
11036
|
type: C.isKeyframe ? "key" : "delta",
|
|
11037
11037
|
timestamp: C.timestamp,
|
|
11038
11038
|
duration: C.duration,
|
|
11039
|
-
data:
|
|
11039
|
+
data: T
|
|
11040
11040
|
});
|
|
11041
11041
|
u.push(t);
|
|
11042
11042
|
}
|
|
@@ -11114,8 +11114,8 @@ class Ve {
|
|
|
11114
11114
|
);
|
|
11115
11115
|
let g = 1 / 0, w = 0;
|
|
11116
11116
|
for (const v of m) {
|
|
11117
|
-
const
|
|
11118
|
-
|
|
11117
|
+
const T = h.samples[v.keyframeSampleIndex], t = v.keyframeSampleIndex + v.sampleCount - 1, n = h.samples[t];
|
|
11118
|
+
T && n && (g = Math.min(g, T.byteOffset), w = Math.max(w, n.byteOffset + n.byteLength));
|
|
11119
11119
|
}
|
|
11120
11120
|
const x = await this.readResourceRangeWithRecovery(g, w);
|
|
11121
11121
|
if (this.aborted) {
|
|
@@ -11439,7 +11439,7 @@ class zo {
|
|
|
11439
11439
|
if (p?.isPaused())
|
|
11440
11440
|
for (; p.isPaused(); ) {
|
|
11441
11441
|
if (o?.aborted) throw new DOMException("Export aborted", "AbortError");
|
|
11442
|
-
await new Promise((
|
|
11442
|
+
await new Promise((T) => setTimeout(T, 100));
|
|
11443
11443
|
}
|
|
11444
11444
|
}, x = s.width || e.renderConfig?.width || 720, C = s.height || e.renderConfig?.height || 1280, v = s.fps || e.fps || 30;
|
|
11445
11445
|
l.emit(z.ExportStart, {
|
|
@@ -11451,8 +11451,8 @@ class zo {
|
|
|
11451
11451
|
}), this.deps.cacheManager.beginExport();
|
|
11452
11452
|
try {
|
|
11453
11453
|
await this.preloadResources(e, u, l, w);
|
|
11454
|
-
const
|
|
11455
|
-
hasAudioSamples:
|
|
11454
|
+
const T = this.deps.cacheManager.audioSampleCache.getTotalBytes() > 0, { enableAudio: t, disabledReason: n } = await this.decideAudioStrategy({
|
|
11455
|
+
hasAudioSamples: T,
|
|
11456
11456
|
requestedFormat: s.format ?? "mp4",
|
|
11457
11457
|
requestedAudioCodec: s.audioCodec ?? "aac"
|
|
11458
11458
|
});
|
|
@@ -11500,11 +11500,11 @@ class zo {
|
|
|
11500
11500
|
progress: 1,
|
|
11501
11501
|
stage: "muxing"
|
|
11502
11502
|
}), d;
|
|
11503
|
-
} catch (
|
|
11503
|
+
} catch (T) {
|
|
11504
11504
|
throw l.emit(z.ExportError, {
|
|
11505
|
-
error:
|
|
11505
|
+
error: T instanceof Error ? T : new Error(String(T)),
|
|
11506
11506
|
stage: "export"
|
|
11507
|
-
}),
|
|
11507
|
+
}), T;
|
|
11508
11508
|
} finally {
|
|
11509
11509
|
this.deps.cacheManager.endExport();
|
|
11510
11510
|
}
|
|
@@ -11570,8 +11570,8 @@ class zo {
|
|
|
11570
11570
|
await h();
|
|
11571
11571
|
const g = `${p.id}-export`;
|
|
11572
11572
|
let w, x;
|
|
11573
|
-
const C = new Promise((
|
|
11574
|
-
w =
|
|
11573
|
+
const C = new Promise((T, t) => {
|
|
11574
|
+
w = T, x = t;
|
|
11575
11575
|
}), v = await Ci.create({
|
|
11576
11576
|
clipId: p.id,
|
|
11577
11577
|
sessionId: g,
|
|
@@ -11582,29 +11582,29 @@ class zo {
|
|
|
11582
11582
|
workerConfigs: this.deps.workerConfigsProvider(),
|
|
11583
11583
|
resourceLoader: this.deps.resourceLoader,
|
|
11584
11584
|
callbacks: {
|
|
11585
|
-
onEncodedStreamReady: async (
|
|
11585
|
+
onEncodedStreamReady: async (T, t) => {
|
|
11586
11586
|
if (t === "video") {
|
|
11587
|
-
const n =
|
|
11587
|
+
const n = T.getReader();
|
|
11588
11588
|
try {
|
|
11589
11589
|
for (; ; ) {
|
|
11590
11590
|
await h();
|
|
11591
11591
|
const { done: c, value: d } = await n.read();
|
|
11592
11592
|
if (c) break;
|
|
11593
11593
|
if (d) {
|
|
11594
|
-
const f = d.chunk, y = d.metadata, _ = f.duration ?? 33333,
|
|
11595
|
-
f.copyTo(
|
|
11596
|
-
const
|
|
11594
|
+
const f = d.chunk, y = d.metadata, _ = f.duration ?? 33333, k = f.timestamp + m, b = new ArrayBuffer(f.byteLength);
|
|
11595
|
+
f.copyTo(b);
|
|
11596
|
+
const U = new EncodedVideoChunk({
|
|
11597
11597
|
type: f.type,
|
|
11598
|
-
timestamp:
|
|
11598
|
+
timestamp: k,
|
|
11599
11599
|
duration: _,
|
|
11600
|
-
data:
|
|
11600
|
+
data: b
|
|
11601
11601
|
});
|
|
11602
|
-
s.writeVideoChunk(
|
|
11603
|
-
const I = 0.4 +
|
|
11602
|
+
s.writeVideoChunk(U, y), u = k + _;
|
|
11603
|
+
const I = 0.4 + k / r.durationUs * 0.6;
|
|
11604
11604
|
this.deps.eventBus.emit(z.ExportProgress, {
|
|
11605
11605
|
progress: Math.min(1, I),
|
|
11606
11606
|
stage: "encoding",
|
|
11607
|
-
timeUs:
|
|
11607
|
+
timeUs: k
|
|
11608
11608
|
});
|
|
11609
11609
|
}
|
|
11610
11610
|
}
|
|
@@ -11816,14 +11816,14 @@ class Oo {
|
|
|
11816
11816
|
}), null;
|
|
11817
11817
|
try {
|
|
11818
11818
|
await this.resourceLoader.load(l, x);
|
|
11819
|
-
} catch (
|
|
11820
|
-
if (tt(
|
|
11819
|
+
} catch (T) {
|
|
11820
|
+
if (tt(T))
|
|
11821
11821
|
return console.warn("[Orchestrator] Resource not decodable, returning null frame:", {
|
|
11822
11822
|
clipId: e.id,
|
|
11823
11823
|
resourceId: l,
|
|
11824
|
-
error: { name:
|
|
11824
|
+
error: { name: T.name, message: T.message }
|
|
11825
11825
|
}), null;
|
|
11826
|
-
throw
|
|
11826
|
+
throw T;
|
|
11827
11827
|
}
|
|
11828
11828
|
if (this.modelToken !== o || this.compositionModel !== p)
|
|
11829
11829
|
return console.warn("[Orchestrator] Model switched during decodeFromResource:", {
|
|
@@ -11851,13 +11851,13 @@ class Oo {
|
|
|
11851
11851
|
try {
|
|
11852
11852
|
if (h?.scrub)
|
|
11853
11853
|
return await v.decodeScrub(s), this.cacheManager.getFrame(s, e.id);
|
|
11854
|
-
const
|
|
11854
|
+
const T = 3e6, t = s, n = Math.min(
|
|
11855
11855
|
u + e.durationUs,
|
|
11856
|
-
s +
|
|
11856
|
+
s + T
|
|
11857
11857
|
);
|
|
11858
11858
|
return await v.decodeWindow(t, n), this.cacheManager.getFrame(s, e.id);
|
|
11859
|
-
} catch (
|
|
11860
|
-
return v.isDisposed || console.error("[Orchestrator] Error composing from resource:",
|
|
11859
|
+
} catch (T) {
|
|
11860
|
+
return v.isDisposed || console.error("[Orchestrator] Error composing from resource:", T), null;
|
|
11861
11861
|
} finally {
|
|
11862
11862
|
this.activeOnDemandSession === v && (this.activeOnDemandSession = null), await v.dispose();
|
|
11863
11863
|
}
|
|
@@ -12067,13 +12067,13 @@ class Oo {
|
|
|
12067
12067
|
const { position: w, keyframes: x, overlayClipStartUs: C } = u.animation, v = h - C;
|
|
12068
12068
|
if (v < 0 || v > x[x.length - 1].time)
|
|
12069
12069
|
return null;
|
|
12070
|
-
const
|
|
12070
|
+
const T = 0;
|
|
12071
12071
|
m.transform = {
|
|
12072
12072
|
x: w.x,
|
|
12073
12073
|
y: w.y,
|
|
12074
12074
|
scaleX: 1,
|
|
12075
12075
|
scaleY: 1,
|
|
12076
|
-
rotation:
|
|
12076
|
+
rotation: T,
|
|
12077
12077
|
anchorX: 0.5,
|
|
12078
12078
|
anchorY: 0.5
|
|
12079
12079
|
};
|
|
@@ -12148,12 +12148,12 @@ function Rs(a, e, s, r, h, l, u, o, p, m) {
|
|
|
12148
12148
|
if (r === 1) {
|
|
12149
12149
|
const C = e.slice(s).trim();
|
|
12150
12150
|
if (ie(a, C, u, o, p) <= l) {
|
|
12151
|
-
const
|
|
12152
|
-
t < w && (w = t, g =
|
|
12151
|
+
const T = [...h, C], t = Di(T, a, u, o, p);
|
|
12152
|
+
t < w && (w = t, g = T);
|
|
12153
12153
|
} else {
|
|
12154
|
-
const
|
|
12154
|
+
const T = C.split(/\s+/);
|
|
12155
12155
|
let t = "", n = [...h];
|
|
12156
|
-
for (const d of
|
|
12156
|
+
for (const d of T) {
|
|
12157
12157
|
const f = t ? `${t} ${d}` : d;
|
|
12158
12158
|
ie(a, f, u, o, p) <= l ? t = f : t ? (n.push(t), t = d) : (n.push(d), t = "");
|
|
12159
12159
|
}
|
|
@@ -12167,15 +12167,15 @@ function Rs(a, e, s, r, h, l, u, o, p, m) {
|
|
|
12167
12167
|
for (let C = 0; C < m.length; C++) {
|
|
12168
12168
|
const v = m[C];
|
|
12169
12169
|
if (v <= s || v >= e.length) continue;
|
|
12170
|
-
const
|
|
12171
|
-
if (ie(a,
|
|
12170
|
+
const T = e.slice(s, v).trim();
|
|
12171
|
+
if (ie(a, T, u, o, p) <= l) {
|
|
12172
12172
|
x = !0;
|
|
12173
12173
|
const n = Rs(
|
|
12174
12174
|
a,
|
|
12175
12175
|
e,
|
|
12176
12176
|
v,
|
|
12177
12177
|
r - 1,
|
|
12178
|
-
[...h,
|
|
12178
|
+
[...h, T],
|
|
12179
12179
|
l,
|
|
12180
12180
|
u,
|
|
12181
12181
|
o,
|
|
@@ -12187,12 +12187,12 @@ function Rs(a, e, s, r, h, l, u, o, p, m) {
|
|
|
12187
12187
|
}
|
|
12188
12188
|
if (!x) {
|
|
12189
12189
|
const v = e.slice(s).split(/\s+/);
|
|
12190
|
-
let
|
|
12190
|
+
let T = "", t = [...h];
|
|
12191
12191
|
for (const n of v) {
|
|
12192
|
-
const c =
|
|
12193
|
-
ie(a, c, u, o, p) <= l ?
|
|
12192
|
+
const c = T ? `${T} ${n}` : n;
|
|
12193
|
+
ie(a, c, u, o, p) <= l ? T = c : T ? (t.push(T), T = n) : t.push(n);
|
|
12194
12194
|
}
|
|
12195
|
-
|
|
12195
|
+
T && t.push(T), g = t;
|
|
12196
12196
|
}
|
|
12197
12197
|
return { bestLines: g, bestBalance: w };
|
|
12198
12198
|
}
|
|
@@ -12258,8 +12258,8 @@ function xi(a, e, s, r, h, l, u = 400) {
|
|
|
12258
12258
|
const n = ie(a, t, r, l, u);
|
|
12259
12259
|
n < C && (C = n), n > v && (v = n);
|
|
12260
12260
|
}
|
|
12261
|
-
const
|
|
12262
|
-
|
|
12261
|
+
const T = v - C;
|
|
12262
|
+
T < m && (m = T, g = w);
|
|
12263
12263
|
}
|
|
12264
12264
|
return Dt(a, e, g, r, h, l, u);
|
|
12265
12265
|
}
|
|
@@ -12331,10 +12331,10 @@ function Jt(a, e, s, r, h) {
|
|
|
12331
12331
|
const l = e.fontConfig?.textStyle;
|
|
12332
12332
|
if (!l) return;
|
|
12333
12333
|
const u = l.fontSize, o = l.fontFamily, p = l.fontWeight, m = l.fill, g = l.stroke, w = l.strokeWidth || 0, x = l.lineHeight || 1.2, C = s * 0.64, v = Pt(e.text, e.letterCase);
|
|
12334
|
-
let
|
|
12334
|
+
let T;
|
|
12335
12335
|
if (e.wordTimings && e.wordTimings.length > 0) {
|
|
12336
12336
|
const c = Bt(e.localeCode || "en-US", v), d = v.split(c ? /\s+/ : "");
|
|
12337
|
-
|
|
12337
|
+
T = xi(
|
|
12338
12338
|
a,
|
|
12339
12339
|
d,
|
|
12340
12340
|
C,
|
|
@@ -12344,11 +12344,11 @@ function Jt(a, e, s, r, h) {
|
|
|
12344
12344
|
p
|
|
12345
12345
|
);
|
|
12346
12346
|
} else
|
|
12347
|
-
|
|
12347
|
+
T = Fs(a, v, C, u, o, p);
|
|
12348
12348
|
a.save(), a.font = `${p} ${u}px ${o}`, a.textAlign = "center", a.textBaseline = "middle", a.lineJoin = "round", a.lineCap = "round";
|
|
12349
|
-
const t =
|
|
12350
|
-
for (let c = 0; c <
|
|
12351
|
-
const d =
|
|
12349
|
+
const t = T.length * u * x, n = Vo(r, t, e.fontConfig?.globalPosition);
|
|
12350
|
+
for (let c = 0; c < T.length; c++) {
|
|
12351
|
+
const d = T[c], f = n + c * u * x + u / 2;
|
|
12352
12352
|
g && w > 0 && (a.strokeStyle = g, a.lineWidth = w, a.strokeText(d, s / 2, f)), a.fillStyle = m, a.fillText(d, s / 2, f);
|
|
12353
12353
|
}
|
|
12354
12354
|
a.restore();
|
|
@@ -12381,7 +12381,7 @@ function Go(a, e, s) {
|
|
|
12381
12381
|
function $o(a, e, s, r, h, l = 30) {
|
|
12382
12382
|
const u = e.fontConfig?.textStyle;
|
|
12383
12383
|
if (!u) return;
|
|
12384
|
-
const o = u.fontSize, p = u.fontFamily, m = u.fontWeight, g = u.fill, w = u.stroke, x = u.strokeWidth || 0, C = u.lineHeight || 1.2, v = e.animation?.highlightTextStyle?.fill || "rgb(255, 215, 0)",
|
|
12384
|
+
const o = u.fontSize, p = u.fontFamily, m = u.fontWeight, g = u.fill, w = u.stroke, x = u.strokeWidth || 0, C = u.lineHeight || 1.2, v = e.animation?.highlightTextStyle?.fill || "rgb(255, 215, 0)", T = e.animation?.highlightTextStyle?.stroke || w, t = s * 0.64, n = Pt(e.text, e.letterCase), c = Bt(e.localeCode || "en-US", n), d = n.split(c ? /\s+/ : ""), f = xi(
|
|
12385
12385
|
a,
|
|
12386
12386
|
d,
|
|
12387
12387
|
t,
|
|
@@ -12391,32 +12391,32 @@ function $o(a, e, s, r, h, l = 30) {
|
|
|
12391
12391
|
m
|
|
12392
12392
|
), y = [];
|
|
12393
12393
|
let _ = 0;
|
|
12394
|
-
const
|
|
12395
|
-
for (let
|
|
12396
|
-
const E = f[
|
|
12397
|
-
let
|
|
12398
|
-
for (const
|
|
12399
|
-
const
|
|
12400
|
-
startFrame: zi(
|
|
12401
|
-
endFrame: zi(
|
|
12394
|
+
const k = f.length * o * C, b = Go(r, k, e.fontConfig?.globalPosition);
|
|
12395
|
+
for (let U = 0; U < f.length; U++) {
|
|
12396
|
+
const E = f[U], I = E.split(c ? /\s+/ : ""), B = b + U * o * C + o / 2, A = ie(a, E, o, p, m);
|
|
12397
|
+
let R = s / 2 - A / 2;
|
|
12398
|
+
for (const F of I) {
|
|
12399
|
+
const G = ie(a, F, o, p, m), q = e.wordTimings?.[_], X = q ? {
|
|
12400
|
+
startFrame: zi(q.startUs, l),
|
|
12401
|
+
endFrame: zi(q.endUs, l)
|
|
12402
12402
|
} : void 0;
|
|
12403
12403
|
y.push({
|
|
12404
|
-
text:
|
|
12405
|
-
x:
|
|
12404
|
+
text: F,
|
|
12405
|
+
x: R + G / 2,
|
|
12406
12406
|
y: B,
|
|
12407
|
-
lineIndex:
|
|
12407
|
+
lineIndex: U,
|
|
12408
12408
|
wordIndex: _,
|
|
12409
12409
|
timing: X
|
|
12410
|
-
}),
|
|
12410
|
+
}), R += G + (c ? ie(a, " ", o, p, m) : 0), _++;
|
|
12411
12411
|
}
|
|
12412
12412
|
}
|
|
12413
12413
|
a.save(), a.font = `${m} ${o}px ${p}`, a.textAlign = "center", a.textBaseline = "middle", a.lineJoin = "round", a.lineCap = "round";
|
|
12414
|
-
for (const
|
|
12414
|
+
for (const U of y) {
|
|
12415
12415
|
let E = g, I = w;
|
|
12416
|
-
if (
|
|
12417
|
-
const { startFrame: B, endFrame: A } =
|
|
12416
|
+
if (U.timing) {
|
|
12417
|
+
const { startFrame: B, endFrame: A } = U.timing;
|
|
12418
12418
|
if (h >= B && h <= A) {
|
|
12419
|
-
const
|
|
12419
|
+
const R = we(
|
|
12420
12420
|
h,
|
|
12421
12421
|
[B, B + 3],
|
|
12422
12422
|
[0, 1],
|
|
@@ -12425,16 +12425,16 @@ function $o(a, e, s, r, h, l = 30) {
|
|
|
12425
12425
|
extrapolateRight: "clamp"
|
|
12426
12426
|
}
|
|
12427
12427
|
);
|
|
12428
|
-
E = ct(g, v,
|
|
12428
|
+
E = ct(g, v, R), w && T && (I = ct(w, T, R));
|
|
12429
12429
|
} else if (h > A) {
|
|
12430
|
-
const
|
|
12430
|
+
const R = we(h, [A, A + 3], [1, 0], {
|
|
12431
12431
|
extrapolateLeft: "clamp",
|
|
12432
12432
|
extrapolateRight: "clamp"
|
|
12433
12433
|
});
|
|
12434
|
-
E = ct(g, v,
|
|
12434
|
+
E = ct(g, v, R), w && T && (I = ct(w, T, R));
|
|
12435
12435
|
}
|
|
12436
12436
|
}
|
|
12437
|
-
I && x > 0 && (a.strokeStyle = I, a.lineWidth = x, a.strokeText(
|
|
12437
|
+
I && x > 0 && (a.strokeStyle = I, a.lineWidth = x, a.strokeText(U.text, U.x, U.y)), a.fillStyle = E, a.fillText(U.text, U.x, U.y);
|
|
12438
12438
|
}
|
|
12439
12439
|
a.restore();
|
|
12440
12440
|
}
|
|
@@ -12457,15 +12457,15 @@ function jo(a, e, s) {
|
|
|
12457
12457
|
function Yo(a, e, s, r, h, l = 30) {
|
|
12458
12458
|
const u = e.fontConfig?.textStyle;
|
|
12459
12459
|
if (!u) return;
|
|
12460
|
-
const o = u.fontSize, p = u.fontFamily, m = u.fontWeight, g = u.fill, w = u.stroke, x = u.strokeWidth || 0, C = u.lineHeight || 1.2, v = e.animation?.highlightTextStyle?.fill || "rgb(255, 215, 0)",
|
|
12460
|
+
const o = u.fontSize, p = u.fontFamily, m = u.fontWeight, g = u.fill, w = u.stroke, x = u.strokeWidth || 0, C = u.lineHeight || 1.2, v = e.animation?.highlightTextStyle?.fill || "rgb(255, 215, 0)", T = e.animation?.glowColor || "#ffffff", t = e.animation?.glowIntensity || 3, n = e.animation?.transitionFrames || 10, c = s * 0.9, d = Pt(e.text, e.letterCase), f = Bt(e.localeCode || "en-US", d), y = [];
|
|
12461
12461
|
if (e.wordTimings && e.wordTimings.length > 0) {
|
|
12462
12462
|
let I = 0;
|
|
12463
12463
|
for (let B = 0; B < e.wordTimings.length; B++) {
|
|
12464
|
-
const A = e.wordTimings[B],
|
|
12465
|
-
for (let X = 0; X <
|
|
12466
|
-
const J = Math.floor(
|
|
12464
|
+
const A = e.wordTimings[B], R = A.text.split(""), F = Oi(A.startUs, l), G = Oi(A.endUs, l), q = R.length > 0 ? (G - F) / R.length : 0;
|
|
12465
|
+
for (let X = 0; X < R.length; X++) {
|
|
12466
|
+
const J = Math.floor(F + X * q);
|
|
12467
12467
|
y.push({
|
|
12468
|
-
char:
|
|
12468
|
+
char: R[X],
|
|
12469
12469
|
index: I,
|
|
12470
12470
|
startFrame: J
|
|
12471
12471
|
}), I++;
|
|
@@ -12484,27 +12484,27 @@ function Yo(a, e, s, r, h, l = 30) {
|
|
|
12484
12484
|
}
|
|
12485
12485
|
} else {
|
|
12486
12486
|
const B = d.split(""), A = B.length > 0 ? 100 / B.length : 0;
|
|
12487
|
-
for (let
|
|
12487
|
+
for (let R = 0; R < B.length; R++)
|
|
12488
12488
|
y.push({
|
|
12489
|
-
char: B[
|
|
12490
|
-
index:
|
|
12491
|
-
startFrame: Math.floor(
|
|
12489
|
+
char: B[R],
|
|
12490
|
+
index: R,
|
|
12491
|
+
startFrame: Math.floor(R * A)
|
|
12492
12492
|
});
|
|
12493
12493
|
}
|
|
12494
|
-
const _ = y.map((I) => I.char).join(""),
|
|
12494
|
+
const _ = y.map((I) => I.char).join(""), k = Fs(a, _, c, o, p, m);
|
|
12495
12495
|
a.save(), a.font = `${m} ${o}px ${p}`, a.textAlign = "left", a.textBaseline = "middle", a.lineJoin = "round", a.lineCap = "round";
|
|
12496
|
-
const
|
|
12496
|
+
const b = k.length * o * C, U = jo(r, b, e.fontConfig?.globalPosition);
|
|
12497
12497
|
let E = 0;
|
|
12498
|
-
for (let I = 0; I <
|
|
12499
|
-
const B =
|
|
12500
|
-
let
|
|
12501
|
-
for (let
|
|
12502
|
-
const
|
|
12498
|
+
for (let I = 0; I < k.length; I++) {
|
|
12499
|
+
const B = k[I], A = U + I * o * C + o / 2, R = ie(a, B, o, p, m);
|
|
12500
|
+
let F = s / 2 - R / 2;
|
|
12501
|
+
for (let G = 0; G < B.length; G++) {
|
|
12502
|
+
const q = B[G], X = y[E];
|
|
12503
12503
|
if (X) {
|
|
12504
12504
|
const J = h >= X.startFrame, he = J && h < X.startFrame + n;
|
|
12505
|
-
a.fillStyle = J ? v : g, he ? (a.shadowColor =
|
|
12505
|
+
a.fillStyle = J ? v : g, he ? (a.shadowColor = T, a.shadowBlur = t * 10) : a.shadowBlur = 0, w && x > 0 && (a.strokeStyle = w, a.lineWidth = x, a.strokeText(q, F, A)), a.fillText(q, F, A), a.shadowBlur = 0;
|
|
12506
12506
|
}
|
|
12507
|
-
|
|
12507
|
+
F += ie(a, q, o, p, m), E++;
|
|
12508
12508
|
}
|
|
12509
12509
|
}
|
|
12510
12510
|
a.restore();
|
|
@@ -12528,59 +12528,59 @@ function qo(a, e, s) {
|
|
|
12528
12528
|
function Ko(a, e, s, r, h, l = 30) {
|
|
12529
12529
|
const u = e.fontConfig?.textStyle;
|
|
12530
12530
|
if (!u) return;
|
|
12531
|
-
const o = u.fontSize, p = u.fontFamily, m = u.fontWeight, g = u.fill, w = u.stroke, x = u.strokeWidth || 0, C = u.lineHeight || 1.2, v = e.animation?.highlightColor || "rgb(255, 215, 0)",
|
|
12531
|
+
const o = u.fontSize, p = u.fontFamily, m = u.fontWeight, g = u.fill, w = u.stroke, x = u.strokeWidth || 0, C = u.lineHeight || 1.2, v = e.animation?.highlightColor || "rgb(255, 215, 0)", T = s * 0.64, t = Pt(e.text, e.letterCase), n = Bt(e.localeCode || "en-US", t), c = t.split(n ? /\s+/ : ""), d = xi(
|
|
12532
12532
|
a,
|
|
12533
12533
|
c,
|
|
12534
|
-
|
|
12534
|
+
T,
|
|
12535
12535
|
o,
|
|
12536
12536
|
n,
|
|
12537
12537
|
p,
|
|
12538
12538
|
m
|
|
12539
12539
|
), f = [];
|
|
12540
12540
|
let y = 0;
|
|
12541
|
-
const _ = d.length * o * C,
|
|
12542
|
-
for (let
|
|
12543
|
-
const
|
|
12541
|
+
const _ = d.length * o * C, k = qo(r, _, e.fontConfig?.globalPosition);
|
|
12542
|
+
for (let b = 0; b < d.length; b++) {
|
|
12543
|
+
const U = d[b], E = U.split(n ? /\s+/ : ""), I = k + b * o * C + o / 2, B = ie(a, U, o, p, m);
|
|
12544
12544
|
let A = s / 2 - B / 2;
|
|
12545
|
-
for (const
|
|
12546
|
-
const
|
|
12547
|
-
startFrame: Ni(
|
|
12548
|
-
endFrame: Ni(
|
|
12545
|
+
for (const R of E) {
|
|
12546
|
+
const F = ie(a, R, o, p, m), G = e.wordTimings?.[y], q = G ? {
|
|
12547
|
+
startFrame: Ni(G.startUs, l),
|
|
12548
|
+
endFrame: Ni(G.endUs, l)
|
|
12549
12549
|
} : void 0;
|
|
12550
12550
|
f.push({
|
|
12551
|
-
text:
|
|
12552
|
-
x: A +
|
|
12551
|
+
text: R,
|
|
12552
|
+
x: A + F / 2,
|
|
12553
12553
|
y: I,
|
|
12554
|
-
width:
|
|
12555
|
-
lineIndex:
|
|
12554
|
+
width: F,
|
|
12555
|
+
lineIndex: b,
|
|
12556
12556
|
wordIndex: y,
|
|
12557
|
-
timing:
|
|
12558
|
-
}), A +=
|
|
12557
|
+
timing: q
|
|
12558
|
+
}), A += F + (n ? ie(a, " ", o, p, m) : 0), y++;
|
|
12559
12559
|
}
|
|
12560
12560
|
}
|
|
12561
12561
|
a.save(), a.font = `${m} ${o}px ${p}`, a.textAlign = "center", a.textBaseline = "middle", a.lineJoin = "round", a.lineCap = "round";
|
|
12562
|
-
for (const
|
|
12563
|
-
let
|
|
12564
|
-
if (
|
|
12565
|
-
const { startFrame: I, endFrame: B } =
|
|
12562
|
+
for (const b of f) {
|
|
12563
|
+
let U = 0, E = 0.8;
|
|
12564
|
+
if (b.timing) {
|
|
12565
|
+
const { startFrame: I, endFrame: B } = b.timing, A = 3;
|
|
12566
12566
|
if (h >= I && h <= B) {
|
|
12567
|
-
const
|
|
12567
|
+
const F = Ds(h - (I - A), {
|
|
12568
12568
|
damping: 6,
|
|
12569
12569
|
mass: 0.35,
|
|
12570
12570
|
stiffness: 200,
|
|
12571
12571
|
overshootClamping: !1
|
|
12572
12572
|
});
|
|
12573
|
-
|
|
12573
|
+
U = 0.9 * we(h, [I, I + 1], [0, 1], {
|
|
12574
12574
|
extrapolateLeft: "clamp",
|
|
12575
12575
|
extrapolateRight: "clamp"
|
|
12576
|
-
}), E = 0.8 +
|
|
12577
|
-
} else h > B && (
|
|
12578
|
-
if (
|
|
12579
|
-
const
|
|
12580
|
-
a.save(), a.globalAlpha =
|
|
12576
|
+
}), E = 0.8 + F * 0.45;
|
|
12577
|
+
} else h > B && (U = 0, E = 0.8);
|
|
12578
|
+
if (U > 0) {
|
|
12579
|
+
const G = (b.width + 16) * E, q = (o + 8) * E;
|
|
12580
|
+
a.save(), a.globalAlpha = U, a.fillStyle = v, a.beginPath(), a.roundRect(b.x - G / 2, b.y - q / 2, G, q, 8), a.fill(), a.restore();
|
|
12581
12581
|
}
|
|
12582
12582
|
}
|
|
12583
|
-
w && x > 0 && (a.strokeStyle = w, a.lineWidth = x, a.strokeText(
|
|
12583
|
+
w && x > 0 && (a.strokeStyle = w, a.lineWidth = x, a.strokeText(b.text, b.x, b.y)), a.fillStyle = g, a.fillText(b.text, b.x, b.y);
|
|
12584
12584
|
}
|
|
12585
12585
|
a.restore();
|
|
12586
12586
|
}
|
|
@@ -13100,8 +13100,8 @@ class Zo {
|
|
|
13100
13100
|
const n = Math.min(Math.max(m + t, 0), h - 1), c = (p * h + n) * 4;
|
|
13101
13101
|
g += u[c], w += u[c + 1], x += u[c + 2], C += u[c + 3], v++;
|
|
13102
13102
|
}
|
|
13103
|
-
const
|
|
13104
|
-
o[
|
|
13103
|
+
const T = (p * h + m) * 4;
|
|
13104
|
+
o[T] = g / v, o[T + 1] = w / v, o[T + 2] = x / v, o[T + 3] = C / v;
|
|
13105
13105
|
}
|
|
13106
13106
|
for (let p = 0; p < h; p++)
|
|
13107
13107
|
for (let m = 0; m < l; m++) {
|
|
@@ -13110,8 +13110,8 @@ class Zo {
|
|
|
13110
13110
|
const c = (Math.min(Math.max(m + t, 0), l - 1) * h + p) * 4;
|
|
13111
13111
|
g += o[c], w += o[c + 1], x += o[c + 2], C += o[c + 3], v++;
|
|
13112
13112
|
}
|
|
13113
|
-
const
|
|
13114
|
-
u[
|
|
13113
|
+
const T = (m * h + p) * 4;
|
|
13114
|
+
u[T] = g / v, u[T + 1] = w / v, u[T + 2] = x / v, u[T + 3] = C / v;
|
|
13115
13115
|
}
|
|
13116
13116
|
return e;
|
|
13117
13117
|
}
|
|
@@ -14212,146 +14212,147 @@ async function ra() {
|
|
|
14212
14212
|
const a = window.__MEFRAME_RUNNER_CONFIG__;
|
|
14213
14213
|
if (!a)
|
|
14214
14214
|
throw new Error("Missing __MEFRAME_RUNNER_CONFIG__");
|
|
14215
|
-
const { model: e, exportOptions: s, partSizeBytes: r, workerPath: h } = a;
|
|
14215
|
+
const { model: e, exportOptions: s, partSizeBytes: r, workerPath: h, fonts: l } = a;
|
|
14216
14216
|
if (typeof globalThis.VideoEncoder != "function")
|
|
14217
14217
|
throw new Error("WebCodecs VideoEncoder is not available in this browser context");
|
|
14218
14218
|
console.log("[meframe-runner] creating meframe...");
|
|
14219
|
-
const
|
|
14219
|
+
const u = (b) => {
|
|
14220
14220
|
if (b)
|
|
14221
14221
|
return b.replace(/\/+$/, "");
|
|
14222
|
-
},
|
|
14222
|
+
}, o = await ki.create({
|
|
14223
14223
|
global: {
|
|
14224
|
-
workerPath:
|
|
14224
|
+
workerPath: u(h),
|
|
14225
|
+
fonts: l ?? []
|
|
14225
14226
|
}
|
|
14226
14227
|
});
|
|
14227
|
-
console.log("[meframe-runner] setCompositionModel..."), await
|
|
14228
|
-
let
|
|
14229
|
-
const
|
|
14230
|
-
window.__serverAbort = () =>
|
|
14231
|
-
const
|
|
14232
|
-
setTimeout(
|
|
14233
|
-
}),
|
|
14234
|
-
let
|
|
14235
|
-
return
|
|
14236
|
-
},
|
|
14237
|
-
if (
|
|
14238
|
-
b.push({ start:
|
|
14239
|
-
let
|
|
14240
|
-
for (let
|
|
14241
|
-
const
|
|
14242
|
-
if (
|
|
14243
|
-
b[
|
|
14228
|
+
console.log("[meframe-runner] setCompositionModel..."), await o.setCompositionModel(e);
|
|
14229
|
+
let p = 0;
|
|
14230
|
+
const m = new AbortController();
|
|
14231
|
+
window.__serverAbort = () => m.abort();
|
|
14232
|
+
const g = (b) => new Promise((U) => {
|
|
14233
|
+
setTimeout(U, b);
|
|
14234
|
+
}), w = (b) => b === 429 || b >= 500 && b <= 599, x = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), v = (b) => {
|
|
14235
|
+
let U = x.get(b);
|
|
14236
|
+
return U || (U = { buf: new Uint8Array(r), ranges: [], uploaded: !1 }, x.set(b, U)), U;
|
|
14237
|
+
}, T = (b, U, E) => {
|
|
14238
|
+
if (E <= U) return;
|
|
14239
|
+
b.push({ start: U, end: E }), b.sort((B, A) => B.start - A.start);
|
|
14240
|
+
let I = 0;
|
|
14241
|
+
for (let B = 0; B < b.length; B++) {
|
|
14242
|
+
const A = b[B];
|
|
14243
|
+
if (I === 0) {
|
|
14244
|
+
b[I++] = A;
|
|
14244
14245
|
continue;
|
|
14245
14246
|
}
|
|
14246
|
-
const
|
|
14247
|
-
|
|
14247
|
+
const R = b[I - 1];
|
|
14248
|
+
A.start <= R.end ? R.end = Math.max(R.end, A.end) : b[I++] = A;
|
|
14248
14249
|
}
|
|
14249
|
-
b.length =
|
|
14250
|
-
},
|
|
14251
|
-
if (
|
|
14250
|
+
b.length = I;
|
|
14251
|
+
}, t = (b, U) => {
|
|
14252
|
+
if (U <= 0) return !0;
|
|
14252
14253
|
if (b.length === 0) return !1;
|
|
14253
|
-
let
|
|
14254
|
-
if (
|
|
14255
|
-
for (let
|
|
14256
|
-
const
|
|
14257
|
-
if (
|
|
14254
|
+
let E = b[0].start === 0 ? b[0].end : 0;
|
|
14255
|
+
if (E === 0) return !1;
|
|
14256
|
+
for (let I = 1; I < b.length && E < U; I++) {
|
|
14257
|
+
const B = b[I];
|
|
14258
|
+
if (B.start > E)
|
|
14258
14259
|
return !1;
|
|
14259
|
-
|
|
14260
|
+
E = Math.max(E, B.end);
|
|
14260
14261
|
}
|
|
14261
|
-
return
|
|
14262
|
-
},
|
|
14263
|
-
for (let
|
|
14264
|
-
if (
|
|
14262
|
+
return E >= U;
|
|
14263
|
+
}, n = async (b, U) => {
|
|
14264
|
+
for (let I = 1; I <= 4; I++) {
|
|
14265
|
+
if (m.signal.aborted)
|
|
14265
14266
|
throw new DOMException("Export aborted", "AbortError");
|
|
14266
|
-
const { url:
|
|
14267
|
+
const { url: B, headers: A } = await window.runnerRequestPartUrl(U), R = new Blob(b, { type: "application/octet-stream" });
|
|
14267
14268
|
try {
|
|
14268
|
-
const
|
|
14269
|
+
const F = await fetch(B, {
|
|
14269
14270
|
method: "PUT",
|
|
14270
|
-
body:
|
|
14271
|
-
headers:
|
|
14272
|
-
signal:
|
|
14271
|
+
body: R,
|
|
14272
|
+
headers: A ?? {},
|
|
14273
|
+
signal: m.signal
|
|
14273
14274
|
});
|
|
14274
|
-
if (!
|
|
14275
|
-
if (
|
|
14276
|
-
const
|
|
14277
|
-
await
|
|
14275
|
+
if (!F.ok) {
|
|
14276
|
+
if (I < 4 && w(F.status)) {
|
|
14277
|
+
const q = Math.min(8e3, 250 * 2 ** (I - 1));
|
|
14278
|
+
await g(q);
|
|
14278
14279
|
continue;
|
|
14279
14280
|
}
|
|
14280
|
-
throw new Error(`UploadPart failed: HTTP ${
|
|
14281
|
+
throw new Error(`UploadPart failed: HTTP ${F.status}`);
|
|
14281
14282
|
}
|
|
14282
|
-
const
|
|
14283
|
-
if (!
|
|
14283
|
+
const G = F.headers.get("etag") || F.headers.get("ETag");
|
|
14284
|
+
if (!G)
|
|
14284
14285
|
throw new Error("UploadPart missing ETag header");
|
|
14285
|
-
await window.runnerReportPartDone(
|
|
14286
|
+
await window.runnerReportPartDone(U, G);
|
|
14286
14287
|
return;
|
|
14287
|
-
} catch (
|
|
14288
|
-
if (
|
|
14289
|
-
throw
|
|
14290
|
-
if (
|
|
14291
|
-
const
|
|
14292
|
-
await
|
|
14288
|
+
} catch (F) {
|
|
14289
|
+
if (F instanceof DOMException && F.name === "AbortError")
|
|
14290
|
+
throw F;
|
|
14291
|
+
if (I < 4) {
|
|
14292
|
+
const G = Math.min(8e3, 250 * 2 ** (I - 1));
|
|
14293
|
+
await g(G);
|
|
14293
14294
|
continue;
|
|
14294
14295
|
}
|
|
14295
|
-
throw
|
|
14296
|
+
throw F;
|
|
14296
14297
|
}
|
|
14297
14298
|
}
|
|
14298
14299
|
};
|
|
14299
|
-
let
|
|
14300
|
-
const
|
|
14301
|
-
if (b === 1 && !
|
|
14302
|
-
const
|
|
14303
|
-
if (
|
|
14304
|
-
|
|
14300
|
+
let c = Promise.resolve(), d = !1;
|
|
14301
|
+
const f = (b, U) => {
|
|
14302
|
+
if (b === 1 && !d) return;
|
|
14303
|
+
const E = C.get(b);
|
|
14304
|
+
if (E !== void 0) {
|
|
14305
|
+
C.set(b, Math.max(E, U));
|
|
14305
14306
|
return;
|
|
14306
14307
|
}
|
|
14307
|
-
|
|
14308
|
-
const
|
|
14309
|
-
if (
|
|
14310
|
-
const
|
|
14311
|
-
if (!
|
|
14312
|
-
const
|
|
14313
|
-
await
|
|
14308
|
+
C.set(b, U), c = c.then(async () => {
|
|
14309
|
+
const I = C.get(b);
|
|
14310
|
+
if (C.delete(b), I === void 0) return;
|
|
14311
|
+
const B = x.get(b);
|
|
14312
|
+
if (!B || B.uploaded || !t(B.ranges, I)) return;
|
|
14313
|
+
const A = B.buf.subarray(0, I);
|
|
14314
|
+
await n([A], b), B.uploaded = !0, x.delete(b);
|
|
14314
14315
|
});
|
|
14315
|
-
},
|
|
14316
|
-
|
|
14317
|
-
let
|
|
14318
|
-
for (;
|
|
14319
|
-
const
|
|
14320
|
-
|
|
14316
|
+
}, y = (b, U) => {
|
|
14317
|
+
p = Math.max(p, U + b.byteLength);
|
|
14318
|
+
let E = b, I = U;
|
|
14319
|
+
for (; E.byteLength > 0; ) {
|
|
14320
|
+
const B = Math.floor(I / r) + 1, A = I % r, R = Math.min(r - A, E.byteLength), F = v(B);
|
|
14321
|
+
F.buf.set(E.subarray(0, R), A), T(F.ranges, A, A + R), f(B, r), E = E.subarray(R), I += R;
|
|
14321
14322
|
}
|
|
14322
14323
|
};
|
|
14323
|
-
let
|
|
14324
|
-
if (
|
|
14324
|
+
let _ = 0;
|
|
14325
|
+
if (o.events.on(z.ExportProgress, (b) => {
|
|
14325
14326
|
window.runnerReportProgress(b);
|
|
14326
|
-
const
|
|
14327
|
-
|
|
14328
|
-
}),
|
|
14327
|
+
const U = Date.now();
|
|
14328
|
+
U - _ >= 1e3 && (_ = U, console.log("[meframe-runner] progress", b));
|
|
14329
|
+
}), o.events.on(z.ExportStart, (b) => {
|
|
14329
14330
|
console.log("[meframe-runner] export:start", b);
|
|
14330
|
-
}),
|
|
14331
|
+
}), o.events.on(z.ExportComplete, (b) => {
|
|
14331
14332
|
console.log("[meframe-runner] export:complete", b);
|
|
14332
|
-
}), console.log("[meframe-runner] export()..."), await
|
|
14333
|
+
}), console.log("[meframe-runner] export()..."), await o.export({
|
|
14333
14334
|
...s,
|
|
14334
14335
|
exportMode: "stream",
|
|
14335
|
-
onMuxData:
|
|
14336
|
+
onMuxData: y,
|
|
14336
14337
|
// IMPORTANT:
|
|
14337
14338
|
// mp4-muxer@5.2.2 StreamTarget "chunked" mode buffers into fixed-size chunks and only emits
|
|
14338
14339
|
// when a whole chunk is filled (or on finalize). With our current muxing pattern (seek+patch),
|
|
14339
14340
|
// we've observed 0-byte output in some environments. Disable chunked mode and let the runner
|
|
14340
14341
|
// aggregate into multipart partSizeBytes instead.
|
|
14341
14342
|
muxChunked: !1,
|
|
14342
|
-
signal:
|
|
14343
|
-
}),
|
|
14343
|
+
signal: m.signal
|
|
14344
|
+
}), p === 0)
|
|
14344
14345
|
throw new Error(
|
|
14345
14346
|
"[meframe-runner] stream mux produced 0 bytes. This indicates mp4-muxer StreamTarget did not emit any data."
|
|
14346
14347
|
);
|
|
14347
14348
|
console.log("[meframe-runner] finalize: flushing parts...");
|
|
14348
|
-
const
|
|
14349
|
-
|
|
14350
|
-
for (let b = 1; b <=
|
|
14351
|
-
const
|
|
14352
|
-
|
|
14349
|
+
const k = Math.ceil(p / r);
|
|
14350
|
+
d = !0;
|
|
14351
|
+
for (let b = 1; b <= k; b++) {
|
|
14352
|
+
const U = b === k ? p - (k - 1) * r : r;
|
|
14353
|
+
f(b, U);
|
|
14353
14354
|
}
|
|
14354
|
-
await
|
|
14355
|
+
await c, console.log("[meframe-runner] done", { totalBytes: p }), await window.runnerReportComplete(p);
|
|
14355
14356
|
}
|
|
14356
14357
|
ra().catch(async (a) => {
|
|
14357
14358
|
await window.runnerReportError(a?.message ?? String(a)).catch(() => {
|