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.
Files changed (119) 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 +28 -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 +109 -173
  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 +98 -157
  53. package/dist/frame-supply.js +191 -162
  54. package/dist/generated/project-schema.d.ts +742 -464
  55. package/dist/generated/project-schema.js +63 -2
  56. package/dist/generated/project-shape.js +663 -118
  57. package/dist/geometry.d.ts +28 -34
  58. package/dist/geometry.js +18 -23
  59. package/dist/gpu-recovery.d.ts +92 -0
  60. package/dist/gpu-recovery.js +135 -0
  61. package/dist/hdr-frames.d.ts +88 -62
  62. package/dist/hdr-frames.js +123 -46
  63. package/dist/index.d.ts +4 -0
  64. package/dist/index.js +4 -0
  65. package/dist/json-text.d.ts +13 -23
  66. package/dist/json-text.js +10 -20
  67. package/dist/layout-values.d.ts +14 -22
  68. package/dist/layout-values.js +18 -21
  69. package/dist/layout.d.ts +55 -55
  70. package/dist/layout.js +37 -36
  71. package/dist/loudness.d.ts +27 -32
  72. package/dist/loudness.js +19 -23
  73. package/dist/media.d.ts +85 -237
  74. package/dist/media.js +133 -287
  75. package/dist/mediabunny.d.ts +173 -237
  76. package/dist/mediabunny.js +943 -518
  77. package/dist/physical-frames.d.ts +5 -17
  78. package/dist/physical-frames.js +4 -11
  79. package/dist/player.d.ts +56 -47
  80. package/dist/player.js +155 -40
  81. package/dist/presented-frames.d.ts +2 -7
  82. package/dist/presented-frames.js +3 -8
  83. package/dist/project.d.ts +83 -110
  84. package/dist/project.js +421 -447
  85. package/dist/rate-control.d.ts +9 -23
  86. package/dist/rate-control.js +7 -18
  87. package/dist/renderer-choice.d.ts +41 -0
  88. package/dist/renderer-choice.js +82 -0
  89. package/dist/repacked-bytes.d.ts +0 -2
  90. package/dist/repacked-bytes.js +2 -5
  91. package/dist/robustness.d.ts +25 -37
  92. package/dist/robustness.js +71 -54
  93. package/dist/sha256.d.ts +5 -13
  94. package/dist/sha256.js +9 -24
  95. package/dist/text.d.ts +106 -63
  96. package/dist/text.js +44 -69
  97. package/dist/video-frames.d.ts +7 -25
  98. package/dist/video-frames.js +12 -29
  99. package/dist/waveform.d.ts +5 -11
  100. package/dist/waveform.js +4 -9
  101. package/dist/worker-error.d.ts +5 -20
  102. package/dist/worker-error.js +8 -25
  103. package/dist/worker.d.ts +82 -92
  104. package/dist/worker.js +239 -144
  105. package/package.json +26 -2
  106. package/wasm/alpha2_audio_worklet.wasm +0 -0
  107. package/wasm/alpha2_extensions.d.ts +26 -47
  108. package/wasm/alpha2_extensions.js +26 -47
  109. package/wasm/alpha2_extensions_bg.wasm +0 -0
  110. package/wasm/alpha2_wasm.d.ts +487 -543
  111. package/wasm/alpha2_wasm.js +669 -572
  112. package/wasm/alpha2_wasm_bg.wasm +0 -0
  113. package/wasm/alpha2_wasm_bg.wasm.d.ts +20 -8
  114. package/wasm/rust-crate-licenses.md +2 -2
  115. package/wasm/snippets/{alpha2-wasm-57b04ecc6db57e1f → alpha2-wasm-1313375d424845c0}/inline1.js +1 -0
  116. package/wasm/snippets/alpha2-wasm-1313375d424845c0/inline2.js +82 -0
  117. package/wasm/snippets/alpha2-wasm-57b04ecc6db57e1f/inline2.js +0 -52
  118. /package/wasm/snippets/{alpha2-wasm-57b04ecc6db57e1f → alpha2-wasm-1313375d424845c0}/inline0.js +0 -0
  119. /package/wasm/snippets/{alpha2-wasm-57b04ecc6db57e1f → alpha2-wasm-1313375d424845c0}/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,204 +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; a host that cannot decode the source in software rejects. Absent
