@napi-rs/webcodecs 1.0.0 → 1.1.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 +1 -1
- package/index.d.ts +848 -0
- package/index.js +58 -52
- package/package.json +11 -10
package/README.md
CHANGED
package/index.d.ts
CHANGED
|
@@ -60,6 +60,317 @@ export interface CanvasLike {
|
|
|
60
60
|
data(): Uint8Array
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
// ============================================================================
|
|
64
|
+
// Muxer/Demuxer Types
|
|
65
|
+
// ============================================================================
|
|
66
|
+
|
|
67
|
+
/** Demuxer state */
|
|
68
|
+
export type DemuxerState = 'unloaded' | 'ready' | 'demuxing' | 'ended' | 'closed'
|
|
69
|
+
|
|
70
|
+
/** Muxer state */
|
|
71
|
+
export type MuxerState = 'configuring' | 'muxing' | 'finalized' | 'closed'
|
|
72
|
+
|
|
73
|
+
/** Track type for demuxer */
|
|
74
|
+
export type DemuxerTrackType = 'video' | 'audio' | 'subtitle' | 'data'
|
|
75
|
+
|
|
76
|
+
/** Track info from demuxer */
|
|
77
|
+
export interface DemuxerTrackInfo {
|
|
78
|
+
/** Track index */
|
|
79
|
+
index: number
|
|
80
|
+
/** Track type */
|
|
81
|
+
trackType: DemuxerTrackType
|
|
82
|
+
/** Codec string */
|
|
83
|
+
codec?: string
|
|
84
|
+
/** Coded width (video only) */
|
|
85
|
+
codedWidth?: number
|
|
86
|
+
/** Coded height (video only) */
|
|
87
|
+
codedHeight?: number
|
|
88
|
+
/** Sample rate (audio only) */
|
|
89
|
+
sampleRate?: number
|
|
90
|
+
/** Number of channels (audio only) */
|
|
91
|
+
numberOfChannels?: number
|
|
92
|
+
/** Duration in microseconds */
|
|
93
|
+
duration?: number
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Video decoder config from demuxer */
|
|
97
|
+
export interface DemuxerVideoDecoderConfig {
|
|
98
|
+
/** Codec string */
|
|
99
|
+
codec: string
|
|
100
|
+
/** Coded width */
|
|
101
|
+
codedWidth: number
|
|
102
|
+
/** Coded height */
|
|
103
|
+
codedHeight: number
|
|
104
|
+
/** Codec description (e.g., avcC for H.264) */
|
|
105
|
+
description?: Uint8Array
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Audio decoder config from demuxer */
|
|
109
|
+
export interface DemuxerAudioDecoderConfig {
|
|
110
|
+
/** Codec string */
|
|
111
|
+
codec: string
|
|
112
|
+
/** Sample rate */
|
|
113
|
+
sampleRate: number
|
|
114
|
+
/** Number of channels */
|
|
115
|
+
numberOfChannels: number
|
|
116
|
+
/** Codec description */
|
|
117
|
+
description?: Uint8Array
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Init options for Mp4Demuxer */
|
|
121
|
+
export interface Mp4DemuxerInit {
|
|
122
|
+
/** Callback for video chunks */
|
|
123
|
+
videoOutput?: (chunk: EncodedVideoChunk) => void
|
|
124
|
+
/** Callback for audio chunks */
|
|
125
|
+
audioOutput?: (chunk: EncodedAudioChunk) => void
|
|
126
|
+
/** Error callback (required) */
|
|
127
|
+
error: (error: Error) => void
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Init options for WebMDemuxer */
|
|
131
|
+
export interface WebMDemuxerInit {
|
|
132
|
+
/** Callback for video chunks */
|
|
133
|
+
videoOutput?: (chunk: EncodedVideoChunk) => void
|
|
134
|
+
/** Callback for audio chunks */
|
|
135
|
+
audioOutput?: (chunk: EncodedAudioChunk) => void
|
|
136
|
+
/** Error callback (required) */
|
|
137
|
+
error: (error: Error) => void
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Init options for MkvDemuxer */
|
|
141
|
+
export interface MkvDemuxerInit {
|
|
142
|
+
/** Callback for video chunks */
|
|
143
|
+
videoOutput?: (chunk: EncodedVideoChunk) => void
|
|
144
|
+
/** Callback for audio chunks */
|
|
145
|
+
audioOutput?: (chunk: EncodedAudioChunk) => void
|
|
146
|
+
/** Error callback (required) */
|
|
147
|
+
error: (error: Error) => void
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Video track config for muxer */
|
|
151
|
+
export interface MuxerVideoTrackConfig {
|
|
152
|
+
/** Codec string */
|
|
153
|
+
codec: string
|
|
154
|
+
/** Video width */
|
|
155
|
+
width: number
|
|
156
|
+
/** Video height */
|
|
157
|
+
height: number
|
|
158
|
+
/** Codec description (e.g., avcC for H.264) */
|
|
159
|
+
description?: Uint8Array
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Audio track config for muxer */
|
|
163
|
+
export interface MuxerAudioTrackConfig {
|
|
164
|
+
/** Codec string */
|
|
165
|
+
codec: string
|
|
166
|
+
/** Sample rate */
|
|
167
|
+
sampleRate: number
|
|
168
|
+
/** Number of channels */
|
|
169
|
+
numberOfChannels: number
|
|
170
|
+
/** Codec description */
|
|
171
|
+
description?: Uint8Array
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Init options for Mp4Muxer */
|
|
175
|
+
export interface Mp4MuxerInit {
|
|
176
|
+
/** Move moov atom to beginning (not compatible with streaming) */
|
|
177
|
+
fastStart?: boolean
|
|
178
|
+
/** Use fragmented MP4 for streaming */
|
|
179
|
+
fragmented?: boolean
|
|
180
|
+
/** Enable streaming output mode */
|
|
181
|
+
streaming?: { bufferCapacity?: number }
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Init options for WebMMuxer */
|
|
185
|
+
export interface WebMMuxerInit {
|
|
186
|
+
/** Enable live streaming mode */
|
|
187
|
+
live?: boolean
|
|
188
|
+
/** Enable streaming output mode */
|
|
189
|
+
streaming?: { bufferCapacity?: number }
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** Init options for MkvMuxer */
|
|
193
|
+
export interface MkvMuxerInit {
|
|
194
|
+
/** Enable live streaming mode */
|
|
195
|
+
live?: boolean
|
|
196
|
+
/** Enable streaming output mode */
|
|
197
|
+
streaming?: { bufferCapacity?: number }
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* MP4 Demuxer - reads encoded video/audio from MP4 containers
|
|
202
|
+
*/
|
|
203
|
+
export declare class Mp4Demuxer {
|
|
204
|
+
constructor(init: Mp4DemuxerInit)
|
|
205
|
+
/** Load from file path */
|
|
206
|
+
load(path: string): Promise<void>
|
|
207
|
+
/** Load from buffer */
|
|
208
|
+
loadBuffer(data: Uint8Array): Promise<void>
|
|
209
|
+
/** Get all tracks */
|
|
210
|
+
get tracks(): DemuxerTrackInfo[]
|
|
211
|
+
/** Get container duration in microseconds */
|
|
212
|
+
get duration(): number | null
|
|
213
|
+
/** Get video decoder configuration */
|
|
214
|
+
get videoDecoderConfig(): DemuxerVideoDecoderConfig | null
|
|
215
|
+
/** Get audio decoder configuration */
|
|
216
|
+
get audioDecoderConfig(): DemuxerAudioDecoderConfig | null
|
|
217
|
+
/** Select video track by index */
|
|
218
|
+
selectVideoTrack(trackIndex: number): void
|
|
219
|
+
/** Select audio track by index */
|
|
220
|
+
selectAudioTrack(trackIndex: number): void
|
|
221
|
+
/** Start demuxing (optional packet count limit) */
|
|
222
|
+
demux(count?: number): void
|
|
223
|
+
/** Seek to timestamp in microseconds */
|
|
224
|
+
seek(timestampUs: number): void
|
|
225
|
+
/** Close and release resources */
|
|
226
|
+
close(): void
|
|
227
|
+
/** Get current state */
|
|
228
|
+
get state(): DemuxerState
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* WebM Demuxer - reads encoded video/audio from WebM containers
|
|
233
|
+
*/
|
|
234
|
+
export declare class WebMDemuxer {
|
|
235
|
+
constructor(init: WebMDemuxerInit)
|
|
236
|
+
/** Load from file path */
|
|
237
|
+
load(path: string): Promise<void>
|
|
238
|
+
/** Load from buffer */
|
|
239
|
+
loadBuffer(data: Uint8Array): Promise<void>
|
|
240
|
+
/** Get all tracks */
|
|
241
|
+
get tracks(): DemuxerTrackInfo[]
|
|
242
|
+
/** Get container duration in microseconds */
|
|
243
|
+
get duration(): number | null
|
|
244
|
+
/** Get video decoder configuration */
|
|
245
|
+
get videoDecoderConfig(): DemuxerVideoDecoderConfig | null
|
|
246
|
+
/** Get audio decoder configuration */
|
|
247
|
+
get audioDecoderConfig(): DemuxerAudioDecoderConfig | null
|
|
248
|
+
/** Select video track by index */
|
|
249
|
+
selectVideoTrack(trackIndex: number): void
|
|
250
|
+
/** Select audio track by index */
|
|
251
|
+
selectAudioTrack(trackIndex: number): void
|
|
252
|
+
/** Start demuxing (optional packet count limit) */
|
|
253
|
+
demux(count?: number): void
|
|
254
|
+
/** Seek to timestamp in microseconds */
|
|
255
|
+
seek(timestampUs: number): void
|
|
256
|
+
/** Close and release resources */
|
|
257
|
+
close(): void
|
|
258
|
+
/** Get current state */
|
|
259
|
+
get state(): DemuxerState
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* MKV Demuxer - reads encoded video/audio from MKV containers
|
|
264
|
+
*/
|
|
265
|
+
export declare class MkvDemuxer {
|
|
266
|
+
constructor(init: MkvDemuxerInit)
|
|
267
|
+
/** Load from file path */
|
|
268
|
+
load(path: string): Promise<void>
|
|
269
|
+
/** Load from buffer */
|
|
270
|
+
loadBuffer(data: Uint8Array): Promise<void>
|
|
271
|
+
/** Get all tracks */
|
|
272
|
+
get tracks(): DemuxerTrackInfo[]
|
|
273
|
+
/** Get container duration in microseconds */
|
|
274
|
+
get duration(): number | null
|
|
275
|
+
/** Get video decoder configuration */
|
|
276
|
+
get videoDecoderConfig(): DemuxerVideoDecoderConfig | null
|
|
277
|
+
/** Get audio decoder configuration */
|
|
278
|
+
get audioDecoderConfig(): DemuxerAudioDecoderConfig | null
|
|
279
|
+
/** Select video track by index */
|
|
280
|
+
selectVideoTrack(trackIndex: number): void
|
|
281
|
+
/** Select audio track by index */
|
|
282
|
+
selectAudioTrack(trackIndex: number): void
|
|
283
|
+
/** Start demuxing (optional packet count limit) */
|
|
284
|
+
demux(count?: number): void
|
|
285
|
+
/** Seek to timestamp in microseconds */
|
|
286
|
+
seek(timestampUs: number): void
|
|
287
|
+
/** Close and release resources */
|
|
288
|
+
close(): void
|
|
289
|
+
/** Get current state */
|
|
290
|
+
get state(): DemuxerState
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* MP4 Muxer - writes encoded video/audio to MP4 containers
|
|
295
|
+
*/
|
|
296
|
+
export declare class Mp4Muxer {
|
|
297
|
+
constructor(init?: Mp4MuxerInit)
|
|
298
|
+
/** Add video track */
|
|
299
|
+
addVideoTrack(config: MuxerVideoTrackConfig): void
|
|
300
|
+
/** Add audio track */
|
|
301
|
+
addAudioTrack(config: MuxerAudioTrackConfig): void
|
|
302
|
+
/** Add encoded video chunk */
|
|
303
|
+
addVideoChunk(chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadata): void
|
|
304
|
+
/** Add encoded audio chunk */
|
|
305
|
+
addAudioChunk(chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadata): void
|
|
306
|
+
/** Flush pending data */
|
|
307
|
+
flush(): Promise<void>
|
|
308
|
+
/** Finalize and get output data */
|
|
309
|
+
finalize(): Uint8Array
|
|
310
|
+
/** Read available data (streaming mode) */
|
|
311
|
+
read(): Uint8Array | null
|
|
312
|
+
/** Check if finished (streaming mode) */
|
|
313
|
+
get isFinished(): boolean
|
|
314
|
+
/** Close and release resources */
|
|
315
|
+
close(): void
|
|
316
|
+
/** Get current state */
|
|
317
|
+
get state(): MuxerState
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* WebM Muxer - writes encoded video/audio to WebM containers
|
|
322
|
+
*/
|
|
323
|
+
export declare class WebMMuxer {
|
|
324
|
+
constructor(init?: WebMMuxerInit)
|
|
325
|
+
/** Add video track */
|
|
326
|
+
addVideoTrack(config: MuxerVideoTrackConfig): void
|
|
327
|
+
/** Add audio track */
|
|
328
|
+
addAudioTrack(config: MuxerAudioTrackConfig): void
|
|
329
|
+
/** Add encoded video chunk */
|
|
330
|
+
addVideoChunk(chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadata): void
|
|
331
|
+
/** Add encoded audio chunk */
|
|
332
|
+
addAudioChunk(chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadata): void
|
|
333
|
+
/** Flush pending data */
|
|
334
|
+
flush(): Promise<void>
|
|
335
|
+
/** Finalize and get output data */
|
|
336
|
+
finalize(): Uint8Array
|
|
337
|
+
/** Read available data (streaming mode) */
|
|
338
|
+
read(): Uint8Array | null
|
|
339
|
+
/** Check if finished (streaming mode) */
|
|
340
|
+
get isFinished(): boolean
|
|
341
|
+
/** Close and release resources */
|
|
342
|
+
close(): void
|
|
343
|
+
/** Get current state */
|
|
344
|
+
get state(): MuxerState
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* MKV Muxer - writes encoded video/audio to MKV containers
|
|
349
|
+
*/
|
|
350
|
+
export declare class MkvMuxer {
|
|
351
|
+
constructor(init?: MkvMuxerInit)
|
|
352
|
+
/** Add video track */
|
|
353
|
+
addVideoTrack(config: MuxerVideoTrackConfig): void
|
|
354
|
+
/** Add audio track */
|
|
355
|
+
addAudioTrack(config: MuxerAudioTrackConfig): void
|
|
356
|
+
/** Add encoded video chunk */
|
|
357
|
+
addVideoChunk(chunk: EncodedVideoChunk, metadata?: EncodedVideoChunkMetadata): void
|
|
358
|
+
/** Add encoded audio chunk */
|
|
359
|
+
addAudioChunk(chunk: EncodedAudioChunk, metadata?: EncodedAudioChunkMetadata): void
|
|
360
|
+
/** Flush pending data */
|
|
361
|
+
flush(): Promise<void>
|
|
362
|
+
/** Finalize and get output data */
|
|
363
|
+
finalize(): Uint8Array
|
|
364
|
+
/** Read available data (streaming mode) */
|
|
365
|
+
read(): Uint8Array | null
|
|
366
|
+
/** Check if finished (streaming mode) */
|
|
367
|
+
get isFinished(): boolean
|
|
368
|
+
/** Close and release resources */
|
|
369
|
+
close(): void
|
|
370
|
+
/** Get current state */
|
|
371
|
+
get state(): MuxerState
|
|
372
|
+
}
|
|
373
|
+
|
|
63
374
|
export type TypedArray =
|
|
64
375
|
| Int8Array
|
|
65
376
|
| Uint8Array
|
|
@@ -480,6 +791,252 @@ export declare class ImageTrackList {
|
|
|
480
791
|
item(index: number): ImageTrack | null
|
|
481
792
|
}
|
|
482
793
|
|
|
794
|
+
/**
|
|
795
|
+
* MKV Demuxer for reading encoded video and audio from Matroska container
|
|
796
|
+
*
|
|
797
|
+
* MKV supports almost any video and audio codec.
|
|
798
|
+
*/
|
|
799
|
+
export declare class MkvDemuxer {
|
|
800
|
+
constructor(init: MkvDemuxerInit)
|
|
801
|
+
load(path: string): Promise<void>
|
|
802
|
+
/**
|
|
803
|
+
* Load an MKV from a buffer
|
|
804
|
+
*
|
|
805
|
+
* This method uses zero-copy buffer loading - the Uint8Array data is passed
|
|
806
|
+
* directly to the demuxer without an intermediate copy.
|
|
807
|
+
*/
|
|
808
|
+
loadBuffer(data: Uint8Array): Promise<void>
|
|
809
|
+
get tracks(): Array<DemuxerTrackInfo>
|
|
810
|
+
get duration(): number | null
|
|
811
|
+
get videoDecoderConfig(): DemuxerVideoDecoderConfig | null
|
|
812
|
+
get audioDecoderConfig(): DemuxerAudioDecoderConfig | null
|
|
813
|
+
selectVideoTrack(trackIndex: number): void
|
|
814
|
+
selectAudioTrack(trackIndex: number): void
|
|
815
|
+
demux(count?: number | undefined | null): void
|
|
816
|
+
seek(timestampUs: number): void
|
|
817
|
+
close(): void
|
|
818
|
+
get state(): string
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* MKV Muxer for combining encoded video and audio into Matroska container
|
|
823
|
+
*
|
|
824
|
+
* MKV (Matroska) supports virtually all video and audio codecs.
|
|
825
|
+
*
|
|
826
|
+
* Usage:
|
|
827
|
+
* ```javascript
|
|
828
|
+
* const muxer = new MkvMuxer();
|
|
829
|
+
* muxer.addVideoTrack({ codec: 'avc1.42001E', width: 1920, height: 1080 });
|
|
830
|
+
* muxer.addAudioTrack({ codec: 'opus', sampleRate: 48000, numberOfChannels: 2 });
|
|
831
|
+
*
|
|
832
|
+
* // Add encoded chunks from VideoEncoder/AudioEncoder
|
|
833
|
+
* encoder.configure({
|
|
834
|
+
* output: (chunk, metadata) => muxer.addVideoChunk(chunk, metadata)
|
|
835
|
+
* });
|
|
836
|
+
*
|
|
837
|
+
* // Finalize and get MKV data
|
|
838
|
+
* const mkvData = muxer.finalize();
|
|
839
|
+
* ```
|
|
840
|
+
*/
|
|
841
|
+
export declare class MkvMuxer {
|
|
842
|
+
/** Create a new MKV muxer */
|
|
843
|
+
constructor(options?: MkvMuxerOptions | undefined | null)
|
|
844
|
+
/**
|
|
845
|
+
* Add a video track to the muxer
|
|
846
|
+
*
|
|
847
|
+
* MKV supports H.264, H.265, VP8, VP9, AV1, and many other video codecs.
|
|
848
|
+
*/
|
|
849
|
+
addVideoTrack(config: MkvVideoTrackConfig): void
|
|
850
|
+
/**
|
|
851
|
+
* Add an audio track to the muxer
|
|
852
|
+
*
|
|
853
|
+
* MKV supports AAC, Opus, Vorbis, FLAC, MP3, AC3, and many other audio codecs.
|
|
854
|
+
*/
|
|
855
|
+
addAudioTrack(config: MkvAudioTrackConfig): void
|
|
856
|
+
/** Add an encoded video chunk to the muxer */
|
|
857
|
+
addVideoChunk(
|
|
858
|
+
chunk: import('./standard').EncodedVideoChunk,
|
|
859
|
+
metadata?: import('./standard').EncodedVideoChunkMetadata,
|
|
860
|
+
): void
|
|
861
|
+
/** Add an encoded audio chunk to the muxer */
|
|
862
|
+
addAudioChunk(
|
|
863
|
+
chunk: import('./standard').EncodedAudioChunk,
|
|
864
|
+
metadata?: import('./standard').EncodedAudioChunkMetadata,
|
|
865
|
+
): void
|
|
866
|
+
/** Flush any buffered data */
|
|
867
|
+
flush(): void
|
|
868
|
+
/** Finalize the muxer and return the MKV data */
|
|
869
|
+
finalize(): Uint8Array
|
|
870
|
+
/**
|
|
871
|
+
* Read available data from streaming buffer (streaming mode only)
|
|
872
|
+
*
|
|
873
|
+
* Returns available data, or null if no data is ready yet.
|
|
874
|
+
* Returns empty Uint8Array when streaming is finished.
|
|
875
|
+
*/
|
|
876
|
+
read(): Uint8Array | null
|
|
877
|
+
/** Check if muxer is in streaming mode */
|
|
878
|
+
get isStreaming(): boolean
|
|
879
|
+
/** Check if streaming is finished (streaming mode only) */
|
|
880
|
+
get isFinished(): boolean
|
|
881
|
+
/** Close the muxer and release resources */
|
|
882
|
+
close(): void
|
|
883
|
+
/** Get the current state of the muxer */
|
|
884
|
+
get state(): string
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* MP4 Demuxer for reading encoded video and audio from MP4 container
|
|
889
|
+
*
|
|
890
|
+
* Usage:
|
|
891
|
+
* ```javascript
|
|
892
|
+
* const demuxer = new Mp4Demuxer({
|
|
893
|
+
* videoOutput: (chunk) => videoDecoder.decode(chunk),
|
|
894
|
+
* audioOutput: (chunk) => audioDecoder.decode(chunk),
|
|
895
|
+
* error: (err) => console.error(err)
|
|
896
|
+
* });
|
|
897
|
+
*
|
|
898
|
+
* await demuxer.load('./video.mp4');
|
|
899
|
+
*
|
|
900
|
+
* // Get decoder configs
|
|
901
|
+
* const videoConfig = demuxer.videoDecoderConfig;
|
|
902
|
+
* const audioConfig = demuxer.audioDecoderConfig;
|
|
903
|
+
*
|
|
904
|
+
* // Configure decoders
|
|
905
|
+
* videoDecoder.configure(videoConfig);
|
|
906
|
+
* audioDecoder.configure(audioConfig);
|
|
907
|
+
*
|
|
908
|
+
* // Start demuxing
|
|
909
|
+
* demuxer.demux();
|
|
910
|
+
*
|
|
911
|
+
* // Seek to 5 seconds
|
|
912
|
+
* demuxer.seek(5_000_000);
|
|
913
|
+
*
|
|
914
|
+
* demuxer.close();
|
|
915
|
+
* ```
|
|
916
|
+
*/
|
|
917
|
+
export declare class Mp4Demuxer {
|
|
918
|
+
/** Create a new MP4 demuxer */
|
|
919
|
+
constructor(init: Mp4DemuxerInit)
|
|
920
|
+
/** Load an MP4 file from a path */
|
|
921
|
+
load(path: string): Promise<void>
|
|
922
|
+
/**
|
|
923
|
+
* Load an MP4 from a buffer
|
|
924
|
+
*
|
|
925
|
+
* This method uses zero-copy buffer loading - the Uint8Array data is passed
|
|
926
|
+
* directly to the demuxer without an intermediate copy.
|
|
927
|
+
*/
|
|
928
|
+
loadBuffer(data: Uint8Array): Promise<void>
|
|
929
|
+
/** Get all tracks */
|
|
930
|
+
get tracks(): Array<DemuxerTrackInfo>
|
|
931
|
+
/** Get container duration in microseconds */
|
|
932
|
+
get duration(): number | null
|
|
933
|
+
/** Get video decoder configuration for the selected video track */
|
|
934
|
+
get videoDecoderConfig(): DemuxerVideoDecoderConfig | null
|
|
935
|
+
/** Get audio decoder configuration for the selected audio track */
|
|
936
|
+
get audioDecoderConfig(): DemuxerAudioDecoderConfig | null
|
|
937
|
+
/** Select a video track by index */
|
|
938
|
+
selectVideoTrack(trackIndex: number): void
|
|
939
|
+
/** Select an audio track by index */
|
|
940
|
+
selectAudioTrack(trackIndex: number): void
|
|
941
|
+
/**
|
|
942
|
+
* Start demuxing packets
|
|
943
|
+
*
|
|
944
|
+
* If count is specified, reads up to that many packets.
|
|
945
|
+
* Otherwise, reads all packets until end of stream.
|
|
946
|
+
*/
|
|
947
|
+
demux(count?: number | undefined | null): void
|
|
948
|
+
/** Seek to a timestamp in microseconds */
|
|
949
|
+
seek(timestampUs: number): void
|
|
950
|
+
/** Close the demuxer and release resources */
|
|
951
|
+
close(): void
|
|
952
|
+
/** Get the current state of the demuxer */
|
|
953
|
+
get state(): string
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* MP4 Muxer for combining encoded video and audio into MP4 container
|
|
958
|
+
*
|
|
959
|
+
* Usage:
|
|
960
|
+
* ```javascript
|
|
961
|
+
* const muxer = new Mp4Muxer({ fastStart: true });
|
|
962
|
+
* muxer.addVideoTrack({ codec: 'avc1.42001E', width: 1920, height: 1080 });
|
|
963
|
+
* muxer.addAudioTrack({ codec: 'mp4a.40.2', sampleRate: 48000, numberOfChannels: 2 });
|
|
964
|
+
*
|
|
965
|
+
* // Add encoded chunks from VideoEncoder/AudioEncoder
|
|
966
|
+
* encoder.configure({
|
|
967
|
+
* output: (chunk, metadata) => muxer.addVideoChunk(chunk, metadata)
|
|
968
|
+
* });
|
|
969
|
+
*
|
|
970
|
+
* // Finalize and get MP4 data
|
|
971
|
+
* const mp4Data = muxer.finalize();
|
|
972
|
+
* ```
|
|
973
|
+
*/
|
|
974
|
+
export declare class Mp4Muxer {
|
|
975
|
+
/** Create a new MP4 muxer */
|
|
976
|
+
constructor(options?: Mp4MuxerOptions | undefined | null)
|
|
977
|
+
/**
|
|
978
|
+
* Add a video track to the muxer
|
|
979
|
+
*
|
|
980
|
+
* Must be called before adding any chunks.
|
|
981
|
+
*/
|
|
982
|
+
addVideoTrack(config: Mp4VideoTrackConfig): void
|
|
983
|
+
/**
|
|
984
|
+
* Add an audio track to the muxer
|
|
985
|
+
*
|
|
986
|
+
* Must be called before adding any chunks.
|
|
987
|
+
*/
|
|
988
|
+
addAudioTrack(config: Mp4AudioTrackConfig): void
|
|
989
|
+
/**
|
|
990
|
+
* Add an encoded video chunk to the muxer
|
|
991
|
+
*
|
|
992
|
+
* The chunk should come from a VideoEncoder's output callback.
|
|
993
|
+
* If metadata contains decoderConfig.description, it will be used to update
|
|
994
|
+
* the codec extradata (useful for extracting avcC/hvcC from the encoder).
|
|
995
|
+
*/
|
|
996
|
+
addVideoChunk(
|
|
997
|
+
chunk: import('./standard').EncodedVideoChunk,
|
|
998
|
+
metadata?: import('./standard').EncodedVideoChunkMetadata,
|
|
999
|
+
): void
|
|
1000
|
+
/**
|
|
1001
|
+
* Add an encoded audio chunk to the muxer
|
|
1002
|
+
*
|
|
1003
|
+
* The chunk should come from an AudioEncoder's output callback.
|
|
1004
|
+
*/
|
|
1005
|
+
addAudioChunk(
|
|
1006
|
+
chunk: import('./standard').EncodedAudioChunk,
|
|
1007
|
+
metadata?: import('./standard').EncodedAudioChunkMetadata,
|
|
1008
|
+
): void
|
|
1009
|
+
/** Flush any buffered data */
|
|
1010
|
+
flush(): void
|
|
1011
|
+
/**
|
|
1012
|
+
* Finalize the muxer and return the MP4 data
|
|
1013
|
+
*
|
|
1014
|
+
* After calling this, no more chunks can be added.
|
|
1015
|
+
* Returns the complete MP4 file as a Uint8Array.
|
|
1016
|
+
*/
|
|
1017
|
+
finalize(): Uint8Array
|
|
1018
|
+
/**
|
|
1019
|
+
* Read available data from streaming buffer (streaming mode only)
|
|
1020
|
+
*
|
|
1021
|
+
* Returns available data, or null if no data is ready yet.
|
|
1022
|
+
* Returns empty Uint8Array when streaming is finished.
|
|
1023
|
+
*/
|
|
1024
|
+
read(): Uint8Array | null
|
|
1025
|
+
/** Check if muxer is in streaming mode */
|
|
1026
|
+
get isStreaming(): boolean
|
|
1027
|
+
/** Check if streaming is finished (streaming mode only) */
|
|
1028
|
+
get isFinished(): boolean
|
|
1029
|
+
/**
|
|
1030
|
+
* Close the muxer and release resources
|
|
1031
|
+
*
|
|
1032
|
+
* This is called automatically when the muxer is garbage collected,
|
|
1033
|
+
* but can be called explicitly to release resources early.
|
|
1034
|
+
*/
|
|
1035
|
+
close(): void
|
|
1036
|
+
/** Get the current state of the muxer */
|
|
1037
|
+
get state(): string
|
|
1038
|
+
}
|
|
1039
|
+
|
|
483
1040
|
/** Video color space parameters (WebCodecs spec) - as a class per spec */
|
|
484
1041
|
export declare class VideoColorSpace {
|
|
485
1042
|
/** Create a new VideoColorSpace */
|
|
@@ -780,6 +1337,99 @@ export declare class VideoFrame {
|
|
|
780
1337
|
close(): void
|
|
781
1338
|
}
|
|
782
1339
|
|
|
1340
|
+
/**
|
|
1341
|
+
* WebM Demuxer for reading encoded video and audio from WebM container
|
|
1342
|
+
*
|
|
1343
|
+
* WebM typically contains VP8, VP9, or AV1 video with Opus or Vorbis audio.
|
|
1344
|
+
*/
|
|
1345
|
+
export declare class WebMDemuxer {
|
|
1346
|
+
constructor(init: WebMDemuxerInit)
|
|
1347
|
+
load(path: string): Promise<void>
|
|
1348
|
+
/**
|
|
1349
|
+
* Load a WebM from a buffer
|
|
1350
|
+
*
|
|
1351
|
+
* This method uses zero-copy buffer loading - the Uint8Array data is passed
|
|
1352
|
+
* directly to the demuxer without an intermediate copy.
|
|
1353
|
+
*/
|
|
1354
|
+
loadBuffer(data: Uint8Array): Promise<void>
|
|
1355
|
+
get tracks(): Array<DemuxerTrackInfo>
|
|
1356
|
+
get duration(): number | null
|
|
1357
|
+
get videoDecoderConfig(): DemuxerVideoDecoderConfig | null
|
|
1358
|
+
get audioDecoderConfig(): DemuxerAudioDecoderConfig | null
|
|
1359
|
+
selectVideoTrack(trackIndex: number): void
|
|
1360
|
+
selectAudioTrack(trackIndex: number): void
|
|
1361
|
+
demux(count?: number | undefined | null): void
|
|
1362
|
+
seek(timestampUs: number): void
|
|
1363
|
+
close(): void
|
|
1364
|
+
get state(): string
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
* WebM Muxer for combining encoded video and audio into WebM container
|
|
1369
|
+
*
|
|
1370
|
+
* WebM supports VP8, VP9, AV1 video codecs and Opus, Vorbis audio codecs.
|
|
1371
|
+
*
|
|
1372
|
+
* Usage:
|
|
1373
|
+
* ```javascript
|
|
1374
|
+
* const muxer = new WebMMuxer();
|
|
1375
|
+
* muxer.addVideoTrack({ codec: 'vp09.00.10.08', width: 1920, height: 1080 });
|
|
1376
|
+
* muxer.addAudioTrack({ codec: 'opus', sampleRate: 48000, numberOfChannels: 2 });
|
|
1377
|
+
*
|
|
1378
|
+
* // Add encoded chunks from VideoEncoder/AudioEncoder
|
|
1379
|
+
* encoder.configure({
|
|
1380
|
+
* output: (chunk, metadata) => muxer.addVideoChunk(chunk, metadata)
|
|
1381
|
+
* });
|
|
1382
|
+
*
|
|
1383
|
+
* // Finalize and get WebM data
|
|
1384
|
+
* const webmData = muxer.finalize();
|
|
1385
|
+
* ```
|
|
1386
|
+
*/
|
|
1387
|
+
export declare class WebMMuxer {
|
|
1388
|
+
/** Create a new WebM muxer */
|
|
1389
|
+
constructor(options?: WebMMuxerOptions | undefined | null)
|
|
1390
|
+
/**
|
|
1391
|
+
* Add a video track to the muxer
|
|
1392
|
+
*
|
|
1393
|
+
* WebM supports VP8, VP9, and AV1 video codecs.
|
|
1394
|
+
*/
|
|
1395
|
+
addVideoTrack(config: WebMVideoTrackConfig): void
|
|
1396
|
+
/**
|
|
1397
|
+
* Add an audio track to the muxer
|
|
1398
|
+
*
|
|
1399
|
+
* WebM supports Opus and Vorbis audio codecs.
|
|
1400
|
+
*/
|
|
1401
|
+
addAudioTrack(config: WebMAudioTrackConfig): void
|
|
1402
|
+
/** Add an encoded video chunk to the muxer */
|
|
1403
|
+
addVideoChunk(
|
|
1404
|
+
chunk: import('./standard').EncodedVideoChunk,
|
|
1405
|
+
metadata?: import('./standard').EncodedVideoChunkMetadata,
|
|
1406
|
+
): void
|
|
1407
|
+
/** Add an encoded audio chunk to the muxer */
|
|
1408
|
+
addAudioChunk(
|
|
1409
|
+
chunk: import('./standard').EncodedAudioChunk,
|
|
1410
|
+
metadata?: import('./standard').EncodedAudioChunkMetadata,
|
|
1411
|
+
): void
|
|
1412
|
+
/** Flush any buffered data */
|
|
1413
|
+
flush(): void
|
|
1414
|
+
/** Finalize the muxer and return the WebM data */
|
|
1415
|
+
finalize(): Uint8Array
|
|
1416
|
+
/**
|
|
1417
|
+
* Read available data from streaming buffer (streaming mode only)
|
|
1418
|
+
*
|
|
1419
|
+
* Returns available data, or null if no data is ready yet.
|
|
1420
|
+
* Returns empty Uint8Array when streaming is finished.
|
|
1421
|
+
*/
|
|
1422
|
+
read(): Uint8Array | null
|
|
1423
|
+
/** Check if muxer is in streaming mode */
|
|
1424
|
+
get isStreaming(): boolean
|
|
1425
|
+
/** Check if streaming is finished (streaming mode only) */
|
|
1426
|
+
get isFinished(): boolean
|
|
1427
|
+
/** Close the muxer and release resources */
|
|
1428
|
+
close(): void
|
|
1429
|
+
/** Get the current state of the muxer */
|
|
1430
|
+
get state(): string
|
|
1431
|
+
}
|
|
1432
|
+
|
|
783
1433
|
/** AAC bitstream format (W3C WebCodecs AAC Registration) */
|
|
784
1434
|
export type AacBitstreamFormat = /** Raw AAC frames - metadata in description */
|
|
785
1435
|
| 'aac'
|
|
@@ -827,6 +1477,18 @@ export interface AudioDecoderAddEventListenerOptions {
|
|
|
827
1477
|
passive?: boolean
|
|
828
1478
|
}
|
|
829
1479
|
|
|
1480
|
+
/** JavaScript-facing audio decoder config type */
|
|
1481
|
+
export interface AudioDecoderConfigJs {
|
|
1482
|
+
/** Codec string */
|
|
1483
|
+
codec?: string
|
|
1484
|
+
/** Sample rate */
|
|
1485
|
+
sampleRate?: number
|
|
1486
|
+
/** Number of channels */
|
|
1487
|
+
numberOfChannels?: number
|
|
1488
|
+
/** Codec-specific description */
|
|
1489
|
+
description?: Uint8Array
|
|
1490
|
+
}
|
|
1491
|
+
|
|
830
1492
|
/** Decoder configuration output (for passing to decoder) */
|
|
831
1493
|
export interface AudioDecoderConfigOutput {
|
|
832
1494
|
/** Codec string */
|
|
@@ -925,6 +1587,50 @@ export type ColorSpaceConversion = /** Apply default color space conversion (spe
|
|
|
925
1587
|
/** No color space conversion */
|
|
926
1588
|
| 'none'
|
|
927
1589
|
|
|
1590
|
+
/** Audio decoder configuration exposed to JavaScript */
|
|
1591
|
+
export interface DemuxerAudioDecoderConfig {
|
|
1592
|
+
/** Codec string */
|
|
1593
|
+
codec: string
|
|
1594
|
+
/** Sample rate */
|
|
1595
|
+
sampleRate: number
|
|
1596
|
+
/** Number of channels */
|
|
1597
|
+
numberOfChannels: number
|
|
1598
|
+
/** Codec-specific description data */
|
|
1599
|
+
description?: Uint8Array
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
/** Track information exposed to JavaScript */
|
|
1603
|
+
export interface DemuxerTrackInfo {
|
|
1604
|
+
/** Track index */
|
|
1605
|
+
index: number
|
|
1606
|
+
/** Track type ("video" or "audio") */
|
|
1607
|
+
trackType: string
|
|
1608
|
+
/** Codec string (WebCodecs format) */
|
|
1609
|
+
codec: string
|
|
1610
|
+
/** Duration in microseconds */
|
|
1611
|
+
duration?: number
|
|
1612
|
+
/** Coded width (video only) */
|
|
1613
|
+
codedWidth?: number
|
|
1614
|
+
/** Coded height (video only) */
|
|
1615
|
+
codedHeight?: number
|
|
1616
|
+
/** Sample rate (audio only) */
|
|
1617
|
+
sampleRate?: number
|
|
1618
|
+
/** Number of channels (audio only) */
|
|
1619
|
+
numberOfChannels?: number
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
/** Video decoder configuration exposed to JavaScript */
|
|
1623
|
+
export interface DemuxerVideoDecoderConfig {
|
|
1624
|
+
/** Codec string */
|
|
1625
|
+
codec: string
|
|
1626
|
+
/** Coded width */
|
|
1627
|
+
codedWidth: number
|
|
1628
|
+
/** Coded height */
|
|
1629
|
+
codedHeight: number
|
|
1630
|
+
/** Codec-specific description data (avcC/hvcC) */
|
|
1631
|
+
description?: Uint8Array
|
|
1632
|
+
}
|
|
1633
|
+
|
|
928
1634
|
/** DOMRectInit for specifying regions */
|
|
929
1635
|
export interface DOMRectInit {
|
|
930
1636
|
x?: number
|
|
@@ -939,6 +1645,12 @@ export interface EncodedAudioChunkMetadata {
|
|
|
939
1645
|
decoderConfig?: AudioDecoderConfigOutput
|
|
940
1646
|
}
|
|
941
1647
|
|
|
1648
|
+
/** JavaScript-facing metadata type for audio chunks */
|
|
1649
|
+
export interface EncodedAudioChunkMetadataJs {
|
|
1650
|
+
/** Decoder configuration from encoder */
|
|
1651
|
+
decoderConfig?: AudioDecoderConfigJS
|
|
1652
|
+
}
|
|
1653
|
+
|
|
942
1654
|
/** Type of encoded audio chunk */
|
|
943
1655
|
export type EncodedAudioChunkType = /** Key chunk - can be decoded independently */
|
|
944
1656
|
| 'key'
|
|
@@ -955,6 +1667,14 @@ export interface EncodedVideoChunkMetadata {
|
|
|
955
1667
|
alphaSideData?: Uint8Array
|
|
956
1668
|
}
|
|
957
1669
|
|
|
1670
|
+
/** JavaScript-facing metadata type for video chunks */
|
|
1671
|
+
export interface EncodedVideoChunkMetadataJs {
|
|
1672
|
+
/** Decoder configuration from encoder */
|
|
1673
|
+
decoderConfig?: VideoDecoderConfigJS
|
|
1674
|
+
/** SVC output metadata */
|
|
1675
|
+
svc?: SvcOutputMetadataJS
|
|
1676
|
+
}
|
|
1677
|
+
|
|
958
1678
|
/** Type of encoded video chunk */
|
|
959
1679
|
export type EncodedVideoChunkType = /** Keyframe - can be decoded independently */
|
|
960
1680
|
| 'key'
|
|
@@ -1030,6 +1750,78 @@ export type LatencyMode = /** Optimize for quality (default) */
|
|
|
1030
1750
|
/** Optimize for low latency */
|
|
1031
1751
|
| 'realtime'
|
|
1032
1752
|
|
|
1753
|
+
/** Audio track configuration for MKV muxer */
|
|
1754
|
+
export interface MkvAudioTrackConfig {
|
|
1755
|
+
/** Codec string (e.g., "mp4a.40.2", "opus", "flac", "vorbis", "ac3") */
|
|
1756
|
+
codec: string
|
|
1757
|
+
/** Sample rate in Hz */
|
|
1758
|
+
sampleRate: number
|
|
1759
|
+
/** Number of audio channels */
|
|
1760
|
+
numberOfChannels: number
|
|
1761
|
+
/** Codec-specific description data */
|
|
1762
|
+
description?: Uint8Array
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
/** MKV muxer options */
|
|
1766
|
+
export interface MkvMuxerOptions {
|
|
1767
|
+
/** Enable live streaming mode */
|
|
1768
|
+
live?: boolean
|
|
1769
|
+
/** Enable streaming output mode */
|
|
1770
|
+
streaming?: StreamingMuxerOptions
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
/** Video track configuration for MKV muxer */
|
|
1774
|
+
export interface MkvVideoTrackConfig {
|
|
1775
|
+
/** Codec string (e.g., "avc1.42001E", "hev1.1.6.L93.B0", "vp09.00.10.08", "av01.0.04M.08") */
|
|
1776
|
+
codec: string
|
|
1777
|
+
/** Video width in pixels */
|
|
1778
|
+
width: number
|
|
1779
|
+
/** Video height in pixels */
|
|
1780
|
+
height: number
|
|
1781
|
+
/** Codec-specific description data */
|
|
1782
|
+
description?: Uint8Array
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
/** Audio track configuration for MP4 muxer */
|
|
1786
|
+
export interface Mp4AudioTrackConfig {
|
|
1787
|
+
/** Codec string (e.g., "mp4a.40.2" for AAC-LC, "opus") */
|
|
1788
|
+
codec: string
|
|
1789
|
+
/** Sample rate in Hz */
|
|
1790
|
+
sampleRate: number
|
|
1791
|
+
/** Number of audio channels */
|
|
1792
|
+
numberOfChannels: number
|
|
1793
|
+
/** Codec-specific description data (esds for AAC, etc.) */
|
|
1794
|
+
description?: Uint8Array
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
/** MP4 muxer options */
|
|
1798
|
+
export interface Mp4MuxerOptions {
|
|
1799
|
+
/**
|
|
1800
|
+
* Move moov atom to beginning for better streaming (default: false)
|
|
1801
|
+
* Note: Not compatible with streaming output mode
|
|
1802
|
+
*/
|
|
1803
|
+
fastStart?: boolean
|
|
1804
|
+
/**
|
|
1805
|
+
* Use fragmented MP4 for streaming output
|
|
1806
|
+
* When true, uses frag_keyframe+empty_moov+default_base_moof
|
|
1807
|
+
*/
|
|
1808
|
+
fragmented?: boolean
|
|
1809
|
+
/** Enable streaming output mode */
|
|
1810
|
+
streaming?: StreamingMuxerOptions
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
/** Video track configuration for MP4 muxer */
|
|
1814
|
+
export interface Mp4VideoTrackConfig {
|
|
1815
|
+
/** Codec string (e.g., "avc1.42001E", "hev1.1.6.L93.B0", "av01.0.04M.08") */
|
|
1816
|
+
codec: string
|
|
1817
|
+
/** Video width in pixels */
|
|
1818
|
+
width: number
|
|
1819
|
+
/** Video height in pixels */
|
|
1820
|
+
height: number
|
|
1821
|
+
/** Codec-specific description data (avcC/hvcC/av1C from encoder metadata) */
|
|
1822
|
+
description?: Uint8Array
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1033
1825
|
/** Opus application mode (W3C WebCodecs Opus Registration) */
|
|
1034
1826
|
export type OpusApplication = /** Optimize for VoIP (speech intelligibility) */
|
|
1035
1827
|
| 'voip'
|
|
@@ -1094,12 +1886,24 @@ export interface PlaneLayout {
|
|
|
1094
1886
|
*/
|
|
1095
1887
|
export declare function resetHardwareFallbackState(): void
|
|
1096
1888
|
|
|
1889
|
+
/** Streaming mode options for muxers */
|
|
1890
|
+
export interface StreamingMuxerOptions {
|
|
1891
|
+
/** Buffer capacity for streaming output (default: 256KB) */
|
|
1892
|
+
bufferCapacity?: number
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1097
1895
|
/** SVC (Scalable Video Coding) output metadata (W3C WebCodecs spec) */
|
|
1098
1896
|
export interface SvcOutputMetadata {
|
|
1099
1897
|
/** Temporal layer ID for this frame */
|
|
1100
1898
|
temporalLayerId?: number
|
|
1101
1899
|
}
|
|
1102
1900
|
|
|
1901
|
+
/** JavaScript-facing SVC metadata */
|
|
1902
|
+
export interface SvcOutputMetadataJs {
|
|
1903
|
+
/** Temporal layer ID */
|
|
1904
|
+
temporalLayerId?: number
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1103
1907
|
/** Video color primaries (W3C WebCodecs spec) */
|
|
1104
1908
|
export type VideoColorPrimaries = /** BT.709 / sRGB primaries */
|
|
1105
1909
|
| 'bt709'
|
|
@@ -1119,6 +1923,18 @@ export interface VideoDecoderAddEventListenerOptions {
|
|
|
1119
1923
|
passive?: boolean
|
|
1120
1924
|
}
|
|
1121
1925
|
|
|
1926
|
+
/** JavaScript-facing decoder config type */
|
|
1927
|
+
export interface VideoDecoderConfigJs {
|
|
1928
|
+
/** Codec string */
|
|
1929
|
+
codec?: string
|
|
1930
|
+
/** Codec-specific description */
|
|
1931
|
+
description?: Uint8Array
|
|
1932
|
+
/** Coded width */
|
|
1933
|
+
codedWidth?: number
|
|
1934
|
+
/** Coded height */
|
|
1935
|
+
codedHeight?: number
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1122
1938
|
/** Decoder configuration output (for passing to decoder) */
|
|
1123
1939
|
export interface VideoDecoderConfigOutput {
|
|
1124
1940
|
/** Codec string */
|
|
@@ -1325,3 +2141,35 @@ export type VideoTransferCharacteristics = /** BT.709 transfer */
|
|
|
1325
2141
|
| 'pq'
|
|
1326
2142
|
/** Hybrid Log-Gamma (HDR) */
|
|
1327
2143
|
| 'hlg'
|
|
2144
|
+
|
|
2145
|
+
/** Audio track configuration for WebM muxer */
|
|
2146
|
+
export interface WebMAudioTrackConfig {
|
|
2147
|
+
/** Codec string (e.g., "opus", "vorbis") */
|
|
2148
|
+
codec: string
|
|
2149
|
+
/** Sample rate in Hz */
|
|
2150
|
+
sampleRate: number
|
|
2151
|
+
/** Number of audio channels */
|
|
2152
|
+
numberOfChannels: number
|
|
2153
|
+
/** Codec-specific description data */
|
|
2154
|
+
description?: Uint8Array
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
/** WebM muxer options */
|
|
2158
|
+
export interface WebMMuxerOptions {
|
|
2159
|
+
/** Enable live streaming mode (cluster-at-a-time output) */
|
|
2160
|
+
live?: boolean
|
|
2161
|
+
/** Enable streaming output mode */
|
|
2162
|
+
streaming?: StreamingMuxerOptions
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
/** Video track configuration for WebM muxer */
|
|
2166
|
+
export interface WebMVideoTrackConfig {
|
|
2167
|
+
/** Codec string (e.g., "vp8", "vp09.00.10.08", "av01.0.04M.08") */
|
|
2168
|
+
codec: string
|
|
2169
|
+
/** Video width in pixels */
|
|
2170
|
+
width: number
|
|
2171
|
+
/** Video height in pixels */
|
|
2172
|
+
height: number
|
|
2173
|
+
/** Codec-specific description data */
|
|
2174
|
+
description?: Uint8Array
|
|
2175
|
+
}
|
package/index.js
CHANGED
|
@@ -78,12 +78,12 @@ function requireNative() {
|
|
|
78
78
|
const binding = require('@napi-rs/webcodecs-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@napi-rs/webcodecs-android-arm64/package.json').version
|
|
80
80
|
if (
|
|
81
|
-
bindingPackageVersion !== '
|
|
81
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
82
82
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
83
83
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
84
84
|
) {
|
|
85
85
|
throw new Error(
|
|
86
|
-
`Native binding package version mismatch, expected
|
|
86
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
87
87
|
)
|
|
88
88
|
}
|
|
89
89
|
return binding
|
|
@@ -100,12 +100,12 @@ function requireNative() {
|
|
|
100
100
|
const binding = require('@napi-rs/webcodecs-android-arm-eabi')
|
|
101
101
|
const bindingPackageVersion = require('@napi-rs/webcodecs-android-arm-eabi/package.json').version
|
|
102
102
|
if (
|
|
103
|
-
bindingPackageVersion !== '
|
|
103
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
104
104
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
105
105
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
106
106
|
) {
|
|
107
107
|
throw new Error(
|
|
108
|
-
`Native binding package version mismatch, expected
|
|
108
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
109
109
|
)
|
|
110
110
|
}
|
|
111
111
|
return binding
|
|
@@ -130,12 +130,12 @@ function requireNative() {
|
|
|
130
130
|
const binding = require('@napi-rs/webcodecs-win32-x64-gnu')
|
|
131
131
|
const bindingPackageVersion = require('@napi-rs/webcodecs-win32-x64-gnu/package.json').version
|
|
132
132
|
if (
|
|
133
|
-
bindingPackageVersion !== '
|
|
133
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
134
134
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
135
135
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
136
136
|
) {
|
|
137
137
|
throw new Error(
|
|
138
|
-
`Native binding package version mismatch, expected
|
|
138
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
139
139
|
)
|
|
140
140
|
}
|
|
141
141
|
return binding
|
|
@@ -152,12 +152,12 @@ function requireNative() {
|
|
|
152
152
|
const binding = require('@napi-rs/webcodecs-win32-x64-msvc')
|
|
153
153
|
const bindingPackageVersion = require('@napi-rs/webcodecs-win32-x64-msvc/package.json').version
|
|
154
154
|
if (
|
|
155
|
-
bindingPackageVersion !== '
|
|
155
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
156
156
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
157
157
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
158
158
|
) {
|
|
159
159
|
throw new Error(
|
|
160
|
-
`Native binding package version mismatch, expected
|
|
160
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
161
161
|
)
|
|
162
162
|
}
|
|
163
163
|
return binding
|
|
@@ -175,12 +175,12 @@ function requireNative() {
|
|
|
175
175
|
const binding = require('@napi-rs/webcodecs-win32-ia32-msvc')
|
|
176
176
|
const bindingPackageVersion = require('@napi-rs/webcodecs-win32-ia32-msvc/package.json').version
|
|
177
177
|
if (
|
|
178
|
-
bindingPackageVersion !== '
|
|
178
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
179
179
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
180
180
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
181
181
|
) {
|
|
182
182
|
throw new Error(
|
|
183
|
-
`Native binding package version mismatch, expected
|
|
183
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
184
184
|
)
|
|
185
185
|
}
|
|
186
186
|
return binding
|
|
@@ -197,12 +197,12 @@ function requireNative() {
|
|
|
197
197
|
const binding = require('@napi-rs/webcodecs-win32-arm64-msvc')
|
|
198
198
|
const bindingPackageVersion = require('@napi-rs/webcodecs-win32-arm64-msvc/package.json').version
|
|
199
199
|
if (
|
|
200
|
-
bindingPackageVersion !== '
|
|
200
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
201
201
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
202
202
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
203
203
|
) {
|
|
204
204
|
throw new Error(
|
|
205
|
-
`Native binding package version mismatch, expected
|
|
205
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
206
206
|
)
|
|
207
207
|
}
|
|
208
208
|
return binding
|
|
@@ -222,12 +222,12 @@ function requireNative() {
|
|
|
222
222
|
const binding = require('@napi-rs/webcodecs-darwin-universal')
|
|
223
223
|
const bindingPackageVersion = require('@napi-rs/webcodecs-darwin-universal/package.json').version
|
|
224
224
|
if (
|
|
225
|
-
bindingPackageVersion !== '
|
|
225
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
226
226
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
227
227
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
228
228
|
) {
|
|
229
229
|
throw new Error(
|
|
230
|
-
`Native binding package version mismatch, expected
|
|
230
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
231
231
|
)
|
|
232
232
|
}
|
|
233
233
|
return binding
|
|
@@ -244,12 +244,12 @@ function requireNative() {
|
|
|
244
244
|
const binding = require('@napi-rs/webcodecs-darwin-x64')
|
|
245
245
|
const bindingPackageVersion = require('@napi-rs/webcodecs-darwin-x64/package.json').version
|
|
246
246
|
if (
|
|
247
|
-
bindingPackageVersion !== '
|
|
247
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
248
248
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
249
249
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
250
250
|
) {
|
|
251
251
|
throw new Error(
|
|
252
|
-
`Native binding package version mismatch, expected
|
|
252
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
253
253
|
)
|
|
254
254
|
}
|
|
255
255
|
return binding
|
|
@@ -266,12 +266,12 @@ function requireNative() {
|
|
|
266
266
|
const binding = require('@napi-rs/webcodecs-darwin-arm64')
|
|
267
267
|
const bindingPackageVersion = require('@napi-rs/webcodecs-darwin-arm64/package.json').version
|
|
268
268
|
if (
|
|
269
|
-
bindingPackageVersion !== '
|
|
269
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
270
270
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
271
271
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
272
272
|
) {
|
|
273
273
|
throw new Error(
|
|
274
|
-
`Native binding package version mismatch, expected
|
|
274
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
275
275
|
)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
@@ -292,12 +292,12 @@ function requireNative() {
|
|
|
292
292
|
const binding = require('@napi-rs/webcodecs-freebsd-x64')
|
|
293
293
|
const bindingPackageVersion = require('@napi-rs/webcodecs-freebsd-x64/package.json').version
|
|
294
294
|
if (
|
|
295
|
-
bindingPackageVersion !== '
|
|
295
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
296
296
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
297
297
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
298
298
|
) {
|
|
299
299
|
throw new Error(
|
|
300
|
-
`Native binding package version mismatch, expected
|
|
300
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
301
301
|
)
|
|
302
302
|
}
|
|
303
303
|
return binding
|
|
@@ -314,12 +314,12 @@ function requireNative() {
|
|
|
314
314
|
const binding = require('@napi-rs/webcodecs-freebsd-arm64')
|
|
315
315
|
const bindingPackageVersion = require('@napi-rs/webcodecs-freebsd-arm64/package.json').version
|
|
316
316
|
if (
|
|
317
|
-
bindingPackageVersion !== '
|
|
317
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
318
318
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
319
319
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
320
320
|
) {
|
|
321
321
|
throw new Error(
|
|
322
|
-
`Native binding package version mismatch, expected
|
|
322
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
323
323
|
)
|
|
324
324
|
}
|
|
325
325
|
return binding
|
|
@@ -341,12 +341,12 @@ function requireNative() {
|
|
|
341
341
|
const binding = require('@napi-rs/webcodecs-linux-x64-musl')
|
|
342
342
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-x64-musl/package.json').version
|
|
343
343
|
if (
|
|
344
|
-
bindingPackageVersion !== '
|
|
344
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
345
345
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
346
346
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
347
347
|
) {
|
|
348
348
|
throw new Error(
|
|
349
|
-
`Native binding package version mismatch, expected
|
|
349
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
350
350
|
)
|
|
351
351
|
}
|
|
352
352
|
return binding
|
|
@@ -363,12 +363,12 @@ function requireNative() {
|
|
|
363
363
|
const binding = require('@napi-rs/webcodecs-linux-x64-gnu')
|
|
364
364
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-x64-gnu/package.json').version
|
|
365
365
|
if (
|
|
366
|
-
bindingPackageVersion !== '
|
|
366
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
367
367
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
368
368
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
369
369
|
) {
|
|
370
370
|
throw new Error(
|
|
371
|
-
`Native binding package version mismatch, expected
|
|
371
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
372
372
|
)
|
|
373
373
|
}
|
|
374
374
|
return binding
|
|
@@ -387,12 +387,12 @@ function requireNative() {
|
|
|
387
387
|
const binding = require('@napi-rs/webcodecs-linux-arm64-musl')
|
|
388
388
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm64-musl/package.json').version
|
|
389
389
|
if (
|
|
390
|
-
bindingPackageVersion !== '
|
|
390
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
391
391
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
392
392
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
393
393
|
) {
|
|
394
394
|
throw new Error(
|
|
395
|
-
`Native binding package version mismatch, expected
|
|
395
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
396
396
|
)
|
|
397
397
|
}
|
|
398
398
|
return binding
|
|
@@ -409,12 +409,12 @@ function requireNative() {
|
|
|
409
409
|
const binding = require('@napi-rs/webcodecs-linux-arm64-gnu')
|
|
410
410
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm64-gnu/package.json').version
|
|
411
411
|
if (
|
|
412
|
-
bindingPackageVersion !== '
|
|
412
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
413
413
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
414
414
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
415
415
|
) {
|
|
416
416
|
throw new Error(
|
|
417
|
-
`Native binding package version mismatch, expected
|
|
417
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
418
418
|
)
|
|
419
419
|
}
|
|
420
420
|
return binding
|
|
@@ -433,12 +433,12 @@ function requireNative() {
|
|
|
433
433
|
const binding = require('@napi-rs/webcodecs-linux-arm-musleabihf')
|
|
434
434
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm-musleabihf/package.json').version
|
|
435
435
|
if (
|
|
436
|
-
bindingPackageVersion !== '
|
|
436
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
437
437
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
438
438
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
439
439
|
) {
|
|
440
440
|
throw new Error(
|
|
441
|
-
`Native binding package version mismatch, expected
|
|
441
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
442
442
|
)
|
|
443
443
|
}
|
|
444
444
|
return binding
|
|
@@ -455,12 +455,12 @@ function requireNative() {
|
|
|
455
455
|
const binding = require('@napi-rs/webcodecs-linux-arm-gnueabihf')
|
|
456
456
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-arm-gnueabihf/package.json').version
|
|
457
457
|
if (
|
|
458
|
-
bindingPackageVersion !== '
|
|
458
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
459
459
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
460
460
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
461
461
|
) {
|
|
462
462
|
throw new Error(
|
|
463
|
-
`Native binding package version mismatch, expected
|
|
463
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
464
464
|
)
|
|
465
465
|
}
|
|
466
466
|
return binding
|
|
@@ -479,12 +479,12 @@ function requireNative() {
|
|
|
479
479
|
const binding = require('@napi-rs/webcodecs-linux-loong64-musl')
|
|
480
480
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-loong64-musl/package.json').version
|
|
481
481
|
if (
|
|
482
|
-
bindingPackageVersion !== '
|
|
482
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
483
483
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
484
484
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
485
485
|
) {
|
|
486
486
|
throw new Error(
|
|
487
|
-
`Native binding package version mismatch, expected
|
|
487
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
488
488
|
)
|
|
489
489
|
}
|
|
490
490
|
return binding
|
|
@@ -501,12 +501,12 @@ function requireNative() {
|
|
|
501
501
|
const binding = require('@napi-rs/webcodecs-linux-loong64-gnu')
|
|
502
502
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-loong64-gnu/package.json').version
|
|
503
503
|
if (
|
|
504
|
-
bindingPackageVersion !== '
|
|
504
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
505
505
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
506
506
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
507
507
|
) {
|
|
508
508
|
throw new Error(
|
|
509
|
-
`Native binding package version mismatch, expected
|
|
509
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
510
510
|
)
|
|
511
511
|
}
|
|
512
512
|
return binding
|
|
@@ -525,12 +525,12 @@ function requireNative() {
|
|
|
525
525
|
const binding = require('@napi-rs/webcodecs-linux-riscv64-musl')
|
|
526
526
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-riscv64-musl/package.json').version
|
|
527
527
|
if (
|
|
528
|
-
bindingPackageVersion !== '
|
|
528
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
529
529
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
530
530
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
531
531
|
) {
|
|
532
532
|
throw new Error(
|
|
533
|
-
`Native binding package version mismatch, expected
|
|
533
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
534
534
|
)
|
|
535
535
|
}
|
|
536
536
|
return binding
|
|
@@ -547,12 +547,12 @@ function requireNative() {
|
|
|
547
547
|
const binding = require('@napi-rs/webcodecs-linux-riscv64-gnu')
|
|
548
548
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-riscv64-gnu/package.json').version
|
|
549
549
|
if (
|
|
550
|
-
bindingPackageVersion !== '
|
|
550
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
551
551
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
552
552
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
553
553
|
) {
|
|
554
554
|
throw new Error(
|
|
555
|
-
`Native binding package version mismatch, expected
|
|
555
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
556
556
|
)
|
|
557
557
|
}
|
|
558
558
|
return binding
|
|
@@ -570,12 +570,12 @@ function requireNative() {
|
|
|
570
570
|
const binding = require('@napi-rs/webcodecs-linux-ppc64-gnu')
|
|
571
571
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-ppc64-gnu/package.json').version
|
|
572
572
|
if (
|
|
573
|
-
bindingPackageVersion !== '
|
|
573
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
574
574
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
575
575
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
576
576
|
) {
|
|
577
577
|
throw new Error(
|
|
578
|
-
`Native binding package version mismatch, expected
|
|
578
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
579
579
|
)
|
|
580
580
|
}
|
|
581
581
|
return binding
|
|
@@ -592,12 +592,12 @@ function requireNative() {
|
|
|
592
592
|
const binding = require('@napi-rs/webcodecs-linux-s390x-gnu')
|
|
593
593
|
const bindingPackageVersion = require('@napi-rs/webcodecs-linux-s390x-gnu/package.json').version
|
|
594
594
|
if (
|
|
595
|
-
bindingPackageVersion !== '
|
|
595
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
596
596
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
597
597
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
598
598
|
) {
|
|
599
599
|
throw new Error(
|
|
600
|
-
`Native binding package version mismatch, expected
|
|
600
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
601
601
|
)
|
|
602
602
|
}
|
|
603
603
|
return binding
|
|
@@ -618,12 +618,12 @@ function requireNative() {
|
|
|
618
618
|
const binding = require('@napi-rs/webcodecs-openharmony-arm64')
|
|
619
619
|
const bindingPackageVersion = require('@napi-rs/webcodecs-openharmony-arm64/package.json').version
|
|
620
620
|
if (
|
|
621
|
-
bindingPackageVersion !== '
|
|
621
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
622
622
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
623
623
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
624
624
|
) {
|
|
625
625
|
throw new Error(
|
|
626
|
-
`Native binding package version mismatch, expected
|
|
626
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
627
627
|
)
|
|
628
628
|
}
|
|
629
629
|
return binding
|
|
@@ -640,12 +640,12 @@ function requireNative() {
|
|
|
640
640
|
const binding = require('@napi-rs/webcodecs-openharmony-x64')
|
|
641
641
|
const bindingPackageVersion = require('@napi-rs/webcodecs-openharmony-x64/package.json').version
|
|
642
642
|
if (
|
|
643
|
-
bindingPackageVersion !== '
|
|
643
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
644
644
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
645
645
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
646
646
|
) {
|
|
647
647
|
throw new Error(
|
|
648
|
-
`Native binding package version mismatch, expected
|
|
648
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
649
649
|
)
|
|
650
650
|
}
|
|
651
651
|
return binding
|
|
@@ -662,12 +662,12 @@ function requireNative() {
|
|
|
662
662
|
const binding = require('@napi-rs/webcodecs-openharmony-arm')
|
|
663
663
|
const bindingPackageVersion = require('@napi-rs/webcodecs-openharmony-arm/package.json').version
|
|
664
664
|
if (
|
|
665
|
-
bindingPackageVersion !== '
|
|
665
|
+
bindingPackageVersion !== '1.1.0' &&
|
|
666
666
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
667
667
|
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
668
668
|
) {
|
|
669
669
|
throw new Error(
|
|
670
|
-
`Native binding package version mismatch, expected
|
|
670
|
+
`Native binding package version mismatch, expected 1.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
671
671
|
)
|
|
672
672
|
}
|
|
673
673
|
return binding
|
|
@@ -741,10 +741,16 @@ module.exports.ImageDecoder = nativeBinding.ImageDecoder
|
|
|
741
741
|
module.exports.ImageDecodeResult = nativeBinding.ImageDecodeResult
|
|
742
742
|
module.exports.ImageTrack = nativeBinding.ImageTrack
|
|
743
743
|
module.exports.ImageTrackList = nativeBinding.ImageTrackList
|
|
744
|
+
module.exports.MkvDemuxer = nativeBinding.MkvDemuxer
|
|
745
|
+
module.exports.MkvMuxer = nativeBinding.MkvMuxer
|
|
746
|
+
module.exports.Mp4Demuxer = nativeBinding.Mp4Demuxer
|
|
747
|
+
module.exports.Mp4Muxer = nativeBinding.Mp4Muxer
|
|
744
748
|
module.exports.VideoColorSpace = nativeBinding.VideoColorSpace
|
|
745
749
|
module.exports.VideoDecoder = nativeBinding.VideoDecoder
|
|
746
750
|
module.exports.VideoEncoder = nativeBinding.VideoEncoder
|
|
747
751
|
module.exports.VideoFrame = nativeBinding.VideoFrame
|
|
752
|
+
module.exports.WebMDemuxer = nativeBinding.WebMDemuxer
|
|
753
|
+
module.exports.WebMMuxer = nativeBinding.WebMMuxer
|
|
748
754
|
module.exports.AacBitstreamFormat = nativeBinding.AacBitstreamFormat
|
|
749
755
|
module.exports.AlphaOption = nativeBinding.AlphaOption
|
|
750
756
|
module.exports.AudioSampleFormat = nativeBinding.AudioSampleFormat
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napi-rs/webcodecs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "WebCodecs API implementation for Node.js using FFmpeg",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"N-API",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"prepublishOnly": "napi prepublish -t npm",
|
|
56
56
|
"test": "ava",
|
|
57
57
|
"typecheck": "tsc -b tsconfig.json",
|
|
58
|
+
"preversion": "napi build --platform && git add .",
|
|
58
59
|
"version": "napi version"
|
|
59
60
|
},
|
|
60
61
|
"lint-staged": {
|
|
@@ -150,14 +151,14 @@
|
|
|
150
151
|
"registry": "https://registry.npmjs.org/"
|
|
151
152
|
},
|
|
152
153
|
"optionalDependencies": {
|
|
153
|
-
"@napi-rs/webcodecs-darwin-x64": "1.
|
|
154
|
-
"@napi-rs/webcodecs-darwin-arm64": "1.
|
|
155
|
-
"@napi-rs/webcodecs-linux-x64-gnu": "1.
|
|
156
|
-
"@napi-rs/webcodecs-linux-x64-musl": "1.
|
|
157
|
-
"@napi-rs/webcodecs-win32-x64-msvc": "1.
|
|
158
|
-
"@napi-rs/webcodecs-linux-arm64-gnu": "1.
|
|
159
|
-
"@napi-rs/webcodecs-linux-arm64-musl": "1.
|
|
160
|
-
"@napi-rs/webcodecs-win32-arm64-msvc": "1.
|
|
161
|
-
"@napi-rs/webcodecs-linux-arm-gnueabihf": "1.
|
|
154
|
+
"@napi-rs/webcodecs-darwin-x64": "1.1.0",
|
|
155
|
+
"@napi-rs/webcodecs-darwin-arm64": "1.1.0",
|
|
156
|
+
"@napi-rs/webcodecs-linux-x64-gnu": "1.1.0",
|
|
157
|
+
"@napi-rs/webcodecs-linux-x64-musl": "1.1.0",
|
|
158
|
+
"@napi-rs/webcodecs-win32-x64-msvc": "1.1.0",
|
|
159
|
+
"@napi-rs/webcodecs-linux-arm64-gnu": "1.1.0",
|
|
160
|
+
"@napi-rs/webcodecs-linux-arm64-musl": "1.1.0",
|
|
161
|
+
"@napi-rs/webcodecs-win32-arm64-msvc": "1.1.0",
|
|
162
|
+
"@napi-rs/webcodecs-linux-arm-gnueabihf": "1.1.0"
|
|
162
163
|
}
|
|
163
164
|
}
|