mattebox 0.16.0 → 0.16.2
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/cdn/mattebox.dash-drm.min.js +1 -1
- package/dist/cdn/mattebox.dash-ll.min.js +1 -1
- package/dist/cdn/mattebox.dash.min.js +1 -1
- package/dist/cdn/mattebox.dual-drm.min.js +1 -1
- package/dist/cdn/mattebox.dual-ll.min.js +1 -1
- package/dist/cdn/mattebox.dual-ts-drm.min.js +3 -3
- package/dist/cdn/mattebox.dual-ts.min.js +3 -3
- package/dist/cdn/mattebox.dual.min.js +1 -1
- package/dist/cdn/mattebox.hls-drm.min.js +2 -2
- package/dist/cdn/mattebox.hls-ll.min.js +1 -1
- package/dist/cdn/mattebox.hls-ts-drm.min.js +3 -3
- package/dist/cdn/mattebox.hls-ts.min.js +3 -3
- package/dist/cdn/mattebox.hls.min.js +1 -1
- package/dist/cdn/mattebox.kernel.min.js +1 -1
- package/dist/cdn/mattebox.min.js +3 -3
- package/dist/containers/fmp4/fit.d.ts +6 -0
- package/dist/containers/fmp4/fit.d.ts.map +1 -1
- package/dist/containers/fmp4/fit.js +49 -0
- package/dist/containers/fmp4/fit.js.map +1 -1
- package/dist/containers/fmp4/writer.d.ts +12 -0
- package/dist/containers/fmp4/writer.d.ts.map +1 -1
- package/dist/containers/fmp4/writer.js +33 -1
- package/dist/containers/fmp4/writer.js.map +1 -1
- package/dist/containers/ts-transmux/index.d.ts.map +1 -1
- package/dist/containers/ts-transmux/index.js +44 -2
- package/dist/containers/ts-transmux/index.js.map +1 -1
- package/dist/containers/ts-transmux/runner.d.ts +2 -2
- package/dist/containers/ts-transmux/runner.d.ts.map +1 -1
- package/dist/containers/ts-transmux/runner.js +13 -4
- package/dist/containers/ts-transmux/runner.js.map +1 -1
- package/dist/containers/ts-transmux/serve.d.ts +3 -1
- package/dist/containers/ts-transmux/serve.d.ts.map +1 -1
- package/dist/containers/ts-transmux/serve.js +4 -2
- package/dist/containers/ts-transmux/serve.js.map +1 -1
- package/dist/containers/ts-transmux/transmux.d.ts +29 -5
- package/dist/containers/ts-transmux/transmux.d.ts.map +1 -1
- package/dist/containers/ts-transmux/transmux.js +91 -29
- package/dist/containers/ts-transmux/transmux.js.map +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/asyncToGenerator.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/defineProperty.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/objectSpread2.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/objectWithoutProperties.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPrimitive.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPropertyKey.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/typeof.js +1 -2
- package/dist/es2015/containers/adts.js +1 -2
- package/dist/es2015/containers/captions.js +1 -2
- package/dist/es2015/containers/codec-probe/index.js +1 -2
- package/dist/es2015/containers/emsg.js +1 -2
- package/dist/es2015/containers/fmp4/fit.js +52 -4
- package/dist/es2015/containers/fmp4/writer.js +32 -4
- package/dist/es2015/containers/id3.js +2 -3
- package/dist/es2015/containers/metadata.js +1 -2
- package/dist/es2015/containers/mp4-box/index.js +1 -2
- package/dist/es2015/containers/packed-audio/index.js +1 -2
- package/dist/es2015/containers/scte35.js +2 -3
- package/dist/es2015/containers/sei.js +1 -2
- package/dist/es2015/containers/ts-transmux/demux.js +1 -2
- package/dist/es2015/containers/ts-transmux/h264.js +2 -3
- package/dist/es2015/containers/ts-transmux/h265.js +2 -3
- package/dist/es2015/containers/ts-transmux/index.js +37 -6
- package/dist/es2015/containers/ts-transmux/runner.js +11 -9
- package/dist/es2015/containers/ts-transmux/serve.js +7 -6
- package/dist/es2015/containers/ts-transmux/sniff.js +0 -1
- package/dist/es2015/containers/ts-transmux/source.js +1 -2
- package/dist/es2015/containers/ts-transmux/transmux.js +92 -40
- package/dist/es2015/containers/ts-transmux/transmux.worker.js +1 -2
- package/dist/es2015/containers/webvtt.js +2 -3
- package/dist/es2015/containers/wvtt.js +2 -3
- package/dist/es2015/eme/index.js +3 -4
- package/dist/es2015/index.js +3 -4
- package/dist/es2015/kernel/append-queue.js +2 -3
- package/dist/es2015/kernel/base64.js +1 -2
- package/dist/es2015/kernel/bus.js +1 -2
- package/dist/es2015/kernel/characteristics.js +1 -2
- package/dist/es2015/kernel/context.js +1 -2
- package/dist/es2015/kernel/dry-run.js +2 -3
- package/dist/es2015/kernel/effects.js +1 -2
- package/dist/es2015/kernel/evictor.js +1 -2
- package/dist/es2015/kernel/lifecycle.js +1 -2
- package/dist/es2015/kernel/loader.js +1 -2
- package/dist/es2015/kernel/mime.js +1 -2
- package/dist/es2015/kernel/mse.js +2 -3
- package/dist/es2015/kernel/prepare.js +5 -6
- package/dist/es2015/kernel/presentation.js +1 -2
- package/dist/es2015/kernel/reducer.js +3 -4
- package/dist/es2015/kernel/refresh.js +2 -3
- package/dist/es2015/kernel/rendition-select.js +3 -4
- package/dist/es2015/kernel/scheduler.js +2 -3
- package/dist/es2015/kernel/sinks/caption-tracks.js +1 -2
- package/dist/es2015/kernel/sinks/metadata-sink.js +1 -2
- package/dist/es2015/kernel/sinks/mse-sink.js +1 -2
- package/dist/es2015/kernel/sinks/native-sync.js +1 -2
- package/dist/es2015/kernel/sinks/text-formats.js +1 -2
- package/dist/es2015/kernel/sinks/text-track-sink.js +1 -2
- package/dist/es2015/kernel/timeline.js +2 -3
- package/dist/es2015/kernel/trace.js +1 -2
- package/dist/es2015/kernel/track-registry.js +1 -2
- package/dist/es2015/kernel/transport.js +9 -9
- package/dist/es2015/kernel/url.js +1 -2
- package/dist/es2015/kernel/watchdog.js +1 -2
- package/dist/es2015/presets/dash/index.js +1 -2
- package/dist/es2015/presets/dash-drm/index.js +1 -2
- package/dist/es2015/presets/dash-ll/index.js +1 -2
- package/dist/es2015/presets/define.js +3 -4
- package/dist/es2015/presets/dual/index.js +1 -2
- package/dist/es2015/presets/dual-drm/index.js +1 -2
- package/dist/es2015/presets/dual-ll/index.js +1 -2
- package/dist/es2015/presets/dual-ts/index.js +1 -2
- package/dist/es2015/presets/dual-ts-drm/index.js +1 -2
- package/dist/es2015/presets/full/index.js +1 -2
- package/dist/es2015/presets/hls/index.js +1 -2
- package/dist/es2015/presets/hls-drm/index.js +1 -2
- package/dist/es2015/presets/hls-ll/index.js +1 -2
- package/dist/es2015/presets/hls-ts/index.js +1 -2
- package/dist/es2015/presets/hls-ts-drm/index.js +1 -2
- package/dist/es2015/presets/kernel/index.js +1 -2
- package/dist/es2015/presets/tiers.js +1 -2
- package/dist/es2015/protocols/adapter-shared.js +1 -2
- package/dist/es2015/protocols/dash-cmaf/index.js +4 -4
- package/dist/es2015/protocols/dash-cmaf/parse.js +2 -3
- package/dist/es2015/protocols/dash-cmaf/periods-runtime.js +2 -3
- package/dist/es2015/protocols/dash-cmaf/periods.js +2 -3
- package/dist/es2015/protocols/dash-live/index.js +5 -4
- package/dist/es2015/protocols/dash-ll/index.js +1 -2
- package/dist/es2015/protocols/dimensions.js +1 -2
- package/dist/es2015/protocols/hls-cmaf/index.js +6 -5
- package/dist/es2015/protocols/hls-cmaf/lexer.js +1 -2
- package/dist/es2015/protocols/hls-cmaf/parse.js +2 -3
- package/dist/es2015/protocols/hls-cmaf/unavailable.js +2 -3
- package/dist/es2015/protocols/hls-live/index.js +5 -5
- package/dist/es2015/protocols/hls-ll/index.js +1 -2
- package/dist/es2015/protocols/hls-ll/parse.js +2 -3
- package/dist/es2015/protocols/live-shared.js +1 -2
- package/dist/es2015/stages/abr/index.js +2 -3
- package/dist/es2015/stages/abr-cap-size/index.js +1 -2
- package/dist/es2015/stages/aes-128/index.js +2 -3
- package/dist/es2015/stages/alt-audio/index.js +1 -2
- package/dist/es2015/stages/chapters/index.js +3 -4
- package/dist/es2015/stages/chapters/parse.js +3 -4
- package/dist/es2015/stages/cmaf-timing/index.js +1 -2
- package/dist/es2015/stages/cmcd/index.js +1 -2
- package/dist/es2015/stages/cmsd/index.js +1 -2
- package/dist/es2015/stages/codec-probe/index.js +2 -3
- package/dist/es2015/stages/codec-switch/index.js +1 -2
- package/dist/es2015/stages/content-steering/index.js +2 -3
- package/dist/es2015/stages/drm-shared.js +1 -2
- package/dist/es2015/stages/eme-cenc/index.js +1 -2
- package/dist/es2015/stages/eme-core/index.js +16 -10
- package/dist/es2015/stages/eme-fairplay/index.js +2 -3
- package/dist/es2015/stages/forced-subtitles/index.js +1 -2
- package/dist/es2015/stages/hdr/index.js +2 -3
- package/dist/es2015/stages/live-catchup/index.js +1 -2
- package/dist/es2015/stages/meta-id3/index.js +1 -2
- package/dist/es2015/stages/mp4-box/index.js +1 -2
- package/dist/es2015/stages/nal-scan/index.js +1 -2
- package/dist/es2015/stages/pdt/index.js +1 -2
- package/dist/es2015/stages/qoe/index.js +2 -3
- package/dist/es2015/stages/recovery/index.js +2 -3
- package/dist/es2015/stages/rendition-names/index.js +2 -3
- package/dist/es2015/stages/text-cea608/decode.js +2 -3
- package/dist/es2015/stages/text-cea608/index.js +1 -2
- package/dist/es2015/stages/text-cea708/decode.js +3 -4
- package/dist/es2015/stages/text-cea708/index.js +2 -3
- package/dist/es2015/stages/text-ttml/images.js +1 -2
- package/dist/es2015/stages/text-ttml/index.js +2 -3
- package/dist/es2015/stages/text-ttml/parse.js +2 -3
- package/dist/es2015/stages/text-webvtt/index.js +1 -2
- package/dist/es2015/stages/text-webvtt-segmented/index.js +1 -2
- package/dist/es2015/stages/thumbnails/index.js +2 -3
- package/dist/es2015/stages/timed-metadata/index.js +2 -3
- package/dist/es2015/stages/trick-play/index.js +2 -3
- package/dist/kernel/prepare.d.ts.map +1 -1
- package/dist/kernel/prepare.js +1 -0
- package/dist/kernel/prepare.js.map +1 -1
- package/dist/kernel/transport.d.ts +3 -1
- package/dist/kernel/transport.d.ts.map +1 -1
- package/dist/kernel/transport.js +5 -1
- package/dist/kernel/transport.js.map +1 -1
- package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/index.js +3 -1
- package/dist/protocols/dash-cmaf/index.js.map +1 -1
- package/dist/protocols/dash-live/index.d.ts.map +1 -1
- package/dist/protocols/dash-live/index.js +3 -1
- package/dist/protocols/dash-live/index.js.map +1 -1
- package/dist/protocols/hls-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/index.js +4 -2
- package/dist/protocols/hls-cmaf/index.js.map +1 -1
- package/dist/protocols/hls-live/index.d.ts.map +1 -1
- package/dist/protocols/hls-live/index.js +4 -2
- package/dist/protocols/hls-live/index.js.map +1 -1
- package/dist/stages/eme-core/index.d.ts.map +1 -1
- package/dist/stages/eme-core/index.js +14 -3
- package/dist/stages/eme-core/index.js.map +1 -1
- package/dist/types/messages.d.ts +8 -0
- package/dist/types/messages.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { concat } from "../fmp4/writer.js";
|
|
2
2
|
import { looksLikeTransportStream } from "./sniff.js";
|
|
3
|
-
|
|
3
|
+
// src/containers/ts-transmux/demux.ts
|
|
4
4
|
/**
|
|
5
5
|
* MPEG-TS demux: 188-byte packets into PES payloads, grouped by elementary
|
|
6
6
|
* stream. PAT names the PMT, the PMT names the elementary PIDs and their
|
|
@@ -216,5 +216,4 @@ function unrollTimestamps(values) {
|
|
|
216
216
|
}
|
|
217
217
|
return out;
|
|
218
218
|
}
|
|
219
|
-
//#endregion
|
|
220
219
|
export { STREAM_TYPE, demux, looksLikeTransportStream, programTables, unrollTimestamps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/defineProperty.js";
|
|
2
2
|
import { toRbsp } from "../sei.js";
|
|
3
|
-
|
|
3
|
+
// src/containers/ts-transmux/h264.ts
|
|
4
4
|
/**
|
|
5
5
|
* H.264 Annex B to AVCC. The elementary stream separates NAL units with
|
|
6
6
|
* start codes; MSE wants them length-prefixed, with the parameter sets moved
|
|
@@ -184,5 +184,4 @@ function spsDimensions(sps) {
|
|
|
184
184
|
height: Math.max(0, height)
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
|
-
//#endregion
|
|
188
187
|
export { NAL_TYPE, accessUnitFromNals, nalType, splitNalUnits, spsDimensions, toAccessUnit };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/defineProperty.js";
|
|
2
2
|
import { toRbsp } from "../sei.js";
|
|
3
|
-
|
|
3
|
+
// src/containers/ts-transmux/h265.ts
|
|
4
4
|
/**
|
|
5
5
|
* H.265 Annex B to the hvc1 sample format. The NAL units split on start
|
|
6
6
|
* codes as in H.264 (splitNalUnits applies); the header is two bytes and
|
|
@@ -171,5 +171,4 @@ function hevcDecoderConfiguration(vps, sps, pps) {
|
|
|
171
171
|
}
|
|
172
172
|
return out;
|
|
173
173
|
}
|
|
174
|
-
//#endregion
|
|
175
174
|
export { HEVC_NAL_TYPE, hevcAccessUnitFromNals, hevcDecoderConfiguration, hevcNalType, hevcSpsInfo };
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/asyncToGenerator.js";
|
|
2
2
|
import { looksLikeTransportStream } from "./sniff.js";
|
|
3
3
|
import { id3Events } from "../id3.js";
|
|
4
4
|
import { deliverMetadata, metadataWanted } from "../metadata.js";
|
|
5
5
|
import { captionsWanted, deliverCaptions } from "../captions.js";
|
|
6
6
|
import { createTransmuxRunner } from "./runner.js";
|
|
7
7
|
import { transmuxSource } from "./source.js";
|
|
8
|
-
|
|
8
|
+
// src/containers/ts-transmux/index.ts
|
|
9
9
|
/** Runs after decrypt-class steps (lower order) and before caption extraction. */
|
|
10
10
|
const TRANSMUX_ORDER = 100;
|
|
11
11
|
/**
|
|
12
|
+
* The least drift, in seconds, past which a segment's own timestamps lose to
|
|
13
|
+
* its playlist start. An encoder's offset between audio and video is well
|
|
14
|
+
* under a segment; a jump of more than a segment is a clock that restarted
|
|
15
|
+
* without a discontinuity tag.
|
|
16
|
+
*/
|
|
17
|
+
const MIN_TOLERANCE = 2;
|
|
18
|
+
/**
|
|
12
19
|
* Which elementary streams a segment's buffer should receive. A video
|
|
13
20
|
* segment keeps only its video stream once the kernel has an audio track of
|
|
14
21
|
* its own active: the audio is then a separate rendition on sb:audio, so a
|
|
@@ -29,16 +36,41 @@ function tsTransmux(options = {}) {
|
|
|
29
36
|
const runner = createTransmuxRunner(options, transmuxSource);
|
|
30
37
|
let announcedDrop = false;
|
|
31
38
|
const parameterSets = /* @__PURE__ */ new Map();
|
|
39
|
+
const anchors = /* @__PURE__ */ new Map();
|
|
40
|
+
let anchoredSource = null;
|
|
32
41
|
ctx.registerTransform({
|
|
33
42
|
name: "ts-transmux",
|
|
34
43
|
order: TRANSMUX_ORDER,
|
|
35
44
|
transform(data, meta) {
|
|
36
45
|
return _asyncToGenerator(function* () {
|
|
37
|
-
var _ctx$getState$present, _ctx$getState$present2, _parameterSets$get;
|
|
46
|
+
var _ctx$getState$present, _ctx$getState$present2, _meta$epoch, _parameterSets$get;
|
|
38
47
|
if (meta.contentType !== "video" && meta.contentType !== "audio") return data;
|
|
39
48
|
if (!looksLikeTransportStream(data)) return data;
|
|
40
|
-
const
|
|
41
|
-
const
|
|
49
|
+
const source = (_ctx$getState$present = (_ctx$getState$present2 = ctx.getState().presentation) === null || _ctx$getState$present2 === void 0 ? void 0 : _ctx$getState$present2.id) !== null && _ctx$getState$present !== void 0 ? _ctx$getState$present : "";
|
|
50
|
+
const key = `${source}|${meta.renditionId}`;
|
|
51
|
+
if (source !== anchoredSource) {
|
|
52
|
+
anchors.clear();
|
|
53
|
+
anchoredSource = source;
|
|
54
|
+
}
|
|
55
|
+
const epochKey = `${source}|${(_meta$epoch = meta.epoch) !== null && _meta$epoch !== void 0 ? _meta$epoch : ""}`;
|
|
56
|
+
const kept = anchors.get(epochKey);
|
|
57
|
+
let settle = null;
|
|
58
|
+
if (kept === void 0) anchors.set(epochKey, new Promise((resolve) => {
|
|
59
|
+
settle = resolve;
|
|
60
|
+
}));
|
|
61
|
+
const anchor = kept === void 0 ? null : yield kept;
|
|
62
|
+
const result = yield runner.run(data, meta.start, captionsWanted(), tracksFor(ctx, meta), (_parameterSets$get = parameterSets.get(key)) !== null && _parameterSets$get !== void 0 ? _parameterSets$get : null, {
|
|
63
|
+
anchor,
|
|
64
|
+
tolerance: Math.max(meta.duration, MIN_TOLERANCE)
|
|
65
|
+
}).catch((cause) => {
|
|
66
|
+
if (settle !== null) {
|
|
67
|
+
anchors.delete(epochKey);
|
|
68
|
+
settle(null);
|
|
69
|
+
}
|
|
70
|
+
throw cause;
|
|
71
|
+
});
|
|
72
|
+
if (settle !== null) settle(result.anchor);
|
|
73
|
+
else if (result.anchor !== null && result.anchor !== anchor) anchors.set(epochKey, Promise.resolve(result.anchor));
|
|
42
74
|
if (result.parameterSets !== null) parameterSets.set(key, result.parameterSets);
|
|
43
75
|
if (result.captions.length > 0) deliverCaptions(result.captions);
|
|
44
76
|
if (result.metadata.length > 0 && metadataWanted()) deliverMetadata(id3Events(result.metadata));
|
|
@@ -61,5 +93,4 @@ function tsTransmux(options = {}) {
|
|
|
61
93
|
}
|
|
62
94
|
};
|
|
63
95
|
}
|
|
64
|
-
//#endregion
|
|
65
96
|
export { tsTransmux as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/asyncToGenerator.js";
|
|
3
|
+
// src/containers/ts-transmux/runner.ts
|
|
4
4
|
function createTransmuxRunner(options, source) {
|
|
5
5
|
let worker = null;
|
|
6
6
|
let workerBroken = options.disableWorker === true;
|
|
@@ -16,7 +16,7 @@ function createTransmuxRunner(options, source) {
|
|
|
16
16
|
_runOnMainThread = _asyncToGenerator(function* (request) {
|
|
17
17
|
var _loaded;
|
|
18
18
|
(_loaded = loaded) !== null && _loaded !== void 0 || (loaded = source.load());
|
|
19
|
-
return (yield loaded)(request.bytes, request.presentationStart, request.wantCaptions, request.tracks, request.parameterSets);
|
|
19
|
+
return (yield loaded)(request.bytes, request.presentationStart, request.wantCaptions, request.tracks, request.parameterSets, request.timing);
|
|
20
20
|
});
|
|
21
21
|
return _runOnMainThread.apply(this, arguments);
|
|
22
22
|
}
|
|
@@ -36,7 +36,8 @@ function createTransmuxRunner(options, source) {
|
|
|
36
36
|
captions: event.data.captions,
|
|
37
37
|
metadata: event.data.metadata,
|
|
38
38
|
droppedAudio: event.data.droppedAudio,
|
|
39
|
-
parameterSets: event.data.parameterSets
|
|
39
|
+
parameterSets: event.data.parameterSets,
|
|
40
|
+
anchor: event.data.anchor
|
|
40
41
|
});
|
|
41
42
|
};
|
|
42
43
|
worker.onerror = () => {
|
|
@@ -54,13 +55,14 @@ function createTransmuxRunner(options, source) {
|
|
|
54
55
|
return worker;
|
|
55
56
|
}
|
|
56
57
|
return {
|
|
57
|
-
run(bytes, presentationStart, wantCaptions = false, tracks = "all", parameterSets = null) {
|
|
58
|
+
run(bytes, presentationStart, wantCaptions = false, tracks = "all", parameterSets = null, timing = null) {
|
|
58
59
|
const request = {
|
|
59
60
|
bytes,
|
|
60
61
|
presentationStart,
|
|
61
62
|
wantCaptions,
|
|
62
63
|
tracks,
|
|
63
|
-
parameterSets
|
|
64
|
+
parameterSets,
|
|
65
|
+
timing
|
|
64
66
|
};
|
|
65
67
|
const active = ensureWorker();
|
|
66
68
|
if (active === null) {
|
|
@@ -80,7 +82,8 @@ function createTransmuxRunner(options, source) {
|
|
|
80
82
|
presentationStart,
|
|
81
83
|
wantCaptions,
|
|
82
84
|
tracks,
|
|
83
|
-
parameterSets
|
|
85
|
+
parameterSets,
|
|
86
|
+
timing
|
|
84
87
|
}, [copy.buffer]);
|
|
85
88
|
} catch (_unused2) {
|
|
86
89
|
pending.delete(id);
|
|
@@ -101,5 +104,4 @@ function createTransmuxRunner(options, source) {
|
|
|
101
104
|
}
|
|
102
105
|
};
|
|
103
106
|
}
|
|
104
|
-
//#endregion
|
|
105
107
|
export { createTransmuxRunner };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { transmux } from "./transmux.js";
|
|
2
|
-
|
|
2
|
+
// src/containers/ts-transmux/serve.ts
|
|
3
3
|
/** Answers transmux requests on a Worker's scope. */
|
|
4
4
|
function serveTransmux(scope) {
|
|
5
5
|
scope.onmessage = (event) => {
|
|
6
|
-
var _event$data$parameter;
|
|
6
|
+
var _event$data$parameter, _event$data$timing;
|
|
7
7
|
const { id, bytes, presentationStart, wantCaptions, tracks = "all" } = event.data;
|
|
8
|
-
const result = transmux(new Uint8Array(bytes), presentationStart, wantCaptions, tracks, (_event$data$parameter = event.data.parameterSets) !== null && _event$data$parameter !== void 0 ? _event$data$parameter : null);
|
|
8
|
+
const result = transmux(new Uint8Array(bytes), presentationStart, wantCaptions, tracks, (_event$data$parameter = event.data.parameterSets) !== null && _event$data$parameter !== void 0 ? _event$data$parameter : null, (_event$data$timing = event.data.timing) !== null && _event$data$timing !== void 0 ? _event$data$timing : null);
|
|
9
9
|
const out = result.bytes;
|
|
10
10
|
if (out === null) {
|
|
11
11
|
scope.postMessage({
|
|
@@ -15,7 +15,8 @@ function serveTransmux(scope) {
|
|
|
15
15
|
captions: [],
|
|
16
16
|
metadata: [],
|
|
17
17
|
droppedAudio: result.droppedAudio,
|
|
18
|
-
parameterSets: null
|
|
18
|
+
parameterSets: null,
|
|
19
|
+
anchor: result.anchor
|
|
19
20
|
}, []);
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
@@ -28,9 +29,9 @@ function serveTransmux(scope) {
|
|
|
28
29
|
captions: result.captions,
|
|
29
30
|
metadata: result.metadata,
|
|
30
31
|
droppedAudio: result.droppedAudio,
|
|
31
|
-
parameterSets: result.parameterSets
|
|
32
|
+
parameterSets: result.parameterSets,
|
|
33
|
+
anchor: result.anchor
|
|
32
34
|
}, [buffer]);
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
|
-
//#endregion
|
|
36
37
|
export { serveTransmux };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// src/containers/ts-transmux/source.ts
|
|
2
2
|
const transmuxSource = {
|
|
3
3
|
load: () => import("./transmux.js").then((module) => module.transmux),
|
|
4
4
|
worker: () => new Worker(new URL("./transmux.worker.js", import.meta.url), { type: "module" })
|
|
5
5
|
};
|
|
6
|
-
//#endregion
|
|
7
6
|
export { transmuxSource };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { concat, sequenceNumberFor, writeInitSegment, writeMediaSegment } from "../fmp4/writer.js";
|
|
3
3
|
import { STREAM_TYPE, demux, unrollTimestamps } from "./demux.js";
|
|
4
4
|
import { ccTriplesFromSei } from "../sei.js";
|
|
5
|
-
import { adtsFragment, parseAdts } from "../adts.js";
|
|
5
|
+
import { SAMPLES_PER_FRAME, adtsFragment, parseAdts } from "../adts.js";
|
|
6
6
|
import { NAL_TYPE, accessUnitFromNals, nalType, splitNalUnits, spsDimensions, toAccessUnit } from "./h264.js";
|
|
7
7
|
import { HEVC_NAL_TYPE, hevcAccessUnitFromNals, hevcDecoderConfiguration, hevcNalType, hevcSpsInfo } from "./h265.js";
|
|
8
|
-
|
|
8
|
+
// src/containers/ts-transmux/transmux.ts
|
|
9
9
|
/**
|
|
10
10
|
* The transmux core: MPEG-TS bytes to a self-contained fragmented MP4. Each
|
|
11
11
|
* call is independent and pure, so identical input plus identical
|
|
@@ -13,10 +13,14 @@ import { HEVC_NAL_TYPE, hevcAccessUnitFromNals, hevcDecoderConfiguration, hevcNa
|
|
|
13
13
|
* Worker. A muxed segment produces one init with a video and an audio track
|
|
14
14
|
* and one media fragment carrying both, so a single SourceBuffer decodes it.
|
|
15
15
|
*
|
|
16
|
-
* Segment timing
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* Segment timing maps the raw PES timestamps onto the presentation through
|
|
17
|
+
* an anchor: one timestamp at one presentation time. Legacy TS streams begin
|
|
18
|
+
* at an arbitrary PTS, so the first segment of a timeline sets the anchor at
|
|
19
|
+
* its playlist start, and every later segment of every rendition is placed
|
|
20
|
+
* from its own timestamps against that anchor. Audio and video renditions
|
|
21
|
+
* whose segments do not start together keep the offset the encoder gave
|
|
22
|
+
* them, as hls.js keeps it with one initPTS per discontinuity. Inside one
|
|
23
|
+
* segment, the video and the audio each start at their own first timestamp.
|
|
20
24
|
*/
|
|
21
25
|
const VIDEO_TIMESCALE = 9e4;
|
|
22
26
|
const VIDEO_TRACK_ID = 1;
|
|
@@ -24,21 +28,27 @@ const AUDIO_TRACK_ID = 2;
|
|
|
24
28
|
/** Fallback duration for a lone trailing video sample: 30 fps in 90 kHz. */
|
|
25
29
|
const DEFAULT_FRAME_DURATION = 3e3;
|
|
26
30
|
const PTS_WRAP = Math.pow(2, 33);
|
|
31
|
+
/** The signed distance from `from` to `to` on the 33-bit clock, in 90 kHz units. */
|
|
32
|
+
function wrapDelta(to, from) {
|
|
33
|
+
let delta = (to - from) % PTS_WRAP;
|
|
34
|
+
if (delta > PTS_WRAP / 2) delta -= PTS_WRAP;
|
|
35
|
+
else if (delta < -PTS_WRAP / 2) delta += PTS_WRAP;
|
|
36
|
+
return delta;
|
|
37
|
+
}
|
|
38
|
+
function timeOfAnchor(anchor) {
|
|
39
|
+
return (timestamp) => anchor.time + wrapDelta(timestamp, anchor.pts) / VIDEO_TIMESCALE;
|
|
40
|
+
}
|
|
27
41
|
/**
|
|
28
|
-
* The metadata stream's tags on the presentation timeline
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* tag, not the segment it was cut from.
|
|
42
|
+
* The metadata stream's tags on the presentation timeline, each at its own
|
|
43
|
+
* PTS, across a 33-bit PTS wrap. The bytes are copied so a Worker posts only
|
|
44
|
+
* the tag, not the segment it was cut from.
|
|
32
45
|
*/
|
|
33
|
-
function timedTags(streams,
|
|
46
|
+
function timedTags(streams, timeOf) {
|
|
34
47
|
const tags = [];
|
|
35
48
|
for (const packet of streams.id3) {
|
|
36
|
-
if (packet.pts === null
|
|
37
|
-
let delta = (packet.pts - anchor) % PTS_WRAP;
|
|
38
|
-
if (delta > PTS_WRAP / 2) delta -= PTS_WRAP;
|
|
39
|
-
else if (delta < -PTS_WRAP / 2) delta += PTS_WRAP;
|
|
49
|
+
if (packet.pts === null) continue;
|
|
40
50
|
tags.push({
|
|
41
|
-
time:
|
|
51
|
+
time: timeOf(packet.pts),
|
|
42
52
|
bytes: packet.data.slice()
|
|
43
53
|
});
|
|
44
54
|
}
|
|
@@ -109,8 +119,8 @@ function frameAccessUnits(packets, syntax) {
|
|
|
109
119
|
flush();
|
|
110
120
|
return framed;
|
|
111
121
|
}
|
|
112
|
-
function buildVideo(packets,
|
|
113
|
-
var _packets$, _ref, _sps, _ref2, _pps, _ref3, _vps
|
|
122
|
+
function buildVideo(packets, timeOf, wantCaptions, carried) {
|
|
123
|
+
var _packets$, _ref, _sps, _ref2, _pps, _ref3, _vps, _dts$;
|
|
114
124
|
if (packets.length === 0) return null;
|
|
115
125
|
const hevc = ((_packets$ = packets[0]) === null || _packets$ === void 0 ? void 0 : _packets$.streamType) === STREAM_TYPE.h265;
|
|
116
126
|
const syntax = hevc ? HEVC : AVC;
|
|
@@ -130,7 +140,8 @@ function buildVideo(packets, presentationStart, wantCaptions, carried) {
|
|
|
130
140
|
if (sps === null || pps === null || hevc && vps === null) return null;
|
|
131
141
|
const dts = unrollTimestamps(framed.map((f) => f.dts));
|
|
132
142
|
const pts = unrollTimestamps(framed.map((f) => f.pts));
|
|
133
|
-
const
|
|
143
|
+
const start = Math.max(0, timeOf((_dts$ = dts[0]) !== null && _dts$ !== void 0 ? _dts$ : 0));
|
|
144
|
+
const base = Math.round(start * VIDEO_TIMESCALE);
|
|
134
145
|
const captions = [];
|
|
135
146
|
if (wantCaptions) {
|
|
136
147
|
var _pts$;
|
|
@@ -140,7 +151,7 @@ function buildVideo(packets, presentationStart, wantCaptions, carried) {
|
|
|
140
151
|
if (unit.sei.length === 0) continue;
|
|
141
152
|
const triples = unit.sei.flatMap((nal) => ccTriplesFromSei(nal, syntax.seiHeader));
|
|
142
153
|
if (triples.length === 0) continue;
|
|
143
|
-
const time =
|
|
154
|
+
const time = start + (pts[i] - firstPts) / VIDEO_TIMESCALE;
|
|
144
155
|
captions.push({
|
|
145
156
|
time,
|
|
146
157
|
triples
|
|
@@ -184,26 +195,66 @@ function buildVideo(packets, presentationStart, wantCaptions, carried) {
|
|
|
184
195
|
}
|
|
185
196
|
};
|
|
186
197
|
}
|
|
187
|
-
function buildAudio(packets, presentationStart) {
|
|
198
|
+
function buildAudio(packets, timeOf, presentationStart) {
|
|
199
|
+
var _packets$0$pts, _packets$2;
|
|
188
200
|
if (packets.length === 0) return null;
|
|
189
201
|
const adts = parseAdts(concat(...packets.map((p) => p.data)));
|
|
190
202
|
if (adts.frames.length === 0) return null;
|
|
191
|
-
|
|
203
|
+
const first = (_packets$0$pts = (_packets$2 = packets[0]) === null || _packets$2 === void 0 ? void 0 : _packets$2.pts) !== null && _packets$0$pts !== void 0 ? _packets$0$pts : null;
|
|
204
|
+
const start = first === null ? presentationStart : timeOf(first);
|
|
205
|
+
if (start >= 0) return adtsFragment(adts, AUDIO_TRACK_ID, start);
|
|
206
|
+
const frame = SAMPLES_PER_FRAME / adts.sampleRate;
|
|
207
|
+
const dropped = Math.ceil(-start / frame - 1e-9);
|
|
208
|
+
if (dropped >= adts.frames.length) return null;
|
|
209
|
+
return adtsFragment(_objectSpread2(_objectSpread2({}, adts), {}, { frames: adts.frames.slice(dropped) }), AUDIO_TRACK_ID, start + dropped * frame);
|
|
192
210
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
211
|
+
/**
|
|
212
|
+
* The anchor a segment is placed by: its timeline's, or a new one that puts
|
|
213
|
+
* the segment's first timestamp at its playlist start, when the timeline
|
|
214
|
+
* has none or the segment drifted past the tolerance.
|
|
215
|
+
*/
|
|
216
|
+
function anchorFor(reference, presentationStart, timing) {
|
|
217
|
+
var _timing$anchor, _timing$anchor2;
|
|
218
|
+
if (reference === null) return (_timing$anchor = timing === null || timing === void 0 ? void 0 : timing.anchor) !== null && _timing$anchor !== void 0 ? _timing$anchor : null;
|
|
219
|
+
const fresh = {
|
|
220
|
+
pts: reference,
|
|
221
|
+
time: presentationStart
|
|
204
222
|
};
|
|
205
|
-
const
|
|
206
|
-
|
|
223
|
+
const kept = (_timing$anchor2 = timing === null || timing === void 0 ? void 0 : timing.anchor) !== null && _timing$anchor2 !== void 0 ? _timing$anchor2 : null;
|
|
224
|
+
if (kept === null) return fresh;
|
|
225
|
+
const drift = timeOfAnchor(kept)(reference) - presentationStart;
|
|
226
|
+
return Math.abs(drift) > timing.tolerance ? fresh : kept;
|
|
227
|
+
}
|
|
228
|
+
/** The first timestamp of the field `key` among `packets`, or null when none carries one. */
|
|
229
|
+
function firstTimestamp(packets, key) {
|
|
230
|
+
for (const packet of packets) {
|
|
231
|
+
const value = packet[key];
|
|
232
|
+
if (value !== null) return value;
|
|
233
|
+
}
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
function transmux(input, presentationStart = 0, wantCaptions = false, tracks = "all", parameterSets = null, timing = null) {
|
|
237
|
+
var _video$captions, _video$parameterSets;
|
|
238
|
+
const streams = demux(input);
|
|
239
|
+
if (streams.notTransportStream) {
|
|
240
|
+
var _timing$anchor3;
|
|
241
|
+
return {
|
|
242
|
+
bytes: null,
|
|
243
|
+
notTransportStream: true,
|
|
244
|
+
empty: false,
|
|
245
|
+
captions: [],
|
|
246
|
+
metadata: [],
|
|
247
|
+
droppedAudio: false,
|
|
248
|
+
parameterSets: null,
|
|
249
|
+
anchor: (_timing$anchor3 = timing === null || timing === void 0 ? void 0 : timing.anchor) !== null && _timing$anchor3 !== void 0 ? _timing$anchor3 : null
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
const videoFirst = tracks !== "audio" ? firstTimestamp(streams.video, "dts") : null;
|
|
253
|
+
const audioFirst = tracks !== "video" ? firstTimestamp(streams.audio, "pts") : null;
|
|
254
|
+
const anchor = anchorFor(videoFirst === null ? audioFirst : audioFirst === null || wrapDelta(audioFirst, videoFirst) >= 0 ? videoFirst : audioFirst, presentationStart, timing);
|
|
255
|
+
const timeOf = anchor === null ? () => presentationStart : timeOfAnchor(anchor);
|
|
256
|
+
const video = tracks === "audio" ? null : buildVideo(streams.video, timeOf, wantCaptions, parameterSets);
|
|
257
|
+
const audio = tracks === "video" ? null : buildAudio(streams.audio, timeOf, presentationStart);
|
|
207
258
|
const droppedAudio = tracks === "video" && streams.audio.length > 0;
|
|
208
259
|
if (video === null && audio === null) return {
|
|
209
260
|
bytes: null,
|
|
@@ -212,7 +263,8 @@ function transmux(input, presentationStart = 0, wantCaptions = false, tracks = "
|
|
|
212
263
|
captions: [],
|
|
213
264
|
metadata: [],
|
|
214
265
|
droppedAudio,
|
|
215
|
-
parameterSets: null
|
|
266
|
+
parameterSets: null,
|
|
267
|
+
anchor
|
|
216
268
|
};
|
|
217
269
|
const configs = [];
|
|
218
270
|
const fragments = [];
|
|
@@ -231,10 +283,10 @@ function transmux(input, presentationStart = 0, wantCaptions = false, tracks = "
|
|
|
231
283
|
notTransportStream: false,
|
|
232
284
|
empty: false,
|
|
233
285
|
captions: (_video$captions = video === null || video === void 0 ? void 0 : video.captions) !== null && _video$captions !== void 0 ? _video$captions : [],
|
|
234
|
-
metadata: timedTags(streams,
|
|
286
|
+
metadata: timedTags(streams, timeOf),
|
|
235
287
|
droppedAudio,
|
|
236
|
-
parameterSets: (_video$parameterSets = video === null || video === void 0 ? void 0 : video.parameterSets) !== null && _video$parameterSets !== void 0 ? _video$parameterSets : null
|
|
288
|
+
parameterSets: (_video$parameterSets = video === null || video === void 0 ? void 0 : video.parameterSets) !== null && _video$parameterSets !== void 0 ? _video$parameterSets : null,
|
|
289
|
+
anchor
|
|
237
290
|
};
|
|
238
291
|
}
|
|
239
|
-
//#endregion
|
|
240
292
|
export { transmux };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { serveTransmux } from "./serve.js";
|
|
2
|
-
|
|
2
|
+
// src/containers/ts-transmux/transmux.worker.ts
|
|
3
3
|
/**
|
|
4
4
|
* The Worker entry of the npm build, loaded by URL. Everything it does is
|
|
5
5
|
* in serve.ts, which the script-tag bundle also starts from its one copy of
|
|
6
6
|
* the transmux.
|
|
7
7
|
*/
|
|
8
8
|
serveTransmux(self);
|
|
9
|
-
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
// src/containers/webvtt.ts
|
|
3
3
|
/** `HH:MM:SS.mmm` or `MM:SS.mmm` to seconds, or null. */
|
|
4
4
|
function parseTimestamp(text) {
|
|
5
5
|
const match = /^(?:(\d+):)?([0-5]\d):([0-5]\d)\.(\d{3})$/.exec(text.trim());
|
|
@@ -60,5 +60,4 @@ function parseVtt(text) {
|
|
|
60
60
|
function escapeCueText(text) {
|
|
61
61
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
62
62
|
}
|
|
63
|
-
//#endregion
|
|
64
63
|
export { escapeCueText, parseTimestamp, parseVtt };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { fourcc, viewOf } from "./mp4-box/index.js";
|
|
3
|
-
|
|
3
|
+
// src/containers/wvtt.ts
|
|
4
4
|
/** The child boxes of `bytes`, as type and payload. */
|
|
5
5
|
function boxes(bytes) {
|
|
6
6
|
const out = [];
|
|
@@ -36,5 +36,4 @@ function wvttCues(samples) {
|
|
|
36
36
|
}
|
|
37
37
|
return cues.map((cue) => _objectSpread2(_objectSpread2({}, cue), {}, { id: `${cue.start.toFixed(3)}|${cue.end.toFixed(3)}|${cue.text}` }));
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { wvttCues };
|
package/dist/es2015/eme/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectWithoutProperties.js";
|
|
3
3
|
import { fetchWithin } from "../kernel/transport.js";
|
|
4
4
|
import emeCore from "../stages/eme-core/index.js";
|
|
5
|
-
|
|
5
|
+
// src/eme/index.ts
|
|
6
6
|
/**
|
|
7
7
|
* The engine's DRM on an element the engine does not drive. On Safari a
|
|
8
8
|
* player can play HLS natively with `video.src`; the element still fires
|
|
@@ -77,5 +77,4 @@ function attachEme(element, options = {}) {
|
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
-
//#endregion
|
|
81
80
|
export { attachEme };
|
package/dist/es2015/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { exportTrace, replay } from "./kernel/trace.js";
|
|
3
3
|
import { createBus } from "./kernel/bus.js";
|
|
4
4
|
import { createEffectRunner } from "./kernel/effects.js";
|
|
5
|
-
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.
|
|
5
|
+
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/asyncToGenerator.js";
|
|
6
6
|
import { createSegmentPreparer } from "./kernel/prepare.js";
|
|
7
7
|
import { cueFormat, normalizeMimeType } from "./kernel/mime.js";
|
|
8
8
|
import { isAudioDescription, isEnhancedSpeech, isOriginal, isSdh, videoKind } from "./kernel/characteristics.js";
|
|
@@ -16,7 +16,7 @@ import { compose } from "./kernel/loader.js";
|
|
|
16
16
|
import { createMseController, decodable } from "./kernel/mse.js";
|
|
17
17
|
import { createTrackRegistry } from "./kernel/track-registry.js";
|
|
18
18
|
import { createTransport } from "./kernel/transport.js";
|
|
19
|
-
|
|
19
|
+
// src/index.ts
|
|
20
20
|
/**
|
|
21
21
|
* Mattebox: a modular adaptive-streaming engine for HLS and DASH.
|
|
22
22
|
* The public entry: the mattebox() factory composes the kernel with the
|
|
@@ -432,5 +432,4 @@ mattebox.from = (el) => {
|
|
|
432
432
|
var _registry$get;
|
|
433
433
|
return (_registry$get = registry.get(el)) !== null && _registry$get !== void 0 ? _registry$get : null;
|
|
434
434
|
};
|
|
435
|
-
//#endregion
|
|
436
435
|
export { canSwitchTo, createReducer, exportTrace, initialState, isAudioDescription, isEnhancedSpeech, isOriginal, isSdh, mattebox, replay, resolveConfig, videoKind };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
// src/kernel/append-queue.ts
|
|
3
3
|
function isQuotaError(err) {
|
|
4
4
|
return err instanceof DOMException && err.name === "QuotaExceededError";
|
|
5
5
|
}
|
|
@@ -144,5 +144,4 @@ function createAppendQueue(sbId, sb, cb) {
|
|
|
144
144
|
idle: () => !destroyed && ops.length === 0 && !sb.updating
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
//#endregion
|
|
148
147
|
export { createAppendQueue };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/kernel/base64.ts
|
|
2
2
|
/**
|
|
3
3
|
* Byte encodings, one copy each: base64 (RFC 4648 §4) and base64url (§5)
|
|
4
4
|
* for manifest pssh boxes and license bodies, and hex for codec strings,
|
|
@@ -32,5 +32,4 @@ function bytesToHex(bytes) {
|
|
|
32
32
|
for (const byte of bytes) out += byteToHex(byte);
|
|
33
33
|
return out;
|
|
34
34
|
}
|
|
35
|
-
//#endregion
|
|
36
35
|
export { base64ToBytes, byteToHex, bytesToBase64, bytesToHex };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createTraceBuffer, digest, lighten } from "./trace.js";
|
|
2
|
-
|
|
2
|
+
// src/kernel/bus.ts
|
|
3
3
|
function createBus(options) {
|
|
4
4
|
var _options$now, _options$traceCapacit;
|
|
5
5
|
let reducer = options.reducer;
|
|
@@ -135,5 +135,4 @@ function createBus(options) {
|
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
-
//#endregion
|
|
139
138
|
export { createBus };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/kernel/characteristics.ts
|
|
2
2
|
function has(track, tag) {
|
|
3
3
|
var _track$characteristic;
|
|
4
4
|
return ((_track$characteristic = track.characteristics) === null || _track$characteristic === void 0 ? void 0 : _track$characteristic.includes(tag)) === true;
|
|
@@ -41,5 +41,4 @@ function videoKind(track) {
|
|
|
41
41
|
if (roles.includes("alternate")) return "alternative";
|
|
42
42
|
return "";
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { isAudioDescription, isEnhancedSpeech, isOriginal, isSdh, videoKind };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/kernel/context.ts
|
|
2
2
|
/**
|
|
3
3
|
* Builds one stage's context and returns the registrations' own teardown,
|
|
4
4
|
* combined by the caller with whatever the stage's install returns.
|
|
@@ -110,5 +110,4 @@ function createStageContext(deps) {
|
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
//#endregion
|
|
114
113
|
export { createStageContext };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { createBus } from "./bus.js";
|
|
3
3
|
import { createEffectRunner } from "./effects.js";
|
|
4
4
|
import { createSegmentPreparer } from "./prepare.js";
|
|
5
5
|
import { createReducer, initialState } from "./reducer.js";
|
|
6
|
-
|
|
6
|
+
// src/kernel/dry-run.ts
|
|
7
7
|
/** The whole run ends here, whatever it has fetched: a preload must not outlive its use. */
|
|
8
8
|
const LIMIT_MS = 1e4;
|
|
9
9
|
/** Ranges this close are one range, as a SourceBuffer reports them. */
|
|
@@ -175,5 +175,4 @@ function dryRun(deps, url, options) {
|
|
|
175
175
|
}, options.mimeType !== void 0 ? { mimeType: options.mimeType } : {}));
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
//#endregion
|
|
179
178
|
export { dryRun };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/kernel/effects.ts
|
|
2
2
|
/**
|
|
3
3
|
* A schedule effect: `then` re-enters the bus after `delayMs`, or at once.
|
|
4
4
|
* The token names the timer, so an abort under it cancels the timer; each
|
|
@@ -78,5 +78,4 @@ function createEffectRunner(options = {}) {
|
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
//#endregion
|
|
82
81
|
export { createEffectRunner, scheduled, tickAfter };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/kernel/evictor.ts
|
|
2
2
|
const DEFAULT_BACK_BUFFER = 30;
|
|
3
3
|
const DEFAULT_MAX_PASSES = 3;
|
|
4
4
|
/** Seconds behind the playhead that are never removed. */
|
|
@@ -63,5 +63,4 @@ function createEvictor(options = {}) {
|
|
|
63
63
|
streaming: () => streaming
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
//#endregion
|
|
67
66
|
export { createEvictor };
|