112
- * 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.
113
99
  */
114
100
  readonly decode?: "software";
115
101
  }
116
102
  /** Host callbacks and frame geometry for one `supply` call. */
117
103
  export interface FrameSupplyOptions {
118
- /** The project's output size, which RGBA pixels must match. */
104
+ /** Output size; RGBA pixels must match it. */
119
105
  readonly width: number;
120
106
  readonly height: number;
121
107
  /**
122
- * What a source's pixels are, as a value that changes exactly when they do: other media, other
123
- * provider settings, a proxy instead of the original. Compared with `Object.is`. A source whose
124
- * value changes loses what was uploaded for it, in this supply and in the engine; every other
125
- * source keeps its uploads across project loads. Without it a source's pixels never change while
126
- * it stays in the project, which is the engine's own rule: media that changes under an unchanged
127
- * 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.
128
111
  */
129
112
  readonly contentOf?: (sourceId: string) => unknown;
130
- /** Sources still present in the project. Others have their uploads retired. */
113
+ /** Sources still in the project; others have their uploads retired. */
131
114
  readonly liveSourceIds: ReadonlySet<string>;
132
- /** The source's layer; a missing one makes `supply` reject. */
115
+ /** A missing layer makes `supply` reject. */
133
116
  readonly getLayer: (sourceId: string) => FrameSupplyLayer | null | undefined;
134
117
  /**
135
- * Decodes `layer` at `seconds` of source time. Resolves with the frame, or `null` when the
136
- * source has no frame there; a rejection rejects `supply`. The supply takes ownership of a
137
- * 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`.
138
120
  */
139
121
  readonly pixelsFor: (layer: FrameSupplyLayer, seconds: number, options: FrameSupplyDecodeOptions) => Promise<FrameSupplySource | null>;
140
122
  /** Opens or retains one decoder cursor per consumer before decoding starts. */
141
123
  readonly retainVideoConsumers?: (consumerIds: ReadonlySet<string>) => Promise<void> | void;
142
- /**
143
- * Returns false once an edit, seek, or pause invalidates this request. Asked before each decode,
144
- * so a replaced request decodes nothing more.
145
- */
124
+ /** Returns false once an edit, seek or pause invalidates the request; checked per decode. */
146
125
  readonly isCurrent: () => boolean;
147
126
  }
148
127
  /** Memory envelope for source textures whose render submission has completed. */
149
128
  export interface FrameRetentionOptions {
150
129
  /**
151
- * Texture bytes kept resident after their frames were rendered, so repeated requests reuse them.
152
- * 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.
153
132
  */
154
133
  readonly maxRetiredBytes?: number;
155
134
  }
156
135
  /** Resource and concurrency limits owned by one frame supplier. */
