@napi-rs/webcodecs 1.2.1 → 1.3.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 (4) hide show
  1. package/README.md +60 -5
  2. package/index.d.ts +255 -212
  3. package/index.js +82 -237
  4. package/package.json +42 -33
package/index.d.ts CHANGED
@@ -137,18 +137,61 @@ export interface MkvMuxerInit {
137
137
  streaming?: { bufferCapacity?: number }
138
138
  }
139
139
 
140
- export type TypedArray =
141
- | Int8Array
142
- | Uint8Array
143
- | Uint8ClampedArray
144
- | Int16Array
145
- | Uint16Array
146
- | Int32Array
147
- | Uint32Array
148
- | Float32Array
149
- | Float64Array
150
- | BigInt64Array
151
- | BigUint64Array
140
+ // ============================================================================
141
+ // Async Iterator Types
142
+ // ============================================================================
143
+
144
+ /**
145
+ * Chunk yielded by demuxer async iterator.
146
+ *
147
+ * Contains either a video or audio chunk. Use the `chunkType` property
148
+ * to determine which type of chunk is present.
149
+ *
150
+ * @example
151
+ * ```typescript
152
+ * for await (const chunk of demuxer) {
153
+ * if (chunk.chunkType === 'video') {
154
+ * videoDecoder.decode(chunk.videoChunk!)
155
+ * } else {
156
+ * audioDecoder.decode(chunk.audioChunk!)
157
+ * }
158
+ * }
159
+ * ```
160
+ */
161
+ export interface DemuxerChunk {
162
+ /** Type of chunk: 'video' or 'audio' */
163
+ chunkType: 'video' | 'audio'
164
+ /** Video chunk (present when chunkType is 'video') */
165
+ videoChunk?: EncodedVideoChunk
166
+ /** Audio chunk (present when chunkType is 'audio') */
167
+ audioChunk?: EncodedAudioChunk
168
+ }
169
+
170
+ /**
171
+ * Adds async iterator support to Mp4Demuxer.
172
+ * Declaration merging allows using `for await...of` with the demuxer.
173
+ */
174
+ export interface Mp4Demuxer {
175
+ [Symbol.asyncIterator](): AsyncGenerator<DemuxerChunk, void, void>
176
+ }
177
+
178
+ /**
179
+ * Adds async iterator support to WebMDemuxer.
180
+ * Declaration merging allows using `for await...of` with the demuxer.
181
+ */
182
+ export interface WebMDemuxer {
183
+ [Symbol.asyncIterator](): AsyncGenerator<DemuxerChunk, void, void>
184
+ }
185
+
186
+ /**
187
+ * Adds async iterator support to MkvDemuxer.
188
+ * Declaration merging allows using `for await...of` with the demuxer.
189
+ */
190
+ export interface MkvDemuxer {
191
+ [Symbol.asyncIterator](): AsyncGenerator<DemuxerChunk, void, void>
192
+ }
193
+
194
+ export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array
152
195
  /**
153
196
  * AudioData - represents uncompressed audio data
154
197
  *
@@ -242,7 +285,7 @@ export declare class AudioDecoder {
242
285
  *
243
286
  * @param init - Init dictionary containing output and error callbacks
244
287
  */
245
- constructor(init: { output: (data: AudioData) => void; error: (error: Error) => void })
288
+ constructor(init: { output: (data: AudioData) => void, error: (error: Error) => void })
246
289
  /** Get decoder state */
247
290
  get state(): CodecState
248
291
  /** Get number of pending decode operations (per WebCodecs spec) */
@@ -282,17 +325,9 @@ export declare class AudioDecoder {
282
325
  */
283
326
  static isConfigSupported(config: AudioDecoderConfig): Promise<AudioDecoderSupport>
284
327
  /** Add an event listener for the specified event type */
285
- addEventListener(
286
- eventType: string,
287
- callback: () => unknown,
288
- options?: AudioDecoderAddEventListenerOptions | undefined | null,
289
- ): void
328
+ addEventListener(eventType: string, callback: () => unknown, options?: AudioDecoderAddEventListenerOptions | undefined | null): void
290
329
  /** Remove an event listener for the specified event type */
291
- removeEventListener(
292
- eventType: string,
293
- callback: () => unknown,
294
- options?: AudioDecoderEventListenerOptions | undefined | null,
295
- ): void
330
+ removeEventListener(eventType: string, callback: () => unknown, options?: AudioDecoderEventListenerOptions | undefined | null): void
296
331
  /** Dispatch an event to all registered listeners */
297
332
  dispatchEvent(eventType: string): boolean
298
333
  }
