@napi-rs/webcodecs 1.2.0 → 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.
- package/README.md +105 -18
- package/index.d.ts +271 -215
- package/index.js +82 -237
- 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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
|
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
|
|
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
|
/**
|
|
@@ -1079,7 +1105,12 @@ export declare class VideoFrame {
|
|
|
1079
1105
|
* Options can specify target format and rect for cropped copy.
|
|
1080
1106
|
*/
|
|
1081
1107
|
copyTo(destination: Uint8Array, options?: VideoFrameCopyToOptions | undefined | null): Promise<Array<PlaneLayout>>
|
|
1082
|
-
/**
|
|
1108
|
+
/**
|
|
1109
|
+
* Clone this VideoFrame
|
|
1110
|
+
*
|
|
1111
|
+
* This creates a new VideoFrame that shares the underlying pixel data with the original.
|
|
1112
|
+
* Both frames will reference the same Arc<RwLock<Frame>>, so no pixel data is copied.
|
|
1113
|
+
*/
|
|
1083
1114
|
clone(): VideoFrame
|
|
1084
1115
|
/**
|
|
1085
1116
|
* Close and release resources
|
|
@@ -1095,6 +1126,11 @@ export declare class VideoFrame {
|
|
|
1095
1126
|
* WebM Demuxer for reading encoded video and audio from WebM container
|
|
1096
1127
|
*
|
|
1097
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
|
|
1098
1134
|
*/
|
|
1099
1135
|
export declare class WebMDemuxer {
|
|
1100
1136
|
constructor(init: WebMDemuxerInit)
|
|
@@ -1113,6 +1149,8 @@ export declare class WebMDemuxer {
|
|
|
1113
1149
|
selectVideoTrack(trackIndex: number): void
|
|
1114
1150
|
selectAudioTrack(trackIndex: number): void
|
|
1115
1151
|
demux(count?: number | undefined | null): void
|
|
1152
|
+
/** Demux packets asynchronously (awaitable version of demux) */
|
|
1153
|
+
demuxAsync(count?: number | undefined | null): Promise<void>
|
|
1116
1154
|
seek(timestampUs: number): void
|
|
1117
1155
|
close(): void
|
|
1118
1156
|
get state(): string
|
|
@@ -1180,9 +1218,9 @@ export declare class WebMMuxer {
|
|
|
1180
1218
|
|
|
1181
1219
|
/** AAC bitstream format (W3C WebCodecs AAC Registration) */
|
|
1182
1220
|
export type AacBitstreamFormat = /** Raw AAC frames - metadata in description */
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1221
|
+
'aac'|
|
|
1222
|
+
/** ADTS frames - metadata in each frame */
|
|
1223
|
+
'adts';
|
|
1186
1224
|
|
|
1187
1225
|
/** AAC encoder configuration (W3C WebCodecs AAC Registration) */
|
|
1188
1226
|
export interface AacEncoderConfig {
|
|
@@ -1202,9 +1240,9 @@ export interface AddEventListenerOptions {
|
|
|
1202
1240
|
* Default is "discard" per spec
|
|
1203
1241
|
*/
|
|
1204
1242
|
export type AlphaOption = /** Keep alpha channel if present */
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1243
|
+
'keep'|
|
|
1244
|
+
/** Discard alpha channel (default per W3C spec) */
|
|
1245
|
+
'discard';
|
|
1208
1246
|
|
|
1209
1247
|
/** Options for copyTo operation */
|
|
1210
1248
|
export interface AudioDataCopyToOptions {
|
|
@@ -1270,7 +1308,9 @@ export interface AudioEncoderAddEventListenerOptions {
|
|
|
1270
1308
|
}
|
|
1271
1309
|
|
|
1272
1310
|
/** Encode options for audio */
|
|
1273
|
-
export interface AudioEncoderEncodeOptions {
|
|
1311
|
+
export interface AudioEncoderEncodeOptions {
|
|
1312
|
+
|
|
1313
|
+
}
|
|
1274
1314
|
|
|
1275
1315
|
/** Options for removeEventListener (W3C DOM spec) */
|
|
1276
1316
|
export interface AudioEncoderEventListenerOptions {
|
|
@@ -1287,27 +1327,27 @@ export interface AudioEncoderSupport {
|
|
|
1287
1327
|
|
|
1288
1328
|
/** Audio sample format (WebCodecs spec) */
|
|
1289
1329
|
export type AudioSampleFormat = /** Unsigned 8-bit integer samples| interleaved */
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
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';
|
|
1305
1345
|
|
|
1306
1346
|
/** AVC (H.264) bitstream format (W3C WebCodecs AVC Registration) */
|
|
1307
1347
|
export type AvcBitstreamFormat = /** AVC format with parameter sets in description (ISO 14496-15) */
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1348
|
+
'avc'|
|
|
1349
|
+
/** Annex B format with parameter sets in bitstream */
|
|
1350
|
+
'annexb';
|
|
1311
1351
|
|
|
1312
1352
|
/** AVC (H.264) encoder configuration (W3C WebCodecs AVC Registration) */
|
|
1313
1353
|
export interface AvcEncoderConfig {
|
|
@@ -1317,23 +1357,23 @@ export interface AvcEncoderConfig {
|
|
|
1317
1357
|
|
|
1318
1358
|
/** Bitrate mode for audio encoding (W3C WebCodecs spec) */
|
|
1319
1359
|
export type BitrateMode = /** Variable bitrate (default) */
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1360
|
+
'variable'|
|
|
1361
|
+
/** Constant bitrate */
|
|
1362
|
+
'constant';
|
|
1323
1363
|
|
|
1324
1364
|
/** Encoder state per WebCodecs spec */
|
|
1325
1365
|
export type CodecState = /** Encoder not configured */
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1366
|
+
'unconfigured'|
|
|
1367
|
+
/** Encoder configured and ready */
|
|
1368
|
+
'configured'|
|
|
1369
|
+
/** Encoder closed */
|
|
1370
|
+
'closed';
|
|
1331
1371
|
|
|
1332
1372
|
/** ColorSpaceConversion for ImageDecoder (W3C WebCodecs spec) */
|
|
1333
1373
|
export type ColorSpaceConversion = /** Apply default color space conversion (spec default) */
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1374
|
+
'default'|
|
|
1375
|
+
/** No color space conversion */
|
|
1376
|
+
'none';
|
|
1337
1377
|
|
|
1338
1378
|
/** Audio decoder configuration exposed to JavaScript */
|
|
1339
1379
|
export interface DemuxerAudioDecoderConfig {
|
|
@@ -1401,9 +1441,9 @@ export interface EncodedAudioChunkMetadataJs {
|
|
|
1401
1441
|
|
|
1402
1442
|
/** Type of encoded audio chunk */
|
|
1403
1443
|
export type EncodedAudioChunkType = /** Key chunk - can be decoded independently */
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1444
|
+
'key'|
|
|
1445
|
+
/** Delta chunk - depends on previous chunks */
|
|
1446
|
+
'delta';
|
|
1407
1447
|
|
|
1408
1448
|
/** Output callback metadata per WebCodecs spec */
|
|
1409
1449
|
export interface EncodedVideoChunkMetadata {
|
|
@@ -1421,13 +1461,19 @@ export interface EncodedVideoChunkMetadataJs {
|
|
|
1421
1461
|
decoderConfig?: VideoDecoderConfigJs
|
|
1422
1462
|
/** SVC output metadata */
|
|
1423
1463
|
svc?: SvcOutputMetadataJs
|
|
1464
|
+
/**
|
|
1465
|
+
* Alpha channel side data (for VP9 alpha support)
|
|
1466
|
+
* This contains the encoded alpha channel data that should be written
|
|
1467
|
+
* as BlockAdditions in WebM/MKV containers.
|
|
1468
|
+
*/
|
|
1469
|
+
alphaSideData?: Uint8Array
|
|
1424
1470
|
}
|
|
1425
1471
|
|
|
1426
1472
|
/** Type of encoded video chunk */
|
|
1427
1473
|
export type EncodedVideoChunkType = /** Keyframe - can be decoded independently */
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1474
|
+
'key'|
|
|
1475
|
+
/** Delta frame - depends on previous frames */
|
|
1476
|
+
'delta';
|
|
1431
1477
|
|
|
1432
1478
|
/** Options for removeEventListener (W3C DOM spec) */
|
|
1433
1479
|
export interface EventListenerOptions {
|
|
@@ -1453,11 +1499,11 @@ export declare function getPreferredHardwareAccelerator(): string | null
|
|
|
1453
1499
|
|
|
1454
1500
|
/** Hardware acceleration preference (W3C WebCodecs spec) */
|
|
1455
1501
|
export type HardwareAcceleration = /** No preference - may use hardware or software */
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1502
|
+
'no-preference'|
|
|
1503
|
+
/** Prefer hardware acceleration */
|
|
1504
|
+
'prefer-hardware'|
|
|
1505
|
+
/** Prefer software implementation */
|
|
1506
|
+
'prefer-software';
|
|
1461
1507
|
|
|
1462
1508
|
/** Hardware accelerator information */
|
|
1463
1509
|
export interface HardwareAccelerator {
|
|
@@ -1471,9 +1517,9 @@ export interface HardwareAccelerator {
|
|
|
1471
1517
|
|
|
1472
1518
|
/** HEVC (H.265) bitstream format (W3C WebCodecs HEVC Registration) */
|
|
1473
1519
|
export type HevcBitstreamFormat = /** HEVC format with parameter sets in description (ISO 14496-15) */
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1520
|
+
'hevc'|
|
|
1521
|
+
/** Annex B format with parameter sets in bitstream */
|
|
1522
|
+
'annexb';
|
|
1477
1523
|
|
|
1478
1524
|
/** HEVC (H.265) encoder configuration (W3C WebCodecs HEVC Registration) */
|
|
1479
1525
|
export interface HevcEncoderConfig {
|
|
@@ -1494,9 +1540,9 @@ export declare function isHardwareAcceleratorAvailable(name: string): boolean
|
|
|
1494
1540
|
|
|
1495
1541
|
/** Latency mode for video encoding (W3C WebCodecs spec) */
|
|
1496
1542
|
export type LatencyMode = /** Optimize for quality (default) */
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1543
|
+
'quality'|
|
|
1544
|
+
/** Optimize for low latency */
|
|
1545
|
+
'realtime';
|
|
1500
1546
|
|
|
1501
1547
|
/** Audio track configuration for MKV muxer */
|
|
1502
1548
|
export interface MkvAudioTrackConfig {
|
|
@@ -1526,6 +1572,8 @@ export interface MkvVideoTrackConfig {
|
|
|
1526
1572
|
width: number
|
|
1527
1573
|
/** Video height in pixels */
|
|
1528
1574
|
height: number
|
|
1575
|
+
/** Frame rate (frames per second) */
|
|
1576
|
+
framerate?: number
|
|
1529
1577
|
/** Codec-specific description data */
|
|
1530
1578
|
description?: Uint8Array
|
|
1531
1579
|
}
|
|
@@ -1566,23 +1614,25 @@ export interface Mp4VideoTrackConfig {
|
|
|
1566
1614
|
width: number
|
|
1567
1615
|
/** Video height in pixels */
|
|
1568
1616
|
height: number
|
|
1617
|
+
/** Frame rate (frames per second) */
|
|
1618
|
+
framerate?: number
|
|
1569
1619
|
/** Codec-specific description data (avcC/hvcC/av1C from encoder metadata) */
|
|
1570
1620
|
description?: Uint8Array
|
|
1571
1621
|
}
|
|
1572
1622
|
|
|
1573
1623
|
/** Opus application mode (W3C WebCodecs Opus Registration) */
|
|
1574
1624
|
export type OpusApplication = /** Optimize for VoIP (speech intelligibility) */
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1625
|
+
'voip'|
|
|
1626
|
+
/** Optimize for audio fidelity (default) */
|
|
1627
|
+
'audio'|
|
|
1628
|
+
/** Minimize coding delay */
|
|
1629
|
+
'lowdelay';
|
|
1580
1630
|
|
|
1581
1631
|
/** Opus bitstream format (W3C WebCodecs Opus Registration) */
|
|
1582
1632
|
export type OpusBitstreamFormat = /** Opus packets (RFC 6716) - no metadata needed for decoding */
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1633
|
+
'opus'|
|
|
1634
|
+
/** Ogg encapsulation (RFC 7845) - metadata in description */
|
|
1635
|
+
'ogg';
|
|
1586
1636
|
|
|
1587
1637
|
/** Opus encoder configuration (W3C WebCodecs Opus Registration) */
|
|
1588
1638
|
export interface OpusEncoderConfig {
|
|
@@ -1609,11 +1659,11 @@ export interface OpusEncoderConfig {
|
|
|
1609
1659
|
|
|
1610
1660
|
/** Opus signal type hint (W3C WebCodecs Opus Registration) */
|
|
1611
1661
|
export type OpusSignal = /** Auto-detect signal type */
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1662
|
+
'auto'|
|
|
1663
|
+
/** Music signal */
|
|
1664
|
+
'music'|
|
|
1665
|
+
/** Voice/speech signal */
|
|
1666
|
+
'voice';
|
|
1617
1667
|
|
|
1618
1668
|
/** Layout information for a single plane per WebCodecs spec */
|
|
1619
1669
|
export interface PlaneLayout {
|
|
@@ -1654,15 +1704,15 @@ export interface SvcOutputMetadataJs {
|
|
|
1654
1704
|
|
|
1655
1705
|
/** Video color primaries (W3C WebCodecs spec) */
|
|
1656
1706
|
export type VideoColorPrimaries = /** BT.709 / sRGB primaries */
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
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';
|
|
1666
1716
|
|
|
1667
1717
|
/** Options for addEventListener (W3C DOM spec) */
|
|
1668
1718
|
export interface VideoDecoderAddEventListenerOptions {
|
|
@@ -1720,11 +1770,11 @@ export interface VideoDecoderSupport {
|
|
|
1720
1770
|
|
|
1721
1771
|
/** Bitrate mode for video encoding (W3C WebCodecs spec) */
|
|
1722
1772
|
export type VideoEncoderBitrateMode = /** Variable bitrate (default) */
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1773
|
+
'variable'|
|
|
1774
|
+
/** Constant bitrate */
|
|
1775
|
+
'constant'|
|
|
1776
|
+
/** Use quantizer parameter from codec-specific options */
|
|
1777
|
+
'quantizer';
|
|
1728
1778
|
|
|
1729
1779
|
/** Encode options per WebCodecs spec */
|
|
1730
1780
|
export interface VideoEncoderEncodeOptions {
|
|
@@ -1742,7 +1792,7 @@ export interface VideoEncoderEncodeOptions {
|
|
|
1742
1792
|
|
|
1743
1793
|
/** AV1 encode options (W3C WebCodecs AV1 Registration) */
|
|
1744
1794
|
export interface VideoEncoderEncodeOptionsForAv1 {
|
|
1745
|
-
/** Per-frame quantizer (0-
|
|
1795
|
+
/** Per-frame quantizer (0-255, lower = higher quality) */
|
|
1746
1796
|
quantizer?: number
|
|
1747
1797
|
}
|
|
1748
1798
|
|
|
@@ -1760,7 +1810,7 @@ export interface VideoEncoderEncodeOptionsForHevc {
|
|
|
1760
1810
|
|
|
1761
1811
|
/** VP9 encode options (W3C WebCodecs VP9 Registration) */
|
|
1762
1812
|
export interface VideoEncoderEncodeOptionsForVp9 {
|
|
1763
|
-
/** Per-frame quantizer (0-
|
|
1813
|
+
/** Per-frame quantizer (0-255, lower = higher quality) */
|
|
1764
1814
|
quantizer?: number
|
|
1765
1815
|
}
|
|
1766
1816
|
|
|
@@ -1808,7 +1858,9 @@ export interface VideoFrameInit {
|
|
|
1808
1858
|
* VideoFrameMetadata - metadata associated with a VideoFrame (W3C spec)
|
|
1809
1859
|
* Members defined in VideoFrame Metadata Registry - currently empty per spec
|
|
1810
1860
|
*/
|
|
1811
|
-
export interface VideoFrameMetadata {
|
|
1861
|
+
export interface VideoFrameMetadata {
|
|
1862
|
+
|
|
1863
|
+
}
|
|
1812
1864
|
|
|
1813
1865
|
/** Rectangle for specifying a region */
|
|
1814
1866
|
export interface VideoFrameRect {
|
|
@@ -1820,75 +1872,75 @@ export interface VideoFrameRect {
|
|
|
1820
1872
|
|
|
1821
1873
|
/** Video matrix coefficients (W3C WebCodecs spec) */
|
|
1822
1874
|
export type VideoMatrixCoefficients = /** RGB (identity matrix) */
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
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';
|
|
1832
1884
|
|
|
1833
1885
|
/** Video pixel format (WebCodecs spec) */
|
|
1834
1886
|
export type VideoPixelFormat = /** Planar YUV 4:2:0| 12bpp| (1 Cr & Cb sample per 2x2 Y samples) */
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
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';
|
|
1876
1928
|
|
|
1877
1929
|
/** Video transfer characteristics (W3C WebCodecs spec) */
|
|
1878
1930
|
export type VideoTransferCharacteristics = /** BT.709 transfer */
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
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';
|
|
1892
1944
|
|
|
1893
1945
|
/** Audio track configuration for WebM muxer */
|
|
1894
1946
|
export interface WebMAudioTrackConfig {
|
|
@@ -1918,6 +1970,10 @@ export interface WebMVideoTrackConfig {
|
|
|
1918
1970
|
width: number
|
|
1919
1971
|
/** Video height in pixels */
|
|
1920
1972
|
height: number
|
|
1973
|
+
/** Frame rate (frames per second) */
|
|
1974
|
+
framerate?: number
|
|
1921
1975
|
/** Codec-specific description data */
|
|
1922
1976
|
description?: Uint8Array
|
|
1977
|
+
/** Whether the video has alpha channel (VP9 alpha support) */
|
|
1978
|
+
alpha?: boolean
|
|
1923
1979
|
}
|