node-av 5.2.4-beta.1 → 6.0.0-beta.10
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 +15 -1
- package/dist/api/bitstream-filter.d.ts +110 -87
- package/dist/api/bitstream-filter.js +162 -102
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +87 -8
- package/dist/api/decoder.js +179 -4
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/demuxer.d.ts +30 -24
- package/dist/api/demuxer.js +4 -5
- package/dist/api/demuxer.js.map +1 -1
- package/dist/api/device.js.map +1 -1
- package/dist/api/encoder-pool.d.ts +220 -0
- package/dist/api/encoder-pool.js +285 -0
- package/dist/api/encoder-pool.js.map +1 -0
- package/dist/api/encoder.d.ts +133 -7
- package/dist/api/encoder.js +392 -68
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter-complex.d.ts +2 -1
- package/dist/api/filter-complex.js +11 -7
- package/dist/api/filter-complex.js.map +1 -1
- package/dist/api/filter-presets.d.ts +130 -654
- package/dist/api/filter-presets.js +180 -858
- package/dist/api/filter-presets.js.map +1 -1
- package/dist/api/filter.js +13 -8
- package/dist/api/filter.js.map +1 -1
- package/dist/api/fmp4-stream.js +1 -1
- package/dist/api/fmp4-stream.js.map +1 -1
- package/dist/api/index.d.ts +6 -6
- package/dist/api/index.js +8 -8
- package/dist/api/index.js.map +1 -1
- package/dist/api/muxer.d.ts +43 -15
- package/dist/api/muxer.js +79 -27
- package/dist/api/muxer.js.map +1 -1
- package/dist/api/pipeline.d.ts +50 -0
- package/dist/api/pipeline.js +138 -22
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/probe.d.ts +128 -0
- package/dist/api/probe.js +227 -0
- package/dist/api/probe.js.map +1 -0
- package/dist/api/rtp-stream.js +1 -1
- package/dist/api/rtp-stream.js.map +1 -1
- package/dist/api/scaler.d.ts +431 -0
- package/dist/api/scaler.js +620 -0
- package/dist/api/scaler.js.map +1 -0
- package/dist/api/utilities/async-queue.d.ts +27 -1
- package/dist/api/utilities/async-queue.js +38 -1
- package/dist/api/utilities/async-queue.js.map +1 -1
- package/dist/api/utilities/electron-shared-texture.d.ts +41 -1
- package/dist/api/utilities/electron-shared-texture.js +41 -4
- package/dist/api/utilities/electron-shared-texture.js.map +1 -1
- package/dist/api/utilities/index.d.ts +1 -1
- package/dist/api/utilities/index.js.map +1 -1
- package/dist/api/webrtc-stream.d.ts +0 -1
- package/dist/api/webrtc-stream.js +0 -1
- package/dist/api/webrtc-stream.js.map +1 -1
- package/dist/constants/bsf-options.d.ts +333 -0
- package/dist/constants/bsf-options.js +7 -0
- package/dist/constants/bsf-options.js.map +1 -0
- package/dist/constants/constants.d.ts +109 -0
- package/dist/constants/constants.js +110 -0
- package/dist/constants/constants.js.map +1 -1
- package/dist/constants/decoders.d.ts +636 -618
- package/dist/constants/decoders.js +1 -3
- package/dist/constants/decoders.js.map +1 -1
- package/dist/constants/encoders.d.ts +300 -282
- package/dist/constants/encoders.js +0 -2
- package/dist/constants/encoders.js.map +1 -1
- package/dist/constants/filter-options.d.ts +10915 -0
- package/dist/constants/filter-options.js +7 -0
- package/dist/constants/filter-options.js.map +1 -0
- package/dist/constants/format-options.d.ts +3056 -0
- package/dist/constants/format-options.js +7 -0
- package/dist/constants/format-options.js.map +1 -0
- package/dist/constants/formats.d.ts +18 -0
- package/dist/constants/formats.js +7 -0
- package/dist/constants/formats.js.map +1 -0
- package/dist/constants/index.d.ts +5 -0
- package/dist/constants/options.d.ts +4073 -0
- package/dist/constants/options.js +7 -0
- package/dist/constants/options.js.map +1 -0
- package/dist/lib/binding.d.ts +4 -1
- package/dist/lib/binding.js.map +1 -1
- package/dist/lib/codec.d.ts +36 -5
- package/dist/lib/codec.js +37 -4
- package/dist/lib/codec.js.map +1 -1
- package/dist/lib/dictionary.d.ts +1 -1
- package/dist/lib/dictionary.js.map +1 -1
- package/dist/lib/error.d.ts +69 -0
- package/dist/lib/error.js +92 -0
- package/dist/lib/error.js.map +1 -1
- package/dist/lib/frame.d.ts +46 -3
- package/dist/lib/frame.js +50 -3
- package/dist/lib/frame.js.map +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/native-types.d.ts +68 -0
- package/dist/lib/packet.d.ts +17 -3
- package/dist/lib/packet.js +19 -3
- package/dist/lib/packet.js.map +1 -1
- package/dist/lib/utilities.d.ts +21 -0
- package/dist/lib/utilities.js +23 -0
- package/dist/lib/utilities.js.map +1 -1
- package/dist/webrtc/index.d.ts +3 -0
- package/dist/webrtc/index.js +7 -0
- package/dist/webrtc/index.js.map +1 -0
- package/package.json +33 -22
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/constants/options.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/lib/binding.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { AVCodecID, AVError, AVHWDeviceType, AVLogLevel, AVMediaType, AVOptionSearchFlags, AVPixelFormat, AVSampleFormat, FFDecoderCodec, FFEncoderCodec } from '../constants/index.js';
|
|
8
8
|
import type { PosixError } from './error.js';
|
|
9
|
-
import type { NativeAudioFifo, NativeBitStreamFilter, NativeBitStreamFilterContext, NativeCodec, NativeCodecContext, NativeCodecParameters, NativeCodecParser, NativeDeviceModule, NativeDictionary, NativeFFmpegError, NativeFifo, NativeFilter, NativeFilterContext, NativeFilterGraph, NativeFilterInOut, NativeFormatContext, NativeFrame, NativeFrameUtils, NativeHardwareDeviceContext, NativeHardwareFramesContext, NativeInputFormat, NativeIOContext, NativeLog, NativeOption, NativeOutputFormat, NativePacket, NativeSoftwareResampleContext, NativeSoftwareScaleContext, NativeStream, NativeSyncQueue } from './native-types.js';
|
|
9
|
+
import type { NativeAudioFifo, NativeBitStreamFilter, NativeBitStreamFilterContext, NativeCodec, NativeCodecContext, NativeCodecParameters, NativeCodecParser, NativeDeviceModule, NativeDictionary, NativeFFmpegError, NativeFifo, NativeFilter, NativeFilterContext, NativeFilterGraph, NativeFilterInOut, NativeFormatContext, NativeFrame, NativeFrameUtils, NativeScaler, NativeHardwareDeviceContext, NativeHardwareFramesContext, NativeInputFormat, NativeIOContext, NativeLog, NativeOption, NativeOutputFormat, NativePacket, NativeSoftwareResampleContext, NativeSoftwareScaleContext, NativeStream, NativeSyncQueue } from './native-types.js';
|
|
10
10
|
import type { ChannelLayout, DtsPredictState, IDimension, IRational } from './types.js';
|
|
11
11
|
type NativePacketConstructor = new () => NativePacket;
|
|
12
12
|
type NativeFrameConstructor = new () => NativeFrame;
|
|
@@ -64,6 +64,7 @@ type NativeFifoConstructor = new () => NativeFifo;
|
|
|
64
64
|
type NativeSoftwareScaleContextConstructor = new () => NativeSoftwareScaleContext;
|
|
65
65
|
type NativeSoftwareResampleContextConstructor = new () => NativeSoftwareResampleContext;
|
|
66
66
|
type NativeFrameUtilsConstructor = new (width: number, height: number) => NativeFrameUtils;
|
|
67
|
+
type NativeScalerConstructor = new (flags?: number) => NativeScaler;
|
|
67
68
|
interface NativeHardwareDeviceContextConstructor {
|
|
68
69
|
new (): NativeHardwareDeviceContext;
|
|
69
70
|
getTypeName(type: AVHWDeviceType): string | null;
|
|
@@ -144,6 +145,7 @@ export interface NativeBinding {
|
|
|
144
145
|
SoftwareScaleContext: NativeSoftwareScaleContextConstructor;
|
|
145
146
|
SoftwareResampleContext: NativeSoftwareResampleContextConstructor;
|
|
146
147
|
FrameUtils: NativeFrameUtilsConstructor;
|
|
148
|
+
Scaler: NativeScalerConstructor;
|
|
147
149
|
HardwareDeviceContext: NativeHardwareDeviceContextConstructor;
|
|
148
150
|
HardwareFramesContext: NativeHardwareFramesContextConstructor;
|
|
149
151
|
Dictionary: NativeDictionaryConstructor;
|
|
@@ -214,6 +216,7 @@ export interface NativeBinding {
|
|
|
214
216
|
linesize: number;
|
|
215
217
|
} | number;
|
|
216
218
|
avChannelLayoutDescribe: (channelLayout: Partial<ChannelLayout>) => string | null;
|
|
219
|
+
avChannelLayoutDefault: (nbChannels: number) => ChannelLayout;
|
|
217
220
|
avSdpCreate: (contexts: NativeFormatContext[]) => string | null;
|
|
218
221
|
dtsPredict: (packet: NativePacket, stream: NativeStream, state: DtsPredictState) => DtsPredictState;
|
|
219
222
|
}
|
package/dist/lib/binding.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/lib/binding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/lib/binding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAkDlD,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAuS9C;;;;;;GAMG;AACH,SAAS,WAAW;IAClB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;IAE3B,kBAAkB;IAClB,MAAM,QAAQ,GAAG,OAAO,CAAC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type { FFDecoderCodec } from '../constants/decoders.js';
|
|
4
4
|
import type { FFEncoderCodec } from '../constants/encoders.js';
|
|
5
5
|
import type { FFHWDeviceType } from '../constants/hardware.js';
|
|
6
|
-
import type { NativeCodec, NativeWrapper } from './native-types.js';
|
|
6
|
+
import type { NativeCodec, NativeCodecOption, NativeWrapper } from './native-types.js';
|
|
7
7
|
import type { ChannelLayout } from './types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Codec profile definition
|
|
@@ -107,14 +107,16 @@ export declare class Codec implements NativeWrapper<NativeCodec> {
|
|
|
107
107
|
*
|
|
108
108
|
* @example
|
|
109
109
|
* ```typescript
|
|
110
|
+
* import { FF_DECODER_H264, FF_DECODER_H264_CUVID } from 'node-av/constants';
|
|
111
|
+
*
|
|
110
112
|
* // Find specific H.264 decoder
|
|
111
|
-
* const decoder = Codec.findDecoderByName(
|
|
113
|
+
* const decoder = Codec.findDecoderByName(FF_DECODER_H264_CUVID);
|
|
112
114
|
* if (decoder) {
|
|
113
115
|
* console.log('Found NVIDIA hardware decoder');
|
|
114
116
|
* }
|
|
115
117
|
*
|
|
116
118
|
* // Find software decoder
|
|
117
|
-
* const sw = Codec.findDecoderByName(
|
|
119
|
+
* const sw = Codec.findDecoderByName(FF_DECODER_H264);
|
|
118
120
|
* ```
|
|
119
121
|
*
|
|
120
122
|
* @see {@link findDecoder} To find by codec ID
|
|
@@ -163,6 +165,8 @@ export declare class Codec implements NativeWrapper<NativeCodec> {
|
|
|
163
165
|
*
|
|
164
166
|
* @example
|
|
165
167
|
* ```typescript
|
|
168
|
+
* import { FF_ENCODER_H264_NVENC, FF_ENCODER_LIBX264 } from 'node-av/constants';
|
|
169
|
+
*
|
|
166
170
|
* // Find specific H.264 encoder
|
|
167
171
|
* const x264 = Codec.findEncoderByName(FF_ENCODER_LIBX264);
|
|
168
172
|
* if (x264) {
|
|
@@ -170,7 +174,7 @@ export declare class Codec implements NativeWrapper<NativeCodec> {
|
|
|
170
174
|
* }
|
|
171
175
|
*
|
|
172
176
|
* // Find hardware encoder
|
|
173
|
-
* const nvenc = Codec.findEncoderByName(
|
|
177
|
+
* const nvenc = Codec.findEncoderByName(FF_ENCODER_H264_NVENC);
|
|
174
178
|
* ```
|
|
175
179
|
*
|
|
176
180
|
* @see {@link findEncoder} To find by codec ID
|
|
@@ -417,7 +421,9 @@ export declare class Codec implements NativeWrapper<NativeCodec> {
|
|
|
417
421
|
*
|
|
418
422
|
* @example
|
|
419
423
|
* ```typescript
|
|
420
|
-
*
|
|
424
|
+
* import { FF_DECODER_H264_CUVID } from 'node-av/constants';
|
|
425
|
+
*
|
|
426
|
+
* const codec = Codec.findDecoderByName(FF_DECODER_H264_CUVID);
|
|
421
427
|
* if (codec?.hasHardwareAcceleration()) {
|
|
422
428
|
* console.log('Hardware acceleration available');
|
|
423
429
|
* }
|
|
@@ -565,6 +571,31 @@ export declare class Codec implements NativeWrapper<NativeCodec> {
|
|
|
565
571
|
methods: number;
|
|
566
572
|
deviceType: AVHWDeviceType;
|
|
567
573
|
} | null;
|
|
574
|
+
/**
|
|
575
|
+
* Enumerate the codec's private options.
|
|
576
|
+
*
|
|
577
|
+
* Returns the codec-specific tunables exposed by the codec's private
|
|
578
|
+
* `AVClass` (e.g. libx264's `preset`, `crf`, `tune`). These are the options
|
|
579
|
+
* accepted via the `options` dictionary when creating an encoder/decoder, and
|
|
580
|
+
* are distinct from the generic `AVCodecContext` fields (bitrate, gop_size, ...).
|
|
581
|
+
*
|
|
582
|
+
* Options of type `AV_OPT_TYPE_CONST` are the named values belonging to a
|
|
583
|
+
* parent option's `unit` (i.e. enum members). Returns an empty array when the
|
|
584
|
+
* codec has no private options.
|
|
585
|
+
*
|
|
586
|
+
* Direct mapping to iterating `codec->priv_class` via av_opt_next().
|
|
587
|
+
*
|
|
588
|
+
* @returns Array of private option descriptors
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```typescript
|
|
592
|
+
* const codec = Codec.findEncoderByName(FF_ENCODER_LIBX264);
|
|
593
|
+
* for (const opt of codec?.getOptions() ?? []) {
|
|
594
|
+
* console.log(opt.name, opt.type, opt.unit);
|
|
595
|
+
* }
|
|
596
|
+
* ```
|
|
597
|
+
*/
|
|
598
|
+
getOptions(): NativeCodecOption[];
|
|
568
599
|
/**
|
|
569
600
|
* Get the underlying native Codec object.
|
|
570
601
|
*
|
package/dist/lib/codec.js
CHANGED
|
@@ -100,14 +100,16 @@ export class Codec {
|
|
|
100
100
|
*
|
|
101
101
|
* @example
|
|
102
102
|
* ```typescript
|
|
103
|
+
* import { FF_DECODER_H264, FF_DECODER_H264_CUVID } from 'node-av/constants';
|
|
104
|
+
*
|
|
103
105
|
* // Find specific H.264 decoder
|
|
104
|
-
* const decoder = Codec.findDecoderByName(
|
|
106
|
+
* const decoder = Codec.findDecoderByName(FF_DECODER_H264_CUVID);
|
|
105
107
|
* if (decoder) {
|
|
106
108
|
* console.log('Found NVIDIA hardware decoder');
|
|
107
109
|
* }
|
|
108
110
|
*
|
|
109
111
|
* // Find software decoder
|
|
110
|
-
* const sw = Codec.findDecoderByName(
|
|
112
|
+
* const sw = Codec.findDecoderByName(FF_DECODER_H264);
|
|
111
113
|
* ```
|
|
112
114
|
*
|
|
113
115
|
* @see {@link findDecoder} To find by codec ID
|
|
@@ -162,6 +164,8 @@ export class Codec {
|
|
|
162
164
|
*
|
|
163
165
|
* @example
|
|
164
166
|
* ```typescript
|
|
167
|
+
* import { FF_ENCODER_H264_NVENC, FF_ENCODER_LIBX264 } from 'node-av/constants';
|
|
168
|
+
*
|
|
165
169
|
* // Find specific H.264 encoder
|
|
166
170
|
* const x264 = Codec.findEncoderByName(FF_ENCODER_LIBX264);
|
|
167
171
|
* if (x264) {
|
|
@@ -169,7 +173,7 @@ export class Codec {
|
|
|
169
173
|
* }
|
|
170
174
|
*
|
|
171
175
|
* // Find hardware encoder
|
|
172
|
-
* const nvenc = Codec.findEncoderByName(
|
|
176
|
+
* const nvenc = Codec.findEncoderByName(FF_ENCODER_H264_NVENC);
|
|
173
177
|
* ```
|
|
174
178
|
*
|
|
175
179
|
* @see {@link findEncoder} To find by codec ID
|
|
@@ -469,7 +473,9 @@ export class Codec {
|
|
|
469
473
|
*
|
|
470
474
|
* @example
|
|
471
475
|
* ```typescript
|
|
472
|
-
*
|
|
476
|
+
* import { FF_DECODER_H264_CUVID } from 'node-av/constants';
|
|
477
|
+
*
|
|
478
|
+
* const codec = Codec.findDecoderByName(FF_DECODER_H264_CUVID);
|
|
473
479
|
* if (codec?.hasHardwareAcceleration()) {
|
|
474
480
|
* console.log('Hardware acceleration available');
|
|
475
481
|
* }
|
|
@@ -685,6 +691,33 @@ export class Codec {
|
|
|
685
691
|
getHwConfig(index) {
|
|
686
692
|
return this.native.getHwConfig(index);
|
|
687
693
|
}
|
|
694
|
+
/**
|
|
695
|
+
* Enumerate the codec's private options.
|
|
696
|
+
*
|
|
697
|
+
* Returns the codec-specific tunables exposed by the codec's private
|
|
698
|
+
* `AVClass` (e.g. libx264's `preset`, `crf`, `tune`). These are the options
|
|
699
|
+
* accepted via the `options` dictionary when creating an encoder/decoder, and
|
|
700
|
+
* are distinct from the generic `AVCodecContext` fields (bitrate, gop_size, ...).
|
|
701
|
+
*
|
|
702
|
+
* Options of type `AV_OPT_TYPE_CONST` are the named values belonging to a
|
|
703
|
+
* parent option's `unit` (i.e. enum members). Returns an empty array when the
|
|
704
|
+
* codec has no private options.
|
|
705
|
+
*
|
|
706
|
+
* Direct mapping to iterating `codec->priv_class` via av_opt_next().
|
|
707
|
+
*
|
|
708
|
+
* @returns Array of private option descriptors
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```typescript
|
|
712
|
+
* const codec = Codec.findEncoderByName(FF_ENCODER_LIBX264);
|
|
713
|
+
* for (const opt of codec?.getOptions() ?? []) {
|
|
714
|
+
* console.log(opt.name, opt.type, opt.unit);
|
|
715
|
+
* }
|
|
716
|
+
* ```
|
|
717
|
+
*/
|
|
718
|
+
getOptions() {
|
|
719
|
+
return this.native.getOptions();
|
|
720
|
+
}
|
|
688
721
|
/**
|
|
689
722
|
* Get the underlying native Codec object.
|
|
690
723
|
*
|
package/dist/lib/codec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/lib/codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,uCAAuC,EAAE,MAAM,2BAA2B,CAAC;AAC7H,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAoBjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,OAAO,KAAK;IACR,MAAM,CAAc;IAE5B;;;;OAIG;IACH,YAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC,WAAW,CAAC,EAAa;QAC9B,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC9C,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3C,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/lib/codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,uCAAuC,EAAE,MAAM,2BAA2B,CAAC;AAC7H,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAoBjE;;;;;;;;;;;;;;;;;;;;;;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AC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,iBAAiB,CAAC,UAA2C;QAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,GAAI,CAAC,EAAE,EAAE,CAAC;YACtB,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YACnC,IAAI,CAAC,MAAM;gBAAE,MAAM;YAEnB,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;gBACnC,UAAU,GAAG,+BAA+B,CAAC,UAAU,CAAC,CAAC;YAC3D,CAAC;YAED,IAAI,MAAM,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;gBACrC,OAAO,MAAM,CAAC,OAAO,CAAC;YACxB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,WAAW,CAAC,KAAa;QAKvB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,UAAU,CAAC,MAA0B;QAC1C,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACzB,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;CACF"}
|
package/dist/lib/dictionary.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ export declare class Dictionary implements Disposable, NativeWrapper<NativeDicti
|
|
|
72
72
|
* });
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
|
-
static fromObject(obj: Record<string, string | number | boolean | undefined | null>, flags?: AVDictFlag): Dictionary;
|
|
75
|
+
static fromObject(obj: Record<string, string | number | boolean | bigint | undefined | null>, flags?: AVDictFlag): Dictionary;
|
|
76
76
|
/**
|
|
77
77
|
* Create dictionary from native instance.
|
|
78
78
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../src/lib/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,OAAO,UAAU;IACb,MAAM,CAAmB;IAEjC;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC1C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../src/lib/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,OAAO,UAAU;IACb,MAAM,CAAmB;IAEjC;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC1C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC,UAAU,CAAC,GAA0E,EAAE,QAAoB,WAAW;QAC3H,MAAM,IAAI,GAAG,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAA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AAK,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,WAAW,CAAC,GAAW,EAAE,SAAiB,EAAE,QAAgB,EAAE,QAAoB,WAAW;QAC3F,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,SAAS,CAAC,SAAiB,EAAE,QAAgB;QAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAChC,CAAC;CACF"}
|
package/dist/lib/error.d.ts
CHANGED
|
@@ -231,6 +231,75 @@ export declare class FFmpegError extends Error implements NativeWrapper<NativeFF
|
|
|
231
231
|
* Human-readable description of the error.
|
|
232
232
|
*/
|
|
233
233
|
get message(): string;
|
|
234
|
+
/**
|
|
235
|
+
* Whether this is EAGAIN (resource temporarily unavailable).
|
|
236
|
+
*
|
|
237
|
+
* In codec/filter contexts this means "output not available yet, feed more
|
|
238
|
+
* input" rather than a hard failure.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* const error = FFmpegError.fromCode(ret);
|
|
243
|
+
* if (error?.isEAGAIN) {
|
|
244
|
+
* // send more input, then retry
|
|
245
|
+
* }
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
get isEAGAIN(): boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Whether this is the end of stream (AVERROR_EOF).
|
|
251
|
+
*/
|
|
252
|
+
get isEOF(): boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Whether this is invalid data found while processing input (AVERROR_INVALIDDATA).
|
|
255
|
+
*/
|
|
256
|
+
get isInvalidData(): boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Whether this is EINVAL (invalid argument).
|
|
259
|
+
*/
|
|
260
|
+
get isEINVAL(): boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Whether this is ENOMEM (out of memory).
|
|
263
|
+
*/
|
|
264
|
+
get isENOMEM(): boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Whether this is ENOENT (no such file or directory).
|
|
267
|
+
*/
|
|
268
|
+
get isENOENT(): boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Whether this is EACCES (permission denied).
|
|
271
|
+
*/
|
|
272
|
+
get isEACCES(): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Whether this is EIO (I/O error).
|
|
275
|
+
*/
|
|
276
|
+
get isEIO(): boolean;
|
|
277
|
+
/**
|
|
278
|
+
* Whether this is EPIPE (broken pipe).
|
|
279
|
+
*/
|
|
280
|
+
get isEPIPE(): boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Whether this is the immediate-exit request (AVERROR_EXIT).
|
|
283
|
+
*/
|
|
284
|
+
get isExit(): boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Check if this error matches a specific code.
|
|
287
|
+
*
|
|
288
|
+
* @param errorCode - FFmpeg error code to compare against
|
|
289
|
+
*
|
|
290
|
+
* @returns True if this error's code matches
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```typescript
|
|
294
|
+
* import { AVERROR_DECODER_NOT_FOUND } from 'node-av/constants';
|
|
295
|
+
*
|
|
296
|
+
* const error = FFmpegError.fromCode(ret);
|
|
297
|
+
* if (error?.is(AVERROR_DECODER_NOT_FOUND)) {
|
|
298
|
+
* // handle missing decoder
|
|
299
|
+
* }
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
is(errorCode: number): boolean;
|
|
234
303
|
/**
|
|
235
304
|
* Get the underlying native FFmpegError object.
|
|
236
305
|
*
|
package/dist/lib/error.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AVERROR_EOF, AVERROR_EXIT, AVERROR_INVALIDDATA } from '../constants/constants.js';
|
|
1
2
|
import { bindings } from './binding.js';
|
|
2
3
|
/**
|
|
3
4
|
* POSIX error names that can be converted to FFmpeg error codes.
|
|
@@ -289,6 +290,97 @@ export class FFmpegError extends Error {
|
|
|
289
290
|
get message() {
|
|
290
291
|
return this.native.message;
|
|
291
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* Whether this is EAGAIN (resource temporarily unavailable).
|
|
295
|
+
*
|
|
296
|
+
* In codec/filter contexts this means "output not available yet, feed more
|
|
297
|
+
* input" rather than a hard failure.
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* const error = FFmpegError.fromCode(ret);
|
|
302
|
+
* if (error?.isEAGAIN) {
|
|
303
|
+
* // send more input, then retry
|
|
304
|
+
* }
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
get isEAGAIN() {
|
|
308
|
+
return this.native.code === AVERROR_EAGAIN;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Whether this is the end of stream (AVERROR_EOF).
|
|
312
|
+
*/
|
|
313
|
+
get isEOF() {
|
|
314
|
+
return this.native.code === AVERROR_EOF;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Whether this is invalid data found while processing input (AVERROR_INVALIDDATA).
|
|
318
|
+
*/
|
|
319
|
+
get isInvalidData() {
|
|
320
|
+
return this.native.code === AVERROR_INVALIDDATA;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Whether this is EINVAL (invalid argument).
|
|
324
|
+
*/
|
|
325
|
+
get isEINVAL() {
|
|
326
|
+
return this.native.code === AVERROR_EINVAL;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Whether this is ENOMEM (out of memory).
|
|
330
|
+
*/
|
|
331
|
+
get isENOMEM() {
|
|
332
|
+
return this.native.code === AVERROR_ENOMEM;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Whether this is ENOENT (no such file or directory).
|
|
336
|
+
*/
|
|
337
|
+
get isENOENT() {
|
|
338
|
+
return this.native.code === AVERROR_ENOENT;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Whether this is EACCES (permission denied).
|
|
342
|
+
*/
|
|
343
|
+
get isEACCES() {
|
|
344
|
+
return this.native.code === AVERROR_EACCES;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Whether this is EIO (I/O error).
|
|
348
|
+
*/
|
|
349
|
+
get isEIO() {
|
|
350
|
+
return this.native.code === AVERROR_EIO;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Whether this is EPIPE (broken pipe).
|
|
354
|
+
*/
|
|
355
|
+
get isEPIPE() {
|
|
356
|
+
return this.native.code === AVERROR_EPIPE;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Whether this is the immediate-exit request (AVERROR_EXIT).
|
|
360
|
+
*/
|
|
361
|
+
get isExit() {
|
|
362
|
+
return this.native.code === AVERROR_EXIT;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Check if this error matches a specific code.
|
|
366
|
+
*
|
|
367
|
+
* @param errorCode - FFmpeg error code to compare against
|
|
368
|
+
*
|
|
369
|
+
* @returns True if this error's code matches
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```typescript
|
|
373
|
+
* import { AVERROR_DECODER_NOT_FOUND } from 'node-av/constants';
|
|
374
|
+
*
|
|
375
|
+
* const error = FFmpegError.fromCode(ret);
|
|
376
|
+
* if (error?.is(AVERROR_DECODER_NOT_FOUND)) {
|
|
377
|
+
* // handle missing decoder
|
|
378
|
+
* }
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
is(errorCode) {
|
|
382
|
+
return this.native.code === errorCode;
|
|
383
|
+
}
|
|
292
384
|
/**
|
|
293
385
|
* Get the underlying native FFmpegError object.
|
|
294
386
|
*
|
package/dist/lib/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/lib/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAN,IAAY,UAiBX;AAjBD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,yBAAW,CAAA;IACX,6BAAe,CAAA;IACf,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,6BAAe,CAAA;IACf,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,+BAAiB,CAAA;IACjB,6BAAe,CAAA;IACf,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;AACnB,CAAC,EAjBW,UAAU,KAAV,UAAU,QAiBrB;AAED,uDAAuD;AACvD,MAAM,UAAU,GAA4B,EAAE,CAAC;AAE/C;;;;;;;;GAQG;AACH,SAAS,cAAc,CAAC,IAAgB;IACtC,IAAI,CAAC,CAAC,IAAI,IAAI,UAAU,CAAC,EAAE,CAAC;QAC1B,UAAU,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC3D,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AAK,cAAc,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,WAAW,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,aAAa,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,CAAC;IAC3C,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,EAAE,CAAC,SAAiB;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
|
package/dist/lib/frame.d.ts
CHANGED
|
@@ -507,6 +507,14 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
507
507
|
* True if the frame data can be modified.
|
|
508
508
|
*/
|
|
509
509
|
get isWritable(): boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Bytes of native buffer memory this frame currently reports to V8's GC via
|
|
512
|
+
* `napi_adjust_external_memory`. Exposed only so the accounting can be
|
|
513
|
+
* asserted in tests; the value is not observable through V8 heap statistics.
|
|
514
|
+
*
|
|
515
|
+
* @internal
|
|
516
|
+
*/
|
|
517
|
+
get reportedExternalMemory(): number;
|
|
510
518
|
/**
|
|
511
519
|
* Hardware frames context.
|
|
512
520
|
*
|
|
@@ -731,6 +739,12 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
731
739
|
*
|
|
732
740
|
* Direct mapping to av_frame_ref().
|
|
733
741
|
*
|
|
742
|
+
* IMPORTANT: per FFmpeg's contract, this frame (the destination) MUST be
|
|
743
|
+
* unreferenced or freshly allocated before calling. Re-using a frame as the
|
|
744
|
+
* destination without {@link unref} first leaks its previous buffers (the old
|
|
745
|
+
* references are overwritten, not freed). When reusing one frame across a loop,
|
|
746
|
+
* call `frame.unref()` before each `frame.ref(src)`.
|
|
747
|
+
*
|
|
734
748
|
* @param src - Source frame to reference
|
|
735
749
|
*
|
|
736
750
|
* @returns 0 on success, negative AVERROR on error:
|
|
@@ -741,14 +755,14 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
741
755
|
* ```typescript
|
|
742
756
|
* import { FFmpegError } from 'node-av';
|
|
743
757
|
*
|
|
744
|
-
*
|
|
745
|
-
* frame2.
|
|
758
|
+
* // Reusing one frame across a loop: unref before re-referencing.
|
|
759
|
+
* frame2.unref();
|
|
746
760
|
* const ret = frame2.ref(frame1);
|
|
747
761
|
* FFmpegError.throwIfError(ret, 'ref');
|
|
748
762
|
* // frame2 now references frame1's data
|
|
749
763
|
* ```
|
|
750
764
|
*
|
|
751
|
-
* @see {@link unref} To remove reference
|
|
765
|
+
* @see {@link unref} To remove reference (call before re-referencing a reused frame)
|
|
752
766
|
* @see {@link clone} To create independent copy
|
|
753
767
|
*/
|
|
754
768
|
ref(src: Frame): number;
|
|
@@ -1095,6 +1109,35 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
|
|
|
1095
1109
|
* @see {@link hwframeTransferData} To transfer between GPU/CPU
|
|
1096
1110
|
*/
|
|
1097
1111
|
isSwFrame(): boolean;
|
|
1112
|
+
/**
|
|
1113
|
+
* Export the IOSurface backing a decoded VideoToolbox frame (macOS only).
|
|
1114
|
+
*
|
|
1115
|
+
* Returns the `IOSurfaceRef` carried by an `AV_PIX_FMT_VIDEOTOOLBOX` frame as
|
|
1116
|
+
* an 8-byte pointer Buffer — the same handle format accepted by
|
|
1117
|
+
* {@link Frame.fromIOSurface}. This enables zero-copy interop with Metal /
|
|
1118
|
+
* CoreVideo (e.g. feeding a hardware-decoded frame into a GPU compositor)
|
|
1119
|
+
* without a GPU→CPU readback.
|
|
1120
|
+
*
|
|
1121
|
+
* Returns `null` when the frame is not a decoded VideoToolbox hardware frame,
|
|
1122
|
+
* has no backing IOSurface, or on non-macOS platforms.
|
|
1123
|
+
*
|
|
1124
|
+
* **Lifetime:** the IOSurface stays owned by the frame's `CVPixelBuffer`.
|
|
1125
|
+
* Keep this `Frame` alive while using the handle. If the surface must outlive
|
|
1126
|
+
* the frame, retain it separately (e.g. `IOSurfaceIncrementUseCount`).
|
|
1127
|
+
*
|
|
1128
|
+
* @returns IOSurfaceRef pointer as Buffer, or null if not available
|
|
1129
|
+
*
|
|
1130
|
+
* @example
|
|
1131
|
+
* ```typescript
|
|
1132
|
+
* const handle = frame.exportIOSurface();
|
|
1133
|
+
* if (handle) {
|
|
1134
|
+
* // Pass to a Metal-based compositor; keep `frame` alive while in use.
|
|
1135
|
+
* }
|
|
1136
|
+
* ```
|
|
1137
|
+
*
|
|
1138
|
+
* @see {@link fromIOSurface} For the inverse (import) direction
|
|
1139
|
+
*/
|
|
1140
|
+
exportIOSurface(): Buffer | null;
|
|
1098
1141
|
/**
|
|
1099
1142
|
* Get frame side data.
|
|
1100
1143
|
*
|
package/dist/lib/frame.js
CHANGED
|
@@ -605,6 +605,16 @@ export class Frame {
|
|
|
605
605
|
get isWritable() {
|
|
606
606
|
return this.native.isWritable;
|
|
607
607
|
}
|
|
608
|
+
/**
|
|
609
|
+
* Bytes of native buffer memory this frame currently reports to V8's GC via
|
|
610
|
+
* `napi_adjust_external_memory`. Exposed only so the accounting can be
|
|
611
|
+
* asserted in tests; the value is not observable through V8 heap statistics.
|
|
612
|
+
*
|
|
613
|
+
* @internal
|
|
614
|
+
*/
|
|
615
|
+
get reportedExternalMemory() {
|
|
616
|
+
return this.native.reportedExternalMemory;
|
|
617
|
+
}
|
|
608
618
|
/**
|
|
609
619
|
* Hardware frames context.
|
|
610
620
|
*
|
|
@@ -900,6 +910,12 @@ export class Frame {
|
|
|
900
910
|
*
|
|
901
911
|
* Direct mapping to av_frame_ref().
|
|
902
912
|
*
|
|
913
|
+
* IMPORTANT: per FFmpeg's contract, this frame (the destination) MUST be
|
|
914
|
+
* unreferenced or freshly allocated before calling. Re-using a frame as the
|
|
915
|
+
* destination without {@link unref} first leaks its previous buffers (the old
|
|
916
|
+
* references are overwritten, not freed). When reusing one frame across a loop,
|
|
917
|
+
* call `frame.unref()` before each `frame.ref(src)`.
|
|
918
|
+
*
|
|
903
919
|
* @param src - Source frame to reference
|
|
904
920
|
*
|
|
905
921
|
* @returns 0 on success, negative AVERROR on error:
|
|
@@ -910,14 +926,14 @@ export class Frame {
|
|
|
910
926
|
* ```typescript
|
|
911
927
|
* import { FFmpegError } from 'node-av';
|
|
912
928
|
*
|
|
913
|
-
*
|
|
914
|
-
* frame2.
|
|
929
|
+
* // Reusing one frame across a loop: unref before re-referencing.
|
|
930
|
+
* frame2.unref();
|
|
915
931
|
* const ret = frame2.ref(frame1);
|
|
916
932
|
* FFmpegError.throwIfError(ret, 'ref');
|
|
917
933
|
* // frame2 now references frame1's data
|
|
918
934
|
* ```
|
|
919
935
|
*
|
|
920
|
-
* @see {@link unref} To remove reference
|
|
936
|
+
* @see {@link unref} To remove reference (call before re-referencing a reused frame)
|
|
921
937
|
* @see {@link clone} To create independent copy
|
|
922
938
|
*/
|
|
923
939
|
ref(src) {
|
|
@@ -1299,6 +1315,37 @@ export class Frame {
|
|
|
1299
1315
|
isSwFrame() {
|
|
1300
1316
|
return this.native.isSwFrame();
|
|
1301
1317
|
}
|
|
1318
|
+
/**
|
|
1319
|
+
* Export the IOSurface backing a decoded VideoToolbox frame (macOS only).
|
|
1320
|
+
*
|
|
1321
|
+
* Returns the `IOSurfaceRef` carried by an `AV_PIX_FMT_VIDEOTOOLBOX` frame as
|
|
1322
|
+
* an 8-byte pointer Buffer — the same handle format accepted by
|
|
1323
|
+
* {@link Frame.fromIOSurface}. This enables zero-copy interop with Metal /
|
|
1324
|
+
* CoreVideo (e.g. feeding a hardware-decoded frame into a GPU compositor)
|
|
1325
|
+
* without a GPU→CPU readback.
|
|
1326
|
+
*
|
|
1327
|
+
* Returns `null` when the frame is not a decoded VideoToolbox hardware frame,
|
|
1328
|
+
* has no backing IOSurface, or on non-macOS platforms.
|
|
1329
|
+
*
|
|
1330
|
+
* **Lifetime:** the IOSurface stays owned by the frame's `CVPixelBuffer`.
|
|
1331
|
+
* Keep this `Frame` alive while using the handle. If the surface must outlive
|
|
1332
|
+
* the frame, retain it separately (e.g. `IOSurfaceIncrementUseCount`).
|
|
1333
|
+
*
|
|
1334
|
+
* @returns IOSurfaceRef pointer as Buffer, or null if not available
|
|
1335
|
+
*
|
|
1336
|
+
* @example
|
|
1337
|
+
* ```typescript
|
|
1338
|
+
* const handle = frame.exportIOSurface();
|
|
1339
|
+
* if (handle) {
|
|
1340
|
+
* // Pass to a Metal-based compositor; keep `frame` alive while in use.
|
|
1341
|
+
* }
|
|
1342
|
+
* ```
|
|
1343
|
+
*
|
|
1344
|
+
* @see {@link fromIOSurface} For the inverse (import) direction
|
|
1345
|
+
*/
|
|
1346
|
+
exportIOSurface() {
|
|
1347
|
+
return this.native.exportIOSurface();
|
|
1348
|
+
}
|
|
1302
1349
|
/**
|
|
1303
1350
|
* Get frame side data.
|
|
1304
1351
|
*
|