node-av 2.0.0 → 2.4.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 +18 -5
- 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 +194 -0
- package/dist/api/decoder.js +313 -0
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/encoder.d.ts +263 -0
- package/dist/api/encoder.js +427 -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 +234 -9
- package/dist/api/filter.js +372 -9
- package/dist/api/filter.js.map +1 -1
- package/dist/api/hardware.d.ts +17 -0
- package/dist/api/hardware.js +28 -17
- 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 +214 -1
- package/dist/api/media-input.js +341 -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 +73 -8
- 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 +32 -7
- 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 +218 -0
- package/dist/lib/io-context.js +234 -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 +19 -17
|
@@ -315,8 +315,11 @@ export class FormatContext extends OptionMember {
|
|
|
315
315
|
* Direct mapping to avformat_alloc_output_context2().
|
|
316
316
|
*
|
|
317
317
|
* @param oformat - Specific output format to use
|
|
318
|
+
*
|
|
318
319
|
* @param formatName - Format name (e.g., 'mp4', 'mkv')
|
|
320
|
+
*
|
|
319
321
|
* @param filename - Filename to guess format from extension
|
|
322
|
+
*
|
|
320
323
|
* @returns 0 on success, negative AVERROR on error:
|
|
321
324
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
322
325
|
* - AVERROR_EINVAL: Invalid parameters
|
|
@@ -384,6 +387,32 @@ export class FormatContext extends OptionMember {
|
|
|
384
387
|
async openOutput() {
|
|
385
388
|
return await this.native.openOutput();
|
|
386
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* Open output file synchronously.
|
|
392
|
+
* Synchronous version of openOutput.
|
|
393
|
+
*
|
|
394
|
+
* Opens output file for writing.
|
|
395
|
+
* I/O context must be set before calling.
|
|
396
|
+
*
|
|
397
|
+
* Direct mapping to avio_open2().
|
|
398
|
+
*
|
|
399
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
400
|
+
* - AVERROR(EIO): I/O error
|
|
401
|
+
* - AVERROR(ENOMEM): Memory allocation failure
|
|
402
|
+
*
|
|
403
|
+
* @example
|
|
404
|
+
* ```typescript
|
|
405
|
+
* import { FFmpegError } from 'node-av';
|
|
406
|
+
*
|
|
407
|
+
* const ret = ctx.openOutputSync();
|
|
408
|
+
* FFmpegError.throwIfError(ret, 'openOutputSync');
|
|
409
|
+
* ```
|
|
410
|
+
*
|
|
411
|
+
* @see {@link openOutput} For async version
|
|
412
|
+
*/
|
|
413
|
+
openOutputSync() {
|
|
414
|
+
return this.native.openOutputSync();
|
|
415
|
+
}
|
|
387
416
|
/**
|
|
388
417
|
* Close output file.
|
|
389
418
|
*
|
|
@@ -404,6 +433,25 @@ export class FormatContext extends OptionMember {
|
|
|
404
433
|
async closeOutput() {
|
|
405
434
|
return await this.native.closeOutput();
|
|
406
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* Close output file synchronously.
|
|
438
|
+
* Synchronous version of closeOutput.
|
|
439
|
+
*
|
|
440
|
+
* Closes the output file and releases I/O resources.
|
|
441
|
+
*
|
|
442
|
+
* Direct mapping to avio_closep().
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```typescript
|
|
446
|
+
* ctx.closeOutputSync();
|
|
447
|
+
* // Output file closed
|
|
448
|
+
* ```
|
|
449
|
+
*
|
|
450
|
+
* @see {@link closeOutput} For async version
|
|
451
|
+
*/
|
|
452
|
+
closeOutputSync() {
|
|
453
|
+
this.native.closeOutputSync();
|
|
454
|
+
}
|
|
407
455
|
/**
|
|
408
456
|
* Open input file for reading.
|
|
409
457
|
*
|
|
@@ -413,8 +461,11 @@ export class FormatContext extends OptionMember {
|
|
|
413
461
|
* Direct mapping to avformat_open_input().
|
|
414
462
|
*
|
|
415
463
|
* @param url - URL or file path to open
|
|
464
|
+
*
|
|
416
465
|
* @param fmt - Force specific input format (null for auto-detect)
|
|
466
|
+
*
|
|
417
467
|
* @param options - Format-specific options
|
|
468
|
+
*
|
|
418
469
|
* @returns 0 on success, negative AVERROR on error:
|
|
419
470
|
* - AVERROR_ENOENT: File not found
|
|
420
471
|
* - AVERROR_INVALIDDATA: Invalid file format
|
|
@@ -434,6 +485,39 @@ export class FormatContext extends OptionMember {
|
|
|
434
485
|
async openInput(url, fmt = null, options = null) {
|
|
435
486
|
return await this.native.openInput(url, fmt?.getNative() ?? null, options?.getNative() ?? null);
|
|
436
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* Open an input file or URL synchronously.
|
|
490
|
+
* Synchronous version of openInput.
|
|
491
|
+
*
|
|
492
|
+
* Opens a media file or stream for reading.
|
|
493
|
+
* The format is auto-detected if not specified.
|
|
494
|
+
*
|
|
495
|
+
* Direct mapping to avformat_open_input().
|
|
496
|
+
*
|
|
497
|
+
* @param url - File path or URL to open
|
|
498
|
+
*
|
|
499
|
+
* @param fmt - Force specific format (null for auto-detect)
|
|
500
|
+
*
|
|
501
|
+
* @param options - Format-specific options
|
|
502
|
+
*
|
|
503
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
504
|
+
* - AVERROR_EINVAL: Invalid arguments
|
|
505
|
+
* - AVERROR(EIO): I/O error
|
|
506
|
+
* - AVERROR(ENOMEM): Memory allocation failure
|
|
507
|
+
*
|
|
508
|
+
* @example
|
|
509
|
+
* ```typescript
|
|
510
|
+
* import { FFmpegError } from 'node-av';
|
|
511
|
+
*
|
|
512
|
+
* const ret = ctx.openInputSync('input.mp4');
|
|
513
|
+
* FFmpegError.throwIfError(ret, 'openInputSync');
|
|
514
|
+
* ```
|
|
515
|
+
*
|
|
516
|
+
* @see {@link openInput} For async version
|
|
517
|
+
*/
|
|
518
|
+
openInputSync(url, fmt = null, options = null) {
|
|
519
|
+
return this.native.openInputSync(url, fmt?.getNative() ?? null, options?.getNative() ?? null);
|
|
520
|
+
}
|
|
437
521
|
/**
|
|
438
522
|
* Close an input format context.
|
|
439
523
|
*
|
|
@@ -454,6 +538,25 @@ export class FormatContext extends OptionMember {
|
|
|
454
538
|
async closeInput() {
|
|
455
539
|
return await this.native.closeInput();
|
|
456
540
|
}
|
|
541
|
+
/**
|
|
542
|
+
* Close an input format context synchronously.
|
|
543
|
+
* Synchronous version of closeInput.
|
|
544
|
+
*
|
|
545
|
+
* Closes input file and releases resources.
|
|
546
|
+
*
|
|
547
|
+
* Direct mapping to avformat_close_input().
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* ```typescript
|
|
551
|
+
* ctx.closeInputSync();
|
|
552
|
+
* // Input closed and context freed
|
|
553
|
+
* ```
|
|
554
|
+
*
|
|
555
|
+
* @see {@link closeInput} For async version
|
|
556
|
+
*/
|
|
557
|
+
closeInputSync() {
|
|
558
|
+
this.native.closeInputSync();
|
|
559
|
+
}
|
|
457
560
|
/**
|
|
458
561
|
* Analyze streams to get stream info.
|
|
459
562
|
*
|
|
@@ -463,6 +566,7 @@ export class FormatContext extends OptionMember {
|
|
|
463
566
|
* Direct mapping to avformat_find_stream_info().
|
|
464
567
|
*
|
|
465
568
|
* @param options - Per-stream options array
|
|
569
|
+
*
|
|
466
570
|
* @returns >=0 on success, negative AVERROR on error:
|
|
467
571
|
* - AVERROR_EOF: End of file reached
|
|
468
572
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -481,6 +585,35 @@ export class FormatContext extends OptionMember {
|
|
|
481
585
|
async findStreamInfo(options = null) {
|
|
482
586
|
return await this.native.findStreamInfo(options?.map((d) => d.getNative()) ?? null);
|
|
483
587
|
}
|
|
588
|
+
/**
|
|
589
|
+
* Analyze streams to get stream info synchronously.
|
|
590
|
+
* Synchronous version of findStreamInfo.
|
|
591
|
+
*
|
|
592
|
+
* Reads packet headers to fill in stream information.
|
|
593
|
+
* Should be called after openInputSync for accurate stream data.
|
|
594
|
+
*
|
|
595
|
+
* Direct mapping to avformat_find_stream_info().
|
|
596
|
+
*
|
|
597
|
+
* @param options - Options dictionary (single, not array for sync version)
|
|
598
|
+
*
|
|
599
|
+
* @returns >=0 on success, negative AVERROR on error:
|
|
600
|
+
* - AVERROR_EOF: End of file reached
|
|
601
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
602
|
+
*
|
|
603
|
+
* @example
|
|
604
|
+
* ```typescript
|
|
605
|
+
* import { FFmpegError } from 'node-av';
|
|
606
|
+
*
|
|
607
|
+
* const ret = ctx.findStreamInfoSync();
|
|
608
|
+
* FFmpegError.throwIfError(ret, 'findStreamInfoSync');
|
|
609
|
+
* console.log(`Found ${ctx.nbStreams} streams`);
|
|
610
|
+
* ```
|
|
611
|
+
*
|
|
612
|
+
* @see {@link findStreamInfo} For async version
|
|
613
|
+
*/
|
|
614
|
+
findStreamInfoSync(options = null) {
|
|
615
|
+
return this.native.findStreamInfoSync(options?.getNative() ?? null);
|
|
616
|
+
}
|
|
484
617
|
/**
|
|
485
618
|
* Read next packet from the input.
|
|
486
619
|
*
|
|
@@ -490,6 +623,7 @@ export class FormatContext extends OptionMember {
|
|
|
490
623
|
* Direct mapping to av_read_frame().
|
|
491
624
|
*
|
|
492
625
|
* @param pkt - Packet to read into
|
|
626
|
+
*
|
|
493
627
|
* @returns 0 on success, negative AVERROR on error:
|
|
494
628
|
* - AVERROR_EOF: End of file
|
|
495
629
|
* - AVERROR_EAGAIN: Temporarily unavailable
|
|
@@ -519,6 +653,46 @@ export class FormatContext extends OptionMember {
|
|
|
519
653
|
async readFrame(pkt) {
|
|
520
654
|
return await this.native.readFrame(pkt.getNative());
|
|
521
655
|
}
|
|
656
|
+
/**
|
|
657
|
+
* Read next packet from the input synchronously.
|
|
658
|
+
* Synchronous version of readFrame.
|
|
659
|
+
*
|
|
660
|
+
* Reads and returns the next packet in the stream.
|
|
661
|
+
* Packet must be unreferenced after use.
|
|
662
|
+
*
|
|
663
|
+
* Direct mapping to av_read_frame().
|
|
664
|
+
*
|
|
665
|
+
* @param pkt - Packet to read into
|
|
666
|
+
*
|
|
667
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
668
|
+
* - AVERROR_EOF: End of file
|
|
669
|
+
* - AVERROR_EAGAIN: Temporarily unavailable
|
|
670
|
+
*
|
|
671
|
+
* @example
|
|
672
|
+
* ```typescript
|
|
673
|
+
* import { FFmpegError } from 'node-av';
|
|
674
|
+
* import { AVERROR_EOF } from 'node-av';
|
|
675
|
+
*
|
|
676
|
+
* const packet = new Packet();
|
|
677
|
+
* packet.alloc();
|
|
678
|
+
*
|
|
679
|
+
* let ret;
|
|
680
|
+
* while ((ret = ctx.readFrameSync(packet)) >= 0) {
|
|
681
|
+
* // Process packet
|
|
682
|
+
* console.log(`Stream ${packet.streamIndex}, PTS: ${packet.pts}`);
|
|
683
|
+
* packet.unref();
|
|
684
|
+
* }
|
|
685
|
+
*
|
|
686
|
+
* if (ret !== AVERROR_EOF) {
|
|
687
|
+
* FFmpegError.throwIfError(ret, 'readFrameSync');
|
|
688
|
+
* }
|
|
689
|
+
* ```
|
|
690
|
+
*
|
|
691
|
+
* @see {@link readFrame} For async version
|
|
692
|
+
*/
|
|
693
|
+
readFrameSync(pkt) {
|
|
694
|
+
return this.native.readFrameSync(pkt.getNative());
|
|
695
|
+
}
|
|
522
696
|
/**
|
|
523
697
|
* Seek to timestamp in stream.
|
|
524
698
|
*
|
|
@@ -527,8 +701,11 @@ export class FormatContext extends OptionMember {
|
|
|
527
701
|
* Direct mapping to av_seek_frame().
|
|
528
702
|
*
|
|
529
703
|
* @param streamIndex - Stream to seek in (-1 for default)
|
|
704
|
+
*
|
|
530
705
|
* @param timestamp - Target timestamp in stream time base
|
|
706
|
+
*
|
|
531
707
|
* @param flags - Seek flags (AVSEEK_FLAG_*)
|
|
708
|
+
*
|
|
532
709
|
* @returns >=0 on success, negative AVERROR on error:
|
|
533
710
|
* - AVERROR_EINVAL: Invalid parameters
|
|
534
711
|
* - AVERROR_EOF: Seek beyond file
|
|
@@ -548,6 +725,41 @@ export class FormatContext extends OptionMember {
|
|
|
548
725
|
async seekFrame(streamIndex, timestamp, flags = AVFLAG_NONE) {
|
|
549
726
|
return await this.native.seekFrame(streamIndex, timestamp, flags);
|
|
550
727
|
}
|
|
728
|
+
/**
|
|
729
|
+
* Seek to timestamp in stream synchronously.
|
|
730
|
+
* Synchronous version of seekFrame.
|
|
731
|
+
*
|
|
732
|
+
* Seeks to closest keyframe at or before timestamp.
|
|
733
|
+
* Timestamp is in stream timebase units.
|
|
734
|
+
*
|
|
735
|
+
* Direct mapping to av_seek_frame().
|
|
736
|
+
*
|
|
737
|
+
* @param streamIndex - Stream to seek in (-1 for default)
|
|
738
|
+
*
|
|
739
|
+
* @param timestamp - Target timestamp in stream timebase
|
|
740
|
+
*
|
|
741
|
+
* @param flags - Seek flags (AVSEEK_FLAG_*)
|
|
742
|
+
*
|
|
743
|
+
* @returns >=0 on success, negative AVERROR on error:
|
|
744
|
+
* - AVERROR_EINVAL: Invalid arguments
|
|
745
|
+
* - AVERROR(EIO): I/O error
|
|
746
|
+
*
|
|
747
|
+
* @example
|
|
748
|
+
* ```typescript
|
|
749
|
+
* import { FFmpegError } from 'node-av';
|
|
750
|
+
* import { AVSEEK_FLAG_BACKWARD } from 'node-av/constants';
|
|
751
|
+
*
|
|
752
|
+
* // Seek to 10 seconds
|
|
753
|
+
* const timestamp = 10n * 1000000n; // Assuming microsecond timebase
|
|
754
|
+
* const ret = ctx.seekFrameSync(-1, timestamp, AVSEEK_FLAG_BACKWARD);
|
|
755
|
+
* FFmpegError.throwIfError(ret, 'seekFrameSync');
|
|
756
|
+
* ```
|
|
757
|
+
*
|
|
758
|
+
* @see {@link seekFrame} For async version
|
|
759
|
+
*/
|
|
760
|
+
seekFrameSync(streamIndex, timestamp, flags = AVFLAG_NONE) {
|
|
761
|
+
return this.native.seekFrameSync(streamIndex, timestamp, flags);
|
|
762
|
+
}
|
|
551
763
|
/**
|
|
552
764
|
* Seek to timestamp with bounds.
|
|
553
765
|
*
|
|
@@ -556,10 +768,15 @@ export class FormatContext extends OptionMember {
|
|
|
556
768
|
* Direct mapping to avformat_seek_file().
|
|
557
769
|
*
|
|
558
770
|
* @param streamIndex - Stream to seek in (-1 for default)
|
|
771
|
+
*
|
|
559
772
|
* @param minTs - Minimum acceptable timestamp
|
|
773
|
+
*
|
|
560
774
|
* @param ts - Target timestamp
|
|
775
|
+
*
|
|
561
776
|
* @param maxTs - Maximum acceptable timestamp
|
|
777
|
+
*
|
|
562
778
|
* @param flags - Seek flags
|
|
779
|
+
*
|
|
563
780
|
* @returns >=0 on success, negative AVERROR on error
|
|
564
781
|
*
|
|
565
782
|
* @example
|
|
@@ -591,6 +808,7 @@ export class FormatContext extends OptionMember {
|
|
|
591
808
|
* Direct mapping to avformat_write_header().
|
|
592
809
|
*
|
|
593
810
|
* @param options - Muxer-specific options
|
|
811
|
+
*
|
|
594
812
|
* @returns 0 on success, negative AVERROR on error:
|
|
595
813
|
* - AVERROR_EINVAL: Invalid parameters
|
|
596
814
|
* - AVERROR_EIO: I/O error
|
|
@@ -610,6 +828,33 @@ export class FormatContext extends OptionMember {
|
|
|
610
828
|
async writeHeader(options = null) {
|
|
611
829
|
return await this.native.writeHeader(options?.getNative() ?? null);
|
|
612
830
|
}
|
|
831
|
+
/**
|
|
832
|
+
* Write file header synchronously.
|
|
833
|
+
* Synchronous version of writeHeader.
|
|
834
|
+
*
|
|
835
|
+
* Writes format header to output file.
|
|
836
|
+
* Must be called before writing packets.
|
|
837
|
+
*
|
|
838
|
+
* Direct mapping to avformat_write_header().
|
|
839
|
+
*
|
|
840
|
+
* @param options - Muxer-specific options
|
|
841
|
+
*
|
|
842
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
843
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
844
|
+
*
|
|
845
|
+
* @example
|
|
846
|
+
* ```typescript
|
|
847
|
+
* import { FFmpegError } from 'node-av';
|
|
848
|
+
*
|
|
849
|
+
* const ret = ctx.writeHeaderSync();
|
|
850
|
+
* FFmpegError.throwIfError(ret, 'writeHeaderSync');
|
|
851
|
+
* ```
|
|
852
|
+
*
|
|
853
|
+
* @see {@link writeHeader} For async version
|
|
854
|
+
*/
|
|
855
|
+
writeHeaderSync(options = null) {
|
|
856
|
+
return this.native.writeHeaderSync(options?.getNative() ?? null);
|
|
857
|
+
}
|
|
613
858
|
/**
|
|
614
859
|
* Write packet to output.
|
|
615
860
|
*
|
|
@@ -619,6 +864,7 @@ export class FormatContext extends OptionMember {
|
|
|
619
864
|
* Direct mapping to av_write_frame().
|
|
620
865
|
*
|
|
621
866
|
* @param pkt - Packet to write (null to flush)
|
|
867
|
+
*
|
|
622
868
|
* @returns 0 on success, negative AVERROR on error:
|
|
623
869
|
* - AVERROR_EINVAL: Invalid packet
|
|
624
870
|
* - AVERROR_EIO: I/O error
|
|
@@ -636,6 +882,32 @@ export class FormatContext extends OptionMember {
|
|
|
636
882
|
async writeFrame(pkt) {
|
|
637
883
|
return await this.native.writeFrame(pkt ? pkt.getNative() : null);
|
|
638
884
|
}
|
|
885
|
+
/**
|
|
886
|
+
* Write packet to output synchronously.
|
|
887
|
+
* Synchronous version of writeFrame.
|
|
888
|
+
*
|
|
889
|
+
* Writes a packet directly without interleaving.
|
|
890
|
+
* Caller must handle correct interleaving.
|
|
891
|
+
*
|
|
892
|
+
* Direct mapping to av_write_frame().
|
|
893
|
+
*
|
|
894
|
+
* @param pkt - Packet to write (null to flush)
|
|
895
|
+
*
|
|
896
|
+
* @returns 0 on success, negative AVERROR on error
|
|
897
|
+
*
|
|
898
|
+
* @example
|
|
899
|
+
* ```typescript
|
|
900
|
+
* import { FFmpegError } from 'node-av';
|
|
901
|
+
*
|
|
902
|
+
* const ret = ctx.writeFrameSync(packet);
|
|
903
|
+
* FFmpegError.throwIfError(ret, 'writeFrameSync');
|
|
904
|
+
* ```
|
|
905
|
+
*
|
|
906
|
+
* @see {@link writeFrame} For async version
|
|
907
|
+
*/
|
|
908
|
+
writeFrameSync(pkt) {
|
|
909
|
+
return this.native.writeFrameSync(pkt ? pkt.getNative() : null);
|
|
910
|
+
}
|
|
639
911
|
/**
|
|
640
912
|
* Write packet with automatic interleaving.
|
|
641
913
|
*
|
|
@@ -645,6 +917,7 @@ export class FormatContext extends OptionMember {
|
|
|
645
917
|
* Direct mapping to av_interleaved_write_frame().
|
|
646
918
|
*
|
|
647
919
|
* @param pkt - Packet to write (null to flush)
|
|
920
|
+
*
|
|
648
921
|
* @returns 0 on success, negative AVERROR on error:
|
|
649
922
|
* - AVERROR_EINVAL: Invalid packet
|
|
650
923
|
* - AVERROR_EIO: I/O error
|
|
@@ -666,6 +939,38 @@ export class FormatContext extends OptionMember {
|
|
|
666
939
|
async interleavedWriteFrame(pkt) {
|
|
667
940
|
return await this.native.interleavedWriteFrame(pkt ? pkt.getNative() : null);
|
|
668
941
|
}
|
|
942
|
+
/**
|
|
943
|
+
* Write packet with automatic interleaving synchronously.
|
|
944
|
+
* Synchronous version of interleavedWriteFrame.
|
|
945
|
+
*
|
|
946
|
+
* Writes packet with proper interleaving for muxing.
|
|
947
|
+
* Preferred method for writing packets.
|
|
948
|
+
*
|
|
949
|
+
* Direct mapping to av_interleaved_write_frame().
|
|
950
|
+
*
|
|
951
|
+
* @param pkt - Packet to write (null to flush)
|
|
952
|
+
*
|
|
953
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
954
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
955
|
+
* - AVERROR(EIO): I/O error
|
|
956
|
+
*
|
|
957
|
+
* @example
|
|
958
|
+
* ```typescript
|
|
959
|
+
* import { FFmpegError } from 'node-av';
|
|
960
|
+
*
|
|
961
|
+
* // Write packet
|
|
962
|
+
* const ret = ctx.interleavedWriteFrameSync(packet);
|
|
963
|
+
* FFmpegError.throwIfError(ret, 'interleavedWriteFrameSync');
|
|
964
|
+
*
|
|
965
|
+
* // Flush interleaved packets
|
|
966
|
+
* ctx.interleavedWriteFrameSync(null);
|
|
967
|
+
* ```
|
|
968
|
+
*
|
|
969
|
+
* @see {@link interleavedWriteFrame} For async version
|
|
970
|
+
*/
|
|
971
|
+
interleavedWriteFrameSync(pkt) {
|
|
972
|
+
return this.native.interleavedWriteFrameSync(pkt ? pkt.getNative() : null);
|
|
973
|
+
}
|
|
669
974
|
/**
|
|
670
975
|
* Write file trailer.
|
|
671
976
|
*
|
|
@@ -691,6 +996,31 @@ export class FormatContext extends OptionMember {
|
|
|
691
996
|
async writeTrailer() {
|
|
692
997
|
return await this.native.writeTrailer();
|
|
693
998
|
}
|
|
999
|
+
/**
|
|
1000
|
+
* Write file trailer synchronously.
|
|
1001
|
+
* Synchronous version of writeTrailer.
|
|
1002
|
+
*
|
|
1003
|
+
* Finalizes the output file, writing index and metadata.
|
|
1004
|
+
* Must be called to properly close output files.
|
|
1005
|
+
*
|
|
1006
|
+
* Direct mapping to av_write_trailer().
|
|
1007
|
+
*
|
|
1008
|
+
* @returns 0 on success, negative AVERROR on error
|
|
1009
|
+
*
|
|
1010
|
+
* @example
|
|
1011
|
+
* ```typescript
|
|
1012
|
+
* import { FFmpegError } from 'node-av';
|
|
1013
|
+
*
|
|
1014
|
+
* const ret = ctx.writeTrailerSync();
|
|
1015
|
+
* FFmpegError.throwIfError(ret, 'writeTrailerSync');
|
|
1016
|
+
* // File is now finalized
|
|
1017
|
+
* ```
|
|
1018
|
+
*
|
|
1019
|
+
* @see {@link writeTrailer} For async version
|
|
1020
|
+
*/
|
|
1021
|
+
writeTrailerSync() {
|
|
1022
|
+
return this.native.writeTrailerSync();
|
|
1023
|
+
}
|
|
694
1024
|
/**
|
|
695
1025
|
* Flush buffered data.
|
|
696
1026
|
*
|
|
@@ -700,12 +1030,31 @@ export class FormatContext extends OptionMember {
|
|
|
700
1030
|
*
|
|
701
1031
|
* @example
|
|
702
1032
|
* ```typescript
|
|
703
|
-
* ctx.flush();
|
|
1033
|
+
* await ctx.flush();
|
|
1034
|
+
* // Buffered data written to output
|
|
1035
|
+
* ```
|
|
1036
|
+
*/
|
|
1037
|
+
async flush() {
|
|
1038
|
+
await this.native.flush();
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Flush buffered data synchronously.
|
|
1042
|
+
* Synchronous version of flush.
|
|
1043
|
+
*
|
|
1044
|
+
* Flushes any buffered packets in muxers.
|
|
1045
|
+
*
|
|
1046
|
+
* Direct mapping to avio_flush().
|
|
1047
|
+
*
|
|
1048
|
+
* @example
|
|
1049
|
+
* ```typescript
|
|
1050
|
+
* ctx.flushSync();
|
|
704
1051
|
* // Buffered data written to output
|
|
705
1052
|
* ```
|
|
1053
|
+
*
|
|
1054
|
+
* @see {@link flush} For async version
|
|
706
1055
|
*/
|
|
707
|
-
|
|
708
|
-
this.native.
|
|
1056
|
+
flushSync() {
|
|
1057
|
+
this.native.flushSync();
|
|
709
1058
|
}
|
|
710
1059
|
/**
|
|
711
1060
|
* Print format information.
|
|
@@ -716,7 +1065,9 @@ export class FormatContext extends OptionMember {
|
|
|
716
1065
|
* Direct mapping to av_dump_format().
|
|
717
1066
|
*
|
|
718
1067
|
* @param index - Stream index to highlight (-1 for none)
|
|
1068
|
+
*
|
|
719
1069
|
* @param url - URL to display
|
|
1070
|
+
*
|
|
720
1071
|
* @param isOutput - True for output format, false for input
|
|
721
1072
|
*
|
|
722
1073
|
* @example
|
|
@@ -754,6 +1105,7 @@ export class FormatContext extends OptionMember {
|
|
|
754
1105
|
* Direct mapping to avformat_new_stream().
|
|
755
1106
|
*
|
|
756
1107
|
* @param c - Codec for the stream (optional)
|
|
1108
|
+
*
|
|
757
1109
|
* @returns New stream instance
|
|
758
1110
|
*
|
|
759
1111
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-context.js","sourceRoot":"","sources":["../../src/lib/format-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,OAAO,aAAc,SAAQ,YAAiC;IAC1D,UAAU,GAAqB,IAAI,CAAC;IAE5C;QACE,KAAK,CAAC,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;IACzB,CAAC;IAED,IAAI,GAAG,CAAC,KAAoB;QAC1B,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;IAC9B,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,OAAO;QACT,OAAO,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
|
|
342
342
|
* Direct mapping to av_frame_ref().
|
|
343
343
|
*
|
|
344
344
|
* @param src - Source frame to reference
|
|
345
|
+
*
|
|
345
346
|
* @returns 0 on success, negative AVERROR on error:
|
|
346
347
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
347
348
|
* - AVERROR_EINVAL: Invalid parameters
|
|
@@ -411,6 +412,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
411
412
|
* Direct mapping to av_frame_get_buffer().
|
|
412
413
|
*
|
|
413
414
|
* @param align - Buffer size alignment (0 for default)
|
|
415
|
+
*
|
|
414
416
|
* @returns Required buffer size in bytes, or negative AVERROR:
|
|
415
417
|
* - AVERROR_EINVAL: Invalid frame parameters
|
|
416
418
|
*
|
|
@@ -485,6 +487,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
485
487
|
* Direct mapping to av_frame_copy_props().
|
|
486
488
|
*
|
|
487
489
|
* @param src - Source frame to copy properties from
|
|
490
|
+
*
|
|
488
491
|
* @returns 0 on success, negative AVERROR on error:
|
|
489
492
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
490
493
|
*
|
|
@@ -509,6 +512,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
509
512
|
* Direct mapping to av_frame_copy().
|
|
510
513
|
*
|
|
511
514
|
* @param src - Source frame to copy from
|
|
515
|
+
*
|
|
512
516
|
* @returns 0 on success, negative AVERROR on error:
|
|
513
517
|
* - AVERROR_EINVAL: Incompatible frames
|
|
514
518
|
*
|
|
@@ -537,6 +541,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
537
541
|
* Frame must have allocated buffers.
|
|
538
542
|
*
|
|
539
543
|
* @param buffer - Source buffer with frame data
|
|
544
|
+
*
|
|
540
545
|
* @returns 0 on success, negative AVERROR on error:
|
|
541
546
|
* - AVERROR_EINVAL: Invalid parameters
|
|
542
547
|
*
|
|
@@ -559,7 +564,9 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
559
564
|
* Direct mapping to av_hwframe_transfer_data().
|
|
560
565
|
*
|
|
561
566
|
* @param dst - Destination frame (software or hardware)
|
|
567
|
+
*
|
|
562
568
|
* @param flags - Transfer flags (0 for default)
|
|
569
|
+
*
|
|
563
570
|
* @returns 0 on success, negative AVERROR on error:
|
|
564
571
|
* - AVERROR_EINVAL: Invalid parameters
|
|
565
572
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -579,6 +586,37 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
579
586
|
* @see {@link isSwFrame} To check if frame is software
|
|
580
587
|
*/
|
|
581
588
|
hwframeTransferData(dst: Frame, flags?: number): Promise<number>;
|
|
589
|
+
/**
|
|
590
|
+
* Transfer data between hardware and software frames synchronously.
|
|
591
|
+
* Synchronous version of hwframeTransferData.
|
|
592
|
+
*
|
|
593
|
+
* Copies frame data between GPU and system memory.
|
|
594
|
+
* Direction depends on source and destination frame types.
|
|
595
|
+
*
|
|
596
|
+
* Direct mapping to av_hwframe_transfer_data().
|
|
597
|
+
*
|
|
598
|
+
* @param dst - Destination frame (software or hardware)
|
|
599
|
+
*
|
|
600
|
+
* @param flags - Transfer flags (0 for default)
|
|
601
|
+
*
|
|
602
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
603
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
604
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
605
|
+
*
|
|
606
|
+
* @example
|
|
607
|
+
* ```typescript
|
|
608
|
+
* import { FFmpegError } from 'node-av';
|
|
609
|
+
*
|
|
610
|
+
* // Download from GPU to CPU
|
|
611
|
+
* const swFrame = new Frame();
|
|
612
|
+
* swFrame.alloc();
|
|
613
|
+
* const ret = hwFrame.hwframeTransferData(swFrame);
|
|
614
|
+
* FFmpegError.throwIfError(ret, 'hwframeTransferData');
|
|
615
|
+
* ```
|
|
616
|
+
*
|
|
617
|
+
* @see {@link hwframeTransferData} For async version
|
|
618
|
+
*/
|
|
619
|
+
hwframeTransferDataSync(dst: Frame, flags?: number): number;
|
|
582
620
|
/**
|
|
583
621
|
* Check if this is a hardware frame.
|
|
584
622
|
*
|
|
@@ -624,6 +662,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
624
662
|
* Direct mapping to av_frame_get_side_data().
|
|
625
663
|
*
|
|
626
664
|
* @param type - Type of side data to retrieve
|
|
665
|
+
*
|
|
627
666
|
* @returns Side data buffer, or null if not present
|
|
628
667
|
*
|
|
629
668
|
* @example
|
|
@@ -649,7 +688,9 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
649
688
|
* Direct mapping to av_frame_new_side_data().
|
|
650
689
|
*
|
|
651
690
|
* @param type - Type of side data
|
|
691
|
+
*
|
|
652
692
|
* @param size - Size in bytes to allocate
|
|
693
|
+
*
|
|
653
694
|
* @returns Allocated buffer for writing
|
|
654
695
|
*
|
|
655
696
|
* @throws {Error} If allocation fails
|