mattebox 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/cdn/mattebox.dash-drm.min.js +3 -3
- package/dist/cdn/mattebox.dash-ll.min.js +3 -3
- package/dist/cdn/mattebox.dash.min.js +2 -2
- package/dist/cdn/mattebox.dual-drm.min.js +3 -3
- package/dist/cdn/mattebox.dual-ll.min.js +3 -3
- 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 +3 -3
- package/dist/cdn/mattebox.hls-drm.min.js +3 -3
- package/dist/cdn/mattebox.hls-ll.min.js +3 -3
- 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 +3 -3
- package/dist/cdn/mattebox.kernel.min.js +1 -1
- package/dist/cdn/mattebox.min.js +5 -5
- package/dist/containers/projection.d.ts +56 -0
- package/dist/containers/projection.d.ts.map +1 -0
- package/dist/containers/projection.js +105 -0
- package/dist/containers/projection.js.map +1 -0
- package/dist/containers/webm/cues.d.ts +59 -0
- package/dist/containers/webm/cues.d.ts.map +1 -0
- package/dist/containers/webm/cues.js +218 -0
- package/dist/containers/webm/cues.js.map +1 -0
- package/dist/containers/webm/index.d.ts +36 -0
- package/dist/containers/webm/index.d.ts.map +1 -0
- package/dist/containers/webm/index.js +271 -0
- package/dist/containers/webm/index.js.map +1 -0
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/objectWithoutProperties.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/toPrimitive.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/typeof.js +1 -1
- package/dist/es2015/containers/emsg.js +2 -2
- package/dist/es2015/containers/fmp4/fit.js +1 -1
- package/dist/es2015/containers/fmp4/writer.js +1 -1
- package/dist/es2015/containers/id3.js +1 -1
- package/dist/es2015/containers/mp4-box/index.js +2 -2
- package/dist/es2015/containers/projection.js +107 -0
- package/dist/es2015/containers/scte35.js +1 -1
- package/dist/es2015/containers/sei.js +1 -1
- package/dist/es2015/containers/ts-transmux/demux.js +1 -1
- package/dist/es2015/containers/ts-transmux/h264.js +1 -1
- package/dist/es2015/containers/ts-transmux/h265.js +1 -1
- package/dist/es2015/containers/ts-transmux/index.js +1 -1
- package/dist/es2015/containers/ts-transmux/runner.js +2 -2
- package/dist/es2015/containers/ts-transmux/transmux.js +1 -1
- package/dist/es2015/containers/webm/cues.js +197 -0
- package/dist/es2015/containers/webm/index.js +255 -0
- package/dist/es2015/containers/webvtt.js +1 -1
- package/dist/es2015/containers/wvtt.js +1 -1
- package/dist/es2015/eme/index.js +3 -3
- package/dist/es2015/index.js +2 -2
- package/dist/es2015/kernel/append-queue.js +1 -1
- package/dist/es2015/kernel/dry-run.js +1 -1
- package/dist/es2015/kernel/mse.js +1 -1
- package/dist/es2015/kernel/prepare.js +2 -2
- package/dist/es2015/kernel/reducer.js +53 -4
- package/dist/es2015/kernel/refresh.js +1 -1
- package/dist/es2015/kernel/rendition-select.js +2 -2
- package/dist/es2015/kernel/scheduler.js +1 -1
- package/dist/es2015/kernel/timeline.js +1 -1
- package/dist/es2015/kernel/trace.js +2 -2
- package/dist/es2015/kernel/transport.js +2 -2
- package/dist/es2015/presets/define.js +2 -2
- package/dist/es2015/presets/full/index.js +6 -3
- package/dist/es2015/presets/tiers/dash-ll.js +2 -1
- package/dist/es2015/presets/tiers/dash.js +7 -2
- package/dist/es2015/protocols/dash-cmaf/index.js +12 -6
- package/dist/es2015/protocols/dash-cmaf/parse.js +102 -50
- package/dist/es2015/protocols/dash-cmaf/periods-runtime.js +1 -1
- package/dist/es2015/protocols/dash-cmaf/periods.js +1 -1
- package/dist/es2015/protocols/dash-live/index.js +9 -6
- package/dist/es2015/protocols/dash-ll/index.js +3 -2
- package/dist/es2015/protocols/hls-cmaf/index.js +1 -1
- package/dist/es2015/protocols/hls-cmaf/parse.js +1 -1
- package/dist/es2015/protocols/hls-cmaf/unavailable.js +1 -1
- package/dist/es2015/protocols/hls-live/index.js +1 -1
- package/dist/es2015/protocols/hls-ll/parse.js +1 -1
- package/dist/es2015/stages/abr/index.js +1 -1
- package/dist/es2015/stages/aes-128/index.js +1 -1
- package/dist/es2015/stages/chapters/index.js +2 -2
- package/dist/es2015/stages/chapters/parse.js +2 -2
- package/dist/es2015/stages/cmcd/index.js +1 -2
- package/dist/es2015/stages/codec-probe/index.js +1 -1
- package/dist/es2015/stages/content-steering/index.js +1 -1
- package/dist/es2015/stages/eme-core/index.js +2 -2
- package/dist/es2015/stages/eme-fairplay/index.js +1 -1
- package/dist/es2015/stages/hdr/index.js +1 -1
- package/dist/es2015/stages/interstitials/breaks.js +1 -1
- package/dist/es2015/stages/interstitials/index.js +2 -2
- package/dist/es2015/stages/projection/index.js +51 -0
- package/dist/es2015/stages/qoe/index.js +1 -1
- package/dist/es2015/stages/recovery/index.js +1 -1
- package/dist/es2015/stages/rendition-names/index.js +1 -1
- package/dist/es2015/stages/text-cea608/decode.js +1 -1
- package/dist/es2015/stages/text-cea708/decode.js +2 -2
- package/dist/es2015/stages/text-cea708/index.js +1 -1
- package/dist/es2015/stages/text-ttml/index.js +1 -1
- package/dist/es2015/stages/text-ttml/parse.js +1 -1
- package/dist/es2015/stages/thumbnails/index.js +1 -1
- package/dist/es2015/stages/timed-metadata/index.js +1 -1
- package/dist/es2015/stages/trick-play/index.js +1 -1
- package/dist/kernel/reducer.d.ts.map +1 -1
- package/dist/kernel/reducer.js +69 -1
- package/dist/kernel/reducer.js.map +1 -1
- package/dist/presets/full/index.d.ts.map +1 -1
- package/dist/presets/full/index.js +5 -2
- package/dist/presets/full/index.js.map +1 -1
- package/dist/presets/tiers/dash-ll.d.ts.map +1 -1
- package/dist/presets/tiers/dash-ll.js +2 -1
- package/dist/presets/tiers/dash-ll.js.map +1 -1
- package/dist/presets/tiers/dash.d.ts +7 -1
- package/dist/presets/tiers/dash.d.ts.map +1 -1
- package/dist/presets/tiers/dash.js +3 -2
- package/dist/presets/tiers/dash.js.map +1 -1
- package/dist/protocols/dash-cmaf/index.d.ts +8 -3
- package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/index.js +12 -5
- package/dist/protocols/dash-cmaf/index.js.map +1 -1
- package/dist/protocols/dash-cmaf/parse.d.ts +6 -1
- package/dist/protocols/dash-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/parse.js +87 -7
- package/dist/protocols/dash-cmaf/parse.js.map +1 -1
- package/dist/protocols/dash-live/index.d.ts +6 -3
- package/dist/protocols/dash-live/index.d.ts.map +1 -1
- package/dist/protocols/dash-live/index.js +7 -4
- package/dist/protocols/dash-live/index.js.map +1 -1
- package/dist/protocols/dash-ll/index.d.ts.map +1 -1
- package/dist/protocols/dash-ll/index.js +3 -2
- package/dist/protocols/dash-ll/index.js.map +1 -1
- package/dist/stages/eme-wiseplay/index.d.ts +3 -2
- package/dist/stages/eme-wiseplay/index.d.ts.map +1 -1
- package/dist/stages/eme-wiseplay/index.js.map +1 -1
- package/dist/stages/projection/index.d.ts +3 -0
- package/dist/stages/projection/index.d.ts.map +1 -0
- package/dist/stages/projection/index.js +57 -0
- package/dist/stages/projection/index.js.map +1 -0
- package/dist/types/ir.d.ts +16 -1
- package/dist/types/ir.d.ts.map +1 -1
- package/dist/types/kernel.d.ts +5 -1
- package/dist/types/kernel.d.ts.map +1 -1
- package/dist/types/kernel.js.map +1 -1
- package/dist/types/messages.d.ts +23 -1
- package/dist/types/messages.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebM segments in DASH. MSE takes `video/webm` and `audio/webm` as they
|
|
3
|
+
* are (W3C WebM Byte Stream Format,
|
|
4
|
+
* https://www.w3.org/TR/mse-byte-stream-format-webm/), so nothing is
|
|
5
|
+
* rewrapped. The stage does two things:
|
|
6
|
+
*
|
|
7
|
+
* - It provides the `video/webm` and `audio/webm` content handlers, so the
|
|
8
|
+
* DASH adapters keep WebM Representations instead of leaving them out.
|
|
9
|
+
* - It resolves a WebM `SegmentBase`: it fetches the initialization range
|
|
10
|
+
* and the Cues at `indexRange`, and turns them into one byte-range
|
|
11
|
+
* segment per Cluster, as Shaka Player and dash.js do.
|
|
12
|
+
*
|
|
13
|
+
* A `SegmentTemplate` WebM Representation needs no index and plays from
|
|
14
|
+
* the MPD alone. Inert module: exports a factory, registers nothing at
|
|
15
|
+
* import time.
|
|
16
|
+
*/
|
|
17
|
+
import { scheduled, tickAfter } from '../../kernel/effects.js';
|
|
18
|
+
import { findRendition } from '../../kernel/presentation.js';
|
|
19
|
+
import { activeRenditions } from '../../kernel/rendition-select.js';
|
|
20
|
+
import { isUnresolved } from '../../kernel/timeline.js';
|
|
21
|
+
import { cuesToSegments, readCues, readInit } from './cues.js';
|
|
22
|
+
/** The fetch of a rendition's initialization range: `webm:init:<renditionId>`. */
|
|
23
|
+
const INIT_TOKEN = 'webm:init:';
|
|
24
|
+
/** The fetch of a rendition's Cues: `webm:cues:<renditionId>`. */
|
|
25
|
+
const CUES_TOKEN = 'webm:cues:';
|
|
26
|
+
/** A failed index's retry: `webm:retry:<renditionId>`. */
|
|
27
|
+
const RETRY_TOKEN = 'webm:retry:';
|
|
28
|
+
/** The constraint source that excludes renditions whose index failed. */
|
|
29
|
+
const UNAVAILABLE = 'webm:unavailable';
|
|
30
|
+
/** The default wait before a failed index is tried again, as the DASH adapter waits. */
|
|
31
|
+
const RETRY_SECONDS = 15;
|
|
32
|
+
/** The slice before any load. */
|
|
33
|
+
const INITIAL = { pending: {}, asked: {}, inits: {}, cues: {}, failed: {}, seen: '' };
|
|
34
|
+
/** WebM `SegmentBase` addressing not resolved yet, or null for anything else. */
|
|
35
|
+
function asWebm(addressing) {
|
|
36
|
+
return addressing !== undefined && isUnresolved(addressing) && addressing.format === 'webm'
|
|
37
|
+
? addressing
|
|
38
|
+
: null;
|
|
39
|
+
}
|
|
40
|
+
/** Loops a message back into the bus through a zero-delay schedule effect. */
|
|
41
|
+
function feed(message) {
|
|
42
|
+
return scheduled('webm:loopback', message);
|
|
43
|
+
}
|
|
44
|
+
/** A copy of `record` without `key`. */
|
|
45
|
+
function without(record, key) {
|
|
46
|
+
const copy = { ...record };
|
|
47
|
+
delete copy[key];
|
|
48
|
+
return copy;
|
|
49
|
+
}
|
|
50
|
+
/** The slice with every trace of one rendition's index gone, its in-flight tokens too. */
|
|
51
|
+
function forget(state, renditionId) {
|
|
52
|
+
const pending = { ...state.pending };
|
|
53
|
+
delete pending[`${INIT_TOKEN}${renditionId}`];
|
|
54
|
+
delete pending[`${CUES_TOKEN}${renditionId}`];
|
|
55
|
+
return {
|
|
56
|
+
...state,
|
|
57
|
+
pending,
|
|
58
|
+
asked: without(state.asked, renditionId),
|
|
59
|
+
inits: without(state.inits, renditionId),
|
|
60
|
+
cues: without(state.cues, renditionId),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** The error a WebM index that cannot be read reports. */
|
|
64
|
+
function invalid(renditionId, reason) {
|
|
65
|
+
return {
|
|
66
|
+
category: 'media',
|
|
67
|
+
code: 'MEDIA_CONTAINER_INVALID',
|
|
68
|
+
fatal: false,
|
|
69
|
+
recoverable: false,
|
|
70
|
+
context: { renditionId, reason },
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* An index that failed to load or could not be read. The rendition is
|
|
75
|
+
* excluded until its retry, as the DASH adapter does for a `sidx`. When
|
|
76
|
+
* that leaves a media track with no rendition, the load fails.
|
|
77
|
+
*/
|
|
78
|
+
function unavailable(state, kernel, renditionId, error, retryMs) {
|
|
79
|
+
const failed = { ...state.failed, [renditionId]: true };
|
|
80
|
+
const next = { ...forget(state, renditionId), failed };
|
|
81
|
+
const effects = [
|
|
82
|
+
{
|
|
83
|
+
kind: 'emit',
|
|
84
|
+
event: 'error',
|
|
85
|
+
payload: {
|
|
86
|
+
category: error.category,
|
|
87
|
+
code: error.code,
|
|
88
|
+
fatal: false,
|
|
89
|
+
recoverable: false,
|
|
90
|
+
renditionId,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
const track = kernel.presentation === null ? null : findRendition(kernel.presentation, renditionId)?.track;
|
|
95
|
+
const media = track?.contentType === 'video' || track?.contentType === 'audio';
|
|
96
|
+
if (track != null && media && track.renditions.every((r) => r.id in failed)) {
|
|
97
|
+
return [
|
|
98
|
+
next,
|
|
99
|
+
[...effects, feed({ type: 'MANIFEST_FAILED', error: { ...error, fatal: true } })],
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
effects.push(feed({
|
|
103
|
+
type: 'CONSTRAIN',
|
|
104
|
+
source: UNAVAILABLE,
|
|
105
|
+
constraint: { excludeIds: Object.keys(failed) },
|
|
106
|
+
}));
|
|
107
|
+
if (Number.isFinite(retryMs))
|
|
108
|
+
effects.push(tickAfter(`${RETRY_TOKEN}${renditionId}`, retryMs));
|
|
109
|
+
return [next, effects];
|
|
110
|
+
}
|
|
111
|
+
/** The retry of a failed index: the rendition returns to arbitration and is fetched when needed. */
|
|
112
|
+
function retry(state, renditionId) {
|
|
113
|
+
if (!(renditionId in state.failed))
|
|
114
|
+
return [state, []];
|
|
115
|
+
const failed = without(state.failed, renditionId);
|
|
116
|
+
return [
|
|
117
|
+
{ ...state, failed },
|
|
118
|
+
[
|
|
119
|
+
feed({
|
|
120
|
+
type: 'CONSTRAIN',
|
|
121
|
+
source: UNAVAILABLE,
|
|
122
|
+
constraint: { excludeIds: Object.keys(failed) },
|
|
123
|
+
}),
|
|
124
|
+
],
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* One fetched part of an index. Once both parts of a rendition are read,
|
|
129
|
+
* its segments go to the kernel as a PLAYLIST_REFRESHED, which merges them
|
|
130
|
+
* as it merges a resolved `sidx`.
|
|
131
|
+
*/
|
|
132
|
+
function received(state, kernel, token, bytes, retryMs) {
|
|
133
|
+
const renditionId = state.pending[token];
|
|
134
|
+
let next = { ...state, pending: without(state.pending, token) };
|
|
135
|
+
const rendition = kernel.presentation === null ? null : findRendition(kernel.presentation, renditionId);
|
|
136
|
+
const addressing = asWebm(rendition?.rendition.segments);
|
|
137
|
+
const initRange = rendition?.rendition.init?.byteRange;
|
|
138
|
+
// The rendition left the presentation (a reload replaced it): nothing to do.
|
|
139
|
+
if (addressing === null || initRange === undefined)
|
|
140
|
+
return [forget(next, renditionId), []];
|
|
141
|
+
const data = new Uint8Array(bytes);
|
|
142
|
+
if (token.startsWith(INIT_TOKEN)) {
|
|
143
|
+
const init = readInit(data);
|
|
144
|
+
if (init === null) {
|
|
145
|
+
return unavailable(next, kernel, renditionId, invalid(renditionId, 'no WebM Info'), retryMs);
|
|
146
|
+
}
|
|
147
|
+
next = { ...next, inits: { ...next.inits, [renditionId]: init } };
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
const cues = readCues(data);
|
|
151
|
+
if (cues === null) {
|
|
152
|
+
return unavailable(next, kernel, renditionId, invalid(renditionId, 'no WebM Cues'), retryMs);
|
|
153
|
+
}
|
|
154
|
+
next = { ...next, cues: { ...next.cues, [renditionId]: cues } };
|
|
155
|
+
}
|
|
156
|
+
const init = next.inits[renditionId];
|
|
157
|
+
const cues = next.cues[renditionId];
|
|
158
|
+
if (init === undefined || cues === undefined)
|
|
159
|
+
return [next, []];
|
|
160
|
+
const segments = cuesToSegments(init, initRange, cues, addressing);
|
|
161
|
+
if (segments.length === 0) {
|
|
162
|
+
const reason = 'WebM Cues hold no segment';
|
|
163
|
+
return unavailable(next, kernel, renditionId, invalid(renditionId, reason), retryMs);
|
|
164
|
+
}
|
|
165
|
+
// Stays asked until the merge lands.
|
|
166
|
+
return [
|
|
167
|
+
{ ...next, inits: without(next.inits, renditionId), cues: without(next.cues, renditionId) },
|
|
168
|
+
[
|
|
169
|
+
feed({
|
|
170
|
+
type: 'PLAYLIST_REFRESHED',
|
|
171
|
+
trackId: renditionId,
|
|
172
|
+
renditionId,
|
|
173
|
+
mediaSequence: 0,
|
|
174
|
+
segments,
|
|
175
|
+
}),
|
|
176
|
+
],
|
|
177
|
+
];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The renditions whose index the selection needs and this slice has not
|
|
181
|
+
* asked for: the same set the DASH adapter resolves for a `sidx`, the
|
|
182
|
+
* playing video rendition and its ladder neighbours, and every rendition
|
|
183
|
+
* of the active audio and text tracks.
|
|
184
|
+
*/
|
|
185
|
+
function needed(state, kernel) {
|
|
186
|
+
const out = [];
|
|
187
|
+
const types = ['video', 'audio', 'text'];
|
|
188
|
+
for (const { rendition } of activeRenditions(kernel, types, kernel.quality.active)) {
|
|
189
|
+
if (asWebm(rendition.segments) === null || rendition.init?.byteRange === undefined)
|
|
190
|
+
continue;
|
|
191
|
+
if (rendition.id in state.asked || rendition.id in state.failed)
|
|
192
|
+
continue;
|
|
193
|
+
out.push(rendition);
|
|
194
|
+
}
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
197
|
+
/** The slice reducer. Pure: it reads bytes from facts and answers with effects. */
|
|
198
|
+
export const createReduceWebm = (retryMs) => (slice, msg, kernel) => {
|
|
199
|
+
const state = slice ?? INITIAL;
|
|
200
|
+
if (msg.type === 'LOAD' || msg.type === 'UNLOAD' || msg.type === 'DETACH') {
|
|
201
|
+
return [INITIAL, []];
|
|
202
|
+
}
|
|
203
|
+
if (msg.type === 'TICK' && msg.token.startsWith(RETRY_TOKEN)) {
|
|
204
|
+
return retry(state, msg.token.slice(RETRY_TOKEN.length));
|
|
205
|
+
}
|
|
206
|
+
// The merge landed: the rendition is resolved, or gone.
|
|
207
|
+
if (msg.type === 'PLAYLIST_REFRESHED' && msg.renditionId !== undefined) {
|
|
208
|
+
if (msg.renditionId in state.asked)
|
|
209
|
+
return [forget(state, msg.renditionId), []];
|
|
210
|
+
}
|
|
211
|
+
if (msg.type === 'SEGMENT_LOADED' && msg.trackId in state.pending) {
|
|
212
|
+
return received(state, kernel, msg.trackId, msg.bytes, retryMs);
|
|
213
|
+
}
|
|
214
|
+
if (msg.type === 'SEGMENT_FAILED' && msg.trackId in state.pending) {
|
|
215
|
+
// The transport already retried under its policy.
|
|
216
|
+
const renditionId = state.pending[msg.trackId];
|
|
217
|
+
return unavailable(state, kernel, renditionId, msg.error, retryMs);
|
|
218
|
+
}
|
|
219
|
+
// Look at the selection again when it changed, as the DASH adapter does.
|
|
220
|
+
if (kernel.lifecycle.phase !== 'ready' || kernel.presentation === null)
|
|
221
|
+
return [state, []];
|
|
222
|
+
const key = `${kernel.quality.version}:${kernel.quality.active}`;
|
|
223
|
+
if (key === state.seen && msg.type !== 'RESUME')
|
|
224
|
+
return [state, []];
|
|
225
|
+
const effects = [];
|
|
226
|
+
const pending = { ...state.pending };
|
|
227
|
+
const asked = { ...state.asked };
|
|
228
|
+
for (const rendition of needed(state, kernel)) {
|
|
229
|
+
const addressing = asWebm(rendition.segments);
|
|
230
|
+
const init = rendition.init;
|
|
231
|
+
asked[rendition.id] = true;
|
|
232
|
+
// Both ranges at once: the Cues need the Info's scale and the
|
|
233
|
+
// Segment's start, which only the initialization range holds.
|
|
234
|
+
for (const [prefix, url, range] of [
|
|
235
|
+
[INIT_TOKEN, init.url, init.byteRange],
|
|
236
|
+
[CUES_TOKEN, addressing.url, addressing.indexRange],
|
|
237
|
+
]) {
|
|
238
|
+
const token = `${prefix}${rendition.id}`;
|
|
239
|
+
pending[token] = rendition.id;
|
|
240
|
+
// The rendition rides along so a failure counts toward steering failover.
|
|
241
|
+
effects.push({
|
|
242
|
+
kind: 'fetch',
|
|
243
|
+
token,
|
|
244
|
+
url,
|
|
245
|
+
...(range !== undefined ? { range } : {}),
|
|
246
|
+
renditionId: rendition.id,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return [{ ...state, pending, asked, seen: key }, effects];
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* The stage factory. Add it beside a DASH adapter:
|
|
254
|
+
* `mattebox({ stages: [dashCmaf(), webm()] })`.
|
|
255
|
+
*/
|
|
256
|
+
export default function webm(options = {}) {
|
|
257
|
+
const retryMs = (options.unavailableRetrySeconds ?? RETRY_SECONDS) * 1000;
|
|
258
|
+
return {
|
|
259
|
+
name: 'webm',
|
|
260
|
+
provides: [
|
|
261
|
+
'webm',
|
|
262
|
+
{ contentType: 'video', mimeType: 'video/webm' },
|
|
263
|
+
{ contentType: 'audio', mimeType: 'audio/webm' },
|
|
264
|
+
],
|
|
265
|
+
requires: ['dash-cmaf'],
|
|
266
|
+
install(ctx) {
|
|
267
|
+
ctx.reduce('webm', createReduceWebm(retryMs));
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/containers/web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,CAAC;YACzC,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;YAC9B,0EAA0E;YAC1E,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,OAAO;gBACb,KAAK;gBACL,GAAG;gBACH,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzC,WAAW,EAAE,SAAS,CAAC,EAAE;aAC1B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEJ;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,UAAuB,EAAE;IACpD,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,uBAAuB,IAAI,aAAa,CAAC,GAAG,IAAI,CAAC;IAC1E,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE;YACR,MAAM;YACN,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE;YAChD,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE;SACjD;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;QACvB,OAAO,CAAC,GAAG;YACT,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAiB,CAAC,CAAC;QAChE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import toPropertyKey from "./toPropertyKey.js";
|
|
2
|
-
// \0@oxc-project+runtime@0.
|
|
2
|
+
// \0@oxc-project+runtime@0.159.0/helpers/esm/defineProperty.js
|
|
3
3
|
function _defineProperty(e, r, t) {
|
|
4
4
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5
5
|
value: t,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "./defineProperty.js";
|
|
2
|
-
// \0@oxc-project+runtime@0.
|
|
2
|
+
// \0@oxc-project+runtime@0.159.0/helpers/esm/objectSpread2.js
|
|
3
3
|
function ownKeys(e, r) {
|
|
4
4
|
var t = Object.keys(e);
|
|
5
5
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "./objectWithoutPropertiesLoose.js";
|
|
2
|
-
// \0@oxc-project+runtime@0.
|
|
2
|
+
// \0@oxc-project+runtime@0.159.0/helpers/esm/objectWithoutProperties.js
|
|
3
3
|
function _objectWithoutProperties(e, t) {
|
|
4
4
|
if (null == e) return {};
|
|
5
5
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _typeof from "./typeof.js";
|
|
2
2
|
import toPrimitive from "./toPrimitive.js";
|
|
3
|
-
// \0@oxc-project+runtime@0.
|
|
3
|
+
// \0@oxc-project+runtime@0.159.0/helpers/esm/toPropertyKey.js
|
|
4
4
|
function toPropertyKey(t) {
|
|
5
5
|
var i = toPrimitive(t, "string");
|
|
6
6
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
@@ -30,7 +30,7 @@ function parseEmsg(payload) {
|
|
|
30
30
|
value: value[0],
|
|
31
31
|
timescale: view.getUint32(cursor),
|
|
32
32
|
time: view.getUint32(cursor + 4),
|
|
33
|
-
duration: duration ===
|
|
33
|
+
duration: duration === 0xffffffff ? null : duration,
|
|
34
34
|
id: view.getUint32(cursor + 12),
|
|
35
35
|
data: payload.subarray(cursor + 16)
|
|
36
36
|
};
|
|
@@ -50,7 +50,7 @@ function parseEmsg(payload) {
|
|
|
50
50
|
value: value[0],
|
|
51
51
|
timescale,
|
|
52
52
|
time,
|
|
53
|
-
duration: duration ===
|
|
53
|
+
duration: duration === 0xffffffff ? null : duration,
|
|
54
54
|
id,
|
|
55
55
|
data: payload.subarray(value[1])
|
|
56
56
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { findBox, fragmentSamples, fullBox, viewOf } from "../mp4-box/index.js";
|
|
2
2
|
import { writeMediaSegment } from "./writer.js";
|
|
3
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
|
|
4
4
|
// src/containers/fmp4/fit.ts
|
|
5
5
|
/**
|
|
6
6
|
* The first traf's per-sample encryption entries, null for a clear
|
|
@@ -50,7 +50,7 @@ function concat(...parts) {
|
|
|
50
50
|
}
|
|
51
51
|
return out;
|
|
52
52
|
}
|
|
53
|
-
const UNITY_MATRIX = concat(u32(65536), u32(0), u32(0), u32(0), u32(65536), u32(0), u32(0), u32(0), u32(
|
|
53
|
+
const UNITY_MATRIX = concat(u32(65536), u32(0), u32(0), u32(0), u32(65536), u32(0), u32(0), u32(0), u32(0x40000000));
|
|
54
54
|
function ftyp() {
|
|
55
55
|
return box("ftyp", u8(...fourcc("isom")), u32(512), u8(...fourcc("isom")), u8(...fourcc("iso6")), u8(...fourcc("mp41")));
|
|
56
56
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fourcc } from "./mp4-box/index.js";
|
|
2
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
|
|
3
3
|
// src/containers/id3.ts
|
|
4
4
|
const HEADER_SIZE = 10;
|
|
5
5
|
function isId3(data, offset) {
|
|
@@ -171,9 +171,9 @@ function parseSidx(payload) {
|
|
|
171
171
|
for (let i = 0; i < count; i += 1) {
|
|
172
172
|
const word = view.getUint32(at);
|
|
173
173
|
references.push({
|
|
174
|
-
referencedSize: word &
|
|
174
|
+
referencedSize: word & 0x7fffffff,
|
|
175
175
|
subsegmentDuration: view.getUint32(at + 4),
|
|
176
|
-
startsWithSap: (view.getUint32(at + 8) &
|
|
176
|
+
startsWithSap: (view.getUint32(at + 8) & 0x80000000) !== 0
|
|
177
177
|
});
|
|
178
178
|
at += 12;
|
|
179
179
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { findBox, findBoxes, fourcc, fullBox, sampleEntries, viewOf } from "./mp4-box/index.js";
|
|
2
|
+
// src/containers/projection.ts
|
|
3
|
+
/** A quarter of the sphere's width in 0.32 fixed point: 0.25 × 2³². */
|
|
4
|
+
const QUARTER = 0x40000000;
|
|
5
|
+
/** The box `type` under `parent`, or null. Each step searches one level of children. */
|
|
6
|
+
function under(parent, ...path) {
|
|
7
|
+
let at = parent;
|
|
8
|
+
for (const type of path) {
|
|
9
|
+
var _findBox$payload, _findBox;
|
|
10
|
+
if (at === null) return null;
|
|
11
|
+
at = (_findBox$payload = (_findBox = findBox(at, type)) === null || _findBox === void 0 ? void 0 : _findBox.payload) !== null && _findBox$payload !== void 0 ? _findBox$payload : null;
|
|
12
|
+
}
|
|
13
|
+
return at;
|
|
14
|
+
}
|
|
15
|
+
/** Apple's `prji` kind: `equi` is 360°, `hequ` 180°. */
|
|
16
|
+
function apple(children) {
|
|
17
|
+
var _fullBox;
|
|
18
|
+
const prji = under(children, "vexu", "proj", "prji");
|
|
19
|
+
const body = prji === null ? void 0 : (_fullBox = fullBox(prji)) === null || _fullBox === void 0 ? void 0 : _fullBox.body;
|
|
20
|
+
if (body === void 0 || body.byteLength < 4) return null;
|
|
21
|
+
const kind = fourcc(body, 0);
|
|
22
|
+
return kind === "equi" ? "equirectangular" : kind === "hequ" ? "half-equirectangular" : null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Google's `equi` bounds. Nothing cropped is the whole sphere. A quarter
|
|
26
|
+
* cropped from the left and from the right leaves the front half, 180°
|
|
27
|
+
* wide and full height: what a half-equirectangular picture covers.
|
|
28
|
+
*/
|
|
29
|
+
function google(children) {
|
|
30
|
+
var _fullBox2;
|
|
31
|
+
const equi = under(children, "sv3d", "proj", "equi");
|
|
32
|
+
const body = equi === null ? void 0 : (_fullBox2 = fullBox(equi)) === null || _fullBox2 === void 0 ? void 0 : _fullBox2.body;
|
|
33
|
+
if (body === void 0 || body.byteLength < 16) return null;
|
|
34
|
+
const view = viewOf(body);
|
|
35
|
+
const [top, bottom, left, right] = [
|
|
36
|
+
0,
|
|
37
|
+
4,
|
|
38
|
+
8,
|
|
39
|
+
12
|
|
40
|
+
].map((at) => view.getUint32(at));
|
|
41
|
+
if (top !== 0 || bottom !== 0) return null;
|
|
42
|
+
if (left === 0 && right === 0) return "equirectangular";
|
|
43
|
+
return left === QUARTER && right === QUARTER ? "half-equirectangular" : null;
|
|
44
|
+
}
|
|
45
|
+
/** Apple's `pkin` kind, with the left eye first: `side` is side by side, `over` top and bottom. */
|
|
46
|
+
function applePacking(children) {
|
|
47
|
+
var _fullBox3, _fullBox4;
|
|
48
|
+
const pkin = under(children, "vexu", "pack", "pkin");
|
|
49
|
+
const body = pkin === null ? void 0 : (_fullBox3 = fullBox(pkin)) === null || _fullBox3 === void 0 ? void 0 : _fullBox3.body;
|
|
50
|
+
if (body === void 0 || body.byteLength < 4) return null;
|
|
51
|
+
const stri = under(children, "vexu", "eyes", "stri");
|
|
52
|
+
const flags = stri === null ? void 0 : (_fullBox4 = fullBox(stri)) === null || _fullBox4 === void 0 ? void 0 : _fullBox4.body;
|
|
53
|
+
if (flags !== void 0 && flags.byteLength > 0 && (flags[0] & 8) !== 0) return null;
|
|
54
|
+
const kind = fourcc(body, 0);
|
|
55
|
+
return kind === "side" ? "side-by-side" : kind === "over" ? "top-bottom" : null;
|
|
56
|
+
}
|
|
57
|
+
/** Google's `stereo_mode`: 1 is top and bottom, 2 left and right. */
|
|
58
|
+
function googlePacking(children) {
|
|
59
|
+
var _findBox2, _fullBox5;
|
|
60
|
+
const st3d = (_findBox2 = findBox(children, "st3d")) === null || _findBox2 === void 0 ? void 0 : _findBox2.payload;
|
|
61
|
+
const body = st3d === void 0 ? void 0 : (_fullBox5 = fullBox(st3d)) === null || _fullBox5 === void 0 ? void 0 : _fullBox5.body;
|
|
62
|
+
if (body === void 0 || body.byteLength < 1) return null;
|
|
63
|
+
return body[0] === 1 ? "top-bottom" : body[0] === 2 ? "side-by-side" : null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* What `read` finds in the first video track's sample entries, given the
|
|
67
|
+
* boxes after each entry's fixed header, or null. Never throws.
|
|
68
|
+
*/
|
|
69
|
+
function inVideoEntry(init, read) {
|
|
70
|
+
for (const trak of findBoxes(init, "moov/trak")) {
|
|
71
|
+
var _fullBox6;
|
|
72
|
+
const hdlr = findBox(trak.payload, "mdia/hdlr");
|
|
73
|
+
const handler = hdlr === null ? void 0 : (_fullBox6 = fullBox(hdlr.payload)) === null || _fullBox6 === void 0 ? void 0 : _fullBox6.body;
|
|
74
|
+
if (handler === void 0 || handler.byteLength < 8 || fourcc(handler, 4) !== "vide") continue;
|
|
75
|
+
const stsd = findBox(trak.payload, "mdia/minf/stbl/stsd");
|
|
76
|
+
if (stsd === null) continue;
|
|
77
|
+
for (const entry of sampleEntries(stsd.payload)) {
|
|
78
|
+
if (entry.body.byteLength < 78) continue;
|
|
79
|
+
const found = read(entry.body.subarray(78));
|
|
80
|
+
if (found !== null) return found;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The projection the first video track's sample entry states, or null for
|
|
87
|
+
* a flat picture, another projection, or bytes that are not an init
|
|
88
|
+
* segment. Never throws.
|
|
89
|
+
*/
|
|
90
|
+
function readProjection(init) {
|
|
91
|
+
return inVideoEntry(init, (children) => {
|
|
92
|
+
var _apple;
|
|
93
|
+
return (_apple = apple(children)) !== null && _apple !== void 0 ? _apple : google(children);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The frame packing the first video track's sample entry states, or null
|
|
98
|
+
* for one picture a frame, a packing with the right eye first, or bytes
|
|
99
|
+
* that are not an init segment. Never throws.
|
|
100
|
+
*/
|
|
101
|
+
function readFramePacking(init) {
|
|
102
|
+
return inVideoEntry(init, (children) => {
|
|
103
|
+
var _applePacking;
|
|
104
|
+
return (_applePacking = applePacking(children)) !== null && _applePacking !== void 0 ? _applePacking : googlePacking(children);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
export { readFramePacking, readProjection };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
// src/containers/scte35.ts
|
|
3
3
|
const TABLE_ID = 252;
|
|
4
4
|
const SPLICE_INSERT = 5;
|
|
@@ -54,7 +54,7 @@ function ccTriplesFromSei(seiNal, headerLength = 1) {
|
|
|
54
54
|
}
|
|
55
55
|
return triples;
|
|
56
56
|
}
|
|
57
|
-
const GA94 =
|
|
57
|
+
const GA94 = 0x47413934;
|
|
58
58
|
function appendAtscCc(payload, out) {
|
|
59
59
|
if (payload.byteLength < 10) return;
|
|
60
60
|
const view = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
|
|
@@ -38,7 +38,7 @@ function readTimestamp(data, offset) {
|
|
|
38
38
|
const high = b0 >> 1 & 7;
|
|
39
39
|
const mid = (b1 << 7 | b2 >> 1) & 32767;
|
|
40
40
|
const low = (b3 << 7 | b4 >> 1) & 32767;
|
|
41
|
-
return high *
|
|
41
|
+
return high * 0x40000000 + mid * 32768 + low;
|
|
42
42
|
}
|
|
43
43
|
/** Parses one completed PES accumulator into a packet with timestamps. */
|
|
44
44
|
function finishPes(acc) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toRbsp } from "../sei.js";
|
|
2
|
-
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/defineProperty.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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toRbsp } from "../sei.js";
|
|
2
|
-
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/defineProperty.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
|
|
@@ -4,7 +4,7 @@ import { deliverMetadata, metadataWanted } from "../metadata.js";
|
|
|
4
4
|
import { createTransmuxRunner } from "./runner.js";
|
|
5
5
|
import { looksLikeTransportStream } from "./sniff.js";
|
|
6
6
|
import { transmuxSource } from "./source.js";
|
|
7
|
-
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.
|
|
7
|
+
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
|
|
2
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
|
|
3
3
|
// src/containers/ts-transmux/runner.ts
|
|
4
4
|
function createTransmuxRunner(options, source) {
|
|
5
5
|
let worker = null;
|
|
@@ -4,7 +4,7 @@ import { ccTriplesFromSei } from "../sei.js";
|
|
|
4
4
|
import { STREAM_TYPE, demux, unrollTimestamps } from "./demux.js";
|
|
5
5
|
import { NAL_TYPE, accessUnitFromNals, nalType, splitNalUnits, spsDimensions, toAccessUnit } from "./h264.js";
|
|
6
6
|
import { HEVC_NAL_TYPE, hevcAccessUnitFromNals, hevcDecoderConfiguration, hevcNalType, hevcSpsInfo } from "./h265.js";
|
|
7
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
7
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.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
|