alpha2 0.4.5 → 0.5.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 +5 -4
- package/THIRD_PARTY_NOTICES.md +4 -0
- package/dist/abort.d.ts +12 -0
- package/dist/abort.js +48 -0
- package/dist/active-clock.d.ts +35 -0
- package/dist/active-clock.js +99 -0
- package/dist/assets.d.ts +28 -22
- package/dist/assets.js +8 -12
- package/dist/audio-layout.d.ts +52 -74
- package/dist/audio-layout.js +114 -148
- package/dist/audio-timeline.d.ts +89 -117
- package/dist/audio-timeline.js +102 -118
- package/dist/audio-worker.d.ts +12 -21
- package/dist/audio-worker.js +8 -13
- package/dist/audio-worklet-processor.js +45 -58
- package/dist/audio-worklet.d.ts +45 -76
- package/dist/audio-worklet.js +44 -79
- package/dist/audio.d.ts +15 -23
- package/dist/audio.js +9 -13
- package/dist/builder.d.ts +45 -63
- package/dist/builder.js +49 -45
- package/dist/capabilities.d.ts +99 -16
- package/dist/capabilities.js +2 -2
- package/dist/captions.d.ts +45 -22
- package/dist/captions.js +60 -15
- package/dist/chroma-siting.d.ts +24 -41
- package/dist/chroma-siting.js +38 -71
- package/dist/containers.d.ts +41 -30
- package/dist/containers.js +59 -27
- package/dist/decoder-fallback.d.ts +13 -0
- package/dist/decoder-fallback.js +38 -0
- package/dist/decoder-order.d.ts +24 -39
- package/dist/decoder-order.js +28 -42
- package/dist/edit.d.ts +77 -154
- package/dist/edit.js +98 -180
- package/dist/effects.d.ts +109 -173
- package/dist/effects.js +7 -9
- package/dist/export-destination.d.ts +25 -41
- package/dist/export-destination.js +20 -32
- package/dist/export-failure.d.ts +34 -59
- package/dist/export-failure.js +54 -48
- package/dist/export-metrics.d.ts +116 -0
- package/dist/export-metrics.js +74 -0
- package/dist/export-retry.d.ts +46 -29
- package/dist/export-retry.js +86 -51
- package/dist/exporter.d.ts +67 -116
- package/dist/exporter.js +133 -133
- package/dist/extensions.d.ts +69 -115
- package/dist/extensions.js +55 -82
- package/dist/frame-intake.d.ts +92 -0
- package/dist/frame-intake.js +114 -0
- package/dist/frame-supply.d.ts +98 -157
- package/dist/frame-supply.js +191 -162
- package/dist/generated/project-schema.d.ts +742 -464
- package/dist/generated/project-schema.js +63 -2
- package/dist/generated/project-shape.js +663 -118
- package/dist/geometry.d.ts +28 -34
- package/dist/geometry.js +18 -23
- package/dist/gpu-recovery.d.ts +92 -0
- package/dist/gpu-recovery.js +135 -0
- package/dist/hdr-frames.d.ts +88 -62
- package/dist/hdr-frames.js +123 -46
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/json-text.d.ts +13 -23
- package/dist/json-text.js +10 -20
- package/dist/layout-values.d.ts +14 -22
- package/dist/layout-values.js +18 -21
- package/dist/layout.d.ts +55 -55
- package/dist/layout.js +37 -36
- package/dist/loudness.d.ts +27 -32
- package/dist/loudness.js +19 -23
- package/dist/media.d.ts +85 -237
- package/dist/media.js +133 -287
- package/dist/mediabunny.d.ts +173 -237
- package/dist/mediabunny.js +943 -518
- package/dist/physical-frames.d.ts +5 -17
- package/dist/physical-frames.js +4 -11
- package/dist/player.d.ts +56 -47
- package/dist/player.js +155 -40
- package/dist/presented-frames.d.ts +2 -7
- package/dist/presented-frames.js +3 -8
- package/dist/project.d.ts +83 -110
- package/dist/project.js +421 -447
- package/dist/rate-control.d.ts +9 -23
- package/dist/rate-control.js +7 -18
- package/dist/renderer-choice.d.ts +41 -0
- package/dist/renderer-choice.js +82 -0
- package/dist/repacked-bytes.d.ts +0 -2
- package/dist/repacked-bytes.js +2 -5
- package/dist/robustness.d.ts +25 -37
- package/dist/robustness.js +71 -54
- package/dist/sha256.d.ts +5 -13
- package/dist/sha256.js +9 -24
- package/dist/text.d.ts +106 -63
- package/dist/text.js +44 -69
- package/dist/video-frames.d.ts +7 -25
- package/dist/video-frames.js +12 -29
- package/dist/waveform.d.ts +5 -11
- package/dist/waveform.js +4 -9
- package/dist/worker-error.d.ts +5 -20
- package/dist/worker-error.js +8 -25
- package/dist/worker.d.ts +82 -92
- package/dist/worker.js +239 -144
- package/package.json +26 -2
- package/wasm/alpha2_audio_worklet.wasm +0 -0
- package/wasm/alpha2_extensions.d.ts +26 -47
- package/wasm/alpha2_extensions.js +26 -47
- package/wasm/alpha2_extensions_bg.wasm +0 -0
- package/wasm/alpha2_wasm.d.ts +487 -543
- package/wasm/alpha2_wasm.js +669 -572
- package/wasm/alpha2_wasm_bg.wasm +0 -0
- package/wasm/alpha2_wasm_bg.wasm.d.ts +20 -8
- package/wasm/rust-crate-licenses.md +2 -2
- package/wasm/snippets/{alpha2-wasm-57b04ecc6db57e1f → alpha2-wasm-1313375d424845c0}/inline1.js +1 -0
- package/wasm/snippets/alpha2-wasm-1313375d424845c0/inline2.js +82 -0
- package/wasm/snippets/alpha2-wasm-57b04ecc6db57e1f/inline2.js +0 -52
- /package/wasm/snippets/{alpha2-wasm-57b04ecc6db57e1f → alpha2-wasm-1313375d424845c0}/inline0.js +0 -0
- /package/wasm/snippets/{alpha2-wasm-57b04ecc6db57e1f → alpha2-wasm-1313375d424845c0}/inline3.js +0 -0
package/dist/frame-supply.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import type { FrameUploadReceipt } from "./effects.js";
|
|
2
2
|
import { type ChromaSiting, type PlanarYuvEngine, type VideoConversion } from "./hdr-frames.js";
|
|
3
3
|
import { type PresentedFrameEngine } from "./presented-frames.js";
|
|
4
|
+
import { type ReadbackRecoveryStats } from "./frame-intake.js";
|
|
5
|
+
export type { ReadbackRecoveryStats } from "./frame-intake.js";
|
|
4
6
|
/** One decode request the engine reports for a single timeline timestamp (`frameNeeds`). */
|
|
5
7
|
export interface FrameNeed {
|
|
6
|
-
/**
|
|
8
|
+
/** Overlapping clips may report the same source. */
|
|
7
9
|
readonly clipId: string;
|
|
8
10
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
+
* Composition step reading the source; `null` or absent when the clip reads it directly. Each
|
|
12
|
+
* reader has its own decoder cursor.
|
|
11
13
|
*/
|
|
12
14
|
readonly readerId?: string | null;
|
|
13
15
|
readonly sourceId: string;
|
|
14
|
-
/**
|
|
16
|
+
/** Decimal tick string, never a rounded number. */
|
|
15
17
|
readonly mediaTimeTicks: string;
|
|
16
18
|
}
|
|
17
19
|
/** A timeline source as the host knows it. */
|
|
@@ -23,204 +25,167 @@ export interface FrameSupplyLayer {
|
|
|
23
25
|
export interface FrameSupplyVideoFrame {
|
|
24
26
|
readonly kind: "video-frame";
|
|
25
27
|
readonly frame: VideoFrame;
|
|
26
|
-
/**
|
|
27
|
-
* The decoded frame's own timestamp, in microseconds, for sources whose wrapper resets
|
|
28
|
-
* `frame.timestamp`. Defaults to `frame.timestamp`.
|
|
29
|
-
*/
|
|
28
|
+
/** The decoded frame's own timestamp, for wrappers that reset `frame.timestamp`. */
|
|
30
29
|
readonly physicalTimeMicroseconds?: number;
|
|
31
|
-
/**
|
|
32
|
-
* Clockwise stream display rotation, when the container declares one, applied after
|
|
33
|
-
* {@link mirror}.
|
|
34
|
-
*/
|
|
30
|
+
/** Clockwise container display rotation, applied after {@link mirror}. */
|
|
35
31
|
readonly rotation?: 0 | 90 | 180 | 270;
|
|
36
|
-
/**
|
|
32
|
+
/** Mirror left to right before rotating. */
|
|
37
33
|
readonly mirror?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Where chroma samples sit, which WebCodecs does not report: see `chromaSitingForStream`.
|
|
40
|
-
*/
|
|
34
|
+
/** WebCodecs does not report it; see `chromaSitingForStream`. */
|
|
41
35
|
readonly chromaSiting?: ChromaSiting;
|
|
42
36
|
}
|
|
43
37
|
/**
|
|
44
|
-
* A video frame read back to RGBA, for
|
|
45
|
-
*
|
|
38
|
+
* A video frame read back to RGBA, for engines that cannot take a `VideoFrame`. Its identity lets
|
|
39
|
+
* requests for the same decoded frame share one upload.
|
|
46
40
|
*/
|
|
47
41
|
export interface FrameSupplyRgbaFrame {
|
|
48
42
|
readonly kind: "rgba-frame";
|
|
49
43
|
/** RGBA8 at the output size, rows packed. */
|
|
50
44
|
readonly pixels: Uint8Array;
|
|
51
|
-
/**
|
|
45
|
+
/** Safe integer. */
|
|
52
46
|
readonly physicalTimeMicroseconds: number;
|
|
53
|
-
/**
|
|
47
|
+
/** Safe integer. */
|
|
54
48
|
readonly durationMicroseconds?: number;
|
|
55
|
-
/**
|
|
49
|
+
/** Display size before scaling to the output. */
|
|
56
50
|
readonly sourceWidth: number;
|
|
57
51
|
readonly sourceHeight: number;
|
|
58
52
|
readonly rotation?: 0 | 90 | 180 | 270;
|
|
59
53
|
}
|
|
60
54
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* scales it.
|
|
55
|
+
* An extension provider frame at its own size (SVG, animated image, Lottie, OpenEXR, image
|
|
56
|
+
* sequence), which the engine scales into the output.
|
|
64
57
|
*/
|
|
65
58
|
export type FrameSupplyRasterFrame = {
|
|
66
59
|
readonly kind: "raster-frame";
|
|
67
60
|
readonly width: number;
|
|
68
61
|
readonly height: number;
|
|
69
|
-
/**
|
|
62
|
+
/** First source time it shows at, in microseconds; serves as its identity. */
|
|
70
63
|
readonly physicalTimeMicroseconds: number;
|
|
71
64
|
readonly durationMicroseconds?: number;
|
|
72
65
|
} & ({
|
|
73
66
|
readonly precision?: "rgba8";
|
|
74
|
-
/** sRGB RGBA8, rows packed
|
|
67
|
+
/** sRGB RGBA8, rows packed. */
|
|
75
68
|
readonly pixels: Uint8Array;
|
|
76
|
-
/**
|
|
77
|
-
* Whether the pixels' color is premultiplied by their alpha (the default) or straight, as a
|
|
78
|
-
* decoded image's is.
|
|
79
|
-
*/
|
|
69
|
+
/** Default `"premultiplied"`; decoded images are usually `"straight"`. */
|
|
80
70
|
readonly alpha?: "premultiplied" | "straight";
|
|
81
71
|
} | {
|
|
82
72
|
readonly precision: "linear_f16";
|
|
83
73
|
/**
|
|
84
|
-
* Premultiplied linear-light RGBA half
|
|
85
|
-
*
|
|
74
|
+
* Premultiplied linear-light RGBA half-float bits in BT.709 primaries, rows packed. Values
|
|
75
|
+
* outside 0 to 1 are kept.
|
|
86
76
|
*/
|
|
87
77
|
readonly pixels: Uint16Array;
|
|
88
78
|
});
|
|
89
79
|
/**
|
|
90
|
-
* What `pixelsFor` resolves with
|
|
91
|
-
* frame carrying its decoded identity. A video source must not resolve with bare pixels.
|
|
80
|
+
* What `pixelsFor` resolves with. Bare RGBA8 pixels at the output size are only for still images.
|
|
92
81
|
*/
|
|
93
82
|
export type FrameSupplySource = Uint8Array | FrameSupplyVideoFrame | FrameSupplyRgbaFrame | FrameSupplyRasterFrame;
|
|
94
83
|
/** Decode hints for one `pixelsFor` call. */
|
|
95
84
|
export interface FrameSupplyDecodeOptions {
|
|
96
85
|
/** Whether the engine can consume a `VideoFrame` without a readback. */
|
|
97
86
|
readonly preferVideoFrame: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Decoder cursor owner. Overlapping clips sharing one asset must decode
|
|
100
|
-
* through independent cursors; see {@link decoderCursorKey}.
|
|
101
|
-
*/
|
|
87
|
+
/** Decoder cursor owner; see {@link decoderCursorKey}. */
|
|
102
88
|
readonly consumerId: string;
|
|
103
89
|
/**
|
|
104
|
-
* The source the engine asked for
|
|
105
|
-
*
|
|
90
|
+
* The source the engine asked for, which may differ from the layer's (a proxy). Key per-source
|
|
91
|
+
* host state by this, as `liveSourceIds` does.
|
|
106
92
|
*/
|
|
107
93
|
readonly sourceId: string;
|
|
108
94
|
/**
|
|
109
|
-
* `"software"
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
95
|
+
* `"software"` requests a CPU decode on a separate cursor, resolving with a `VideoFrame`. Used
|
|
96
|
+
* after a hardware frame could not be read back, or when a frame the engine must convert has no
|
|
97
|
+
* planar format (then for every later frame of the source). Reject if software decode is
|
|
98
|
+
* unavailable.
|
|
113
99
|
*/
|
|
114
100
|
readonly decode?: "software";
|
|
115
101
|
}
|
|
116
102
|
/** Host callbacks and frame geometry for one `supply` call. */
|
|
117
103
|
export interface FrameSupplyOptions {
|
|
118
|
-
/**
|
|
104
|
+
/** Output size; RGBA pixels must match it. */
|
|
119
105
|
readonly width: number;
|
|
120
106
|
readonly height: number;
|
|
121
107
|
/**
|
|
122
|
-
*
|
|
123
|
-
* provider settings
|
|
124
|
-
*
|
|
125
|
-
* source keeps its uploads across project loads. Without it a source's pixels never change while
|
|
126
|
-
* it stays in the project, which is the engine's own rule: media that changes under an unchanged
|
|
127
|
-
* locator needs a new source ID.
|
|
108
|
+
* A value that changes (by `Object.is`) exactly when a source's pixels do, such as new media,
|
|
109
|
+
* provider settings or a proxy swap. A change drops that source's uploads here and in the engine.
|
|
110
|
+
* Without it, a source's pixels are assumed fixed while it stays in the project.
|
|
128
111
|
*/
|
|
129
112
|
readonly contentOf?: (sourceId: string) => unknown;
|
|
130
|
-
/** Sources still
|
|
113
|
+
/** Sources still in the project; others have their uploads retired. */
|
|
131
114
|
readonly liveSourceIds: ReadonlySet<string>;
|
|
132
|
-
/**
|
|
115
|
+
/** A missing layer makes `supply` reject. */
|
|
133
116
|
readonly getLayer: (sourceId: string) => FrameSupplyLayer | null | undefined;
|
|
134
117
|
/**
|
|
135
|
-
* Decodes `layer` at `seconds` of source time
|
|
136
|
-
*
|
|
137
|
-
* returned `VideoFrame`.
|
|
118
|
+
* Decodes `layer` at `seconds` of source time, or resolves `null` when there is no frame. The
|
|
119
|
+
* supply takes ownership of a returned `VideoFrame`; a rejection rejects `supply`.
|
|
138
120
|
*/
|
|
139
121
|
readonly pixelsFor: (layer: FrameSupplyLayer, seconds: number, options: FrameSupplyDecodeOptions) => Promise<FrameSupplySource | null>;
|
|
140
122
|
/** Opens or retains one decoder cursor per consumer before decoding starts. */
|
|
141
123
|
readonly retainVideoConsumers?: (consumerIds: ReadonlySet<string>) => Promise<void> | void;
|
|
142
|
-
/**
|
|
143
|
-
* Returns false once an edit, seek, or pause invalidates this request. Asked before each decode,
|
|
144
|
-
* so a replaced request decodes nothing more.
|
|
145
|
-
*/
|
|
124
|
+
/** Returns false once an edit, seek or pause invalidates the request; checked per decode. */
|
|
146
125
|
readonly isCurrent: () => boolean;
|
|
147
126
|
}
|
|
148
127
|
/** Memory envelope for source textures whose render submission has completed. */
|
|
149
128
|
export interface FrameRetentionOptions {
|
|
150
129
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
130
|
+
* Rendered texture bytes kept for reuse. Defaults to 256 MiB; the newest generation is kept even
|
|
131
|
+
* if it alone exceeds this.
|
|
153
132
|
*/
|
|
154
133
|
readonly maxRetiredBytes?: number;
|
|
155
134
|
}
|
|
156
135
|
/** Resource and concurrency limits owned by one frame supplier. */
|
|
157
136
|
export interface FrameSupplyConfig extends FrameRetentionOptions {
|
|
158
|
-
/**
|
|
159
|
-
* Bytes of uploaded stills kept cached, least recently used evicted first. Defaults to 256 MiB.
|
|
160
|
-
*/
|
|
137
|
+
/** Cached still bytes, evicted least recently used first. Defaults to 256 MiB. */
|
|
161
138
|
readonly maxCachedImageBytes?: number;
|
|
162
|
-
/** Maximum
|
|
139
|
+
/** Maximum concurrent decoder cursors. Defaults to 2. */
|
|
163
140
|
readonly maxDecodeConcurrency?: number;
|
|
164
|
-
/**
|
|
165
|
-
* Who converts a decoded SDR `VideoFrame`: the engine, from its planes (`"engine"`, the
|
|
166
|
-
* default), or the browser (`"browser"`); see {@link VideoConversion}.
|
|
167
|
-
*/
|
|
141
|
+
/** See {@link VideoConversion}. Defaults to `"engine"`. */
|
|
168
142
|
readonly videoConversion?: VideoConversion;
|
|
169
143
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* for a preview, where a frame shown at once matters more than the engine's conversion.
|
|
144
|
+
* Fallback for a frame whose planes still cannot be read back after retries. `"redecode"`
|
|
145
|
+
* (default) decodes it again in software; `"present"` hands it to the browser's conversion
|
|
146
|
+
* unless the engine must convert it, trading accuracy for preview latency. Required frames with
|
|
147
|
+
* no planar format always redecode.
|
|
175
148
|
*/
|
|
176
149
|
readonly unreadableFrames?: "redecode" | "present";
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
readonly redecodedFrames: number;
|
|
186
|
-
/** Frames given to the browser's conversion (`unreadableFrames: "present"`). */
|
|
187
|
-
readonly presentedFrames: number;
|
|
150
|
+
/**
|
|
151
|
+
* Handling of a source the engine must convert (HDR or declared color) when no decoder gives
|
|
152
|
+
* planes. `"refuse"` (default) rejects with `PlanarDecodeUnavailableError`. `"present-degraded"`
|
|
153
|
+
* shows the browser's conversion via `uploadDegradedVideoFrame` and lists the source in
|
|
154
|
+
* `degradedSources`; the engine then refuses to export such frames. Exports should keep
|
|
155
|
+
* `"refuse"`.
|
|
156
|
+
*/
|
|
157
|
+
readonly opaqueEngineFrames?: "refuse" | "present-degraded";
|
|
188
158
|
}
|
|
189
159
|
/**
|
|
190
|
-
* Keeps
|
|
191
|
-
* through `release` when the budget is exceeded.
|
|
160
|
+
* Keeps rendered upload generations within a byte budget, releasing the oldest through `release`.
|
|
192
161
|
*
|
|
193
162
|
* The constructor throws `RangeError` when `maxRetiredBytes` is not a positive safe integer.
|
|
194
163
|
*/
|
|
195
164
|
export declare class FrameGenerationRetainer {
|
|
196
165
|
#private;
|
|
197
166
|
constructor(release: (generation: bigint) => void, options?: FrameRetentionOptions);
|
|
198
|
-
/** Bytes of the generations currently held. */
|
|
199
167
|
get retainedBytes(): number;
|
|
200
168
|
/**
|
|
201
|
-
* Takes over generations
|
|
169
|
+
* Takes over rendered generations, releasing older ones past the budget.
|
|
202
170
|
*
|
|
203
171
|
* @throws RangeError for a receipt with a non-positive generation or byte count.
|
|
204
172
|
*/
|
|
205
173
|
retire(uploads: readonly FrameUploadReceipt[]): void;
|
|
206
|
-
/**
|
|
207
|
-
* Forgets every held generation without releasing it, for when the owning engine has dropped its
|
|
208
|
-
* whole frame store.
|
|
209
|
-
*/
|
|
174
|
+
/** Forgets held generations without releasing them, after the engine dropped its frame store. */
|
|
210
175
|
discardAll(): void;
|
|
211
176
|
}
|
|
212
177
|
/** One upload reported through {@link FrameSupply.onUpload}. */
|
|
213
178
|
export interface FrameUploadTrace {
|
|
214
179
|
readonly sourceId: string;
|
|
215
180
|
readonly mediaTimeTicks: string;
|
|
216
|
-
/**
|
|
181
|
+
/** Sparse 32-bit checksum of the uploaded RGBA pixels. */
|
|
217
182
|
readonly checksum: number;
|
|
218
183
|
}
|
|
219
184
|
/** Uploads accepted by the engine for one timestamp. */
|
|
220
185
|
export interface SuppliedFrame {
|
|
221
|
-
/**
|
|
186
|
+
/** Every need, including those served by an existing upload. */
|
|
222
187
|
readonly needs: readonly FrameNeed[];
|
|
223
|
-
/**
|
|
188
|
+
/** Pass to `retire` once rendered. */
|
|
224
189
|
readonly uploaded: readonly FrameUploadReceipt[];
|
|
225
190
|
}
|
|
226
191
|
/** Outcome of one real-time presentation attempt. */
|
|
@@ -229,19 +194,18 @@ export interface PlaybackResult {
|
|
|
229
194
|
/** `null` until the engine has presented a frame, and after a reset. */
|
|
230
195
|
readonly presentedTimeTicks: number | null;
|
|
231
196
|
readonly missingSources: readonly string[];
|
|
232
|
-
readonly repeated: boolean;
|
|
233
197
|
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
198
|
+
* Sources shown through the browser's conversion (`opaqueEngineFrames: "present-degraded"`); the
|
|
199
|
+
* engine refuses to export them.
|
|
236
200
|
*/
|
|
201
|
+
readonly degradedSources?: readonly string[];
|
|
202
|
+
readonly repeated: boolean;
|
|
203
|
+
/** The frame matched the last one, so nothing was rendered and the canvas is unchanged. */
|
|
237
204
|
readonly unchanged: boolean;
|
|
238
205
|
}
|
|
239
206
|
/**
|
|
240
|
-
* Engine surface this module drives.
|
|
241
|
-
*
|
|
242
|
-
* The wasm `WebEffectRegistry` satisfies it; a worker-side proxy that forwards the same calls does
|
|
243
|
-
* too. Optional methods are probed per call, and a source that needs a missing one makes `supply`
|
|
244
|
-
* reject.
|
|
207
|
+
* Engine surface this module drives, satisfied by the wasm renderer or a forwarding proxy. Optional
|
|
208
|
+
* methods are probed per call; a source that needs a missing one makes `supply` reject.
|
|
245
209
|
*/
|
|
246
210
|
export interface FrameSupplyEngine {
|
|
247
211
|
readonly deviceLost: boolean;
|
|
@@ -252,106 +216,83 @@ export interface FrameSupplyEngine {
|
|
|
252
216
|
uploadPresentedVideoFrame?(sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame, width: number, height: number, rotation: number | undefined, mirror: boolean): FrameUploadReceipt;
|
|
253
217
|
readonly videoFrameCopy?: string;
|
|
254
218
|
uploadPresentedImageBitmap?: PresentedFrameEngine["uploadPresentedImageBitmap"];
|
|
255
|
-
/**
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
* the supply leaves SDR to the browser.
|
|
259
|
-
*/
|
|
219
|
+
/** Presents a frame through the browser's conversion and marks its source degraded. */
|
|
220
|
+
uploadDegradedVideoFrame?(sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame, width: number, height: number, rotation: number, mirror: boolean): FrameUploadReceipt;
|
|
221
|
+
/** Converts planar YUV with the project's color pipeline; used for all HDR frames. */
|
|
260
222
|
uploadYuvFrame?: PlanarYuvEngine["uploadYuvFrame"];
|
|
261
223
|
/** Presents a premultiplied or straight RGBA8 frame at its own size into the output. */
|
|
262
224
|
uploadPresentedRgbaFrame?: (sourceId: string, mediaTimeTicks: bigint, width: number, height: number, pixels: Uint8Array, premultiplied: boolean, outputWidth: number, outputHeight: number) => FrameUploadReceipt;
|
|
263
225
|
/** Like `uploadPresentedRgbaFrame`, for a still shown at every time. */
|
|
264
226
|
uploadPresentedRgbaImage?: (sourceId: string, width: number, height: number, pixels: Uint8Array, premultiplied: boolean, outputWidth: number, outputHeight: number) => FrameUploadReceipt;
|
|
265
|
-
/**
|
|
266
|
-
* Presents a premultiplied linear-light RGBA half-float frame at its own size into the output.
|
|
267
|
-
*/
|
|
227
|
+
/** Presents a premultiplied linear-light RGBA half-float frame at its own size. */
|
|
268
228
|
uploadPresentedLinearFrame?: (sourceId: string, mediaTimeTicks: bigint, width: number, height: number, pixels: Uint16Array, outputWidth: number, outputHeight: number) => FrameUploadReceipt;
|
|
269
229
|
/** Like `uploadPresentedLinearFrame`, for a still shown at every time. */
|
|
270
230
|
uploadPresentedLinearImage?: (sourceId: string, width: number, height: number, pixels: Uint16Array, outputWidth: number, outputHeight: number) => FrameUploadReceipt;
|
|
271
231
|
/** Whether the loaded project declares `sourceId` HDR. */
|
|
272
232
|
hdrSource?(sourceId: string): boolean;
|
|
273
|
-
/**
|
|
233
|
+
/** Project-declared color for `sourceId`, as JSON. */
|
|
274
234
|
sourceColorMetadata?(sourceId: string): string | undefined;
|
|
275
235
|
aliasVideoFrame(sourceId: string, existingMediaTimeTicks: bigint, requestedMediaTimeTicks: bigint): boolean;
|
|
276
|
-
/**
|
|
277
|
-
* Whether the engine still holds the still `sourceId` as the upload `generation` names; the
|
|
278
|
-
* engine drops stills on its own.
|
|
279
|
-
*/
|
|
236
|
+
/** Whether the still for `sourceId` is still upload `generation`; the engine may evict stills. */
|
|
280
237
|
holdsImage(sourceId: string, generation: bigint): boolean;
|
|
281
238
|
releaseFrameGeneration(generation: bigint): void;
|
|
282
|
-
/** Drops
|
|
239
|
+
/** Drops a source's frames and still after its media changed. */
|
|
283
240
|
releaseSourceFrames(sourceId: string): void;
|
|
284
241
|
renderAt(timeTicks: bigint): string;
|
|
285
242
|
}
|
|
286
243
|
/**
|
|
287
|
-
* Keys the decoder cursor of one clip reading one asset.
|
|
288
|
-
*
|
|
289
|
-
* Two clips sharing a source must not share a cursor: a single sequential decoder would seek
|
|
290
|
-
* backwards and forwards on every output frame.
|
|
244
|
+
* Keys the decoder cursor of one clip reading one asset. Clips sharing a source need separate
|
|
245
|
+
* cursors, or one decoder would seek back and forth every frame.
|
|
291
246
|
*/
|
|
292
247
|
export declare function decoderCursorKey(assetId: string, consumerId: string): string;
|
|
293
|
-
/**
|
|
248
|
+
/** Cumulative raw source video a {@link FrameSupply} copied through script memory. */
|
|
294
249
|
export interface SourceTransferStats {
|
|
295
250
|
readonly planarCopyFrames: number;
|
|
296
251
|
readonly planarCopyBytes: number;
|
|
297
252
|
}
|
|
298
253
|
/**
|
|
299
|
-
* Reference host-side consumer of the engine's `frameNeeds` contract.
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
* clip-scoped cursor, uploads them, and bounds upload retention. Requests whose frames resolve to
|
|
303
|
-
* one decoded frame share one upload.
|
|
254
|
+
* Reference host-side consumer of the engine's `frameNeeds` contract. It decodes each needed frame
|
|
255
|
+
* through a clip-scoped cursor, uploads it, and bounds retention. Needs resolving to the same
|
|
256
|
+
* decoded frame share one upload.
|
|
304
257
|
*
|
|
305
|
-
* The constructor throws `RangeError` for a limit
|
|
258
|
+
* The constructor throws `RangeError` for a limit that is not a positive safe integer.
|
|
306
259
|
*/
|
|
307
260
|
export declare class FrameSupply {
|
|
308
261
|
#private;
|
|
309
262
|
/**
|
|
310
|
-
* Optional upload trace
|
|
311
|
-
*
|
|
312
|
-
* the host decoded the wrong asset, which is a host bug; distinct checksums move the search into
|
|
313
|
-
* the engine.
|
|
263
|
+
* Optional RGBA upload trace for diagnosing a clip that shows another clip's picture. Two sources
|
|
264
|
+
* with the same checksum point to a host decoding bug; distinct checksums point to the engine.
|
|
314
265
|
*/
|
|
315
266
|
onUpload: ((entry: FrameUploadTrace) => void) | null;
|
|
316
267
|
constructor(engine: FrameSupplyEngine, options?: FrameSupplyConfig);
|
|
317
|
-
/**
|
|
268
|
+
/** See {@link FrameRetentionOptions}. */
|
|
318
269
|
get retiredBytes(): number;
|
|
319
|
-
/** Bytes of uploaded stills currently cached. */
|
|
320
270
|
get cachedImageBytes(): number;
|
|
321
|
-
/**
|
|
322
|
-
* Raw source video this supply copied through script memory, cumulative. Frames are copied out
|
|
323
|
-
* planar so the engine converts them, as natively (see {@link VideoConversion}); that copy is a
|
|
324
|
-
* source-side cost, apart from any output readback.
|
|
325
|
-
*/
|
|
271
|
+
/** Planar copies made for engine conversion (see {@link VideoConversion}). */
|
|
326
272
|
get sourceTransfer(): SourceTransferStats;
|
|
327
|
-
/**
|
|
273
|
+
/** Cumulative readback failures and how they were recovered. */
|
|
328
274
|
get readbackRecovery(): ReadbackRecoveryStats;
|
|
329
275
|
/**
|
|
330
|
-
* Uploads every source the engine
|
|
331
|
-
* `VideoFrame` until the WebGPU external-image copy consumes it.
|
|
276
|
+
* Uploads every source the engine needs at one timestamp.
|
|
332
277
|
*
|
|
333
|
-
* Resolves with receipts for the
|
|
334
|
-
* false mid-decode (decoded frames are
|
|
335
|
-
* {@link FrameSupply.retire} once the engine has consumed them, so this call does not; the still
|
|
336
|
-
* uploads it replaced or evicted are retired then too.
|
|
278
|
+
* Resolves with upload receipts for the caller to pass to {@link FrameSupply.retire} after
|
|
279
|
+
* rendering, or `null` when `isCurrent` turned false mid-decode (decoded frames are closed).
|
|
337
280
|
*
|
|
338
|
-
* Rejects with a fatal `GPU_DEVICE_LOST` error when the
|
|
339
|
-
*
|
|
340
|
-
*
|
|
281
|
+
* Rejects with a fatal `GPU_DEVICE_LOST` error when the device is lost, and with an `Error` when
|
|
282
|
+
* a source is unavailable, decodes to nothing or the wrong kind of frame, or an upload fails.
|
|
283
|
+
* Earlier uploads are then retired and remaining frames closed.
|
|
341
284
|
*/
|
|
342
285
|
supply(timeTicks: bigint, { width, height, contentOf, liveSourceIds, getLayer, pixelsFor, retainVideoConsumers, isCurrent, }: FrameSupplyOptions): Promise<SuppliedFrame | null>;
|
|
343
286
|
/**
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
* released past `maxRetiredBytes`.
|
|
287
|
+
* Retires receipts from {@link FrameSupply.supply} after rendering, along with replaced or
|
|
288
|
+
* evicted stills. The oldest are released past `maxRetiredBytes`.
|
|
347
289
|
*/
|
|
348
290
|
retire(uploads: readonly FrameUploadReceipt[]): void;
|
|
349
291
|
/**
|
|
350
|
-
* Supplies one timestamp
|
|
292
|
+
* Supplies one timestamp, presents it, and retires the uploads.
|
|
351
293
|
*
|
|
352
294
|
* Resolves with `null` when `isCurrent` turned false before presenting. Rejects as
|
|
353
|
-
* {@link FrameSupply.supply} does,
|
|
354
|
-
* still reports missing sources after the supply.
|
|
295
|
+
* {@link FrameSupply.supply} does, or when the engine still reports missing sources.
|
|
355
296
|
*/
|
|
356
297
|
render(timeTicks: bigint, options: FrameSupplyOptions): Promise<PlaybackResult | null>;
|
|
357
298
|
}
|