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/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,66 +99,65 @@ 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
|
-
*
|
|
123
|
+
* Compiles one effect definition without holding the binding while the browser compiles.
|
|
124
|
+
* Rejects with `EFFECT_ERROR` and the shader's diagnostics. The CPU renderer only validates the
|
|
125
|
+
* definition, since it cannot draw runtime effects.
|
|
132
126
|
*/
|
|
133
127
|
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
|
-
*/
|
|
128
|
+
/** Returns `id@version`; throws `EFFECT_ERROR` if that id was registered meanwhile. */
|
|
138
129
|
registerCompiledEffect(compiled: WasmCompiledEffect): string;
|
|
139
130
|
unregisterEffect(id: string, version: number): boolean;
|
|
140
131
|
clearEffects(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Registered runtime effects the loaded project can draw, as `id@version`. On the CPU renderer
|
|
134
|
+
* any of them makes rendering and export fail with `EFFECT_ERROR`.
|
|
135
|
+
*/
|
|
136
|
+
projectRuntimeEffects(): string[];
|
|
141
137
|
builtinCatalog(): string;
|
|
142
138
|
registerLut3d(id: string, cube: string): void;
|
|
143
139
|
unregisterEffectResource(id: string): boolean;
|
|
144
140
|
clearEffectResources(): void;
|
|
145
141
|
}
|
|
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
|
-
*/
|
|
142
|
+
/** See `WasmCanvasRenderer.setAudioContinuity`. */
|
|
152
143
|
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
|
-
*/
|
|
144
|
+
/** Generated wasm renderer surface, shared by the GPU and CPU renderers. */
|
|
157
145
|
export interface WasmCanvasRenderer extends WasmEffectRegistry {
|
|
158
146
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
147
|
+
* Absent means `"gpu"`. The CPU renderer registers runtime effects but refuses a project that
|
|
148
|
+
* draws one with `EFFECT_ERROR`.
|
|
161
149
|
*/
|
|
162
150
|
readonly renderer?: "gpu" | "cpu";
|
|
151
|
+
/** Absent on the CPU renderer. */
|
|
152
|
+
readonly backend?: "webgpu" | "webgl2";
|
|
153
|
+
/** Browser-reported adapter name; may be empty. */
|
|
154
|
+
readonly adapter?: string;
|
|
163
155
|
/**
|
|
164
|
-
*
|
|
165
|
-
* `
|
|
166
|
-
* CPU renderer is never lost.
|
|
156
|
+
* After a loss, JSON `{ hung, gpuMs, watchdogMs, timeTicks, frameIndex, effects }` with
|
|
157
|
+
* `timeTicks` as a decimal string; `undefined` before any loss and on the CPU renderer.
|
|
167
158
|
*/
|
|
159
|
+
readonly lossReport?: string;
|
|
160
|
+
/** A lost renderer rejects export readbacks and must be recreated. Never set on the CPU. */
|
|
168
161
|
readonly deviceLost: boolean;
|
|
169
162
|
readonly uploadedFrameCount: number;
|
|
170
163
|
readonly uploadedFrameBytes: bigint;
|
|
@@ -172,187 +165,149 @@ export interface WasmCanvasRenderer extends WasmEffectRegistry {
|
|
|
172
165
|
loadProject(projectJson: string): void;
|
|
173
166
|
uploadVideoFrame(sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame): FrameUploadReceipt;
|
|
174
167
|
uploadPresentedVideoFrame(sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame, outputWidth: number, outputHeight: number, rotationDegrees: number, mirror: boolean): FrameUploadReceipt;
|
|
175
|
-
/** `"direct"`, `"bitmap"`, `"untried"
|
|
168
|
+
/** `"direct"`, `"bitmap"`, `"untried"` or `"canvas"` (WebGL2). */
|
|
176
169
|
readonly videoFrameCopy: string;
|
|
177
170
|
/** `uploadPresentedVideoFrame` for a bitmap made with `premultiplyAlpha: "none"`. */
|
|
178
171
|
uploadPresentedImageBitmap(sourceId: string, mediaTimeTicks: bigint, bitmap: ImageBitmap, outputWidth: number, outputHeight: number, rotationDegrees: number, mirror: boolean): FrameUploadReceipt;
|
|
179
172
|
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
|
-
*/
|
|
173
|
+
/** Planar YUV converted with the project's color pipeline, which controls tone mapping. */
|
|
184
174
|
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
|
-
*/
|
|
175
|
+
/** Display size before rotation; carries the pixel aspect ratio. */
|
|
189
176
|
displayWidth: number, displayHeight: number, colorJson: string, chromaSiting: ChromaSiting, outputWidth: number, outputHeight: number, rotationDegrees: number, mirror: boolean): FrameUploadReceipt;
|
|
190
177
|
/** Whether the loaded project declares `sourceId` HDR. */
|
|
191
178
|
hdrSource(sourceId: string): boolean;
|
|
192
|
-
/**
|
|
179
|
+
/** Project-declared color for `sourceId`, as JSON. */
|
|
193
180
|
sourceColorMetadata(sourceId: string): string | undefined;
|
|
194
181
|
uploadRgbaImage(sourceId: string, width: number, height: number, pixels: Uint8Array): FrameUploadReceipt;
|
|
195
182
|
aliasVideoFrame(sourceId: string, existingMediaTimeTicks: bigint, requestedMediaTimeTicks: bigint): boolean;
|
|
196
183
|
releaseFrame(sourceId: string, mediaTimeTicks: bigint): boolean;
|
|
197
184
|
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
|
-
*/
|
|
185
|
+
/** Whether the still for `sourceId` is still upload `generation`; the engine may evict stills. */
|
|
202
186
|
holdsImage(sourceId: string, generation: bigint): boolean;
|
|
203
|
-
/** Releases
|
|
187
|
+
/** Releases a source's frames and still, such as after its media changed. */
|
|
204
188
|
releaseSourceFrames(sourceId: string): boolean;
|
|
205
189
|
clearFrames(): void;
|
|
206
|
-
/**
|
|
207
|
-
* Releases one source's frames before a time on that source's own timeline; other sources keep
|
|
208
|
-
* theirs.
|
|
209
|
-
*/
|
|
190
|
+
/** Releases one source's frames before a time in that source's media timeline. */
|
|
210
191
|
trimFramesBefore(sourceId: string, mediaTimeTicks: bigint): void;
|
|
211
192
|
readonly retiredFrameCount: number;
|
|
212
193
|
/** JSON clip/source/timestamp needs; decoder cursors are scoped by clip ID. */
|
|
213
194
|
frameNeeds(timeTicks: bigint): string;
|
|
214
195
|
renderAt(timeTicks: bigint): string;
|
|
215
196
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* engine folds them into the project's channels by speaker.
|
|
197
|
+
* Uploads project-rate planar audio; `startSample` is the source sample index of the first
|
|
198
|
+
* sample. `layout` is the speaker per plane, or a channel count for `FFmpeg`'s default layout
|
|
199
|
+
* (3 is 2.1, 4 is 4.0). The 1 to 24 planes are concatenated; the engine folds them into the
|
|
200
|
+
* project's channels by speaker.
|
|
221
201
|
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* `endsSource` with an upload that runs to the source's end, such as a whole decoded source.
|
|
202
|
+
* Missing samples mean audio not yet arrived, not silence, so a mix needs every sample of its
|
|
203
|
+
* block. Upload zeros past a source's end, or pass `endsSource` when the upload reaches it.
|
|
225
204
|
*
|
|
226
|
-
* An upload replaces
|
|
227
|
-
*
|
|
228
|
-
*
|
|
205
|
+
* An upload replaces overlapping windows and joins adjacent ones. Throws `RESOURCE_LIMIT` (not
|
|
206
|
+
* fatal) over 600 s or the store's 512 MiB, and `INVALID_INPUT` when malformed. `stream` is the
|
|
207
|
+
* audio stream an {@link audioNeeds} entry names, absent for the default one; each stream of a
|
|
208
|
+
* source is held apart.
|
|
229
209
|
*/
|
|
230
|
-
uploadAudioBlock(sourceId: string, startSample: bigint, sampleRate: number, layout: number | readonly AudioSpeaker[], samples: Float32Array, endsSource?: boolean): void;
|
|
231
|
-
/**
|
|
210
|
+
uploadAudioBlock(sourceId: string, startSample: bigint, sampleRate: number, layout: number | readonly AudioSpeaker[], samples: Float32Array, endsSource?: boolean, stream?: number): void;
|
|
211
|
+
/** Maximum samples per channel per {@link renderAudio} call. */
|
|
232
212
|
readonly audioMaxBlock: number;
|
|
233
213
|
/**
|
|
234
|
-
* Mixes
|
|
235
|
-
*
|
|
236
|
-
* consecutive calls.
|
|
214
|
+
* Mixes up to {@link audioMaxBlock} samples per channel and returns the channels concatenated.
|
|
215
|
+
* A longer block throws `INVALID_INPUT` (not fatal).
|
|
237
216
|
*/
|
|
238
217
|
renderAudio(startSample: bigint, frames: number, playing: boolean): Float32Array;
|
|
239
|
-
/**
|
|
218
|
+
/**
|
|
219
|
+
* JSON `[{sourceId, stream?, startTicks, endTicks}]`: source intervals required before a sample
|
|
220
|
+
* window can be mixed. `stream` is set for clips playing another audio stream than the default
|
|
221
|
+
* one (`audio.stream`).
|
|
222
|
+
*/
|
|
240
223
|
audioNeeds(startSample: bigint, frames: number): string;
|
|
241
224
|
/**
|
|
242
|
-
* Starts (from empty) or stops
|
|
243
|
-
*
|
|
244
|
-
* measures the mix as authored.
|
|
225
|
+
* Starts (from empty) or stops loudness metering before the master limiter. Starting resets the
|
|
226
|
+
* normalization gain so the mix is measured as authored.
|
|
245
227
|
*/
|
|
246
228
|
setLoudnessMetering(enabled: boolean): void;
|
|
247
229
|
/** JSON `LoudnessReport` (`alpha2/loudness`) since metering started, or `null`. */
|
|
248
230
|
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
|
-
*/
|
|
231
|
+
/** Static gain in dB before the master limiter; 0 removes it, as does starting metering. */
|
|
253
232
|
setNormalizationGainDb(gainDb: number): void;
|
|
254
233
|
/**
|
|
255
|
-
* Appends an OpenType font to the fallback stack
|
|
256
|
-
*
|
|
234
|
+
* Appends an OpenType font to the text fallback stack. The same fonts as the export host give
|
|
235
|
+
* identical text.
|
|
257
236
|
*/
|
|
258
237
|
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
|
-
*/
|
|
238
|
+
/** Appends every face of an OpenType file (including `.ttc` collections) in file order. */
|
|
263
239
|
addFontFile(family: string, bytes: Uint8Array): void;
|
|
264
|
-
/** Drops every font. */
|
|
265
240
|
clearFonts(): void;
|
|
266
|
-
/** JSON source ids the
|
|
241
|
+
/** JSON source ids the last `renderAudio` call could not mix. */
|
|
267
242
|
audioMissingSources(): string;
|
|
268
243
|
audioChannels(): number;
|
|
269
244
|
audioSampleRate(): number;
|
|
270
245
|
audioRetainedFrames(): number;
|
|
271
246
|
audioRetainedBytes(): number;
|
|
272
247
|
/**
|
|
273
|
-
* JSON `[{startSample, endSample}]
|
|
274
|
-
*
|
|
248
|
+
* JSON `[{startSample, endSample}]` of the retained half-open windows of a source's `stream`
|
|
249
|
+
* (absent for the default one), newest first.
|
|
275
250
|
*/
|
|
276
|
-
audioRetainedWindows(sourceId: string): string;
|
|
251
|
+
audioRetainedWindows(sourceId: string, stream?: number): string;
|
|
277
252
|
releaseAudioSource(sourceId: string): boolean;
|
|
278
253
|
clearAudioSources(): void;
|
|
279
254
|
/**
|
|
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.
|
|
255
|
+
* Drops one source's audio ending before a time in its media timeline. Call it during playback,
|
|
256
|
+
* a few seconds behind the earliest time still mixed, to bound memory.
|
|
284
257
|
*/
|
|
285
258
|
trimAudioBefore(sourceId: string, ticks: bigint): void;
|
|
286
259
|
resetAudio(): void;
|
|
287
260
|
/**
|
|
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).
|
|
261
|
+
* How `renderAudio` handles a block that does not continue the previous one, outside an export.
|
|
262
|
+
* `"exact"` (default) replays up to 30 s of settling history, matching a fresh renderer.
|
|
263
|
+
* `"continue-small-gaps"` (live preview) continues across steps of up to {@link audioMaxBlock}
|
|
264
|
+
* samples and replays only on larger jumps or after {@link resetAudio}. Exports are always
|
|
265
|
+
* exact. Changing the policy resets the audio; an unknown name throws `INVALID_INPUT`.
|
|
296
266
|
*/
|
|
297
267
|
setAudioContinuity(policy: AudioContinuity): void;
|
|
298
268
|
/**
|
|
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.
|
|
269
|
+
* Starts a deterministic offscreen export over a half-open timeline range. A zero rate uses the
|
|
270
|
+
* project's. Frames are packed with the chroma siting `codec` implies.
|
|
305
271
|
*
|
|
306
|
-
* Until `endExport`, an audio block with a missing source
|
|
307
|
-
*
|
|
308
|
-
* export.
|
|
272
|
+
* Until `endExport`, an audio block with a missing source returns silence without advancing, so
|
|
273
|
+
* it can be rendered again after the upload. `loadProject` ends the export.
|
|
309
274
|
*/
|
|
310
275
|
beginExport(startTicks: bigint, endTicks: bigint, rateNum: number, rateDen: number, codec: EngineVideoCodec): void;
|
|
311
276
|
/** Renders the next export frame. Waiting never advances the cursor. */
|
|
312
277
|
exportFrame(): Promise<ExportFrameResult>;
|
|
313
|
-
/** Starts a frame and exposes its readback promise without awaiting it. */
|
|
314
278
|
beginExportFrame(): ExportFrameTicket;
|
|
315
279
|
/**
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
* before anything renders.
|
|
280
|
+
* Renders one timestamp outside any export, packed for `codec`; results carry no frame index.
|
|
281
|
+
* An odd 4:2:0 size throws `INVALID_INPUT`. `pixels` is an `FFmpeg` pixel format (`yuva420p`
|
|
282
|
+
* keeps alpha with no background, `yuv420p10le` is 10-bit); default I420.
|
|
320
283
|
*/
|
|
321
|
-
beginExportAt(timeTicks: bigint, codec: EngineVideoCodec): ExportAtTicket;
|
|
284
|
+
beginExportAt(timeTicks: bigint, codec: EngineVideoCodec, pixels?: string): ExportAtTicket;
|
|
322
285
|
/**
|
|
323
286
|
* 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.
|
|
287
|
+
* frames } }`; ticks and `startSample` are decimal strings. See `Alpha2Exporter.effectiveRange`
|
|
288
|
+
* and `audioWindow`.
|
|
327
289
|
*/
|
|
328
290
|
exportProgress(): string;
|
|
329
291
|
endExport(): void;
|
|
330
292
|
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
|
-
*/
|
|
293
|
+
/** Per-pass timing, off by default because it costs a clock read and GPU timestamp resources. */
|
|
335
294
|
setPassTiming?(enabled: boolean): void;
|
|
336
295
|
resizeSurface?(width: number, height: number): void;
|
|
337
296
|
resetPlayer(): void;
|
|
338
297
|
free?(): void;
|
|
339
298
|
}
|
|
340
|
-
/**
|
|
299
|
+
/** An uploaded source texture generation and its byte cost. */
|
|
341
300
|
export interface FrameUploadReceipt {
|
|
342
301
|
readonly generation: bigint;
|
|
343
302
|
readonly retainedBytes: number;
|
|
344
303
|
}
|
|
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
|
-
*/
|
|
304
|
+
/** A source frame a render needed but did not have; `mediaTimeTicks` is the time to decode. */
|
|
350
305
|
export interface WasmMissingFrame {
|
|
351
306
|
readonly clipId: string;
|
|
352
|
-
/**
|
|
307
|
+
/** Composition step that reads the source; `null` when the clip reads it directly. */
|
|
353
308
|
readonly readerId: string | null;
|
|
354
309
|
readonly sourceId: string;
|
|
355
|
-
/**
|
|
310
|
+
/** Decimal string to preserve full i64 precision. */
|
|
356
311
|
readonly mediaTimeTicks: string;
|
|
357
312
|
}
|
|
358
313
|
/** One step of an engine-owned export. */
|
|
@@ -369,26 +324,14 @@ export type ExportFrameResult = {
|
|
|
369
324
|
readonly timeTicks: string;
|
|
370
325
|
readonly width: number;
|
|
371
326
|
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
|
-
*/
|
|
327
|
+
readonly format: "I420" | "I420A" | "I420P10" | "I420AP10";
|
|
328
|
+
/** BT.709 limited range; pass it to the `VideoFrame` so the encoder tags the stream. */
|
|
377
329
|
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`. */
|
|
330
|
+
/** Plane offsets and strides in `pixels`. Rows may be padded. */
|
|
331
|
+
readonly layout: readonly ExportPlaneLayout[];
|
|
332
|
+
/** Y, U, V, then alpha, as described by `layout`. */
|
|
389
333
|
readonly pixels: Uint8Array;
|
|
390
334
|
};
|
|
391
|
-
/** One plane of an exported frame: its first byte and its row pitch. */
|
|
392
335
|
export interface ExportPlaneLayout {
|
|
393
336
|
readonly offset: number;
|
|
394
337
|
readonly stride: number;
|
|
@@ -405,20 +348,17 @@ export type ExportFrameTicket = {
|
|
|
405
348
|
readonly kind: "rendered";
|
|
406
349
|
readonly index: number;
|
|
407
350
|
readonly timeTicks: string;
|
|
408
|
-
/** GPU readback
|
|
351
|
+
/** GPU readback bytes held by this ticket. */
|
|
409
352
|
readonly retainedBytes: number;
|
|
410
353
|
readonly readback: Promise<Extract<ExportFrameResult, {
|
|
411
354
|
kind: "rendered";
|
|
412
355
|
}>>;
|
|
413
356
|
};
|
|
414
|
-
/** A frame
|
|
357
|
+
/** A frame rendered by `beginExportAt`. */
|
|
415
358
|
export type ExportAtFrame = Omit<Extract<ExportFrameResult, {
|
|
416
359
|
kind: "rendered";
|
|
417
360
|
}>, "index">;
|
|
418
|
-
/**
|
|
419
|
-
* What `beginExportAt` answers: waiting for sources, or a frame whose GPU mapping can remain in
|
|
420
|
-
* flight.
|
|
421
|
-
*/
|
|
361
|
+
/** Result of `beginExportAt`; a rendered frame's GPU mapping can remain in flight. */
|
|
422
362
|
export type ExportAtTicket = {
|
|
423
363
|
readonly kind: "waiting";
|
|
424
364
|
readonly timeTicks: string;
|
|
@@ -427,50 +367,59 @@ export type ExportAtTicket = {
|
|
|
427
367
|
} | {
|
|
428
368
|
readonly kind: "rendered";
|
|
429
369
|
readonly timeTicks: string;
|
|
430
|
-
/** GPU readback
|
|
370
|
+
/** GPU readback bytes held by this ticket. */
|
|
431
371
|
readonly retainedBytes: number;
|
|
432
372
|
readonly readback: Promise<ExportAtFrame>;
|
|
433
373
|
};
|
|
374
|
+
/** Options for the binding's canvas constructors. */
|
|
375
|
+
export interface CanvasRendererOptions {
|
|
376
|
+
/**
|
|
377
|
+
* `"refuse"` rejects software adapters (fallback adapter, SwiftShader, llvmpipe, WARP) with
|
|
378
|
+
* `GPU_INIT_FAILED` before binding the canvas. Default `"allow"`.
|
|
379
|
+
*/
|
|
380
|
+
readonly softwareAdapter?: "allow" | "refuse";
|
|
381
|
+
}
|
|
434
382
|
/** Constructor shape injected by a browser host after loading wasm. */
|
|
435
383
|
export interface WasmEffectRegistryBinding {
|
|
436
384
|
create(): Promise<WasmEffectRegistry>;
|
|
437
|
-
createForCanvas?(canvas: OffscreenCanvas): Promise<WasmCanvasRenderer>;
|
|
438
|
-
createForHtmlCanvas?(canvas: HTMLCanvasElement): Promise<WasmCanvasRenderer>;
|
|
439
385
|
/**
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
|
|
386
|
+
* GPU renderer on `canvas` (WebGPU, else WebGL2). On WebGPU a rejection happens before the canvas
|
|
387
|
+
* is bound, leaving it free for the CPU renderer.
|
|
388
|
+
*/
|
|
389
|
+
createForCanvas?(canvas: OffscreenCanvas, options?: CanvasRendererOptions): Promise<WasmCanvasRenderer>;
|
|
390
|
+
createForHtmlCanvas?(canvas: HTMLCanvasElement, options?: CanvasRendererOptions): Promise<WasmCanvasRenderer>;
|
|
391
|
+
/**
|
|
392
|
+
* CPU renderer presenting on `canvas`'s 2D context, for browsers with no GPU path. Throws
|
|
393
|
+
* `INVALID_INPUT` for a canvas that already holds a WebGL or WebGPU context.
|
|
443
394
|
*/
|
|
444
395
|
createCpu?(canvas?: OffscreenCanvas | HTMLCanvasElement): WasmCanvasRenderer;
|
|
445
396
|
}
|
|
446
|
-
/** Typed
|
|
397
|
+
/** Typed wrapper over the effect registry binding. */
|
|
447
398
|
export declare class RuntimeEffectRegistry {
|
|
448
399
|
#private;
|
|
449
400
|
private constructor();
|
|
450
401
|
/** Creates a registry on a new binding instance; rejects when the binding cannot be created. */
|
|
451
402
|
static create(binding: WasmEffectRegistryBinding): Promise<RuntimeEffectRegistry>;
|
|
452
403
|
/**
|
|
453
|
-
* Compiles and registers one effect
|
|
454
|
-
* neither holds the binding while the browser compiles.
|
|
404
|
+
* Compiles and registers one effect, resolving to its `id@version`. Registrations may overlap.
|
|
455
405
|
*
|
|
456
|
-
* Rejects with `EFFECT_ERROR` and the shader's diagnostics when
|
|
457
|
-
*
|
|
406
|
+
* Rejects with `EFFECT_ERROR` and the shader's diagnostics when it does not compile, or when the
|
|
407
|
+
* same `id@version` was registered meanwhile.
|
|
458
408
|
*/
|
|
459
409
|
register(definition: EffectDefinition): Promise<string>;
|
|
460
410
|
/** Removes a host-registered effect; `false` when none was registered under `id@version`. */
|
|
461
411
|
unregister(id: string, version: number): boolean;
|
|
462
412
|
/** Removes every host-registered effect; built-in effects stay. */
|
|
463
413
|
clearHostEffects(): void;
|
|
464
|
-
/**
|
|
414
|
+
/** Built-in effects and transitions with authoring metadata. */
|
|
465
415
|
builtinCatalog(): BuiltinEffectCatalog;
|
|
466
416
|
/**
|
|
467
|
-
* Registers a 3D LUT under `resource.id
|
|
468
|
-
*
|
|
417
|
+
* Registers a 3D LUT under `resource.id`. Throws, changing nothing, when the `.cube` text is
|
|
418
|
+
* invalid or too large for the device.
|
|
469
419
|
*/
|
|
470
420
|
registerResource(resource: EffectResourceData): void;
|
|
471
421
|
/** Removes a registered resource; `false` when none had `id`. */
|
|
472
422
|
unregisterResource(id: string): boolean;
|
|
473
|
-
/** Removes every registered resource. */
|
|
474
423
|
clearResources(): void;
|
|
475
424
|
}
|
|
476
425
|
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
|
}
|