alpha2 0.4.5 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/THIRD_PARTY_NOTICES.md +4 -0
- package/dist/abort.d.ts +12 -0
- package/dist/abort.js +48 -0
- package/dist/active-clock.d.ts +35 -0
- package/dist/active-clock.js +99 -0
- package/dist/assets.d.ts +28 -22
- package/dist/assets.js +8 -12
- package/dist/audio-layout.d.ts +52 -74
- package/dist/audio-layout.js +114 -148
- package/dist/audio-timeline.d.ts +89 -117
- package/dist/audio-timeline.js +102 -118
- package/dist/audio-worker.d.ts +12 -21
- package/dist/audio-worker.js +8 -13
- package/dist/audio-worklet-processor.js +45 -58
- package/dist/audio-worklet.d.ts +45 -76
- package/dist/audio-worklet.js +44 -79
- package/dist/audio.d.ts +15 -23
- package/dist/audio.js +9 -13
- package/dist/builder.d.ts +45 -63
- package/dist/builder.js +49 -45
- package/dist/capabilities.d.ts +99 -16
- package/dist/capabilities.js +2 -2
- package/dist/captions.d.ts +45 -22
- package/dist/captions.js +60 -15
- package/dist/chroma-siting.d.ts +24 -41
- package/dist/chroma-siting.js +38 -71
- package/dist/containers.d.ts +41 -30
- package/dist/containers.js +59 -27
- package/dist/decoder-fallback.d.ts +13 -0
- package/dist/decoder-fallback.js +38 -0
- package/dist/decoder-order.d.ts +24 -39
- package/dist/decoder-order.js +28 -42
- package/dist/edit.d.ts +77 -154
- package/dist/edit.js +98 -180
- package/dist/effects.d.ts +109 -173
- package/dist/effects.js +7 -9
- package/dist/export-destination.d.ts +25 -41
- package/dist/export-destination.js +20 -32
- package/dist/export-failure.d.ts +34 -59
- package/dist/export-failure.js +54 -48
- package/dist/export-metrics.d.ts +116 -0
- package/dist/export-metrics.js +74 -0
- package/dist/export-retry.d.ts +46 -29
- package/dist/export-retry.js +86 -51
- package/dist/exporter.d.ts +67 -116
- package/dist/exporter.js +133 -133
- package/dist/extensions.d.ts +69 -115
- package/dist/extensions.js +55 -82
- package/dist/frame-intake.d.ts +92 -0
- package/dist/frame-intake.js +114 -0
- package/dist/frame-supply.d.ts +98 -157
- package/dist/frame-supply.js +191 -162
- package/dist/generated/project-schema.d.ts +742 -464
- package/dist/generated/project-schema.js +63 -2
- package/dist/generated/project-shape.js +663 -118
- package/dist/geometry.d.ts +28 -34
- package/dist/geometry.js +18 -23
- package/dist/gpu-recovery.d.ts +92 -0
- package/dist/gpu-recovery.js +135 -0
- package/dist/hdr-frames.d.ts +88 -62
- package/dist/hdr-frames.js +123 -46
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/json-text.d.ts +13 -23
- package/dist/json-text.js +10 -20
- package/dist/layout-values.d.ts +14 -22
- package/dist/layout-values.js +18 -21
- package/dist/layout.d.ts +55 -55
- package/dist/layout.js +37 -36
- package/dist/loudness.d.ts +27 -32
- package/dist/loudness.js +19 -23
- package/dist/media.d.ts +85 -237
- package/dist/media.js +133 -287
- package/dist/mediabunny.d.ts +173 -237
- package/dist/mediabunny.js +943 -518
- package/dist/physical-frames.d.ts +5 -17
- package/dist/physical-frames.js +4 -11
- package/dist/player.d.ts +56 -47
- package/dist/player.js +155 -40
- package/dist/presented-frames.d.ts +2 -7
- package/dist/presented-frames.js +3 -8
- package/dist/project.d.ts +83 -110
- package/dist/project.js +421 -447
- package/dist/rate-control.d.ts +9 -23
- package/dist/rate-control.js +7 -18
- package/dist/renderer-choice.d.ts +41 -0
- package/dist/renderer-choice.js +82 -0
- package/dist/repacked-bytes.d.ts +0 -2
- package/dist/repacked-bytes.js +2 -5
- package/dist/robustness.d.ts +25 -37
- package/dist/robustness.js +71 -54
- package/dist/sha256.d.ts +5 -13
- package/dist/sha256.js +9 -24
- package/dist/text.d.ts +106 -63
- package/dist/text.js +44 -69
- package/dist/video-frames.d.ts +7 -25
- package/dist/video-frames.js +12 -29
- package/dist/waveform.d.ts +5 -11
- package/dist/waveform.js +4 -9
- package/dist/worker-error.d.ts +5 -20
- package/dist/worker-error.js +8 -25
- package/dist/worker.d.ts +82 -92
- package/dist/worker.js +239 -144
- package/package.json +26 -2
- package/wasm/alpha2_audio_worklet.wasm +0 -0
- package/wasm/alpha2_extensions.d.ts +26 -47
- package/wasm/alpha2_extensions.js +26 -47
- package/wasm/alpha2_extensions_bg.wasm +0 -0
- package/wasm/alpha2_wasm.d.ts +487 -543
- package/wasm/alpha2_wasm.js +669 -572
- package/wasm/alpha2_wasm_bg.wasm +0 -0
- package/wasm/alpha2_wasm_bg.wasm.d.ts +20 -8
- package/wasm/rust-crate-licenses.md +2 -2
- package/wasm/snippets/{alpha2-wasm-57b04ecc6db57e1f → alpha2-wasm-1313375d424845c0}/inline1.js +1 -0
- package/wasm/snippets/alpha2-wasm-1313375d424845c0/inline2.js +82 -0
- package/wasm/snippets/alpha2-wasm-57b04ecc6db57e1f/inline2.js +0 -52
- /package/wasm/snippets/{alpha2-wasm-57b04ecc6db57e1f → alpha2-wasm-1313375d424845c0}/inline0.js +0 -0
- /package/wasm/snippets/{alpha2-wasm-57b04ecc6db57e1f → alpha2-wasm-1313375d424845c0}/inline3.js +0 -0
package/dist/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,182 +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
|
-
/**
|
|
223
|
+
/** Appends every face of an OpenType file (including `.ttc` collections) in file order. */
|
|
224
|
+
addFontFile(family: string, bytes: Uint8Array): void;
|
|
260
225
|
clearFonts(): void;
|
|
261
|
-
/** JSON source ids the
|
|
226
|
+
/** JSON source ids the last `renderAudio` call could not mix. */
|
|
262
227
|
audioMissingSources(): string;
|
|
263
228
|
audioChannels(): number;
|
|
264
229
|
audioSampleRate(): number;
|
|
265
230
|
audioRetainedFrames(): number;
|
|
266
231
|
audioRetainedBytes(): number;
|
|
267
|
-
/**
|
|
268
|
-
* JSON `[{startSample, endSample}]`: one source's retained windows as half-open project-rate
|
|
269
|
-
* sample intervals, most recently uploaded first.
|
|
270
|
-
*/
|
|
232
|
+
/** JSON `[{startSample, endSample}]` of a source's retained half-open windows, newest first. */
|
|
271
233
|
audioRetainedWindows(sourceId: string): string;
|
|
272
234
|
releaseAudioSource(sourceId: string): boolean;
|
|
273
235
|
clearAudioSources(): void;
|
|
274
236
|
/**
|
|
275
|
-
* Drops one source's audio
|
|
276
|
-
*
|
|
277
|
-
* still reads of the source, so what the store holds stays seconds rather than every window
|
|
278
|
-
* 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.
|
|
279
239
|
*/
|
|
280
240
|
trimAudioBefore(sourceId: string, ticks: bigint): void;
|
|
281
241
|
resetAudio(): void;
|
|
282
242
|
/**
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
* {@link resetAudio}, replays. Loudness measurements and other output that must repeat stay
|
|
289
|
-
* exact; from `beginExport` to `endExport` the renderer is exact whatever is chosen. Choosing
|
|
290
|
-
* 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`.
|
|
291
248
|
*/
|
|
292
249
|
setAudioContinuity(policy: AudioContinuity): void;
|
|
293
250
|
/**
|
|
294
|
-
* Starts a deterministic export over a half-open timeline range.
|
|
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.
|
|
295
253
|
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
* a zero rate to use the project's. Frames are packed for `codec`: their chroma sits where that
|
|
299
|
-
* codec implies.
|
|
300
|
-
*
|
|
301
|
-
* Until `endExport`, an audio block with a missing source is silence and advances nothing, so
|
|
302
|
-
* rendering it again once the source is uploaded continues exactly. `loadProject` ends the
|
|
303
|
-
* 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.
|
|
304
256
|
*/
|
|
305
257
|
beginExport(startTicks: bigint, endTicks: bigint, rateNum: number, rateDen: number, codec: EngineVideoCodec): void;
|
|
306
258
|
/** Renders the next export frame. Waiting never advances the cursor. */
|
|
307
259
|
exportFrame(): Promise<ExportFrameResult>;
|
|
308
|
-
/** Starts a frame and exposes its readback promise without awaiting it. */
|
|
309
260
|
beginExportFrame(): ExportFrameTicket;
|
|
310
261
|
/**
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
* 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.
|
|
315
265
|
*/
|
|
316
|
-
beginExportAt(timeTicks: bigint, codec: EngineVideoCodec): ExportAtTicket;
|
|
266
|
+
beginExportAt(timeTicks: bigint, codec: EngineVideoCodec, pixels?: string): ExportAtTicket;
|
|
317
267
|
/**
|
|
318
268
|
* JSON `{ completed, total, effectiveRange: { startTicks, endTicks }, audioWindow: { startSample,
|
|
319
|
-
* frames } }
|
|
320
|
-
* `
|
|
321
|
-
* `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`.
|
|
322
271
|
*/
|
|
323
272
|
exportProgress(): string;
|
|
324
273
|
endExport(): void;
|
|
325
274
|
diagnostics?(): string;
|
|
326
|
-
/**
|
|
327
|
-
* Turns per-pass timing collection on or off. Off by default, because timing reads a clock per
|
|
328
|
-
* pass and allocates GPU timestamp resources; every other diagnostic field is always available.
|
|
329
|
-
*/
|
|
275
|
+
/** Per-pass timing, off by default because it costs a clock read and GPU timestamp resources. */
|
|
330
276
|
setPassTiming?(enabled: boolean): void;
|
|
331
277
|
resizeSurface?(width: number, height: number): void;
|
|
332
278
|
resetPlayer(): void;
|
|
333
279
|
free?(): void;
|
|
334
280
|
}
|
|
335
|
-
/**
|
|
281
|
+
/** An uploaded source texture generation and its byte cost. */
|
|
336
282
|
export interface FrameUploadReceipt {
|
|
337
283
|
readonly generation: bigint;
|
|
338
284
|
readonly retainedBytes: number;
|
|
339
285
|
}
|
|
340
|
-
/**
|
|
341
|
-
* A source frame a render needed and did not have, from the snapshot it rendered. A trimmed,
|
|
342
|
-
* offset, or retimed clip needs its source at a time other than the timeline's, so this is what to
|
|
343
|
-
* decode.
|
|
344
|
-
*/
|
|
286
|
+
/** A source frame a render needed but did not have; `mediaTimeTicks` is the time to decode. */
|
|
345
287
|
export interface WasmMissingFrame {
|
|
346
288
|
readonly clipId: string;
|
|
347
|
-
/**
|
|
289
|
+
/** Composition step that reads the source; `null` when the clip reads it directly. */
|
|
348
290
|
readonly readerId: string | null;
|
|
349
291
|
readonly sourceId: string;
|
|
350
|
-
/**
|
|
292
|
+
/** Decimal string to preserve full i64 precision. */
|
|
351
293
|
readonly mediaTimeTicks: string;
|
|
352
294
|
}
|
|
353
295
|
/** One step of an engine-owned export. */
|
|
@@ -364,26 +306,14 @@ export type ExportFrameResult = {
|
|
|
364
306
|
readonly timeTicks: string;
|
|
365
307
|
readonly width: number;
|
|
366
308
|
readonly height: number;
|
|
367
|
-
readonly format: "I420";
|
|
368
|
-
/**
|
|
369
|
-
* What the planes are coded as: the engine's export coding (BT.709, limited range), which a
|
|
370
|
-
* `VideoFrame` built from them carries so the encoder tags it, as the native encoder does.
|
|
371
|
-
*/
|
|
309
|
+
readonly format: "I420" | "I420A" | "I420P10" | "I420AP10";
|
|
310
|
+
/** BT.709 limited range; pass it to the `VideoFrame` so the encoder tags the stream. */
|
|
372
311
|
readonly colorSpace: VideoColorSpaceInit;
|
|
373
|
-
/**
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
* packed.
|
|
377
|
-
*/
|
|
378
|
-
readonly layout: readonly [
|
|
379
|
-
ExportPlaneLayout,
|
|
380
|
-
ExportPlaneLayout,
|
|
381
|
-
ExportPlaneLayout
|
|
382
|
-
];
|
|
383
|
-
/** 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`. */
|
|
384
315
|
readonly pixels: Uint8Array;
|
|
385
316
|
};
|
|
386
|
-
/** One plane of an exported frame: its first byte and its row pitch. */
|
|
387
317
|
export interface ExportPlaneLayout {
|
|
388
318
|
readonly offset: number;
|
|
389
319
|
readonly stride: number;
|
|
@@ -400,20 +330,17 @@ export type ExportFrameTicket = {
|
|
|
400
330
|
readonly kind: "rendered";
|
|
401
331
|
readonly index: number;
|
|
402
332
|
readonly timeTicks: string;
|
|
403
|
-
/** GPU readback
|
|
333
|
+
/** GPU readback bytes held by this ticket. */
|
|
404
334
|
readonly retainedBytes: number;
|
|
405
335
|
readonly readback: Promise<Extract<ExportFrameResult, {
|
|
406
336
|
kind: "rendered";
|
|
407
337
|
}>>;
|
|
408
338
|
};
|
|
409
|
-
/** A frame
|
|
339
|
+
/** A frame rendered by `beginExportAt`. */
|
|
410
340
|
export type ExportAtFrame = Omit<Extract<ExportFrameResult, {
|
|
411
341
|
kind: "rendered";
|
|
412
342
|
}>, "index">;
|
|
413
|
-
/**
|
|
414
|
-
* What `beginExportAt` answers: waiting for sources, or a frame whose GPU mapping can remain in
|
|
415
|
-
* flight.
|
|
416
|
-
*/
|
|
343
|
+
/** Result of `beginExportAt`; a rendered frame's GPU mapping can remain in flight. */
|
|
417
344
|
export type ExportAtTicket = {
|
|
418
345
|
readonly kind: "waiting";
|
|
419
346
|
readonly timeTicks: string;
|
|
@@ -422,50 +349,59 @@ export type ExportAtTicket = {
|
|
|
422
349
|
} | {
|
|
423
350
|
readonly kind: "rendered";
|
|
424
351
|
readonly timeTicks: string;
|
|
425
|
-
/** GPU readback
|
|
352
|
+
/** GPU readback bytes held by this ticket. */
|
|
426
353
|
readonly retainedBytes: number;
|
|
427
354
|
readonly readback: Promise<ExportAtFrame>;
|
|
428
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
|
+
}
|
|
429
364
|
/** Constructor shape injected by a browser host after loading wasm. */
|
|
430
365
|
export interface WasmEffectRegistryBinding {
|
|
431
366
|
create(): Promise<WasmEffectRegistry>;
|
|
432
|
-
createForCanvas?(canvas: OffscreenCanvas): Promise<WasmCanvasRenderer>;
|
|
433
|
-
createForHtmlCanvas?(canvas: HTMLCanvasElement): Promise<WasmCanvasRenderer>;
|
|
434
367
|
/**
|
|
435
|
-
*
|
|
436
|
-
*
|
|
437
|
-
|
|
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.
|
|
438
376
|
*/
|
|
439
377
|
createCpu?(canvas?: OffscreenCanvas | HTMLCanvasElement): WasmCanvasRenderer;
|
|
440
378
|
}
|
|
441
|
-
/** Typed
|
|
379
|
+
/** Typed wrapper over the effect registry binding. */
|
|
442
380
|
export declare class RuntimeEffectRegistry {
|
|
443
381
|
#private;
|
|
444
382
|
private constructor();
|
|
445
383
|
/** Creates a registry on a new binding instance; rejects when the binding cannot be created. */
|
|
446
384
|
static create(binding: WasmEffectRegistryBinding): Promise<RuntimeEffectRegistry>;
|
|
447
385
|
/**
|
|
448
|
-
* Compiles and registers one effect
|
|
449
|
-
* neither holds the binding while the browser compiles.
|
|
386
|
+
* Compiles and registers one effect, resolving to its `id@version`. Registrations may overlap.
|
|
450
387
|
*
|
|
451
|
-
* Rejects with `EFFECT_ERROR` and the shader's diagnostics when
|
|
452
|
-
*
|
|
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.
|
|
453
390
|
*/
|
|
454
391
|
register(definition: EffectDefinition): Promise<string>;
|
|
455
392
|
/** Removes a host-registered effect; `false` when none was registered under `id@version`. */
|
|
456
393
|
unregister(id: string, version: number): boolean;
|
|
457
394
|
/** Removes every host-registered effect; built-in effects stay. */
|
|
458
395
|
clearHostEffects(): void;
|
|
459
|
-
/**
|
|
396
|
+
/** Built-in effects and transitions with authoring metadata. */
|
|
460
397
|
builtinCatalog(): BuiltinEffectCatalog;
|
|
461
398
|
/**
|
|
462
|
-
* Registers a 3D LUT under `resource.id
|
|
463
|
-
*
|
|
399
|
+
* Registers a 3D LUT under `resource.id`. Throws, changing nothing, when the `.cube` text is
|
|
400
|
+
* invalid or too large for the device.
|
|
464
401
|
*/
|
|
465
402
|
registerResource(resource: EffectResourceData): void;
|
|
466
403
|
/** Removes a registered resource; `false` when none had `id`. */
|
|
467
404
|
unregisterResource(id: string): boolean;
|
|
468
|
-
/** Removes every registered resource. */
|
|
469
405
|
clearResources(): void;
|
|
470
406
|
}
|
|
471
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
|
}
|