@@ -327,10 +362,7 @@ export declare class AudioEncoder {
327
362
  *
328
363
  * @param init - Init dictionary containing output and error callbacks
329
364
  */
330
- constructor(init: {
331
- output: (chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadata) => void
332
- error: (error: Error) => void
333
- })
365
+ constructor(init: { output: (chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadata) => void, error: (error: Error) => void })
334
366
  /** Get encoder state */
335
367
  get state(): CodecState
336
368
  /** Get number of pending encode operations (per WebCodecs spec) */
@@ -373,17 +405,9 @@ export declare class AudioEncoder {
373
405
  * Add an event listener for the specified event type
374
406
  * Uses separate RwLock to avoid blocking on encode operations
375
407
  */
376
- addEventListener(
377
- eventType: string,
378
- callback: () => unknown,
379
- options?: AudioEncoderAddEventListenerOptions | undefined | null,
380
- ): void
408
+ addEventListener(eventType: string, callback: () => unknown, options?: AudioEncoderAddEventListenerOptions | undefined | null): void
381
409
  /** Remove an event listener for the specified event type */
382
- removeEventListener(
383
- eventType: string,
384
- callback: () => unknown,
385
- options?: AudioEncoderEventListenerOptions | undefined | null,
386
- ): void
410
+ removeEventListener(eventType: string, callback: () => unknown, options?: AudioEncoderEventListenerOptions | undefined | null): void
387
411
  /** Dispatch an event to all registered listeners */
388
412
  dispatchEvent(eventType: string): boolean
389
413
  }
@@ -394,12 +418,7 @@ export declare class AudioEncoder {
394
418
  */
395
419
  export declare class DOMRectReadOnly {
396
420
  /** Create a new DOMRectReadOnly */
397
- constructor(
398
- x?: number | undefined | null,
399
- y?: number | undefined | null,
400
- width?: number | undefined | null,
401
- height?: number | undefined | null,
402
- )
421
+ constructor(x?: number | undefined | null, y?: number | undefined | null, width?: number | undefined | null, height?: number | undefined | null)
403
422
  /** X coordinate */
404
423
  get x(): number
405
424
  /** Y coordinate */
@@ -561,6 +580,11 @@ export declare class ImageTrackList {
561
580
  * MKV Demuxer for reading encoded video and audio from Matroska container
562
581
  *
563
582
  * MKV supports almost any video and audio codec.
583
+ *
584
+ * This type implements JavaScript's async iterable protocol.
585
+ * It can be used with `for await...of` loops.
586
+ *
587
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
564
588
  */
565
589
  export declare class MkvDemuxer {
566
590
  constructor(init: MkvDemuxerInit)
@@ -579,6 +603,8 @@ export declare class MkvDemuxer {
579
603
  selectVideoTrack(trackIndex: number): void
580
604
  selectAudioTrack(trackIndex: number): void
581
605
  demux(count?: number | undefined | null): void
606
+ /** Demux packets asynchronously (awaitable version of demux) */
607
+ demuxAsync(count?: number | undefined | null): Promise<void>
582
608
  seek(timestampUs: number): void
583
609
  close(): void
584
610
  get state(): string
@@ -673,6 +699,11 @@ export declare class MkvMuxer {
673
699
  *
674
700
  * demuxer.close();
675
701
  * ```
702
+ *
703
+ * This type implements JavaScript's async iterable protocol.
704
+ * It can be used with `for await...of` loops.
705
+ *
706
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
676
707
  */
677
708
  export declare class Mp4Demuxer {
678
709
  /** Create a new MP4 demuxer */
@@ -705,6 +736,20 @@ export declare class Mp4Demuxer {
705
736
  * Otherwise, reads all packets until end of stream.
706
737
  */
707
738
  demux(count?: number | undefined | null): void
739
+ /**
740
+ * Demux packets asynchronously (awaitable version of demux)
741
+ *
742
+ * If count is specified, reads up to that many packets.
743
+ * Otherwise, reads all packets until end of stream.
744
+ * Returns a Promise that resolves when demuxing is complete.
745
+ *
746
+ * This method is useful when you want to wait for demuxing to finish
747
+ * before proceeding with other operations.
748
+ *
749
+ * Note: For streaming use cases, prefer the async iterator pattern:
750
+ * `for await (const chunk of demuxer) { ... }`
751
+ */
752
+ demuxAsync(count?: number | undefined | null): Promise<void>
708
753
  /** Seek to a timestamp in microseconds */
709
754
  seek(timestampUs: number): void
710
755
  /** Close the demuxer and release resources */
@@ -839,7 +884,7 @@ export declare class VideoDecoder {
839
884
  *
840
885
  * @param init - Init dictionary containing output and error callbacks
841
886
  */
842
- constructor(init: { output: (frame: VideoFrame) => void; error: (error: Error) => void })
887
+ constructor(init: { output: (frame: VideoFrame) => void, error: (error: Error) => void })
843
888
  /** Get decoder state */
844
889
  get state(): CodecState
845
890
  /** Get number of pending decode operations (per WebCodecs spec) */
@@ -889,17 +934,9 @@ export declare class VideoDecoder {
889
934
  * Add an event listener for the specified event type
890
935
  * Uses separate RwLock to avoid blocking on decode operations
891
936
  */
892
- addEventListener(
893
- eventType: string,
894
- callback: () => unknown,
895
- options?: VideoDecoderAddEventListenerOptions | undefined | null,
896
- ): void
937
+ addEventListener(eventType: string, callback: () => unknown, options?: VideoDecoderAddEventListenerOptions | undefined | null): void
897
938
  /** Remove an event listener for the specified event type */
898
- removeEventListener(
899
- eventType: string,
900
- callback: () => unknown,
901
- options?: VideoDecoderEventListenerOptions | undefined | null,
902
- ): void
939
+ removeEventListener(eventType: string, callback: () => unknown, options?: VideoDecoderEventListenerOptions | undefined | null): void
903
940
  /** Dispatch an event to all registered listeners */
904
941
  dispatchEvent(eventType: string): boolean
905
942
  }
@@ -935,10 +972,7 @@ export declare class VideoEncoder {
935
972
  *
936
973
  * @param init - Init dictionary containing output and error callbacks
937
974
  */
938
- constructor(init: {
939
- output: (chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadata) => void
940
- error: (error: Error) => void
941
- })
975
+ constructor(init: { output: (chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadata) => void, error: (error: Error) => void })
942
976
  /** Get encoder state */
943
977
  get state(): CodecState
944
978
  /** Get number of pending encode operations (per WebCodecs spec) */
@@ -973,17 +1007,9 @@ export declare class VideoEncoder {
973
1007
  * Add an event listener for the specified event type
974
1008
  * Uses separate RwLock to avoid blocking on encode operations
975
1009
  */
976
- addEventListener(
977
- eventType: string,
978
- callback: () => unknown,
979
- options?: AddEventListenerOptions | undefined | null,
980
- ): void
1010
+ addEventListener(eventType: string, callback: () => unknown, options?: AddEventListenerOptions | undefined | null): void
981
1011
  /** Remove an event listener for the specified event type */
982
- removeEventListener(
983
- eventType: string,
984
- callback: () => unknown,
985
- options?: EventListenerOptions | undefined | null,
986
- ): void
1012
+ removeEventListener(eventType: string, callback: () => unknown, options?: EventListenerOptions | undefined | null): void
987
1013
  /** Dispatch an event to all registered listeners */
988
1014
  dispatchEvent(eventType: string): boolean
989
1015
  /**
@@ -1100,6 +1126,11 @@ export declare class VideoFrame {
1100
1126
  * WebM Demuxer for reading encoded video and audio from WebM container
1101
1127
  *
1102
1128
  * WebM typically contains VP8, VP9, or AV1 video with Opus or Vorbis audio.
1129
+ *
1130
+ * This type implements JavaScript's async iterable protocol.
1131
+ * It can be used with `for await...of` loops.
1132
+ *
1133
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
1103
1134
  */
1104
1135
  export declare class WebMDemuxer {
1105
1136
  constructor(init: WebMDemuxerInit)
@@ -1118,6 +1149,8 @@ export declare class WebMDemuxer {
1118
1149
  selectVideoTrack(trackIndex: number): void
1119
1150
  selectAudioTrack(trackIndex: number): void
1120
1151
  demux(count?: number | undefined | null): void
1152
+ /** Demux packets asynchronously (awaitable version of demux) */
1153
+ demuxAsync(count?: number | undefined | null): Promise<void>
1121
1154
  seek(timestampUs: number): void
1122
1155
  close(): void
1123
1156
  get state(): string
@@ -1185,9 +1218,9 @@ export declare class WebMMuxer {
1185
1218
 
1186
1219
  /** AAC bitstream format (W3C WebCodecs AAC Registration) */
1187
1220
  export type AacBitstreamFormat = /** Raw AAC frames - metadata in description */
1188
- | 'aac'
1189
- /** ADTS frames - metadata in each frame */
1190
- | 'adts'
1221
+ 'aac'|
1222
+ /** ADTS frames - metadata in each frame */
1223
+ 'adts';
1191
1224
 
1192
1225
  /** AAC encoder configuration (W3C WebCodecs AAC Registration) */
1193
1226
  export interface AacEncoderConfig {
@@ -1207,9 +1240,9 @@ export interface AddEventListenerOptions {
1207
1240
  * Default is "discard" per spec
1208
1241
  */
1209
1242
  export type AlphaOption = /** Keep alpha channel if present */
1210
- | 'keep'
1211
- /** Discard alpha channel (default per W3C spec) */
1212
- | 'discard'
1243
+ 'keep'|
1244
+ /** Discard alpha channel (default per W3C spec) */
1245
+ 'discard';
1213
1246
 
1214
1247
  /** Options for copyTo operation */
1215
1248
  export interface AudioDataCopyToOptions {
@@ -1275,7 +1308,9 @@ export interface AudioEncoderAddEventListenerOptions {
1275
1308
  }
1276
1309
 
1277
1310
  /** Encode options for audio */
1278
- export interface AudioEncoderEncodeOptions {}
1311
+ export interface AudioEncoderEncodeOptions {
1312
+
1313
+ }
1279
1314
 
1280
1315
  /** Options for removeEventListener (W3C DOM spec) */
1281
1316
  export interface AudioEncoderEventListenerOptions {
@@ -1292,27 +1327,27 @@ export interface AudioEncoderSupport {
1292
1327
 
1293
1328
  /** Audio sample format (WebCodecs spec) */
1294
1329
  export type AudioSampleFormat = /** Unsigned 8-bit integer samples| interleaved */
1295
- | 'u8'
1296
- /** Signed 16-bit integer samples| interleaved */
1297
- | 's16'
1298
- /** Signed 32-bit integer samples| interleaved */
1299
- | 's32'
1300
- /** 32-bit float samples| interleaved */
1301
- | 'f32'
1302
- /** Unsigned 8-bit integer samples| planar */
1303
- | 'u8-planar'
1304
- /** Signed 16-bit integer samples| planar */
1305
- | 's16-planar'
1306
- /** Signed 32-bit integer samples| planar */
1307
- | 's32-planar'
1308
- /** 32-bit float samples| planar */
1309
- | 'f32-planar'
1330
+ 'u8'|
1331
+ /** Signed 16-bit integer samples| interleaved */
1332
+ 's16'|
1333
+ /** Signed 32-bit integer samples| interleaved */
1334
+ 's32'|
1335
+ /** 32-bit float samples| interleaved */
1336
+ 'f32'|
1337
+ /** Unsigned 8-bit integer samples| planar */
1338
+ 'u8-planar'|
1339
+ /** Signed 16-bit integer samples| planar */
1340
+ 's16-planar'|
1341
+ /** Signed 32-bit integer samples| planar */
1342
+ 's32-planar'|
1343
+ /** 32-bit float samples| planar */
1344
+ 'f32-planar';
1310
1345
 
1311
1346
  /** AVC (H.264) bitstream format (W3C WebCodecs AVC Registration) */
1312
1347
  export type AvcBitstreamFormat = /** AVC format with parameter sets in description (ISO 14496-15) */
1313
- | 'avc'
1314
- /** Annex B format with parameter sets in bitstream */
1315
- | 'annexb'
1348
+ 'avc'|
1349
+ /** Annex B format with parameter sets in bitstream */
1350
+ 'annexb';
1316
1351
 
1317
1352
  /** AVC (H.264) encoder configuration (W3C WebCodecs AVC Registration) */
1318
1353
  export interface AvcEncoderConfig {
@@ -1322,23 +1357,23 @@ export interface AvcEncoderConfig {
1322
1357
 
1323
1358
  /** Bitrate mode for audio encoding (W3C WebCodecs spec) */
1324
1359
  export type BitrateMode = /** Variable bitrate (default) */
1325
- | 'variable'
1326
- /** Constant bitrate */
1327
- | 'constant'
1360
+ 'variable'|
1361
+ /** Constant bitrate */
1362
+ 'constant';
1328
1363
 
1329
1364
  /** Encoder state per WebCodecs spec */
1330
1365
  export type CodecState = /** Encoder not configured */
1331
- | 'unconfigured'
1332
- /** Encoder configured and ready */
1333
- | 'configured'
1334
- /** Encoder closed */
1335
- | 'closed'
1366
+ 'unconfigured'|
1367
+ /** Encoder configured and ready */
1368
+ 'configured'|
1369
+ /** Encoder closed */
1370
+ 'closed';
1336
1371
 
1337
1372
  /** ColorSpaceConversion for ImageDecoder (W3C WebCodecs spec) */
1338
1373
  export type ColorSpaceConversion = /** Apply default color space conversion (spec default) */
1339
- | 'default'
1340
- /** No color space conversion */
1341
- | 'none'
1374
+ 'default'|
1375
+ /** No color space conversion */
1376
+ 'none';
1342
1377
 
1343
1378
  /** Audio decoder configuration exposed to JavaScript */
1344
1379
  export interface DemuxerAudioDecoderConfig {
@@ -1406,9 +1441,9 @@ export interface EncodedAudioChunkMetadataJs {
1406
1441
 
1407
1442
  /** Type of encoded audio chunk */
1408
1443
  export type EncodedAudioChunkType = /** Key chunk - can be decoded independently */
1409
- | 'key'
1410
- /** Delta chunk - depends on previous chunks */
1411
- | 'delta'
1444
+ 'key'|
1445
+ /** Delta chunk - depends on previous chunks */
1446
+ 'delta';
1412
1447
 
1413
1448
  /** Output callback metadata per WebCodecs spec */
1414
1449
  export interface EncodedVideoChunkMetadata {
@@ -1436,9 +1471,9 @@ export interface EncodedVideoChunkMetadataJs {
1436
1471
 
1437
1472
  /** Type of encoded video chunk */
1438
1473
  export type EncodedVideoChunkType = /** Keyframe - can be decoded independently */
1439
- | 'key'
1440
- /** Delta frame - depends on previous frames */
1441
- | 'delta'
1474
+ 'key'|
1475
+ /** Delta frame - depends on previous frames */
1476
+ 'delta';
1442
1477
 
1443
1478
  /** Options for removeEventListener (W3C DOM spec) */
1444
1479
  export interface EventListenerOptions {
@@ -1464,11 +1499,11 @@ export declare function getPreferredHardwareAccelerator(): string | null
1464
1499
 
1465
1500
  /** Hardware acceleration preference (W3C WebCodecs spec) */
1466
1501
  export type HardwareAcceleration = /** No preference - may use hardware or software */
1467
- | 'no-preference'
1468
- /** Prefer hardware acceleration */
1469
- | 'prefer-hardware'
1470
- /** Prefer software implementation */
1471
- | 'prefer-software'
1502
+ 'no-preference'|
1503
+ /** Prefer hardware acceleration */
1504
+ 'prefer-hardware'|
1505
+ /** Prefer software implementation */
1506
+ 'prefer-software';
1472
1507
 
1473
1508
  /** Hardware accelerator information */
1474
1509
  export interface HardwareAccelerator {
@@ -1482,9 +1517,9 @@ export interface HardwareAccelerator {
1482
1517
 
1483
1518
  /** HEVC (H.265) bitstream format (W3C WebCodecs HEVC Registration) */
1484
1519
  export type HevcBitstreamFormat = /** HEVC format with parameter sets in description (ISO 14496-15) */
1485
- | 'hevc'
1486
- /** Annex B format with parameter sets in bitstream */
1487
- | 'annexb'
1520
+ 'hevc'|
1521
+ /** Annex B format with parameter sets in bitstream */
1522
+ 'annexb';
1488
1523
 
1489
1524
  /** HEVC (H.265) encoder configuration (W3C WebCodecs HEVC Registration) */
1490
1525
  export interface HevcEncoderConfig {
@@ -1505,9 +1540,9 @@ export declare function isHardwareAcceleratorAvailable(name: string): boolean
1505
1540
 
1506
1541
  /** Latency mode for video encoding (W3C WebCodecs spec) */
1507
1542
  export type LatencyMode = /** Optimize for quality (default) */
1508
- | 'quality'
1509
- /** Optimize for low latency */
1510
- | 'realtime'
1543
+ 'quality'|
1544
+ /** Optimize for low latency */
1545
+ 'realtime';
1511
1546
 
1512
1547
  /** Audio track configuration for MKV muxer */
1513
1548
  export interface MkvAudioTrackConfig {
@@ -1537,6 +1572,8 @@ export interface MkvVideoTrackConfig {
1537
1572
  width: number
1538
1573
  /** Video height in pixels */
1539
1574
  height: number
1575
+ /** Frame rate (frames per second) */
1576
+ framerate?: number
1540
1577
  /** Codec-specific description data */
1541
1578
  description?: Uint8Array
1542
1579
  }
@@ -1577,23 +1614,25 @@ export interface Mp4VideoTrackConfig {
1577
1614
  width: number
1578
1615
  /** Video height in pixels */
1579
1616
  height: number
1617
+ /** Frame rate (frames per second) */
1618
+ framerate?: number
1580
1619
  /** Codec-specific description data (avcC/hvcC/av1C from encoder metadata) */
1581
1620
  description?: Uint8Array
1582
1621
  }
1583
1622
 
1584
1623
  /** Opus application mode (W3C WebCodecs Opus Registration) */
1585
1624
  export type OpusApplication = /** Optimize for VoIP (speech intelligibility) */
1586
- | 'voip'
1587
- /** Optimize for audio fidelity (default) */
1588
- | 'audio'
1589
- /** Minimize coding delay */
1590
- | 'lowdelay'
1625
+ 'voip'|
1626
+ /** Optimize for audio fidelity (default) */
1627
+ 'audio'|
1628
+ /** Minimize coding delay */
1629
+ 'lowdelay';
1591
1630
 
1592
1631
  /** Opus bitstream format (W3C WebCodecs Opus Registration) */
1593
1632
  export type OpusBitstreamFormat = /** Opus packets (RFC 6716) - no metadata needed for decoding */
1594
- | 'opus'
1595
- /** Ogg encapsulation (RFC 7845) - metadata in description */
1596
- | 'ogg'
1633
+ 'opus'|
1634
+ /** Ogg encapsulation (RFC 7845) - metadata in description */
1635
+ 'ogg';
1597
1636
 
1598
1637
  /** Opus encoder configuration (W3C WebCodecs Opus Registration) */
1599
1638
  export interface OpusEncoderConfig {
@@ -1620,11 +1659,11 @@ export interface OpusEncoderConfig {
1620
1659
 
1621
1660
  /** Opus signal type hint (W3C WebCodecs Opus Registration) */
1622
1661
  export type OpusSignal = /** Auto-detect signal type */
1623
- | 'auto'
1624
- /** Music signal */
1625
- | 'music'
1626
- /** Voice/speech signal */
1627
- | 'voice'
1662
+ 'auto'|
1663
+ /** Music signal */
1664
+ 'music'|
1665
+ /** Voice/speech signal */
1666
+ 'voice';
1628
1667
 
1629
1668
  /** Layout information for a single plane per WebCodecs spec */
1630
1669
  export interface PlaneLayout {
@@ -1665,15 +1704,15 @@ export interface SvcOutputMetadataJs {
1665
1704
 
1666
1705
  /** Video color primaries (W3C WebCodecs spec) */
1667
1706
  export type VideoColorPrimaries = /** BT.709 / sRGB primaries */
1668
- | 'bt709'
1669
- /** BT.470 BG (PAL) */
1670
- | 'bt470bg'
1671
- /** SMPTE 170M (NTSC) */
1672
- | 'smpte170m'
1673
- /** BT.2020 (UHD) */
1674
- | 'bt2020'
1675
- /** SMPTE 432 (DCI-P3) */
1676
- | 'smpte432'
1707
+ 'bt709'|
1708
+ /** BT.470 BG (PAL) */
1709
+ 'bt470bg'|
1710
+ /** SMPTE 170M (NTSC) */
1711
+ 'smpte170m'|
1712
+ /** BT.2020 (UHD) */
1713
+ 'bt2020'|
1714
+ /** SMPTE 432 (DCI-P3) */
1715
+ 'smpte432';
1677
1716
 
1678
1717
  /** Options for addEventListener (W3C DOM spec) */
1679
1718
  export interface VideoDecoderAddEventListenerOptions {
@@ -1731,11 +1770,11 @@ export interface VideoDecoderSupport {
1731
1770
 
1732
1771
  /** Bitrate mode for video encoding (W3C WebCodecs spec) */
1733
1772
  export type VideoEncoderBitrateMode = /** Variable bitrate (default) */
1734
- | 'variable'
1735
- /** Constant bitrate */
1736
- | 'constant'
1737
- /** Use quantizer parameter from codec-specific options */
1738
- | 'quantizer'
1773
+ 'variable'|
1774
+ /** Constant bitrate */
1775
+ 'constant'|
1776
+ /** Use quantizer parameter from codec-specific options */
1777
+ 'quantizer';
1739
1778
 
1740
1779
  /** Encode options per WebCodecs spec */
1741
1780
  export interface VideoEncoderEncodeOptions {
@@ -1819,7 +1858,9 @@ export interface VideoFrameInit {
1819
1858
  * VideoFrameMetadata - metadata associated with a VideoFrame (W3C spec)
1820
1859
  * Members defined in VideoFrame Metadata Registry - currently empty per spec
1821
1860
  */
1822
- export interface VideoFrameMetadata {}
1861
+ export interface VideoFrameMetadata {
1862
+
1863
+ }
1823
1864
 
1824
1865
  /** Rectangle for specifying a region */
1825
1866
  export interface VideoFrameRect {
@@ -1831,75 +1872,75 @@ export interface VideoFrameRect {
1831
1872
 
1832
1873
  /** Video matrix coefficients (W3C WebCodecs spec) */
1833
1874
  export type VideoMatrixCoefficients = /** RGB (identity matrix) */
1834
- | 'rgb'
1835
- /** BT.709 */
1836
- | 'bt709'
1837
- /** BT.470 BG */
1838
- | 'bt470bg'
1839
- /** SMPTE 170M */
1840
- | 'smpte170m'
1841
- /** BT.2020 non-constant luminance */
1842
- | 'bt2020-ncl'
1875
+ 'rgb'|
1876
+ /** BT.709 */
1877
+ 'bt709'|
1878
+ /** BT.470 BG */
1879
+ 'bt470bg'|
1880
+ /** SMPTE 170M */
1881
+ 'smpte170m'|
1882
+ /** BT.2020 non-constant luminance */
1883
+ 'bt2020-ncl';
1843
1884
 
1844
1885
  /** Video pixel format (WebCodecs spec) */
1845
1886
  export type VideoPixelFormat = /** Planar YUV 4:2:0| 12bpp| (1 Cr & Cb sample per 2x2 Y samples) */
1846
- | 'I420'
1847
- /** Planar YUV 4:2:0| 12bpp| with alpha plane */
1848
- | 'I420A'
1849
- /** Planar YUV 4:2:2| 16bpp */
1850
- | 'I422'
1851
- /** Planar YUV 4:2:2| 16bpp| with alpha plane */
1852
- | 'I422A'
1853
- /** Planar YUV 4:4:4| 24bpp */
1854
- | 'I444'
1855
- /** Planar YUV 4:4:4| 24bpp| with alpha plane */
1856
- | 'I444A'
1857
- /** Planar YUV 4:2:0| 10-bit */
1858
- | 'I420P10'
1859
- /** Planar YUV 4:2:0| 10-bit| with alpha plane */
1860
- | 'I420AP10'
1861
- /** Planar YUV 4:2:2| 10-bit */
1862
- | 'I422P10'
1863
- /** Planar YUV 4:2:2| 10-bit| with alpha plane */
1864
- | 'I422AP10'
1865
- /** Planar YUV 4:4:4| 10-bit */
1866
- | 'I444P10'
1867
- /** Planar YUV 4:4:4| 10-bit| with alpha plane */
1868
- | 'I444AP10'
1869
- /** Planar YUV 4:2:0| 12-bit */
1870
- | 'I420P12'
1871
- /** Planar YUV 4:2:2| 12-bit */
1872
- | 'I422P12'
1873
- /** Planar YUV 4:4:4| 12-bit */
1874
- | 'I444P12'
1875
- /** Semi-planar YUV 4:2:0| 12bpp (Y plane + interleaved UV) */
1876
- | 'NV12'
1877
- /** Semi-planar YUV 4:2:0| 12bpp (Y plane + interleaved VU) - per W3C WebCodecs spec */
1878
- | 'NV21'
1879
- /** RGBA 32bpp */
1880
- | 'RGBA'
1881
- /** RGBX 32bpp (alpha ignored) */
1882
- | 'RGBX'
1883
- /** BGRA 32bpp */
1884
- | 'BGRA'
1885
- /** BGRX 32bpp (alpha ignored) */
1886
- | 'BGRX'
1887
+ 'I420'|
1888
+ /** Planar YUV 4:2:0| 12bpp| with alpha plane */
1889
+ 'I420A'|
1890
+ /** Planar YUV 4:2:2| 16bpp */
1891
+ 'I422'|
1892
+ /** Planar YUV 4:2:2| 16bpp| with alpha plane */
1893
+ 'I422A'|
1894
+ /** Planar YUV 4:4:4| 24bpp */
1895
+ 'I444'|
1896
+ /** Planar YUV 4:4:4| 24bpp| with alpha plane */
1897
+ 'I444A'|
1898
+ /** Planar YUV 4:2:0| 10-bit */
1899
+ 'I420P10'|
1900
+ /** Planar YUV 4:2:0| 10-bit| with alpha plane */
1901
+ 'I420AP10'|
1902
+ /** Planar YUV 4:2:2| 10-bit */
1903
+ 'I422P10'|
1904
+ /** Planar YUV 4:2:2| 10-bit| with alpha plane */
1905
+ 'I422AP10'|
1906
+ /** Planar YUV 4:4:4| 10-bit */
1907
+ 'I444P10'|
1908
+ /** Planar YUV 4:4:4| 10-bit| with alpha plane */
1909
+ 'I444AP10'|
1910
+ /** Planar YUV 4:2:0| 12-bit */
1911
+ 'I420P12'|
1912
+ /** Planar YUV 4:2:2| 12-bit */
1913
+ 'I422P12'|
1914
+ /** Planar YUV 4:4:4| 12-bit */
1915
+ 'I444P12'|
1916
+ /** Semi-planar YUV 4:2:0| 12bpp (Y plane + interleaved UV) */
1917
+ 'NV12'|
1918
+ /** Semi-planar YUV 4:2:0| 12bpp (Y plane + interleaved VU) - per W3C WebCodecs spec */
1919
+ 'NV21'|
1920
+ /** RGBA 32bpp */
1921
+ 'RGBA'|
1922
+ /** RGBX 32bpp (alpha ignored) */
1923
+ 'RGBX'|
1924
+ /** BGRA 32bpp */
1925
+ 'BGRA'|
1926
+ /** BGRX 32bpp (alpha ignored) */
1927
+ 'BGRX';
1887
1928
 
1888
1929
  /** Video transfer characteristics (W3C WebCodecs spec) */
1889
1930
  export type VideoTransferCharacteristics = /** BT.709 transfer */
1890
- | 'bt709'
1891
- /** SMPTE 170M transfer */
1892
- | 'smpte170m'
1893
- /** IEC 61966-2-1 (sRGB) - technical name */
1894
- | 'iec61966-2-1'
1895
- /** sRGB transfer (alias for iec61966-2-1) */
1896
- | 'srgb'
1897
- /** Linear transfer */
1898
- | 'linear'
1899
- /** Perceptual Quantizer (HDR) */
1900
- | 'pq'
1901
- /** Hybrid Log-Gamma (HDR) */
1902
- | 'hlg'
1931
+ 'bt709'|
1932
+ /** SMPTE 170M transfer */
1933
+ 'smpte170m'|
1934
+ /** IEC 61966-2-1 (sRGB) - technical name */
1935
+ 'iec61966-2-1'|
1936
+ /** sRGB transfer (alias for iec61966-2-1) */
1937
+ 'srgb'|
1938
+ /** Linear transfer */
1939
+ 'linear'|
1940
+ /** Perceptual Quantizer (HDR) */
1941
+ 'pq'|
1942
+ /** Hybrid Log-Gamma (HDR) */
1943
+ 'hlg';
1903
1944
 
1904
1945
  /** Audio track configuration for WebM muxer */
1905
1946
  export interface WebMAudioTrackConfig {
@@ -1929,6 +1970,8 @@ export interface WebMVideoTrackConfig {
1929
1970
  width: number
1930
1971
  /** Video height in pixels */
1931
1972
  height: number
1973
+ /** Frame rate (frames per second) */
1974
+ framerate?: number
1932
1975
  /** Codec-specific description data */
1933
1976
  description?: Uint8Array
1934
1977
  /** Whether the video has alpha channel (VP9 alpha support) */