node-av 2.0.0 → 2.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 +10 -2
- package/binding.gyp +12 -0
- package/dist/api/bitstream-filter.d.ts +132 -0
- package/dist/api/bitstream-filter.js +198 -0
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +145 -0
- package/dist/api/decoder.js +225 -0
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/encoder.d.ts +206 -0
- package/dist/api/encoder.js +315 -0
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter-presets.d.ts +92 -0
- package/dist/api/filter-presets.js +92 -0
- package/dist/api/filter-presets.js.map +1 -1
- package/dist/api/filter.d.ts +225 -0
- package/dist/api/filter.js +363 -0
- package/dist/api/filter.js.map +1 -1
- package/dist/api/hardware.d.ts +17 -0
- package/dist/api/hardware.js +17 -0
- package/dist/api/hardware.js.map +1 -1
- package/dist/api/io-stream.d.ts +6 -0
- package/dist/api/io-stream.js +2 -0
- package/dist/api/io-stream.js.map +1 -1
- package/dist/api/media-input.d.ts +207 -1
- package/dist/api/media-input.js +353 -0
- package/dist/api/media-input.js.map +1 -1
- package/dist/api/media-output.d.ts +132 -1
- package/dist/api/media-output.js +339 -0
- package/dist/api/media-output.js.map +1 -1
- package/dist/api/pipeline.d.ts +65 -0
- package/dist/api/pipeline.js +61 -0
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/types.d.ts +7 -0
- package/dist/api/utils.js +2 -0
- package/dist/api/utils.js.map +1 -1
- package/dist/lib/audio-fifo.d.ts +103 -0
- package/dist/lib/audio-fifo.js +109 -0
- package/dist/lib/audio-fifo.js.map +1 -1
- package/dist/lib/binding.d.ts +1 -0
- package/dist/lib/binding.js.map +1 -1
- package/dist/lib/bitstream-filter-context.d.ts +79 -0
- package/dist/lib/bitstream-filter-context.js +83 -0
- package/dist/lib/bitstream-filter-context.js.map +1 -1
- package/dist/lib/bitstream-filter.d.ts +2 -0
- package/dist/lib/bitstream-filter.js +2 -0
- package/dist/lib/bitstream-filter.js.map +1 -1
- package/dist/lib/codec-context.d.ts +168 -0
- package/dist/lib/codec-context.js +178 -0
- package/dist/lib/codec-context.js.map +1 -1
- package/dist/lib/codec-parameters.d.ts +3 -0
- package/dist/lib/codec-parameters.js +3 -0
- package/dist/lib/codec-parameters.js.map +1 -1
- package/dist/lib/codec-parser.d.ts +6 -0
- package/dist/lib/codec-parser.js +6 -0
- package/dist/lib/codec-parser.js.map +1 -1
- package/dist/lib/codec.d.ts +12 -0
- package/dist/lib/codec.js +12 -0
- package/dist/lib/codec.js.map +1 -1
- package/dist/lib/dictionary.d.ts +16 -0
- package/dist/lib/dictionary.js +16 -0
- package/dist/lib/dictionary.js.map +1 -1
- package/dist/lib/error.d.ts +8 -0
- package/dist/lib/error.js +9 -0
- package/dist/lib/error.js.map +1 -1
- package/dist/lib/filter-context.d.ts +100 -0
- package/dist/lib/filter-context.js +104 -0
- package/dist/lib/filter-context.js.map +1 -1
- package/dist/lib/filter-graph.d.ts +80 -0
- package/dist/lib/filter-graph.js +84 -0
- package/dist/lib/filter-graph.js.map +1 -1
- package/dist/lib/filter-inout.d.ts +1 -0
- package/dist/lib/filter-inout.js +1 -0
- package/dist/lib/filter-inout.js.map +1 -1
- package/dist/lib/filter.d.ts +2 -0
- package/dist/lib/filter.js +2 -0
- package/dist/lib/filter.js.map +1 -1
- package/dist/lib/format-context.d.ts +338 -2
- package/dist/lib/format-context.js +355 -3
- package/dist/lib/format-context.js.map +1 -1
- package/dist/lib/frame.d.ts +41 -0
- package/dist/lib/frame.js +43 -0
- package/dist/lib/frame.js.map +1 -1
- package/dist/lib/hardware-device-context.d.ts +8 -0
- package/dist/lib/hardware-device-context.js +8 -0
- package/dist/lib/hardware-device-context.js.map +1 -1
- package/dist/lib/hardware-frames-context.d.ts +55 -0
- package/dist/lib/hardware-frames-context.js +57 -0
- package/dist/lib/hardware-frames-context.js.map +1 -1
- package/dist/lib/input-format.d.ts +43 -3
- package/dist/lib/input-format.js +48 -0
- package/dist/lib/input-format.js.map +1 -1
- package/dist/lib/io-context.d.ts +212 -0
- package/dist/lib/io-context.js +228 -0
- package/dist/lib/io-context.js.map +1 -1
- package/dist/lib/log.d.ts +2 -0
- package/dist/lib/log.js +2 -0
- package/dist/lib/log.js.map +1 -1
- package/dist/lib/native-types.d.ts +39 -1
- package/dist/lib/option.d.ts +90 -0
- package/dist/lib/option.js +97 -0
- package/dist/lib/option.js.map +1 -1
- package/dist/lib/output-format.d.ts +4 -0
- package/dist/lib/output-format.js +4 -0
- package/dist/lib/output-format.js.map +1 -1
- package/dist/lib/packet.d.ts +7 -0
- package/dist/lib/packet.js +7 -0
- package/dist/lib/packet.js.map +1 -1
- package/dist/lib/rational.d.ts +1 -0
- package/dist/lib/rational.js +1 -0
- package/dist/lib/rational.js.map +1 -1
- package/dist/lib/software-resample-context.d.ts +64 -0
- package/dist/lib/software-resample-context.js +66 -0
- package/dist/lib/software-resample-context.js.map +1 -1
- package/dist/lib/software-scale-context.d.ts +98 -0
- package/dist/lib/software-scale-context.js +102 -0
- package/dist/lib/software-scale-context.js.map +1 -1
- package/dist/lib/stream.d.ts +1 -0
- package/dist/lib/stream.js +1 -0
- package/dist/lib/stream.js.map +1 -1
- package/dist/lib/utilities.d.ts +60 -0
- package/dist/lib/utilities.js +60 -0
- package/dist/lib/utilities.js.map +1 -1
- package/package.json +13 -13
|
@@ -85,11 +85,17 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
85
85
|
* Direct mapping to swr_alloc_set_opts2().
|
|
86
86
|
*
|
|
87
87
|
* @param outChLayout - Output channel layout
|
|
88
|
+
*
|
|
88
89
|
* @param outSampleFmt - Output sample format
|
|
90
|
+
*
|
|
89
91
|
* @param outSampleRate - Output sample rate in Hz
|
|
92
|
+
*
|
|
90
93
|
* @param inChLayout - Input channel layout
|
|
94
|
+
*
|
|
91
95
|
* @param inSampleFmt - Input sample format
|
|
96
|
+
*
|
|
92
97
|
* @param inSampleRate - Input sample rate in Hz
|
|
98
|
+
*
|
|
93
99
|
* @returns 0 on success, negative AVERROR on error:
|
|
94
100
|
* - AVERROR_EINVAL: Invalid parameters
|
|
95
101
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -183,9 +189,13 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
183
189
|
* Direct mapping to swr_convert().
|
|
184
190
|
*
|
|
185
191
|
* @param outBuffer - Output sample buffers (one per channel for planar)
|
|
192
|
+
*
|
|
186
193
|
* @param outCount - Maximum output samples per channel
|
|
194
|
+
*
|
|
187
195
|
* @param inBuffer - Input sample buffers (one per channel for planar)
|
|
196
|
+
*
|
|
188
197
|
* @param inCount - Input samples per channel
|
|
198
|
+
*
|
|
189
199
|
* @returns Number of output samples per channel, negative AVERROR on error:
|
|
190
200
|
* - AVERROR_EINVAL: Invalid parameters
|
|
191
201
|
* - AVERROR_INPUT_CHANGED: Input format changed
|
|
@@ -212,6 +222,46 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
212
222
|
* @see {@link convertFrame} For frame-based conversion
|
|
213
223
|
*/
|
|
214
224
|
convert(outBuffer: Buffer[] | null, outCount: number, inBuffer: Buffer[] | null, inCount: number): Promise<number>;
|
|
225
|
+
/**
|
|
226
|
+
* Convert audio samples synchronously.
|
|
227
|
+
* Synchronous version of convert.
|
|
228
|
+
*
|
|
229
|
+
* Converts audio between formats, sample rates, and channel layouts.
|
|
230
|
+
* Can handle format conversion, resampling, and channel mixing.
|
|
231
|
+
*
|
|
232
|
+
* Direct mapping to swr_convert().
|
|
233
|
+
*
|
|
234
|
+
* @param outBuffer - Output buffer array (one per channel, null to get delay)
|
|
235
|
+
*
|
|
236
|
+
* @param outCount - Number of output samples space per channel
|
|
237
|
+
*
|
|
238
|
+
* @param inBuffer - Input buffer array (one per channel, null to flush)
|
|
239
|
+
*
|
|
240
|
+
* @param inCount - Number of input samples per channel
|
|
241
|
+
*
|
|
242
|
+
* @returns Number of samples output per channel, or negative AVERROR:
|
|
243
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
244
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```typescript
|
|
248
|
+
* import { FFmpegError } from 'node-av';
|
|
249
|
+
*
|
|
250
|
+
* // Convert stereo float to mono s16
|
|
251
|
+
* const inBuffers = [leftChannel, rightChannel];
|
|
252
|
+
* const outBuffers = [monoOutput];
|
|
253
|
+
*
|
|
254
|
+
* const samples = resampler.convertSync(
|
|
255
|
+
* outBuffers, 1024, // Output: 1024 samples max
|
|
256
|
+
* inBuffers, 1024 // Input: 1024 samples
|
|
257
|
+
* );
|
|
258
|
+
* FFmpegError.throwIfError(samples, 'convertSync');
|
|
259
|
+
* console.log(`Converted ${samples} samples`);
|
|
260
|
+
* ```
|
|
261
|
+
*
|
|
262
|
+
* @see {@link convert} For async version
|
|
263
|
+
*/
|
|
264
|
+
convertSync(outBuffer: Buffer[] | null, outCount: number, inBuffer: Buffer[] | null, inCount: number): number;
|
|
215
265
|
/**
|
|
216
266
|
* Convert audio frame.
|
|
217
267
|
*
|
|
@@ -221,7 +271,9 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
221
271
|
* Direct mapping to swr_convert_frame().
|
|
222
272
|
*
|
|
223
273
|
* @param outFrame - Output frame (null to drain)
|
|
274
|
+
*
|
|
224
275
|
* @param inFrame - Input frame (null to flush)
|
|
276
|
+
*
|
|
225
277
|
* @returns 0 on success, negative AVERROR on error:
|
|
226
278
|
* - AVERROR_EINVAL: Invalid parameters
|
|
227
279
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -257,7 +309,9 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
257
309
|
* Direct mapping to swr_config_frame().
|
|
258
310
|
*
|
|
259
311
|
* @param outFrame - Frame with output format
|
|
312
|
+
*
|
|
260
313
|
* @param inFrame - Frame with input format
|
|
314
|
+
*
|
|
261
315
|
* @returns 0 on success, negative AVERROR on error:
|
|
262
316
|
* - AVERROR_EINVAL: Invalid parameters
|
|
263
317
|
*
|
|
@@ -304,6 +358,7 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
304
358
|
* Direct mapping to swr_get_delay().
|
|
305
359
|
*
|
|
306
360
|
* @param base - Time base for the returned delay
|
|
361
|
+
*
|
|
307
362
|
* @returns Delay in samples at the given base rate
|
|
308
363
|
*
|
|
309
364
|
* @example
|
|
@@ -327,6 +382,7 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
327
382
|
* Direct mapping to swr_get_out_samples().
|
|
328
383
|
*
|
|
329
384
|
* @param inSamples - Number of input samples
|
|
385
|
+
*
|
|
330
386
|
* @returns Number of output samples
|
|
331
387
|
*
|
|
332
388
|
* @example
|
|
@@ -344,6 +400,7 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
344
400
|
* Direct mapping to swr_next_pts().
|
|
345
401
|
*
|
|
346
402
|
* @param pts - Current presentation timestamp
|
|
403
|
+
*
|
|
347
404
|
* @returns Next presentation timestamp
|
|
348
405
|
*
|
|
349
406
|
* @example
|
|
@@ -363,7 +420,9 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
363
420
|
* Direct mapping to swr_set_compensation().
|
|
364
421
|
*
|
|
365
422
|
* @param sampleDelta - Sample difference to compensate
|
|
423
|
+
*
|
|
366
424
|
* @param compensationDistance - Distance over which to compensate
|
|
425
|
+
*
|
|
367
426
|
* @returns 0 on success, negative AVERROR on error:
|
|
368
427
|
* - AVERROR_EINVAL: Invalid parameters
|
|
369
428
|
*
|
|
@@ -385,6 +444,7 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
385
444
|
* Direct mapping to swr_set_channel_mapping().
|
|
386
445
|
*
|
|
387
446
|
* @param channelMap - Array mapping input to output channels
|
|
447
|
+
*
|
|
388
448
|
* @returns 0 on success, negative AVERROR on error
|
|
389
449
|
*
|
|
390
450
|
* @example
|
|
@@ -403,7 +463,9 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
403
463
|
* Direct mapping to swr_set_matrix().
|
|
404
464
|
*
|
|
405
465
|
* @param matrix - Mixing matrix coefficients
|
|
466
|
+
*
|
|
406
467
|
* @param stride - Matrix row stride
|
|
468
|
+
*
|
|
407
469
|
* @returns 0 on success, negative AVERROR on error
|
|
408
470
|
*
|
|
409
471
|
* @example
|
|
@@ -427,6 +489,7 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
427
489
|
* Direct mapping to swr_drop_output().
|
|
428
490
|
*
|
|
429
491
|
* @param count - Number of samples to drop
|
|
492
|
+
*
|
|
430
493
|
* @returns 0 on success, negative AVERROR on error
|
|
431
494
|
*
|
|
432
495
|
* @example
|
|
@@ -448,6 +511,7 @@ export declare class SoftwareResampleContext extends OptionMember<NativeSoftware
|
|
|
448
511
|
* Direct mapping to swr_inject_silence().
|
|
449
512
|
*
|
|
450
513
|
* @param count - Number of silent samples to inject
|
|
514
|
+
*
|
|
451
515
|
* @returns 0 on success, negative AVERROR on error
|
|
452
516
|
*
|
|
453
517
|
* @example
|
|
@@ -86,11 +86,17 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
86
86
|
* Direct mapping to swr_alloc_set_opts2().
|
|
87
87
|
*
|
|
88
88
|
* @param outChLayout - Output channel layout
|
|
89
|
+
*
|
|
89
90
|
* @param outSampleFmt - Output sample format
|
|
91
|
+
*
|
|
90
92
|
* @param outSampleRate - Output sample rate in Hz
|
|
93
|
+
*
|
|
91
94
|
* @param inChLayout - Input channel layout
|
|
95
|
+
*
|
|
92
96
|
* @param inSampleFmt - Input sample format
|
|
97
|
+
*
|
|
93
98
|
* @param inSampleRate - Input sample rate in Hz
|
|
99
|
+
*
|
|
94
100
|
* @returns 0 on success, negative AVERROR on error:
|
|
95
101
|
* - AVERROR_EINVAL: Invalid parameters
|
|
96
102
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -192,9 +198,13 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
192
198
|
* Direct mapping to swr_convert().
|
|
193
199
|
*
|
|
194
200
|
* @param outBuffer - Output sample buffers (one per channel for planar)
|
|
201
|
+
*
|
|
195
202
|
* @param outCount - Maximum output samples per channel
|
|
203
|
+
*
|
|
196
204
|
* @param inBuffer - Input sample buffers (one per channel for planar)
|
|
205
|
+
*
|
|
197
206
|
* @param inCount - Input samples per channel
|
|
207
|
+
*
|
|
198
208
|
* @returns Number of output samples per channel, negative AVERROR on error:
|
|
199
209
|
* - AVERROR_EINVAL: Invalid parameters
|
|
200
210
|
* - AVERROR_INPUT_CHANGED: Input format changed
|
|
@@ -223,6 +233,48 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
223
233
|
async convert(outBuffer, outCount, inBuffer, inCount) {
|
|
224
234
|
return await this.native.convert(outBuffer, outCount, inBuffer, inCount);
|
|
225
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Convert audio samples synchronously.
|
|
238
|
+
* Synchronous version of convert.
|
|
239
|
+
*
|
|
240
|
+
* Converts audio between formats, sample rates, and channel layouts.
|
|
241
|
+
* Can handle format conversion, resampling, and channel mixing.
|
|
242
|
+
*
|
|
243
|
+
* Direct mapping to swr_convert().
|
|
244
|
+
*
|
|
245
|
+
* @param outBuffer - Output buffer array (one per channel, null to get delay)
|
|
246
|
+
*
|
|
247
|
+
* @param outCount - Number of output samples space per channel
|
|
248
|
+
*
|
|
249
|
+
* @param inBuffer - Input buffer array (one per channel, null to flush)
|
|
250
|
+
*
|
|
251
|
+
* @param inCount - Number of input samples per channel
|
|
252
|
+
*
|
|
253
|
+
* @returns Number of samples output per channel, or negative AVERROR:
|
|
254
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
255
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```typescript
|
|
259
|
+
* import { FFmpegError } from 'node-av';
|
|
260
|
+
*
|
|
261
|
+
* // Convert stereo float to mono s16
|
|
262
|
+
* const inBuffers = [leftChannel, rightChannel];
|
|
263
|
+
* const outBuffers = [monoOutput];
|
|
264
|
+
*
|
|
265
|
+
* const samples = resampler.convertSync(
|
|
266
|
+
* outBuffers, 1024, // Output: 1024 samples max
|
|
267
|
+
* inBuffers, 1024 // Input: 1024 samples
|
|
268
|
+
* );
|
|
269
|
+
* FFmpegError.throwIfError(samples, 'convertSync');
|
|
270
|
+
* console.log(`Converted ${samples} samples`);
|
|
271
|
+
* ```
|
|
272
|
+
*
|
|
273
|
+
* @see {@link convert} For async version
|
|
274
|
+
*/
|
|
275
|
+
convertSync(outBuffer, outCount, inBuffer, inCount) {
|
|
276
|
+
return this.native.convertSync(outBuffer, outCount, inBuffer, inCount);
|
|
277
|
+
}
|
|
226
278
|
/**
|
|
227
279
|
* Convert audio frame.
|
|
228
280
|
*
|
|
@@ -232,7 +284,9 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
232
284
|
* Direct mapping to swr_convert_frame().
|
|
233
285
|
*
|
|
234
286
|
* @param outFrame - Output frame (null to drain)
|
|
287
|
+
*
|
|
235
288
|
* @param inFrame - Input frame (null to flush)
|
|
289
|
+
*
|
|
236
290
|
* @returns 0 on success, negative AVERROR on error:
|
|
237
291
|
* - AVERROR_EINVAL: Invalid parameters
|
|
238
292
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -270,7 +324,9 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
270
324
|
* Direct mapping to swr_config_frame().
|
|
271
325
|
*
|
|
272
326
|
* @param outFrame - Frame with output format
|
|
327
|
+
*
|
|
273
328
|
* @param inFrame - Frame with input format
|
|
329
|
+
*
|
|
274
330
|
* @returns 0 on success, negative AVERROR on error:
|
|
275
331
|
* - AVERROR_EINVAL: Invalid parameters
|
|
276
332
|
*
|
|
@@ -321,6 +377,7 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
321
377
|
* Direct mapping to swr_get_delay().
|
|
322
378
|
*
|
|
323
379
|
* @param base - Time base for the returned delay
|
|
380
|
+
*
|
|
324
381
|
* @returns Delay in samples at the given base rate
|
|
325
382
|
*
|
|
326
383
|
* @example
|
|
@@ -346,6 +403,7 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
346
403
|
* Direct mapping to swr_get_out_samples().
|
|
347
404
|
*
|
|
348
405
|
* @param inSamples - Number of input samples
|
|
406
|
+
*
|
|
349
407
|
* @returns Number of output samples
|
|
350
408
|
*
|
|
351
409
|
* @example
|
|
@@ -365,6 +423,7 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
365
423
|
* Direct mapping to swr_next_pts().
|
|
366
424
|
*
|
|
367
425
|
* @param pts - Current presentation timestamp
|
|
426
|
+
*
|
|
368
427
|
* @returns Next presentation timestamp
|
|
369
428
|
*
|
|
370
429
|
* @example
|
|
@@ -386,7 +445,9 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
386
445
|
* Direct mapping to swr_set_compensation().
|
|
387
446
|
*
|
|
388
447
|
* @param sampleDelta - Sample difference to compensate
|
|
448
|
+
*
|
|
389
449
|
* @param compensationDistance - Distance over which to compensate
|
|
450
|
+
*
|
|
390
451
|
* @returns 0 on success, negative AVERROR on error:
|
|
391
452
|
* - AVERROR_EINVAL: Invalid parameters
|
|
392
453
|
*
|
|
@@ -410,6 +471,7 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
410
471
|
* Direct mapping to swr_set_channel_mapping().
|
|
411
472
|
*
|
|
412
473
|
* @param channelMap - Array mapping input to output channels
|
|
474
|
+
*
|
|
413
475
|
* @returns 0 on success, negative AVERROR on error
|
|
414
476
|
*
|
|
415
477
|
* @example
|
|
@@ -430,7 +492,9 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
430
492
|
* Direct mapping to swr_set_matrix().
|
|
431
493
|
*
|
|
432
494
|
* @param matrix - Mixing matrix coefficients
|
|
495
|
+
*
|
|
433
496
|
* @param stride - Matrix row stride
|
|
497
|
+
*
|
|
434
498
|
* @returns 0 on success, negative AVERROR on error
|
|
435
499
|
*
|
|
436
500
|
* @example
|
|
@@ -456,6 +520,7 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
456
520
|
* Direct mapping to swr_drop_output().
|
|
457
521
|
*
|
|
458
522
|
* @param count - Number of samples to drop
|
|
523
|
+
*
|
|
459
524
|
* @returns 0 on success, negative AVERROR on error
|
|
460
525
|
*
|
|
461
526
|
* @example
|
|
@@ -479,6 +544,7 @@ export class SoftwareResampleContext extends OptionMember {
|
|
|
479
544
|
* Direct mapping to swr_inject_silence().
|
|
480
545
|
*
|
|
481
546
|
* @param count - Number of silent samples to inject
|
|
547
|
+
*
|
|
482
548
|
* @returns 0 on success, negative AVERROR on error
|
|
483
549
|
*
|
|
484
550
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"software-resample-context.js","sourceRoot":"","sources":["../../src/lib/software-resample-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAM,OAAO,uBAAwB,SAAQ,YAA2C;IACtF;QACE,KAAK,CAAC,IAAI,QAAQ,CAAC,uBAAuB,EAAE,CAAC,CAAC;IAChD,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"software-resample-context.js","sourceRoot":"","sources":["../../src/lib/software-resample-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAA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H,eAAe,CAAC,WAAmB,EAAE,oBAA4B;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;IACxE,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,iBAAiB,CAAC,UAAoB;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,SAAS,CAAC,MAAgB,EAAE,MAAc;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,UAAU,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,aAAa,CAAC,KAAa;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -76,11 +76,17 @@ export declare class SoftwareScaleContext extends OptionMember<NativeSoftwareSca
|
|
|
76
76
|
* Direct mapping to sws_getContext().
|
|
77
77
|
*
|
|
78
78
|
* @param srcW - Source width in pixels
|
|
79
|
+
*
|
|
79
80
|
* @param srcH - Source height in pixels
|
|
81
|
+
*
|
|
80
82
|
* @param srcFormat - Source pixel format
|
|
83
|
+
*
|
|
81
84
|
* @param dstW - Destination width in pixels
|
|
85
|
+
*
|
|
82
86
|
* @param dstH - Destination height in pixels
|
|
87
|
+
*
|
|
83
88
|
* @param dstFormat - Destination pixel format
|
|
89
|
+
*
|
|
84
90
|
* @param flags - Scaling algorithm flags (SWS_*)
|
|
85
91
|
*
|
|
86
92
|
* @example
|
|
@@ -155,11 +161,17 @@ export declare class SoftwareScaleContext extends OptionMember<NativeSoftwareSca
|
|
|
155
161
|
* Direct mapping to sws_scale().
|
|
156
162
|
*
|
|
157
163
|
* @param srcSlice - Source data planes (one buffer per plane)
|
|
164
|
+
*
|
|
158
165
|
* @param srcStride - Bytes per line for each plane
|
|
166
|
+
*
|
|
159
167
|
* @param srcSliceY - Starting Y position in source
|
|
168
|
+
*
|
|
160
169
|
* @param srcSliceH - Height of source slice to process
|
|
170
|
+
*
|
|
161
171
|
* @param dst - Destination data planes
|
|
172
|
+
*
|
|
162
173
|
* @param dstStride - Destination bytes per line
|
|
174
|
+
*
|
|
163
175
|
* @returns Output height in pixels, negative AVERROR on error:
|
|
164
176
|
* - AVERROR_EINVAL: Invalid parameters
|
|
165
177
|
*
|
|
@@ -181,6 +193,52 @@ export declare class SoftwareScaleContext extends OptionMember<NativeSoftwareSca
|
|
|
181
193
|
* @see {@link scaleFrame} For frame-based scaling
|
|
182
194
|
*/
|
|
183
195
|
scale(srcSlice: Buffer[], srcStride: number[], srcSliceY: number, srcSliceH: number, dst: Buffer[], dstStride: number[]): Promise<number>;
|
|
196
|
+
/**
|
|
197
|
+
* Scale video synchronously.
|
|
198
|
+
* Synchronous version of scale.
|
|
199
|
+
*
|
|
200
|
+
* Scales raw video data from source to destination format.
|
|
201
|
+
* Can scale a slice or entire image.
|
|
202
|
+
*
|
|
203
|
+
* Direct mapping to sws_scale().
|
|
204
|
+
*
|
|
205
|
+
* @param srcSlice - Array of source buffers (one per plane)
|
|
206
|
+
*
|
|
207
|
+
* @param srcStride - Array of source strides (bytes per row)
|
|
208
|
+
*
|
|
209
|
+
* @param srcSliceY - Y position of slice (0 for full image)
|
|
210
|
+
*
|
|
211
|
+
* @param srcSliceH - Height of slice (full height for entire image)
|
|
212
|
+
*
|
|
213
|
+
* @param dst - Array of destination buffers (one per plane)
|
|
214
|
+
*
|
|
215
|
+
* @param dstStride - Array of destination strides
|
|
216
|
+
*
|
|
217
|
+
* @returns Height of output image, or negative AVERROR:
|
|
218
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* import { FFmpegError } from 'node-av';
|
|
223
|
+
*
|
|
224
|
+
* // Scale YUV420P image
|
|
225
|
+
* const srcBufs = [yPlane, uPlane, vPlane];
|
|
226
|
+
* const srcStrides = [srcWidth, srcWidth/2, srcWidth/2];
|
|
227
|
+
* const dstBufs = [dstY, dstU, dstV];
|
|
228
|
+
* const dstStrides = [dstWidth, dstWidth/2, dstWidth/2];
|
|
229
|
+
*
|
|
230
|
+
* const height = scaler.scaleSync(
|
|
231
|
+
* srcBufs, srcStrides,
|
|
232
|
+
* 0, srcHeight, // Full image
|
|
233
|
+
* dstBufs, dstStrides
|
|
234
|
+
* );
|
|
235
|
+
* FFmpegError.throwIfError(height, 'scaleSync');
|
|
236
|
+
* console.log(`Scaled ${height} lines`);
|
|
237
|
+
* ```
|
|
238
|
+
*
|
|
239
|
+
* @see {@link scale} For async version
|
|
240
|
+
*/
|
|
241
|
+
scaleSync(srcSlice: Buffer[], srcStride: number[], srcSliceY: number, srcSliceH: number, dst: Buffer[], dstStride: number[]): number;
|
|
184
242
|
/**
|
|
185
243
|
* Scale video frame.
|
|
186
244
|
*
|
|
@@ -190,7 +248,9 @@ export declare class SoftwareScaleContext extends OptionMember<NativeSoftwareSca
|
|
|
190
248
|
* Direct mapping to sws_scale_frame().
|
|
191
249
|
*
|
|
192
250
|
* @param dst - Destination frame (must be allocated)
|
|
251
|
+
*
|
|
193
252
|
* @param src - Source frame
|
|
253
|
+
*
|
|
194
254
|
* @returns 0 on success, negative AVERROR on error:
|
|
195
255
|
* - AVERROR_EINVAL: Invalid parameters
|
|
196
256
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -218,6 +278,44 @@ export declare class SoftwareScaleContext extends OptionMember<NativeSoftwareSca
|
|
|
218
278
|
* @see {@link scale} For buffer-based scaling
|
|
219
279
|
*/
|
|
220
280
|
scaleFrame(dst: Frame, src: Frame): Promise<number>;
|
|
281
|
+
/**
|
|
282
|
+
* Scale video frame synchronously.
|
|
283
|
+
* Synchronous version of scaleFrame.
|
|
284
|
+
*
|
|
285
|
+
* Scales an entire video frame to the destination format.
|
|
286
|
+
* Simpler interface than scaleSync() for frame-based processing.
|
|
287
|
+
*
|
|
288
|
+
* Direct mapping to sws_scale_frame().
|
|
289
|
+
*
|
|
290
|
+
* @param dst - Destination frame (must be allocated)
|
|
291
|
+
*
|
|
292
|
+
* @param src - Source frame
|
|
293
|
+
*
|
|
294
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
295
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```typescript
|
|
299
|
+
* import { FFmpegError } from 'node-av';
|
|
300
|
+
* import { AV_PIX_FMT_YUV420P, AV_PIX_FMT_RGB24 } from 'node-av/constants';
|
|
301
|
+
*
|
|
302
|
+
* // Convert YUV to RGB
|
|
303
|
+
* const srcFrame = new Frame();
|
|
304
|
+
* srcFrame.allocBuffer(AV_PIX_FMT_YUV420P, 1920, 1080);
|
|
305
|
+
* // ... fill with YUV data ...
|
|
306
|
+
*
|
|
307
|
+
* const dstFrame = new Frame();
|
|
308
|
+
* dstFrame.allocBuffer(AV_PIX_FMT_RGB24, 1920, 1080);
|
|
309
|
+
*
|
|
310
|
+
* const ret = scaler.scaleFrameSync(dstFrame, srcFrame);
|
|
311
|
+
* FFmpegError.throwIfError(ret, 'scaleFrameSync');
|
|
312
|
+
*
|
|
313
|
+
* // dstFrame now contains scaled image
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* @see {@link scaleFrame} For async version
|
|
317
|
+
*/
|
|
318
|
+
scaleFrameSync(dst: Frame, src: Frame): number;
|
|
221
319
|
/**
|
|
222
320
|
* Get the underlying native SoftwareScaleContext object.
|
|
223
321
|
*
|
|
@@ -79,11 +79,17 @@ export class SoftwareScaleContext extends OptionMember {
|
|
|
79
79
|
* Direct mapping to sws_getContext().
|
|
80
80
|
*
|
|
81
81
|
* @param srcW - Source width in pixels
|
|
82
|
+
*
|
|
82
83
|
* @param srcH - Source height in pixels
|
|
84
|
+
*
|
|
83
85
|
* @param srcFormat - Source pixel format
|
|
86
|
+
*
|
|
84
87
|
* @param dstW - Destination width in pixels
|
|
88
|
+
*
|
|
85
89
|
* @param dstH - Destination height in pixels
|
|
90
|
+
*
|
|
86
91
|
* @param dstFormat - Destination pixel format
|
|
92
|
+
*
|
|
87
93
|
* @param flags - Scaling algorithm flags (SWS_*)
|
|
88
94
|
*
|
|
89
95
|
* @example
|
|
@@ -164,11 +170,17 @@ export class SoftwareScaleContext extends OptionMember {
|
|
|
164
170
|
* Direct mapping to sws_scale().
|
|
165
171
|
*
|
|
166
172
|
* @param srcSlice - Source data planes (one buffer per plane)
|
|
173
|
+
*
|
|
167
174
|
* @param srcStride - Bytes per line for each plane
|
|
175
|
+
*
|
|
168
176
|
* @param srcSliceY - Starting Y position in source
|
|
177
|
+
*
|
|
169
178
|
* @param srcSliceH - Height of source slice to process
|
|
179
|
+
*
|
|
170
180
|
* @param dst - Destination data planes
|
|
181
|
+
*
|
|
171
182
|
* @param dstStride - Destination bytes per line
|
|
183
|
+
*
|
|
172
184
|
* @returns Output height in pixels, negative AVERROR on error:
|
|
173
185
|
* - AVERROR_EINVAL: Invalid parameters
|
|
174
186
|
*
|
|
@@ -192,6 +204,54 @@ export class SoftwareScaleContext extends OptionMember {
|
|
|
192
204
|
async scale(srcSlice, srcStride, srcSliceY, srcSliceH, dst, dstStride) {
|
|
193
205
|
return await this.native.scale(srcSlice, srcStride, srcSliceY, srcSliceH, dst, dstStride);
|
|
194
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Scale video synchronously.
|
|
209
|
+
* Synchronous version of scale.
|
|
210
|
+
*
|
|
211
|
+
* Scales raw video data from source to destination format.
|
|
212
|
+
* Can scale a slice or entire image.
|
|
213
|
+
*
|
|
214
|
+
* Direct mapping to sws_scale().
|
|
215
|
+
*
|
|
216
|
+
* @param srcSlice - Array of source buffers (one per plane)
|
|
217
|
+
*
|
|
218
|
+
* @param srcStride - Array of source strides (bytes per row)
|
|
219
|
+
*
|
|
220
|
+
* @param srcSliceY - Y position of slice (0 for full image)
|
|
221
|
+
*
|
|
222
|
+
* @param srcSliceH - Height of slice (full height for entire image)
|
|
223
|
+
*
|
|
224
|
+
* @param dst - Array of destination buffers (one per plane)
|
|
225
|
+
*
|
|
226
|
+
* @param dstStride - Array of destination strides
|
|
227
|
+
*
|
|
228
|
+
* @returns Height of output image, or negative AVERROR:
|
|
229
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```typescript
|
|
233
|
+
* import { FFmpegError } from 'node-av';
|
|
234
|
+
*
|
|
235
|
+
* // Scale YUV420P image
|
|
236
|
+
* const srcBufs = [yPlane, uPlane, vPlane];
|
|
237
|
+
* const srcStrides = [srcWidth, srcWidth/2, srcWidth/2];
|
|
238
|
+
* const dstBufs = [dstY, dstU, dstV];
|
|
239
|
+
* const dstStrides = [dstWidth, dstWidth/2, dstWidth/2];
|
|
240
|
+
*
|
|
241
|
+
* const height = scaler.scaleSync(
|
|
242
|
+
* srcBufs, srcStrides,
|
|
243
|
+
* 0, srcHeight, // Full image
|
|
244
|
+
* dstBufs, dstStrides
|
|
245
|
+
* );
|
|
246
|
+
* FFmpegError.throwIfError(height, 'scaleSync');
|
|
247
|
+
* console.log(`Scaled ${height} lines`);
|
|
248
|
+
* ```
|
|
249
|
+
*
|
|
250
|
+
* @see {@link scale} For async version
|
|
251
|
+
*/
|
|
252
|
+
scaleSync(srcSlice, srcStride, srcSliceY, srcSliceH, dst, dstStride) {
|
|
253
|
+
return this.native.scaleSync(srcSlice, srcStride, srcSliceY, srcSliceH, dst, dstStride);
|
|
254
|
+
}
|
|
195
255
|
/**
|
|
196
256
|
* Scale video frame.
|
|
197
257
|
*
|
|
@@ -201,7 +261,9 @@ export class SoftwareScaleContext extends OptionMember {
|
|
|
201
261
|
* Direct mapping to sws_scale_frame().
|
|
202
262
|
*
|
|
203
263
|
* @param dst - Destination frame (must be allocated)
|
|
264
|
+
*
|
|
204
265
|
* @param src - Source frame
|
|
266
|
+
*
|
|
205
267
|
* @returns 0 on success, negative AVERROR on error:
|
|
206
268
|
* - AVERROR_EINVAL: Invalid parameters
|
|
207
269
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -231,6 +293,46 @@ export class SoftwareScaleContext extends OptionMember {
|
|
|
231
293
|
async scaleFrame(dst, src) {
|
|
232
294
|
return await this.native.scaleFrame(dst.getNative(), src.getNative());
|
|
233
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
* Scale video frame synchronously.
|
|
298
|
+
* Synchronous version of scaleFrame.
|
|
299
|
+
*
|
|
300
|
+
* Scales an entire video frame to the destination format.
|
|
301
|
+
* Simpler interface than scaleSync() for frame-based processing.
|
|
302
|
+
*
|
|
303
|
+
* Direct mapping to sws_scale_frame().
|
|
304
|
+
*
|
|
305
|
+
* @param dst - Destination frame (must be allocated)
|
|
306
|
+
*
|
|
307
|
+
* @param src - Source frame
|
|
308
|
+
*
|
|
309
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
310
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* import { FFmpegError } from 'node-av';
|
|
315
|
+
* import { AV_PIX_FMT_YUV420P, AV_PIX_FMT_RGB24 } from 'node-av/constants';
|
|
316
|
+
*
|
|
317
|
+
* // Convert YUV to RGB
|
|
318
|
+
* const srcFrame = new Frame();
|
|
319
|
+
* srcFrame.allocBuffer(AV_PIX_FMT_YUV420P, 1920, 1080);
|
|
320
|
+
* // ... fill with YUV data ...
|
|
321
|
+
*
|
|
322
|
+
* const dstFrame = new Frame();
|
|
323
|
+
* dstFrame.allocBuffer(AV_PIX_FMT_RGB24, 1920, 1080);
|
|
324
|
+
*
|
|
325
|
+
* const ret = scaler.scaleFrameSync(dstFrame, srcFrame);
|
|
326
|
+
* FFmpegError.throwIfError(ret, 'scaleFrameSync');
|
|
327
|
+
*
|
|
328
|
+
* // dstFrame now contains scaled image
|
|
329
|
+
* ```
|
|
330
|
+
*
|
|
331
|
+
* @see {@link scaleFrame} For async version
|
|
332
|
+
*/
|
|
333
|
+
scaleFrameSync(dst, src) {
|
|
334
|
+
return this.native.scaleFrameSync(dst.getNative(), src.getNative());
|
|
335
|
+
}
|
|
234
336
|
/**
|
|
235
337
|
* Get the underlying native SoftwareScaleContext object.
|
|
236
338
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"software-scale-context.js","sourceRoot":"","sources":["../../src/lib/software-scale-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,OAAO,oBAAqB,SAAQ,YAAwC;IAChF;QACE,KAAK,CAAC,IAAI,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY;QACV,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;IAC7B,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"software-scale-context.js","sourceRoot":"","sources":["../../src/lib/software-scale-context.ts"],"names":[],"mappings":"AAAA,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AAS,CAAC,CAAC;IAC5F,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,SAAS,CAAC,QAAkB,EAAE,SAAmB,EAAE,SAAiB,EAAE,SAAiB,EAAE,GAAa,EAAE,SAAmB;QACzH,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;IAC1F,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,KAAK,CAAC,UAAU,CAAC,GAAU,EAAE,GAAU;QACrC,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;IACxE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,cAAc,CAAC,GAAU,EAAE,GAAU;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAChC,CAAC;CACF"}
|
package/dist/lib/stream.d.ts
CHANGED
package/dist/lib/stream.js
CHANGED
package/dist/lib/stream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/lib/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EA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