alpha2 0.4.6 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +51 -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 +125 -176
- 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 +96 -162
- package/dist/frame-supply.js +181 -171
- package/dist/frames.d.ts +23 -0
- package/dist/frames.js +34 -0
- package/dist/generated/project-schema.d.ts +712 -485
- package/dist/generated/project-schema.js +55 -2
- package/dist/generated/project-shape.js +276 -16
- 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 +82 -67
- package/dist/hdr-frames.js +112 -49
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -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 +48 -63
- package/dist/layout.js +37 -37
- 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 +178 -246
- package/dist/mediabunny.js +781 -583
- package/dist/paint.d.ts +23 -0
- package/dist/paint.js +37 -0
- 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 +74 -118
- package/dist/project.js +384 -445
- 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 +97 -71
- package/dist/text.js +33 -70
- 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 -95
- package/dist/worker.js +235 -143
- 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 +501 -587
- package/wasm/alpha2_wasm.js +661 -616
- package/wasm/alpha2_wasm_bg.wasm +0 -0
- package/wasm/alpha2_wasm_bg.wasm.d.ts +22 -12
- package/wasm/rust-crate-licenses.md +2 -2
- package/wasm/snippets/{alpha2-wasm-c62e60c964e88a52 → alpha2-wasm-070d94113471ef0a}/inline1.js +1 -0
- package/wasm/snippets/alpha2-wasm-070d94113471ef0a/inline2.js +82 -0
- package/wasm/snippets/alpha2-wasm-c62e60c964e88a52/inline2.js +0 -52
- /package/wasm/snippets/{alpha2-wasm-c62e60c964e88a52 → alpha2-wasm-070d94113471ef0a}/inline0.js +0 -0
- /package/wasm/snippets/{alpha2-wasm-c62e60c964e88a52 → alpha2-wasm-070d94113471ef0a}/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,211 +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
|
-
*
|
|
113
|
-
* later frame of that source until its content changes; a host that cannot decode the source in
|
|
114
|
-
* software rejects. Absent for every other request.
|
|
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.
|
|
115
99
|
*/
|
|
116
100
|
readonly decode?: "software";
|
|
117
101
|
}
|
|
118
102
|
/** Host callbacks and frame geometry for one `supply` call. */
|
|
119
103
|
export interface FrameSupplyOptions {
|
|
120
|
-
/**
|
|
104
|
+
/** Output size; RGBA pixels must match it. */
|
|
121
105
|
readonly width: number;
|
|
122
106
|
readonly height: number;
|
|
123
107
|
/**
|
|
124
|
-
*
|
|
125
|
-
* provider settings
|
|
126
|
-
*
|
|
127
|
-
* source keeps its uploads across project loads. Without it a source's pixels never change while
|
|
128
|
-
* it stays in the project, which is the engine's own rule: media that changes under an unchanged
|
|
129
|
-
* 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.
|
|
130
111
|
*/
|
|
131
112
|
readonly contentOf?: (sourceId: string) => unknown;
|
|
132
|
-
/** Sources still
|
|
113
|
+
/** Sources still in the project; others have their uploads retired. */
|
|
133
114
|
readonly liveSourceIds: ReadonlySet<string>;
|
|
134
|
-
/**
|
|
115
|
+
/** A missing layer makes `supply` reject. */
|
|
135
116
|
readonly getLayer: (sourceId: string) => FrameSupplyLayer | null | undefined;
|
|
136
117
|
/**
|
|
137
|
-
* Decodes `layer` at `seconds` of source time
|
|
138
|
-
*
|
|
139
|
-
* 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`.
|
|
140
120
|
*/
|
|
141
121
|
readonly pixelsFor: (layer: FrameSupplyLayer, seconds: number, options: FrameSupplyDecodeOptions) => Promise<FrameSupplySource | null>;
|
|
142
122
|
/** Opens or retains one decoder cursor per consumer before decoding starts. */
|
|
143
123
|
readonly retainVideoConsumers?: (consumerIds: ReadonlySet<string>) => Promise<void> | void;
|
|
144
|
-
/**
|
|
145
|
-
* Returns false once an edit, seek, or pause invalidates this request. Asked before each decode,
|
|
146
|
-
* so a replaced request decodes nothing more.
|
|
147
|
-
*/
|
|
124
|
+
/** Returns false once an edit, seek or pause invalidates the request; checked per decode. */
|
|
148
125
|
readonly isCurrent: () => boolean;
|
|
149
126
|
}
|
|
150
127
|
/** Memory envelope for source textures whose render submission has completed. */
|
|
151
128
|
export interface FrameRetentionOptions {
|
|
152
129
|
/**
|
|
153
|
-
*
|
|
154
|
-
*
|
|
130
|
+
* Rendered texture bytes kept for reuse. Defaults to 256 MiB; the newest generation is kept even
|
|
131
|
+
* if it alone exceeds this.
|
|
155
132
|
*/
|
|
156
133
|
readonly maxRetiredBytes?: number;
|
|
157
134
|
}
|
|
158
135
|
/** Resource and concurrency limits owned by one frame supplier. */
|
|
159
136
|
export interface FrameSupplyConfig extends FrameRetentionOptions {
|
|
160
|
-
/**
|
|
161
|
-
* Bytes of uploaded stills kept cached, least recently used evicted first. Defaults to 256 MiB.
|
|
162
|
-
*/
|
|
137
|
+
/** Cached still bytes, evicted least recently used first. Defaults to 256 MiB. */
|
|
163
138
|
readonly maxCachedImageBytes?: number;
|
|
164
|
-
/** Maximum
|
|
139
|
+
/** Maximum concurrent decoder cursors. Defaults to 2. */
|
|
165
140
|
readonly maxDecodeConcurrency?: number;
|
|
166
|
-
/**
|
|
167
|
-
* Who converts a decoded SDR `VideoFrame`: the engine, from its planes (`"engine"`, the
|
|
168
|
-
* default), or the browser (`"browser"`); see {@link VideoConversion}.
|
|
169
|
-
*/
|
|
141
|
+
/** See {@link VideoConversion}. Defaults to `"engine"`. */
|
|
170
142
|
readonly videoConversion?: VideoConversion;
|
|
171
143
|
/**
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* for a preview, where a frame shown at once matters more than the engine's conversion. A frame
|
|
177
|
-
* the engine must convert that has no planar format it reads is decoded again in software either
|
|
178
|
-
* way.
|
|
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.
|
|
179
148
|
*/
|
|
180
149
|
readonly unreadableFrames?: "redecode" | "present";
|
|
181
|
-
}
|
|
182
|
-
/** How a {@link FrameSupply} recovered frames the browser could not read back; cumulative. */
|
|
183
|
-
export interface ReadbackRecoveryStats {
|
|
184
150
|
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
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"`.
|
|
187
156
|
*/
|
|
188
|
-
readonly
|
|
189
|
-
/** Reads repeated on the same frame. */
|
|
190
|
-
readonly readbackRetries: number;
|
|
191
|
-
/** Frames decoded again in software and copied from that decode. */
|
|
192
|
-
readonly redecodedFrames: number;
|
|
193
|
-
/** Frames given to the browser's conversion (`unreadableFrames: "present"`). */
|
|
194
|
-
readonly presentedFrames: number;
|
|
157
|
+
readonly opaqueEngineFrames?: "refuse" | "present-degraded";
|
|
195
158
|
}
|
|
196
159
|
/**
|
|
197
|
-
* Keeps
|
|
198
|
-
* through `release` when the budget is exceeded.
|
|
160
|
+
* Keeps rendered upload generations within a byte budget, releasing the oldest through `release`.
|
|
199
161
|
*
|
|
200
162
|
* The constructor throws `RangeError` when `maxRetiredBytes` is not a positive safe integer.
|
|
201
163
|
*/
|
|
202
164
|
export declare class FrameGenerationRetainer {
|
|
203
165
|
#private;
|
|
204
166
|
constructor(release: (generation: bigint) => void, options?: FrameRetentionOptions);
|
|
205
|
-
/** Bytes of the generations currently held. */
|
|
206
167
|
get retainedBytes(): number;
|
|
207
168
|
/**
|
|
208
|
-
* Takes over generations
|
|
169
|
+
* Takes over rendered generations, releasing older ones past the budget.
|
|
209
170
|
*
|
|
210
171
|
* @throws RangeError for a receipt with a non-positive generation or byte count.
|
|
211
172
|
*/
|
|
212
173
|
retire(uploads: readonly FrameUploadReceipt[]): void;
|
|
213
|
-
/**
|
|
214
|
-
* Forgets every held generation without releasing it, for when the owning engine has dropped its
|
|
215
|
-
* whole frame store.
|
|
216
|
-
*/
|
|
174
|
+
/** Forgets held generations without releasing them, after the engine dropped its frame store. */
|
|
217
175
|
discardAll(): void;
|
|
218
176
|
}
|
|
219
177
|
/** One upload reported through {@link FrameSupply.onUpload}. */
|
|
220
178
|
export interface FrameUploadTrace {
|
|
221
179
|
readonly sourceId: string;
|
|
222
180
|
readonly mediaTimeTicks: string;
|
|
223
|
-
/**
|
|
181
|
+
/** Sparse 32-bit checksum of the uploaded RGBA pixels. */
|
|
224
182
|
readonly checksum: number;
|
|
225
183
|
}
|
|
226
184
|
/** Uploads accepted by the engine for one timestamp. */
|
|
227
185
|
export interface SuppliedFrame {
|
|
228
|
-
/**
|
|
186
|
+
/** Every need, including those served by an existing upload. */
|
|
229
187
|
readonly needs: readonly FrameNeed[];
|
|
230
|
-
/**
|
|
188
|
+
/** Pass to `retire` once rendered. */
|
|
231
189
|
readonly uploaded: readonly FrameUploadReceipt[];
|
|
232
190
|
}
|
|
233
191
|
/** Outcome of one real-time presentation attempt. */
|
|
@@ -236,19 +194,18 @@ export interface PlaybackResult {
|
|
|
236
194
|
/** `null` until the engine has presented a frame, and after a reset. */
|
|
237
195
|
readonly presentedTimeTicks: number | null;
|
|
238
196
|
readonly missingSources: readonly string[];
|
|
239
|
-
readonly repeated: boolean;
|
|
240
197
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
198
|
+
* Sources shown through the browser's conversion (`opaqueEngineFrames: "present-degraded"`); the
|
|
199
|
+
* engine refuses to export them.
|
|
243
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. */
|
|
244
204
|
readonly unchanged: boolean;
|
|
245
205
|
}
|
|
246
206
|
/**
|
|
247
|
-
* Engine surface this module drives.
|
|
248
|
-
*
|
|
249
|
-
* The wasm `WebEffectRegistry` satisfies it; a worker-side proxy that forwards the same calls does
|
|
250
|
-
* too. Optional methods are probed per call, and a source that needs a missing one makes `supply`
|
|
251
|
-
* 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.
|
|
252
209
|
*/
|
|
253
210
|
export interface FrameSupplyEngine {
|
|
254
211
|
readonly deviceLost: boolean;
|
|
@@ -259,106 +216,83 @@ export interface FrameSupplyEngine {
|
|
|
259
216
|
uploadPresentedVideoFrame?(sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame, width: number, height: number, rotation: number | undefined, mirror: boolean): FrameUploadReceipt;
|
|
260
217
|
readonly videoFrameCopy?: string;
|
|
261
218
|
uploadPresentedImageBitmap?: PresentedFrameEngine["uploadPresentedImageBitmap"];
|
|
262
|
-
/**
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
* the supply leaves SDR to the browser.
|
|
266
|
-
*/
|
|
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. */
|
|
267
222
|
uploadYuvFrame?: PlanarYuvEngine["uploadYuvFrame"];
|
|
268
223
|
/** Presents a premultiplied or straight RGBA8 frame at its own size into the output. */
|
|
269
224
|
uploadPresentedRgbaFrame?: (sourceId: string, mediaTimeTicks: bigint, width: number, height: number, pixels: Uint8Array, premultiplied: boolean, outputWidth: number, outputHeight: number) => FrameUploadReceipt;
|
|
270
225
|
/** Like `uploadPresentedRgbaFrame`, for a still shown at every time. */
|
|
271
226
|
uploadPresentedRgbaImage?: (sourceId: string, width: number, height: number, pixels: Uint8Array, premultiplied: boolean, outputWidth: number, outputHeight: number) => FrameUploadReceipt;
|
|
272
|
-
/**
|
|
273
|
-
* Presents a premultiplied linear-light RGBA half-float frame at its own size into the output.
|
|
274
|
-
*/
|
|
227
|
+
/** Presents a premultiplied linear-light RGBA half-float frame at its own size. */
|
|
275
228
|
uploadPresentedLinearFrame?: (sourceId: string, mediaTimeTicks: bigint, width: number, height: number, pixels: Uint16Array, outputWidth: number, outputHeight: number) => FrameUploadReceipt;
|
|
276
229
|
/** Like `uploadPresentedLinearFrame`, for a still shown at every time. */
|
|
277
230
|
uploadPresentedLinearImage?: (sourceId: string, width: number, height: number, pixels: Uint16Array, outputWidth: number, outputHeight: number) => FrameUploadReceipt;
|
|
278
231
|
/** Whether the loaded project declares `sourceId` HDR. */
|
|
279
232
|
hdrSource?(sourceId: string): boolean;
|
|
280
|
-
/**
|
|
233
|
+
/** Project-declared color for `sourceId`, as JSON. */
|
|
281
234
|
sourceColorMetadata?(sourceId: string): string | undefined;
|
|
282
235
|
aliasVideoFrame(sourceId: string, existingMediaTimeTicks: bigint, requestedMediaTimeTicks: bigint): boolean;
|
|
283
|
-
/**
|
|
284
|
-
* Whether the engine still holds the still `sourceId` as the upload `generation` names; the
|
|
285
|
-
* engine drops stills on its own.
|
|
286
|
-
*/
|
|
236
|
+
/** Whether the still for `sourceId` is still upload `generation`; the engine may evict stills. */
|
|
287
237
|
holdsImage(sourceId: string, generation: bigint): boolean;
|
|
288
238
|
releaseFrameGeneration(generation: bigint): void;
|
|
289
|
-
/** Drops
|
|
239
|
+
/** Drops a source's frames and still after its media changed. */
|
|
290
240
|
releaseSourceFrames(sourceId: string): void;
|
|
291
241
|
renderAt(timeTicks: bigint): string;
|
|
292
242
|
}
|
|
293
243
|
/**
|
|
294
|
-
* Keys the decoder cursor of one clip reading one asset.
|
|
295
|
-
*
|
|
296
|
-
* Two clips sharing a source must not share a cursor: a single sequential decoder would seek
|
|
297
|
-
* 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.
|
|
298
246
|
*/
|
|
299
247
|
export declare function decoderCursorKey(assetId: string, consumerId: string): string;
|
|
300
|
-
/**
|
|
248
|
+
/** Cumulative raw source video a {@link FrameSupply} copied through script memory. */
|
|
301
249
|
export interface SourceTransferStats {
|
|
302
250
|
readonly planarCopyFrames: number;
|
|
303
251
|
readonly planarCopyBytes: number;
|
|
304
252
|
}
|
|
305
253
|
/**
|
|
306
|
-
* Reference host-side consumer of the engine's `frameNeeds` contract.
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
* clip-scoped cursor, uploads them, and bounds upload retention. Requests whose frames resolve to
|
|
310
|
-
* 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.
|
|
311
257
|
*
|
|
312
|
-
* The constructor throws `RangeError` for a limit
|
|
258
|
+
* The constructor throws `RangeError` for a limit that is not a positive safe integer.
|
|
313
259
|
*/
|
|
314
260
|
export declare class FrameSupply {
|
|
315
261
|
#private;
|
|
316
262
|
/**
|
|
317
|
-
* Optional upload trace
|
|
318
|
-
*
|
|
319
|
-
* the host decoded the wrong asset, which is a host bug; distinct checksums move the search into
|
|
320
|
-
* 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.
|
|
321
265
|
*/
|
|
322
266
|
onUpload: ((entry: FrameUploadTrace) => void) | null;
|
|
323
267
|
constructor(engine: FrameSupplyEngine, options?: FrameSupplyConfig);
|
|
324
|
-
/**
|
|
268
|
+
/** See {@link FrameRetentionOptions}. */
|
|
325
269
|
get retiredBytes(): number;
|
|
326
|
-
/** Bytes of uploaded stills currently cached. */
|
|
327
270
|
get cachedImageBytes(): number;
|
|
328
|
-
/**
|
|
329
|
-
* Raw source video this supply copied through script memory, cumulative. Frames are copied out
|
|
330
|
-
* planar so the engine converts them, as natively (see {@link VideoConversion}); that copy is a
|
|
331
|
-
* source-side cost, apart from any output readback.
|
|
332
|
-
*/
|
|
271
|
+
/** Planar copies made for engine conversion (see {@link VideoConversion}). */
|
|
333
272
|
get sourceTransfer(): SourceTransferStats;
|
|
334
|
-
/**
|
|
273
|
+
/** Cumulative readback failures and how they were recovered. */
|
|
335
274
|
get readbackRecovery(): ReadbackRecoveryStats;
|
|
336
275
|
/**
|
|
337
|
-
* Uploads every source the engine
|
|
338
|
-
* `VideoFrame` until the WebGPU external-image copy consumes it.
|
|
276
|
+
* Uploads every source the engine needs at one timestamp.
|
|
339
277
|
*
|
|
340
|
-
* Resolves with receipts for the
|
|
341
|
-
* false mid-decode (decoded frames are
|
|
342
|
-
* {@link FrameSupply.retire} once the engine has consumed them, so this call does not; the still
|
|
343
|
-
* 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).
|
|
344
280
|
*
|
|
345
|
-
* Rejects with a fatal `GPU_DEVICE_LOST` error when the
|
|
346
|
-
*
|
|
347
|
-
*
|
|
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.
|
|
348
284
|
*/
|
|
349
285
|
supply(timeTicks: bigint, { width, height, contentOf, liveSourceIds, getLayer, pixelsFor, retainVideoConsumers, isCurrent, }: FrameSupplyOptions): Promise<SuppliedFrame | null>;
|
|
350
286
|
/**
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* 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`.
|
|
354
289
|
*/
|
|
355
290
|
retire(uploads: readonly FrameUploadReceipt[]): void;
|
|
356
291
|
/**
|
|
357
|
-
* Supplies one timestamp
|
|
292
|
+
* Supplies one timestamp, presents it, and retires the uploads.
|
|
358
293
|
*
|
|
359
294
|
* Resolves with `null` when `isCurrent` turned false before presenting. Rejects as
|
|
360
|
-
* {@link FrameSupply.supply} does,
|
|
361
|
-
* still reports missing sources after the supply.
|
|
295
|
+
* {@link FrameSupply.supply} does, or when the engine still reports missing sources.
|
|
362
296
|
*/
|
|
363
297
|
render(timeTicks: bigint, options: FrameSupplyOptions): Promise<PlaybackResult | null>;
|
|
364
298
|
}
|