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