node-av 1.3.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 +47 -40
- package/binding.gyp +12 -0
- package/dist/api/bitstream-filter.d.ts +134 -2
- package/dist/api/bitstream-filter.js +200 -2
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +261 -105
- package/dist/api/decoder.js +384 -171
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/encoder.d.ts +338 -74
- package/dist/api/encoder.js +546 -188
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter-presets.d.ts +479 -1513
- package/dist/api/filter-presets.js +1044 -2005
- package/dist/api/filter-presets.js.map +1 -1
- package/dist/api/filter.d.ts +370 -150
- package/dist/api/filter.js +647 -364
- package/dist/api/filter.js.map +1 -1
- package/dist/api/hardware.d.ts +25 -31
- package/dist/api/hardware.js +36 -70
- package/dist/api/hardware.js.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/index.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 +208 -2
- package/dist/api/media-input.js +356 -8
- package/dist/api/media-input.js.map +1 -1
- package/dist/api/media-output.d.ts +142 -104
- package/dist/api/media-output.js +446 -179
- package/dist/api/media-output.js.map +1 -1
- package/dist/api/pipeline.d.ts +82 -17
- package/dist/api/pipeline.js +80 -42
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/types.d.ts +24 -57
- 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 +18 -2
- package/dist/lib/dictionary.js +18 -2
- 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 +119 -2
- package/dist/lib/filter-context.js +119 -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 +356 -20
- package/dist/lib/format-context.js +375 -23
- package/dist/lib/format-context.js.map +1 -1
- package/dist/lib/frame.d.ts +84 -1
- package/dist/lib/frame.js +96 -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 +18 -18
- package/release_notes.md +0 -29
|
@@ -2,7 +2,7 @@ import { Filter } from './filter.js';
|
|
|
2
2
|
import { HardwareDeviceContext } from './hardware-device-context.js';
|
|
3
3
|
import { OptionMember } from './option.js';
|
|
4
4
|
import { Rational } from './rational.js';
|
|
5
|
-
import type { AVPixelFormat, AVSampleFormat } from '../constants/constants.js';
|
|
5
|
+
import type { AVColorRange, AVColorSpace, AVPixelFormat, AVSampleFormat } from '../constants/constants.js';
|
|
6
6
|
import type { Frame } from './frame.js';
|
|
7
7
|
import type { HardwareFramesContext } from './hardware-frames-context.js';
|
|
8
8
|
import type { NativeDictionary, NativeFilterContext, NativeFilterGraph, NativeWrapper } from './native-types.js';
|
|
@@ -47,6 +47,7 @@ export declare class FilterContext extends OptionMember<NativeFilterContext> imp
|
|
|
47
47
|
private _hwDeviceCtx?;
|
|
48
48
|
/**
|
|
49
49
|
* @param native - The native filter context instance
|
|
50
|
+
*
|
|
50
51
|
* @internal
|
|
51
52
|
*/
|
|
52
53
|
constructor(native: NativeFilterContext);
|
|
@@ -120,6 +121,7 @@ export declare class FilterContext extends OptionMember<NativeFilterContext> imp
|
|
|
120
121
|
* Direct mapping to avfilter_init_dict().
|
|
121
122
|
*
|
|
122
123
|
* @param options - Dictionary of filter options
|
|
124
|
+
*
|
|
123
125
|
* @returns 0 on success, negative AVERROR on error:
|
|
124
126
|
* - AVERROR_EINVAL: Invalid parameters
|
|
125
127
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -145,6 +147,7 @@ export declare class FilterContext extends OptionMember<NativeFilterContext> imp
|
|
|
145
147
|
* Direct mapping to avfilter_init_str().
|
|
146
148
|
*
|
|
147
149
|
* @param args - Filter arguments string
|
|
150
|
+
*
|
|
148
151
|
* @returns 0 on success, negative AVERROR on error:
|
|
149
152
|
* - AVERROR_EINVAL: Invalid arguments
|
|
150
153
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -174,8 +177,11 @@ export declare class FilterContext extends OptionMember<NativeFilterContext> imp
|
|
|
174
177
|
* Direct mapping to avfilter_link().
|
|
175
178
|
*
|
|
176
179
|
* @param srcPad - Output pad index of this filter
|
|
180
|
+
*
|
|
177
181
|
* @param dst - Destination filter context
|
|
182
|
+
*
|
|
178
183
|
* @param dstPad - Input pad index of destination filter
|
|
184
|
+
*
|
|
179
185
|
* @returns 0 on success, negative AVERROR on error:
|
|
180
186
|
* - AVERROR_EINVAL: Invalid pad indices or incompatible formats
|
|
181
187
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -224,6 +230,7 @@ export declare class FilterContext extends OptionMember<NativeFilterContext> imp
|
|
|
224
230
|
* Direct mapping to av_buffersrc_add_frame().
|
|
225
231
|
*
|
|
226
232
|
* @param frame - Frame to send, or null for EOF
|
|
233
|
+
*
|
|
227
234
|
* @returns 0 on success, negative AVERROR on error:
|
|
228
235
|
* - AVERROR_EAGAIN: Filter needs more output consumption
|
|
229
236
|
* - AVERROR_EOF: Filter has been closed
|
|
@@ -250,6 +257,45 @@ export declare class FilterContext extends OptionMember<NativeFilterContext> imp
|
|
|
250
257
|
* @see {@link buffersinkGetFrame} To retrieve filtered frames
|
|
251
258
|
*/
|
|
252
259
|
buffersrcAddFrame(frame: Frame | null): Promise<number>;
|
|
260
|
+
/**
|
|
261
|
+
* Add frame to buffer source filter synchronously.
|
|
262
|
+
* Synchronous version of buffersrcAddFrame.
|
|
263
|
+
*
|
|
264
|
+
* Sends a frame to a buffer source filter for processing.
|
|
265
|
+
* Only valid for buffer source filters (buffer, abuffer).
|
|
266
|
+
*
|
|
267
|
+
* Direct mapping to av_buffersrc_add_frame().
|
|
268
|
+
*
|
|
269
|
+
* @param frame - Frame to send (null to mark EOF)
|
|
270
|
+
*
|
|
271
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
272
|
+
* - AVERROR_EAGAIN: Need to retrieve output first
|
|
273
|
+
* - AVERROR_EOF: Graph has finished processing
|
|
274
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
275
|
+
* - AVERROR(ENOMEM): Memory allocation failure
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```typescript
|
|
279
|
+
* import { FFmpegError } from 'node-av';
|
|
280
|
+
* import { AVERROR_EAGAIN } from 'node-av/constants';
|
|
281
|
+
*
|
|
282
|
+
* // Send frame to filter
|
|
283
|
+
* const ret = bufferSrc.buffersrcAddFrameSync(frame);
|
|
284
|
+
* if (ret === AVERROR_EAGAIN) {
|
|
285
|
+
* // Need to get output frames first
|
|
286
|
+
* const filtered = new Frame();
|
|
287
|
+
* bufferSink.buffersinkGetFrameSync(filtered);
|
|
288
|
+
* } else {
|
|
289
|
+
* FFmpegError.throwIfError(ret, 'buffersrcAddFrameSync');
|
|
290
|
+
* }
|
|
291
|
+
*
|
|
292
|
+
* // Mark end of stream
|
|
293
|
+
* bufferSrc.buffersrcAddFrameSync(null);
|
|
294
|
+
* ```
|
|
295
|
+
*
|
|
296
|
+
* @see {@link buffersrcAddFrame} For async version
|
|
297
|
+
*/
|
|
298
|
+
buffersrcAddFrameSync(frame: Frame | null): number;
|
|
253
299
|
/**
|
|
254
300
|
* Set parameters for a buffer source filter.
|
|
255
301
|
*
|
|
@@ -259,15 +305,29 @@ export declare class FilterContext extends OptionMember<NativeFilterContext> imp
|
|
|
259
305
|
* Direct mapping to av_buffersrc_parameters_set().
|
|
260
306
|
*
|
|
261
307
|
* @param params - Source parameters
|
|
308
|
+
*
|
|
262
309
|
* @param params.width - Video frame width
|
|
310
|
+
*
|
|
263
311
|
* @param params.height - Video frame height
|
|
312
|
+
*
|
|
264
313
|
* @param params.format - Pixel or sample format
|
|
314
|
+
*
|
|
265
315
|
* @param params.timeBase - Time base for timestamps
|
|
316
|
+
*
|
|
266
317
|
* @param params.frameRate - Video frame rate
|
|
318
|
+
*
|
|
267
319
|
* @param params.sampleAspectRatio - Pixel aspect ratio
|
|
320
|
+
*
|
|
268
321
|
* @param params.hwFramesCtx - Hardware frames context
|
|
322
|
+
*
|
|
269
323
|
* @param params.sampleRate - Audio sample rate
|
|
324
|
+
*
|
|
270
325
|
* @param params.channelLayout - Audio channel layout
|
|
326
|
+
*
|
|
327
|
+
* @param params.colorRange - Color range for video
|
|
328
|
+
*
|
|
329
|
+
* @param params.colorSpace - Color space for video
|
|
330
|
+
*
|
|
271
331
|
* @returns 0 on success, negative AVERROR on error:
|
|
272
332
|
* - AVERROR_EINVAL: Invalid parameters
|
|
273
333
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -286,18 +346,33 @@ export declare class FilterContext extends OptionMember<NativeFilterContext> imp
|
|
|
286
346
|
* frameRate: { num: 25, den: 1 }
|
|
287
347
|
* });
|
|
288
348
|
* FFmpegError.throwIfError(ret, 'buffersrcParametersSet');
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```typescript
|
|
352
|
+
* import { FFmpegError } from 'node-av';
|
|
353
|
+
* import { AV_SAMPLE_FMT_FLTP } from 'node-av/constants';
|
|
354
|
+
*
|
|
355
|
+
* // Configure audio buffer source
|
|
356
|
+
* const ret = bufferSrc.buffersrcParametersSet({
|
|
357
|
+
* format: AV_SAMPLE_FMT_FLTP,
|
|
358
|
+
* sampleRate: 44100,
|
|
359
|
+
* channelLayout: AV_CHANNEL_LAYOUT_STEREO
|
|
360
|
+
* });
|
|
361
|
+
* FFmpegError.throwIfError(ret, 'buffersrcParametersSet');
|
|
289
362
|
* ```
|
|
290
363
|
*/
|
|
291
364
|
buffersrcParametersSet(params: {
|
|
292
365
|
width?: number;
|
|
293
366
|
height?: number;
|
|
294
|
-
format?:
|
|
367
|
+
format?: AVPixelFormat | AVSampleFormat;
|
|
295
368
|
timeBase?: IRational;
|
|
296
369
|
frameRate?: IRational;
|
|
297
370
|
sampleAspectRatio?: IRational;
|
|
298
371
|
hwFramesCtx?: HardwareFramesContext | null;
|
|
299
372
|
sampleRate?: number;
|
|
300
373
|
channelLayout?: bigint;
|
|
374
|
+
colorRange?: AVColorRange;
|
|
375
|
+
colorSpace?: AVColorSpace;
|
|
301
376
|
}): number;
|
|
302
377
|
/**
|
|
303
378
|
* Get a frame from a buffer sink filter.
|
|
@@ -308,6 +383,7 @@ export declare class FilterContext extends OptionMember<NativeFilterContext> imp
|
|
|
308
383
|
* Direct mapping to av_buffersink_get_frame().
|
|
309
384
|
*
|
|
310
385
|
* @param frame - Frame to receive filtered data
|
|
386
|
+
*
|
|
311
387
|
* @returns 0 on success, negative AVERROR on error:
|
|
312
388
|
* - AVERROR_EAGAIN: No frame available yet
|
|
313
389
|
* - AVERROR_EOF: No more frames will be produced
|
|
@@ -335,6 +411,47 @@ export declare class FilterContext extends OptionMember<NativeFilterContext> imp
|
|
|
335
411
|
* @see {@link buffersrcAddFrame} To send frames for filtering
|
|
336
412
|
*/
|
|
337
413
|
buffersinkGetFrame(frame: Frame): Promise<number>;
|
|
414
|
+
/**
|
|
415
|
+
* Get frame from buffer sink filter synchronously.
|
|
416
|
+
* Synchronous version of buffersinkGetFrame.
|
|
417
|
+
*
|
|
418
|
+
* Retrieves a filtered frame from a buffer sink filter.
|
|
419
|
+
* Only valid for buffer sink filters (buffersink, abuffersink).
|
|
420
|
+
*
|
|
421
|
+
* Direct mapping to av_buffersink_get_frame().
|
|
422
|
+
*
|
|
423
|
+
* @param frame - Frame to receive filtered data
|
|
424
|
+
*
|
|
425
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
426
|
+
* - AVERROR_EAGAIN: Need more input
|
|
427
|
+
* - AVERROR_EOF: No more frames available
|
|
428
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* ```typescript
|
|
432
|
+
* import { Frame, FFmpegError } from 'node-av';
|
|
433
|
+
* import { AVERROR_EAGAIN, AVERROR_EOF } from 'node-av/constants';
|
|
434
|
+
*
|
|
435
|
+
* // Get filtered frame
|
|
436
|
+
* const filtered = new Frame();
|
|
437
|
+
* const ret = bufferSink.buffersinkGetFrameSync(filtered);
|
|
438
|
+
*
|
|
439
|
+
* if (ret === 0) {
|
|
440
|
+
* // Process filtered frame
|
|
441
|
+
* console.log(`Got filtered frame with ${filtered.nbSamples} samples`);
|
|
442
|
+
* filtered.unref();
|
|
443
|
+
* } else if (ret === AVERROR_EAGAIN) {
|
|
444
|
+
* // Need more input frames
|
|
445
|
+
* } else if (ret === AVERROR_EOF) {
|
|
446
|
+
* // No more frames
|
|
447
|
+
* } else {
|
|
448
|
+
* FFmpegError.throwIfError(ret, 'buffersinkGetFrameSync');
|
|
449
|
+
* }
|
|
450
|
+
* ```
|
|
451
|
+
*
|
|
452
|
+
* @see {@link buffersinkGetFrame} For async version
|
|
453
|
+
*/
|
|
454
|
+
buffersinkGetFrameSync(frame: Frame): number;
|
|
338
455
|
/**
|
|
339
456
|
* Get time base from buffer sink.
|
|
340
457
|
*
|
|
@@ -42,6 +42,7 @@ export class FilterContext extends OptionMember {
|
|
|
42
42
|
_hwDeviceCtx; // Cache for hardware device context wrapper
|
|
43
43
|
/**
|
|
44
44
|
* @param native - The native filter context instance
|
|
45
|
+
*
|
|
45
46
|
* @internal
|
|
46
47
|
*/
|
|
47
48
|
constructor(native) {
|
|
@@ -152,6 +153,7 @@ export class FilterContext extends OptionMember {
|
|
|
152
153
|
* Direct mapping to avfilter_init_dict().
|
|
153
154
|
*
|
|
154
155
|
* @param options - Dictionary of filter options
|
|
156
|
+
*
|
|
155
157
|
* @returns 0 on success, negative AVERROR on error:
|
|
156
158
|
* - AVERROR_EINVAL: Invalid parameters
|
|
157
159
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -179,6 +181,7 @@ export class FilterContext extends OptionMember {
|
|
|
179
181
|
* Direct mapping to avfilter_init_str().
|
|
180
182
|
*
|
|
181
183
|
* @param args - Filter arguments string
|
|
184
|
+
*
|
|
182
185
|
* @returns 0 on success, negative AVERROR on error:
|
|
183
186
|
* - AVERROR_EINVAL: Invalid arguments
|
|
184
187
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -210,8 +213,11 @@ export class FilterContext extends OptionMember {
|
|
|
210
213
|
* Direct mapping to avfilter_link().
|
|
211
214
|
*
|
|
212
215
|
* @param srcPad - Output pad index of this filter
|
|
216
|
+
*
|
|
213
217
|
* @param dst - Destination filter context
|
|
218
|
+
*
|
|
214
219
|
* @param dstPad - Input pad index of destination filter
|
|
220
|
+
*
|
|
215
221
|
* @returns 0 on success, negative AVERROR on error:
|
|
216
222
|
* - AVERROR_EINVAL: Invalid pad indices or incompatible formats
|
|
217
223
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -264,6 +270,7 @@ export class FilterContext extends OptionMember {
|
|
|
264
270
|
* Direct mapping to av_buffersrc_add_frame().
|
|
265
271
|
*
|
|
266
272
|
* @param frame - Frame to send, or null for EOF
|
|
273
|
+
*
|
|
267
274
|
* @returns 0 on success, negative AVERROR on error:
|
|
268
275
|
* - AVERROR_EAGAIN: Filter needs more output consumption
|
|
269
276
|
* - AVERROR_EOF: Filter has been closed
|
|
@@ -292,6 +299,47 @@ export class FilterContext extends OptionMember {
|
|
|
292
299
|
async buffersrcAddFrame(frame) {
|
|
293
300
|
return await this.native.buffersrcAddFrame(frame ? frame.getNative() : null);
|
|
294
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Add frame to buffer source filter synchronously.
|
|
304
|
+
* Synchronous version of buffersrcAddFrame.
|
|
305
|
+
*
|
|
306
|
+
* Sends a frame to a buffer source filter for processing.
|
|
307
|
+
* Only valid for buffer source filters (buffer, abuffer).
|
|
308
|
+
*
|
|
309
|
+
* Direct mapping to av_buffersrc_add_frame().
|
|
310
|
+
*
|
|
311
|
+
* @param frame - Frame to send (null to mark EOF)
|
|
312
|
+
*
|
|
313
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
314
|
+
* - AVERROR_EAGAIN: Need to retrieve output first
|
|
315
|
+
* - AVERROR_EOF: Graph has finished processing
|
|
316
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
317
|
+
* - AVERROR(ENOMEM): Memory allocation failure
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```typescript
|
|
321
|
+
* import { FFmpegError } from 'node-av';
|
|
322
|
+
* import { AVERROR_EAGAIN } from 'node-av/constants';
|
|
323
|
+
*
|
|
324
|
+
* // Send frame to filter
|
|
325
|
+
* const ret = bufferSrc.buffersrcAddFrameSync(frame);
|
|
326
|
+
* if (ret === AVERROR_EAGAIN) {
|
|
327
|
+
* // Need to get output frames first
|
|
328
|
+
* const filtered = new Frame();
|
|
329
|
+
* bufferSink.buffersinkGetFrameSync(filtered);
|
|
330
|
+
* } else {
|
|
331
|
+
* FFmpegError.throwIfError(ret, 'buffersrcAddFrameSync');
|
|
332
|
+
* }
|
|
333
|
+
*
|
|
334
|
+
* // Mark end of stream
|
|
335
|
+
* bufferSrc.buffersrcAddFrameSync(null);
|
|
336
|
+
* ```
|
|
337
|
+
*
|
|
338
|
+
* @see {@link buffersrcAddFrame} For async version
|
|
339
|
+
*/
|
|
340
|
+
buffersrcAddFrameSync(frame) {
|
|
341
|
+
return this.native.buffersrcAddFrameSync(frame ? frame.getNative() : null);
|
|
342
|
+
}
|
|
295
343
|
/**
|
|
296
344
|
* Set parameters for a buffer source filter.
|
|
297
345
|
*
|
|
@@ -301,15 +349,29 @@ export class FilterContext extends OptionMember {
|
|
|
301
349
|
* Direct mapping to av_buffersrc_parameters_set().
|
|
302
350
|
*
|
|
303
351
|
* @param params - Source parameters
|
|
352
|
+
*
|
|
304
353
|
* @param params.width - Video frame width
|
|
354
|
+
*
|
|
305
355
|
* @param params.height - Video frame height
|
|
356
|
+
*
|
|
306
357
|
* @param params.format - Pixel or sample format
|
|
358
|
+
*
|
|
307
359
|
* @param params.timeBase - Time base for timestamps
|
|
360
|
+
*
|
|
308
361
|
* @param params.frameRate - Video frame rate
|
|
362
|
+
*
|
|
309
363
|
* @param params.sampleAspectRatio - Pixel aspect ratio
|
|
364
|
+
*
|
|
310
365
|
* @param params.hwFramesCtx - Hardware frames context
|
|
366
|
+
*
|
|
311
367
|
* @param params.sampleRate - Audio sample rate
|
|
368
|
+
*
|
|
312
369
|
* @param params.channelLayout - Audio channel layout
|
|
370
|
+
*
|
|
371
|
+
* @param params.colorRange - Color range for video
|
|
372
|
+
*
|
|
373
|
+
* @param params.colorSpace - Color space for video
|
|
374
|
+
*
|
|
313
375
|
* @returns 0 on success, negative AVERROR on error:
|
|
314
376
|
* - AVERROR_EINVAL: Invalid parameters
|
|
315
377
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -328,6 +390,19 @@ export class FilterContext extends OptionMember {
|
|
|
328
390
|
* frameRate: { num: 25, den: 1 }
|
|
329
391
|
* });
|
|
330
392
|
* FFmpegError.throwIfError(ret, 'buffersrcParametersSet');
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```typescript
|
|
396
|
+
* import { FFmpegError } from 'node-av';
|
|
397
|
+
* import { AV_SAMPLE_FMT_FLTP } from 'node-av/constants';
|
|
398
|
+
*
|
|
399
|
+
* // Configure audio buffer source
|
|
400
|
+
* const ret = bufferSrc.buffersrcParametersSet({
|
|
401
|
+
* format: AV_SAMPLE_FMT_FLTP,
|
|
402
|
+
* sampleRate: 44100,
|
|
403
|
+
* channelLayout: AV_CHANNEL_LAYOUT_STEREO
|
|
404
|
+
* });
|
|
405
|
+
* FFmpegError.throwIfError(ret, 'buffersrcParametersSet');
|
|
331
406
|
* ```
|
|
332
407
|
*/
|
|
333
408
|
buffersrcParametersSet(params) {
|
|
@@ -346,6 +421,7 @@ export class FilterContext extends OptionMember {
|
|
|
346
421
|
* Direct mapping to av_buffersink_get_frame().
|
|
347
422
|
*
|
|
348
423
|
* @param frame - Frame to receive filtered data
|
|
424
|
+
*
|
|
349
425
|
* @returns 0 on success, negative AVERROR on error:
|
|
350
426
|
* - AVERROR_EAGAIN: No frame available yet
|
|
351
427
|
* - AVERROR_EOF: No more frames will be produced
|
|
@@ -375,6 +451,49 @@ export class FilterContext extends OptionMember {
|
|
|
375
451
|
async buffersinkGetFrame(frame) {
|
|
376
452
|
return await this.native.buffersinkGetFrame(frame.getNative());
|
|
377
453
|
}
|
|
454
|
+
/**
|
|
455
|
+
* Get frame from buffer sink filter synchronously.
|
|
456
|
+
* Synchronous version of buffersinkGetFrame.
|
|
457
|
+
*
|
|
458
|
+
* Retrieves a filtered frame from a buffer sink filter.
|
|
459
|
+
* Only valid for buffer sink filters (buffersink, abuffersink).
|
|
460
|
+
*
|
|
461
|
+
* Direct mapping to av_buffersink_get_frame().
|
|
462
|
+
*
|
|
463
|
+
* @param frame - Frame to receive filtered data
|
|
464
|
+
*
|
|
465
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
466
|
+
* - AVERROR_EAGAIN: Need more input
|
|
467
|
+
* - AVERROR_EOF: No more frames available
|
|
468
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* ```typescript
|
|
472
|
+
* import { Frame, FFmpegError } from 'node-av';
|
|
473
|
+
* import { AVERROR_EAGAIN, AVERROR_EOF } from 'node-av/constants';
|
|
474
|
+
*
|
|
475
|
+
* // Get filtered frame
|
|
476
|
+
* const filtered = new Frame();
|
|
477
|
+
* const ret = bufferSink.buffersinkGetFrameSync(filtered);
|
|
478
|
+
*
|
|
479
|
+
* if (ret === 0) {
|
|
480
|
+
* // Process filtered frame
|
|
481
|
+
* console.log(`Got filtered frame with ${filtered.nbSamples} samples`);
|
|
482
|
+
* filtered.unref();
|
|
483
|
+
* } else if (ret === AVERROR_EAGAIN) {
|
|
484
|
+
* // Need more input frames
|
|
485
|
+
* } else if (ret === AVERROR_EOF) {
|
|
486
|
+
* // No more frames
|
|
487
|
+
* } else {
|
|
488
|
+
* FFmpegError.throwIfError(ret, 'buffersinkGetFrameSync');
|
|
489
|
+
* }
|
|
490
|
+
* ```
|
|
491
|
+
*
|
|
492
|
+
* @see {@link buffersinkGetFrame} For async version
|
|
493
|
+
*/
|
|
494
|
+
buffersinkGetFrameSync(frame) {
|
|
495
|
+
return this.native.buffersinkGetFrameSync(frame.getNative());
|
|
496
|
+
}
|
|
378
497
|
/**
|
|
379
498
|
* Get time base from buffer sink.
|
|
380
499
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-context.js","sourceRoot":"","sources":["../../src/lib/filter-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM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AAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,sBAAsB;QACpB,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;QAChD,OAAO,IAAI,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,uBAAuB;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,0BAA0B;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,EAAE,CAAC;IAClD,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,IAAI;QACF,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -153,8 +153,11 @@ export declare class FilterGraph extends OptionMember<NativeFilterGraph> impleme
|
|
|
153
153
|
* Direct mapping to avfilter_graph_create_filter().
|
|
154
154
|
*
|
|
155
155
|
* @param filter - Filter descriptor to instantiate
|
|
156
|
+
*
|
|
156
157
|
* @param name - Name for this filter instance
|
|
158
|
+
*
|
|
157
159
|
* @param args - Initialization arguments (filter-specific)
|
|
160
|
+
*
|
|
158
161
|
* @returns Created filter context, or null on failure
|
|
159
162
|
*
|
|
160
163
|
* @example
|
|
@@ -187,7 +190,9 @@ export declare class FilterGraph extends OptionMember<NativeFilterGraph> impleme
|
|
|
187
190
|
* Direct mapping to avfilter_graph_alloc_filter().
|
|
188
191
|
*
|
|
189
192
|
* @param filter - Filter descriptor to instantiate
|
|
193
|
+
*
|
|
190
194
|
* @param name - Name for this filter instance
|
|
195
|
+
*
|
|
191
196
|
* @returns Allocated filter context, or null on failure
|
|
192
197
|
*
|
|
193
198
|
* @example
|
|
@@ -216,6 +221,7 @@ export declare class FilterGraph extends OptionMember<NativeFilterGraph> impleme
|
|
|
216
221
|
* Direct mapping to avfilter_graph_get_filter().
|
|
217
222
|
*
|
|
218
223
|
* @param name - Name of the filter instance
|
|
224
|
+
*
|
|
219
225
|
* @returns Filter context if found, null otherwise
|
|
220
226
|
*
|
|
221
227
|
* @example
|
|
@@ -258,6 +264,32 @@ export declare class FilterGraph extends OptionMember<NativeFilterGraph> impleme
|
|
|
258
264
|
* @see {@link validate} To check configuration
|
|
259
265
|
*/
|
|
260
266
|
config(): Promise<number>;
|
|
267
|
+
/**
|
|
268
|
+
* Configure the filter graph synchronously.
|
|
269
|
+
* Synchronous version of config.
|
|
270
|
+
*
|
|
271
|
+
* Validates and finalizes the graph structure after all filters
|
|
272
|
+
* have been added and connected. Must be called before processing.
|
|
273
|
+
*
|
|
274
|
+
* Direct mapping to avfilter_graph_config().
|
|
275
|
+
*
|
|
276
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
277
|
+
* - AVERROR_EINVAL: Invalid graph structure
|
|
278
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```typescript
|
|
282
|
+
* import { FFmpegError } from 'node-av';
|
|
283
|
+
*
|
|
284
|
+
* // Configure graph after building
|
|
285
|
+
* const ret = graph.configSync();
|
|
286
|
+
* FFmpegError.throwIfError(ret, 'configSync');
|
|
287
|
+
* // Graph is now ready for processing
|
|
288
|
+
* ```
|
|
289
|
+
*
|
|
290
|
+
* @see {@link config} For async version
|
|
291
|
+
*/
|
|
292
|
+
configSync(): number;
|
|
261
293
|
/**
|
|
262
294
|
* Parse a filter graph description.
|
|
263
295
|
*
|
|
@@ -267,8 +299,11 @@ export declare class FilterGraph extends OptionMember<NativeFilterGraph> impleme
|
|
|
267
299
|
* Direct mapping to avfilter_graph_parse().
|
|
268
300
|
*
|
|
269
301
|
* @param filters - Filter graph description string
|
|
302
|
+
*
|
|
270
303
|
* @param inputs - Linked list of graph inputs
|
|
304
|
+
*
|
|
271
305
|
* @param outputs - Linked list of graph outputs
|
|
306
|
+
*
|
|
272
307
|
* @returns 0 on success, negative AVERROR on error:
|
|
273
308
|
* - AVERROR_EINVAL: Parse error
|
|
274
309
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -305,6 +340,7 @@ export declare class FilterGraph extends OptionMember<NativeFilterGraph> impleme
|
|
|
305
340
|
* Direct mapping to avfilter_graph_parse2().
|
|
306
341
|
*
|
|
307
342
|
* @param filters - Filter graph description string
|
|
343
|
+
*
|
|
308
344
|
* @returns 0 on success, negative AVERROR on error:
|
|
309
345
|
* - AVERROR_EINVAL: Parse error
|
|
310
346
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -331,8 +367,11 @@ export declare class FilterGraph extends OptionMember<NativeFilterGraph> impleme
|
|
|
331
367
|
* Direct mapping to avfilter_graph_parse_ptr().
|
|
332
368
|
*
|
|
333
369
|
* @param filters - Filter graph description string
|
|
370
|
+
*
|
|
334
371
|
* @param inputs - Optional linked list of inputs
|
|
372
|
+
*
|
|
335
373
|
* @param outputs - Optional linked list of outputs
|
|
374
|
+
*
|
|
336
375
|
* @returns 0 on success, negative AVERROR on error:
|
|
337
376
|
* - AVERROR_EINVAL: Parse error
|
|
338
377
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -399,6 +438,38 @@ export declare class FilterGraph extends OptionMember<NativeFilterGraph> impleme
|
|
|
399
438
|
* ```
|
|
400
439
|
*/
|
|
401
440
|
requestOldest(): Promise<number>;
|
|
441
|
+
/**
|
|
442
|
+
* Request the oldest queued frame from filters synchronously.
|
|
443
|
+
* Synchronous version of requestOldest.
|
|
444
|
+
*
|
|
445
|
+
* Requests a frame from the oldest sink in the graph.
|
|
446
|
+
* Used for pulling frames through the filter pipeline.
|
|
447
|
+
*
|
|
448
|
+
* Direct mapping to avfilter_graph_request_oldest().
|
|
449
|
+
*
|
|
450
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
451
|
+
* - AVERROR_EOF: No more frames
|
|
452
|
+
* - AVERROR_EAGAIN: Need more input
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```typescript
|
|
456
|
+
* import { FFmpegError } from 'node-av';
|
|
457
|
+
* import { AVERROR_EOF, AVERROR_EAGAIN } from 'node-av/constants';
|
|
458
|
+
*
|
|
459
|
+
* // Pull frames through the graph
|
|
460
|
+
* const ret = graph.requestOldestSync();
|
|
461
|
+
* if (ret === AVERROR_EOF) {
|
|
462
|
+
* // All frames processed
|
|
463
|
+
* } else if (ret === AVERROR_EAGAIN) {
|
|
464
|
+
* // Need more input frames
|
|
465
|
+
* } else {
|
|
466
|
+
* FFmpegError.throwIfError(ret, 'requestOldestSync');
|
|
467
|
+
* }
|
|
468
|
+
* ```
|
|
469
|
+
*
|
|
470
|
+
* @see {@link requestOldest} For async version
|
|
471
|
+
*/
|
|
472
|
+
requestOldestSync(): number;
|
|
402
473
|
/**
|
|
403
474
|
* Dump the filter graph to a string.
|
|
404
475
|
*
|
|
@@ -428,9 +499,13 @@ export declare class FilterGraph extends OptionMember<NativeFilterGraph> impleme
|
|
|
428
499
|
* Direct mapping to avfilter_graph_send_command().
|
|
429
500
|
*
|
|
430
501
|
* @param target - Filter name or "all"
|
|
502
|
+
*
|
|
431
503
|
* @param cmd - Command to send
|
|
504
|
+
*
|
|
432
505
|
* @param arg - Command argument
|
|
506
|
+
*
|
|
433
507
|
* @param flags - Command flags
|
|
508
|
+
*
|
|
434
509
|
* @returns Error code or response object
|
|
435
510
|
*
|
|
436
511
|
* @example
|
|
@@ -464,10 +539,15 @@ export declare class FilterGraph extends OptionMember<NativeFilterGraph> impleme
|
|
|
464
539
|
* Direct mapping to avfilter_graph_queue_command().
|
|
465
540
|
*
|
|
466
541
|
* @param target - Filter name or "all"
|
|
542
|
+
*
|
|
467
543
|
* @param cmd - Command to queue
|
|
544
|
+
*
|
|
468
545
|
* @param arg - Command argument
|
|
546
|
+
*
|
|
469
547
|
* @param ts - Timestamp for execution
|
|
548
|
+
*
|
|
470
549
|
* @param flags - Command flags
|
|
550
|
+
*
|
|
471
551
|
* @returns 0 on success, negative AVERROR on error
|
|
472
552
|
*
|
|
473
553
|
* @example
|