157
136
  export interface FrameSupplyConfig extends FrameRetentionOptions {
158
- /**
159
- * Bytes of uploaded stills kept cached, least recently used evicted first. Defaults to 256 MiB.
160
- */
137
+ /** Cached still bytes, evicted least recently used first. Defaults to 256 MiB. */
161
138
  readonly maxCachedImageBytes?: number;
162
- /** Maximum number of independent decoder cursors running at once. Defaults to 2. */
139
+ /** Maximum concurrent decoder cursors. Defaults to 2. */
163
140
  readonly maxDecodeConcurrency?: number;
164
- /**
165
- * Who converts a decoded SDR `VideoFrame`: the engine, from its planes (`"engine"`, the
166
- * default), or the browser (`"browser"`); see {@link VideoConversion}.
167
- */
141
+ /** See {@link VideoConversion}. Defaults to `"engine"`. */
168
142
  readonly videoConversion?: VideoConversion;
169
143
  /**
170
- * What becomes of a frame whose planes the browser cannot read back, once reading them again
171
- * has failed: `"redecode"` (the default) decodes it again in software, which decodes the same
172
- * picture, and fails the supply if that fails too; `"present"` gives it to the browser's
173
- * conversion instead, unless the engine must convert it (HDR, or color the project declares),
174
- * for a preview, where a frame shown at once matters more than the engine's conversion.
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.
175
148
  */
176
149
  readonly unreadableFrames?: "redecode" | "present";
177
- }
178
- /** How a {@link FrameSupply} recovered frames the browser could not read back; cumulative. */
179
- export interface ReadbackRecoveryStats {
180
- /** Frames whose planes the browser still could not read back after the repeated reads. */
181
- readonly unreadableFrames: number;
182
- /** Reads repeated on the same frame. */
183
- readonly readbackRetries: number;
184
- /** Frames decoded again in software and copied from that decode. */
185
- readonly redecodedFrames: number;
186
- /** Frames given to the browser's conversion (`unreadableFrames: "present"`). */
187
- readonly presentedFrames: number;
150
+ /**
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"`.
156
+ */
157
+ readonly opaqueEngineFrames?: "refuse" | "present-degraded";
188
158
  }
189
159
  /**
190
- * Keeps completed source upload generations resident within a byte budget, releasing the oldest
191
- * through `release` when the budget is exceeded.
160
+ * Keeps rendered upload generations within a byte budget, releasing the oldest through `release`.
192
161
  *
193
162
  * The constructor throws `RangeError` when `maxRetiredBytes` is not a positive safe integer.
194
163
  */
195
164
  export declare class FrameGenerationRetainer {
196
165
  #private;
197
166
  constructor(release: (generation: bigint) => void, options?: FrameRetentionOptions);
198
- /** Bytes of the generations currently held. */
199
167
  get retainedBytes(): number;
200
168
  /**
201
- * Takes over generations whose rendering has completed, releasing older ones past the budget.
169
+ * Takes over rendered generations, releasing older ones past the budget.
202
170
  *
203
171
  * @throws RangeError for a receipt with a non-positive generation or byte count.
204
172
  */
205
173
  retire(uploads: readonly FrameUploadReceipt[]): void;
206
- /**
207
- * Forgets every held generation without releasing it, for when the owning engine has dropped its
208
- * whole frame store.
209
- */
174
+ /** Forgets held generations without releasing them, after the engine dropped its frame store. */
210
175
  discardAll(): void;
211
176
  }
212
177
  /** One upload reported through {@link FrameSupply.onUpload}. */
213
178
  export interface FrameUploadTrace {
214
179
  readonly sourceId: string;
215
180
  readonly mediaTimeTicks: string;
216
- /** A sparse 32-bit checksum of the uploaded RGBA pixels, for telling pictures apart. */
181
+ /** Sparse 32-bit checksum of the uploaded RGBA pixels. */
217
182
  readonly checksum: number;
218
183
  }
219
184
  /** Uploads accepted by the engine for one timestamp. */
220
185
  export interface SuppliedFrame {
221
- /** Everything the engine asked for, including needs served by an existing upload. */
186
+ /** Every need, including those served by an existing upload. */
222
187
  readonly needs: readonly FrameNeed[];
223
- /** Receipts for the textures this call uploaded; pass them to `retire` once rendered. */
188
+ /** Pass to `retire` once rendered. */
224
189
  readonly uploaded: readonly FrameUploadReceipt[];
225
190
  }
226
191
  /** Outcome of one real-time presentation attempt. */
@@ -229,19 +194,18 @@ export interface PlaybackResult {
229
194
  /** `null` until the engine has presented a frame, and after a reset. */
230
195
  readonly presentedTimeTicks: number | null;
231
196
  readonly missingSources: readonly string[];
232
- readonly repeated: boolean;
233
197
  /**
234
- * The frame equals the one presented last, so the engine neither rendered nor presented it: the
235
- * 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.
236
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. */
237
204
  readonly unchanged: boolean;
238
205
  }
