@napi-rs/webcodecs 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/index.d.ts +157 -129
- package/index.js +376 -106
- package/package.json +40 -62
package/README.md
CHANGED
|
@@ -168,6 +168,11 @@ result.image.close()
|
|
|
168
168
|
decoder.close()
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
+
When `data` is a `ReadableStream`, `ImageDecoder` accumulates every chunk so it
|
|
172
|
+
can re-probe the growing input. This buffer currently has no fixed limit, so
|
|
173
|
+
applications should bound or reject unexpectedly large streams before passing
|
|
174
|
+
them to the decoder.
|
|
175
|
+
|
|
171
176
|
### Container Demuxing
|
|
172
177
|
|
|
173
178
|
Read encoded video/audio from MP4, WebM, or MKV containers:
|
|
@@ -283,6 +288,7 @@ import { Mp4Muxer } from '@napi-rs/webcodecs'
|
|
|
283
288
|
|
|
284
289
|
const muxer = new Mp4Muxer({
|
|
285
290
|
fragmented: true, // Required for MP4 streaming
|
|
291
|
+
// Maximum bytes returned by each read(); this is not a memory limit.
|
|
286
292
|
streaming: { bufferCapacity: 256 * 1024 },
|
|
287
293
|
})
|
|
288
294
|
|
|
@@ -303,6 +309,12 @@ if (muxer.isFinished) {
|
|
|
303
309
|
}
|
|
304
310
|
```
|
|
305
311
|
|
|
312
|
+
Streaming writes are queued in a growable native buffer so `addVideoChunk()`
|
|
313
|
+
and `addAudioChunk()` never wait for JavaScript to call `read()`. Applications
|
|
314
|
+
must drain `read()` regularly; an indefinitely stalled consumer can retain the
|
|
315
|
+
entire muxed output in memory. `bufferCapacity` controls only the maximum size
|
|
316
|
+
of each returned read chunk.
|
|
317
|
+
|
|
306
318
|
### VideoFrame from Canvas
|
|
307
319
|
|
|
308
320
|
Create VideoFrames from `@napi-rs/canvas` for graphics, text rendering, or image compositing:
|
|
@@ -683,6 +695,11 @@ For full API documentation, see the [W3C WebCodecs specification](https://w3c.gi
|
|
|
683
695
|
- Node.js 18+
|
|
684
696
|
- pnpm
|
|
685
697
|
|
|
698
|
+
The build downloads the pinned FFmpeg 9.0 release by default. If you opt out
|
|
699
|
+
of that download or set `FFMPEG_DIR`, the supplied FFmpeg headers and libraries
|
|
700
|
+
must be from FFmpeg 9.x; FFmpeg 8.x system/Homebrew installations are rejected
|
|
701
|
+
by the ABI guard.
|
|
702
|
+
|
|
686
703
|
### Build
|
|
687
704
|
|
|
688
705
|
```bash
|
package/index.d.ts
CHANGED
|
@@ -111,32 +111,6 @@ export interface MuxerAudioTrackConfig {
|
|
|
111
111
|
description?: Uint8Array
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
/** Init options for Mp4Muxer */
|
|
115
|
-
export interface Mp4MuxerInit {
|
|
116
|
-
/** Move moov atom to beginning (not compatible with streaming) */
|
|
117
|
-
fastStart?: boolean
|
|
118
|
-
/** Use fragmented MP4 for streaming */
|
|
119
|
-
fragmented?: boolean
|
|
120
|
-
/** Enable streaming output mode */
|
|
121
|
-
streaming?: { bufferCapacity?: number }
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/** Init options for WebMMuxer */
|
|
125
|
-
export interface WebMMuxerInit {
|
|
126
|
-
/** Enable live streaming mode */
|
|
127
|
-
live?: boolean
|
|
128
|
-
/** Enable streaming output mode */
|
|
129
|
-
streaming?: { bufferCapacity?: number }
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/** Init options for MkvMuxer */
|
|
133
|
-
export interface MkvMuxerInit {
|
|
134
|
-
/** Enable live streaming mode */
|
|
135
|
-
live?: boolean
|
|
136
|
-
/** Enable streaming output mode */
|
|
137
|
-
streaming?: { bufferCapacity?: number }
|
|
138
|
-
}
|
|
139
|
-
|
|
140
114
|
// ============================================================================
|
|
141
115
|
// Async Iterator Types
|
|
142
116
|
// ============================================================================
|
|
@@ -191,7 +165,18 @@ export interface MkvDemuxer {
|
|
|
191
165
|
[Symbol.asyncIterator](): AsyncGenerator<DemuxerChunk, void, void>
|
|
192
166
|
}
|
|
193
167
|
|
|
194
|
-
export type TypedArray =
|
|
168
|
+
export type TypedArray =
|
|
169
|
+
| Int8Array
|
|
170
|
+
| Uint8Array
|
|
171
|
+
| Uint8ClampedArray
|
|
172
|
+
| Int16Array
|
|
173
|
+
| Uint16Array
|
|
174
|
+
| Int32Array
|
|
175
|
+
| Uint32Array
|
|
176
|
+
| Float32Array
|
|
177
|
+
| Float64Array
|
|
178
|
+
| BigInt64Array
|
|
179
|
+
| BigUint64Array
|
|
195
180
|
/**
|
|
196
181
|
* AudioData - represents uncompressed audio data
|
|
197
182
|
*
|
|
@@ -285,7 +270,7 @@ export declare class AudioDecoder {
|
|
|
285
270
|
*
|
|
286
271
|
* @param init - Init dictionary containing output and error callbacks
|
|
287
272
|
*/
|
|
288
|
-
constructor(init: { output: (data: AudioData) => void
|
|
273
|
+
constructor(init: { output: (data: AudioData) => void; error: (error: Error) => void })
|
|
289
274
|
/** Get decoder state */
|
|
290
275
|
get state(): CodecState
|
|
291
276
|
/** Get number of pending decode operations (per WebCodecs spec) */
|
|
@@ -325,9 +310,17 @@ export declare class AudioDecoder {
|
|
|
325
310
|
*/
|
|
326
311
|
static isConfigSupported(config: AudioDecoderConfig): Promise<AudioDecoderSupport>
|
|
327
312
|
/** Add an event listener for the specified event type */
|
|
328
|
-
addEventListener(
|
|
313
|
+
addEventListener(
|
|
314
|
+
eventType: string,
|
|
315
|
+
callback: () => unknown,
|
|
316
|
+
options?: AudioDecoderAddEventListenerOptions | undefined | null,
|
|
317
|
+
): void
|
|
329
318
|
/** Remove an event listener for the specified event type */
|
|
330
|
-
removeEventListener(
|
|
319
|
+
removeEventListener(
|
|
320
|
+
eventType: string,
|
|
321
|
+
callback: () => unknown,
|
|
322
|
+
options?: AudioDecoderEventListenerOptions | undefined | null,
|
|
323
|
+
): void
|
|
331
324
|
/** Dispatch an event to all registered listeners */
|
|
332
325
|
dispatchEvent(eventType: string): boolean
|
|
333
326
|
}
|
|
@@ -362,7 +355,10 @@ export declare class AudioEncoder {
|
|
|
362
355
|
*
|
|
363
356
|
* @param init - Init dictionary containing output and error callbacks
|
|
364
357
|
*/
|
|
365
|
-
constructor(init: {
|
|
358
|
+
constructor(init: {
|
|
359
|
+
output: (chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadata) => void
|
|
360
|
+
error: (error: Error) => void
|
|
361
|
+
})
|
|
366
362
|
/** Get encoder state */
|
|
367
363
|
get state(): CodecState
|
|
368
364
|
/** Get number of pending encode operations (per WebCodecs spec) */
|
|
@@ -405,9 +401,17 @@ export declare class AudioEncoder {
|
|
|
405
401
|
* Add an event listener for the specified event type
|
|
406
402
|
* Uses separate RwLock to avoid blocking on encode operations
|
|
407
403
|
*/
|
|
408
|
-
addEventListener(
|
|
404
|
+
addEventListener(
|
|
405
|
+
eventType: string,
|
|
406
|
+
callback: () => unknown,
|
|
407
|
+
options?: AudioEncoderAddEventListenerOptions | undefined | null,
|
|
408
|
+
): void
|
|
409
409
|
/** Remove an event listener for the specified event type */
|
|
410
|
-
removeEventListener(
|
|
410
|
+
removeEventListener(
|
|
411
|
+
eventType: string,
|
|
412
|
+
callback: () => unknown,
|
|
413
|
+
options?: AudioEncoderEventListenerOptions | undefined | null,
|
|
414
|
+
): void
|
|
411
415
|
/** Dispatch an event to all registered listeners */
|
|
412
416
|
dispatchEvent(eventType: string): boolean
|
|
413
417
|
}
|
|
@@ -418,7 +422,12 @@ export declare class AudioEncoder {
|
|
|
418
422
|
*/
|
|
419
423
|
export declare class DOMRectReadOnly {
|
|
420
424
|
/** Create a new DOMRectReadOnly */
|
|
421
|
-
constructor(
|
|
425
|
+
constructor(
|
|
426
|
+
x?: number | undefined | null,
|
|
427
|
+
y?: number | undefined | null,
|
|
428
|
+
width?: number | undefined | null,
|
|
429
|
+
height?: number | undefined | null,
|
|
430
|
+
)
|
|
422
431
|
/** X coordinate */
|
|
423
432
|
get x(): number
|
|
424
433
|
/** Y coordinate */
|
|
@@ -504,7 +513,8 @@ export declare class EncodedVideoChunk {
|
|
|
504
513
|
export declare class ImageDecoder {
|
|
505
514
|
/**
|
|
506
515
|
* Create a new ImageDecoder
|
|
507
|
-
* Supports both Uint8Array and ReadableStream as data source per W3C spec
|
|
516
|
+
* Supports both Uint8Array and ReadableStream as data source per W3C spec.
|
|
517
|
+
* ReadableStream input is buffered without a fixed size limit.
|
|
508
518
|
*/
|
|
509
519
|
constructor(init: ImageDecoderInit)
|
|
510
520
|
/** Whether the data is fully buffered */
|
|
@@ -884,7 +894,7 @@ export declare class VideoDecoder {
|
|
|
884
894
|
*
|
|
885
895
|
* @param init - Init dictionary containing output and error callbacks
|
|
886
896
|
*/
|
|
887
|
-
constructor(init: { output: (frame: VideoFrame) => void
|
|
897
|
+
constructor(init: { output: (frame: VideoFrame) => void; error: (error: Error) => void })
|
|
888
898
|
/** Get decoder state */
|
|
889
899
|
get state(): CodecState
|
|
890
900
|
/** Get number of pending decode operations (per WebCodecs spec) */
|
|
@@ -934,9 +944,17 @@ export declare class VideoDecoder {
|
|
|
934
944
|
* Add an event listener for the specified event type
|
|
935
945
|
* Uses separate RwLock to avoid blocking on decode operations
|
|
936
946
|
*/
|
|
937
|
-
addEventListener(
|
|
947
|
+
addEventListener(
|
|
948
|
+
eventType: string,
|
|
949
|
+
callback: () => unknown,
|
|
950
|
+
options?: VideoDecoderAddEventListenerOptions | undefined | null,
|
|
951
|
+
): void
|
|
938
952
|
/** Remove an event listener for the specified event type */
|
|
939
|
-
removeEventListener(
|
|
953
|
+
removeEventListener(
|
|
954
|
+
eventType: string,
|
|
955
|
+
callback: () => unknown,
|
|
956
|
+
options?: VideoDecoderEventListenerOptions | undefined | null,
|
|
957
|
+
): void
|
|
940
958
|
/** Dispatch an event to all registered listeners */
|
|
941
959
|
dispatchEvent(eventType: string): boolean
|
|
942
960
|
}
|
|
@@ -972,7 +990,10 @@ export declare class VideoEncoder {
|
|
|
972
990
|
*
|
|
973
991
|
* @param init - Init dictionary containing output and error callbacks
|
|
974
992
|
*/
|
|
975
|
-
constructor(init: {
|
|
993
|
+
constructor(init: {
|
|
994
|
+
output: (chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadata) => void
|
|
995
|
+
error: (error: Error) => void
|
|
996
|
+
})
|
|
976
997
|
/** Get encoder state */
|
|
977
998
|
get state(): CodecState
|
|
978
999
|
/** Get number of pending encode operations (per WebCodecs spec) */
|
|
@@ -1007,9 +1028,17 @@ export declare class VideoEncoder {
|
|
|
1007
1028
|
* Add an event listener for the specified event type
|
|
1008
1029
|
* Uses separate RwLock to avoid blocking on encode operations
|
|
1009
1030
|
*/
|
|
1010
|
-
addEventListener(
|
|
1031
|
+
addEventListener(
|
|
1032
|
+
eventType: string,
|
|
1033
|
+
callback: () => unknown,
|
|
1034
|
+
options?: AddEventListenerOptions | undefined | null,
|
|
1035
|
+
): void
|
|
1011
1036
|
/** Remove an event listener for the specified event type */
|
|
1012
|
-
removeEventListener(
|
|
1037
|
+
removeEventListener(
|
|
1038
|
+
eventType: string,
|
|
1039
|
+
callback: () => unknown,
|
|
1040
|
+
options?: EventListenerOptions | undefined | null,
|
|
1041
|
+
): void
|
|
1013
1042
|
/** Dispatch an event to all registered listeners */
|
|
1014
1043
|
dispatchEvent(eventType: string): boolean
|
|
1015
1044
|
/**
|
|
@@ -1218,9 +1247,9 @@ export declare class WebMMuxer {
|
|
|
1218
1247
|
|
|
1219
1248
|
/** AAC bitstream format (W3C WebCodecs AAC Registration) */
|
|
1220
1249
|
export type AacBitstreamFormat = /** Raw AAC frames - metadata in description */
|
|
1221
|
-
'aac'
|
|
1250
|
+
| 'aac'
|
|
1222
1251
|
/** ADTS frames - metadata in each frame */
|
|
1223
|
-
'adts'
|
|
1252
|
+
| 'adts'
|
|
1224
1253
|
|
|
1225
1254
|
/** AAC encoder configuration (W3C WebCodecs AAC Registration) */
|
|
1226
1255
|
export interface AacEncoderConfig {
|
|
@@ -1240,9 +1269,9 @@ export interface AddEventListenerOptions {
|
|
|
1240
1269
|
* Default is "discard" per spec
|
|
1241
1270
|
*/
|
|
1242
1271
|
export type AlphaOption = /** Keep alpha channel if present */
|
|
1243
|
-
'keep'
|
|
1272
|
+
| 'keep'
|
|
1244
1273
|
/** Discard alpha channel (default per W3C spec) */
|
|
1245
|
-
'discard'
|
|
1274
|
+
| 'discard'
|
|
1246
1275
|
|
|
1247
1276
|
/** Options for copyTo operation */
|
|
1248
1277
|
export interface AudioDataCopyToOptions {
|
|
@@ -1308,9 +1337,7 @@ export interface AudioEncoderAddEventListenerOptions {
|
|
|
1308
1337
|
}
|
|
1309
1338
|
|
|
1310
1339
|
/** Encode options for audio */
|
|
1311
|
-
export interface AudioEncoderEncodeOptions {
|
|
1312
|
-
|
|
1313
|
-
}
|
|
1340
|
+
export interface AudioEncoderEncodeOptions {}
|
|
1314
1341
|
|
|
1315
1342
|
/** Options for removeEventListener (W3C DOM spec) */
|
|
1316
1343
|
export interface AudioEncoderEventListenerOptions {
|
|
@@ -1327,27 +1354,27 @@ export interface AudioEncoderSupport {
|
|
|
1327
1354
|
|
|
1328
1355
|
/** Audio sample format (WebCodecs spec) */
|
|
1329
1356
|
export type AudioSampleFormat = /** Unsigned 8-bit integer samples| interleaved */
|
|
1330
|
-
'u8'
|
|
1357
|
+
| 'u8'
|
|
1331
1358
|
/** Signed 16-bit integer samples| interleaved */
|
|
1332
|
-
's16'
|
|
1359
|
+
| 's16'
|
|
1333
1360
|
/** Signed 32-bit integer samples| interleaved */
|
|
1334
|
-
's32'
|
|
1361
|
+
| 's32'
|
|
1335
1362
|
/** 32-bit float samples| interleaved */
|
|
1336
|
-
'f32'
|
|
1363
|
+
| 'f32'
|
|
1337
1364
|
/** Unsigned 8-bit integer samples| planar */
|
|
1338
|
-
'u8-planar'
|
|
1365
|
+
| 'u8-planar'
|
|
1339
1366
|
/** Signed 16-bit integer samples| planar */
|
|
1340
|
-
's16-planar'
|
|
1367
|
+
| 's16-planar'
|
|
1341
1368
|
/** Signed 32-bit integer samples| planar */
|
|
1342
|
-
's32-planar'
|
|
1369
|
+
| 's32-planar'
|
|
1343
1370
|
/** 32-bit float samples| planar */
|
|
1344
|
-
'f32-planar'
|
|
1371
|
+
| 'f32-planar'
|
|
1345
1372
|
|
|
1346
1373
|
/** AVC (H.264) bitstream format (W3C WebCodecs AVC Registration) */
|
|
1347
1374
|
export type AvcBitstreamFormat = /** AVC format with parameter sets in description (ISO 14496-15) */
|
|
1348
|
-
'avc'
|
|
1375
|
+
| 'avc'
|
|
1349
1376
|
/** Annex B format with parameter sets in bitstream */
|
|
1350
|
-
'annexb'
|
|
1377
|
+
| 'annexb'
|
|
1351
1378
|
|
|
1352
1379
|
/** AVC (H.264) encoder configuration (W3C WebCodecs AVC Registration) */
|
|
1353
1380
|
export interface AvcEncoderConfig {
|
|
@@ -1357,23 +1384,23 @@ export interface AvcEncoderConfig {
|
|
|
1357
1384
|
|
|
1358
1385
|
/** Bitrate mode for audio encoding (W3C WebCodecs spec) */
|
|
1359
1386
|
export type BitrateMode = /** Variable bitrate (default) */
|
|
1360
|
-
'variable'
|
|
1387
|
+
| 'variable'
|
|
1361
1388
|
/** Constant bitrate */
|
|
1362
|
-
'constant'
|
|
1389
|
+
| 'constant'
|
|
1363
1390
|
|
|
1364
1391
|
/** Encoder state per WebCodecs spec */
|
|
1365
1392
|
export type CodecState = /** Encoder not configured */
|
|
1366
|
-
'unconfigured'
|
|
1393
|
+
| 'unconfigured'
|
|
1367
1394
|
/** Encoder configured and ready */
|
|
1368
|
-
'configured'
|
|
1395
|
+
| 'configured'
|
|
1369
1396
|
/** Encoder closed */
|
|
1370
|
-
'closed'
|
|
1397
|
+
| 'closed'
|
|
1371
1398
|
|
|
1372
1399
|
/** ColorSpaceConversion for ImageDecoder (W3C WebCodecs spec) */
|
|
1373
1400
|
export type ColorSpaceConversion = /** Apply default color space conversion (spec default) */
|
|
1374
|
-
'default'
|
|
1401
|
+
| 'default'
|
|
1375
1402
|
/** No color space conversion */
|
|
1376
|
-
'none'
|
|
1403
|
+
| 'none'
|
|
1377
1404
|
|
|
1378
1405
|
/** Audio decoder configuration exposed to JavaScript */
|
|
1379
1406
|
export interface DemuxerAudioDecoderConfig {
|
|
@@ -1441,9 +1468,9 @@ export interface EncodedAudioChunkMetadataJs {
|
|
|
1441
1468
|
|
|
1442
1469
|
/** Type of encoded audio chunk */
|
|
1443
1470
|
export type EncodedAudioChunkType = /** Key chunk - can be decoded independently */
|
|
1444
|
-
'key'
|
|
1471
|
+
| 'key'
|
|
1445
1472
|
/** Delta chunk - depends on previous chunks */
|
|
1446
|
-
'delta'
|
|
1473
|
+
| 'delta'
|
|
1447
1474
|
|
|
1448
1475
|
/** Output callback metadata per WebCodecs spec */
|
|
1449
1476
|
export interface EncodedVideoChunkMetadata {
|
|
@@ -1471,9 +1498,9 @@ export interface EncodedVideoChunkMetadataJs {
|
|
|
1471
1498
|
|
|
1472
1499
|
/** Type of encoded video chunk */
|
|
1473
1500
|
export type EncodedVideoChunkType = /** Keyframe - can be decoded independently */
|
|
1474
|
-
'key'
|
|
1501
|
+
| 'key'
|
|
1475
1502
|
/** Delta frame - depends on previous frames */
|
|
1476
|
-
'delta'
|
|
1503
|
+
| 'delta'
|
|
1477
1504
|
|
|
1478
1505
|
/** Options for removeEventListener (W3C DOM spec) */
|
|
1479
1506
|
export interface EventListenerOptions {
|
|
@@ -1499,11 +1526,11 @@ export declare function getPreferredHardwareAccelerator(): string | null
|
|
|
1499
1526
|
|
|
1500
1527
|
/** Hardware acceleration preference (W3C WebCodecs spec) */
|
|
1501
1528
|
export type HardwareAcceleration = /** No preference - may use hardware or software */
|
|
1502
|
-
'no-preference'
|
|
1529
|
+
| 'no-preference'
|
|
1503
1530
|
/** Prefer hardware acceleration */
|
|
1504
|
-
'prefer-hardware'
|
|
1531
|
+
| 'prefer-hardware'
|
|
1505
1532
|
/** Prefer software implementation */
|
|
1506
|
-
'prefer-software'
|
|
1533
|
+
| 'prefer-software'
|
|
1507
1534
|
|
|
1508
1535
|
/** Hardware accelerator information */
|
|
1509
1536
|
export interface HardwareAccelerator {
|
|
@@ -1517,9 +1544,9 @@ export interface HardwareAccelerator {
|
|
|
1517
1544
|
|
|
1518
1545
|
/** HEVC (H.265) bitstream format (W3C WebCodecs HEVC Registration) */
|
|
1519
1546
|
export type HevcBitstreamFormat = /** HEVC format with parameter sets in description (ISO 14496-15) */
|
|
1520
|
-
'hevc'
|
|
1547
|
+
| 'hevc'
|
|
1521
1548
|
/** Annex B format with parameter sets in bitstream */
|
|
1522
|
-
'annexb'
|
|
1549
|
+
| 'annexb'
|
|
1523
1550
|
|
|
1524
1551
|
/** HEVC (H.265) encoder configuration (W3C WebCodecs HEVC Registration) */
|
|
1525
1552
|
export interface HevcEncoderConfig {
|
|
@@ -1540,9 +1567,9 @@ export declare function isHardwareAcceleratorAvailable(name: string): boolean
|
|
|
1540
1567
|
|
|
1541
1568
|
/** Latency mode for video encoding (W3C WebCodecs spec) */
|
|
1542
1569
|
export type LatencyMode = /** Optimize for quality (default) */
|
|
1543
|
-
'quality'
|
|
1570
|
+
| 'quality'
|
|
1544
1571
|
/** Optimize for low latency */
|
|
1545
|
-
'realtime'
|
|
1572
|
+
| 'realtime'
|
|
1546
1573
|
|
|
1547
1574
|
/** Audio track configuration for MKV muxer */
|
|
1548
1575
|
export interface MkvAudioTrackConfig {
|
|
@@ -1622,17 +1649,17 @@ export interface Mp4VideoTrackConfig {
|
|
|
1622
1649
|
|
|
1623
1650
|
/** Opus application mode (W3C WebCodecs Opus Registration) */
|
|
1624
1651
|
export type OpusApplication = /** Optimize for VoIP (speech intelligibility) */
|
|
1625
|
-
'voip'
|
|
1652
|
+
| 'voip'
|
|
1626
1653
|
/** Optimize for audio fidelity (default) */
|
|
1627
|
-
'audio'
|
|
1654
|
+
| 'audio'
|
|
1628
1655
|
/** Minimize coding delay */
|
|
1629
|
-
'lowdelay'
|
|
1656
|
+
| 'lowdelay'
|
|
1630
1657
|
|
|
1631
1658
|
/** Opus bitstream format (W3C WebCodecs Opus Registration) */
|
|
1632
1659
|
export type OpusBitstreamFormat = /** Opus packets (RFC 6716) - no metadata needed for decoding */
|
|
1633
|
-
'opus'
|
|
1660
|
+
| 'opus'
|
|
1634
1661
|
/** Ogg encapsulation (RFC 7845) - metadata in description */
|
|
1635
|
-
'ogg'
|
|
1662
|
+
| 'ogg'
|
|
1636
1663
|
|
|
1637
1664
|
/** Opus encoder configuration (W3C WebCodecs Opus Registration) */
|
|
1638
1665
|
export interface OpusEncoderConfig {
|
|
@@ -1659,11 +1686,11 @@ export interface OpusEncoderConfig {
|
|
|
1659
1686
|
|
|
1660
1687
|
/** Opus signal type hint (W3C WebCodecs Opus Registration) */
|
|
1661
1688
|
export type OpusSignal = /** Auto-detect signal type */
|
|
1662
|
-
'auto'
|
|
1689
|
+
| 'auto'
|
|
1663
1690
|
/** Music signal */
|
|
1664
|
-
'music'
|
|
1691
|
+
| 'music'
|
|
1665
1692
|
/** Voice/speech signal */
|
|
1666
|
-
'voice'
|
|
1693
|
+
| 'voice'
|
|
1667
1694
|
|
|
1668
1695
|
/** Layout information for a single plane per WebCodecs spec */
|
|
1669
1696
|
export interface PlaneLayout {
|
|
@@ -1686,7 +1713,10 @@ export declare function resetHardwareFallbackState(): void
|
|
|
1686
1713
|
|
|
1687
1714
|
/** Streaming mode options for muxers */
|
|
1688
1715
|
export interface StreamingMuxerOptions {
|
|
1689
|
-
/**
|
|
1716
|
+
/**
|
|
1717
|
+
* Maximum bytes returned by each streaming read (default: 256KB).
|
|
1718
|
+
* Muxer writes are queued without blocking the JavaScript consumer.
|
|
1719
|
+
*/
|
|
1690
1720
|
bufferCapacity?: number
|
|
1691
1721
|
}
|
|
1692
1722
|
|
|
@@ -1704,15 +1734,15 @@ export interface SvcOutputMetadataJs {
|
|
|
1704
1734
|
|
|
1705
1735
|
/** Video color primaries (W3C WebCodecs spec) */
|
|
1706
1736
|
export type VideoColorPrimaries = /** BT.709 / sRGB primaries */
|
|
1707
|
-
'bt709'
|
|
1737
|
+
| 'bt709'
|
|
1708
1738
|
/** BT.470 BG (PAL) */
|
|
1709
|
-
'bt470bg'
|
|
1739
|
+
| 'bt470bg'
|
|
1710
1740
|
/** SMPTE 170M (NTSC) */
|
|
1711
|
-
'smpte170m'
|
|
1741
|
+
| 'smpte170m'
|
|
1712
1742
|
/** BT.2020 (UHD) */
|
|
1713
|
-
'bt2020'
|
|
1743
|
+
| 'bt2020'
|
|
1714
1744
|
/** SMPTE 432 (DCI-P3) */
|
|
1715
|
-
'smpte432'
|
|
1745
|
+
| 'smpte432'
|
|
1716
1746
|
|
|
1717
1747
|
/** Options for addEventListener (W3C DOM spec) */
|
|
1718
1748
|
export interface VideoDecoderAddEventListenerOptions {
|
|
@@ -1770,11 +1800,11 @@ export interface VideoDecoderSupport {
|
|
|
1770
1800
|
|
|
1771
1801
|
/** Bitrate mode for video encoding (W3C WebCodecs spec) */
|
|
1772
1802
|
export type VideoEncoderBitrateMode = /** Variable bitrate (default) */
|
|
1773
|
-
'variable'
|
|
1803
|
+
| 'variable'
|
|
1774
1804
|
/** Constant bitrate */
|
|
1775
|
-
'constant'
|
|
1805
|
+
| 'constant'
|
|
1776
1806
|
/** Use quantizer parameter from codec-specific options */
|
|
1777
|
-
'quantizer'
|
|
1807
|
+
| 'quantizer'
|
|
1778
1808
|
|
|
1779
1809
|
/** Encode options per WebCodecs spec */
|
|
1780
1810
|
export interface VideoEncoderEncodeOptions {
|
|
@@ -1858,9 +1888,7 @@ export interface VideoFrameInit {
|
|
|
1858
1888
|
* VideoFrameMetadata - metadata associated with a VideoFrame (W3C spec)
|
|
1859
1889
|
* Members defined in VideoFrame Metadata Registry - currently empty per spec
|
|
1860
1890
|
*/
|
|
1861
|
-
export interface VideoFrameMetadata {
|
|
1862
|
-
|
|
1863
|
-
}
|
|
1891
|
+
export interface VideoFrameMetadata {}
|
|
1864
1892
|
|
|
1865
1893
|
/** Rectangle for specifying a region */
|
|
1866
1894
|
export interface VideoFrameRect {
|
|
@@ -1872,75 +1900,75 @@ export interface VideoFrameRect {
|
|
|
1872
1900
|
|
|
1873
1901
|
/** Video matrix coefficients (W3C WebCodecs spec) */
|
|
1874
1902
|
export type VideoMatrixCoefficients = /** RGB (identity matrix) */
|
|
1875
|
-
'rgb'
|
|
1903
|
+
| 'rgb'
|
|
1876
1904
|
/** BT.709 */
|
|
1877
|
-
'bt709'
|
|
1905
|
+
| 'bt709'
|
|
1878
1906
|
/** BT.470 BG */
|
|
1879
|
-
'bt470bg'
|
|
1907
|
+
| 'bt470bg'
|
|
1880
1908
|
/** SMPTE 170M */
|
|
1881
|
-
'smpte170m'
|
|
1909
|
+
| 'smpte170m'
|
|
1882
1910
|
/** BT.2020 non-constant luminance */
|
|
1883
|
-
'bt2020-ncl'
|
|
1911
|
+
| 'bt2020-ncl'
|
|
1884
1912
|
|
|
1885
1913
|
/** Video pixel format (WebCodecs spec) */
|
|
1886
1914
|
export type VideoPixelFormat = /** Planar YUV 4:2:0| 12bpp| (1 Cr & Cb sample per 2x2 Y samples) */
|
|
1887
|
-
'I420'
|
|
1915
|
+
| 'I420'
|
|
1888
1916
|
/** Planar YUV 4:2:0| 12bpp| with alpha plane */
|
|
1889
|
-
'I420A'
|
|
1917
|
+
| 'I420A'
|
|
1890
1918
|
/** Planar YUV 4:2:2| 16bpp */
|
|
1891
|
-
'I422'
|
|
1919
|
+
| 'I422'
|
|
1892
1920
|
/** Planar YUV 4:2:2| 16bpp| with alpha plane */
|
|
1893
|
-
'I422A'
|
|
1921
|
+
| 'I422A'
|
|
1894
1922
|
/** Planar YUV 4:4:4| 24bpp */
|
|
1895
|
-
'I444'
|
|
1923
|
+
| 'I444'
|
|
1896
1924
|
/** Planar YUV 4:4:4| 24bpp| with alpha plane */
|
|
1897
|
-
'I444A'
|
|
1925
|
+
| 'I444A'
|
|
1898
1926
|
/** Planar YUV 4:2:0| 10-bit */
|
|
1899
|
-
'I420P10'
|
|
1927
|
+
| 'I420P10'
|
|
1900
1928
|
/** Planar YUV 4:2:0| 10-bit| with alpha plane */
|
|
1901
|
-
'I420AP10'
|
|
1929
|
+
| 'I420AP10'
|
|
1902
1930
|
/** Planar YUV 4:2:2| 10-bit */
|
|
1903
|
-
'I422P10'
|
|
1931
|
+
| 'I422P10'
|
|
1904
1932
|
/** Planar YUV 4:2:2| 10-bit| with alpha plane */
|
|
1905
|
-
'I422AP10'
|
|
1933
|
+
| 'I422AP10'
|
|
1906
1934
|
/** Planar YUV 4:4:4| 10-bit */
|
|
1907
|
-
'I444P10'
|
|
1935
|
+
| 'I444P10'
|
|
1908
1936
|
/** Planar YUV 4:4:4| 10-bit| with alpha plane */
|
|
1909
|
-
'I444AP10'
|
|
1937
|
+
| 'I444AP10'
|
|
1910
1938
|
/** Planar YUV 4:2:0| 12-bit */
|
|
1911
|
-
'I420P12'
|
|
1939
|
+
| 'I420P12'
|
|
1912
1940
|
/** Planar YUV 4:2:2| 12-bit */
|
|
1913
|
-
'I422P12'
|
|
1941
|
+
| 'I422P12'
|
|
1914
1942
|
/** Planar YUV 4:4:4| 12-bit */
|
|
1915
|
-
'I444P12'
|
|
1943
|
+
| 'I444P12'
|
|
1916
1944
|
/** Semi-planar YUV 4:2:0| 12bpp (Y plane + interleaved UV) */
|
|
1917
|
-
'NV12'
|
|
1945
|
+
| 'NV12'
|
|
1918
1946
|
/** Semi-planar YUV 4:2:0| 12bpp (Y plane + interleaved VU) - per W3C WebCodecs spec */
|
|
1919
|
-
'NV21'
|
|
1947
|
+
| 'NV21'
|
|
1920
1948
|
/** RGBA 32bpp */
|
|
1921
|
-
'RGBA'
|
|
1949
|
+
| 'RGBA'
|
|
1922
1950
|
/** RGBX 32bpp (alpha ignored) */
|
|
1923
|
-
'RGBX'
|
|
1951
|
+
| 'RGBX'
|
|
1924
1952
|
/** BGRA 32bpp */
|
|
1925
|
-
'BGRA'
|
|
1953
|
+
| 'BGRA'
|
|
1926
1954
|
/** BGRX 32bpp (alpha ignored) */
|
|
1927
|
-
'BGRX'
|
|
1955
|
+
| 'BGRX'
|
|
1928
1956
|
|
|
1929
1957
|
/** Video transfer characteristics (W3C WebCodecs spec) */
|
|
1930
1958
|
export type VideoTransferCharacteristics = /** BT.709 transfer */
|
|
1931
|
-
'bt709'
|
|
1959
|
+
| 'bt709'
|
|
1932
1960
|
/** SMPTE 170M transfer */
|
|
1933
|
-
'smpte170m'
|
|
1961
|
+
| 'smpte170m'
|
|
1934
1962
|
/** IEC 61966-2-1 (sRGB) - technical name */
|
|
1935
|
-
'iec61966-2-1'
|
|
1963
|
+
| 'iec61966-2-1'
|
|
1936
1964
|
/** sRGB transfer (alias for iec61966-2-1) */
|
|
1937
|
-
'srgb'
|
|
1965
|
+
| 'srgb'
|
|
1938
1966
|
/** Linear transfer */
|
|
1939
|
-
'linear'
|
|
1967
|
+
| 'linear'
|
|
1940
1968
|
/** Perceptual Quantizer (HDR) */
|
|
1941
|
-
'pq'
|
|
1969
|
+
| 'pq'
|
|
1942
1970
|
/** Hybrid Log-Gamma (HDR) */
|
|
1943
|
-
'hlg'
|
|
1971
|
+
| 'hlg'
|
|
1944
1972
|
|
|
1945
1973
|
/** Audio track configuration for WebM muxer */
|
|
1946
1974
|
export interface WebMAudioTrackConfig {
|