alpha2 0.2.0 → 0.2.2

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/dist/assets.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { ColorPipeline, MediaFingerprint, Project } from "./generated/project-schema.js";
2
2
  /** What media is read for. */
3
- export type MediaPurpose = "preview" | "thumbnail" | "remote_edit" | "export_original" | "export_proxy";
3
+ export type MediaPurpose = "preview" | "preview_proxy" | "thumbnail" | "remote_edit" | "export_original" | "export_proxy";
4
4
  /** Whether a source's original media can be read. */
5
5
  export type OriginalState = {
6
6
  readonly state: "online";
package/dist/effects.d.ts CHANGED
@@ -153,6 +153,10 @@ export interface WasmCanvasRenderer extends WasmEffectRegistry {
153
153
  loadProject(projectJson: string): void;
154
154
  uploadVideoFrame(sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame): FrameUploadReceipt;
155
155
  uploadPresentedVideoFrame(sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame, outputWidth: number, outputHeight: number, rotationDegrees: number, mirror: boolean): FrameUploadReceipt;
156
+ /** `"direct"`, `"bitmap"`, `"untried"`, or `"canvas"` (WebGL2): see `uploadPresentedVideoFrame`. */
157
+ readonly videoFrameCopy: string;
158
+ /** `uploadPresentedVideoFrame` for a bitmap made with `premultiplyAlpha: "none"`. */
159
+ uploadPresentedImageBitmap(sourceId: string, mediaTimeTicks: bigint, bitmap: ImageBitmap, outputWidth: number, outputHeight: number, rotationDegrees: number, mirror: boolean): FrameUploadReceipt;
156
160
  uploadRgbaFrame(sourceId: string, mediaTimeTicks: bigint, width: number, height: number, pixels: Uint8Array): FrameUploadReceipt;
157
161
  /**
158
162
  * Planar YUV (a WebCodecs format) converted with the project's color pipeline: how HDR frames
@@ -1,5 +1,6 @@
1
1
  import type { FrameUploadReceipt } from "./effects.js";
2
2
  import { type ChromaSiting, type PlanarYuvEngine, type VideoConversion } from "./hdr-frames.js";
3
+ import { type PresentedFrameEngine } from "./presented-frames.js";
3
4
  /** One decode request the engine reports for a single timeline timestamp (`frameNeeds`). */
4
5
  export interface FrameNeed {
5
6
  /** Clip that needs the frame. Overlapping clips report the same source. */
@@ -218,6 +219,8 @@ export interface FrameSupplyEngine {
218
219
  uploadRgbaImage(sourceId: string, width: number, height: number, pixels: Uint8Array): FrameUploadReceipt;
219
220
  uploadRgbaFrame(sourceId: string, mediaTimeTicks: bigint, width: number, height: number, pixels: Uint8Array): FrameUploadReceipt;
220
221
  uploadPresentedVideoFrame?(sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame, width: number, height: number, rotation: number | undefined, mirror: boolean): FrameUploadReceipt;
222
+ readonly videoFrameCopy?: string;
223
+ uploadPresentedImageBitmap?: PresentedFrameEngine["uploadPresentedImageBitmap"];
221
224
  /**
222
225
  * Converts planar YUV with the project's color pipeline. An engine that has it takes every HDR
223
226
  * frame this way, never through the browser's conversion, and every other planar frame unless
@@ -2,6 +2,7 @@
2
2
  // derive them itself, for example by rounding (timelineSeconds - clip.start).
3
3
  import { copyPlanarYuvFrame, isHdrVideoFrame, isPlanarVideoFrame, PlanarCopyPool, uploadPlanarYuvFrame, } from "./hdr-frames.js";
4
4
  import { decoderConsumerId } from "./media.js";
5
+ import { sendsBitmaps, uploadPresentedFrame, } from "./presented-frames.js";
5
6
  import { PhysicalFrameAliases, } from "./physical-frames.js";
6
7
  /** Tick rate shared by every engine timestamp. */
7
8
  const TICKS_PER_SECOND = 120_000;
@@ -278,10 +279,20 @@ export class FrameSupply {
278
279
  }
279
280
  }
280
281
  else {
281
- // Called on the engine: these methods lose their receiver when detached.
282
- if (this.#engine.uploadPresentedVideoFrame === undefined)
283
- throw new Error("engine cannot consume a VideoFrame directly");
284
- upload = this.#engine.uploadPresentedVideoFrame(need.sourceId, sourceTicks, videoFrame.frame, width, height, videoFrame.rotation, videoFrame.mirror ?? false);
282
+ const engine = this.#presentedEngine();
283
+ const presented = [
284
+ need.sourceId,
285
+ sourceTicks,
286
+ videoFrame.frame,
287
+ width,
288
+ height,
289
+ videoFrame.rotation ?? 0,
290
+ videoFrame.mirror ?? false,
291
+ ];
292
+ // A frame the engine takes directly still uploads synchronously.
293
+ upload = sendsBitmaps(engine)
294
+ ? await uploadPresentedFrame(engine, ...presented)
295
+ : engine.uploadPresentedVideoFrame(...presented);
285
296
  }
286
297
  validateUploadReceipt(upload);
287
298
  uploaded.push(upload);
@@ -438,6 +449,13 @@ export class FrameSupply {
438
449
  : required(engine.uploadPresentedRgbaImage).call(engine, sourceId, raster.width, raster.height, raster.pixels, raster.alpha !== "straight", width, height),
439
450
  };
440
451
  }
452
+ /** The engine, which must take presented `VideoFrame` uploads. */
453
+ #presentedEngine() {
454
+ const engine = this.#engine;
455
+ if (!takesPresentedFrames(engine))
456
+ throw new Error("engine cannot consume a VideoFrame directly");
457
+ return engine;
458
+ }
441
459
  #planarEngine() {
442
460
  const engine = this.#engine;
443
461
  const upload = engine.uploadYuvFrame;
@@ -708,6 +726,10 @@ function validatePositiveInteger(value, name) {
708
726
  throw new RangeError(`${name} must be a positive safe integer`);
709
727
  }
710
728
  }
729
+ /** Whether `engine` takes presented `VideoFrame` uploads (`uploadPresentedVideoFrame`). */
730
+ function takesPresentedFrames(engine) {
731
+ return typeof engine.uploadPresentedVideoFrame === "function";
732
+ }
711
733
  function closeDecodedNeeds(decoded) {
712
734
  for (const { source } of decoded) {
713
735
  if (source && "kind" in source && source.kind === "video-frame") {
@@ -171,6 +171,13 @@ export interface MediabunnyMp4SinkOptions {
171
171
  * refuses it; `appliedVideoRateControl` says which ran.
172
172
  */
173
173
  readonly videoRateControl?: VideoRateControl;
174
+ /** The video encoder's latency mode; by default the one {@link videoEncoderLatencyMode} measures. */
175
+ readonly videoLatencyMode?: VideoEncoderLatencyMode;
176
+ /**
177
+ * How long the video encoder may hold frames without output before writes reject with
178
+ * `ENCODE_STALLED` (default 10 s).
179
+ */
180
+ readonly stallTimeoutMs?: number;
174
181
  /** The audio bitrate in bits per second, already resolved. Required with `audioCodec`. */
175
182
  readonly audioBitrate?: number;
176
183
  /**
@@ -220,6 +227,14 @@ export declare function canEncodeVideoTrack(codec: "avc" | "hevc" | "vp9" | "av1
220
227
  readonly height: number;
221
228
  readonly rate: VideoRateControl;
222
229
  }): Promise<boolean>;
230
+ /** How a browser's video encoder is opened: see {@link videoEncoderLatencyMode}. */
231
+ export type VideoEncoderLatencyMode = "quality" | "realtime";
232
+ /**
233
+ * The latency mode {@link MediabunnyMp4Sink} opens `codec`'s encoder with: `"realtime"` only where a
234
+ * quality-mode encoder puts out nothing (Safari 27's H.264) and a realtime one works. Measured once
235
+ * per codec.
236
+ */
237
+ export declare function videoEncoderLatencyMode(codec: "avc" | "hevc" | "vp9" | "av1"): Promise<VideoEncoderLatencyMode>;
223
238
  /**
224
239
  * The rate this browser encodes `codec` audio of a project at `sampleRate` with, by the rule a
225
240
  * native host follows: the project rate when the browser's encoder takes it, else the lowest rate
@@ -258,12 +273,15 @@ export interface AppliedVideoRateControl {
258
273
  * has ended. Either track's `abort` discards the whole file, and the other runner's next write
259
274
  * fails.
260
275
  *
261
- * The constructor throws `RangeError` when no track is configured, a codec lacks its rate, or a
262
- * memory destination's `maxBytes` is not a positive safe integer.
276
+ * The constructor throws `RangeError` when no track is configured, a codec lacks its rate, a
277
+ * memory destination's `maxBytes` is not a positive safe integer, or `stallTimeoutMs` is out of
278
+ * range.
263
279
  */
264
280
  export declare class MediabunnyMp4Sink implements BrowserEncodeSink, BrowserAudioBlockSink {
265
281
  #private;
266
282
  constructor(options: MediabunnyMp4SinkOptions);
283
+ /** The latency mode the video encoder was opened with; undefined until the sink has started. */
284
+ get videoLatencyMode(): VideoEncoderLatencyMode | undefined;
267
285
  /**
268
286
  * The video track as a sink of its own, for a runner that shares the file with another: its
269
287
  * `finish` ends the video track and finalizes the file once every configured track has ended;
@@ -284,7 +302,8 @@ export declare class MediabunnyMp4Sink implements BrowserEncodeSink, BrowserAudi
284
302
  /**
285
303
  * Encodes one frame at its output time (`output.timeTicks`, counted from the output's zero).
286
304
  * Closes `output.frame` whether or not it succeeds. Rejects with `RESOURCE_LIMIT` once a memory
287
- * destination has passed `maxBytes`, or when no video track is configured.
305
+ * destination has passed `maxBytes`, with `ENCODE_STALLED` when the encoder stalls, or when no
306
+ * video track is configured.
288
307
  */
289
308
  writeVideo(output: ExportedFrame): Promise<void>;
290
309
  /**
@@ -299,8 +318,9 @@ export declare class MediabunnyMp4Sink implements BrowserEncodeSink, BrowserAudi
299
318
  writeAudio(block: BrowserAudioBlock): Promise<void>;
300
319
  /**
301
320
  * Finalizes the file and commits a stream destination; calling it again after it resolved does
302
- * nothing. Rejects with `RESOURCE_LIMIT` when a memory destination passed `maxBytes`, and with
303
- * what the muxer or the destination refused; a stream destination is then discarded.
321
+ * nothing. Rejects with `RESOURCE_LIMIT` when a memory destination passed `maxBytes`, with
322
+ * `ENCODE_STALLED` when the encoder stalls, and with what the muxer or the destination refused; a
323
+ * stream destination is then discarded.
304
324
  */
305
325
  finish(): Promise<void>;
306
326
  /**
@@ -28,6 +28,8 @@ const DEFAULT_MAX_CACHED_FRAMES = 2;
28
28
  const MIN_CACHED_FRAMES = 2;
29
29
  /** How long reading one frame may take before the decoder is taken to be stuck. */
30
30
  const DEFAULT_STALL_TIMEOUT_MS = 5_000;
31
+ /** How long the video encoder may hold frames without output before it is taken to be stuck. */
32
+ const DEFAULT_ENCODER_STALL_TIMEOUT_MS = 10_000;
31
33
  /** Bytes of copied frames the reverse window keeps by default: about forty 1080p frames. */
32
34
  const DEFAULT_MAX_REVERSE_FRAME_BYTES = 128 * 1024 * 1024;
33
35
  const TICKS_PER_SECOND = 120_000;
@@ -1103,6 +1105,118 @@ export async function canEncodeVideoTrack(codec, options) {
1103
1105
  quality: videoEncoderQuality(options.rate),
1104
1106
  }).catch(() => false);
1105
1107
  }
1108
+ /** The profiles mediabunny opens (H.264 High, HEVC Main), at a level for the probe's frames. */
1109
+ const LATENCY_PROBE_CODECS = {
1110
+ avc: "avc1.64001e",
1111
+ hevc: "hev1.1.6.L93.B0",
1112
+ vp9: "vp09.00.10.08",
1113
+ av1: "av01.0.04M.08",
1114
+ };
1115
+ const LATENCY_PROBE_WIDTH = 320;
1116
+ const LATENCY_PROBE_HEIGHT = 240;
1117
+ /** More frames than Safari's encoder takes in before it stops. */
1118
+ const LATENCY_PROBE_FRAMES = 6;
1119
+ /** How long a probe encoder has to put out its first chunk. */
1120
+ const LATENCY_PROBE_TIMEOUT_MS = 1_500;
1121
+ const latencyModes = new Map();
1122
+ /**
1123
+ * The latency mode {@link MediabunnyMp4Sink} opens `codec`'s encoder with: `"realtime"` only where a
1124
+ * quality-mode encoder puts out nothing (Safari 27's H.264) and a realtime one works. Measured once
1125
+ * per codec.
1126
+ */
1127
+ export function videoEncoderLatencyMode(codec) {
1128
+ let mode = latencyModes.get(codec);
1129
+ if (mode === undefined) {
1130
+ mode = measureLatencyMode(codec);
1131
+ latencyModes.set(codec, mode);
1132
+ }
1133
+ return mode;
1134
+ }
1135
+ async function measureLatencyMode(codec) {
1136
+ if (typeof VideoEncoder === "undefined")
1137
+ return "quality";
1138
+ // One at a time: on Chrome a realtime encoder opening at once delays the quality one.
1139
+ if ((await encoderPutsOut(codec, "quality")) !== false)
1140
+ return "quality";
1141
+ return (await encoderPutsOut(codec, "realtime")) === true
1142
+ ? "realtime"
1143
+ : "quality";
1144
+ }
1145
+ /** `true` once the encoder puts out a chunk, `false` if it puts out none, `undefined` if it failed. */
1146
+ async function encoderPutsOut(codec, latencyMode) {
1147
+ const config = {
1148
+ codec: LATENCY_PROBE_CODECS[codec],
1149
+ width: LATENCY_PROBE_WIDTH,
1150
+ height: LATENCY_PROBE_HEIGHT,
1151
+ bitrate: 500_000,
1152
+ framerate: 30,
1153
+ latencyMode,
1154
+ ...(codec === "avc" ? { avc: { format: "avc" } } : {}),
1155
+ };
1156
+ try {
1157
+ if (!(await VideoEncoder.isConfigSupported(config)).supported)
1158
+ return undefined;
1159
+ }
1160
+ catch {
1161
+ return undefined;
1162
+ }
1163
+ let outputs = 0;
1164
+ let failed = false;
1165
+ let encoder;
1166
+ let timer;
1167
+ let putOut = () => { };
1168
+ const firstOutput = new Promise((resolve) => (putOut = resolve));
1169
+ try {
1170
+ encoder = new VideoEncoder({
1171
+ output: () => {
1172
+ outputs += 1;
1173
+ putOut();
1174
+ },
1175
+ error: () => (failed = true),
1176
+ });
1177
+ encoder.configure(config);
1178
+ const pixels = new Uint8Array(LATENCY_PROBE_WIDTH * LATENCY_PROBE_HEIGHT * 1.5);
1179
+ for (let index = 0; index < LATENCY_PROBE_FRAMES; index += 1) {
1180
+ pixels.fill(16 + index * 32, 0, LATENCY_PROBE_WIDTH);
1181
+ const frame = new VideoFrame(pixels, {
1182
+ format: "I420",
1183
+ codedWidth: LATENCY_PROBE_WIDTH,
1184
+ codedHeight: LATENCY_PROBE_HEIGHT,
1185
+ timestamp: Math.round((index * 1_000_000) / 30),
1186
+ duration: Math.round(1_000_000 / 30),
1187
+ });
1188
+ try {
1189
+ encoder.encode(frame, { keyFrame: index === 0 });
1190
+ }
1191
+ finally {
1192
+ frame.close();
1193
+ }
1194
+ }
1195
+ await Promise.race([
1196
+ firstOutput,
1197
+ encoder.flush().catch(() => (failed = true)),
1198
+ new Promise((resolve) => {
1199
+ timer = setTimeout(resolve, LATENCY_PROBE_TIMEOUT_MS);
1200
+ }),
1201
+ ]);
1202
+ if (outputs > 0)
1203
+ return true;
1204
+ return failed ? undefined : false;
1205
+ }
1206
+ catch {
1207
+ return undefined;
1208
+ }
1209
+ finally {
1210
+ clearTimeout(timer);
1211
+ try {
1212
+ if (encoder?.state !== "closed")
1213
+ encoder?.close();
1214
+ }
1215
+ catch {
1216
+ // Already closed by its own failure.
1217
+ }
1218
+ }
1219
+ }
1106
1220
  /**
1107
1221
  * The sample rates each audio codec a {@link MediabunnyMp4Sink} writes can carry, lowest first:
1108
1222
  * AAC's MPEG-4 rates up to the project limit, and Opus's.
@@ -1234,8 +1348,9 @@ class EncoderRateConverter {
1234
1348
  * has ended. Either track's `abort` discards the whole file, and the other runner's next write
1235
1349
  * fails.
1236
1350
  *
1237
- * The constructor throws `RangeError` when no track is configured, a codec lacks its rate, or a
1238
- * memory destination's `maxBytes` is not a positive safe integer.
1351
+ * The constructor throws `RangeError` when no track is configured, a codec lacks its rate, a
1352
+ * memory destination's `maxBytes` is not a positive safe integer, or `stallTimeoutMs` is out of
1353
+ * range.
1239
1354
  */
1240
1355
  export class MediabunnyMp4Sink {
1241
1356
  #target;
@@ -1248,7 +1363,14 @@ export class MediabunnyMp4Sink {
1248
1363
  #output;
1249
1364
  #written = 0;
1250
1365
  #overflow;
1366
+ #hasVideo;
1251
1367
  #video;
1368
+ #latencyMode;
1369
+ #stallTimeoutMs;
1370
+ #framesIn = 0;
1371
+ #framesOut = 0;
1372
+ /** When the encoder last put a frame out, or was given one while it owed none. */
1373
+ #progressAt = 0;
1252
1374
  #audio;
1253
1375
  #audioRate;
1254
1376
  #audioResampler;
@@ -1310,13 +1432,50 @@ export class MediabunnyMp4Sink {
1310
1432
  format: new Mp4OutputFormat({ fastStart: false }),
1311
1433
  target: this.#target,
1312
1434
  });
1313
- if (options.videoCodec !== undefined) {
1314
- const rate = options.videoRateControl;
1315
- if (rate === undefined)
1316
- throw new RangeError("videoRateControl is required with videoCodec");
1435
+ this.#hasVideo = options.videoCodec !== undefined;
1436
+ if (this.#hasVideo && options.videoRateControl === undefined)
1437
+ throw new RangeError("videoRateControl is required with videoCodec");
1438
+ const frameRate = options.frameRate;
1439
+ this.#frameDuration =
1440
+ this.#hasVideo &&
1441
+ frameRate !== undefined &&
1442
+ frameRate.num > 0 &&
1443
+ frameRate.den > 0
1444
+ ? frameRate.den / frameRate.num
1445
+ : undefined;
1446
+ this.#stallTimeoutMs =
1447
+ options.stallTimeoutMs ?? DEFAULT_ENCODER_STALL_TIMEOUT_MS;
1448
+ validateStallTimeout(this.#stallTimeoutMs);
1449
+ if (options.audioCodec !== undefined) {
1450
+ if (options.audioBitrate === undefined)
1451
+ throw new RangeError("audioBitrate is required with audioCodec");
1452
+ const rate = options.audioSampleRate;
1453
+ if (rate !== undefined && (!Number.isSafeInteger(rate) || rate <= 0))
1454
+ throw new RangeError("audioSampleRate must be a positive integer");
1455
+ this.#audioRate = rate;
1456
+ this.#audioResampler = options.audioResampler;
1457
+ this.#audio = new AudioSampleSource({
1458
+ codec: options.audioCodec,
1459
+ quality: new Quality({ bitrate: options.audioBitrate }),
1460
+ });
1461
+ }
1462
+ if (!this.#hasVideo && this.#audio === undefined)
1463
+ throw new RangeError("at least one output track is required");
1464
+ this.#ready = this.#open(options);
1465
+ }
1466
+ /** Adds the tracks once the video latency mode is known, and starts the file. */
1467
+ async #open(options) {
1468
+ const codec = options.videoCodec;
1469
+ const rate = options.videoRateControl;
1470
+ if (codec !== undefined && rate !== undefined) {
1471
+ const latencyMode = options.videoLatencyMode ?? (await videoEncoderLatencyMode(codec));
1472
+ if (this.#output.state === "canceled")
1473
+ return;
1474
+ this.#latencyMode = latencyMode;
1317
1475
  this.#video = new VideoSampleSource({
1318
- codec: options.videoCodec,
1476
+ codec,
1319
1477
  quality: videoEncoderQuality(rate),
1478
+ latencyMode,
1320
1479
  // mediabunny reports each candidate config before it asks the browser whether it is
1321
1480
  // supported and stops at the first that is, so the last one reported is the one that runs.
1322
1481
  onEncoderConfig: (config) => {
@@ -1328,33 +1487,45 @@ export class MediabunnyMp4Sink {
1328
1487
  : { bitrate: config.bitrate }),
1329
1488
  };
1330
1489
  },
1490
+ onEncodedPacket: () => {
1491
+ this.#framesOut += 1;
1492
+ this.#progressAt = performance.now();
1493
+ },
1331
1494
  });
1332
- const frameRate = options.frameRate;
1333
- this.#frameDuration =
1334
- frameRate !== undefined && frameRate.num > 0 && frameRate.den > 0
1335
- ? frameRate.den / frameRate.num
1336
- : undefined;
1337
1495
  this.#output.addVideoTrack(this.#video, this.#frameDuration === undefined
1338
1496
  ? undefined
1339
1497
  : { frameRate: 1 / this.#frameDuration });
1340
1498
  }
1341
- if (options.audioCodec !== undefined) {
1342
- if (options.audioBitrate === undefined)
1343
- throw new RangeError("audioBitrate is required with audioCodec");
1344
- const rate = options.audioSampleRate;
1345
- if (rate !== undefined && (!Number.isSafeInteger(rate) || rate <= 0))
1346
- throw new RangeError("audioSampleRate must be a positive integer");
1347
- this.#audioRate = rate;
1348
- this.#audioResampler = options.audioResampler;
1349
- this.#audio = new AudioSampleSource({
1350
- codec: options.audioCodec,
1351
- quality: new Quality({ bitrate: options.audioBitrate }),
1352
- });
1499
+ if (this.#audio !== undefined)
1353
1500
  this.#output.addAudioTrack(this.#audio);
1354
- }
1355
- if (this.#video === undefined && this.#audio === undefined)
1356
- throw new RangeError("at least one output track is required");
1357
- this.#ready = this.#output.start();
1501
+ await this.#output.start();
1502
+ }
1503
+ /** `work`, unless the video encoder holds frames without output for `stallTimeoutMs`. */
1504
+ #watched(work) {
1505
+ return new Promise((resolve, reject) => {
1506
+ const timer = setInterval(() => {
1507
+ const waited = performance.now() - this.#progressAt;
1508
+ if (this.#framesOut >= this.#framesIn ||
1509
+ waited < this.#stallTimeoutMs)
1510
+ return;
1511
+ clearInterval(timer);
1512
+ const held = this.#framesIn - this.#framesOut;
1513
+ reject(Object.assign(new Error(`video encoder stalled: no output for ${Math.round(waited)} ms with ${held} frames queued`), {
1514
+ code: "ENCODE_STALLED",
1515
+ failure: {
1516
+ code: "GPU_TIMEOUT",
1517
+ phase: "encode",
1518
+ stage: "encoder-stalled",
1519
+ resource: "unknown",
1520
+ },
1521
+ }));
1522
+ }, Math.min(1_000, this.#stallTimeoutMs));
1523
+ void work.finally(() => clearInterval(timer)).then(resolve, reject);
1524
+ });
1525
+ }
1526
+ /** The latency mode the video encoder was opened with; undefined until the sink has started. */
1527
+ get videoLatencyMode() {
1528
+ return this.#latencyMode;
1358
1529
  }
1359
1530
  /**
1360
1531
  * The video track as a sink of its own, for a runner that shares the file with another: its
@@ -1362,7 +1533,7 @@ export class MediabunnyMp4Sink {
1362
1533
  * its `abort` discards the file. Throws `RangeError` when no video track is configured.
1363
1534
  */
1364
1535
  get videoTrack() {
1365
- if (this.#video === undefined)
1536
+ if (!this.#hasVideo)
1366
1537
  throw new RangeError("video track is not configured");
1367
1538
  this.#videoTrack ??= {
1368
1539
  writeVideo: (output) => this.writeVideo(output),
@@ -1398,7 +1569,7 @@ export class MediabunnyMp4Sink {
1398
1569
  await this.#flushAudio();
1399
1570
  (track === "video" ? this.#video : this.#audio)?.close();
1400
1571
  }
1401
- if ((this.#video === undefined || this.#ended.has("video")) &&
1572
+ if ((!this.#hasVideo || this.#ended.has("video")) &&
1402
1573
  (this.#audio === undefined || this.#ended.has("audio")))
1403
1574
  await this.finish();
1404
1575
  }
@@ -1413,25 +1584,37 @@ export class MediabunnyMp4Sink {
1413
1584
  /**
1414
1585
  * Encodes one frame at its output time (`output.timeTicks`, counted from the output's zero).
1415
1586
  * Closes `output.frame` whether or not it succeeds. Rejects with `RESOURCE_LIMIT` once a memory
1416
- * destination has passed `maxBytes`, or when no video track is configured.
1587
+ * destination has passed `maxBytes`, with `ENCODE_STALLED` when the encoder stalls, or when no
1588
+ * video track is configured.
1417
1589
  */
1418
1590
  async writeVideo(output) {
1419
- await this.#ready;
1591
+ try {
1592
+ await this.#ready;
1593
+ }
1594
+ catch (error) {
1595
+ output.frame.close();
1596
+ throw error;
1597
+ }
1420
1598
  if (this.#overflow) {
1421
1599
  output.frame.close();
1422
1600
  throw this.#overflow;
1423
1601
  }
1424
1602
  if (this.#video === undefined) {
1425
1603
  output.frame.close();
1426
- throw new Error("video track is not configured");
1604
+ throw new Error(this.#hasVideo
1605
+ ? "the output was cancelled before its video track started"
1606
+ : "video track is not configured");
1427
1607
  }
1428
1608
  // Declaring the duration keeps sample durations uniform instead of inferred from float deltas.
1429
1609
  const sample = new VideoSample(output.frame, {
1430
1610
  timestamp: Number(output.timeTicks) / 120_000,
1431
1611
  duration: this.#frameDuration,
1432
1612
  });
1613
+ if (this.#framesOut >= this.#framesIn)
1614
+ this.#progressAt = performance.now();
1615
+ this.#framesIn += 1;
1433
1616
  try {
1434
- await this.#video.add(sample);
1617
+ await this.#watched(this.#video.add(sample));
1435
1618
  }
1436
1619
  finally {
1437
1620
  sample.close();
@@ -1510,8 +1693,9 @@ export class MediabunnyMp4Sink {
1510
1693
  }
1511
1694
  /**
1512
1695
  * Finalizes the file and commits a stream destination; calling it again after it resolved does
1513
- * nothing. Rejects with `RESOURCE_LIMIT` when a memory destination passed `maxBytes`, and with
1514
- * what the muxer or the destination refused; a stream destination is then discarded.
1696
+ * nothing. Rejects with `RESOURCE_LIMIT` when a memory destination passed `maxBytes`, with
1697
+ * `ENCODE_STALLED` when the encoder stalls, and with what the muxer or the destination refused; a
1698
+ * stream destination is then discarded.
1515
1699
  */
1516
1700
  async finish() {
1517
1701
  if (this.#finished)
@@ -1519,7 +1703,7 @@ export class MediabunnyMp4Sink {
1519
1703
  await this.#ready;
1520
1704
  try {
1521
1705
  await this.#flushAudio();
1522
- await this.#output.finalize();
1706
+ await this.#watched(this.#output.finalize());
1523
1707
  if (this.#overflow)
1524
1708
  throw this.#overflow;
1525
1709
  await this.#file?.close();
@@ -0,0 +1,16 @@
1
+ import type { FrameUploadReceipt } from "./effects.js";
2
+ /** The engine calls {@link uploadPresentedFrame} makes. */
3
+ export interface PresentedFrameEngine {
4
+ /** `"bitmap"` where the engine copies frames through a canvas after WebGPU refused one. */
5
+ readonly videoFrameCopy?: string;
6
+ uploadPresentedVideoFrame(sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame, width: number, height: number, rotation: number, mirror: boolean): FrameUploadReceipt;
7
+ /** `uploadPresentedVideoFrame` for a bitmap made with `premultiplyAlpha: "none"`. */
8
+ uploadPresentedImageBitmap?(sourceId: string, mediaTimeTicks: bigint, bitmap: ImageBitmap, width: number, height: number, rotation: number, mirror: boolean): FrameUploadReceipt;
9
+ }
10
+ /** Whether {@link uploadPresentedFrame} sends `engine` bitmaps instead of frames. */
11
+ export declare function sendsBitmaps(engine: PresentedFrameEngine): boolean;
12
+ /**
13
+ * Uploads `frame`, as a bitmap where {@link sendsBitmaps}, and closes it either way. A frame that
14
+ * cannot be made into a bitmap is sent as it is.
15
+ */
16
+ export declare function uploadPresentedFrame(engine: PresentedFrameEngine, sourceId: string, mediaTimeTicks: bigint, frame: VideoFrame, width: number, height: number, rotation: number, mirror: boolean): Promise<FrameUploadReceipt>;
@@ -0,0 +1,31 @@
1
+ // Presented VideoFrame uploads. Where WebGPU refuses a VideoFrame (Firefox), the engine draws each
2
+ // frame on a 2D canvas on the calling thread; a bitmap from `createImageBitmap` skips that draw.
3
+ /** Whether {@link uploadPresentedFrame} sends `engine` bitmaps instead of frames. */
4
+ export function sendsBitmaps(engine) {
5
+ return (engine.videoFrameCopy === "bitmap" &&
6
+ typeof engine.uploadPresentedImageBitmap === "function" &&
7
+ typeof createImageBitmap === "function");
8
+ }
9
+ /**
10
+ * Uploads `frame`, as a bitmap where {@link sendsBitmaps}, and closes it either way. A frame that
11
+ * cannot be made into a bitmap is sent as it is.
12
+ */
13
+ export async function uploadPresentedFrame(engine, sourceId, mediaTimeTicks, frame, width, height, rotation, mirror) {
14
+ const send = () => engine.uploadPresentedVideoFrame(sourceId, mediaTimeTicks, frame, width, height, rotation, mirror);
15
+ if (!sendsBitmaps(engine) || engine.uploadPresentedImageBitmap === undefined)
16
+ return send();
17
+ let bitmap;
18
+ try {
19
+ // The display size, as the engine's canvas draws it.
20
+ bitmap = await createImageBitmap(frame, {
21
+ premultiplyAlpha: "none",
22
+ resizeWidth: frame.displayWidth,
23
+ resizeHeight: frame.displayHeight,
24
+ });
25
+ }
26
+ catch {
27
+ return send();
28
+ }
29
+ frame.close();
30
+ return engine.uploadPresentedImageBitmap(sourceId, mediaTimeTicks, bitmap, width, height, rotation, mirror);
31
+ }
package/dist/worker.js CHANGED
@@ -4,6 +4,7 @@ import { recordRepackedBytes } from "./repacked-bytes.js";
4
4
  import { copyPlanarYuvFrame, PlanarCopyPool, isHdrVideoFrame, isPlanarVideoFrame, uploadPlanarYuvFrame, } from "./hdr-frames.js";
5
5
  import { Alpha2WasmError, serializeError, wasmTrapCode, } from "./worker-error.js";
6
6
  import { PhysicalFrameAliases, } from "./physical-frames.js";
7
+ import { sendsBitmaps, uploadPresentedFrame } from "./presented-frames.js";
7
8
  export { Alpha2WasmError } from "./worker-error.js";
8
9
  /**
9
10
  * Installs a serial request loop in the worker that owns the GPU device, replacing
@@ -261,7 +262,19 @@ class WasmRenderWorkerHost {
261
262
  this.#physicalFrames.record(identity, exact);
262
263
  return;
263
264
  }
264
- this.#pendingUploads.push(this.#wasm.uploadPresentedVideoFrame(frame.sourceId, frame.requestedTimeTicks, frame.frame, this.#outputSize.width, this.#outputSize.height, rotation, mirror));
265
+ const upload = [
266
+ frame.sourceId,
267
+ frame.requestedTimeTicks,
268
+ frame.frame,
269
+ this.#outputSize.width,
270
+ this.#outputSize.height,
271
+ rotation,
272
+ mirror,
273
+ ];
274
+ // A frame the engine takes directly still uploads synchronously.
275
+ this.#pendingUploads.push(sendsBitmaps(this.#wasm)
276
+ ? await uploadPresentedFrame(this.#wasm, ...upload)
277
+ : this.#wasm.uploadPresentedVideoFrame(...upload));
265
278
  this.#physicalFrames.record(identity, exact);
266
279
  }
267
280
  // The backend contract is asynchronous because a worker-side implementation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alpha2",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "license": "MIT",
5
5
  "description": "JavaScript bindings for the standalone alpha2 media engine.",
6
6
  "repository": {
Binary file
Binary file
@@ -171,6 +171,47 @@ export class RasterizedText {
171
171
  readonly descriptor: string;
172
172
  }
173
173
 
174
+ /**
175
+ * Measures text generators with caller-supplied fonts, without a GPU:
176
+ * where the engine draws each one's text on the canvas. Given the fonts
177
+ * a renderer draws with, in the same order, it answers for that
178
+ * renderer's frames.
179
+ */
180
+ export class WasmTextMeasurer {
181
+ free(): void;
182
+ [Symbol.dispose](): void;
183
+ /**
184
+ * Appends an OpenType font to the fallback stack.
185
+ *
186
+ * # Errors
187
+ * Rejects malformed font bytes.
188
+ */
189
+ addFont(family: string, bytes: Uint8Array, face_index: number): void;
190
+ /**
191
+ * Drops every font.
192
+ */
193
+ clearFonts(): void;
194
+ /**
195
+ * Where the text generator `generator_json` (`{ "type": "text",
196
+ * "text", "style" }`, as a project holds it) lies on a `width` by
197
+ * `height` canvas, as JSON `{ layout, content, ink, lineCount }`:
198
+ * each a `{ left, top, right, bottom }` rectangle in fractions of the
199
+ * canvas, as the style's position is, on the picture the generator
200
+ * draws before its clip's transform; `ink` is `null` when the text
201
+ * draws nothing. Measure at the project's canvas size: text laid out
202
+ * at another size can break its lines elsewhere.
203
+ *
204
+ * # Errors
205
+ * Rejects JSON that is no valid text generator, an empty canvas, and
206
+ * a measurer without fonts.
207
+ */
208
+ measure(generator_json: string, width: number, height: number): string;
209
+ /**
210
+ * A measurer with no fonts; add them in fallback order.
211
+ */
212
+ constructor();
213
+ }
214
+
174
215
  /**
175
216
  * Shapes and rasterizes text from caller-supplied fonts, in wasm.
176
217
  */
@@ -765,6 +806,13 @@ export class WebEffectRegistry {
765
806
  * and read an interpolation sample or two beyond.
766
807
  */
767
808
  uploadAudioBlock(source_id: string, start_sample: bigint, sample_rate: number, layout: any, samples: Float32Array, ends_source?: boolean | null): void;
809
+ /**
810
+ * [`Self::upload_presented_video_frame`] for a bitmap made of the frame
811
+ * with `createImageBitmap(frame, { premultiplyAlpha: "none" })`, which
812
+ * skips the canvas draw where `videoFrameCopy` is `"bitmap"`. Always
813
+ * closes `bitmap`; a source the project declares HDR is refused.
814
+ */
815
+ uploadPresentedImageBitmap(source_id: string, media_time_ticks: bigint, bitmap: ImageBitmap, output_width: number, output_height: number, rotation_degrees: number, mirror: boolean): any;
768
816
  /**
769
817
  * Like [`Self::upload_presented_rgba_frame`], for premultiplied
770
818
  * linear-light RGBA half floats (their bits) in BT.709 primaries, as
@@ -800,6 +848,7 @@ export class WebEffectRegistry {
800
848
  * Browser WebGPU copies the frame into a texture directly, or, where the
801
849
  * browser does not take a `VideoFrame` (Firefox), copies it through a
802
850
  * reused 2D canvas's bitmap. WebGL2 always uploads that bitmap.
851
+ * `videoFrameCopy` says which.
803
852
  *
804
853
  * Both copies go through the page's own color conversion, so an HDR
805
854
  * frame (PQ or HLG, by the color the project declares for the source,
@@ -889,6 +938,12 @@ export class WebEffectRegistry {
889
938
  * Returns the number of browser frames currently retained by the binding.
890
939
  */
891
940
  readonly uploadedFrameCount: number;
941
+ /**
942
+ * How [`Self::upload_presented_video_frame`] copies a frame: `"direct"`,
943
+ * `"bitmap"` (through a canvas, once WebGPU refused a frame), `"untried"`,
944
+ * or `"canvas"` on WebGL2.
945
+ */
946
+ readonly videoFrameCopy: string;
892
947
  }
893
948
 
894
949
  /**
@@ -935,8 +990,8 @@ export function compareFingerprints(recorded: string, found: string): string;
935
990
 
936
991
  /**
937
992
  * Whether `project`'s media, as `catalog` describes it, is ready for
938
- * `purpose` (`preview`, `thumbnail`, `remote_edit`, `export_original`, or
939
- * `export_proxy`), as a JSON `ConformReport`.
993
+ * `purpose` (`preview`, `preview_proxy`, `thumbnail`, `remote_edit`,
994
+ * `export_original`, or `export_proxy`), as a JSON `ConformReport`.
940
995
  *
941
996
  * # Errors
942
997
  * Rejects an invalid project, catalog (one whose fingerprints are not well
@@ -1048,6 +1103,7 @@ export interface InitOutput {
1048
1103
  readonly __wbg_loudnessmeter_free: (a: number, b: number) => void;
1049
1104
  readonly __wbg_playbackclock_free: (a: number, b: number) => void;
1050
1105
  readonly __wbg_rasterizedtext_free: (a: number, b: number) => void;
1106
+ readonly __wbg_wasmtextmeasurer_free: (a: number, b: number) => void;
1051
1107
  readonly __wbg_wasmtextrasterizer_free: (a: number, b: number) => void;
1052
1108
  readonly __wbg_waveformbuilder_free: (a: number, b: number) => void;
1053
1109
  readonly __wbg_waveformresult_free: (a: number, b: number) => void;
@@ -1086,6 +1142,10 @@ export interface InitOutput {
1086
1142
  readonly resolveRateControl: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
1087
1143
  readonly roundingQuantum: (a: number, b: number) => bigint;
1088
1144
  readonly start: () => void;
1145
+ readonly wasmtextmeasurer_addFont: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1146
+ readonly wasmtextmeasurer_clearFonts: (a: number) => void;
1147
+ readonly wasmtextmeasurer_measure: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
1148
+ readonly wasmtextmeasurer_new: () => number;
1089
1149
  readonly wasmtextrasterizer_addFont: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1090
1150
  readonly wasmtextrasterizer_cacheSize: (a: number) => number;
1091
1151
  readonly wasmtextrasterizer_clear: (a: number) => void;
@@ -1162,6 +1222,7 @@ export interface InitOutput {
1162
1222
  readonly webeffectregistry_unregisterEffect: (a: number, b: number, c: number, d: number) => number;
1163
1223
  readonly webeffectregistry_unregisterEffectResource: (a: number, b: number, c: number) => number;
1164
1224
  readonly webeffectregistry_uploadAudioBlock: (a: number, b: number, c: number, d: bigint, e: number, f: any, g: any, h: number) => [number, number];
1225
+ readonly webeffectregistry_uploadPresentedImageBitmap: (a: number, b: number, c: number, d: bigint, e: any, f: number, g: number, h: number, i: number) => [number, number, number];
1165
1226
  readonly webeffectregistry_uploadPresentedLinearFrame: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
1166
1227
  readonly webeffectregistry_uploadPresentedLinearImage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
1167
1228
  readonly webeffectregistry_uploadPresentedRgbaFrame: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number];
@@ -1173,15 +1234,16 @@ export interface InitOutput {
1173
1234
  readonly webeffectregistry_uploadYuvFrame: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number) => [number, number, number];
1174
1235
  readonly webeffectregistry_uploadedFrameBytes: (a: number) => bigint;
1175
1236
  readonly webeffectregistry_uploadedFrameCount: (a: number) => number;
1237
+ readonly webeffectregistry_videoFrameCopy: (a: number) => [number, number];
1176
1238
  readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___js_sys_dcf218532b47778c___Function_fn_wasm_bindgen_d171202afaeab6f2___JsValue_____wasm_bindgen_d171202afaeab6f2___sys__Undefined___js_sys_dcf218532b47778c___Function_fn_wasm_bindgen_d171202afaeab6f2___JsValue_____wasm_bindgen_d171202afaeab6f2___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
1177
1239
  readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true_: (a: number, b: number, c: any) => [number, number];
1178
1240
  readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true_: (a: number, b: number, c: any) => [number, number];
1179
- readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__125: (a: number, b: number, c: any) => [number, number];
1180
- readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__128: (a: number, b: number, c: any) => [number, number];
1181
- readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__129: (a: number, b: number, c: any) => [number, number];
1241
+ readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__131: (a: number, b: number, c: any) => [number, number];
1242
+ readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__134: (a: number, b: number, c: any) => [number, number];
1243
+ readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__135: (a: number, b: number, c: any) => [number, number];
1182
1244
  readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___web_sys_9e2ae0ace5131457___features__gen_Event__Event______true_: (a: number, b: number, c: any) => void;
1183
1245
  readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_: (a: number, b: number, c: any) => void;
1184
- readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__127: (a: number, b: number, c: any) => void;
1246
+ readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__133: (a: number, b: number, c: any) => void;
1185
1247
  readonly wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke_______true_: (a: number, b: number) => void;
1186
1248
  readonly __wbindgen_malloc: (a: number, b: number) => number;
1187
1249
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
@@ -1,8 +1,8 @@
1
1
  /* @ts-self-types="./alpha2_wasm.d.ts" */
2
- import { alpha2BitmapUploadsPremultiplied, alpha2FrameBitmap } from './snippets/alpha2-wasm-632c71c93cbb7942/inline1.js';
3
- import { alpha2CopyExternalImage } from './snippets/alpha2-wasm-632c71c93cbb7942/inline2.js';
4
- import * as import1 from "./snippets/alpha2-wasm-632c71c93cbb7942/inline0.js"
5
- import * as import2 from "./snippets/alpha2-wasm-632c71c93cbb7942/inline0.js"
2
+ import { alpha2BitmapUploadsPremultiplied, alpha2FrameBitmap } from './snippets/alpha2-wasm-e7f44ec6b15db6c6/inline1.js';
3
+ import { alpha2CopyExternalImage } from './snippets/alpha2-wasm-e7f44ec6b15db6c6/inline2.js';
4
+ import * as import1 from "./snippets/alpha2-wasm-e7f44ec6b15db6c6/inline0.js"
5
+ import * as import2 from "./snippets/alpha2-wasm-e7f44ec6b15db6c6/inline0.js"
6
6
 
7
7
 
8
8
  /**
@@ -408,6 +408,98 @@ export class RasterizedText {
408
408
  }
409
409
  if (Symbol.dispose) RasterizedText.prototype[Symbol.dispose] = RasterizedText.prototype.free;
410
410
 
411
+ /**
412
+ * Measures text generators with caller-supplied fonts, without a GPU:
413
+ * where the engine draws each one's text on the canvas. Given the fonts
414
+ * a renderer draws with, in the same order, it answers for that
415
+ * renderer's frames.
416
+ */
417
+ export class WasmTextMeasurer {
418
+ __destroy_into_raw() {
419
+ const ptr = this.__wbg_ptr;
420
+ this.__wbg_ptr = 0;
421
+ WasmTextMeasurerFinalization.unregister(this);
422
+ return ptr;
423
+ }
424
+ free() {
425
+ const ptr = this.__destroy_into_raw();
426
+ wasm.__wbg_wasmtextmeasurer_free(ptr, 0);
427
+ }
428
+ /**
429
+ * Appends an OpenType font to the fallback stack.
430
+ *
431
+ * # Errors
432
+ * Rejects malformed font bytes.
433
+ * @param {string} family
434
+ * @param {Uint8Array} bytes
435
+ * @param {number} face_index
436
+ */
437
+ addFont(family, bytes, face_index) {
438
+ const ptr0 = passStringToWasm0(family, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
439
+ const len0 = WASM_VECTOR_LEN;
440
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
441
+ const len1 = WASM_VECTOR_LEN;
442
+ const ret = wasm.wasmtextmeasurer_addFont(this.__wbg_ptr, ptr0, len0, ptr1, len1, face_index);
443
+ if (ret[1]) {
444
+ throw takeFromExternrefTable0(ret[0]);
445
+ }
446
+ }
447
+ /**
448
+ * Drops every font.
449
+ */
450
+ clearFonts() {
451
+ wasm.wasmtextmeasurer_clearFonts(this.__wbg_ptr);
452
+ }
453
+ /**
454
+ * Where the text generator `generator_json` (`{ "type": "text",
455
+ * "text", "style" }`, as a project holds it) lies on a `width` by
456
+ * `height` canvas, as JSON `{ layout, content, ink, lineCount }`:
457
+ * each a `{ left, top, right, bottom }` rectangle in fractions of the
458
+ * canvas, as the style's position is, on the picture the generator
459
+ * draws before its clip's transform; `ink` is `null` when the text
460
+ * draws nothing. Measure at the project's canvas size: text laid out
461
+ * at another size can break its lines elsewhere.
462
+ *
463
+ * # Errors
464
+ * Rejects JSON that is no valid text generator, an empty canvas, and
465
+ * a measurer without fonts.
466
+ * @param {string} generator_json
467
+ * @param {number} width
468
+ * @param {number} height
469
+ * @returns {string}
470
+ */
471
+ measure(generator_json, width, height) {
472
+ let deferred3_0;
473
+ let deferred3_1;
474
+ try {
475
+ const ptr0 = passStringToWasm0(generator_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
476
+ const len0 = WASM_VECTOR_LEN;
477
+ const ret = wasm.wasmtextmeasurer_measure(this.__wbg_ptr, ptr0, len0, width, height);
478
+ var ptr2 = ret[0];
479
+ var len2 = ret[1];
480
+ if (ret[3]) {
481
+ ptr2 = 0; len2 = 0;
482
+ throw takeFromExternrefTable0(ret[2]);
483
+ }
484
+ deferred3_0 = ptr2;
485
+ deferred3_1 = len2;
486
+ return getStringFromWasm0(ptr2, len2);
487
+ } finally {
488
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
489
+ }
490
+ }
491
+ /**
492
+ * A measurer with no fonts; add them in fallback order.
493
+ */
494
+ constructor() {
495
+ const ret = wasm.wasmtextmeasurer_new();
496
+ this.__wbg_ptr = ret;
497
+ WasmTextMeasurerFinalization.register(this, this.__wbg_ptr, this);
498
+ return this;
499
+ }
500
+ }
501
+ if (Symbol.dispose) WasmTextMeasurer.prototype[Symbol.dispose] = WasmTextMeasurer.prototype.free;
502
+
411
503
  /**
412
504
  * Shapes and rasterizes text from caller-supplied fonts, in wasm.
413
505
  */
@@ -1673,6 +1765,29 @@ export class WebEffectRegistry {
1673
1765
  throw takeFromExternrefTable0(ret[0]);
1674
1766
  }
1675
1767
  }
1768
+ /**
1769
+ * [`Self::upload_presented_video_frame`] for a bitmap made of the frame
1770
+ * with `createImageBitmap(frame, { premultiplyAlpha: "none" })`, which
1771
+ * skips the canvas draw where `videoFrameCopy` is `"bitmap"`. Always
1772
+ * closes `bitmap`; a source the project declares HDR is refused.
1773
+ * @param {string} source_id
1774
+ * @param {bigint} media_time_ticks
1775
+ * @param {ImageBitmap} bitmap
1776
+ * @param {number} output_width
1777
+ * @param {number} output_height
1778
+ * @param {number} rotation_degrees
1779
+ * @param {boolean} mirror
1780
+ * @returns {any}
1781
+ */
1782
+ uploadPresentedImageBitmap(source_id, media_time_ticks, bitmap, output_width, output_height, rotation_degrees, mirror) {
1783
+ const ptr0 = passStringToWasm0(source_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1784
+ const len0 = WASM_VECTOR_LEN;
1785
+ const ret = wasm.webeffectregistry_uploadPresentedImageBitmap(this.__wbg_ptr, ptr0, len0, media_time_ticks, bitmap, output_width, output_height, rotation_degrees, mirror);
1786
+ if (ret[2]) {
1787
+ throw takeFromExternrefTable0(ret[1]);
1788
+ }
1789
+ return takeFromExternrefTable0(ret[0]);
1790
+ }
1676
1791
  /**
1677
1792
  * Like [`Self::upload_presented_rgba_frame`], for premultiplied
1678
1793
  * linear-light RGBA half floats (their bits) in BT.709 primaries, as
@@ -1780,6 +1895,7 @@ export class WebEffectRegistry {
1780
1895
  * Browser WebGPU copies the frame into a texture directly, or, where the
1781
1896
  * browser does not take a `VideoFrame` (Firefox), copies it through a
1782
1897
  * reused 2D canvas's bitmap. WebGL2 always uploads that bitmap.
1898
+ * `videoFrameCopy` says which.
1783
1899
  *
1784
1900
  * Both copies go through the page's own color conversion, so an HDR
1785
1901
  * frame (PQ or HLG, by the color the project declares for the source,
@@ -1951,6 +2067,24 @@ export class WebEffectRegistry {
1951
2067
  const ret = wasm.webeffectregistry_uploadedFrameCount(this.__wbg_ptr);
1952
2068
  return ret >>> 0;
1953
2069
  }
2070
+ /**
2071
+ * How [`Self::upload_presented_video_frame`] copies a frame: `"direct"`,
2072
+ * `"bitmap"` (through a canvas, once WebGPU refused a frame), `"untried"`,
2073
+ * or `"canvas"` on WebGL2.
2074
+ * @returns {string}
2075
+ */
2076
+ get videoFrameCopy() {
2077
+ let deferred1_0;
2078
+ let deferred1_1;
2079
+ try {
2080
+ const ret = wasm.webeffectregistry_videoFrameCopy(this.__wbg_ptr);
2081
+ deferred1_0 = ret[0];
2082
+ deferred1_1 = ret[1];
2083
+ return getStringFromWasm0(ret[0], ret[1]);
2084
+ } finally {
2085
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2086
+ }
2087
+ }
1954
2088
  }
1955
2089
  if (Symbol.dispose) WebEffectRegistry.prototype[Symbol.dispose] = WebEffectRegistry.prototype.free;
1956
2090
 
@@ -2060,8 +2194,8 @@ export function compareFingerprints(recorded, found) {
2060
2194
 
2061
2195
  /**
2062
2196
  * Whether `project`'s media, as `catalog` describes it, is ready for
2063
- * `purpose` (`preview`, `thumbnail`, `remote_edit`, `export_original`, or
2064
- * `export_proxy`), as a JSON `ConformReport`.
2197
+ * `purpose` (`preview`, `preview_proxy`, `thumbnail`, `remote_edit`,
2198
+ * `export_original`, or `export_proxy`), as a JSON `ConformReport`.
2065
2199
  *
2066
2200
  * # Errors
2067
2201
  * Rejects an invalid project, catalog (one whose fingerprints are not well
@@ -2416,14 +2550,14 @@ function __wbg_get_imports() {
2416
2550
  __wbg_addEventListener_9534e2dc12044ee4: function() { return handleError(function (arg0, arg1, arg2, arg3) {
2417
2551
  arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3);
2418
2552
  }, arguments); },
2419
- __wbg_alpha2BitmapUploadsPremultiplied_0c5d843c2f9131ee: function() { return handleError(function () {
2553
+ __wbg_alpha2BitmapUploadsPremultiplied_7006b42680c3b9ab: function() { return handleError(function () {
2420
2554
  const ret = alpha2BitmapUploadsPremultiplied();
2421
2555
  return ret;
2422
2556
  }, arguments); },
2423
- __wbg_alpha2CopyExternalImage_f35a689ee6364289: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2557
+ __wbg_alpha2CopyExternalImage_f788b46c28154842: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2424
2558
  alpha2CopyExternalImage(arg0, arg1, arg2, arg3 >>> 0, arg4 >>> 0);
2425
2559
  }, arguments); },
2426
- __wbg_alpha2FrameBitmap_bdd1fce4f80435c5: function() { return handleError(function (arg0, arg1, arg2) {
2560
+ __wbg_alpha2FrameBitmap_7d7c2888e4fdf163: function() { return handleError(function (arg0, arg1, arg2) {
2427
2561
  const ret = alpha2FrameBitmap(arg0, arg1 >>> 0, arg2 >>> 0);
2428
2562
  return ret;
2429
2563
  }, arguments); },
@@ -4604,47 +4738,47 @@ function __wbg_get_imports() {
4604
4738
  arg0.writeTexture(arg1, getArrayU8FromWasm0(arg2, arg3), arg4, arg5);
4605
4739
  }, arguments); },
4606
4740
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
4607
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3238, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
4741
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3267, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
4608
4742
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true_);
4609
4743
  return ret;
4610
4744
  },
4611
4745
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
4612
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 69, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4746
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 170, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4613
4747
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___web_sys_9e2ae0ace5131457___features__gen_Event__Event______true_);
4614
4748
  return ret;
4615
4749
  },
4616
4750
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
4617
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUCompilationInfo")], shim_idx: 1019, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
4751
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUCompilationInfo")], shim_idx: 1048, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
4618
4752
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true_);
4619
4753
  return ret;
4620
4754
  },
4621
4755
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
4622
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 1019, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
4623
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__125);
4756
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 1048, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
4757
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__131);
4624
4758
  return ret;
4625
4759
  },
4626
4760
  __wbindgen_generic_0000000000000005: function(arg0, arg1) {
4627
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 1022, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4761
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 1051, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4628
4762
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_);
4629
4763
  return ret;
4630
4764
  },
4631
4765
  __wbindgen_generic_0000000000000006: function(arg0, arg1) {
4632
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 1022, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4633
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__127);
4766
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 1051, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4767
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__133);
4634
4768
  return ret;
4635
4769
  },
4636
4770
  __wbindgen_generic_0000000000000007: function(arg0, arg1) {
4637
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 1019, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
4638
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__128);
4771
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 1048, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
4772
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__134);
4639
4773
  return ret;
4640
4774
  },
4641
4775
  __wbindgen_generic_0000000000000008: function(arg0, arg1) {
4642
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 1019, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
4643
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__129);
4776
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 1048, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
4777
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__135);
4644
4778
  return ret;
4645
4779
  },
4646
4780
  __wbindgen_generic_0000000000000009: function(arg0, arg1) {
4647
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 71, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4781
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 172, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4648
4782
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke_______true_);
4649
4783
  return ret;
4650
4784
  },
@@ -4711,8 +4845,8 @@ function __wbg_get_imports() {
4711
4845
  return {
4712
4846
  __proto__: null,
4713
4847
  "./alpha2_wasm_bg.js": import0,
4714
- "./snippets/alpha2-wasm-632c71c93cbb7942/inline0.js": import1,
4715
- "./snippets/alpha2-wasm-632c71c93cbb7942/inline0.js": import2,
4848
+ "./snippets/alpha2-wasm-e7f44ec6b15db6c6/inline0.js": import1,
4849
+ "./snippets/alpha2-wasm-e7f44ec6b15db6c6/inline0.js": import2,
4716
4850
  };
4717
4851
  }
4718
4852
 
@@ -4728,8 +4862,8 @@ function wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46
4728
4862
  wasm.wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_(arg0, arg1, arg2);
4729
4863
  }
4730
4864
 
4731
- function wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__127(arg0, arg1, arg2) {
4732
- wasm.wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__127(arg0, arg1, arg2);
4865
+ function wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__133(arg0, arg1, arg2) {
4866
+ wasm.wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__133(arg0, arg1, arg2);
4733
4867
  }
4734
4868
 
4735
4869
  function wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true_(arg0, arg1, arg2) {
@@ -4746,22 +4880,22 @@ function wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bin
4746
4880
  }
4747
4881
  }
4748
4882
 
4749
- function wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__125(arg0, arg1, arg2) {
4750
- const ret = wasm.wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__125(arg0, arg1, arg2);
4883
+ function wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__131(arg0, arg1, arg2) {
4884
+ const ret = wasm.wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__131(arg0, arg1, arg2);
4751
4885
  if (ret[1]) {
4752
4886
  throw takeFromExternrefTable0(ret[0]);
4753
4887
  }
4754
4888
  }
4755
4889
 
4756
- function wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__128(arg0, arg1, arg2) {
4757
- const ret = wasm.wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__128(arg0, arg1, arg2);
4890
+ function wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__134(arg0, arg1, arg2) {
4891
+ const ret = wasm.wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__134(arg0, arg1, arg2);
4758
4892
  if (ret[1]) {
4759
4893
  throw takeFromExternrefTable0(ret[0]);
4760
4894
  }
4761
4895
  }
4762
4896
 
4763
- function wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__129(arg0, arg1, arg2) {
4764
- const ret = wasm.wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__129(arg0, arg1, arg2);
4897
+ function wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__135(arg0, arg1, arg2) {
4898
+ const ret = wasm.wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__135(arg0, arg1, arg2);
4765
4899
  if (ret[1]) {
4766
4900
  throw takeFromExternrefTable0(ret[0]);
4767
4901
  }
@@ -4884,6 +5018,9 @@ const PlaybackClockFinalization = (typeof FinalizationRegistry === 'undefined')
4884
5018
  const RasterizedTextFinalization = (typeof FinalizationRegistry === 'undefined')
4885
5019
  ? { register: () => {}, unregister: () => {} }
4886
5020
  : new FinalizationRegistry(ptr => wasm.__wbg_rasterizedtext_free(ptr, 1));
5021
+ const WasmTextMeasurerFinalization = (typeof FinalizationRegistry === 'undefined')
5022
+ ? { register: () => {}, unregister: () => {} }
5023
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmtextmeasurer_free(ptr, 1));
4887
5024
  const WasmTextRasterizerFinalization = (typeof FinalizationRegistry === 'undefined')
4888
5025
  ? { register: () => {}, unregister: () => {} }
4889
5026
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmtextrasterizer_free(ptr, 1));
Binary file
@@ -7,6 +7,7 @@ export const __wbg_compiledeffect_free: (a: number, b: number) => void;
7
7
  export const __wbg_loudnessmeter_free: (a: number, b: number) => void;
8
8
  export const __wbg_playbackclock_free: (a: number, b: number) => void;
9
9
  export const __wbg_rasterizedtext_free: (a: number, b: number) => void;
10
+ export const __wbg_wasmtextmeasurer_free: (a: number, b: number) => void;
10
11
  export const __wbg_wasmtextrasterizer_free: (a: number, b: number) => void;
11
12
  export const __wbg_waveformbuilder_free: (a: number, b: number) => void;
12
13
  export const __wbg_waveformresult_free: (a: number, b: number) => void;
@@ -45,6 +46,10 @@ export const resolveAudioBitrate: (a: number, b: number, c: number, d: number) =
45
46
  export const resolveRateControl: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
46
47
  export const roundingQuantum: (a: number, b: number) => bigint;
47
48
  export const start: () => void;
49
+ export const wasmtextmeasurer_addFont: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
50
+ export const wasmtextmeasurer_clearFonts: (a: number) => void;
51
+ export const wasmtextmeasurer_measure: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
52
+ export const wasmtextmeasurer_new: () => number;
48
53
  export const wasmtextrasterizer_addFont: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
49
54
  export const wasmtextrasterizer_cacheSize: (a: number) => number;
50
55
  export const wasmtextrasterizer_clear: (a: number) => void;
@@ -121,6 +126,7 @@ export const webeffectregistry_trimFramesBefore: (a: number, b: number, c: numbe
121
126
  export const webeffectregistry_unregisterEffect: (a: number, b: number, c: number, d: number) => number;
122
127
  export const webeffectregistry_unregisterEffectResource: (a: number, b: number, c: number) => number;
123
128
  export const webeffectregistry_uploadAudioBlock: (a: number, b: number, c: number, d: bigint, e: number, f: any, g: any, h: number) => [number, number];
129
+ export const webeffectregistry_uploadPresentedImageBitmap: (a: number, b: number, c: number, d: bigint, e: any, f: number, g: number, h: number, i: number) => [number, number, number];
124
130
  export const webeffectregistry_uploadPresentedLinearFrame: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
125
131
  export const webeffectregistry_uploadPresentedLinearImage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
126
132
  export const webeffectregistry_uploadPresentedRgbaFrame: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number];
@@ -132,15 +138,16 @@ export const webeffectregistry_uploadVideoFrame: (a: number, b: number, c: numbe
132
138
  export const webeffectregistry_uploadYuvFrame: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number) => [number, number, number];
133
139
  export const webeffectregistry_uploadedFrameBytes: (a: number) => bigint;
134
140
  export const webeffectregistry_uploadedFrameCount: (a: number) => number;
141
+ export const webeffectregistry_videoFrameCopy: (a: number) => [number, number];
135
142
  export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___js_sys_dcf218532b47778c___Function_fn_wasm_bindgen_d171202afaeab6f2___JsValue_____wasm_bindgen_d171202afaeab6f2___sys__Undefined___js_sys_dcf218532b47778c___Function_fn_wasm_bindgen_d171202afaeab6f2___JsValue_____wasm_bindgen_d171202afaeab6f2___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
136
143
  export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true_: (a: number, b: number, c: any) => [number, number];
137
144
  export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true_: (a: number, b: number, c: any) => [number, number];
138
- export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__125: (a: number, b: number, c: any) => [number, number];
139
- export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__128: (a: number, b: number, c: any) => [number, number];
140
- export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__129: (a: number, b: number, c: any) => [number, number];
145
+ export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__131: (a: number, b: number, c: any) => [number, number];
146
+ export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__134: (a: number, b: number, c: any) => [number, number];
147
+ export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wasm_bindgen_d171202afaeab6f2___sys__JsNullable_wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_d171202afaeab6f2___JsError___true__135: (a: number, b: number, c: any) => [number, number];
141
148
  export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___web_sys_9e2ae0ace5131457___features__gen_Event__Event______true_: (a: number, b: number, c: any) => void;
142
149
  export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_: (a: number, b: number, c: any) => void;
143
- export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__127: (a: number, b: number, c: any) => void;
150
+ export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke___wgpu_f46556a90412e4d9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__133: (a: number, b: number, c: any) => void;
144
151
  export const wasm_bindgen_d171202afaeab6f2___convert__closures_____invoke_______true_: (a: number, b: number) => void;
145
152
  export const __wbindgen_malloc: (a: number, b: number) => number;
146
153
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;