239
206
  /**
240
- * Engine surface this module drives.
241
- *
242
- * The wasm `WebEffectRegistry` satisfies it; a worker-side proxy that forwards the same calls does
243
- * too. Optional methods are probed per call, and a source that needs a missing one makes `supply`
244
- * 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.
245
209
  */
246
210
  export interface FrameSupplyEngine {
247
211
  readonly deviceLost: boolean;
@@ -252,106 +216,83 @@ export interface FrameSupplyEngine {
252
216
  uploadPresentedVideoFrame?(sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame, width: number, height: number, rotation: number | undefined, mirror: boolean): FrameUploadReceipt;
253
217
  readonly videoFrameCopy?: string;
254
218
  uploadPresentedImageBitmap?: PresentedFrameEngine["uploadPresentedImageBitmap"];
255
- /**
256
- * Converts planar YUV with the project's color pipeline. An engine that has it takes every HDR
257
- * frame this way, never through the browser's conversion, and every other planar frame unless
258
- * the supply leaves SDR to the browser.
259
- */
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. */
260
222
  uploadYuvFrame?: PlanarYuvEngine["uploadYuvFrame"];
261
223
  /** Presents a premultiplied or straight RGBA8 frame at its own size into the output. */
262
224
  uploadPresentedRgbaFrame?: (sourceId: string, mediaTimeTicks: bigint, width: number, height: number, pixels: Uint8Array, premultiplied: boolean, outputWidth: number, outputHeight: number) => FrameUploadReceipt;
263
225
  /** Like `uploadPresentedRgbaFrame`, for a still shown at every time. */
264
226
  uploadPresentedRgbaImage?: (sourceId: string, width: number, height: number, pixels: Uint8Array, premultiplied: boolean, outputWidth: number, outputHeight: number) => FrameUploadReceipt;
265
- /**
266
- * Presents a premultiplied linear-light RGBA half-float frame at its own size into the output.
267
- */
227
+ /** Presents a premultiplied linear-light RGBA half-float frame at its own size. */
268
228
  uploadPresentedLinearFrame?: (sourceId: string, mediaTimeTicks: bigint, width: number, height: number, pixels: Uint16Array, outputWidth: number, outputHeight: number) => FrameUploadReceipt;
269
229
  /** Like `uploadPresentedLinearFrame`, for a still shown at every time. */
270
230
  uploadPresentedLinearImage?: (sourceId: string, width: number, height: number, pixels: Uint16Array, outputWidth: number, outputHeight: number) => FrameUploadReceipt;
271
231
  /** Whether the loaded project declares `sourceId` HDR. */
272
232
  hdrSource?(sourceId: string): boolean;
273
- /** The color the loaded project declares for `sourceId`, as JSON. */
233
+ /** Project-declared color for `sourceId`, as JSON. */
274
234
  sourceColorMetadata?(sourceId: string): string | undefined;
275
235
  aliasVideoFrame(sourceId: string, existingMediaTimeTicks: bigint, requestedMediaTimeTicks: bigint): boolean;
276
- /**
277
- * Whether the engine still holds the still `sourceId` as the upload `generation` names; the
278
- * engine drops stills on its own.
279
- */
236
+ /** Whether the still for `sourceId` is still upload `generation`; the engine may evict stills. */
280
237
  holdsImage(sourceId: string, generation: bigint): boolean;
281
238
  releaseFrameGeneration(generation: bigint): void;
282
- /** Drops the frames and still of one source whose media changed. */
239
+ /** Drops a source's frames and still after its media changed. */
283
240
  releaseSourceFrames(sourceId: string): void;
284
241
  renderAt(timeTicks: bigint): string;
285
242
  }
286
243
  /**
287
- * Keys the decoder cursor of one clip reading one asset.
288
- *
289
- * Two clips sharing a source must not share a cursor: a single sequential decoder would seek
290
- * 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.
291
246
  */
292
247
  export declare function decoderCursorKey(assetId: string, consumerId: string): string;
293
- /** Raw source video a {@link FrameSupply} copied through script memory, cumulative. */
248
+ /** Cumulative raw source video a {@link FrameSupply} copied through script memory. */
294
249
  export interface SourceTransferStats {
295
250
  readonly planarCopyFrames: number;
296
251
  readonly planarCopyBytes: number;
297
252
  }
298
253
  /**
299
- * Reference host-side consumer of the engine's `frameNeeds` contract.
300
- *
301
- * It asks the engine which source frames one timestamp requires, decodes each through a
302
- * clip-scoped cursor, uploads them, and bounds upload retention. Requests whose frames resolve to
303
- * 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.
304
257
  *
305
- * 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.
306
259
  */
307
260
  export declare class FrameSupply {
308
261
  #private;
309
262
  /**
310
- * Optional upload trace, for diagnosing a clip that renders another clip's picture. Every RGBA
311
- * upload then reports which source received which pixels. Two sources sharing a checksum means
312
- * the host decoded the wrong asset, which is a host bug; distinct checksums move the search into
313
- * 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.
314
265
  */
315
266
  onUpload: ((entry: FrameUploadTrace) => void) | null;
316
267
  constructor(engine: FrameSupplyEngine, options?: FrameSupplyConfig);
317
- /** Bytes of rendered source textures kept resident; see {@link FrameRetentionOptions}. */
268
+ /** See {@link FrameRetentionOptions}. */
318
269
  get retiredBytes(): number;
319
- /** Bytes of uploaded stills currently cached. */
320
270
  get cachedImageBytes(): number;
321
- /**
322
- * Raw source video this supply copied through script memory, cumulative. Frames are copied out
323
- * planar so the engine converts them, as natively (see {@link VideoConversion}); that copy is a
324
- * source-side cost, apart from any output readback.
325
- */
271
+ /** Planar copies made for engine conversion (see {@link VideoConversion}). */
326
272
  get sourceTransfer(): SourceTransferStats;
327
- /** Frames the browser could not read back, and how they were recovered; cumulative. */
273
+ /** Cumulative readback failures and how they were recovered. */
328
274
  get readbackRecovery(): ReadbackRecoveryStats;
329
275
  /**
330
- * Uploads every source the engine asks for at one timestamp. Browser video stays as a
331
- * `VideoFrame` until the WebGPU external-image copy consumes it.
276
+ * Uploads every source the engine needs at one timestamp.
332
277
  *
333
- * Resolves with receipts for the textures this call uploaded, or `null` when `isCurrent` turned
334
- * false mid-decode (decoded frames are then closed). The caller retires the receipts with
335
- * {@link FrameSupply.retire} once the engine has consumed them, so this call does not; the still
336
- * 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).
337
280
  *
338
- * Rejects with a fatal `GPU_DEVICE_LOST` error when the engine's device is lost, and with an
339
- * `Error` when a source is unavailable, decodes to nothing or to the wrong kind of frame, or an
340
- * 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.
341
284
  */
342
285
  supply(timeTicks: bigint, { width, height, contentOf, liveSourceIds, getLayer, pixelsFor, retainVideoConsumers, isCurrent, }: FrameSupplyOptions): Promise<SuppliedFrame | null>;
343
286
  /**
344
- * Hands over receipts from {@link FrameSupply.supply} once the engine has rendered with them,
345
- * after the still uploads the supplies since the last call replaced or evicted. The oldest are
346
- * 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`.
347
289
  */
348
290
  retire(uploads: readonly FrameUploadReceipt[]): void;
349
291
  /**
350
- * Supplies one timestamp and presents it, retiring the uploads afterwards.
292
+ * Supplies one timestamp, presents it, and retires the uploads.
351
293
  *
352
294
  * Resolves with `null` when `isCurrent` turned false before presenting. Rejects as
353
- * {@link FrameSupply.supply} does, and with an `Error` naming the missing frames when the engine
354
- * still reports missing sources after the supply.
295
+ * {@link FrameSupply.supply} does, or when the engine still reports missing sources.
355
296
  */
356
297
  render(timeTicks: bigint, options: FrameSupplyOptions): Promise<PlaybackResult | null>;
357
298
  }