node-av 1.1.0 → 1.2.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 +51 -38
- package/dist/api/bitstream-filter.d.ts +180 -123
- package/dist/api/bitstream-filter.js +180 -125
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +279 -132
- package/dist/api/decoder.js +285 -142
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/encoder.d.ts +246 -162
- package/dist/api/encoder.js +272 -208
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter-presets.d.ts +690 -94
- package/dist/api/filter-presets.js +686 -102
- package/dist/api/filter-presets.js.map +1 -1
- package/dist/api/filter.d.ts +249 -213
- package/dist/api/filter.js +252 -242
- package/dist/api/filter.js.map +1 -1
- package/dist/api/hardware.d.ts +224 -117
- package/dist/api/hardware.js +380 -214
- package/dist/api/hardware.js.map +1 -1
- package/dist/api/index.d.ts +3 -3
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/io-stream.d.ts +65 -61
- package/dist/api/io-stream.js +43 -46
- package/dist/api/io-stream.js.map +1 -1
- package/dist/api/media-input.d.ts +242 -140
- package/dist/api/media-input.js +205 -103
- package/dist/api/media-input.js.map +1 -1
- package/dist/api/media-output.d.ts +206 -128
- package/dist/api/media-output.js +210 -128
- package/dist/api/media-output.js.map +1 -1
- package/dist/api/pipeline.d.ts +168 -38
- package/dist/api/pipeline.js +238 -14
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/types.d.ts +21 -187
- package/dist/api/utils.d.ts +1 -2
- package/dist/api/utils.js +9 -0
- package/dist/api/utils.js.map +1 -1
- package/dist/lib/audio-fifo.d.ts +127 -170
- package/dist/lib/audio-fifo.js +130 -173
- package/dist/lib/audio-fifo.js.map +1 -1
- package/dist/lib/binding.js +5 -0
- package/dist/lib/binding.js.map +1 -1
- package/dist/lib/bitstream-filter-context.d.ts +139 -184
- package/dist/lib/bitstream-filter-context.js +139 -188
- package/dist/lib/bitstream-filter-context.js.map +1 -1
- package/dist/lib/bitstream-filter.d.ts +68 -54
- package/dist/lib/bitstream-filter.js +68 -54
- package/dist/lib/bitstream-filter.js.map +1 -1
- package/dist/lib/codec-context.d.ts +316 -380
- package/dist/lib/codec-context.js +316 -381
- package/dist/lib/codec-context.js.map +1 -1
- package/dist/lib/codec-parameters.d.ts +160 -170
- package/dist/lib/codec-parameters.js +162 -172
- package/dist/lib/codec-parameters.js.map +1 -1
- package/dist/lib/codec-parser.d.ts +91 -104
- package/dist/lib/codec-parser.js +92 -103
- package/dist/lib/codec-parser.js.map +1 -1
- package/dist/lib/codec.d.ts +264 -281
- package/dist/lib/codec.js +268 -285
- package/dist/lib/codec.js.map +1 -1
- package/dist/lib/dictionary.d.ts +149 -203
- package/dist/lib/dictionary.js +158 -212
- package/dist/lib/dictionary.js.map +1 -1
- package/dist/lib/error.d.ts +96 -130
- package/dist/lib/error.js +98 -128
- package/dist/lib/error.js.map +1 -1
- package/dist/lib/filter-context.d.ts +284 -218
- package/dist/lib/filter-context.js +290 -227
- package/dist/lib/filter-context.js.map +1 -1
- package/dist/lib/filter-graph.d.ts +251 -292
- package/dist/lib/filter-graph.js +253 -294
- package/dist/lib/filter-graph.js.map +1 -1
- package/dist/lib/filter-inout.d.ts +87 -95
- package/dist/lib/filter-inout.js +87 -95
- package/dist/lib/filter-inout.js.map +1 -1
- package/dist/lib/filter.d.ts +93 -111
- package/dist/lib/filter.js +93 -111
- package/dist/lib/filter.js.map +1 -1
- package/dist/lib/format-context.d.ts +320 -428
- package/dist/lib/format-context.js +313 -385
- package/dist/lib/format-context.js.map +1 -1
- package/dist/lib/frame.d.ts +262 -405
- package/dist/lib/frame.js +263 -408
- package/dist/lib/frame.js.map +1 -1
- package/dist/lib/hardware-device-context.d.ts +149 -203
- package/dist/lib/hardware-device-context.js +149 -203
- package/dist/lib/hardware-device-context.js.map +1 -1
- package/dist/lib/hardware-frames-context.d.ts +170 -180
- package/dist/lib/hardware-frames-context.js +171 -181
- package/dist/lib/hardware-frames-context.js.map +1 -1
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.js +2 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/input-format.d.ts +89 -117
- package/dist/lib/input-format.js +89 -117
- package/dist/lib/input-format.js.map +1 -1
- package/dist/lib/io-context.d.ts +209 -241
- package/dist/lib/io-context.js +220 -252
- package/dist/lib/io-context.js.map +1 -1
- package/dist/lib/log.d.ts +85 -119
- package/dist/lib/log.js +85 -122
- package/dist/lib/log.js.map +1 -1
- package/dist/lib/native-types.d.ts +117 -106
- package/dist/lib/native-types.js +0 -7
- package/dist/lib/native-types.js.map +1 -1
- package/dist/lib/option.d.ts +284 -241
- package/dist/lib/option.js +309 -249
- package/dist/lib/option.js.map +1 -1
- package/dist/lib/output-format.d.ts +77 -101
- package/dist/lib/output-format.js +77 -101
- package/dist/lib/output-format.js.map +1 -1
- package/dist/lib/packet.d.ts +172 -240
- package/dist/lib/packet.js +172 -241
- package/dist/lib/packet.js.map +1 -1
- package/dist/lib/rational.d.ts +0 -2
- package/dist/lib/rational.js +0 -2
- package/dist/lib/rational.js.map +1 -1
- package/dist/lib/software-resample-context.d.ts +241 -325
- package/dist/lib/software-resample-context.js +242 -326
- package/dist/lib/software-resample-context.js.map +1 -1
- package/dist/lib/software-scale-context.d.ts +129 -173
- package/dist/lib/software-scale-context.js +131 -175
- package/dist/lib/software-scale-context.js.map +1 -1
- package/dist/lib/stream.d.ts +87 -197
- package/dist/lib/stream.js +87 -197
- package/dist/lib/stream.js.map +1 -1
- package/dist/lib/utilities.d.ts +372 -181
- package/dist/lib/utilities.js +373 -182
- package/dist/lib/utilities.js.map +1 -1
- package/install/check.js +0 -1
- package/package.json +21 -12
- package/release_notes.md +43 -59
- package/CHANGELOG.md +0 -8
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;AAgBzC
|
|
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;AAgBzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,OAAO,KAAK;IACR,MAAM,CAAc;IACpB,YAAY,CAAgC,CAAC,4CAA4C;IAEjG;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,IAAI,MAAM,CAAC,KAAqC;QAC9C,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAC3B,CAAC;IAED,IAAI,KAAK,CAAC,KAAa;QACrB,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,IAAI,MAAM,CAAC,KAAa;QACtB,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,I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,EAAE,KAAc;QAClD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,WAAW,CAAC,IAAyB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,WAAW,CAAC,IAAyB,EAAE,IAAY;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAAc,CAAC,IAAyB;QACtC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACnC,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"}
|
|
@@ -2,370 +2,321 @@ import type { AVHWDeviceType } from '../constants/constants.js';
|
|
|
2
2
|
import type { Dictionary } from './dictionary.js';
|
|
3
3
|
import type { NativeHardwareDeviceContext, NativeWrapper } from './native-types.js';
|
|
4
4
|
/**
|
|
5
|
-
* Hardware device context for
|
|
5
|
+
* Hardware device context for GPU-accelerated processing.
|
|
6
6
|
*
|
|
7
|
-
* Manages hardware acceleration devices
|
|
8
|
-
* Provides
|
|
9
|
-
*
|
|
7
|
+
* Manages hardware acceleration devices for video encoding, decoding, and filtering.
|
|
8
|
+
* Provides access to GPU resources like CUDA, VAAPI, VideoToolbox, and other
|
|
9
|
+
* hardware acceleration APIs. Essential for high-performance video processing
|
|
10
|
+
* and reduced CPU usage.
|
|
10
11
|
*
|
|
11
12
|
* Direct mapping to FFmpeg's AVHWDeviceContext.
|
|
12
13
|
*
|
|
13
14
|
* @example
|
|
14
15
|
* ```typescript
|
|
15
|
-
* import { HardwareDeviceContext,
|
|
16
|
-
* import { AV_HWDEVICE_TYPE_CUDA,
|
|
16
|
+
* import { HardwareDeviceContext, FFmpegError } from 'node-av';
|
|
17
|
+
* import { AV_HWDEVICE_TYPE_CUDA, AV_HWDEVICE_TYPE_VIDEOTOOLBOX } from 'node-av/constants';
|
|
17
18
|
*
|
|
18
|
-
* // Create
|
|
19
|
+
* // Create hardware device
|
|
19
20
|
* const device = new HardwareDeviceContext();
|
|
20
|
-
* const ret = device.create(AV_HWDEVICE_TYPE_CUDA
|
|
21
|
-
* FFmpegError.throwIfError(ret, 'create
|
|
21
|
+
* const ret = device.create(AV_HWDEVICE_TYPE_CUDA);
|
|
22
|
+
* FFmpegError.throwIfError(ret, 'create');
|
|
22
23
|
*
|
|
23
|
-
* //
|
|
24
|
-
* const constraints = device.getHwframeConstraints();
|
|
25
|
-
* console.log(`Max size: ${constraints.maxWidth}x${constraints.maxHeight}`);
|
|
26
|
-
*
|
|
27
|
-
* // Create frames context for this device
|
|
28
|
-
* const frames = new HardwareFramesContext();
|
|
29
|
-
* frames.alloc(device);
|
|
30
|
-
* frames.format = AV_PIX_FMT_CUDA;
|
|
31
|
-
* frames.swFormat = AV_PIX_FMT_NV12;
|
|
32
|
-
* frames.width = 1920;
|
|
33
|
-
* frames.height = 1080;
|
|
34
|
-
* const initRet = frames.init();
|
|
35
|
-
* FFmpegError.throwIfError(initRet, 'init frames');
|
|
36
|
-
*
|
|
37
|
-
* // Cleanup
|
|
38
|
-
* frames.free();
|
|
39
|
-
* device.free();
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* import { HardwareDeviceContext } from 'node-av';
|
|
45
|
-
* import { AV_HWDEVICE_TYPE_NONE } from 'node-av/constants';
|
|
46
|
-
*
|
|
47
|
-
* // List available hardware device types
|
|
24
|
+
* // List available hardware types
|
|
48
25
|
* const types = HardwareDeviceContext.iterateTypes();
|
|
49
26
|
* for (const type of types) {
|
|
50
27
|
* const name = HardwareDeviceContext.getTypeName(type);
|
|
51
28
|
* console.log(`Available: ${name}`);
|
|
52
29
|
* }
|
|
53
30
|
*
|
|
54
|
-
* //
|
|
55
|
-
* const
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
31
|
+
* // Use with decoder
|
|
32
|
+
* const codecContext = new CodecContext();
|
|
33
|
+
* codecContext.hwDeviceCtx = device;
|
|
34
|
+
*
|
|
35
|
+
* // Create derived context
|
|
36
|
+
* const derived = new HardwareDeviceContext();
|
|
37
|
+
* const ret2 = derived.createDerived(device, AV_HWDEVICE_TYPE_CUDA);
|
|
38
|
+
* FFmpegError.throwIfError(ret2, 'createDerived');
|
|
39
|
+
*
|
|
40
|
+
* // Cleanup
|
|
41
|
+
* device.free();
|
|
61
42
|
* ```
|
|
62
43
|
*
|
|
63
|
-
* @see
|
|
64
|
-
* @see {@link
|
|
44
|
+
* @see [AVHWDeviceContext](https://ffmpeg.org/doxygen/trunk/structAVHWDeviceContext.html) - FFmpeg Doxygen
|
|
45
|
+
* @see {@link HardwareFramesContext} For hardware frame allocation
|
|
46
|
+
* @see {@link CodecContext} For hardware codec usage
|
|
65
47
|
*/
|
|
66
48
|
export declare class HardwareDeviceContext implements Disposable, NativeWrapper<NativeHardwareDeviceContext> {
|
|
67
49
|
private native;
|
|
68
|
-
/**
|
|
69
|
-
* Create a new hardware device context.
|
|
70
|
-
*
|
|
71
|
-
* The context is uninitialized - you must call alloc() or create() before use.
|
|
72
|
-
* No FFmpeg resources are allocated until initialization.
|
|
73
|
-
*
|
|
74
|
-
* Direct wrapper around AVHWDeviceContext.
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```typescript
|
|
78
|
-
* import { HardwareDeviceContext, FFmpegError } from 'node-av';
|
|
79
|
-
* import { AV_HWDEVICE_TYPE_CUDA } from 'node-av/constants';
|
|
80
|
-
*
|
|
81
|
-
* const device = new HardwareDeviceContext();
|
|
82
|
-
* const ret = device.create(AV_HWDEVICE_TYPE_CUDA, null, null);
|
|
83
|
-
* FFmpegError.throwIfError(ret, 'create device');
|
|
84
|
-
* // Device is now ready for use
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
50
|
constructor();
|
|
88
51
|
/**
|
|
89
|
-
* Get
|
|
52
|
+
* Get human-readable name for hardware device type.
|
|
90
53
|
*
|
|
91
|
-
*
|
|
54
|
+
* Converts a hardware device type enum to its string representation.
|
|
92
55
|
*
|
|
93
|
-
* Direct mapping to av_hwdevice_get_type_name()
|
|
56
|
+
* Direct mapping to av_hwdevice_get_type_name().
|
|
94
57
|
*
|
|
95
|
-
* @param type - Hardware device type
|
|
96
|
-
*
|
|
97
|
-
* @returns Device type name or null if unknown
|
|
58
|
+
* @param type - Hardware device type
|
|
59
|
+
* @returns Type name string, or null if invalid
|
|
98
60
|
*
|
|
99
61
|
* @example
|
|
100
62
|
* ```typescript
|
|
101
|
-
* import { HardwareDeviceContext } from 'node-av';
|
|
102
63
|
* import { AV_HWDEVICE_TYPE_CUDA } from 'node-av/constants';
|
|
103
64
|
*
|
|
104
65
|
* const name = HardwareDeviceContext.getTypeName(AV_HWDEVICE_TYPE_CUDA);
|
|
105
66
|
* console.log(name); // "cuda"
|
|
106
67
|
* ```
|
|
68
|
+
*
|
|
69
|
+
* @see {@link findTypeByName} For reverse lookup
|
|
107
70
|
*/
|
|
108
71
|
static getTypeName(type: AVHWDeviceType): string | null;
|
|
109
72
|
/**
|
|
110
|
-
*
|
|
73
|
+
* List all supported hardware device types.
|
|
111
74
|
*
|
|
112
|
-
* Returns all hardware
|
|
75
|
+
* Returns an array of all hardware acceleration types available
|
|
76
|
+
* in the current FFmpeg build.
|
|
113
77
|
*
|
|
114
|
-
* Direct mapping to av_hwdevice_iterate_types()
|
|
78
|
+
* Direct mapping to av_hwdevice_iterate_types().
|
|
115
79
|
*
|
|
116
|
-
* @returns Array of
|
|
80
|
+
* @returns Array of available hardware device types
|
|
117
81
|
*
|
|
118
82
|
* @example
|
|
119
83
|
* ```typescript
|
|
120
|
-
* import { HardwareDeviceContext } from 'node-av';
|
|
121
|
-
*
|
|
122
84
|
* const types = HardwareDeviceContext.iterateTypes();
|
|
85
|
+
* console.log('Available hardware acceleration:');
|
|
123
86
|
* for (const type of types) {
|
|
124
87
|
* const name = HardwareDeviceContext.getTypeName(type);
|
|
125
|
-
* console.log(`
|
|
88
|
+
* console.log(` - ${name}`);
|
|
126
89
|
* }
|
|
127
90
|
* ```
|
|
128
91
|
*/
|
|
129
92
|
static iterateTypes(): AVHWDeviceType[];
|
|
130
93
|
/**
|
|
131
|
-
*
|
|
94
|
+
* Find hardware device type by name.
|
|
132
95
|
*
|
|
133
|
-
*
|
|
96
|
+
* Converts a string name to the corresponding hardware device type enum.
|
|
134
97
|
*
|
|
135
|
-
* Direct mapping to av_hwdevice_find_type_by_name()
|
|
98
|
+
* Direct mapping to av_hwdevice_find_type_by_name().
|
|
136
99
|
*
|
|
137
|
-
* @param name -
|
|
138
|
-
*
|
|
139
|
-
* @returns AVHWDeviceType or AV_HWDEVICE_TYPE_NONE if not found
|
|
100
|
+
* @param name - Hardware type name (e.g., 'cuda', 'vaapi', 'videotoolbox')
|
|
101
|
+
* @returns Hardware device type enum, or AV_HWDEVICE_TYPE_NONE if not found
|
|
140
102
|
*
|
|
141
103
|
* @example
|
|
142
104
|
* ```typescript
|
|
143
|
-
* import { HardwareDeviceContext } from 'node-av';
|
|
144
|
-
* import { AV_HWDEVICE_TYPE_NONE } from 'node-av/constants';
|
|
145
|
-
*
|
|
146
105
|
* const type = HardwareDeviceContext.findTypeByName('cuda');
|
|
147
106
|
* if (type !== AV_HWDEVICE_TYPE_NONE) {
|
|
148
|
-
*
|
|
107
|
+
* console.log('CUDA is available');
|
|
149
108
|
* }
|
|
150
109
|
* ```
|
|
110
|
+
*
|
|
111
|
+
* @see {@link getTypeName} For type to name conversion
|
|
151
112
|
*/
|
|
152
113
|
static findTypeByName(name: string): AVHWDeviceType;
|
|
153
114
|
/**
|
|
154
115
|
* Hardware device type.
|
|
155
116
|
*
|
|
156
|
-
*
|
|
117
|
+
* The type of hardware acceleration in use.
|
|
157
118
|
*
|
|
158
|
-
*
|
|
119
|
+
* Direct mapping to AVHWDeviceContext->type.
|
|
159
120
|
*/
|
|
160
121
|
get type(): AVHWDeviceType;
|
|
161
122
|
/**
|
|
162
|
-
* Hardware
|
|
123
|
+
* Hardware context pointer.
|
|
163
124
|
*
|
|
164
|
-
*
|
|
125
|
+
* Opaque pointer to the underlying hardware-specific context.
|
|
126
|
+
* Type depends on the hardware device type.
|
|
165
127
|
*
|
|
166
|
-
*
|
|
167
|
-
* @readonly
|
|
128
|
+
* Direct mapping to AVHWDeviceContext->hwctx.
|
|
168
129
|
*/
|
|
169
130
|
get hwctx(): bigint | null;
|
|
170
131
|
/**
|
|
171
|
-
* Allocate
|
|
132
|
+
* Allocate hardware device context.
|
|
172
133
|
*
|
|
173
|
-
* Allocates
|
|
174
|
-
* Must
|
|
134
|
+
* Allocates memory for the specified hardware device type.
|
|
135
|
+
* Must be followed by init() to initialize the device.
|
|
175
136
|
*
|
|
176
|
-
* Direct mapping to av_hwdevice_ctx_alloc()
|
|
137
|
+
* Direct mapping to av_hwdevice_ctx_alloc().
|
|
177
138
|
*
|
|
178
|
-
* @param type - Hardware device type
|
|
139
|
+
* @param type - Hardware device type to allocate
|
|
179
140
|
*
|
|
180
|
-
* @throws {Error}
|
|
141
|
+
* @throws {Error} If allocation fails (ENOMEM)
|
|
181
142
|
*
|
|
182
143
|
* @example
|
|
183
144
|
* ```typescript
|
|
184
|
-
* import { HardwareDeviceContext, FFmpegError } from 'node-av';
|
|
185
145
|
* import { AV_HWDEVICE_TYPE_CUDA } from 'node-av/constants';
|
|
186
146
|
*
|
|
187
147
|
* const device = new HardwareDeviceContext();
|
|
188
148
|
* device.alloc(AV_HWDEVICE_TYPE_CUDA);
|
|
189
|
-
* // Configure device properties if needed
|
|
190
149
|
* const ret = device.init();
|
|
191
|
-
* FFmpegError.throwIfError(ret, 'init
|
|
150
|
+
* FFmpegError.throwIfError(ret, 'init');
|
|
192
151
|
* ```
|
|
193
152
|
*
|
|
194
|
-
* @see {@link init} To
|
|
195
|
-
* @see {@link create} For
|
|
153
|
+
* @see {@link init} To initialize after allocation
|
|
154
|
+
* @see {@link create} For combined alloc and init
|
|
196
155
|
*/
|
|
197
156
|
alloc(type: AVHWDeviceType): void;
|
|
198
157
|
/**
|
|
199
|
-
*
|
|
158
|
+
* Initialize allocated hardware device.
|
|
200
159
|
*
|
|
201
|
-
*
|
|
202
|
-
* Must be called before using the device
|
|
160
|
+
* Initializes a previously allocated hardware device context.
|
|
161
|
+
* Must be called after alloc() and before using the device.
|
|
203
162
|
*
|
|
204
|
-
* Direct mapping to av_hwdevice_ctx_init()
|
|
163
|
+
* Direct mapping to av_hwdevice_ctx_init().
|
|
205
164
|
*
|
|
206
165
|
* @returns 0 on success, negative AVERROR on error:
|
|
207
|
-
* -
|
|
208
|
-
* -
|
|
209
|
-
* -
|
|
210
|
-
* - <0: Device-specific errors
|
|
166
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
167
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
168
|
+
* - Device-specific errors
|
|
211
169
|
*
|
|
212
170
|
* @example
|
|
213
171
|
* ```typescript
|
|
214
|
-
* import {
|
|
172
|
+
* import { FFmpegError } from 'node-av';
|
|
215
173
|
*
|
|
174
|
+
* device.alloc(type);
|
|
216
175
|
* const ret = device.init();
|
|
217
|
-
* FFmpegError.throwIfError(ret, 'init
|
|
218
|
-
* // Device is now ready for use
|
|
176
|
+
* FFmpegError.throwIfError(ret, 'init');
|
|
219
177
|
* ```
|
|
220
178
|
*
|
|
221
179
|
* @see {@link alloc} Must be called first
|
|
180
|
+
* @see {@link create} For combined operation
|
|
222
181
|
*/
|
|
223
182
|
init(): number;
|
|
224
183
|
/**
|
|
225
|
-
*
|
|
184
|
+
* Create and initialize hardware device.
|
|
226
185
|
*
|
|
227
|
-
*
|
|
228
|
-
* This is the preferred method for creating hardware
|
|
186
|
+
* Combined allocation and initialization of a hardware device.
|
|
187
|
+
* This is the preferred method for creating hardware contexts.
|
|
229
188
|
*
|
|
230
|
-
* Direct mapping to av_hwdevice_ctx_create()
|
|
189
|
+
* Direct mapping to av_hwdevice_ctx_create().
|
|
231
190
|
*
|
|
232
191
|
* @param type - Hardware device type
|
|
233
|
-
* @param device - Device
|
|
234
|
-
* @param options - Device
|
|
235
|
-
*
|
|
192
|
+
* @param device - Device name/path (null for default)
|
|
193
|
+
* @param options - Device-specific options
|
|
236
194
|
* @returns 0 on success, negative AVERROR on error:
|
|
237
|
-
* -
|
|
238
|
-
* -
|
|
239
|
-
* -
|
|
240
|
-
* -
|
|
241
|
-
* - <0: Device-specific errors
|
|
195
|
+
* - AVERROR_EINVAL: Invalid type or parameters
|
|
196
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
197
|
+
* - AVERROR_ENOSYS: Type not supported
|
|
198
|
+
* - Device-specific errors
|
|
242
199
|
*
|
|
243
200
|
* @example
|
|
244
201
|
* ```typescript
|
|
245
|
-
* import {
|
|
246
|
-
* import { AV_HWDEVICE_TYPE_CUDA
|
|
247
|
-
*
|
|
248
|
-
* // Create
|
|
249
|
-
* const
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
202
|
+
* import { FFmpegError, Dictionary } from 'node-av';
|
|
203
|
+
* import { AV_HWDEVICE_TYPE_CUDA } from 'node-av/constants';
|
|
204
|
+
*
|
|
205
|
+
* // Create with default device
|
|
206
|
+
* const device = new HardwareDeviceContext();
|
|
207
|
+
* let ret = device.create(AV_HWDEVICE_TYPE_CUDA);
|
|
208
|
+
* FFmpegError.throwIfError(ret, 'create');
|
|
209
|
+
*
|
|
210
|
+
* // Create with specific device
|
|
211
|
+
* const device2 = new HardwareDeviceContext();
|
|
212
|
+
* ret = device2.create(AV_HWDEVICE_TYPE_VAAPI, '/dev/dri/renderD128');
|
|
213
|
+
* FFmpegError.throwIfError(ret, 'create');
|
|
214
|
+
*
|
|
215
|
+
* // Create with options
|
|
216
|
+
* const opts = Dictionary.fromObject({ 'device_idx': '1' });
|
|
217
|
+
* ret = device.create(AV_HWDEVICE_TYPE_CUDA, null, opts);
|
|
218
|
+
* FFmpegError.throwIfError(ret, 'create');
|
|
259
219
|
* ```
|
|
260
220
|
*
|
|
261
|
-
* @see {@link
|
|
262
|
-
* @see {@link createDerived} To derive from another device
|
|
221
|
+
* @see {@link createDerived} To create from existing device
|
|
263
222
|
*/
|
|
264
223
|
create(type: AVHWDeviceType, device?: string | null, options?: Dictionary | null): number;
|
|
265
224
|
/**
|
|
266
|
-
* Create
|
|
225
|
+
* Create derived hardware device.
|
|
267
226
|
*
|
|
268
|
-
* Creates a device
|
|
269
|
-
*
|
|
227
|
+
* Creates a new device context derived from an existing one.
|
|
228
|
+
* Used for interoperability between different hardware APIs.
|
|
270
229
|
*
|
|
271
|
-
* Direct mapping to av_hwdevice_ctx_create_derived()
|
|
230
|
+
* Direct mapping to av_hwdevice_ctx_create_derived().
|
|
272
231
|
*
|
|
273
232
|
* @param source - Source device context to derive from
|
|
274
233
|
* @param type - Target hardware device type
|
|
275
|
-
*
|
|
276
234
|
* @returns 0 on success, negative AVERROR on error:
|
|
277
|
-
* -
|
|
278
|
-
* -
|
|
279
|
-
* -
|
|
280
|
-
* - <0: Other errors
|
|
235
|
+
* - AVERROR_EINVAL: Invalid parameters
|
|
236
|
+
* - AVERROR_ENOSYS: Derivation not supported
|
|
237
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
281
238
|
*
|
|
282
239
|
* @example
|
|
283
240
|
* ```typescript
|
|
284
|
-
* import {
|
|
285
|
-
* import {
|
|
241
|
+
* import { FFmpegError } from 'node-av';
|
|
242
|
+
* import { AV_HWDEVICE_TYPE_CUDA, AV_HWDEVICE_TYPE_VULKAN } from 'node-av/constants';
|
|
286
243
|
*
|
|
287
|
-
* // Create CUDA device from
|
|
288
|
-
* const
|
|
289
|
-
*
|
|
290
|
-
* FFmpegError.throwIfError(vaapiRet, 'create VAAPI');
|
|
244
|
+
* // Create CUDA device from Vulkan
|
|
245
|
+
* const vulkan = new HardwareDeviceContext();
|
|
246
|
+
* vulkan.create(AV_HWDEVICE_TYPE_VULKAN);
|
|
291
247
|
*
|
|
292
248
|
* const cuda = new HardwareDeviceContext();
|
|
293
|
-
* const ret = cuda.createDerived(
|
|
294
|
-
* FFmpegError.throwIfError(ret, '
|
|
249
|
+
* const ret = cuda.createDerived(vulkan, AV_HWDEVICE_TYPE_CUDA);
|
|
250
|
+
* FFmpegError.throwIfError(ret, 'createDerived');
|
|
295
251
|
* ```
|
|
296
252
|
*
|
|
297
|
-
* @see {@link create} For
|
|
253
|
+
* @see {@link create} For creating independent device
|
|
298
254
|
*/
|
|
299
255
|
createDerived(source: HardwareDeviceContext, type: AVHWDeviceType): number;
|
|
300
256
|
/**
|
|
301
|
-
* Free
|
|
257
|
+
* Free hardware device context.
|
|
302
258
|
*
|
|
303
|
-
*
|
|
259
|
+
* Releases all resources associated with the hardware device.
|
|
260
|
+
* The context becomes invalid after calling this.
|
|
304
261
|
*
|
|
305
|
-
* Direct mapping to av_buffer_unref()
|
|
262
|
+
* Direct mapping to av_buffer_unref() on device context.
|
|
306
263
|
*
|
|
307
264
|
* @example
|
|
308
265
|
* ```typescript
|
|
309
|
-
* import { HardwareDeviceContext } from 'node-av';
|
|
310
|
-
*
|
|
311
266
|
* device.free();
|
|
312
|
-
* //
|
|
267
|
+
* // Device is now invalid
|
|
313
268
|
* ```
|
|
269
|
+
*
|
|
270
|
+
* @see {@link Symbol.dispose} For automatic cleanup
|
|
314
271
|
*/
|
|
315
272
|
free(): void;
|
|
316
273
|
/**
|
|
317
|
-
* Allocate
|
|
274
|
+
* Allocate hardware configuration.
|
|
318
275
|
*
|
|
319
|
-
* Allocates a configuration structure
|
|
276
|
+
* Allocates a hardware-specific configuration structure.
|
|
277
|
+
* Used for codec configuration with hardware acceleration.
|
|
320
278
|
*
|
|
321
|
-
* Direct mapping to av_hwdevice_hwconfig_alloc()
|
|
279
|
+
* Direct mapping to av_hwdevice_hwconfig_alloc().
|
|
322
280
|
*
|
|
323
|
-
* @returns
|
|
281
|
+
* @returns Configuration pointer, or null on failure
|
|
324
282
|
*
|
|
325
283
|
* @example
|
|
326
284
|
* ```typescript
|
|
327
|
-
* import { HardwareDeviceContext } from 'node-av';
|
|
328
|
-
*
|
|
329
285
|
* const hwconfig = device.hwconfigAlloc();
|
|
330
286
|
* if (hwconfig) {
|
|
331
|
-
* // Use with
|
|
332
|
-
*
|
|
287
|
+
* // Use with codec context
|
|
288
|
+
* codecContext.hwConfig = hwconfig;
|
|
333
289
|
* }
|
|
334
290
|
* ```
|
|
335
291
|
*
|
|
336
|
-
* @see {@link getHwframeConstraints} To
|
|
292
|
+
* @see {@link getHwframeConstraints} To get constraints
|
|
337
293
|
*/
|
|
338
294
|
hwconfigAlloc(): bigint | null;
|
|
339
295
|
/**
|
|
340
|
-
* Get
|
|
296
|
+
* Get hardware frame constraints.
|
|
341
297
|
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
298
|
+
* Returns the constraints on frames that can be allocated
|
|
299
|
+
* with this hardware device.
|
|
344
300
|
*
|
|
345
|
-
* Direct mapping to av_hwdevice_get_hwframe_constraints()
|
|
301
|
+
* Direct mapping to av_hwdevice_get_hwframe_constraints().
|
|
346
302
|
*
|
|
347
|
-
* @param hwconfig -
|
|
348
|
-
*
|
|
349
|
-
* @returns Constraints object or null:
|
|
350
|
-
* - Object: Device constraints
|
|
351
|
-
* - null: No constraints available
|
|
303
|
+
* @param hwconfig - Optional hardware configuration
|
|
304
|
+
* @returns Frame constraints, or null if not available
|
|
352
305
|
*
|
|
353
306
|
* @example
|
|
354
307
|
* ```typescript
|
|
355
|
-
* import { HardwareDeviceContext } from 'node-av';
|
|
356
|
-
*
|
|
357
308
|
* const constraints = device.getHwframeConstraints();
|
|
358
309
|
* if (constraints) {
|
|
359
|
-
* console.log(`
|
|
360
|
-
*
|
|
310
|
+
* console.log(`Min size: ${constraints.minWidth}x${constraints.minHeight}`);
|
|
311
|
+
* console.log(`Max size: ${constraints.maxWidth}x${constraints.maxHeight}`);
|
|
361
312
|
* if (constraints.validSwFormats) {
|
|
362
|
-
* console.log('
|
|
313
|
+
* console.log('Software formats:', constraints.validSwFormats);
|
|
314
|
+
* }
|
|
315
|
+
* if (constraints.validHwFormats) {
|
|
316
|
+
* console.log('Hardware formats:', constraints.validHwFormats);
|
|
363
317
|
* }
|
|
364
318
|
* }
|
|
365
319
|
* ```
|
|
366
|
-
*
|
|
367
|
-
* @see {@link hwconfigAlloc} To create configuration
|
|
368
|
-
* @see {@link HardwareFramesContext} To use with frame pools
|
|
369
320
|
*/
|
|
370
321
|
getHwframeConstraints(hwconfig?: bigint): {
|
|
371
322
|
validHwFormats?: number[];
|
|
@@ -376,10 +327,11 @@ export declare class HardwareDeviceContext implements Disposable, NativeWrapper<
|
|
|
376
327
|
maxHeight: number;
|
|
377
328
|
} | null;
|
|
378
329
|
/**
|
|
379
|
-
* Get the native
|
|
330
|
+
* Get the underlying native HardwareDeviceContext object.
|
|
331
|
+
*
|
|
332
|
+
* @returns The native HardwareDeviceContext binding object
|
|
380
333
|
*
|
|
381
|
-
* @internal
|
|
382
|
-
* @returns The underlying native hardware device context object
|
|
334
|
+
* @internal
|
|
383
335
|
*/
|
|
384
336
|
getNative(): NativeHardwareDeviceContext;
|
|
385
337
|
/**
|
|
@@ -390,18 +342,12 @@ export declare class HardwareDeviceContext implements Disposable, NativeWrapper<
|
|
|
390
342
|
*
|
|
391
343
|
* @example
|
|
392
344
|
* ```typescript
|
|
393
|
-
* import { HardwareDeviceContext, FFmpegError } from 'node-av';
|
|
394
|
-
* import { AV_HWDEVICE_TYPE_CUDA } from 'node-av/constants';
|
|
395
|
-
*
|
|
396
345
|
* {
|
|
397
346
|
* using device = new HardwareDeviceContext();
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
* // ... use device
|
|
347
|
+
* device.create(AV_HWDEVICE_TYPE_CUDA);
|
|
348
|
+
* // Use device...
|
|
401
349
|
* } // Automatically freed when leaving scope
|
|
402
350
|
* ```
|
|
403
|
-
*
|
|
404
|
-
* @see {@link free} For manual cleanup
|
|
405
351
|
*/
|
|
406
352
|
[Symbol.dispose](): void;
|
|
407
353
|
}
|