@napi-rs/webcodecs 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +212 -162
- package/index.js +235 -76
- package/package.json +22 -30
package/index.d.ts
CHANGED
|
@@ -191,7 +191,18 @@ export interface MkvDemuxer {
|
|
|
191
191
|
[Symbol.asyncIterator](): AsyncGenerator<DemuxerChunk, void, void>
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
export type TypedArray =
|
|
194
|
+
export type TypedArray =
|
|
195
|
+
| Int8Array
|
|
196
|
+
| Uint8Array
|
|
197
|
+
| Uint8ClampedArray
|
|
198
|
+
| Int16Array
|
|
199
|
+
| Uint16Array
|
|
200
|
+
| Int32Array
|
|
201
|
+
| Uint32Array
|
|
202
|
+
| Float32Array
|
|
203
|
+
| Float64Array
|
|
204
|
+
| BigInt64Array
|
|
205
|
+
| BigUint64Array
|
|
195
206
|
/**
|
|
196
207
|
* AudioData - represents uncompressed audio data
|
|
197
208
|
*
|
|
@@ -285,7 +296,7 @@ export declare class AudioDecoder {
|
|
|
285
296
|
*
|
|
286
297
|
* @param init - Init dictionary containing output and error callbacks
|
|
287
298
|
*/
|
|
288
|
-
constructor(init: { output: (data: AudioData) => void
|
|
299
|
+
constructor(init: { output: (data: AudioData) => void; error: (error: Error) => void })
|
|
289
300
|
/** Get decoder state */
|
|
290
301
|
get state(): CodecState
|
|
291
302
|
/** Get number of pending decode operations (per WebCodecs spec) */
|
|
@@ -325,9 +336,17 @@ export declare class AudioDecoder {
|
|
|
325
336
|
*/
|
|
326
337
|
static isConfigSupported(config: AudioDecoderConfig): Promise<AudioDecoderSupport>
|
|
327
338
|
/** Add an event listener for the specified event type */
|
|
328
|
-
addEventListener(
|
|
339
|
+
addEventListener(
|
|
340
|
+
eventType: string,
|
|
341
|
+
callback: () => unknown,
|
|
342
|
+
options?: AudioDecoderAddEventListenerOptions | undefined | null,
|
|
343
|
+
): void
|
|
329
344
|
/** Remove an event listener for the specified event type */
|
|
330
|
-
removeEventListener(
|
|
345
|
+
removeEventListener(
|
|
346
|
+
eventType: string,
|
|
347
|
+
callback: () => unknown,
|
|
348
|
+
options?: AudioDecoderEventListenerOptions | undefined | null,
|
|
349
|
+
): void
|
|
331
350
|
/** Dispatch an event to all registered listeners */
|
|
332
351
|
dispatchEvent(eventType: string): boolean
|
|
333
352
|
}
|
|
@@ -362,7 +381,10 @@ export declare class AudioEncoder {
|
|
|
362
381
|
*
|
|
363
382
|
* @param init - Init dictionary containing output and error callbacks
|
|
364
383
|
*/
|
|
365
|
-
constructor(init: {
|
|
384
|
+
constructor(init: {
|
|
385
|
+
output: (chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadata) => void
|
|
386
|
+
error: (error: Error) => void
|
|
387
|
+
})
|
|
366
388
|
/** Get encoder state */
|
|
367
389
|
get state(): CodecState
|
|
368
390
|
/** Get number of pending encode operations (per WebCodecs spec) */
|
|
@@ -405,9 +427,17 @@ export declare class AudioEncoder {
|
|
|
405
427
|
* Add an event listener for the specified event type
|
|
406
428
|
* Uses separate RwLock to avoid blocking on encode operations
|
|
407
429
|
*/
|
|
408
|
-
addEventListener(
|
|
430
|
+
addEventListener(
|
|
431
|
+
eventType: string,
|
|
432
|
+
callback: () => unknown,
|
|
433
|
+
options?: AudioEncoderAddEventListenerOptions | undefined | null,
|
|
434
|
+
): void
|
|
409
435
|
/** Remove an event listener for the specified event type */
|
|
410
|
-
removeEventListener(
|
|
436
|
+
removeEventListener(
|
|
437
|
+
eventType: string,
|
|
438
|
+
callback: () => unknown,
|
|
439
|
+
options?: AudioEncoderEventListenerOptions | undefined | null,
|
|
440
|
+
): void
|
|
411
441
|
/** Dispatch an event to all registered listeners */
|
|
412
442
|
dispatchEvent(eventType: string): boolean
|
|
413
443
|
}
|
|
@@ -418,7 +448,12 @@ export declare class AudioEncoder {
|
|
|
418
448
|
*/
|
|
419
449
|
export declare class DOMRectReadOnly {
|
|
420
450
|
/** Create a new DOMRectReadOnly */
|
|
421
|
-
constructor(
|
|
451
|
+
constructor(
|
|
452
|
+
x?: number | undefined | null,
|
|
453
|
+
y?: number | undefined | null,
|
|
454
|
+
width?: number | undefined | null,
|
|
455
|
+
height?: number | undefined | null,
|
|
456
|
+
)
|
|
422
457
|
/** X coordinate */
|
|
423
458
|
get x(): number
|
|
424
459
|
/** Y coordinate */
|
|
@@ -884,7 +919,7 @@ export declare class VideoDecoder {
|
|
|
884
919
|
*
|
|
885
920
|
* @param init - Init dictionary containing output and error callbacks
|
|
886
921
|
*/
|
|
887
|
-
constructor(init: { output: (frame: VideoFrame) => void
|
|
922
|
+
constructor(init: { output: (frame: VideoFrame) => void; error: (error: Error) => void })
|
|
888
923
|
/** Get decoder state */
|
|
889
924
|
get state(): CodecState
|
|
890
925
|
/** Get number of pending decode operations (per WebCodecs spec) */
|
|
@@ -934,9 +969,17 @@ export declare class VideoDecoder {
|
|
|
934
969
|
* Add an event listener for the specified event type
|
|
935
970
|
* Uses separate RwLock to avoid blocking on decode operations
|
|
936
971
|
*/
|
|
937
|
-
addEventListener(
|
|
972
|
+
addEventListener(
|
|
973
|
+
eventType: string,
|
|
974
|
+
callback: () => unknown,
|
|
975
|
+
options?: VideoDecoderAddEventListenerOptions | undefined | null,
|
|
976
|
+
): void
|
|
938
977
|
/** Remove an event listener for the specified event type */
|
|
939
|
-
removeEventListener(
|
|
978
|
+
removeEventListener(
|
|
979
|
+
eventType: string,
|
|
980
|
+
callback: () => unknown,
|
|
981
|
+
options?: VideoDecoderEventListenerOptions | undefined | null,
|
|
982
|
+
): void
|
|
940
983
|
/** Dispatch an event to all registered listeners */
|
|
941
984
|
dispatchEvent(eventType: string): boolean
|
|
942
985
|
}
|
|
@@ -972,7 +1015,10 @@ export declare class VideoEncoder {
|
|
|
972
1015
|
*
|
|
973
1016
|
* @param init - Init dictionary containing output and error callbacks
|
|
974
1017
|
*/
|
|
975
|
-
constructor(init: {
|
|
1018
|
+
constructor(init: {
|
|
1019
|
+
output: (chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadata) => void
|
|
1020
|
+
error: (error: Error) => void
|
|
1021
|
+
})
|
|
976
1022
|
/** Get encoder state */
|
|
977
1023
|
get state(): CodecState
|
|
978
1024
|
/** Get number of pending encode operations (per WebCodecs spec) */
|
|
@@ -1007,9 +1053,17 @@ export declare class VideoEncoder {
|
|
|
1007
1053
|
* Add an event listener for the specified event type
|
|
1008
1054
|
* Uses separate RwLock to avoid blocking on encode operations
|
|
1009
1055
|
*/
|
|
1010
|
-
addEventListener(
|
|
1056
|
+
addEventListener(
|
|
1057
|
+
eventType: string,
|
|
1058
|
+
callback: () => unknown,
|
|
1059
|
+
options?: AddEventListenerOptions | undefined | null,
|
|
1060
|
+
): void
|
|
1011
1061
|
/** Remove an event listener for the specified event type */
|
|
1012
|
-
removeEventListener(
|
|
1062
|
+
removeEventListener(
|
|
1063
|
+
eventType: string,
|
|
1064
|
+
callback: () => unknown,
|
|
1065
|
+
options?: EventListenerOptions | undefined | null,
|
|
1066
|
+
): void
|
|
1013
1067
|
/** Dispatch an event to all registered listeners */
|
|
1014
1068
|
dispatchEvent(eventType: string): boolean
|
|
1015
1069
|
/**
|
|
@@ -1218,9 +1272,9 @@ export declare class WebMMuxer {
|
|
|
1218
1272
|
|
|
1219
1273
|
/** AAC bitstream format (W3C WebCodecs AAC Registration) */
|
|
1220
1274
|
export type AacBitstreamFormat = /** Raw AAC frames - metadata in description */
|
|
1221
|
-
'aac'
|
|
1222
|
-
/** ADTS frames - metadata in each frame */
|
|
1223
|
-
'adts'
|
|
1275
|
+
| 'aac'
|
|
1276
|
+
/** ADTS frames - metadata in each frame */
|
|
1277
|
+
| 'adts'
|
|
1224
1278
|
|
|
1225
1279
|
/** AAC encoder configuration (W3C WebCodecs AAC Registration) */
|
|
1226
1280
|
export interface AacEncoderConfig {
|
|
@@ -1240,9 +1294,9 @@ export interface AddEventListenerOptions {
|
|
|
1240
1294
|
* Default is "discard" per spec
|
|
1241
1295
|
*/
|
|
1242
1296
|
export type AlphaOption = /** Keep alpha channel if present */
|
|
1243
|
-
'keep'
|
|
1244
|
-
/** Discard alpha channel (default per W3C spec) */
|
|
1245
|
-
'discard'
|
|
1297
|
+
| 'keep'
|
|
1298
|
+
/** Discard alpha channel (default per W3C spec) */
|
|
1299
|
+
| 'discard'
|
|
1246
1300
|
|
|
1247
1301
|
/** Options for copyTo operation */
|
|
1248
1302
|
export interface AudioDataCopyToOptions {
|
|
@@ -1308,9 +1362,7 @@ export interface AudioEncoderAddEventListenerOptions {
|
|
|
1308
1362
|
}
|
|
1309
1363
|
|
|
1310
1364
|
/** Encode options for audio */
|
|
1311
|
-
export interface AudioEncoderEncodeOptions {
|
|
1312
|
-
|
|
1313
|
-
}
|
|
1365
|
+
export interface AudioEncoderEncodeOptions {}
|
|
1314
1366
|
|
|
1315
1367
|
/** Options for removeEventListener (W3C DOM spec) */
|
|
1316
1368
|
export interface AudioEncoderEventListenerOptions {
|
|
@@ -1327,27 +1379,27 @@ export interface AudioEncoderSupport {
|
|
|
1327
1379
|
|
|
1328
1380
|
/** Audio sample format (WebCodecs spec) */
|
|
1329
1381
|
export type AudioSampleFormat = /** Unsigned 8-bit integer samples| interleaved */
|
|
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'
|
|
1382
|
+
| 'u8'
|
|
1383
|
+
/** Signed 16-bit integer samples| interleaved */
|
|
1384
|
+
| 's16'
|
|
1385
|
+
/** Signed 32-bit integer samples| interleaved */
|
|
1386
|
+
| 's32'
|
|
1387
|
+
/** 32-bit float samples| interleaved */
|
|
1388
|
+
| 'f32'
|
|
1389
|
+
/** Unsigned 8-bit integer samples| planar */
|
|
1390
|
+
| 'u8-planar'
|
|
1391
|
+
/** Signed 16-bit integer samples| planar */
|
|
1392
|
+
| 's16-planar'
|
|
1393
|
+
/** Signed 32-bit integer samples| planar */
|
|
1394
|
+
| 's32-planar'
|
|
1395
|
+
/** 32-bit float samples| planar */
|
|
1396
|
+
| 'f32-planar'
|
|
1345
1397
|
|
|
1346
1398
|
/** AVC (H.264) bitstream format (W3C WebCodecs AVC Registration) */
|
|
1347
1399
|
export type AvcBitstreamFormat = /** AVC format with parameter sets in description (ISO 14496-15) */
|
|
1348
|
-
'avc'
|
|
1349
|
-
/** Annex B format with parameter sets in bitstream */
|
|
1350
|
-
'annexb'
|
|
1400
|
+
| 'avc'
|
|
1401
|
+
/** Annex B format with parameter sets in bitstream */
|
|
1402
|
+
| 'annexb'
|
|
1351
1403
|
|
|
1352
1404
|
/** AVC (H.264) encoder configuration (W3C WebCodecs AVC Registration) */
|
|
1353
1405
|
export interface AvcEncoderConfig {
|
|
@@ -1357,23 +1409,23 @@ export interface AvcEncoderConfig {
|
|
|
1357
1409
|
|
|
1358
1410
|
/** Bitrate mode for audio encoding (W3C WebCodecs spec) */
|
|
1359
1411
|
export type BitrateMode = /** Variable bitrate (default) */
|
|
1360
|
-
'variable'
|
|
1361
|
-
/** Constant bitrate */
|
|
1362
|
-
'constant'
|
|
1412
|
+
| 'variable'
|
|
1413
|
+
/** Constant bitrate */
|
|
1414
|
+
| 'constant'
|
|
1363
1415
|
|
|
1364
1416
|
/** Encoder state per WebCodecs spec */
|
|
1365
1417
|
export type CodecState = /** Encoder not configured */
|
|
1366
|
-
'unconfigured'
|
|
1367
|
-
/** Encoder configured and ready */
|
|
1368
|
-
'configured'
|
|
1369
|
-
/** Encoder closed */
|
|
1370
|
-
'closed'
|
|
1418
|
+
| 'unconfigured'
|
|
1419
|
+
/** Encoder configured and ready */
|
|
1420
|
+
| 'configured'
|
|
1421
|
+
/** Encoder closed */
|
|
1422
|
+
| 'closed'
|
|
1371
1423
|
|
|
1372
1424
|
/** ColorSpaceConversion for ImageDecoder (W3C WebCodecs spec) */
|
|
1373
1425
|
export type ColorSpaceConversion = /** Apply default color space conversion (spec default) */
|
|
1374
|
-
'default'
|
|
1375
|
-
/** No color space conversion */
|
|
1376
|
-
'none'
|
|
1426
|
+
| 'default'
|
|
1427
|
+
/** No color space conversion */
|
|
1428
|
+
| 'none'
|
|
1377
1429
|
|
|
1378
1430
|
/** Audio decoder configuration exposed to JavaScript */
|
|
1379
1431
|
export interface DemuxerAudioDecoderConfig {
|
|
@@ -1441,9 +1493,9 @@ export interface EncodedAudioChunkMetadataJs {
|
|
|
1441
1493
|
|
|
1442
1494
|
/** Type of encoded audio chunk */
|
|
1443
1495
|
export type EncodedAudioChunkType = /** Key chunk - can be decoded independently */
|
|
1444
|
-
'key'
|
|
1445
|
-
/** Delta chunk - depends on previous chunks */
|
|
1446
|
-
'delta'
|
|
1496
|
+
| 'key'
|
|
1497
|
+
/** Delta chunk - depends on previous chunks */
|
|
1498
|
+
| 'delta'
|
|
1447
1499
|
|
|
1448
1500
|
/** Output callback metadata per WebCodecs spec */
|
|
1449
1501
|
export interface EncodedVideoChunkMetadata {
|
|
@@ -1471,9 +1523,9 @@ export interface EncodedVideoChunkMetadataJs {
|
|
|
1471
1523
|
|
|
1472
1524
|
/** Type of encoded video chunk */
|
|
1473
1525
|
export type EncodedVideoChunkType = /** Keyframe - can be decoded independently */
|
|
1474
|
-
'key'
|
|
1475
|
-
/** Delta frame - depends on previous frames */
|
|
1476
|
-
'delta'
|
|
1526
|
+
| 'key'
|
|
1527
|
+
/** Delta frame - depends on previous frames */
|
|
1528
|
+
| 'delta'
|
|
1477
1529
|
|
|
1478
1530
|
/** Options for removeEventListener (W3C DOM spec) */
|
|
1479
1531
|
export interface EventListenerOptions {
|
|
@@ -1499,11 +1551,11 @@ export declare function getPreferredHardwareAccelerator(): string | null
|
|
|
1499
1551
|
|
|
1500
1552
|
/** Hardware acceleration preference (W3C WebCodecs spec) */
|
|
1501
1553
|
export type HardwareAcceleration = /** No preference - may use hardware or software */
|
|
1502
|
-
'no-preference'
|
|
1503
|
-
/** Prefer hardware acceleration */
|
|
1504
|
-
'prefer-hardware'
|
|
1505
|
-
/** Prefer software implementation */
|
|
1506
|
-
'prefer-software'
|
|
1554
|
+
| 'no-preference'
|
|
1555
|
+
/** Prefer hardware acceleration */
|
|
1556
|
+
| 'prefer-hardware'
|
|
1557
|
+
/** Prefer software implementation */
|
|
1558
|
+
| 'prefer-software'
|
|
1507
1559
|
|
|
1508
1560
|
/** Hardware accelerator information */
|
|
1509
1561
|
export interface HardwareAccelerator {
|
|
@@ -1517,9 +1569,9 @@ export interface HardwareAccelerator {
|
|
|
1517
1569
|
|
|
1518
1570
|
/** HEVC (H.265) bitstream format (W3C WebCodecs HEVC Registration) */
|
|
1519
1571
|
export type HevcBitstreamFormat = /** HEVC format with parameter sets in description (ISO 14496-15) */
|
|
1520
|
-
'hevc'
|
|
1521
|
-
/** Annex B format with parameter sets in bitstream */
|
|
1522
|
-
'annexb'
|
|
1572
|
+
| 'hevc'
|
|
1573
|
+
/** Annex B format with parameter sets in bitstream */
|
|
1574
|
+
| 'annexb'
|
|
1523
1575
|
|
|
1524
1576
|
/** HEVC (H.265) encoder configuration (W3C WebCodecs HEVC Registration) */
|
|
1525
1577
|
export interface HevcEncoderConfig {
|
|
@@ -1540,9 +1592,9 @@ export declare function isHardwareAcceleratorAvailable(name: string): boolean
|
|
|
1540
1592
|
|
|
1541
1593
|
/** Latency mode for video encoding (W3C WebCodecs spec) */
|
|
1542
1594
|
export type LatencyMode = /** Optimize for quality (default) */
|
|
1543
|
-
'quality'
|
|
1544
|
-
/** Optimize for low latency */
|
|
1545
|
-
'realtime'
|
|
1595
|
+
| 'quality'
|
|
1596
|
+
/** Optimize for low latency */
|
|
1597
|
+
| 'realtime'
|
|
1546
1598
|
|
|
1547
1599
|
/** Audio track configuration for MKV muxer */
|
|
1548
1600
|
export interface MkvAudioTrackConfig {
|
|
@@ -1622,17 +1674,17 @@ export interface Mp4VideoTrackConfig {
|
|
|
1622
1674
|
|
|
1623
1675
|
/** Opus application mode (W3C WebCodecs Opus Registration) */
|
|
1624
1676
|
export type OpusApplication = /** Optimize for VoIP (speech intelligibility) */
|
|
1625
|
-
'voip'
|
|
1626
|
-
/** Optimize for audio fidelity (default) */
|
|
1627
|
-
'audio'
|
|
1628
|
-
/** Minimize coding delay */
|
|
1629
|
-
'lowdelay'
|
|
1677
|
+
| 'voip'
|
|
1678
|
+
/** Optimize for audio fidelity (default) */
|
|
1679
|
+
| 'audio'
|
|
1680
|
+
/** Minimize coding delay */
|
|
1681
|
+
| 'lowdelay'
|
|
1630
1682
|
|
|
1631
1683
|
/** Opus bitstream format (W3C WebCodecs Opus Registration) */
|
|
1632
1684
|
export type OpusBitstreamFormat = /** Opus packets (RFC 6716) - no metadata needed for decoding */
|
|
1633
|
-
'opus'
|
|
1634
|
-
/** Ogg encapsulation (RFC 7845) - metadata in description */
|
|
1635
|
-
'ogg'
|
|
1685
|
+
| 'opus'
|
|
1686
|
+
/** Ogg encapsulation (RFC 7845) - metadata in description */
|
|
1687
|
+
| 'ogg'
|
|
1636
1688
|
|
|
1637
1689
|
/** Opus encoder configuration (W3C WebCodecs Opus Registration) */
|
|
1638
1690
|
export interface OpusEncoderConfig {
|
|
@@ -1659,11 +1711,11 @@ export interface OpusEncoderConfig {
|
|
|
1659
1711
|
|
|
1660
1712
|
/** Opus signal type hint (W3C WebCodecs Opus Registration) */
|
|
1661
1713
|
export type OpusSignal = /** Auto-detect signal type */
|
|
1662
|
-
'auto'
|
|
1663
|
-
/** Music signal */
|
|
1664
|
-
'music'
|
|
1665
|
-
/** Voice/speech signal */
|
|
1666
|
-
'voice'
|
|
1714
|
+
| 'auto'
|
|
1715
|
+
/** Music signal */
|
|
1716
|
+
| 'music'
|
|
1717
|
+
/** Voice/speech signal */
|
|
1718
|
+
| 'voice'
|
|
1667
1719
|
|
|
1668
1720
|
/** Layout information for a single plane per WebCodecs spec */
|
|
1669
1721
|
export interface PlaneLayout {
|
|
@@ -1704,15 +1756,15 @@ export interface SvcOutputMetadataJs {
|
|
|
1704
1756
|
|
|
1705
1757
|
/** Video color primaries (W3C WebCodecs spec) */
|
|
1706
1758
|
export type VideoColorPrimaries = /** BT.709 / sRGB primaries */
|
|
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'
|
|
1759
|
+
| 'bt709'
|
|
1760
|
+
/** BT.470 BG (PAL) */
|
|
1761
|
+
| 'bt470bg'
|
|
1762
|
+
/** SMPTE 170M (NTSC) */
|
|
1763
|
+
| 'smpte170m'
|
|
1764
|
+
/** BT.2020 (UHD) */
|
|
1765
|
+
| 'bt2020'
|
|
1766
|
+
/** SMPTE 432 (DCI-P3) */
|
|
1767
|
+
| 'smpte432'
|
|
1716
1768
|
|
|
1717
1769
|
/** Options for addEventListener (W3C DOM spec) */
|
|
1718
1770
|
export interface VideoDecoderAddEventListenerOptions {
|
|
@@ -1770,11 +1822,11 @@ export interface VideoDecoderSupport {
|
|
|
1770
1822
|
|
|
1771
1823
|
/** Bitrate mode for video encoding (W3C WebCodecs spec) */
|
|
1772
1824
|
export type VideoEncoderBitrateMode = /** Variable bitrate (default) */
|
|
1773
|
-
'variable'
|
|
1774
|
-
/** Constant bitrate */
|
|
1775
|
-
'constant'
|
|
1776
|
-
/** Use quantizer parameter from codec-specific options */
|
|
1777
|
-
'quantizer'
|
|
1825
|
+
| 'variable'
|
|
1826
|
+
/** Constant bitrate */
|
|
1827
|
+
| 'constant'
|
|
1828
|
+
/** Use quantizer parameter from codec-specific options */
|
|
1829
|
+
| 'quantizer'
|
|
1778
1830
|
|
|
1779
1831
|
/** Encode options per WebCodecs spec */
|
|
1780
1832
|
export interface VideoEncoderEncodeOptions {
|
|
@@ -1858,9 +1910,7 @@ export interface VideoFrameInit {
|
|
|
1858
1910
|
* VideoFrameMetadata - metadata associated with a VideoFrame (W3C spec)
|
|
1859
1911
|
* Members defined in VideoFrame Metadata Registry - currently empty per spec
|
|
1860
1912
|
*/
|
|
1861
|
-
export interface VideoFrameMetadata {
|
|
1862
|
-
|
|
1863
|
-
}
|
|
1913
|
+
export interface VideoFrameMetadata {}
|
|
1864
1914
|
|
|
1865
1915
|
/** Rectangle for specifying a region */
|
|
1866
1916
|
export interface VideoFrameRect {
|
|
@@ -1872,75 +1922,75 @@ export interface VideoFrameRect {
|
|
|
1872
1922
|
|
|
1873
1923
|
/** Video matrix coefficients (W3C WebCodecs spec) */
|
|
1874
1924
|
export type VideoMatrixCoefficients = /** RGB (identity matrix) */
|
|
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'
|
|
1925
|
+
| 'rgb'
|
|
1926
|
+
/** BT.709 */
|
|
1927
|
+
| 'bt709'
|
|
1928
|
+
/** BT.470 BG */
|
|
1929
|
+
| 'bt470bg'
|
|
1930
|
+
/** SMPTE 170M */
|
|
1931
|
+
| 'smpte170m'
|
|
1932
|
+
/** BT.2020 non-constant luminance */
|
|
1933
|
+
| 'bt2020-ncl'
|
|
1884
1934
|
|
|
1885
1935
|
/** Video pixel format (WebCodecs spec) */
|
|
1886
1936
|
export type VideoPixelFormat = /** Planar YUV 4:2:0| 12bpp| (1 Cr & Cb sample per 2x2 Y samples) */
|
|
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'
|
|
1937
|
+
| 'I420'
|
|
1938
|
+
/** Planar YUV 4:2:0| 12bpp| with alpha plane */
|
|
1939
|
+
| 'I420A'
|
|
1940
|
+
/** Planar YUV 4:2:2| 16bpp */
|
|
1941
|
+
| 'I422'
|
|
1942
|
+
/** Planar YUV 4:2:2| 16bpp| with alpha plane */
|
|
1943
|
+
| 'I422A'
|
|
1944
|
+
/** Planar YUV 4:4:4| 24bpp */
|
|
1945
|
+
| 'I444'
|
|
1946
|
+
/** Planar YUV 4:4:4| 24bpp| with alpha plane */
|
|
1947
|
+
| 'I444A'
|
|
1948
|
+
/** Planar YUV 4:2:0| 10-bit */
|
|
1949
|
+
| 'I420P10'
|
|
1950
|
+
/** Planar YUV 4:2:0| 10-bit| with alpha plane */
|
|
1951
|
+
| 'I420AP10'
|
|
1952
|
+
/** Planar YUV 4:2:2| 10-bit */
|
|
1953
|
+
| 'I422P10'
|
|
1954
|
+
/** Planar YUV 4:2:2| 10-bit| with alpha plane */
|
|
1955
|
+
| 'I422AP10'
|
|
1956
|
+
/** Planar YUV 4:4:4| 10-bit */
|
|
1957
|
+
| 'I444P10'
|
|
1958
|
+
/** Planar YUV 4:4:4| 10-bit| with alpha plane */
|
|
1959
|
+
| 'I444AP10'
|
|
1960
|
+
/** Planar YUV 4:2:0| 12-bit */
|
|
1961
|
+
| 'I420P12'
|
|
1962
|
+
/** Planar YUV 4:2:2| 12-bit */
|
|
1963
|
+
| 'I422P12'
|
|
1964
|
+
/** Planar YUV 4:4:4| 12-bit */
|
|
1965
|
+
| 'I444P12'
|
|
1966
|
+
/** Semi-planar YUV 4:2:0| 12bpp (Y plane + interleaved UV) */
|
|
1967
|
+
| 'NV12'
|
|
1968
|
+
/** Semi-planar YUV 4:2:0| 12bpp (Y plane + interleaved VU) - per W3C WebCodecs spec */
|
|
1969
|
+
| 'NV21'
|
|
1970
|
+
/** RGBA 32bpp */
|
|
1971
|
+
| 'RGBA'
|
|
1972
|
+
/** RGBX 32bpp (alpha ignored) */
|
|
1973
|
+
| 'RGBX'
|
|
1974
|
+
/** BGRA 32bpp */
|
|
1975
|
+
| 'BGRA'
|
|
1976
|
+
/** BGRX 32bpp (alpha ignored) */
|
|
1977
|
+
| 'BGRX'
|
|
1928
1978
|
|
|
1929
1979
|
/** Video transfer characteristics (W3C WebCodecs spec) */
|
|
1930
1980
|
export type VideoTransferCharacteristics = /** BT.709 transfer */
|
|
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'
|
|
1981
|
+
| 'bt709'
|
|
1982
|
+
/** SMPTE 170M transfer */
|
|
1983
|
+
| 'smpte170m'
|
|
1984
|
+
/** IEC 61966-2-1 (sRGB) - technical name */
|
|
1985
|
+
| 'iec61966-2-1'
|
|
1986
|
+
/** sRGB transfer (alias for iec61966-2-1) */
|
|
1987
|
+
| 'srgb'
|
|
1988
|
+
/** Linear transfer */
|
|
1989
|
+
| 'linear'
|
|
1990
|
+
/** Perceptual Quantizer (HDR) */
|
|
1991
|
+
| 'pq'
|
|
1992
|
+
/** Hybrid Log-Gamma (HDR) */
|
|
1993
|
+
| 'hlg'
|
|
1944
1994
|
|
|
1945
1995
|
/** Audio track configuration for WebM muxer */
|
|
1946
1996
|
export interface WebMAudioTrackConfig {
|
package/index.js
CHANGED
|
@@ -63,7 +63,7 @@ const isMuslFromChildProcess = () => {
|
|
|
63
63
|
function requireNative() {
|
|
64
64
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
65
65
|
try {
|
|
66
|
-
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
|
|
66
|
+
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
|
|
67
67
|
} catch (err) {
|
|
68
68
|
loadErrors.push(err)
|
|
69
69
|
}
|
|
@@ -77,8 +77,14 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@napi-rs/webcodecs-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@napi-rs/webcodecs-android-arm64/package.json').version
|
|
80
|
-
if (
|
|
81
|
-
|
|
80
|
+
if (
|
|
81
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
82
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
83
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
84
|
+
) {
|
|
85
|
+
throw new Error(
|
|
86
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
87
|
+
)
|
|
82
88
|
}
|
|
83
89
|
return binding
|
|
84
90
|
} catch (e) {
|
|
@@ -93,8 +99,14 @@ function requireNative() {
|
|
|
93
99
|
try {
|
|
94
100
|
const binding = require('@napi-rs/webcodecs-android-arm-eabi')
|
|
95
101
|
const bindingPackageVersion = require('@napi-rs/webcodecs-android-arm-eabi/package.json').version
|
|
96
|
-
if (
|
|
97
|
-
|
|
102
|
+
if (
|
|
103
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
104
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
105
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
106
|
+
) {
|
|
107
|
+
throw new Error(
|
|
108
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
109
|
+
)
|
|
98
110
|
}
|
|
99
111
|
return binding
|
|
100
112
|
} catch (e) {
|
|
@@ -105,38 +117,53 @@ function requireNative() {
|
|
|
105
117
|
}
|
|
106
118
|
} else if (process.platform === 'win32') {
|
|
107
119
|
if (process.arch === 'x64') {
|
|
108
|
-
if (
|
|
120
|
+
if (
|
|
121
|
+
process.config?.variables?.shlib_suffix === 'dll.a' ||
|
|
122
|
+
process.config?.variables?.node_target_type === 'shared_library'
|
|
123
|
+
) {
|
|
109
124
|
try {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
return require('./webcodecs.win32-x64-gnu.node')
|
|
126
|
+
} catch (e) {
|
|
127
|
+
loadErrors.push(e)
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const binding = require('@napi-rs/webcodecs-win32-x64-gnu')
|
|
131
|
+
const bindingPackageVersion = require('@napi-rs/webcodecs-win32-x64-gnu/package.json').version
|
|
132
|
+
if (
|
|
133
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
134
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
135
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
136
|
+
) {
|
|
137
|
+
throw new Error(
|
|
138
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
return binding
|
|
142
|
+
} catch (e) {
|
|
143
|
+
loadErrors.push(e)
|
|
119
144
|
}
|
|
120
|
-
return binding
|
|
121
|
-
} catch (e) {
|
|
122
|
-
loadErrors.push(e)
|
|
123
|
-
}
|
|
124
145
|
} else {
|
|
125
146
|
try {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
147
|
+
return require('./webcodecs.win32-x64-msvc.node')
|
|
148
|
+
} catch (e) {
|
|
149
|
+
loadErrors.push(e)
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
const binding = require('@napi-rs/webcodecs-win32-x64-msvc')
|
|
153
|
+
const bindingPackageVersion = require('@napi-rs/webcodecs-win32-x64-msvc/package.json').version
|
|
154
|
+
if (
|
|
155
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
156
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
157
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
158
|
+
) {
|
|
159
|
+
throw new Error(
|
|
160
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
return binding
|
|
164
|
+
} catch (e) {
|
|
165
|
+
loadErrors.push(e)
|
|
135
166
|
}
|
|
136
|
-
return binding
|
|
137
|
-
} catch (e) {
|
|
138
|
-
loadErrors.push(e)
|
|
139
|
-
}
|
|
140
167
|
}
|
|
141
168
|
} else if (process.arch === 'ia32') {
|
|
142
169
|
try {
|
|
@@ -147,8 +174,14 @@ function requireNative() {
|
|
|
147
174
|
try {
|
|
148
175
|
const binding = require('@napi-rs/webcodecs-win32-ia32-msvc')
|
|
149
176
|
const bindingPackageVersion = require('@napi-rs/webcodecs-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (
|
|
151
|
-
|
|
177
|
+
if (
|
|
178
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
179
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
180
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
181
|
+
) {
|
|
182
|
+
throw new Error(
|
|
183
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
184
|
+
)
|
|
152
185
|
}
|
|
153
186
|
return binding
|
|
154
187
|
} catch (e) {
|
|
@@ -163,8 +196,14 @@ function requireNative() {
|
|
|
163
196
|
try {
|
|
164
197
|
const binding = require('@napi-rs/webcodecs-win32-arm64-msvc')
|
|
165
198
|
const bindingPackageVersion = require('@napi-rs/webcodecs-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (
|
|
167
|
-
|
|
199
|
+
if (
|
|
200
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
201
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
202
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
203
|
+
) {
|
|
204
|
+
throw new Error(
|
|
205
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
206
|
+
)
|
|
168
207
|
}
|
|
169
208
|
return binding
|
|
170
209
|
} catch (e) {
|
|
@@ -182,8 +221,14 @@ function requireNative() {
|
|
|
182
221
|
try {
|
|
183
222
|
const binding = require('@napi-rs/webcodecs-darwin-universal')
|
|
184
223
|
const bindingPackageVersion = require('@napi-rs/webcodecs-darwin-universal/package.json').version
|
|
185
|
-
if (
|
|
186
|
-
|
|
224
|
+
if (
|
|
225
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
226
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
227
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
228
|
+
) {
|
|
229
|
+
throw new Error(
|
|
230
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
231
|
+
)
|
|
187
232
|
}
|
|
188
233
|
return binding
|
|
189
234
|
} catch (e) {
|
|
@@ -198,8 +243,14 @@ function requireNative() {
|
|
|
198
243
|
try {
|
|
199
244
|
const binding = require('@napi-rs/webcodecs-darwin-x64')
|
|
200
245
|
const bindingPackageVersion = require('@napi-rs/webcodecs-darwin-x64/package.json').version
|
|
201
|
-
if (
|
|
202
|
-
|
|
246
|
+
if (
|
|
247
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
248
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
249
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
250
|
+
) {
|
|
251
|
+
throw new Error(
|
|
252
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
253
|
+
)
|
|
203
254
|
}
|
|
204
255
|
return binding
|
|
205
256
|
} catch (e) {
|
|
@@ -214,8 +265,14 @@ function requireNative() {
|
|
|
214
265
|
try {
|
|
215
266
|
const binding = require('@napi-rs/webcodecs-darwin-arm64')
|
|
216
267
|
const bindingPackageVersion = require('@napi-rs/webcodecs-darwin-arm64/package.json').version
|
|
217
|
-
if (
|
|
218
|
-
|
|
268
|
+
if (
|
|
269
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
270
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
271
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
272
|
+
) {
|
|
273
|
+
throw new Error(
|
|
274
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
275
|
+
)
|
|
219
276
|
}
|
|
220
277
|
return binding
|
|
221
278
|
} catch (e) {
|
|
@@ -234,8 +291,14 @@ function requireNative() {
|
|
|
234
291
|
try {
|
|
235
292
|
const binding = require('@napi-rs/webcodecs-freebsd-x64')
|
|
236
293
|
const bindingPackageVersion = require('@napi-rs/webcodecs-freebsd-x64/package.json').version
|
|
237
|
-
if (
|
|
238
|
-
|
|
294
|
+
if (
|
|
295
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
296
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
297
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
298
|
+
) {
|
|
299
|
+
throw new Error(
|
|
300
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
301
|
+
)
|
|
239
302
|
}
|
|
240
303
|
return binding
|
|
241
304
|
} catch (e) {
|
|
@@ -250,8 +313,14 @@ function requireNative() {
|
|
|
250
313
|
try {
|
|
251
314
|
const binding = require('@napi-rs/webcodecs-freebsd-arm64')
|
|
252
315
|
const bindingPackageVersion = require('@napi-rs/webcodecs-freebsd-arm64/package.json').version
|
|
253
|
-
if (
|
|
254
|
-
|
|
316
|
+
if (
|
|
317
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
318
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
319
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
320
|
+
) {
|
|
321
|
+
throw new Error(
|
|
322
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
323
|
+
)
|
|
255
324
|
}
|
|
256
325
|
return binding
|
|
257
326
|
} catch (e) {
|
|
@@ -271,8 +340,14 @@ function requireNative() {
|
|
|
271
340
|
try {
|
|
272
341
|
const binding = require('@napi-rs/webcodecs-linux-x64-musl')
|
|
273
342
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-x64-musl/package.json').version
|
|
274
|
-
if (
|
|
275
|
-
|
|
343
|
+
if (
|
|
344
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
345
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
346
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
347
|
+
) {
|
|
348
|
+
throw new Error(
|
|
349
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
350
|
+
)
|
|
276
351
|
}
|
|
277
352
|
return binding
|
|
278
353
|
} catch (e) {
|
|
@@ -287,8 +362,14 @@ function requireNative() {
|
|
|
287
362
|
try {
|
|
288
363
|
const binding = require('@napi-rs/webcodecs-linux-x64-gnu')
|
|
289
364
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-x64-gnu/package.json').version
|
|
290
|
-
if (
|
|
291
|
-
|
|
365
|
+
if (
|
|
366
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
367
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
368
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
369
|
+
) {
|
|
370
|
+
throw new Error(
|
|
371
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
372
|
+
)
|
|
292
373
|
}
|
|
293
374
|
return binding
|
|
294
375
|
} catch (e) {
|
|
@@ -305,8 +386,14 @@ function requireNative() {
|
|
|
305
386
|
try {
|
|
306
387
|
const binding = require('@napi-rs/webcodecs-linux-arm64-musl')
|
|
307
388
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm64-musl/package.json').version
|
|
308
|
-
if (
|
|
309
|
-
|
|
389
|
+
if (
|
|
390
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
391
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
392
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
393
|
+
) {
|
|
394
|
+
throw new Error(
|
|
395
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
396
|
+
)
|
|
310
397
|
}
|
|
311
398
|
return binding
|
|
312
399
|
} catch (e) {
|
|
@@ -321,8 +408,14 @@ function requireNative() {
|
|
|
321
408
|
try {
|
|
322
409
|
const binding = require('@napi-rs/webcodecs-linux-arm64-gnu')
|
|
323
410
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (
|
|
325
|
-
|
|
411
|
+
if (
|
|
412
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
413
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
414
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
415
|
+
) {
|
|
416
|
+
throw new Error(
|
|
417
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
418
|
+
)
|
|
326
419
|
}
|
|
327
420
|
return binding
|
|
328
421
|
} catch (e) {
|
|
@@ -339,8 +432,14 @@ function requireNative() {
|
|
|
339
432
|
try {
|
|
340
433
|
const binding = require('@napi-rs/webcodecs-linux-arm-musleabihf')
|
|
341
434
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (
|
|
343
|
-
|
|
435
|
+
if (
|
|
436
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
437
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
438
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
439
|
+
) {
|
|
440
|
+
throw new Error(
|
|
441
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
442
|
+
)
|
|
344
443
|
}
|
|
345
444
|
return binding
|
|
346
445
|
} catch (e) {
|
|
@@ -355,8 +454,14 @@ function requireNative() {
|
|
|
355
454
|
try {
|
|
356
455
|
const binding = require('@napi-rs/webcodecs-linux-arm-gnueabihf')
|
|
357
456
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (
|
|
359
|
-
|
|
457
|
+
if (
|
|
458
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
459
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
460
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
461
|
+
) {
|
|
462
|
+
throw new Error(
|
|
463
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
464
|
+
)
|
|
360
465
|
}
|
|
361
466
|
return binding
|
|
362
467
|
} catch (e) {
|
|
@@ -373,8 +478,14 @@ function requireNative() {
|
|
|
373
478
|
try {
|
|
374
479
|
const binding = require('@napi-rs/webcodecs-linux-loong64-musl')
|
|
375
480
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-loong64-musl/package.json').version
|
|
376
|
-
if (
|
|
377
|
-
|
|
481
|
+
if (
|
|
482
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
483
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
484
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
485
|
+
) {
|
|
486
|
+
throw new Error(
|
|
487
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
488
|
+
)
|
|
378
489
|
}
|
|
379
490
|
return binding
|
|
380
491
|
} catch (e) {
|
|
@@ -389,8 +500,14 @@ function requireNative() {
|
|
|
389
500
|
try {
|
|
390
501
|
const binding = require('@napi-rs/webcodecs-linux-loong64-gnu')
|
|
391
502
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (
|
|
393
|
-
|
|
503
|
+
if (
|
|
504
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
505
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
506
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
507
|
+
) {
|
|
508
|
+
throw new Error(
|
|
509
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
510
|
+
)
|
|
394
511
|
}
|
|
395
512
|
return binding
|
|
396
513
|
} catch (e) {
|
|
@@ -407,8 +524,14 @@ function requireNative() {
|
|
|
407
524
|
try {
|
|
408
525
|
const binding = require('@napi-rs/webcodecs-linux-riscv64-musl')
|
|
409
526
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (
|
|
411
|
-
|
|
527
|
+
if (
|
|
528
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
529
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
530
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
531
|
+
) {
|
|
532
|
+
throw new Error(
|
|
533
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
534
|
+
)
|
|
412
535
|
}
|
|
413
536
|
return binding
|
|
414
537
|
} catch (e) {
|
|
@@ -423,8 +546,14 @@ function requireNative() {
|
|
|
423
546
|
try {
|
|
424
547
|
const binding = require('@napi-rs/webcodecs-linux-riscv64-gnu')
|
|
425
548
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (
|
|
427
|
-
|
|
549
|
+
if (
|
|
550
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
551
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
552
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
553
|
+
) {
|
|
554
|
+
throw new Error(
|
|
555
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
556
|
+
)
|
|
428
557
|
}
|
|
429
558
|
return binding
|
|
430
559
|
} catch (e) {
|
|
@@ -440,8 +569,14 @@ function requireNative() {
|
|
|
440
569
|
try {
|
|
441
570
|
const binding = require('@napi-rs/webcodecs-linux-ppc64-gnu')
|
|
442
571
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (
|
|
444
|
-
|
|
572
|
+
if (
|
|
573
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
574
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
575
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
576
|
+
) {
|
|
577
|
+
throw new Error(
|
|
578
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
579
|
+
)
|
|
445
580
|
}
|
|
446
581
|
return binding
|
|
447
582
|
} catch (e) {
|
|
@@ -456,8 +591,14 @@ function requireNative() {
|
|
|
456
591
|
try {
|
|
457
592
|
const binding = require('@napi-rs/webcodecs-linux-s390x-gnu')
|
|
458
593
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (
|
|
460
|
-
|
|
594
|
+
if (
|
|
595
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
596
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
597
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
598
|
+
) {
|
|
599
|
+
throw new Error(
|
|
600
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
601
|
+
)
|
|
461
602
|
}
|
|
462
603
|
return binding
|
|
463
604
|
} catch (e) {
|
|
@@ -476,8 +617,14 @@ function requireNative() {
|
|
|
476
617
|
try {
|
|
477
618
|
const binding = require('@napi-rs/webcodecs-openharmony-arm64')
|
|
478
619
|
const bindingPackageVersion = require('@napi-rs/webcodecs-openharmony-arm64/package.json').version
|
|
479
|
-
if (
|
|
480
|
-
|
|
620
|
+
if (
|
|
621
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
622
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
623
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
624
|
+
) {
|
|
625
|
+
throw new Error(
|
|
626
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
627
|
+
)
|
|
481
628
|
}
|
|
482
629
|
return binding
|
|
483
630
|
} catch (e) {
|
|
@@ -492,8 +639,14 @@ function requireNative() {
|
|
|
492
639
|
try {
|
|
493
640
|
const binding = require('@napi-rs/webcodecs-openharmony-x64')
|
|
494
641
|
const bindingPackageVersion = require('@napi-rs/webcodecs-openharmony-x64/package.json').version
|
|
495
|
-
if (
|
|
496
|
-
|
|
642
|
+
if (
|
|
643
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
644
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
645
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
646
|
+
) {
|
|
647
|
+
throw new Error(
|
|
648
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
649
|
+
)
|
|
497
650
|
}
|
|
498
651
|
return binding
|
|
499
652
|
} catch (e) {
|
|
@@ -508,8 +661,14 @@ function requireNative() {
|
|
|
508
661
|
try {
|
|
509
662
|
const binding = require('@napi-rs/webcodecs-openharmony-arm')
|
|
510
663
|
const bindingPackageVersion = require('@napi-rs/webcodecs-openharmony-arm/package.json').version
|
|
511
|
-
if (
|
|
512
|
-
|
|
664
|
+
if (
|
|
665
|
+
bindingPackageVersion !== '1.3.1' &&
|
|
666
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
667
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
668
|
+
) {
|
|
669
|
+
throw new Error(
|
|
670
|
+
`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
671
|
+
)
|
|
513
672
|
}
|
|
514
673
|
return binding
|
|
515
674
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napi-rs/webcodecs",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "WebCodecs API implementation for Node.js using FFmpeg",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"N-API",
|
|
@@ -46,8 +46,7 @@
|
|
|
46
46
|
"bench": "node --import @oxc-node/core/register benchmark/compare.ts",
|
|
47
47
|
"build": "oxnode ./build.ts --platform --release",
|
|
48
48
|
"build:debug": "oxnode ./build.ts --platform",
|
|
49
|
-
"format": "run-p format:rs format:oxfmt
|
|
50
|
-
"format:prettier": "prettier . \"!**/*.{js,jsx,ts,tsx}\" -w",
|
|
49
|
+
"format": "run-p format:rs format:oxfmt",
|
|
51
50
|
"format:oxfmt": "oxfmt",
|
|
52
51
|
"format:rs": "cargo fmt",
|
|
53
52
|
"lint": "oxlint --type-aware",
|
|
@@ -55,7 +54,7 @@
|
|
|
55
54
|
"test": "ava",
|
|
56
55
|
"demo": "cd example && vite",
|
|
57
56
|
"typecheck": "tsc -b tsconfig.json && tsc ./index.d.ts",
|
|
58
|
-
"preversion": "
|
|
57
|
+
"preversion": "oxnode ./build.ts --platform && git add .",
|
|
59
58
|
"version": "napi version"
|
|
60
59
|
},
|
|
61
60
|
"lint-staged": {
|
|
@@ -64,8 +63,8 @@
|
|
|
64
63
|
]
|
|
65
64
|
},
|
|
66
65
|
"devDependencies": {
|
|
67
|
-
"@emnapi/core": "^1.
|
|
68
|
-
"@emnapi/runtime": "^1.
|
|
66
|
+
"@emnapi/core": "^1.8.1",
|
|
67
|
+
"@emnapi/runtime": "^1.8.1",
|
|
69
68
|
"@napi-rs/canvas": "^0.1.88",
|
|
70
69
|
"@napi-rs/cli": "^3.5.1",
|
|
71
70
|
"@napi-rs/wasm-runtime": "^1.1.1",
|
|
@@ -73,18 +72,18 @@
|
|
|
73
72
|
"@oxc-node/core": "^0.0.35",
|
|
74
73
|
"@taplo/cli": "^0.7.0",
|
|
75
74
|
"@tybys/wasm-util": "^0.10.1",
|
|
76
|
-
"@types/node": "^25.0.
|
|
75
|
+
"@types/node": "^25.0.10",
|
|
77
76
|
"ava": "^6.4.1",
|
|
78
77
|
"chalk": "^5.6.2",
|
|
79
|
-
"emnapi": "^1.
|
|
78
|
+
"emnapi": "^1.8.1",
|
|
80
79
|
"husky": "^9.1.7",
|
|
81
80
|
"lint-staged": "^16.2.7",
|
|
82
|
-
"mediabunny": "1.
|
|
81
|
+
"mediabunny": "1.30.1",
|
|
83
82
|
"npm-run-all2": "^8.0.4",
|
|
84
|
-
"oxfmt": "^0.
|
|
85
|
-
"oxlint": "^1.
|
|
86
|
-
"oxlint-tsgolint": "^0.
|
|
87
|
-
"prettier": "^3.
|
|
83
|
+
"oxfmt": "^0.26.0",
|
|
84
|
+
"oxlint": "^1.41.0",
|
|
85
|
+
"oxlint-tsgolint": "^0.11.1",
|
|
86
|
+
"prettier": "^3.8.1",
|
|
88
87
|
"tinybench": "^6.0.0",
|
|
89
88
|
"typescript": "^5.9.3",
|
|
90
89
|
"webcodecs-polyfill": "^1.0.1",
|
|
@@ -114,14 +113,7 @@
|
|
|
114
113
|
"armv7-unknown-linux-gnueabihf"
|
|
115
114
|
]
|
|
116
115
|
},
|
|
117
|
-
"packageManager": "pnpm@10.
|
|
118
|
-
"prettier": {
|
|
119
|
-
"arrowParens": "always",
|
|
120
|
-
"printWidth": 120,
|
|
121
|
-
"semi": false,
|
|
122
|
-
"singleQuote": true,
|
|
123
|
-
"trailingComma": "all"
|
|
124
|
-
},
|
|
116
|
+
"packageManager": "pnpm@10.28.1",
|
|
125
117
|
"ava": {
|
|
126
118
|
"environmentVariables": {
|
|
127
119
|
"TS_NODE_PROJECT": "./tsconfig.json"
|
|
@@ -160,14 +152,14 @@
|
|
|
160
152
|
]
|
|
161
153
|
},
|
|
162
154
|
"optionalDependencies": {
|
|
163
|
-
"@napi-rs/webcodecs-darwin-x64": "1.3.
|
|
164
|
-
"@napi-rs/webcodecs-darwin-arm64": "1.3.
|
|
165
|
-
"@napi-rs/webcodecs-linux-x64-gnu": "1.3.
|
|
166
|
-
"@napi-rs/webcodecs-linux-x64-musl": "1.3.
|
|
167
|
-
"@napi-rs/webcodecs-win32-x64-msvc": "1.3.
|
|
168
|
-
"@napi-rs/webcodecs-linux-arm64-gnu": "1.3.
|
|
169
|
-
"@napi-rs/webcodecs-linux-arm64-musl": "1.3.
|
|
170
|
-
"@napi-rs/webcodecs-win32-arm64-msvc": "1.3.
|
|
171
|
-
"@napi-rs/webcodecs-linux-arm-gnueabihf": "1.3.
|
|
155
|
+
"@napi-rs/webcodecs-darwin-x64": "1.3.1",
|
|
156
|
+
"@napi-rs/webcodecs-darwin-arm64": "1.3.1",
|
|
157
|
+
"@napi-rs/webcodecs-linux-x64-gnu": "1.3.1",
|
|
158
|
+
"@napi-rs/webcodecs-linux-x64-musl": "1.3.1",
|
|
159
|
+
"@napi-rs/webcodecs-win32-x64-msvc": "1.3.1",
|
|
160
|
+
"@napi-rs/webcodecs-linux-arm64-gnu": "1.3.1",
|
|
161
|
+
"@napi-rs/webcodecs-linux-arm64-musl": "1.3.1",
|
|
162
|
+
"@napi-rs/webcodecs-win32-arm64-msvc": "1.3.1",
|
|
163
|
+
"@napi-rs/webcodecs-linux-arm-gnueabihf": "1.3.1"
|
|
172
164
|
}
|
|
173
165
|
}
|