node-av 6.2.0-beta.3 → 6.2.0-beta.31
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 +13 -8
- package/dist/api/audio-frame-buffer.d.ts +438 -7
- package/dist/api/audio-frame-buffer.js +792 -52
- package/dist/api/audio-frame-buffer.js.map +1 -1
- package/dist/api/bitstream-filter.d.ts +82 -4
- package/dist/api/bitstream-filter.js +197 -100
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +5 -0
- package/dist/api/decoder.js +13 -6
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/demuxer.d.ts +29 -4
- package/dist/api/demuxer.js +209 -60
- package/dist/api/demuxer.js.map +1 -1
- package/dist/api/encoder-pool.d.ts +43 -1
- package/dist/api/encoder-pool.js +121 -9
- package/dist/api/encoder-pool.js.map +1 -1
- package/dist/api/encoder.d.ts +58 -2
- package/dist/api/encoder.js +173 -57
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter.js +15 -6
- package/dist/api/filter.js.map +1 -1
- package/dist/api/fmp4-stream.d.ts +327 -8
- package/dist/api/fmp4-stream.js +663 -123
- package/dist/api/fmp4-stream.js.map +1 -1
- package/dist/api/hardware.d.ts +2 -0
- package/dist/api/hardware.js +25 -4
- package/dist/api/hardware.js.map +1 -1
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js.map +1 -1
- package/dist/api/io-stream.d.ts +3 -2
- package/dist/api/io-stream.js +77 -5
- package/dist/api/io-stream.js.map +1 -1
- package/dist/api/muxer.d.ts +289 -7
- package/dist/api/muxer.js +696 -109
- package/dist/api/muxer.js.map +1 -1
- package/dist/api/pipeline.d.ts +24 -0
- package/dist/api/pipeline.js +76 -5
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/rtp-stream.d.ts +77 -8
- package/dist/api/rtp-stream.js +316 -88
- package/dist/api/rtp-stream.js.map +1 -1
- package/dist/api/scaler.d.ts +124 -21
- package/dist/api/scaler.js +347 -114
- package/dist/api/scaler.js.map +1 -1
- package/dist/api/utilities/async-queue.d.ts +3 -0
- package/dist/api/utilities/async-queue.js +8 -0
- package/dist/api/utilities/async-queue.js.map +1 -1
- package/dist/api/utilities/packet-age-watchdog.d.ts +198 -0
- package/dist/api/utilities/packet-age-watchdog.js +594 -0
- package/dist/api/utilities/packet-age-watchdog.js.map +1 -0
- package/dist/api/webrtc-stream.d.ts +2 -0
- package/dist/api/webrtc-stream.js +46 -12
- package/dist/api/webrtc-stream.js.map +1 -1
- package/dist/api/whisper.d.ts +2 -0
- package/dist/api/whisper.js +63 -23
- package/dist/api/whisper.js.map +1 -1
- package/dist/constants/constants.d.ts +1 -0
- package/dist/constants/constants.js +1 -0
- package/dist/constants/constants.js.map +1 -1
- package/dist/constants/filter-options.d.ts +2 -0
- package/dist/ffmpeg/install.js +104 -26
- package/dist/ffmpeg/install.js.map +1 -1
- package/dist/ffmpeg/utils.js +7 -4
- package/dist/ffmpeg/utils.js.map +1 -1
- package/dist/lib/binding.d.ts +10 -1
- package/dist/lib/binding.js +25 -16
- package/dist/lib/binding.js.map +1 -1
- package/dist/lib/bitstream-filter-context.d.ts +2 -0
- package/dist/lib/bitstream-filter-context.js +2 -0
- package/dist/lib/bitstream-filter-context.js.map +1 -1
- package/dist/lib/codec-context.d.ts +0 -2
- package/dist/lib/codec-context.js +4 -22
- package/dist/lib/codec-context.js.map +1 -1
- package/dist/lib/filter-context.d.ts +3 -1
- package/dist/lib/filter-context.js +5 -11
- package/dist/lib/filter-context.js.map +1 -1
- package/dist/lib/filter-graph-segment.d.ts +3 -2
- package/dist/lib/filter-graph-segment.js +3 -2
- package/dist/lib/filter-graph-segment.js.map +1 -1
- package/dist/lib/filter-graph.d.ts +4 -4
- package/dist/lib/filter-graph.js +4 -4
- package/dist/lib/filter-inout.d.ts +4 -0
- package/dist/lib/filter-inout.js +4 -0
- package/dist/lib/filter-inout.js.map +1 -1
- package/dist/lib/format-context.d.ts +72 -7
- package/dist/lib/format-context.js +80 -22
- package/dist/lib/format-context.js.map +1 -1
- package/dist/lib/frame.d.ts +17 -13
- package/dist/lib/frame.js +24 -23
- package/dist/lib/frame.js.map +1 -1
- package/dist/lib/hardware-frames-context.d.ts +0 -1
- package/dist/lib/hardware-frames-context.js +2 -8
- package/dist/lib/hardware-frames-context.js.map +1 -1
- package/dist/lib/io-context.d.ts +4 -2
- package/dist/lib/io-context.js +4 -2
- package/dist/lib/io-context.js.map +1 -1
- package/dist/lib/native-types.d.ts +7 -5
- package/dist/lib/option.d.ts +26 -0
- package/dist/lib/option.js +42 -18
- package/dist/lib/option.js.map +1 -1
- package/dist/lib/packet.d.ts +5 -0
- package/dist/lib/packet.js +5 -0
- package/dist/lib/packet.js.map +1 -1
- package/dist/lib/stream.d.ts +8 -4
- package/dist/lib/stream.js +22 -24
- package/dist/lib/stream.js.map +1 -1
- package/install/check.js +40 -79
- package/package.json +45 -34
- package/build_mac_local.sh +0 -69
|
@@ -73,7 +73,6 @@ export interface RTSPStreamInfo {
|
|
|
73
73
|
* @see {@link Stream} For stream management
|
|
74
74
|
*/
|
|
75
75
|
export declare class FormatContext extends OptionMember<NativeFormatContext> implements AsyncDisposable, NativeWrapper<NativeFormatContext> {
|
|
76
|
-
private _metadata?;
|
|
77
76
|
private _ioContext;
|
|
78
77
|
constructor();
|
|
79
78
|
/**
|
|
@@ -166,7 +165,8 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
|
|
|
166
165
|
*
|
|
167
166
|
* Key-value pairs of metadata (title, author, etc.).
|
|
168
167
|
*
|
|
169
|
-
*
|
|
168
|
+
* Returns a copy of AVFormatContext->metadata - mutating the returned
|
|
169
|
+
* Dictionary does not affect the context. Assign it back to apply changes.
|
|
170
170
|
*/
|
|
171
171
|
get metadata(): Dictionary | null;
|
|
172
172
|
set metadata(value: Dictionary | null);
|
|
@@ -191,6 +191,10 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
|
|
|
191
191
|
* Custom I/O context.
|
|
192
192
|
*
|
|
193
193
|
* For custom I/O operations instead of file I/O.
|
|
194
|
+
* Assigning a callback-backed context also sets AVFMT_FLAG_CUSTOM_IO so libavformat never closes it.
|
|
195
|
+
* A context opened with open2() is closed once, by whichever comes first: its closep(), which
|
|
196
|
+
* also clears this pb like `avio_closep(&ctx->pb)` in C, or closing or freeing this output context.
|
|
197
|
+
* An IOContext can be the pb of one FormatContext at a time.
|
|
194
198
|
*
|
|
195
199
|
* Direct mapping to AVFormatContext->pb.
|
|
196
200
|
*/
|
|
@@ -465,9 +469,16 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
|
|
|
465
469
|
* Close an input format context.
|
|
466
470
|
*
|
|
467
471
|
* Closes input file and releases resources.
|
|
472
|
+
* A pb with JS callbacks stops serving this input: a read, seek or open
|
|
473
|
+
* still waiting for one of its callbacks fails with AVERROR_EXIT, and its
|
|
474
|
+
* callbacks are not called again, so a stalled source cannot block the close.
|
|
468
475
|
*
|
|
469
476
|
* Direct mapping to avformat_close_input().
|
|
470
477
|
*
|
|
478
|
+
* @param detachPb - Forget a caller-owned pb (custom IOContext) once the
|
|
479
|
+
* reader thread has stopped, so it is not closed with the input. Setting
|
|
480
|
+
* `pb = null` yourself throws while an async reader is active.
|
|
481
|
+
*
|
|
471
482
|
* @returns Promise that resolves when closed
|
|
472
483
|
*
|
|
473
484
|
* @example
|
|
@@ -478,12 +489,13 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
|
|
|
478
489
|
*
|
|
479
490
|
* @see {@link openInput} To open input
|
|
480
491
|
*/
|
|
481
|
-
closeInput(): Promise<void>;
|
|
492
|
+
closeInput(detachPb?: boolean): Promise<void>;
|
|
482
493
|
/**
|
|
483
494
|
* Close an input format context synchronously.
|
|
484
495
|
* Synchronous version of closeInput.
|
|
485
496
|
*
|
|
486
497
|
* Closes input file and releases resources.
|
|
498
|
+
* A pb with JS callbacks stops serving this input (see closeInput).
|
|
487
499
|
*
|
|
488
500
|
* Direct mapping to avformat_close_input().
|
|
489
501
|
*
|
|
@@ -494,8 +506,10 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
|
|
|
494
506
|
* ```
|
|
495
507
|
*
|
|
496
508
|
* @see {@link closeInput} For async version
|
|
509
|
+
*
|
|
510
|
+
* @param detachPb - Forget a caller-owned pb once the reader stopped (see closeInput)
|
|
497
511
|
*/
|
|
498
|
-
closeInputSync(): void;
|
|
512
|
+
closeInputSync(detachPb?: boolean): void;
|
|
499
513
|
/**
|
|
500
514
|
* Analyze streams to get stream info.
|
|
501
515
|
*
|
|
@@ -519,6 +533,7 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
|
|
|
519
533
|
* console.log(`Found ${ctx.nbStreams} streams`);
|
|
520
534
|
* ```
|
|
521
535
|
*
|
|
536
|
+
* @see {@link findStreamInfoSync} For synchronous version
|
|
522
537
|
* @see {@link openInput} Must be called first
|
|
523
538
|
*/
|
|
524
539
|
findStreamInfo(options?: Dictionary[] | null): Promise<number>;
|
|
@@ -531,7 +546,7 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
|
|
|
531
546
|
*
|
|
532
547
|
* Direct mapping to avformat_find_stream_info().
|
|
533
548
|
*
|
|
534
|
-
* @param options -
|
|
549
|
+
* @param options - Per-stream options array
|
|
535
550
|
*
|
|
536
551
|
* @returns >=0 on success, negative AVERROR on error:
|
|
537
552
|
* - AVERROR_EOF: End of file reached
|
|
@@ -548,7 +563,7 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
|
|
|
548
563
|
*
|
|
549
564
|
* @see {@link findStreamInfo} For async version
|
|
550
565
|
*/
|
|
551
|
-
findStreamInfoSync(options?: Dictionary | null): number;
|
|
566
|
+
findStreamInfoSync(options?: Dictionary[] | null): number;
|
|
552
567
|
/**
|
|
553
568
|
* Read next packet from the input.
|
|
554
569
|
*
|
|
@@ -561,7 +576,14 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
|
|
|
561
576
|
*
|
|
562
577
|
* @returns 0 on success, negative AVERROR on error:
|
|
563
578
|
* - AVERROR_EOF: End of file
|
|
564
|
-
* -
|
|
579
|
+
* - AVERROR_EXIT: Aborted by interrupt() or closeInput()
|
|
580
|
+
*
|
|
581
|
+
* The first call starts the context's own reader thread, which is the only
|
|
582
|
+
* thread touching the input from then on: it blocks in av_read_frame(),
|
|
583
|
+
* retries EAGAIN itself and hands packets over through a bounded queue, so
|
|
584
|
+
* a waiting read never occupies a libuv threadpool thread. seekFrame(),
|
|
585
|
+
* seekFile(), sendRTSPPacket() and findStreamInfo() run on that thread
|
|
586
|
+
* between two reads; the sync variants throw while it is active.
|
|
565
587
|
*
|
|
566
588
|
* @example
|
|
567
589
|
* ```typescript
|
|
@@ -721,9 +743,49 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
|
|
|
721
743
|
* FFmpegError.throwIfError(ret, 'seekFile');
|
|
722
744
|
* ```
|
|
723
745
|
*
|
|
746
|
+
* @see {@link seekFileSync} For synchronous version
|
|
724
747
|
* @see {@link seekFrame} For simpler seeking
|
|
725
748
|
*/
|
|
726
749
|
seekFile(streamIndex: number, minTs: bigint, ts: bigint, maxTs: bigint, flags?: AVSeekFlag): Promise<number>;
|
|
750
|
+
/**
|
|
751
|
+
* Seek to timestamp with bounds synchronously.
|
|
752
|
+
* Synchronous version of seekFile.
|
|
753
|
+
*
|
|
754
|
+
* More precise seeking with min/max timestamp bounds.
|
|
755
|
+
*
|
|
756
|
+
* Direct mapping to avformat_seek_file().
|
|
757
|
+
*
|
|
758
|
+
* @param streamIndex - Stream to seek in (-1 for default)
|
|
759
|
+
*
|
|
760
|
+
* @param minTs - Minimum acceptable timestamp
|
|
761
|
+
*
|
|
762
|
+
* @param ts - Target timestamp
|
|
763
|
+
*
|
|
764
|
+
* @param maxTs - Maximum acceptable timestamp
|
|
765
|
+
*
|
|
766
|
+
* @param flags - Seek flags
|
|
767
|
+
*
|
|
768
|
+
* @returns >=0 on success, negative AVERROR on error
|
|
769
|
+
*
|
|
770
|
+
* @example
|
|
771
|
+
* ```typescript
|
|
772
|
+
* import { FFmpegError } from 'node-av';
|
|
773
|
+
*
|
|
774
|
+
* // Seek to 10s with 0.5s tolerance
|
|
775
|
+
* const target = 10000n;
|
|
776
|
+
* const ret = ctx.seekFileSync(
|
|
777
|
+
* -1,
|
|
778
|
+
* target - 500n,
|
|
779
|
+
* target,
|
|
780
|
+
* target + 500n
|
|
781
|
+
* );
|
|
782
|
+
* FFmpegError.throwIfError(ret, 'seekFileSync');
|
|
783
|
+
* ```
|
|
784
|
+
*
|
|
785
|
+
* @see {@link seekFile} For async version
|
|
786
|
+
* @see {@link seekFrameSync} For simpler seeking
|
|
787
|
+
*/
|
|
788
|
+
seekFileSync(streamIndex: number, minTs: bigint, ts: bigint, maxTs: bigint, flags?: AVSeekFlag): number;
|
|
727
789
|
/**
|
|
728
790
|
* Write file header.
|
|
729
791
|
*
|
|
@@ -1161,6 +1223,9 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
|
|
|
1161
1223
|
* quiet RTSP socket) returns immediately instead of waiting for data. The
|
|
1162
1224
|
* context is not freed and remains valid - this only aborts the pending
|
|
1163
1225
|
* operation, so a reader can drain and shut down before closing the input.
|
|
1226
|
+
* An input pb with JS callbacks stops serving the input as on close: a call
|
|
1227
|
+
* waiting for one of its callbacks fails with AVERROR_EXIT, and its callbacks
|
|
1228
|
+
* are not called again.
|
|
1164
1229
|
*
|
|
1165
1230
|
* @example
|
|
1166
1231
|
* ```typescript
|
|
@@ -55,7 +55,6 @@ import { Stream } from './stream.js';
|
|
|
55
55
|
* @see {@link Stream} For stream management
|
|
56
56
|
*/
|
|
57
57
|
export class FormatContext extends OptionMember {
|
|
58
|
-
_metadata; // Cache for metadata wrapper
|
|
59
58
|
_ioContext = null;
|
|
60
59
|
constructor() {
|
|
61
60
|
super(new bindings.FormatContext());
|
|
@@ -176,28 +175,20 @@ export class FormatContext extends OptionMember {
|
|
|
176
175
|
*
|
|
177
176
|
* Key-value pairs of metadata (title, author, etc.).
|
|
178
177
|
*
|
|
179
|
-
*
|
|
178
|
+
* Returns a copy of AVFormatContext->metadata - mutating the returned
|
|
179
|
+
* Dictionary does not affect the context. Assign it back to apply changes.
|
|
180
180
|
*/
|
|
181
181
|
get metadata() {
|
|
182
182
|
const native = this.native.metadata;
|
|
183
183
|
if (!native) {
|
|
184
|
-
// Clear cache if native is null
|
|
185
|
-
this._metadata = undefined;
|
|
186
184
|
return null;
|
|
187
185
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
// Create and cache new wrapper
|
|
193
|
-
const device = Object.create(Dictionary.prototype);
|
|
194
|
-
device.native = native;
|
|
195
|
-
this._metadata = device;
|
|
196
|
-
return device;
|
|
186
|
+
const dict = Object.create(Dictionary.prototype);
|
|
187
|
+
dict.native = native;
|
|
188
|
+
return dict;
|
|
197
189
|
}
|
|
198
190
|
set metadata(value) {
|
|
199
191
|
this.native.metadata = value?.getNative() ?? null;
|
|
200
|
-
this._metadata = undefined;
|
|
201
192
|
}
|
|
202
193
|
/**
|
|
203
194
|
* Input format descriptor.
|
|
@@ -234,6 +225,10 @@ export class FormatContext extends OptionMember {
|
|
|
234
225
|
* Custom I/O context.
|
|
235
226
|
*
|
|
236
227
|
* For custom I/O operations instead of file I/O.
|
|
228
|
+
* Assigning a callback-backed context also sets AVFMT_FLAG_CUSTOM_IO so libavformat never closes it.
|
|
229
|
+
* A context opened with open2() is closed once, by whichever comes first: its closep(), which
|
|
230
|
+
* also clears this pb like `avio_closep(&ctx->pb)` in C, or closing or freeing this output context.
|
|
231
|
+
* An IOContext can be the pb of one FormatContext at a time.
|
|
237
232
|
*
|
|
238
233
|
* Direct mapping to AVFormatContext->pb.
|
|
239
234
|
*/
|
|
@@ -241,8 +236,8 @@ export class FormatContext extends OptionMember {
|
|
|
241
236
|
return this._ioContext;
|
|
242
237
|
}
|
|
243
238
|
set pb(value) {
|
|
244
|
-
this._ioContext = value;
|
|
245
239
|
this.native.pb = value?.getNative() ?? null;
|
|
240
|
+
this._ioContext = value;
|
|
246
241
|
}
|
|
247
242
|
/**
|
|
248
243
|
* Number of streams in the container.
|
|
@@ -556,9 +551,16 @@ export class FormatContext extends OptionMember {
|
|
|
556
551
|
* Close an input format context.
|
|
557
552
|
*
|
|
558
553
|
* Closes input file and releases resources.
|
|
554
|
+
* A pb with JS callbacks stops serving this input: a read, seek or open
|
|
555
|
+
* still waiting for one of its callbacks fails with AVERROR_EXIT, and its
|
|
556
|
+
* callbacks are not called again, so a stalled source cannot block the close.
|
|
559
557
|
*
|
|
560
558
|
* Direct mapping to avformat_close_input().
|
|
561
559
|
*
|
|
560
|
+
* @param detachPb - Forget a caller-owned pb (custom IOContext) once the
|
|
561
|
+
* reader thread has stopped, so it is not closed with the input. Setting
|
|
562
|
+
* `pb = null` yourself throws while an async reader is active.
|
|
563
|
+
*
|
|
562
564
|
* @returns Promise that resolves when closed
|
|
563
565
|
*
|
|
564
566
|
* @example
|
|
@@ -569,14 +571,15 @@ export class FormatContext extends OptionMember {
|
|
|
569
571
|
*
|
|
570
572
|
* @see {@link openInput} To open input
|
|
571
573
|
*/
|
|
572
|
-
async closeInput() {
|
|
573
|
-
return await this.native.closeInput();
|
|
574
|
+
async closeInput(detachPb = false) {
|
|
575
|
+
return await this.native.closeInput(detachPb);
|
|
574
576
|
}
|
|
575
577
|
/**
|
|
576
578
|
* Close an input format context synchronously.
|
|
577
579
|
* Synchronous version of closeInput.
|
|
578
580
|
*
|
|
579
581
|
* Closes input file and releases resources.
|
|
582
|
+
* A pb with JS callbacks stops serving this input (see closeInput).
|
|
580
583
|
*
|
|
581
584
|
* Direct mapping to avformat_close_input().
|
|
582
585
|
*
|
|
@@ -587,9 +590,11 @@ export class FormatContext extends OptionMember {
|
|
|
587
590
|
* ```
|
|
588
591
|
*
|
|
589
592
|
* @see {@link closeInput} For async version
|
|
593
|
+
*
|
|
594
|
+
* @param detachPb - Forget a caller-owned pb once the reader stopped (see closeInput)
|
|
590
595
|
*/
|
|
591
|
-
closeInputSync() {
|
|
592
|
-
this.native.closeInputSync();
|
|
596
|
+
closeInputSync(detachPb = false) {
|
|
597
|
+
this.native.closeInputSync(detachPb);
|
|
593
598
|
}
|
|
594
599
|
/**
|
|
595
600
|
* Analyze streams to get stream info.
|
|
@@ -614,6 +619,7 @@ export class FormatContext extends OptionMember {
|
|
|
614
619
|
* console.log(`Found ${ctx.nbStreams} streams`);
|
|
615
620
|
* ```
|
|
616
621
|
*
|
|
622
|
+
* @see {@link findStreamInfoSync} For synchronous version
|
|
617
623
|
* @see {@link openInput} Must be called first
|
|
618
624
|
*/
|
|
619
625
|
async findStreamInfo(options = null) {
|
|
@@ -628,7 +634,7 @@ export class FormatContext extends OptionMember {
|
|
|
628
634
|
*
|
|
629
635
|
* Direct mapping to avformat_find_stream_info().
|
|
630
636
|
*
|
|
631
|
-
* @param options -
|
|
637
|
+
* @param options - Per-stream options array
|
|
632
638
|
*
|
|
633
639
|
* @returns >=0 on success, negative AVERROR on error:
|
|
634
640
|
* - AVERROR_EOF: End of file reached
|
|
@@ -646,7 +652,7 @@ export class FormatContext extends OptionMember {
|
|
|
646
652
|
* @see {@link findStreamInfo} For async version
|
|
647
653
|
*/
|
|
648
654
|
findStreamInfoSync(options = null) {
|
|
649
|
-
return this.native.findStreamInfoSync(options?.getNative() ?? null);
|
|
655
|
+
return this.native.findStreamInfoSync(options?.map((d) => d.getNative()) ?? null);
|
|
650
656
|
}
|
|
651
657
|
/**
|
|
652
658
|
* Read next packet from the input.
|
|
@@ -660,7 +666,14 @@ export class FormatContext extends OptionMember {
|
|
|
660
666
|
*
|
|
661
667
|
* @returns 0 on success, negative AVERROR on error:
|
|
662
668
|
* - AVERROR_EOF: End of file
|
|
663
|
-
* -
|
|
669
|
+
* - AVERROR_EXIT: Aborted by interrupt() or closeInput()
|
|
670
|
+
*
|
|
671
|
+
* The first call starts the context's own reader thread, which is the only
|
|
672
|
+
* thread touching the input from then on: it blocks in av_read_frame(),
|
|
673
|
+
* retries EAGAIN itself and hands packets over through a bounded queue, so
|
|
674
|
+
* a waiting read never occupies a libuv threadpool thread. seekFrame(),
|
|
675
|
+
* seekFile(), sendRTSPPacket() and findStreamInfo() run on that thread
|
|
676
|
+
* between two reads; the sync variants throw while it is active.
|
|
664
677
|
*
|
|
665
678
|
* @example
|
|
666
679
|
* ```typescript
|
|
@@ -828,11 +841,53 @@ export class FormatContext extends OptionMember {
|
|
|
828
841
|
* FFmpegError.throwIfError(ret, 'seekFile');
|
|
829
842
|
* ```
|
|
830
843
|
*
|
|
844
|
+
* @see {@link seekFileSync} For synchronous version
|
|
831
845
|
* @see {@link seekFrame} For simpler seeking
|
|
832
846
|
*/
|
|
833
847
|
async seekFile(streamIndex, minTs, ts, maxTs, flags = AVFLAG_NONE) {
|
|
834
848
|
return await this.native.seekFile(streamIndex, minTs, ts, maxTs, flags);
|
|
835
849
|
}
|
|
850
|
+
/**
|
|
851
|
+
* Seek to timestamp with bounds synchronously.
|
|
852
|
+
* Synchronous version of seekFile.
|
|
853
|
+
*
|
|
854
|
+
* More precise seeking with min/max timestamp bounds.
|
|
855
|
+
*
|
|
856
|
+
* Direct mapping to avformat_seek_file().
|
|
857
|
+
*
|
|
858
|
+
* @param streamIndex - Stream to seek in (-1 for default)
|
|
859
|
+
*
|
|
860
|
+
* @param minTs - Minimum acceptable timestamp
|
|
861
|
+
*
|
|
862
|
+
* @param ts - Target timestamp
|
|
863
|
+
*
|
|
864
|
+
* @param maxTs - Maximum acceptable timestamp
|
|
865
|
+
*
|
|
866
|
+
* @param flags - Seek flags
|
|
867
|
+
*
|
|
868
|
+
* @returns >=0 on success, negative AVERROR on error
|
|
869
|
+
*
|
|
870
|
+
* @example
|
|
871
|
+
* ```typescript
|
|
872
|
+
* import { FFmpegError } from 'node-av';
|
|
873
|
+
*
|
|
874
|
+
* // Seek to 10s with 0.5s tolerance
|
|
875
|
+
* const target = 10000n;
|
|
876
|
+
* const ret = ctx.seekFileSync(
|
|
877
|
+
* -1,
|
|
878
|
+
* target - 500n,
|
|
879
|
+
* target,
|
|
880
|
+
* target + 500n
|
|
881
|
+
* );
|
|
882
|
+
* FFmpegError.throwIfError(ret, 'seekFileSync');
|
|
883
|
+
* ```
|
|
884
|
+
*
|
|
885
|
+
* @see {@link seekFile} For async version
|
|
886
|
+
* @see {@link seekFrameSync} For simpler seeking
|
|
887
|
+
*/
|
|
888
|
+
seekFileSync(streamIndex, minTs, ts, maxTs, flags = AVFLAG_NONE) {
|
|
889
|
+
return this.native.seekFileSync(streamIndex, minTs, ts, maxTs, flags);
|
|
890
|
+
}
|
|
836
891
|
/**
|
|
837
892
|
* Write file header.
|
|
838
893
|
*
|
|
@@ -1277,6 +1332,9 @@ export class FormatContext extends OptionMember {
|
|
|
1277
1332
|
* quiet RTSP socket) returns immediately instead of waiting for data. The
|
|
1278
1333
|
* context is not freed and remains valid - this only aborts the pending
|
|
1279
1334
|
* operation, so a reader can drain and shut down before closing the input.
|
|
1335
|
+
* An input pb with JS callbacks stops serving the input as on close: a call
|
|
1336
|
+
* waiting for one of its callbacks fails with AVERROR_EXIT, and its callbacks
|
|
1337
|
+
* are not called again.
|
|
1280
1338
|
*
|
|
1281
1339
|
* @example
|
|
1282
1340
|
* ```typescript
|
|
@@ -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,oBAAo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AM,CAAC,YAAY,CAAC,EAAE,CAAC;IAC3C,CAAC;CACF"}
|
package/dist/lib/frame.d.ts
CHANGED
|
@@ -128,7 +128,6 @@ export interface DmaBufFrame {
|
|
|
128
128
|
*/
|
|
129
129
|
export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
130
130
|
private native;
|
|
131
|
-
private _hwFramesCtx?;
|
|
132
131
|
constructor();
|
|
133
132
|
/**
|
|
134
133
|
* Create a video frame from a buffer with pixel data.
|
|
@@ -808,28 +807,28 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
808
807
|
*/
|
|
809
808
|
clone(): Frame | null;
|
|
810
809
|
/**
|
|
811
|
-
*
|
|
810
|
+
* Allocate data buffers for the frame.
|
|
812
811
|
*
|
|
813
|
-
*
|
|
812
|
+
* Allocates buffers based on frame parameters.
|
|
814
813
|
* Must set format, width/height (video) or format, nb_samples, channel_layout (audio) first.
|
|
815
814
|
*
|
|
816
815
|
* Direct mapping to av_frame_get_buffer().
|
|
817
816
|
*
|
|
818
817
|
* @param align - Buffer size alignment (0 for default)
|
|
819
818
|
*
|
|
820
|
-
* @returns
|
|
819
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
821
820
|
* - AVERROR_EINVAL: Invalid frame parameters
|
|
821
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
822
822
|
*
|
|
823
823
|
* @example
|
|
824
824
|
* ```typescript
|
|
825
825
|
* import { FFmpegError } from 'node-av';
|
|
826
826
|
*
|
|
827
|
-
* const
|
|
828
|
-
* FFmpegError.throwIfError(
|
|
829
|
-
* console.log(`Buffer size: ${size} bytes`);
|
|
827
|
+
* const ret = frame.getBuffer();
|
|
828
|
+
* FFmpegError.throwIfError(ret, 'getBuffer');
|
|
830
829
|
* ```
|
|
831
830
|
*
|
|
832
|
-
* @see {@link allocBuffer}
|
|
831
|
+
* @see {@link allocBuffer} Equivalent without alignment parameter
|
|
833
832
|
*/
|
|
834
833
|
getBuffer(align?: number): number;
|
|
835
834
|
/**
|
|
@@ -856,7 +855,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
856
855
|
* FFmpegError.throwIfError(ret, 'allocBuffer');
|
|
857
856
|
* ```
|
|
858
857
|
*
|
|
859
|
-
* @see {@link getBuffer}
|
|
858
|
+
* @see {@link getBuffer} Equivalent with an alignment parameter
|
|
860
859
|
*/
|
|
861
860
|
allocBuffer(): number;
|
|
862
861
|
/**
|
|
@@ -942,8 +941,9 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
942
941
|
/**
|
|
943
942
|
* Fill frame data from buffer.
|
|
944
943
|
*
|
|
945
|
-
* Copies data from buffer into frame data planes
|
|
946
|
-
*
|
|
944
|
+
* Copies data from buffer into frame-owned data planes; the frame never
|
|
945
|
+
* references the source buffer, so it may be reused or garbage collected
|
|
946
|
+
* afterwards. Allocates the frame's buffers if not already allocated.
|
|
947
947
|
*
|
|
948
948
|
* @param buffer - Source buffer with frame data
|
|
949
949
|
*
|
|
@@ -968,10 +968,14 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
968
968
|
* For audio frames, handles both planar and interleaved formats.
|
|
969
969
|
* Cannot be used with hardware frames - use hwframeTransferData first.
|
|
970
970
|
*
|
|
971
|
-
* @
|
|
971
|
+
* @param output - Optional Buffer to copy into instead of allocating one; it must hold at least the frame's size and must not overlap the frame's data
|
|
972
|
+
*
|
|
973
|
+
* @returns Buffer containing frame data (a view of `output` when given)
|
|
972
974
|
*
|
|
973
975
|
* @throws {Error} If frame is not allocated, has no data, or is a hardware frame
|
|
974
976
|
*
|
|
977
|
+
* @throws {TypeError} If `output` is not a Buffer or is smaller than the frame data
|
|
978
|
+
*
|
|
975
979
|
* @example Video frame to buffer
|
|
976
980
|
* ```typescript
|
|
977
981
|
* // Get YUV420P video frame as buffer
|
|
@@ -1010,7 +1014,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
1010
1014
|
* @see {@link isHwFrame} To check if frame is hardware
|
|
1011
1015
|
* @see {@link data} To access individual planes
|
|
1012
1016
|
*/
|
|
1013
|
-
toBuffer(): Buffer;
|
|
1017
|
+
toBuffer(output?: Buffer): Buffer;
|
|
1014
1018
|
/**
|
|
1015
1019
|
* Transfer data between hardware and software frames.
|
|
1016
1020
|
*
|
package/dist/lib/frame.js
CHANGED
|
@@ -48,7 +48,6 @@ import { Dictionary } from './dictionary.js';
|
|
|
48
48
|
*/
|
|
49
49
|
export class Frame {
|
|
50
50
|
native;
|
|
51
|
-
_hwFramesCtx; // Cache for hardware frames context wrapper
|
|
52
51
|
constructor() {
|
|
53
52
|
this.native = new bindings.Frame();
|
|
54
53
|
}
|
|
@@ -624,25 +623,18 @@ export class Frame {
|
|
|
624
623
|
* Direct mapping to AVFrame->hw_frames_ctx.
|
|
625
624
|
*/
|
|
626
625
|
get hwFramesCtx() {
|
|
627
|
-
//
|
|
628
|
-
|
|
629
|
-
return this._hwFramesCtx;
|
|
630
|
-
}
|
|
626
|
+
// Not cached: the frame's hw_frames_ctx changes across unref()/reuse, and the
|
|
627
|
+
// native wrapper holds its own AVBufferRef, so a fresh wrapper per access is safe
|
|
631
628
|
const native = this.native.hwFramesCtx;
|
|
632
629
|
if (!native) {
|
|
633
|
-
this._hwFramesCtx = null;
|
|
634
630
|
return null;
|
|
635
631
|
}
|
|
636
|
-
// Create and cache the wrapper
|
|
637
632
|
const frames = Object.create(HardwareFramesContext.prototype);
|
|
638
633
|
frames.native = native;
|
|
639
|
-
this._hwFramesCtx = frames;
|
|
640
634
|
return frames;
|
|
641
635
|
}
|
|
642
636
|
set hwFramesCtx(value) {
|
|
643
637
|
this.native.hwFramesCtx = value?.getNative() ?? null;
|
|
644
|
-
// Clear the cache as the underlying context has changed
|
|
645
|
-
this._hwFramesCtx = undefined;
|
|
646
638
|
}
|
|
647
639
|
/**
|
|
648
640
|
* Frame flags.
|
|
@@ -992,28 +984,28 @@ export class Frame {
|
|
|
992
984
|
return frame;
|
|
993
985
|
}
|
|
994
986
|
/**
|
|
995
|
-
*
|
|
987
|
+
* Allocate data buffers for the frame.
|
|
996
988
|
*
|
|
997
|
-
*
|
|
989
|
+
* Allocates buffers based on frame parameters.
|
|
998
990
|
* Must set format, width/height (video) or format, nb_samples, channel_layout (audio) first.
|
|
999
991
|
*
|
|
1000
992
|
* Direct mapping to av_frame_get_buffer().
|
|
1001
993
|
*
|
|
1002
994
|
* @param align - Buffer size alignment (0 for default)
|
|
1003
995
|
*
|
|
1004
|
-
* @returns
|
|
996
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
1005
997
|
* - AVERROR_EINVAL: Invalid frame parameters
|
|
998
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
1006
999
|
*
|
|
1007
1000
|
* @example
|
|
1008
1001
|
* ```typescript
|
|
1009
1002
|
* import { FFmpegError } from 'node-av';
|
|
1010
1003
|
*
|
|
1011
|
-
* const
|
|
1012
|
-
* FFmpegError.throwIfError(
|
|
1013
|
-
* console.log(`Buffer size: ${size} bytes`);
|
|
1004
|
+
* const ret = frame.getBuffer();
|
|
1005
|
+
* FFmpegError.throwIfError(ret, 'getBuffer');
|
|
1014
1006
|
* ```
|
|
1015
1007
|
*
|
|
1016
|
-
* @see {@link allocBuffer}
|
|
1008
|
+
* @see {@link allocBuffer} Equivalent without alignment parameter
|
|
1017
1009
|
*/
|
|
1018
1010
|
getBuffer(align = 0) {
|
|
1019
1011
|
return this.native.getBuffer(align);
|
|
@@ -1042,7 +1034,7 @@ export class Frame {
|
|
|
1042
1034
|
* FFmpegError.throwIfError(ret, 'allocBuffer');
|
|
1043
1035
|
* ```
|
|
1044
1036
|
*
|
|
1045
|
-
* @see {@link getBuffer}
|
|
1037
|
+
* @see {@link getBuffer} Equivalent with an alignment parameter
|
|
1046
1038
|
*/
|
|
1047
1039
|
allocBuffer() {
|
|
1048
1040
|
return this.native.allocBuffer();
|
|
@@ -1136,8 +1128,9 @@ export class Frame {
|
|
|
1136
1128
|
/**
|
|
1137
1129
|
* Fill frame data from buffer.
|
|
1138
1130
|
*
|
|
1139
|
-
* Copies data from buffer into frame data planes
|
|
1140
|
-
*
|
|
1131
|
+
* Copies data from buffer into frame-owned data planes; the frame never
|
|
1132
|
+
* references the source buffer, so it may be reused or garbage collected
|
|
1133
|
+
* afterwards. Allocates the frame's buffers if not already allocated.
|
|
1141
1134
|
*
|
|
1142
1135
|
* @param buffer - Source buffer with frame data
|
|
1143
1136
|
*
|
|
@@ -1164,10 +1157,14 @@ export class Frame {
|
|
|
1164
1157
|
* For audio frames, handles both planar and interleaved formats.
|
|
1165
1158
|
* Cannot be used with hardware frames - use hwframeTransferData first.
|
|
1166
1159
|
*
|
|
1167
|
-
* @
|
|
1160
|
+
* @param output - Optional Buffer to copy into instead of allocating one; it must hold at least the frame's size and must not overlap the frame's data
|
|
1161
|
+
*
|
|
1162
|
+
* @returns Buffer containing frame data (a view of `output` when given)
|
|
1168
1163
|
*
|
|
1169
1164
|
* @throws {Error} If frame is not allocated, has no data, or is a hardware frame
|
|
1170
1165
|
*
|
|
1166
|
+
* @throws {TypeError} If `output` is not a Buffer or is smaller than the frame data
|
|
1167
|
+
*
|
|
1171
1168
|
* @example Video frame to buffer
|
|
1172
1169
|
* ```typescript
|
|
1173
1170
|
* // Get YUV420P video frame as buffer
|
|
@@ -1206,8 +1203,12 @@ export class Frame {
|
|
|
1206
1203
|
* @see {@link isHwFrame} To check if frame is hardware
|
|
1207
1204
|
* @see {@link data} To access individual planes
|
|
1208
1205
|
*/
|
|
1209
|
-
toBuffer() {
|
|
1210
|
-
|
|
1206
|
+
toBuffer(output) {
|
|
1207
|
+
// The native side accepts any Uint8Array, but the result would then not be a Buffer
|
|
1208
|
+
if (output !== undefined && !Buffer.isBuffer(output)) {
|
|
1209
|
+
throw new TypeError('output must be a Buffer');
|
|
1210
|
+
}
|
|
1211
|
+
return this.native.toBuffer(output);
|
|
1211
1212
|
}
|
|
1212
1213
|
/**
|
|
1213
1214
|
* Transfer data between hardware and software frames.
|