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
package/dist/lib/frame.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HardwareFramesContext } from './hardware-frames-context.js';
|
|
2
2
|
import { Rational } from './rational.js';
|
|
3
|
-
import type { AVChromaLocation, AVColorPrimaries, AVColorRange, AVColorSpace, AVColorTransferCharacteristic, AVFrameSideDataType, AVPictureType, AVPixelFormat, AVSampleFormat } from '../constants/constants.js';
|
|
3
|
+
import type { AVChromaLocation, AVColorPrimaries, AVColorRange, AVColorSpace, AVColorTransferCharacteristic, AVFrameSideDataType, AVMediaType, AVPictureType, AVPixelFormat, AVSampleFormat } from '../constants/constants.js';
|
|
4
4
|
import type { NativeFrame, NativeWrapper } from './native-types.js';
|
|
5
5
|
import type { ChannelLayout } from './types.js';
|
|
6
6
|
/**
|
|
@@ -254,6 +254,48 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
254
254
|
*/
|
|
255
255
|
get hwFramesCtx(): HardwareFramesContext | null;
|
|
256
256
|
set hwFramesCtx(value: HardwareFramesContext | null);
|
|
257
|
+
/**
|
|
258
|
+
* Check if this is a video frame.
|
|
259
|
+
*
|
|
260
|
+
* Video frames have width and height > 0.
|
|
261
|
+
*
|
|
262
|
+
* @returns true if this is a video frame
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* if (frame.isVideo()) {
|
|
267
|
+
* console.log(`Video frame: ${frame.width}x${frame.height}`);
|
|
268
|
+
* }
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
isVideo(): boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Check if this is an audio frame.
|
|
274
|
+
*
|
|
275
|
+
* Audio frames have sampleRate > 0 and nbSamples > 0.
|
|
276
|
+
*
|
|
277
|
+
* @returns true if this is an audio frame
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```typescript
|
|
281
|
+
* if (frame.isAudio()) {
|
|
282
|
+
* console.log(`Audio frame: ${frame.sampleRate}Hz, ${frame.nbSamples} samples`);
|
|
283
|
+
* }
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
isAudio(): boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Get the media type of this frame.
|
|
289
|
+
*
|
|
290
|
+
* @returns AVMEDIA_TYPE_VIDEO for video frames, AVMEDIA_TYPE_AUDIO for audio frames, or AVMEDIA_TYPE_UNKNOWN
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```typescript
|
|
294
|
+
* const type = frame.getMediaType();
|
|
295
|
+
* console.log(`Frame type: ${type}`);
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
getMediaType(): AVMediaType;
|
|
257
299
|
/**
|
|
258
300
|
* Allocate a new frame.
|
|
259
301
|
*
|
|
@@ -300,6 +342,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
300
342
|
* Direct mapping to av_frame_ref().
|
|
301
343
|
*
|
|
302
344
|
* @param src - Source frame to reference
|
|
345
|
+
*
|
|
303
346
|
* @returns 0 on success, negative AVERROR on error:
|
|
304
347
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
305
348
|
* - AVERROR_EINVAL: Invalid parameters
|
|
@@ -369,6 +412,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
369
412
|
* Direct mapping to av_frame_get_buffer().
|
|
370
413
|
*
|
|
371
414
|
* @param align - Buffer size alignment (0 for default)
|
|
415
|
+
*
|
|
372
416
|
* @returns Required buffer size in bytes, or negative AVERROR:
|
|
373
417
|
* - AVERROR_EINVAL: Invalid frame parameters
|
|
374
418
|
*
|
|
@@ -443,6 +487,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
443
487
|
* Direct mapping to av_frame_copy_props().
|
|
444
488
|
*
|
|
445
489
|
* @param src - Source frame to copy properties from
|
|
490
|
+
*
|
|
446
491
|
* @returns 0 on success, negative AVERROR on error:
|
|
447
492
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
448
493
|
*
|
|
@@ -467,6 +512,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
467
512
|
* Direct mapping to av_frame_copy().
|
|
468
513
|
*
|
|
469
514
|
* @param src - Source frame to copy from
|
|
515
|
+
*
|
|
470
516
|
* @returns 0 on success, negative AVERROR on error:
|
|
471
517
|
* - AVERROR_EINVAL: Incompatible frames
|
|
472
518
|
*
|
|
@@ -495,6 +541,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
495
541
|
* Frame must have allocated buffers.
|
|
496
542
|
*
|
|
497
543
|
* @param buffer - Source buffer with frame data
|
|
544
|
+
*
|
|
498
545
|
* @returns 0 on success, negative AVERROR on error:
|
|
499
546
|
* - AVERROR_EINVAL: Invalid parameters
|
|
500
547
|
*
|
|
@@ -517,7 +564,9 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
517
564
|
* Direct mapping to av_hwframe_transfer_data().
|
|
518
565
|
*
|
|
519
566
|
* @param dst - Destination frame (software or hardware)
|
|
567
|
+
*
|
|
520
568
|
* @param flags - Transfer flags (0 for default)
|
|
569
|
+
*
|
|
521
570
|
* @returns 0 on success, negative AVERROR on error:
|
|
522
571
|
* - AVERROR_EINVAL: Invalid parameters
|
|
523
572
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -537,6 +586,37 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
537
586
|
* @see {@link isSwFrame} To check if frame is software
|
|
538
587
|
*/
|
|
539
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;
|
|
540
620
|
/**
|
|
541
621
|
* Check if this is a hardware frame.
|
|
542
622
|
*
|
|
@@ -582,6 +662,7 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
582
662
|
* Direct mapping to av_frame_get_side_data().
|
|
583
663
|
*
|
|
584
664
|
* @param type - Type of side data to retrieve
|
|
665
|
+
*
|
|
585
666
|
* @returns Side data buffer, or null if not present
|
|
586
667
|
*
|
|
587
668
|
* @example
|
|
@@ -607,7 +688,9 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
607
688
|
* Direct mapping to av_frame_new_side_data().
|
|
608
689
|
*
|
|
609
690
|
* @param type - Type of side data
|
|
691
|
+
*
|
|
610
692
|
* @param size - Size in bytes to allocate
|
|
693
|
+
*
|
|
611
694
|
* @returns Allocated buffer for writing
|
|
612
695
|
*
|
|
613
696
|
* @throws {Error} If allocation fails
|
package/dist/lib/frame.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_UNKNOWN, AVMEDIA_TYPE_VIDEO } from '../constants/constants.js';
|
|
1
2
|
import { bindings } from './binding.js';
|
|
2
3
|
import { HardwareFramesContext } from './hardware-frames-context.js';
|
|
3
4
|
import { Rational } from './rational.js';
|
|
@@ -357,6 +358,58 @@ export class Frame {
|
|
|
357
358
|
// Clear the cache as the underlying context has changed
|
|
358
359
|
this._hwFramesCtx = undefined;
|
|
359
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* Check if this is a video frame.
|
|
363
|
+
*
|
|
364
|
+
* Video frames have width and height > 0.
|
|
365
|
+
*
|
|
366
|
+
* @returns true if this is a video frame
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```typescript
|
|
370
|
+
* if (frame.isVideo()) {
|
|
371
|
+
* console.log(`Video frame: ${frame.width}x${frame.height}`);
|
|
372
|
+
* }
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
375
|
+
isVideo() {
|
|
376
|
+
return this.width > 0 && this.height > 0;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Check if this is an audio frame.
|
|
380
|
+
*
|
|
381
|
+
* Audio frames have sampleRate > 0 and nbSamples > 0.
|
|
382
|
+
*
|
|
383
|
+
* @returns true if this is an audio frame
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* ```typescript
|
|
387
|
+
* if (frame.isAudio()) {
|
|
388
|
+
* console.log(`Audio frame: ${frame.sampleRate}Hz, ${frame.nbSamples} samples`);
|
|
389
|
+
* }
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
392
|
+
isAudio() {
|
|
393
|
+
return this.sampleRate > 0 && this.nbSamples > 0;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Get the media type of this frame.
|
|
397
|
+
*
|
|
398
|
+
* @returns AVMEDIA_TYPE_VIDEO for video frames, AVMEDIA_TYPE_AUDIO for audio frames, or AVMEDIA_TYPE_UNKNOWN
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* ```typescript
|
|
402
|
+
* const type = frame.getMediaType();
|
|
403
|
+
* console.log(`Frame type: ${type}`);
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
getMediaType() {
|
|
407
|
+
if (this.isVideo())
|
|
408
|
+
return AVMEDIA_TYPE_VIDEO;
|
|
409
|
+
if (this.isAudio())
|
|
410
|
+
return AVMEDIA_TYPE_AUDIO;
|
|
411
|
+
return AVMEDIA_TYPE_UNKNOWN;
|
|
412
|
+
}
|
|
360
413
|
/**
|
|
361
414
|
* Allocate a new frame.
|
|
362
415
|
*
|
|
@@ -407,6 +460,7 @@ export class Frame {
|
|
|
407
460
|
* Direct mapping to av_frame_ref().
|
|
408
461
|
*
|
|
409
462
|
* @param src - Source frame to reference
|
|
463
|
+
*
|
|
410
464
|
* @returns 0 on success, negative AVERROR on error:
|
|
411
465
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
412
466
|
* - AVERROR_EINVAL: Invalid parameters
|
|
@@ -489,6 +543,7 @@ export class Frame {
|
|
|
489
543
|
* Direct mapping to av_frame_get_buffer().
|
|
490
544
|
*
|
|
491
545
|
* @param align - Buffer size alignment (0 for default)
|
|
546
|
+
*
|
|
492
547
|
* @returns Required buffer size in bytes, or negative AVERROR:
|
|
493
548
|
* - AVERROR_EINVAL: Invalid frame parameters
|
|
494
549
|
*
|
|
@@ -569,6 +624,7 @@ export class Frame {
|
|
|
569
624
|
* Direct mapping to av_frame_copy_props().
|
|
570
625
|
*
|
|
571
626
|
* @param src - Source frame to copy properties from
|
|
627
|
+
*
|
|
572
628
|
* @returns 0 on success, negative AVERROR on error:
|
|
573
629
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
574
630
|
*
|
|
@@ -595,6 +651,7 @@ export class Frame {
|
|
|
595
651
|
* Direct mapping to av_frame_copy().
|
|
596
652
|
*
|
|
597
653
|
* @param src - Source frame to copy from
|
|
654
|
+
*
|
|
598
655
|
* @returns 0 on success, negative AVERROR on error:
|
|
599
656
|
* - AVERROR_EINVAL: Incompatible frames
|
|
600
657
|
*
|
|
@@ -625,6 +682,7 @@ export class Frame {
|
|
|
625
682
|
* Frame must have allocated buffers.
|
|
626
683
|
*
|
|
627
684
|
* @param buffer - Source buffer with frame data
|
|
685
|
+
*
|
|
628
686
|
* @returns 0 on success, negative AVERROR on error:
|
|
629
687
|
* - AVERROR_EINVAL: Invalid parameters
|
|
630
688
|
*
|
|
@@ -649,7 +707,9 @@ export class Frame {
|
|
|
649
707
|
* Direct mapping to av_hwframe_transfer_data().
|
|
650
708
|
*
|
|
651
709
|
* @param dst - Destination frame (software or hardware)
|
|
710
|
+
*
|
|
652
711
|
* @param flags - Transfer flags (0 for default)
|
|
712
|
+
*
|
|
653
713
|
* @returns 0 on success, negative AVERROR on error:
|
|
654
714
|
* - AVERROR_EINVAL: Invalid parameters
|
|
655
715
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -671,6 +731,39 @@ export class Frame {
|
|
|
671
731
|
async hwframeTransferData(dst, flags) {
|
|
672
732
|
return await this.native.hwframeTransferData(dst.getNative(), flags ?? 0);
|
|
673
733
|
}
|
|
734
|
+
/**
|
|
735
|
+
* Transfer data between hardware and software frames synchronously.
|
|
736
|
+
* Synchronous version of hwframeTransferData.
|
|
737
|
+
*
|
|
738
|
+
* Copies frame data between GPU and system memory.
|
|
739
|
+
* Direction depends on source and destination frame types.
|
|
740
|
+
*
|
|
741
|
+
* Direct mapping to av_hwframe_transfer_data().
|
|
742
|
+
*
|
|
743
|
+
* @param dst - Destination frame (software or hardware)
|
|
744
|
+
*
|
|
745
|
+
* @param flags - Transfer flags (0 for default)
|
|
746
|
+
*
|
|
747
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
748
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
749
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
750
|
+
*
|
|
751
|
+
* @example
|
|
752
|
+
* ```typescript
|
|
753
|
+
* import { FFmpegError } from 'node-av';
|
|
754
|
+
*
|
|
755
|
+
* // Download from GPU to CPU
|
|
756
|
+
* const swFrame = new Frame();
|
|
757
|
+
* swFrame.alloc();
|
|
758
|
+
* const ret = hwFrame.hwframeTransferData(swFrame);
|
|
759
|
+
* FFmpegError.throwIfError(ret, 'hwframeTransferData');
|
|
760
|
+
* ```
|
|
761
|
+
*
|
|
762
|
+
* @see {@link hwframeTransferData} For async version
|
|
763
|
+
*/
|
|
764
|
+
hwframeTransferDataSync(dst, flags) {
|
|
765
|
+
return this.native.hwframeTransferDataSync(dst.getNative(), flags ?? 0);
|
|
766
|
+
}
|
|
674
767
|
/**
|
|
675
768
|
* Check if this is a hardware frame.
|
|
676
769
|
*
|
|
@@ -720,6 +813,7 @@ export class Frame {
|
|
|
720
813
|
* Direct mapping to av_frame_get_side_data().
|
|
721
814
|
*
|
|
722
815
|
* @param type - Type of side data to retrieve
|
|
816
|
+
*
|
|
723
817
|
* @returns Side data buffer, or null if not present
|
|
724
818
|
*
|
|
725
819
|
* @example
|
|
@@ -747,7 +841,9 @@ export class Frame {
|
|
|
747
841
|
* Direct mapping to av_frame_new_side_data().
|
|
748
842
|
*
|
|
749
843
|
* @param type - Type of side data
|
|
844
|
+
*
|
|
750
845
|
* @param size - Size in bytes to allocate
|
|
846
|
+
*
|
|
751
847
|
* @returns Allocated buffer for writing
|
|
752
848
|
*
|
|
753
849
|
* @throws {Error} If allocation fails
|
package/dist/lib/frame.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame.js","sourceRoot":"","sources":["../../src/lib/frame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"frame.js","sourceRoot":"","sources":["../../src/lib/frame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACzG,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,C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,OAAO,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -56,6 +56,7 @@ export declare class HardwareDeviceContext implements Disposable, NativeWrapper<
|
|
|
56
56
|
* Direct mapping to av_hwdevice_get_type_name().
|
|
57
57
|
*
|
|
58
58
|
* @param type - Hardware device type
|
|
59
|
+
*
|
|
59
60
|
* @returns Type name string, or null if invalid
|
|
60
61
|
*
|
|
61
62
|
* @example
|
|
@@ -98,6 +99,7 @@ export declare class HardwareDeviceContext implements Disposable, NativeWrapper<
|
|
|
98
99
|
* Direct mapping to av_hwdevice_find_type_by_name().
|
|
99
100
|
*
|
|
100
101
|
* @param name - Hardware type name (e.g., 'cuda', 'vaapi', 'videotoolbox')
|
|
102
|
+
*
|
|
101
103
|
* @returns Hardware device type enum, or AV_HWDEVICE_TYPE_NONE if not found
|
|
102
104
|
*
|
|
103
105
|
* @example
|
|
@@ -189,8 +191,11 @@ export declare class HardwareDeviceContext implements Disposable, NativeWrapper<
|
|
|
189
191
|
* Direct mapping to av_hwdevice_ctx_create().
|
|
190
192
|
*
|
|
191
193
|
* @param type - Hardware device type
|
|
194
|
+
*
|
|
192
195
|
* @param device - Device name/path (null for default)
|
|
196
|
+
*
|
|
193
197
|
* @param options - Device-specific options
|
|
198
|
+
*
|
|
194
199
|
* @returns 0 on success, negative AVERROR on error:
|
|
195
200
|
* - AVERROR_EINVAL: Invalid type or parameters
|
|
196
201
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -230,7 +235,9 @@ export declare class HardwareDeviceContext implements Disposable, NativeWrapper<
|
|
|
230
235
|
* Direct mapping to av_hwdevice_ctx_create_derived().
|
|
231
236
|
*
|
|
232
237
|
* @param source - Source device context to derive from
|
|
238
|
+
*
|
|
233
239
|
* @param type - Target hardware device type
|
|
240
|
+
*
|
|
234
241
|
* @returns 0 on success, negative AVERROR on error:
|
|
235
242
|
* - AVERROR_EINVAL: Invalid parameters
|
|
236
243
|
* - AVERROR_ENOSYS: Derivation not supported
|
|
@@ -301,6 +308,7 @@ export declare class HardwareDeviceContext implements Disposable, NativeWrapper<
|
|
|
301
308
|
* Direct mapping to av_hwdevice_get_hwframe_constraints().
|
|
302
309
|
*
|
|
303
310
|
* @param hwconfig - Optional hardware configuration
|
|
311
|
+
*
|
|
304
312
|
* @returns Frame constraints, or null if not available
|
|
305
313
|
*
|
|
306
314
|
* @example
|
|
@@ -56,6 +56,7 @@ export class HardwareDeviceContext {
|
|
|
56
56
|
* Direct mapping to av_hwdevice_get_type_name().
|
|
57
57
|
*
|
|
58
58
|
* @param type - Hardware device type
|
|
59
|
+
*
|
|
59
60
|
* @returns Type name string, or null if invalid
|
|
60
61
|
*
|
|
61
62
|
* @example
|
|
@@ -102,6 +103,7 @@ export class HardwareDeviceContext {
|
|
|
102
103
|
* Direct mapping to av_hwdevice_find_type_by_name().
|
|
103
104
|
*
|
|
104
105
|
* @param name - Hardware type name (e.g., 'cuda', 'vaapi', 'videotoolbox')
|
|
106
|
+
*
|
|
105
107
|
* @returns Hardware device type enum, or AV_HWDEVICE_TYPE_NONE if not found
|
|
106
108
|
*
|
|
107
109
|
* @example
|
|
@@ -203,8 +205,11 @@ export class HardwareDeviceContext {
|
|
|
203
205
|
* Direct mapping to av_hwdevice_ctx_create().
|
|
204
206
|
*
|
|
205
207
|
* @param type - Hardware device type
|
|
208
|
+
*
|
|
206
209
|
* @param device - Device name/path (null for default)
|
|
210
|
+
*
|
|
207
211
|
* @param options - Device-specific options
|
|
212
|
+
*
|
|
208
213
|
* @returns 0 on success, negative AVERROR on error:
|
|
209
214
|
* - AVERROR_EINVAL: Invalid type or parameters
|
|
210
215
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -246,7 +251,9 @@ export class HardwareDeviceContext {
|
|
|
246
251
|
* Direct mapping to av_hwdevice_ctx_create_derived().
|
|
247
252
|
*
|
|
248
253
|
* @param source - Source device context to derive from
|
|
254
|
+
*
|
|
249
255
|
* @param type - Target hardware device type
|
|
256
|
+
*
|
|
250
257
|
* @returns 0 on success, negative AVERROR on error:
|
|
251
258
|
* - AVERROR_EINVAL: Invalid parameters
|
|
252
259
|
* - AVERROR_ENOSYS: Derivation not supported
|
|
@@ -323,6 +330,7 @@ export class HardwareDeviceContext {
|
|
|
323
330
|
* Direct mapping to av_hwdevice_get_hwframe_constraints().
|
|
324
331
|
*
|
|
325
332
|
* @param hwconfig - Optional hardware configuration
|
|
333
|
+
*
|
|
326
334
|
* @returns Frame constraints, or null if not available
|
|
327
335
|
*
|
|
328
336
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardware-device-context.js","sourceRoot":"","sources":["../../src/lib/hardware-device-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAMxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,OAAO,qBAAqB;IACxB,MAAM,CAA8B;IAE5C;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,qBAAqB,EAAE,CAAC;IACrD,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"hardware-device-context.js","sourceRoot":"","sources":["../../src/lib/hardware-device-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAMxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,OAAO,qBAAqB;IACxB,MAAM,CAA8B;IAE5C;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,qBAAqB,EAAE,CAAC;IACrD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,WAAW,CAAC,IAAoB;QACrC,OAAO,QAAQ,CAAC,qBAAqB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IAED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,IAAI,EAAE,CAAC;IACrB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,qBAAqB,CAAC,QAAiB;QAQrC,OAAO,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACrD,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"}
|
|
@@ -192,7 +192,9 @@ export declare class HardwareFramesContext implements Disposable, NativeWrapper<
|
|
|
192
192
|
* Direct mapping to av_hwframe_get_buffer().
|
|
193
193
|
*
|
|
194
194
|
* @param frame - Frame to allocate buffer for
|
|
195
|
+
*
|
|
195
196
|
* @param flags - Allocation flags (usually 0)
|
|
197
|
+
*
|
|
196
198
|
* @returns 0 on success, negative AVERROR on error:
|
|
197
199
|
* - AVERROR_ENOMEM: No frames available in pool
|
|
198
200
|
* - AVERROR_EINVAL: Invalid parameters
|
|
@@ -219,8 +221,11 @@ export declare class HardwareFramesContext implements Disposable, NativeWrapper<
|
|
|
219
221
|
* Direct mapping to av_hwframe_transfer_data().
|
|
220
222
|
*
|
|
221
223
|
* @param dst - Destination frame
|
|
224
|
+
*
|
|
222
225
|
* @param src - Source frame
|
|
226
|
+
*
|
|
223
227
|
* @param flags - Transfer flags (usually 0)
|
|
228
|
+
*
|
|
224
229
|
* @returns 0 on success, negative AVERROR on error:
|
|
225
230
|
* - AVERROR_EINVAL: Invalid parameters
|
|
226
231
|
* - AVERROR_ENOSYS: Transfer not supported
|
|
@@ -248,6 +253,48 @@ export declare class HardwareFramesContext implements Disposable, NativeWrapper<
|
|
|
248
253
|
* @see {@link map} For zero-copy access
|
|
249
254
|
*/
|
|
250
255
|
transferData(dst: Frame, src: Frame, flags?: number): Promise<number>;
|
|
256
|
+
/**
|
|
257
|
+
* Transfer frame between hardware and system memory synchronously.
|
|
258
|
+
* Synchronous version of transferData.
|
|
259
|
+
*
|
|
260
|
+
* Copies frame data between GPU and CPU memory.
|
|
261
|
+
* Direction depends on frame types (hardware vs software).
|
|
262
|
+
*
|
|
263
|
+
* Direct mapping to av_hwframe_transfer_data().
|
|
264
|
+
*
|
|
265
|
+
* @param dst - Destination frame
|
|
266
|
+
*
|
|
267
|
+
* @param src - Source frame
|
|
268
|
+
*
|
|
269
|
+
* @param flags - Transfer flags (currently unused, pass 0)
|
|
270
|
+
*
|
|
271
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
272
|
+
* - AVERROR_EINVAL: Invalid frames
|
|
273
|
+
* - AVERROR_ENOSYS: Operation not supported
|
|
274
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```typescript
|
|
278
|
+
* import { Frame, FFmpegError } from 'node-av';
|
|
279
|
+
*
|
|
280
|
+
* // Download from GPU to CPU
|
|
281
|
+
* const cpuFrame = new Frame();
|
|
282
|
+
* cpuFrame.format = frames.swFormat;
|
|
283
|
+
* cpuFrame.width = frames.width;
|
|
284
|
+
* cpuFrame.height = frames.height;
|
|
285
|
+
* cpuFrame.allocBuffer();
|
|
286
|
+
*
|
|
287
|
+
* const ret = frames.transferDataSync(cpuFrame, hwFrame);
|
|
288
|
+
* FFmpegError.throwIfError(ret, 'transferDataSync');
|
|
289
|
+
*
|
|
290
|
+
* // Upload from CPU to GPU
|
|
291
|
+
* const ret2 = frames.transferDataSync(hwFrame, cpuFrame);
|
|
292
|
+
* FFmpegError.throwIfError(ret2, 'transferDataSync');
|
|
293
|
+
* ```
|
|
294
|
+
*
|
|
295
|
+
* @see {@link transferData} For async version
|
|
296
|
+
*/
|
|
297
|
+
transferDataSync(dst: Frame, src: Frame, flags?: number): number;
|
|
251
298
|
/**
|
|
252
299
|
* Get supported transfer formats.
|
|
253
300
|
*
|
|
@@ -257,6 +304,7 @@ export declare class HardwareFramesContext implements Disposable, NativeWrapper<
|
|
|
257
304
|
* Direct mapping to av_hwframe_transfer_get_formats().
|
|
258
305
|
*
|
|
259
306
|
* @param direction - Transfer direction (FROM/TO hardware)
|
|
307
|
+
*
|
|
260
308
|
* @returns Array of supported formats, or error code:
|
|
261
309
|
* - AVERROR_ENOSYS: Query not supported
|
|
262
310
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -283,8 +331,11 @@ export declare class HardwareFramesContext implements Disposable, NativeWrapper<
|
|
|
283
331
|
* Direct mapping to av_hwframe_map().
|
|
284
332
|
*
|
|
285
333
|
* @param dst - Destination frame for mapped data
|
|
334
|
+
*
|
|
286
335
|
* @param src - Hardware frame to map
|
|
336
|
+
*
|
|
287
337
|
* @param flags - Mapping flags (AV_HWFRAME_MAP_*)
|
|
338
|
+
*
|
|
288
339
|
* @returns 0 on success, negative AVERROR on error:
|
|
289
340
|
* - AVERROR_EINVAL: Invalid parameters
|
|
290
341
|
* - AVERROR_ENOSYS: Mapping not supported
|
|
@@ -312,9 +363,13 @@ export declare class HardwareFramesContext implements Disposable, NativeWrapper<
|
|
|
312
363
|
* Direct mapping to av_hwframe_ctx_create_derived().
|
|
313
364
|
*
|
|
314
365
|
* @param format - Pixel format for derived frames
|
|
366
|
+
*
|
|
315
367
|
* @param derivedDevice - Target device context
|
|
368
|
+
*
|
|
316
369
|
* @param source - Source frames context
|
|
370
|
+
*
|
|
317
371
|
* @param flags - Creation flags
|
|
372
|
+
*
|
|
318
373
|
* @returns 0 on success, negative AVERROR on error:
|
|
319
374
|
* - AVERROR_EINVAL: Invalid parameters
|
|
320
375
|
* - AVERROR_ENOSYS: Derivation not supported
|
|
@@ -233,7 +233,9 @@ export class HardwareFramesContext {
|
|
|
233
233
|
* Direct mapping to av_hwframe_get_buffer().
|
|
234
234
|
*
|
|
235
235
|
* @param frame - Frame to allocate buffer for
|
|
236
|
+
*
|
|
236
237
|
* @param flags - Allocation flags (usually 0)
|
|
238
|
+
*
|
|
237
239
|
* @returns 0 on success, negative AVERROR on error:
|
|
238
240
|
* - AVERROR_ENOMEM: No frames available in pool
|
|
239
241
|
* - AVERROR_EINVAL: Invalid parameters
|
|
@@ -262,8 +264,11 @@ export class HardwareFramesContext {
|
|
|
262
264
|
* Direct mapping to av_hwframe_transfer_data().
|
|
263
265
|
*
|
|
264
266
|
* @param dst - Destination frame
|
|
267
|
+
*
|
|
265
268
|
* @param src - Source frame
|
|
269
|
+
*
|
|
266
270
|
* @param flags - Transfer flags (usually 0)
|
|
271
|
+
*
|
|
267
272
|
* @returns 0 on success, negative AVERROR on error:
|
|
268
273
|
* - AVERROR_EINVAL: Invalid parameters
|
|
269
274
|
* - AVERROR_ENOSYS: Transfer not supported
|
|
@@ -293,6 +298,50 @@ export class HardwareFramesContext {
|
|
|
293
298
|
async transferData(dst, src, flags) {
|
|
294
299
|
return await this.native.transferData(dst.getNative(), src.getNative(), flags ?? 0);
|
|
295
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* Transfer frame between hardware and system memory synchronously.
|
|
303
|
+
* Synchronous version of transferData.
|
|
304
|
+
*
|
|
305
|
+
* Copies frame data between GPU and CPU memory.
|
|
306
|
+
* Direction depends on frame types (hardware vs software).
|
|
307
|
+
*
|
|
308
|
+
* Direct mapping to av_hwframe_transfer_data().
|
|
309
|
+
*
|
|
310
|
+
* @param dst - Destination frame
|
|
311
|
+
*
|
|
312
|
+
* @param src - Source frame
|
|
313
|
+
*
|
|
314
|
+
* @param flags - Transfer flags (currently unused, pass 0)
|
|
315
|
+
*
|
|
316
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
317
|
+
* - AVERROR_EINVAL: Invalid frames
|
|
318
|
+
* - AVERROR_ENOSYS: Operation not supported
|
|
319
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```typescript
|
|
323
|
+
* import { Frame, FFmpegError } from 'node-av';
|
|
324
|
+
*
|
|
325
|
+
* // Download from GPU to CPU
|
|
326
|
+
* const cpuFrame = new Frame();
|
|
327
|
+
* cpuFrame.format = frames.swFormat;
|
|
328
|
+
* cpuFrame.width = frames.width;
|
|
329
|
+
* cpuFrame.height = frames.height;
|
|
330
|
+
* cpuFrame.allocBuffer();
|
|
331
|
+
*
|
|
332
|
+
* const ret = frames.transferDataSync(cpuFrame, hwFrame);
|
|
333
|
+
* FFmpegError.throwIfError(ret, 'transferDataSync');
|
|
334
|
+
*
|
|
335
|
+
* // Upload from CPU to GPU
|
|
336
|
+
* const ret2 = frames.transferDataSync(hwFrame, cpuFrame);
|
|
337
|
+
* FFmpegError.throwIfError(ret2, 'transferDataSync');
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
340
|
+
* @see {@link transferData} For async version
|
|
341
|
+
*/
|
|
342
|
+
transferDataSync(dst, src, flags) {
|
|
343
|
+
return this.native.transferDataSync(dst.getNative(), src.getNative(), flags ?? 0);
|
|
344
|
+
}
|
|
296
345
|
/**
|
|
297
346
|
* Get supported transfer formats.
|
|
298
347
|
*
|
|
@@ -302,6 +351,7 @@ export class HardwareFramesContext {
|
|
|
302
351
|
* Direct mapping to av_hwframe_transfer_get_formats().
|
|
303
352
|
*
|
|
304
353
|
* @param direction - Transfer direction (FROM/TO hardware)
|
|
354
|
+
*
|
|
305
355
|
* @returns Array of supported formats, or error code:
|
|
306
356
|
* - AVERROR_ENOSYS: Query not supported
|
|
307
357
|
* - AVERROR_ENOMEM: Memory allocation failure
|
|
@@ -330,8 +380,11 @@ export class HardwareFramesContext {
|
|
|
330
380
|
* Direct mapping to av_hwframe_map().
|
|
331
381
|
*
|
|
332
382
|
* @param dst - Destination frame for mapped data
|
|
383
|
+
*
|
|
333
384
|
* @param src - Hardware frame to map
|
|
385
|
+
*
|
|
334
386
|
* @param flags - Mapping flags (AV_HWFRAME_MAP_*)
|
|
387
|
+
*
|
|
335
388
|
* @returns 0 on success, negative AVERROR on error:
|
|
336
389
|
* - AVERROR_EINVAL: Invalid parameters
|
|
337
390
|
* - AVERROR_ENOSYS: Mapping not supported
|
|
@@ -361,9 +414,13 @@ export class HardwareFramesContext {
|
|
|
361
414
|
* Direct mapping to av_hwframe_ctx_create_derived().
|
|
362
415
|
*
|
|
363
416
|
* @param format - Pixel format for derived frames
|
|
417
|
+
*
|
|
364
418
|
* @param derivedDevice - Target device context
|
|
419
|
+
*
|
|
365
420
|
* @param source - Source frames context
|
|
421
|
+
*
|
|
366
422
|
* @param flags - Creation flags
|
|
423
|
+
*
|
|
367
424
|
* @returns 0 on success, negative AVERROR on error:
|
|
368
425
|
* - AVERROR_EINVAL: Invalid parameters
|
|
369
426
|
* - AVERROR_ENOSYS: Derivation not supported
|