alpha2 0.4.6 → 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 +108 -177
- 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/generated/project-schema.d.ts +701 -485
- package/dist/generated/project-schema.js +55 -2
- package/dist/generated/project-shape.js +261 -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 +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 +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 +166 -245
- package/dist/mediabunny.js +741 -580
- 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 +73 -117
- 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 +460 -567
- package/wasm/alpha2_wasm.js +594 -594
- package/wasm/alpha2_wasm_bg.wasm +0 -0
- package/wasm/alpha2_wasm_bg.wasm.d.ts +15 -8
- package/wasm/rust-crate-licenses.md +2 -2
- package/wasm/snippets/{alpha2-wasm-c62e60c964e88a52 → alpha2-wasm-1313375d424845c0}/inline1.js +1 -0
- package/wasm/snippets/alpha2-wasm-1313375d424845c0/inline2.js +82 -0
- package/wasm/snippets/alpha2-wasm-c62e60c964e88a52/inline2.js +0 -52
- /package/wasm/snippets/{alpha2-wasm-c62e60c964e88a52 → alpha2-wasm-1313375d424845c0}/inline0.js +0 -0
- /package/wasm/snippets/{alpha2-wasm-c62e60c964e88a52 → alpha2-wasm-1313375d424845c0}/inline3.js +0 -0
package/dist/effects.d.ts
CHANGED
|
@@ -5,16 +5,16 @@ import type { EngineVideoCodec } from "./rate-control.js";
|
|
|
5
5
|
/** An effect filters one input; a transition blends two. */
|
|
6
6
|
export type EffectKind = "effect" | "transition";
|
|
7
7
|
/**
|
|
8
|
-
* GPU
|
|
9
|
-
*
|
|
8
|
+
* GPU tier: `a` is a full `WebGPU` adapter, `b` a downlevel one. Effects with `tierMin: "a"` do not
|
|
9
|
+
* compile on tier `b`.
|
|
10
10
|
*/
|
|
11
11
|
export type CapabilityTier = "a" | "b";
|
|
12
|
-
/** A resource an effect reads
|
|
12
|
+
/** A resource an effect reads; `name` is its shader binding name. */
|
|
13
13
|
export interface EffectResourceSpec {
|
|
14
14
|
readonly name: string;
|
|
15
15
|
readonly kind: EffectResourceKind;
|
|
16
16
|
}
|
|
17
|
-
/** An image an effect samples
|
|
17
|
+
/** An extra image an effect samples; an effect node binds it under `inputs.<name>`. */
|
|
18
18
|
export interface EffectInputSpec {
|
|
19
19
|
readonly name: string;
|
|
20
20
|
}
|
|
@@ -36,10 +36,7 @@ export interface BuiltinEffectCatalogEntry {
|
|
|
36
36
|
readonly params: readonly (EffectParameter & {
|
|
37
37
|
readonly label: string;
|
|
38
38
|
readonly step?: number;
|
|
39
|
-
/**
|
|
40
|
-
* Whether a project may keyframe this parameter with an interpolating curve. Enum and bool
|
|
41
|
-
* keyframes only hold.
|
|
42
|
-
*/
|
|
39
|
+
/** Whether keyframes interpolate; enum and bool keyframes only hold. */
|
|
43
40
|
readonly animatable: boolean;
|
|
44
41
|
})[];
|
|
45
42
|
readonly resources: readonly EffectResourceSpec[];
|
|
@@ -68,10 +65,7 @@ export interface Vec2Parameter extends ParameterBase {
|
|
|
68
65
|
readonly step?: number;
|
|
69
66
|
readonly unit: "normalized";
|
|
70
67
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Four numbers that are not a color, such as per-channel thresholds; they keyframe component by
|
|
73
|
-
* component.
|
|
74
|
-
*/
|
|
68
|
+
/** Four non-color numbers, such as per-channel thresholds; keyframed per component. */
|
|
75
69
|
export interface Vec4Parameter extends ParameterBase {
|
|
76
70
|
readonly type: "vec4";
|
|
77
71
|
readonly default: readonly [number, number, number, number];
|
|
@@ -80,7 +74,7 @@ export interface Vec4Parameter extends ParameterBase {
|
|
|
80
74
|
readonly step?: number;
|
|
81
75
|
readonly unit: "normalized";
|
|
82
76
|
}
|
|
83
|
-
/**
|
|
77
|
+
/** Straight sRGB RGBA in 0..1; keyframes interpolate premultiplied. */
|
|
84
78
|
export interface ColorParameter extends ParameterBase {
|
|
85
79
|
readonly type: "color";
|
|
86
80
|
readonly default: readonly [number, number, number, number];
|
|
@@ -105,36 +99,32 @@ export interface EffectDefinition {
|
|
|
105
99
|
readonly version: number;
|
|
106
100
|
readonly kind: EffectKind;
|
|
107
101
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
102
|
+
* Up to 8 extra images, for `kind: "effect"` only. The shader reads each with
|
|
103
|
+
* `sample_<name>(uv) -> vec4f` (premultiplied, sRGB-encoded, edge-clamped like `sample_src`) and
|
|
104
|
+
* `size_<name>() -> vec2f` in texels. The body must not redeclare `input_<name>`, `sample_<name>`
|
|
105
|
+
* or `size_<name>`.
|
|
112
106
|
*/
|
|
113
107
|
readonly inputs?: readonly EffectInputSpec[];
|
|
114
108
|
readonly params?: readonly EffectParameter[];
|
|
115
109
|
readonly resources?: readonly EffectResourceSpec[];
|
|
116
|
-
/** WGSL the engine
|
|
110
|
+
/** WGSL inserted into the engine's effect shader; compile errors reject registration. */
|
|
117
111
|
readonly wgslBody: string;
|
|
118
112
|
readonly tierMin?: CapabilityTier;
|
|
119
113
|
readonly license?: string;
|
|
120
114
|
}
|
|
121
|
-
/**
|
|
115
|
+
/** A compiled effect awaiting registration. */
|
|
122
116
|
export interface WasmCompiledEffect {
|
|
123
|
-
/**
|
|
117
|
+
/** `id@version`. */
|
|
124
118
|
readonly id: string;
|
|
125
119
|
}
|
|
126
120
|
/** Minimal shape of the generated wasm-bindgen class. */
|
|
127
121
|
export interface WasmEffectRegistry {
|
|
128
122
|
/**
|
|
129
|
-
* Compiles one effect definition
|
|
130
|
-
*
|
|
131
|
-
* meanwhile. It rejects with `EFFECT_ERROR` and the shader's diagnostics.
|
|
123
|
+
* Compiles one effect definition without holding the binding while the browser compiles.
|
|
124
|
+
* Rejects with `EFFECT_ERROR` and the shader's diagnostics.
|
|
132
125
|
*/
|
|
133
126
|
compileEffect(definitionJson: string): Promise<WasmCompiledEffect>;
|
|
134
|
-
/**
|
|
135
|
-
* Adds an effect this binding compiled and returns its `id@version`; `EFFECT_ERROR` for one
|
|
136
|
-
* registered meanwhile.
|
|
137
|
-
*/
|
|
127
|
+
/** Returns `id@version`; throws `EFFECT_ERROR` if that id was registered meanwhile. */
|
|
138
128
|
registerCompiledEffect(compiled: WasmCompiledEffect): string;
|
|
139
129
|
unregisterEffect(id: string, version: number): boolean;
|
|
140
130
|
clearEffects(): void;
|
|
@@ -143,28 +133,22 @@ export interface WasmEffectRegistry {
|
|
|
143
133
|
unregisterEffectResource(id: string): boolean;
|
|
144
134
|
clearEffectResources(): void;
|
|
145
135
|
}
|
|
146
|
-
/**
|
|
147
|
-
* What `renderAudio` does with a block that does not start where the previous one ended:
|
|
148
|
-
* `"exact"` replays the settling history and mixes what a fresh renderer would;
|
|
149
|
-
* `"continue-small-gaps"` (live preview only) continues across a step of at most `audioMaxBlock`
|
|
150
|
-
* samples either way without a replay.
|
|
151
|
-
*/
|
|
136
|
+
/** See `WasmCanvasRenderer.setAudioContinuity`. */
|
|
152
137
|
export type AudioContinuity = "exact" | "continue-small-gaps";
|
|
153
|
-
/**
|
|
154
|
-
* Generated wasm surface used by the concrete render-worker host: the GPU renderer
|
|
155
|
-
* (`createForCanvas`) or the CPU one (`createCpu`), which answer the same calls.
|
|
156
|
-
*/
|
|
138
|
+
/** Generated wasm renderer surface, shared by the GPU and CPU renderers. */
|
|
157
139
|
export interface WasmCanvasRenderer extends WasmEffectRegistry {
|
|
158
|
-
/**
|
|
159
|
-
* Which renderer draws: `"gpu"` (WebGPU or WebGL2) or `"cpu"` (the engine's CPU renderer in
|
|
160
|
-
* wasm, which refuses runtime effects with `EFFECT_ERROR`). Absent means `"gpu"`.
|
|
161
|
-
*/
|
|
140
|
+
/** Absent means `"gpu"`. The CPU renderer rejects runtime effects with `EFFECT_ERROR`. */
|
|
162
141
|
readonly renderer?: "gpu" | "cpu";
|
|
142
|
+
/** Absent on the CPU renderer. */
|
|
143
|
+
readonly backend?: "webgpu" | "webgl2";
|
|
144
|
+
/** Browser-reported adapter name; may be empty. */
|
|
145
|
+
readonly adapter?: string;
|
|
163
146
|
/**
|
|
164
|
-
*
|
|
165
|
-
* `
|
|
166
|
-
* CPU renderer is never lost.
|
|
147
|
+
* After a loss, JSON `{ hung, gpuMs, watchdogMs, timeTicks, frameIndex, effects }` with
|
|
148
|
+
* `timeTicks` as a decimal string; `undefined` before any loss and on the CPU renderer.
|
|
167
149
|
*/
|
|
150
|
+
readonly lossReport?: string;
|
|
151
|
+
/** A lost renderer rejects export readbacks and must be recreated. Never set on the CPU. */
|
|
168
152
|
readonly deviceLost: boolean;
|
|
169
153
|
readonly uploadedFrameCount: number;
|
|
170
154
|
readonly uploadedFrameBytes: bigint;
|
|
@@ -172,187 +156,140 @@ export interface WasmCanvasRenderer extends WasmEffectRegistry {
|
|
|
172
156
|
loadProject(projectJson: string): void;
|
|
173
157
|
uploadVideoFrame(sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame): FrameUploadReceipt;
|
|
174
158
|
uploadPresentedVideoFrame(sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame, outputWidth: number, outputHeight: number, rotationDegrees: number, mirror: boolean): FrameUploadReceipt;
|
|
175
|
-
/** `"direct"`, `"bitmap"`, `"untried"
|
|
159
|
+
/** `"direct"`, `"bitmap"`, `"untried"` or `"canvas"` (WebGL2). */
|
|
176
160
|
readonly videoFrameCopy: string;
|
|
177
161
|
/** `uploadPresentedVideoFrame` for a bitmap made with `premultiplyAlpha: "none"`. */
|
|
178
162
|
uploadPresentedImageBitmap(sourceId: string, mediaTimeTicks: bigint, bitmap: ImageBitmap, outputWidth: number, outputHeight: number, rotationDegrees: number, mirror: boolean): FrameUploadReceipt;
|
|
179
163
|
uploadRgbaFrame(sourceId: string, mediaTimeTicks: bigint, width: number, height: number, pixels: Uint8Array): FrameUploadReceipt;
|
|
180
|
-
/**
|
|
181
|
-
* Planar YUV (a WebCodecs format) converted with the project's color pipeline: how HDR frames
|
|
182
|
-
* arrive, so the project, not the browser, decides how they are tone-mapped.
|
|
183
|
-
*/
|
|
164
|
+
/** Planar YUV converted with the project's color pipeline, which controls tone mapping. */
|
|
184
165
|
uploadYuvFrame(sourceId: string, mediaTimeTicks: bigint, format: string, codedWidth: number, codedHeight: number, data: Uint8Array, layout: Uint32Array, visibleRect: Uint32Array,
|
|
185
|
-
/**
|
|
186
|
-
* Size the visible picture is shown at before it turns (a `VideoFrame`'s display size): its
|
|
187
|
-
* pixel aspect ratio.
|
|
188
|
-
*/
|
|
166
|
+
/** Display size before rotation; carries the pixel aspect ratio. */
|
|
189
167
|
displayWidth: number, displayHeight: number, colorJson: string, chromaSiting: ChromaSiting, outputWidth: number, outputHeight: number, rotationDegrees: number, mirror: boolean): FrameUploadReceipt;
|
|
190
168
|
/** Whether the loaded project declares `sourceId` HDR. */
|
|
191
169
|
hdrSource(sourceId: string): boolean;
|
|
192
|
-
/**
|
|
170
|
+
/** Project-declared color for `sourceId`, as JSON. */
|
|
193
171
|
sourceColorMetadata(sourceId: string): string | undefined;
|
|
194
172
|
uploadRgbaImage(sourceId: string, width: number, height: number, pixels: Uint8Array): FrameUploadReceipt;
|
|
195
173
|
aliasVideoFrame(sourceId: string, existingMediaTimeTicks: bigint, requestedMediaTimeTicks: bigint): boolean;
|
|
196
174
|
releaseFrame(sourceId: string, mediaTimeTicks: bigint): boolean;
|
|
197
175
|
releaseFrameGeneration(generation: bigint): boolean;
|
|
198
|
-
/**
|
|
199
|
-
* Whether the still `sourceId` is still the upload `generation` names: the engine drops stills on
|
|
200
|
-
* its own, by its byte budget and a count limit.
|
|
201
|
-
*/
|
|
176
|
+
/** Whether the still for `sourceId` is still upload `generation`; the engine may evict stills. */
|
|
202
177
|
holdsImage(sourceId: string, generation: bigint): boolean;
|
|
203
|
-
/** Releases
|
|
178
|
+
/** Releases a source's frames and still, such as after its media changed. */
|
|
204
179
|
releaseSourceFrames(sourceId: string): boolean;
|
|
205
180
|
clearFrames(): void;
|
|
206
|
-
/**
|
|
207
|
-
* Releases one source's frames before a time on that source's own timeline; other sources keep
|
|
208
|
-
* theirs.
|
|
209
|
-
*/
|
|
181
|
+
/** Releases one source's frames before a time in that source's media timeline. */
|
|
210
182
|
trimFramesBefore(sourceId: string, mediaTimeTicks: bigint): void;
|
|
211
183
|
readonly retiredFrameCount: number;
|
|
212
184
|
/** JSON clip/source/timestamp needs; decoder cursors are scoped by clip ID. */
|
|
213
185
|
frameNeeds(timeTicks: bigint): string;
|
|
214
186
|
renderAt(timeTicks: bigint): string;
|
|
215
187
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* engine folds them into the project's channels by speaker.
|
|
188
|
+
* Uploads project-rate planar audio; `startSample` is the source sample index of the first
|
|
189
|
+
* sample. `layout` is the speaker per plane, or a channel count for `FFmpeg`'s default layout
|
|
190
|
+
* (3 is 2.1, 4 is 4.0). The 1 to 24 planes are concatenated; the engine folds them into the
|
|
191
|
+
* project's channels by speaker.
|
|
221
192
|
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* `endsSource` with an upload that runs to the source's end, such as a whole decoded source.
|
|
193
|
+
* Missing samples mean audio not yet arrived, not silence, so a mix needs every sample of its
|
|
194
|
+
* block. Upload zeros past a source's end, or pass `endsSource` when the upload reaches it.
|
|
225
195
|
*
|
|
226
|
-
* An upload replaces
|
|
227
|
-
*
|
|
228
|
-
* MiB) and `INVALID_INPUT` when it is malformed.
|
|
196
|
+
* An upload replaces overlapping windows and joins adjacent ones. Throws `RESOURCE_LIMIT` (not
|
|
197
|
+
* fatal) over 600 s or the store's 512 MiB, and `INVALID_INPUT` when malformed.
|
|
229
198
|
*/
|
|
230
199
|
uploadAudioBlock(sourceId: string, startSample: bigint, sampleRate: number, layout: number | readonly AudioSpeaker[], samples: Float32Array, endsSource?: boolean): void;
|
|
231
|
-
/**
|
|
200
|
+
/** Maximum samples per channel per {@link renderAudio} call. */
|
|
232
201
|
readonly audioMaxBlock: number;
|
|
233
202
|
/**
|
|
234
|
-
* Mixes
|
|
235
|
-
*
|
|
236
|
-
* consecutive calls.
|
|
203
|
+
* Mixes up to {@link audioMaxBlock} samples per channel and returns the channels concatenated.
|
|
204
|
+
* A longer block throws `INVALID_INPUT` (not fatal).
|
|
237
205
|
*/
|
|
238
206
|
renderAudio(startSample: bigint, frames: number, playing: boolean): Float32Array;
|
|
239
207
|
/** JSON source intervals required before a sample window can be mixed. */
|
|
240
208
|
audioNeeds(startSample: bigint, frames: number): string;
|
|
241
209
|
/**
|
|
242
|
-
* Starts (from empty) or stops
|
|
243
|
-
*
|
|
244
|
-
* measures the mix as authored.
|
|
210
|
+
* Starts (from empty) or stops loudness metering before the master limiter. Starting resets the
|
|
211
|
+
* normalization gain so the mix is measured as authored.
|
|
245
212
|
*/
|
|
246
213
|
setLoudnessMetering(enabled: boolean): void;
|
|
247
214
|
/** JSON `LoudnessReport` (`alpha2/loudness`) since metering started, or `null`. */
|
|
248
215
|
loudnessReport(): string;
|
|
249
|
-
/**
|
|
250
|
-
* Static gain before the master limiter, dB; zero removes it, and so does starting to meter. It
|
|
251
|
-
* stays until it is set again.
|
|
252
|
-
*/
|
|
216
|
+
/** Static gain in dB before the master limiter; 0 removes it, as does starting metering. */
|
|
253
217
|
setNormalizationGainDb(gainDb: number): void;
|
|
254
218
|
/**
|
|
255
|
-
* Appends an OpenType font to the fallback stack
|
|
256
|
-
*
|
|
219
|
+
* Appends an OpenType font to the text fallback stack. The same fonts as the export host give
|
|
220
|
+
* identical text.
|
|
257
221
|
*/
|
|
258
222
|
addFont(family: string, bytes: Uint8Array, faceIndex: number): void;
|
|
259
|
-
/**
|
|
260
|
-
* Appends every face of an OpenType font file, in the file's order: each weight of a collection
|
|
261
|
-
* (`.ttc`), as the export host registers a font file.
|
|
262
|
-
*/
|
|
223
|
+
/** Appends every face of an OpenType file (including `.ttc` collections) in file order. */
|
|
263
224
|
addFontFile(family: string, bytes: Uint8Array): void;
|
|
264
|
-
/** Drops every font. */
|
|
265
225
|
clearFonts(): void;
|
|
266
|
-
/** JSON source ids the
|
|
226
|
+
/** JSON source ids the last `renderAudio` call could not mix. */
|
|
267
227
|
audioMissingSources(): string;
|
|
268
228
|
audioChannels(): number;
|
|
269
229
|
audioSampleRate(): number;
|
|
270
230
|
audioRetainedFrames(): number;
|
|
271
231
|
audioRetainedBytes(): number;
|
|
272
|
-
/**
|
|
273
|
-
* JSON `[{startSample, endSample}]`: one source's retained windows as half-open project-rate
|
|
274
|
-
* sample intervals, most recently uploaded first.
|
|
275
|
-
*/
|
|
232
|
+
/** JSON `[{startSample, endSample}]` of a source's retained half-open windows, newest first. */
|
|
276
233
|
audioRetainedWindows(sourceId: string): string;
|
|
277
234
|
releaseAudioSource(sourceId: string): boolean;
|
|
278
235
|
clearAudioSources(): void;
|
|
279
236
|
/**
|
|
280
|
-
* Drops one source's audio
|
|
281
|
-
*
|
|
282
|
-
* still reads of the source, so what the store holds stays seconds rather than every window
|
|
283
|
-
* decoded since a seek.
|
|
237
|
+
* Drops one source's audio ending before a time in its media timeline. Call it during playback,
|
|
238
|
+
* a few seconds behind the earliest time still mixed, to bound memory.
|
|
284
239
|
*/
|
|
285
240
|
trimAudioBefore(sourceId: string, ticks: bigint): void;
|
|
286
241
|
resetAudio(): void;
|
|
287
242
|
/**
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
* {@link resetAudio}, replays. Loudness measurements and other output that must repeat stay
|
|
294
|
-
* exact; from `beginExport` to `endExport` the renderer is exact whatever is chosen. Choosing
|
|
295
|
-
* another policy resets the audio. Any other name throws `INVALID_INPUT` (not fatal).
|
|
243
|
+
* How `renderAudio` handles a block that does not continue the previous one, outside an export.
|
|
244
|
+
* `"exact"` (default) replays up to 30 s of settling history, matching a fresh renderer.
|
|
245
|
+
* `"continue-small-gaps"` (live preview) continues across steps of up to {@link audioMaxBlock}
|
|
246
|
+
* samples and replays only on larger jumps or after {@link resetAudio}. Exports are always
|
|
247
|
+
* exact. Changing the policy resets the audio; an unknown name throws `INVALID_INPUT`.
|
|
296
248
|
*/
|
|
297
249
|
setAudioContinuity(policy: AudioContinuity): void;
|
|
298
250
|
/**
|
|
299
|
-
* Starts a deterministic export over a half-open timeline range.
|
|
300
|
-
*
|
|
301
|
-
* Export renders offscreen at the engine's export quality and never touches the presentation
|
|
302
|
-
* surface, so its output does not depend on the canvas, its size, or the browser compositor. Pass
|
|
303
|
-
* a zero rate to use the project's. Frames are packed for `codec`: their chroma sits where that
|
|
304
|
-
* codec implies.
|
|
251
|
+
* Starts a deterministic offscreen export over a half-open timeline range. A zero rate uses the
|
|
252
|
+
* project's. Frames are packed with the chroma siting `codec` implies.
|
|
305
253
|
*
|
|
306
|
-
* Until `endExport`, an audio block with a missing source
|
|
307
|
-
*
|
|
308
|
-
* export.
|
|
254
|
+
* Until `endExport`, an audio block with a missing source returns silence without advancing, so
|
|
255
|
+
* it can be rendered again after the upload. `loadProject` ends the export.
|
|
309
256
|
*/
|
|
310
257
|
beginExport(startTicks: bigint, endTicks: bigint, rateNum: number, rateDen: number, codec: EngineVideoCodec): void;
|
|
311
258
|
/** Renders the next export frame. Waiting never advances the cursor. */
|
|
312
259
|
exportFrame(): Promise<ExportFrameResult>;
|
|
313
|
-
/** Starts a frame and exposes its readback promise without awaiting it. */
|
|
314
260
|
beginExportFrame(): ExportFrameTicket;
|
|
315
261
|
/**
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
* before anything renders.
|
|
262
|
+
* Renders one timestamp outside any export, packed for `codec`; results carry no frame index.
|
|
263
|
+
* An odd 4:2:0 size throws `INVALID_INPUT`. `pixels` is an `FFmpeg` pixel format (`yuva420p`
|
|
264
|
+
* keeps alpha with no background, `yuv420p10le` is 10-bit); default I420.
|
|
320
265
|
*/
|
|
321
|
-
beginExportAt(timeTicks: bigint, codec: EngineVideoCodec): ExportAtTicket;
|
|
266
|
+
beginExportAt(timeTicks: bigint, codec: EngineVideoCodec, pixels?: string): ExportAtTicket;
|
|
322
267
|
/**
|
|
323
268
|
* JSON `{ completed, total, effectiveRange: { startTicks, endTicks }, audioWindow: { startSample,
|
|
324
|
-
* frames } }
|
|
325
|
-
* `
|
|
326
|
-
* `audioWindow` is the project-rate samples the export's audio covers, from that range.
|
|
269
|
+
* frames } }`; ticks and `startSample` are decimal strings. See `Alpha2Exporter.effectiveRange`
|
|
270
|
+
* and `audioWindow`.
|
|
327
271
|
*/
|
|
328
272
|
exportProgress(): string;
|
|
329
273
|
endExport(): void;
|
|
330
274
|
diagnostics?(): string;
|
|
331
|
-
/**
|
|
332
|
-
* Turns per-pass timing collection on or off. Off by default, because timing reads a clock per
|
|
333
|
-
* pass and allocates GPU timestamp resources; every other diagnostic field is always available.
|
|
334
|
-
*/
|
|
275
|
+
/** Per-pass timing, off by default because it costs a clock read and GPU timestamp resources. */
|
|
335
276
|
setPassTiming?(enabled: boolean): void;
|
|
336
277
|
resizeSurface?(width: number, height: number): void;
|
|
337
278
|
resetPlayer(): void;
|
|
338
279
|
free?(): void;
|
|
339
280
|
}
|
|
340
|
-
/**
|
|
281
|
+
/** An uploaded source texture generation and its byte cost. */
|
|
341
282
|
export interface FrameUploadReceipt {
|
|
342
283
|
readonly generation: bigint;
|
|
343
284
|
readonly retainedBytes: number;
|
|
344
285
|
}
|
|
345
|
-
/**
|
|
346
|
-
* A source frame a render needed and did not have, from the snapshot it rendered. A trimmed,
|
|
347
|
-
* offset, or retimed clip needs its source at a time other than the timeline's, so this is what to
|
|
348
|
-
* decode.
|
|
349
|
-
*/
|
|
286
|
+
/** A source frame a render needed but did not have; `mediaTimeTicks` is the time to decode. */
|
|
350
287
|
export interface WasmMissingFrame {
|
|
351
288
|
readonly clipId: string;
|
|
352
|
-
/**
|
|
289
|
+
/** Composition step that reads the source; `null` when the clip reads it directly. */
|
|
353
290
|
readonly readerId: string | null;
|
|
354
291
|
readonly sourceId: string;
|
|
355
|
-
/**
|
|
292
|
+
/** Decimal string to preserve full i64 precision. */
|
|
356
293
|
readonly mediaTimeTicks: string;
|
|
357
294
|
}
|
|
358
295
|
/** One step of an engine-owned export. */
|
|
@@ -369,26 +306,14 @@ export type ExportFrameResult = {
|
|
|
369
306
|
readonly timeTicks: string;
|
|
370
307
|
readonly width: number;
|
|
371
308
|
readonly height: number;
|
|
372
|
-
readonly format: "I420";
|
|
373
|
-
/**
|
|
374
|
-
* What the planes are coded as: the engine's export coding (BT.709, limited range), which a
|
|
375
|
-
* `VideoFrame` built from them carries so the encoder tags it, as the native encoder does.
|
|
376
|
-
*/
|
|
309
|
+
readonly format: "I420" | "I420A" | "I420P10" | "I420AP10";
|
|
310
|
+
/** BT.709 limited range; pass it to the `VideoFrame` so the encoder tags the stream. */
|
|
377
311
|
readonly colorSpace: VideoColorSpaceInit;
|
|
378
|
-
/**
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
* packed.
|
|
382
|
-
*/
|
|
383
|
-
readonly layout: readonly [
|
|
384
|
-
ExportPlaneLayout,
|
|
385
|
-
ExportPlaneLayout,
|
|
386
|
-
ExportPlaneLayout
|
|
387
|
-
];
|
|
388
|
-
/** Planar I420 at the offsets and strides of `layout`. */
|
|
312
|
+
/** Plane offsets and strides in `pixels`. Rows may be padded. */
|
|
313
|
+
readonly layout: readonly ExportPlaneLayout[];
|
|
314
|
+
/** Y, U, V, then alpha, as described by `layout`. */
|
|
389
315
|
readonly pixels: Uint8Array;
|
|
390
316
|
};
|
|
391
|
-
/** One plane of an exported frame: its first byte and its row pitch. */
|
|
392
317
|
export interface ExportPlaneLayout {
|
|
393
318
|
readonly offset: number;
|
|
394
319
|
readonly stride: number;
|
|
@@ -405,20 +330,17 @@ export type ExportFrameTicket = {
|
|
|
405
330
|
readonly kind: "rendered";
|
|
406
331
|
readonly index: number;
|
|
407
332
|
readonly timeTicks: string;
|
|
408
|
-
/** GPU readback
|
|
333
|
+
/** GPU readback bytes held by this ticket. */
|
|
409
334
|
readonly retainedBytes: number;
|
|
410
335
|
readonly readback: Promise<Extract<ExportFrameResult, {
|
|
411
336
|
kind: "rendered";
|
|
412
337
|
}>>;
|
|
413
338
|
};
|
|
414
|
-
/** A frame
|
|
339
|
+
/** A frame rendered by `beginExportAt`. */
|
|
415
340
|
export type ExportAtFrame = Omit<Extract<ExportFrameResult, {
|
|
416
341
|
kind: "rendered";
|
|
417
342
|
}>, "index">;
|
|
418
|
-
/**
|
|
419
|
-
* What `beginExportAt` answers: waiting for sources, or a frame whose GPU mapping can remain in
|
|
420
|
-
* flight.
|
|
421
|
-
*/
|
|
343
|
+
/** Result of `beginExportAt`; a rendered frame's GPU mapping can remain in flight. */
|
|
422
344
|
export type ExportAtTicket = {
|
|
423
345
|
readonly kind: "waiting";
|
|
424
346
|
readonly timeTicks: string;
|
|
@@ -427,50 +349,59 @@ export type ExportAtTicket = {
|
|
|
427
349
|
} | {
|
|
428
350
|
readonly kind: "rendered";
|
|
429
351
|
readonly timeTicks: string;
|
|
430
|
-
/** GPU readback
|
|
352
|
+
/** GPU readback bytes held by this ticket. */
|
|
431
353
|
readonly retainedBytes: number;
|
|
432
354
|
readonly readback: Promise<ExportAtFrame>;
|
|
433
355
|
};
|
|
356
|
+
/** Options for the binding's canvas constructors. */
|
|
357
|
+
export interface CanvasRendererOptions {
|
|
358
|
+
/**
|
|
359
|
+
* `"refuse"` rejects software adapters (fallback adapter, SwiftShader, llvmpipe, WARP) with
|
|
360
|
+
* `GPU_INIT_FAILED` before binding the canvas. Default `"allow"`.
|
|
361
|
+
*/
|
|
362
|
+
readonly softwareAdapter?: "allow" | "refuse";
|
|
363
|
+
}
|
|
434
364
|
/** Constructor shape injected by a browser host after loading wasm. */
|
|
435
365
|
export interface WasmEffectRegistryBinding {
|
|
436
366
|
create(): Promise<WasmEffectRegistry>;
|
|
437
|
-
createForCanvas?(canvas: OffscreenCanvas): Promise<WasmCanvasRenderer>;
|
|
438
|
-
createForHtmlCanvas?(canvas: HTMLCanvasElement): Promise<WasmCanvasRenderer>;
|
|
439
367
|
/**
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
|
|
368
|
+
* GPU renderer on `canvas` (WebGPU, else WebGL2). On WebGPU a rejection happens before the canvas
|
|
369
|
+
* is bound, leaving it free for the CPU renderer.
|
|
370
|
+
*/
|
|
371
|
+
createForCanvas?(canvas: OffscreenCanvas, options?: CanvasRendererOptions): Promise<WasmCanvasRenderer>;
|
|
372
|
+
createForHtmlCanvas?(canvas: HTMLCanvasElement, options?: CanvasRendererOptions): Promise<WasmCanvasRenderer>;
|
|
373
|
+
/**
|
|
374
|
+
* CPU renderer presenting on `canvas`'s 2D context, for browsers with no GPU path. Throws
|
|
375
|
+
* `INVALID_INPUT` for a canvas that already holds a WebGL or WebGPU context.
|
|
443
376
|
*/
|
|
444
377
|
createCpu?(canvas?: OffscreenCanvas | HTMLCanvasElement): WasmCanvasRenderer;
|
|
445
378
|
}
|
|
446
|
-
/** Typed
|
|
379
|
+
/** Typed wrapper over the effect registry binding. */
|
|
447
380
|
export declare class RuntimeEffectRegistry {
|
|
448
381
|
#private;
|
|
449
382
|
private constructor();
|
|
450
383
|
/** Creates a registry on a new binding instance; rejects when the binding cannot be created. */
|
|
451
384
|
static create(binding: WasmEffectRegistryBinding): Promise<RuntimeEffectRegistry>;
|
|
452
385
|
/**
|
|
453
|
-
* Compiles and registers one effect
|
|
454
|
-
* neither holds the binding while the browser compiles.
|
|
386
|
+
* Compiles and registers one effect, resolving to its `id@version`. Registrations may overlap.
|
|
455
387
|
*
|
|
456
|
-
* Rejects with `EFFECT_ERROR` and the shader's diagnostics when
|
|
457
|
-
*
|
|
388
|
+
* Rejects with `EFFECT_ERROR` and the shader's diagnostics when it does not compile, or when the
|
|
389
|
+
* same `id@version` was registered meanwhile.
|
|
458
390
|
*/
|
|
459
391
|
register(definition: EffectDefinition): Promise<string>;
|
|
460
392
|
/** Removes a host-registered effect; `false` when none was registered under `id@version`. */
|
|
461
393
|
unregister(id: string, version: number): boolean;
|
|
462
394
|
/** Removes every host-registered effect; built-in effects stay. */
|
|
463
395
|
clearHostEffects(): void;
|
|
464
|
-
/**
|
|
396
|
+
/** Built-in effects and transitions with authoring metadata. */
|
|
465
397
|
builtinCatalog(): BuiltinEffectCatalog;
|
|
466
398
|
/**
|
|
467
|
-
* Registers a 3D LUT under `resource.id
|
|
468
|
-
*
|
|
399
|
+
* Registers a 3D LUT under `resource.id`. Throws, changing nothing, when the `.cube` text is
|
|
400
|
+
* invalid or too large for the device.
|
|
469
401
|
*/
|
|
470
402
|
registerResource(resource: EffectResourceData): void;
|
|
471
403
|
/** Removes a registered resource; `false` when none had `id`. */
|
|
472
404
|
unregisterResource(id: string): boolean;
|
|
473
|
-
/** Removes every registered resource. */
|
|
474
405
|
clearResources(): void;
|
|
475
406
|
}
|
|
476
407
|
export {};
|
package/dist/effects.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Typed
|
|
1
|
+
/** Typed wrapper over the effect registry binding. */
|
|
2
2
|
export class RuntimeEffectRegistry {
|
|
3
3
|
#wasm;
|
|
4
4
|
constructor(wasm) {
|
|
@@ -9,11 +9,10 @@ export class RuntimeEffectRegistry {
|
|
|
9
9
|
return new RuntimeEffectRegistry(await binding.create());
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Compiles and registers one effect
|
|
13
|
-
* neither holds the binding while the browser compiles.
|
|
12
|
+
* Compiles and registers one effect, resolving to its `id@version`. Registrations may overlap.
|
|
14
13
|
*
|
|
15
|
-
* Rejects with `EFFECT_ERROR` and the shader's diagnostics when
|
|
16
|
-
*
|
|
14
|
+
* Rejects with `EFFECT_ERROR` and the shader's diagnostics when it does not compile, or when the
|
|
15
|
+
* same `id@version` was registered meanwhile.
|
|
17
16
|
*/
|
|
18
17
|
async register(definition) {
|
|
19
18
|
const compiled = await this.#wasm.compileEffect(JSON.stringify(definition));
|
|
@@ -27,13 +26,13 @@ export class RuntimeEffectRegistry {
|
|
|
27
26
|
clearHostEffects() {
|
|
28
27
|
this.#wasm.clearEffects();
|
|
29
28
|
}
|
|
30
|
-
/**
|
|
29
|
+
/** Built-in effects and transitions with authoring metadata. */
|
|
31
30
|
builtinCatalog() {
|
|
32
31
|
return JSON.parse(this.#wasm.builtinCatalog());
|
|
33
32
|
}
|
|
34
33
|
/**
|
|
35
|
-
* Registers a 3D LUT under `resource.id
|
|
36
|
-
*
|
|
34
|
+
* Registers a 3D LUT under `resource.id`. Throws, changing nothing, when the `.cube` text is
|
|
35
|
+
* invalid or too large for the device.
|
|
37
36
|
*/
|
|
38
37
|
registerResource(resource) {
|
|
39
38
|
this.#wasm.registerLut3d(resource.id, resource.data);
|
|
@@ -42,7 +41,6 @@ export class RuntimeEffectRegistry {
|
|
|
42
41
|
unregisterResource(id) {
|
|
43
42
|
return this.#wasm.unregisterEffectResource(id);
|
|
44
43
|
}
|
|
45
|
-
/** Removes every registered resource. */
|
|
46
44
|
clearResources() {
|
|
47
45
|
this.#wasm.clearEffectResources();
|
|
48
46
|
}
|