node-av 0.0.1
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/CHANGELOG.md +8 -0
- package/LICENSE.md +22 -0
- package/README.md +377 -0
- package/binding.gyp +78 -0
- package/dist/api/bitstream-filter.d.ts +246 -0
- package/dist/api/bitstream-filter.js +369 -0
- package/dist/api/bitstream-filter.js.map +1 -0
- package/dist/api/decoder.d.ts +257 -0
- package/dist/api/decoder.js +424 -0
- package/dist/api/decoder.js.map +1 -0
- package/dist/api/encoder.d.ts +298 -0
- package/dist/api/encoder.js +574 -0
- package/dist/api/encoder.js.map +1 -0
- package/dist/api/filter.d.ts +457 -0
- package/dist/api/filter.js +876 -0
- package/dist/api/filter.js.map +1 -0
- package/dist/api/hardware.d.ts +318 -0
- package/dist/api/hardware.js +558 -0
- package/dist/api/hardware.js.map +1 -0
- package/dist/api/index.d.ts +12 -0
- package/dist/api/index.js +20 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/io-stream.d.ts +109 -0
- package/dist/api/io-stream.js +124 -0
- package/dist/api/io-stream.js.map +1 -0
- package/dist/api/media-input.d.ts +295 -0
- package/dist/api/media-input.js +456 -0
- package/dist/api/media-input.js.map +1 -0
- package/dist/api/media-output.d.ts +274 -0
- package/dist/api/media-output.js +486 -0
- package/dist/api/media-output.js.map +1 -0
- package/dist/api/pipeline.d.ts +117 -0
- package/dist/api/pipeline.js +836 -0
- package/dist/api/pipeline.js.map +1 -0
- package/dist/api/types.d.ts +440 -0
- package/dist/api/types.js +2 -0
- package/dist/api/types.js.map +1 -0
- package/dist/api/utilities/audio-sample.d.ts +115 -0
- package/dist/api/utilities/audio-sample.js +110 -0
- package/dist/api/utilities/audio-sample.js.map +1 -0
- package/dist/api/utilities/channel-layout.d.ts +83 -0
- package/dist/api/utilities/channel-layout.js +87 -0
- package/dist/api/utilities/channel-layout.js.map +1 -0
- package/dist/api/utilities/image.d.ts +177 -0
- package/dist/api/utilities/image.js +183 -0
- package/dist/api/utilities/image.js.map +1 -0
- package/dist/api/utilities/index.d.ts +8 -0
- package/dist/api/utilities/index.js +17 -0
- package/dist/api/utilities/index.js.map +1 -0
- package/dist/api/utilities/media-type.d.ts +56 -0
- package/dist/api/utilities/media-type.js +60 -0
- package/dist/api/utilities/media-type.js.map +1 -0
- package/dist/api/utilities/pixel-format.d.ts +94 -0
- package/dist/api/utilities/pixel-format.js +102 -0
- package/dist/api/utilities/pixel-format.js.map +1 -0
- package/dist/api/utilities/sample-format.d.ts +132 -0
- package/dist/api/utilities/sample-format.js +144 -0
- package/dist/api/utilities/sample-format.js.map +1 -0
- package/dist/api/utilities/streaming.d.ts +104 -0
- package/dist/api/utilities/streaming.js +137 -0
- package/dist/api/utilities/streaming.js.map +1 -0
- package/dist/api/utilities/timestamp.d.ts +187 -0
- package/dist/api/utilities/timestamp.js +200 -0
- package/dist/api/utilities/timestamp.js.map +1 -0
- package/dist/api/utils.d.ts +61 -0
- package/dist/api/utils.js +330 -0
- package/dist/api/utils.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/audio-fifo.d.ts +339 -0
- package/dist/lib/audio-fifo.js +365 -0
- package/dist/lib/audio-fifo.js.map +1 -0
- package/dist/lib/binding.d.ts +192 -0
- package/dist/lib/binding.js +70 -0
- package/dist/lib/binding.js.map +1 -0
- package/dist/lib/bitstream-filter-context.d.ts +345 -0
- package/dist/lib/bitstream-filter-context.js +407 -0
- package/dist/lib/bitstream-filter-context.js.map +1 -0
- package/dist/lib/bitstream-filter.d.ts +124 -0
- package/dist/lib/bitstream-filter.js +138 -0
- package/dist/lib/bitstream-filter.js.map +1 -0
- package/dist/lib/channel-layouts.d.ts +51 -0
- package/dist/lib/channel-layouts.js +55 -0
- package/dist/lib/channel-layouts.js.map +1 -0
- package/dist/lib/codec-context.d.ts +763 -0
- package/dist/lib/codec-context.js +974 -0
- package/dist/lib/codec-context.js.map +1 -0
- package/dist/lib/codec-parameters.d.ts +362 -0
- package/dist/lib/codec-parameters.js +460 -0
- package/dist/lib/codec-parameters.js.map +1 -0
- package/dist/lib/codec-parser.d.ts +185 -0
- package/dist/lib/codec-parser.js +193 -0
- package/dist/lib/codec-parser.js.map +1 -0
- package/dist/lib/codec.d.ts +432 -0
- package/dist/lib/codec.js +492 -0
- package/dist/lib/codec.js.map +1 -0
- package/dist/lib/constants.d.ts +2037 -0
- package/dist/lib/constants.js +1659 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/dictionary.d.ts +371 -0
- package/dist/lib/dictionary.js +406 -0
- package/dist/lib/dictionary.js.map +1 -0
- package/dist/lib/error.d.ts +216 -0
- package/dist/lib/error.js +254 -0
- package/dist/lib/error.js.map +1 -0
- package/dist/lib/filter-context.d.ts +445 -0
- package/dist/lib/filter-context.js +505 -0
- package/dist/lib/filter-context.js.map +1 -0
- package/dist/lib/filter-graph.d.ts +556 -0
- package/dist/lib/filter-graph.js +608 -0
- package/dist/lib/filter-graph.js.map +1 -0
- package/dist/lib/filter-inout.d.ts +205 -0
- package/dist/lib/filter-inout.js +264 -0
- package/dist/lib/filter-inout.js.map +1 -0
- package/dist/lib/filter.d.ts +231 -0
- package/dist/lib/filter.js +260 -0
- package/dist/lib/filter.js.map +1 -0
- package/dist/lib/format-context.d.ts +798 -0
- package/dist/lib/format-context.js +845 -0
- package/dist/lib/format-context.js.map +1 -0
- package/dist/lib/frame.d.ts +784 -0
- package/dist/lib/frame.js +933 -0
- package/dist/lib/frame.js.map +1 -0
- package/dist/lib/hardware-device-context.d.ts +407 -0
- package/dist/lib/hardware-device-context.js +429 -0
- package/dist/lib/hardware-device-context.js.map +1 -0
- package/dist/lib/hardware-frames-context.d.ts +374 -0
- package/dist/lib/hardware-frames-context.js +430 -0
- package/dist/lib/hardware-frames-context.js.map +1 -0
- package/dist/lib/index.d.ts +31 -0
- package/dist/lib/index.js +54 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/input-format.d.ts +216 -0
- package/dist/lib/input-format.js +246 -0
- package/dist/lib/input-format.js.map +1 -0
- package/dist/lib/io-context.d.ts +495 -0
- package/dist/lib/io-context.js +550 -0
- package/dist/lib/io-context.js.map +1 -0
- package/dist/lib/log.d.ts +201 -0
- package/dist/lib/log.js +219 -0
- package/dist/lib/log.js.map +1 -0
- package/dist/lib/native-types.d.ts +719 -0
- package/dist/lib/native-types.js +2 -0
- package/dist/lib/native-types.js.map +1 -0
- package/dist/lib/option.d.ts +589 -0
- package/dist/lib/option.js +853 -0
- package/dist/lib/option.js.map +1 -0
- package/dist/lib/output-format.d.ts +179 -0
- package/dist/lib/output-format.js +205 -0
- package/dist/lib/output-format.js.map +1 -0
- package/dist/lib/packet.d.ts +487 -0
- package/dist/lib/packet.js +558 -0
- package/dist/lib/packet.js.map +1 -0
- package/dist/lib/rational.d.ts +210 -0
- package/dist/lib/rational.js +233 -0
- package/dist/lib/rational.js.map +1 -0
- package/dist/lib/software-resample-context.d.ts +572 -0
- package/dist/lib/software-resample-context.js +610 -0
- package/dist/lib/software-resample-context.js.map +1 -0
- package/dist/lib/software-scale-context.d.ts +290 -0
- package/dist/lib/software-scale-context.js +308 -0
- package/dist/lib/software-scale-context.js.map +1 -0
- package/dist/lib/stream.d.ts +322 -0
- package/dist/lib/stream.js +408 -0
- package/dist/lib/stream.js.map +1 -0
- package/dist/lib/types.d.ts +59 -0
- package/dist/lib/types.js +8 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utilities.d.ts +346 -0
- package/dist/lib/utilities.js +424 -0
- package/dist/lib/utilities.js.map +1 -0
- package/install/check.js +113 -0
- package/install/ffmpeg.js +163 -0
- package/package.json +107 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { bindings } from './binding.js';
|
|
2
|
+
/**
|
|
3
|
+
* FFmpeg error handling.
|
|
4
|
+
*
|
|
5
|
+
* Represents FFmpeg errors with error codes and human-readable messages.
|
|
6
|
+
* Provides utilities for error checking and throwing.
|
|
7
|
+
* Essential for proper error handling in FFmpeg operations.
|
|
8
|
+
*
|
|
9
|
+
* Direct mapping to FFmpeg's error system.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { FFmpegError } from 'node-av';
|
|
14
|
+
*
|
|
15
|
+
* // Check return codes
|
|
16
|
+
* const ret = await codecContext.sendPacket(packet);
|
|
17
|
+
* FFmpegError.throwIfError(ret, 'sendPacket');
|
|
18
|
+
*
|
|
19
|
+
* // Handle specific errors
|
|
20
|
+
* try {
|
|
21
|
+
* const openRet = await formatContext.openInput('file.mp4', null, null);
|
|
22
|
+
* FFmpegError.throwIfError(openRet, 'openInput');
|
|
23
|
+
* } catch (error) {
|
|
24
|
+
* if (error instanceof FFmpegError) {
|
|
25
|
+
* console.error(`Error code: ${error.code}`);
|
|
26
|
+
* console.error(`Message: ${error.message}`);
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export class FFmpegError extends Error {
|
|
32
|
+
native;
|
|
33
|
+
/**
|
|
34
|
+
* Create a new FFmpegError instance.
|
|
35
|
+
*
|
|
36
|
+
* Wraps an FFmpeg error code with a JavaScript Error.
|
|
37
|
+
* Automatically retrieves the error message from FFmpeg.
|
|
38
|
+
*
|
|
39
|
+
* Direct wrapper around FFmpeg error codes.
|
|
40
|
+
*
|
|
41
|
+
* @param code - FFmpeg error code (negative number)
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* import { FFmpegError } from 'node-av';
|
|
46
|
+
* import { AVERROR_EOF } from 'node-av/constants';
|
|
47
|
+
*
|
|
48
|
+
* const error = new FFmpegError(AVERROR_EOF);
|
|
49
|
+
* console.log(error.message); // "End of file"
|
|
50
|
+
* console.log(error.code); // -541478725
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
constructor(code) {
|
|
54
|
+
const native = new bindings.FFmpegError(code);
|
|
55
|
+
const message = code !== undefined ? native.message : 'FFmpeg Error';
|
|
56
|
+
super(message);
|
|
57
|
+
this.native = native;
|
|
58
|
+
this.name = 'FFmpegError';
|
|
59
|
+
// Maintain proper stack trace for where our error was thrown (only available on V8)
|
|
60
|
+
if (Error.captureStackTrace) {
|
|
61
|
+
Error.captureStackTrace(this, FFmpegError);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Put a description of the AVERROR code errnum in a string.
|
|
66
|
+
*
|
|
67
|
+
* Converts an error code to a human-readable message.
|
|
68
|
+
*
|
|
69
|
+
* Direct mapping to av_strerror()
|
|
70
|
+
*
|
|
71
|
+
* @param errnum - Error code to describe
|
|
72
|
+
*
|
|
73
|
+
* @returns Error description string
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* import { FFmpegError } from 'node-av';
|
|
78
|
+
* import { AVERROR_EAGAIN, AVERROR_EOF } from 'node-av/constants';
|
|
79
|
+
*
|
|
80
|
+
* const message = FFmpegError.strerror(AVERROR_EAGAIN);
|
|
81
|
+
* console.log(message); // "Resource temporarily unavailable"
|
|
82
|
+
*
|
|
83
|
+
* const message2 = FFmpegError.strerror(AVERROR_EOF);
|
|
84
|
+
* console.log(message2); // "End of file"
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
static strerror(errnum) {
|
|
88
|
+
return bindings.FFmpegError.strerror(errnum);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Convert a POSIX error code to FFmpeg error code.
|
|
92
|
+
*
|
|
93
|
+
* Converts standard POSIX error codes to FFmpeg's error format.
|
|
94
|
+
*
|
|
95
|
+
* Direct mapping to AVERROR() macro
|
|
96
|
+
*
|
|
97
|
+
* @param posixError - POSIX error code (positive)
|
|
98
|
+
*
|
|
99
|
+
* @returns FFmpeg error code (negative)
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* import { FFmpegError } from 'node-av';
|
|
104
|
+
* import { EAGAIN } from 'errno';
|
|
105
|
+
*
|
|
106
|
+
* const ffmpegError = FFmpegError.makeError(EAGAIN);
|
|
107
|
+
* // ffmpegError is now AVERROR(EAGAIN)
|
|
108
|
+
*
|
|
109
|
+
* if (ret === ffmpegError) {
|
|
110
|
+
* console.log('Resource temporarily unavailable');
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
static makeError(posixError) {
|
|
115
|
+
return bindings.FFmpegError.makeError(posixError);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Check if a value is an error code.
|
|
119
|
+
*
|
|
120
|
+
* @param code - Value to check
|
|
121
|
+
*
|
|
122
|
+
* @returns true if code is negative (error), false otherwise
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const ret = await formatContext.readFrame(packet);
|
|
127
|
+
* if (FFmpegError.isFFmpegError(ret)) {
|
|
128
|
+
* console.error('Read frame failed');
|
|
129
|
+
* }
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
static isFFmpegError(code) {
|
|
133
|
+
return bindings.FFmpegError.isError(code);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Create FFmpegError from error code if it's an error.
|
|
137
|
+
*
|
|
138
|
+
* Helper method to conditionally create error objects.
|
|
139
|
+
*
|
|
140
|
+
* @param code - FFmpeg return code
|
|
141
|
+
*
|
|
142
|
+
* @returns FFmpegError if code < 0, null otherwise
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* const ret = await formatContext.openInput('video.mp4', null, null);
|
|
147
|
+
* const error = FFmpegError.fromCode(ret);
|
|
148
|
+
* if (error) {
|
|
149
|
+
* console.error(`Failed: ${error.message}`);
|
|
150
|
+
* console.error(`Code: ${error.code}`);
|
|
151
|
+
* }
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
static fromCode(code) {
|
|
155
|
+
if (code >= 0) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
return new FFmpegError(code);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Throw FFmpegError if code indicates error.
|
|
162
|
+
*
|
|
163
|
+
* Checks return code and throws an error if negative.
|
|
164
|
+
* Essential for FFmpeg error handling pattern.
|
|
165
|
+
*
|
|
166
|
+
* @param code - FFmpeg return code
|
|
167
|
+
* @param operation - Optional operation name for better error messages
|
|
168
|
+
*
|
|
169
|
+
* @throws {FFmpegError} If code < 0
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* import { FFmpegError } from 'node-av';
|
|
174
|
+
*
|
|
175
|
+
* const ret = await codecContext.sendPacket(packet);
|
|
176
|
+
* FFmpegError.throwIfError(ret, 'sendPacket');
|
|
177
|
+
* // Continues if successful, throws if error
|
|
178
|
+
*
|
|
179
|
+
* // With operation name for better error messages
|
|
180
|
+
* const ret2 = formatContext.allocOutputContext2(null, 'mp4', 'out.mp4');
|
|
181
|
+
* FFmpegError.throwIfError(ret2, 'allocOutputContext2');
|
|
182
|
+
* // Error message: "allocOutputContext2 failed: ..."
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* @see {@link fromCode} To create error without throwing
|
|
186
|
+
* @see {@link isFFmpegError} To check if value is error
|
|
187
|
+
*/
|
|
188
|
+
static throwIfError(code, operation) {
|
|
189
|
+
if (code < 0) {
|
|
190
|
+
const error = new FFmpegError(code);
|
|
191
|
+
if (operation) {
|
|
192
|
+
error.message = `${operation} failed: ${error.message}`;
|
|
193
|
+
}
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Check if error code matches specific error.
|
|
199
|
+
*
|
|
200
|
+
* Compares return code with specific error constant.
|
|
201
|
+
* Useful for handling different error conditions.
|
|
202
|
+
*
|
|
203
|
+
* @param code - FFmpeg return code
|
|
204
|
+
* @param errorCode - Error code to check against
|
|
205
|
+
*
|
|
206
|
+
* @returns true if codes match, false otherwise
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```typescript
|
|
210
|
+
* import { FFmpegError } from 'node-av';
|
|
211
|
+
* import { AVERROR_EOF, AVERROR_EAGAIN } from 'node-av/constants';
|
|
212
|
+
*
|
|
213
|
+
* const ret = await codecContext.receiveFrame(frame);
|
|
214
|
+
* if (FFmpegError.is(ret, AVERROR_EOF)) {
|
|
215
|
+
* console.log('End of stream reached');
|
|
216
|
+
* } else if (FFmpegError.is(ret, AVERROR_EAGAIN)) {
|
|
217
|
+
* console.log('Need more input');
|
|
218
|
+
* }
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
static is(code, errorCode) {
|
|
222
|
+
return code === errorCode;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Get error code.
|
|
226
|
+
*
|
|
227
|
+
* Direct mapping to AVERROR code
|
|
228
|
+
*
|
|
229
|
+
* FFmpeg error code (negative number).
|
|
230
|
+
*/
|
|
231
|
+
get code() {
|
|
232
|
+
return this.native.code;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Get human-readable error message.
|
|
236
|
+
*
|
|
237
|
+
* Direct mapping to av_strerror() output
|
|
238
|
+
*
|
|
239
|
+
* Error description string.
|
|
240
|
+
*/
|
|
241
|
+
get message() {
|
|
242
|
+
return this.native.message;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Get the native FFmpeg error object.
|
|
246
|
+
*
|
|
247
|
+
* @internal For use by other wrapper classes
|
|
248
|
+
* @returns The underlying native error object
|
|
249
|
+
*/
|
|
250
|
+
getNative() {
|
|
251
|
+
return this.native;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/lib/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC5B,MAAM,CAAoB;IAElC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,YAAY,IAAa;QACvB,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC9C,MAAM,OAAO,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC;QACrE,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAE1B,oFAAoF;QACpF,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAc;QAC5B,OAAO,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,SAAS,CAAC,UAAkB;QACjC,OAAO,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,aAAa,CAAC,IAAY;QAC/B,OAAO,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAY;QAC1B,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;YACd,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC,YAAY,CAAC,IAAY,EAAE,SAAkB;QAClD,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;YACb,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;YACpC,IAAI,SAAS,EAAE,CAAC;gBACb,KAAa,CAAC,OAAO,GAAG,GAAG,SAAS,YAAY,KAAK,CAAC,OAAO,EAAE,CAAC;YACnE,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,EAAE,CAAC,IAAY,EAAE,SAAiB;QACvC,OAAO,IAAI,KAAK,SAAS,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { Filter } from './filter.js';
|
|
2
|
+
import { HardwareDeviceContext } from './hardware-device-context.js';
|
|
3
|
+
import { OptionMember } from './option.js';
|
|
4
|
+
import { Rational } from './rational.js';
|
|
5
|
+
import type { Frame } from './frame.js';
|
|
6
|
+
import type { HardwareFramesContext } from './hardware-frames-context.js';
|
|
7
|
+
import type { NativeDictionary, NativeFilterContext, NativeFilterGraph, NativeWrapper } from './native-types.js';
|
|
8
|
+
import type { IRational } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Filter context for media processing.
|
|
11
|
+
*
|
|
12
|
+
* Represents an instance of a filter in a filter graph.
|
|
13
|
+
* Manages filter configuration, parameters, and connections.
|
|
14
|
+
* Must be created through FilterGraph.createFilter() and properly initialized before use.
|
|
15
|
+
*
|
|
16
|
+
* Direct mapping to FFmpeg's AVFilterContext.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import { FilterGraph, Filter, FFmpegError } from 'node-av';
|
|
21
|
+
*
|
|
22
|
+
* // Create filter context through FilterGraph
|
|
23
|
+
* const filterGraph = new FilterGraph();
|
|
24
|
+
* filterGraph.alloc();
|
|
25
|
+
*
|
|
26
|
+
* const bufferFilter = Filter.getByName('buffer');
|
|
27
|
+
* const bufferCtx = filterGraph.createFilter(bufferFilter, 'in');
|
|
28
|
+
* const initRet = bufferCtx.initStr('video_size=1920x1080:pix_fmt=yuv420p:time_base=1/25:pixel_aspect=1/1');
|
|
29
|
+
* FFmpegError.throwIfError(initRet, 'initStr buffer');
|
|
30
|
+
*
|
|
31
|
+
* // Link filters
|
|
32
|
+
* const scaleFilter = Filter.getByName('scale');
|
|
33
|
+
* const scaleCtx = filterGraph.createFilter(scaleFilter, 'scale');
|
|
34
|
+
* const scaleRet = scaleCtx.initStr('1280:720');
|
|
35
|
+
* FFmpegError.throwIfError(scaleRet, 'initStr scale');
|
|
36
|
+
*
|
|
37
|
+
* const linkRet = bufferCtx.link(0, scaleCtx, 0);
|
|
38
|
+
* FFmpegError.throwIfError(linkRet, 'link');
|
|
39
|
+
*
|
|
40
|
+
* // Configure and use the graph
|
|
41
|
+
* const configRet = filterGraph.config();
|
|
42
|
+
* FFmpegError.throwIfError(configRet, 'config');
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare class FilterContext extends OptionMember<NativeFilterContext> implements Disposable, NativeWrapper<NativeFilterContext> {
|
|
46
|
+
private _hwDeviceCtx?;
|
|
47
|
+
/**
|
|
48
|
+
* Constructor is internal - use FilterGraph.createFilter().
|
|
49
|
+
*
|
|
50
|
+
* FilterContexts are created and managed by FilterGraph.
|
|
51
|
+
* Do not instantiate directly.
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*
|
|
55
|
+
* @param native - Native AVFilterContext to wrap
|
|
56
|
+
*/
|
|
57
|
+
constructor(native: NativeFilterContext);
|
|
58
|
+
/**
|
|
59
|
+
* Filter instance name.
|
|
60
|
+
*
|
|
61
|
+
* The unique name of this filter instance in the graph.
|
|
62
|
+
*
|
|
63
|
+
* Direct mapping to AVFilterContext->name
|
|
64
|
+
*/
|
|
65
|
+
get name(): string | null;
|
|
66
|
+
set name(value: string | null);
|
|
67
|
+
/**
|
|
68
|
+
* The filter definition.
|
|
69
|
+
*
|
|
70
|
+
* The AVFilter that this context is an instance of.
|
|
71
|
+
*
|
|
72
|
+
* Direct mapping to AVFilterContext->filter
|
|
73
|
+
*
|
|
74
|
+
* @readonly
|
|
75
|
+
*/
|
|
76
|
+
get filter(): Filter | null;
|
|
77
|
+
/**
|
|
78
|
+
* The parent filter graph.
|
|
79
|
+
*
|
|
80
|
+
* The filter graph that contains this filter context.
|
|
81
|
+
*
|
|
82
|
+
* Direct mapping to AVFilterContext->graph
|
|
83
|
+
*
|
|
84
|
+
* @readonly
|
|
85
|
+
*/
|
|
86
|
+
get graph(): NativeFilterGraph | null;
|
|
87
|
+
/**
|
|
88
|
+
* Number of input pads.
|
|
89
|
+
*
|
|
90
|
+
* The number of input connections this filter can accept.
|
|
91
|
+
*
|
|
92
|
+
* Direct mapping to AVFilterContext->nb_inputs
|
|
93
|
+
*
|
|
94
|
+
* @readonly
|
|
95
|
+
*/
|
|
96
|
+
get nbInputs(): number;
|
|
97
|
+
/**
|
|
98
|
+
* Number of output pads.
|
|
99
|
+
*
|
|
100
|
+
* Direct mapping to AVFilterContext->nb_outputs
|
|
101
|
+
*
|
|
102
|
+
* The number of output connections this filter can provide.
|
|
103
|
+
*/
|
|
104
|
+
get nbOutputs(): number;
|
|
105
|
+
/**
|
|
106
|
+
* Filter readiness status.
|
|
107
|
+
*
|
|
108
|
+
* Direct mapping to AVFilterContext->ready
|
|
109
|
+
*
|
|
110
|
+
* Non-zero when the filter has been properly initialized.
|
|
111
|
+
*/
|
|
112
|
+
get ready(): number;
|
|
113
|
+
/**
|
|
114
|
+
* Get or set the hardware device context.
|
|
115
|
+
*
|
|
116
|
+
* Direct mapping to AVFilterContext->hw_device_ctx
|
|
117
|
+
*
|
|
118
|
+
* Used for hardware-accelerated filters that need device context.
|
|
119
|
+
* Must be set before filter initialization for hardware filters.
|
|
120
|
+
*/
|
|
121
|
+
get hwDeviceCtx(): HardwareDeviceContext | null;
|
|
122
|
+
set hwDeviceCtx(value: HardwareDeviceContext | null);
|
|
123
|
+
/**
|
|
124
|
+
* Initialize the filter with options.
|
|
125
|
+
*
|
|
126
|
+
* Direct mapping to avfilter_init_dict()
|
|
127
|
+
*
|
|
128
|
+
* @param options - Optional dictionary of filter options
|
|
129
|
+
*
|
|
130
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
131
|
+
* - 0: Success
|
|
132
|
+
* - AVERROR(EINVAL): Invalid options
|
|
133
|
+
* - AVERROR(ENOMEM): Memory allocation failure
|
|
134
|
+
* - <0: Other filter-specific errors
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* import { Dictionary, FilterContext, FFmpegError } from 'node-av';
|
|
139
|
+
*
|
|
140
|
+
* const options = new Dictionary();
|
|
141
|
+
* const ret1 = options.set('width', '1280', 0);
|
|
142
|
+
* FFmpegError.throwIfError(ret1, 'set width');
|
|
143
|
+
* const ret2 = options.set('height', '720', 0);
|
|
144
|
+
* FFmpegError.throwIfError(ret2, 'set height');
|
|
145
|
+
*
|
|
146
|
+
* const initRet = filterCtx.init(options.getNative());
|
|
147
|
+
* FFmpegError.throwIfError(initRet, 'init');
|
|
148
|
+
* options.free();
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @see initStr() - Alternative initialization with string arguments
|
|
152
|
+
*/
|
|
153
|
+
init(options?: NativeDictionary | null): number;
|
|
154
|
+
/**
|
|
155
|
+
* Initialize the filter with a string argument.
|
|
156
|
+
*
|
|
157
|
+
* Direct mapping to avfilter_init_str()
|
|
158
|
+
*
|
|
159
|
+
* @param args - Filter arguments string (format is filter-specific)
|
|
160
|
+
*
|
|
161
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
162
|
+
* - 0: Success
|
|
163
|
+
* - AVERROR(EINVAL): Invalid arguments
|
|
164
|
+
* - AVERROR(ENOMEM): Memory allocation failure
|
|
165
|
+
* - <0: Other filter-specific errors
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* import { FilterContext, FFmpegError } from 'node-av';
|
|
170
|
+
*
|
|
171
|
+
* // Initialize scale filter
|
|
172
|
+
* const scaleRet = scaleCtx.initStr('1280:720');
|
|
173
|
+
* FFmpegError.throwIfError(scaleRet, 'initStr scale');
|
|
174
|
+
*
|
|
175
|
+
* // Initialize buffer source
|
|
176
|
+
* const bufferRet = bufferCtx.initStr('video_size=1920x1080:pix_fmt=yuv420p:time_base=1/25');
|
|
177
|
+
* FFmpegError.throwIfError(bufferRet, 'initStr buffer');
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
180
|
+
* @see init() - Alternative initialization with dictionary
|
|
181
|
+
*/
|
|
182
|
+
initStr(args?: string | null): number;
|
|
183
|
+
/**
|
|
184
|
+
* Link this filter's output to another filter's input.
|
|
185
|
+
*
|
|
186
|
+
* Direct mapping to avfilter_link()
|
|
187
|
+
*
|
|
188
|
+
* @param srcPad - Output pad index on this filter
|
|
189
|
+
* @param dst - Destination filter context
|
|
190
|
+
* @param dstPad - Input pad index on destination filter
|
|
191
|
+
*
|
|
192
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
193
|
+
* - 0: Success
|
|
194
|
+
* - AVERROR(EINVAL): Invalid pad indices or incompatible formats
|
|
195
|
+
* - AVERROR(ENOMEM): Memory allocation failure
|
|
196
|
+
* - <0: Other linking errors
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* import { FilterContext, FFmpegError } from 'node-av';
|
|
201
|
+
*
|
|
202
|
+
* // Link buffer source to scale filter
|
|
203
|
+
* const linkRet1 = bufferCtx.link(0, scaleCtx, 0);
|
|
204
|
+
* FFmpegError.throwIfError(linkRet1, 'link buffer to scale');
|
|
205
|
+
*
|
|
206
|
+
* // Link scale to sink
|
|
207
|
+
* const linkRet2 = scaleCtx.link(0, sinkCtx, 0);
|
|
208
|
+
* FFmpegError.throwIfError(linkRet2, 'link scale to sink');
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
link(srcPad: number, dst: FilterContext, dstPad: number): number;
|
|
212
|
+
/**
|
|
213
|
+
* Unlink a filter pad.
|
|
214
|
+
*
|
|
215
|
+
* Removes the connection from the specified input pad.
|
|
216
|
+
* Note: avfilter_link_free is deprecated, we set pointer to nullptr instead.
|
|
217
|
+
*
|
|
218
|
+
* @param pad - Input pad index to unlink
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* // Unlink the first input pad
|
|
223
|
+
* filterCtx.unlink(0);
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
unlink(pad: number): void;
|
|
227
|
+
/**
|
|
228
|
+
* Add a frame to a buffer source filter.
|
|
229
|
+
*
|
|
230
|
+
* Direct mapping to av_buffersrc_add_frame()
|
|
231
|
+
*
|
|
232
|
+
* This function is specific to buffer source filters and is used
|
|
233
|
+
* to feed frames into the filter graph.
|
|
234
|
+
*
|
|
235
|
+
* @param frame - The frame to add (can be null to signal EOF)
|
|
236
|
+
*
|
|
237
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
238
|
+
* - 0: Success
|
|
239
|
+
* - AVERROR(EAGAIN): The buffer is full, try again later
|
|
240
|
+
* - AVERROR(EINVAL): Invalid parameters
|
|
241
|
+
* - AVERROR_EOF: The filter has been closed
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```typescript
|
|
245
|
+
* import { Frame, FilterContext, FFmpegError } from 'node-av';
|
|
246
|
+
*
|
|
247
|
+
* // Feed a frame to the buffer source
|
|
248
|
+
* const addRet = srcCtx.buffersrcAddFrame(frame);
|
|
249
|
+
* FFmpegError.throwIfError(addRet, 'buffersrcAddFrame');
|
|
250
|
+
*
|
|
251
|
+
* // Signal end of stream
|
|
252
|
+
* const eofRet = srcCtx.buffersrcAddFrame(null);
|
|
253
|
+
* FFmpegError.throwIfError(eofRet, 'buffersrcAddFrame EOF');
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
buffersrcAddFrame(frame: Frame | null): Promise<number>;
|
|
257
|
+
/**
|
|
258
|
+
* Set parameters for a buffer source filter.
|
|
259
|
+
*
|
|
260
|
+
* Direct mapping to av_buffersrc_parameters_set()
|
|
261
|
+
*
|
|
262
|
+
* This function configures a buffer source filter with specific parameters,
|
|
263
|
+
* including hardware frames context for hardware-accelerated filtering.
|
|
264
|
+
*
|
|
265
|
+
* @param params - Parameters for the buffer source
|
|
266
|
+
* @returns 0 on success, negative error code on failure
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```typescript
|
|
270
|
+
* const ret = srcCtx.buffersrcParametersSet({
|
|
271
|
+
* width: 1920,
|
|
272
|
+
* height: 1080,
|
|
273
|
+
* format: AV_PIX_FMT_YUV420P,
|
|
274
|
+
* timeBase: { num: 1, den: 30 },
|
|
275
|
+
* hwFramesCtx: hardware.framesContext
|
|
276
|
+
* });
|
|
277
|
+
* FFmpegError.throwIfError(ret, 'buffersrcParametersSet');
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
buffersrcParametersSet(params: {
|
|
281
|
+
width?: number;
|
|
282
|
+
height?: number;
|
|
283
|
+
format?: number;
|
|
284
|
+
timeBase?: IRational;
|
|
285
|
+
frameRate?: IRational;
|
|
286
|
+
sampleAspectRatio?: IRational;
|
|
287
|
+
hwFramesCtx?: HardwareFramesContext | null;
|
|
288
|
+
sampleRate?: number;
|
|
289
|
+
channelLayout?: bigint;
|
|
290
|
+
}): number;
|
|
291
|
+
/**
|
|
292
|
+
* Get a frame from a buffer sink filter.
|
|
293
|
+
*
|
|
294
|
+
* Direct mapping to av_buffersink_get_frame()
|
|
295
|
+
*
|
|
296
|
+
* This function is specific to buffer sink filters and is used
|
|
297
|
+
* to retrieve filtered frames from the filter graph.
|
|
298
|
+
*
|
|
299
|
+
* @param frame - The frame to receive the filtered data
|
|
300
|
+
*
|
|
301
|
+
* @returns 0 on success, negative AVERROR on error:
|
|
302
|
+
* - 0: Success, frame contains valid data
|
|
303
|
+
* - AVERROR(EAGAIN): No frame available, need more input
|
|
304
|
+
* - AVERROR_EOF: End of stream reached
|
|
305
|
+
* - AVERROR(EINVAL): Invalid parameters
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* import { Frame, FilterContext, FFmpegError } from 'node-av';
|
|
310
|
+
* import { AVERROR_EAGAIN, AVERROR_EOF } from 'node-av/constants';
|
|
311
|
+
*
|
|
312
|
+
* // Get filtered frames
|
|
313
|
+
* const frame = new Frame();
|
|
314
|
+
* frame.alloc();
|
|
315
|
+
*
|
|
316
|
+
* let ret = sinkCtx.buffersinkGetFrame(frame);
|
|
317
|
+
* while (ret >= 0) {
|
|
318
|
+
* // Process the filtered frame
|
|
319
|
+
* processFrame(frame);
|
|
320
|
+
* frame.unref();
|
|
321
|
+
*
|
|
322
|
+
* // Try to get another frame
|
|
323
|
+
* ret = sinkCtx.buffersinkGetFrame(frame);
|
|
324
|
+
* }
|
|
325
|
+
*
|
|
326
|
+
* if (!FFmpegError.is(ret, AVERROR_EAGAIN) && !FFmpegError.is(ret, AVERROR_EOF)) {
|
|
327
|
+
* FFmpegError.throwIfError(ret, 'buffersinkGetFrame');
|
|
328
|
+
* }
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
buffersinkGetFrame(frame: Frame): Promise<number>;
|
|
332
|
+
/**
|
|
333
|
+
* Set the frame size for a buffersink filter.
|
|
334
|
+
*
|
|
335
|
+
* Direct mapping to av_buffersink_set_frame_size()
|
|
336
|
+
*
|
|
337
|
+
* For audio encoders that require a specific frame size.
|
|
338
|
+
*
|
|
339
|
+
* @param frameSize - The frame size to set
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```typescript
|
|
343
|
+
* if (encCtx.frameSize > 0) {
|
|
344
|
+
* buffersinkCtx.buffersinkSetFrameSize(encCtx.frameSize);
|
|
345
|
+
* }
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
/**
|
|
349
|
+
* Get the time base from a buffersink filter.
|
|
350
|
+
*
|
|
351
|
+
* Direct mapping to av_buffersink_get_time_base()
|
|
352
|
+
*
|
|
353
|
+
* Returns the time base of the buffersink filter.
|
|
354
|
+
*
|
|
355
|
+
* @returns The time base as a Rational
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```typescript
|
|
359
|
+
* const timeBase = buffersinkCtx.buffersinkGetTimeBase();
|
|
360
|
+
* console.log(`Time base: ${timeBase.num}/${timeBase.den}`);
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
buffersinkGetTimeBase(): Rational;
|
|
364
|
+
/**
|
|
365
|
+
* Free the filter context.
|
|
366
|
+
*
|
|
367
|
+
* Direct mapping to avfilter_free()
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```typescript
|
|
371
|
+
* filterCtx.free();
|
|
372
|
+
* // filterCtx is now invalid and should not be used
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
375
|
+
free(): void;
|
|
376
|
+
/**
|
|
377
|
+
* Check if this is a source filter context.
|
|
378
|
+
*
|
|
379
|
+
* Source filters have no inputs and generate data.
|
|
380
|
+
*
|
|
381
|
+
* @returns true if the filter has no input pads, false otherwise
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* ```typescript
|
|
385
|
+
* if (filterCtx.isSource()) {
|
|
386
|
+
* console.log('This is a source filter');
|
|
387
|
+
* }
|
|
388
|
+
* ```
|
|
389
|
+
*/
|
|
390
|
+
isSource(): boolean;
|
|
391
|
+
/**
|
|
392
|
+
* Check if this is a sink filter context.
|
|
393
|
+
*
|
|
394
|
+
* Sink filters have no outputs and consume data.
|
|
395
|
+
*
|
|
396
|
+
* @returns true if the filter has no output pads, false otherwise
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```typescript
|
|
400
|
+
* if (filterCtx.isSink()) {
|
|
401
|
+
* console.log('This is a sink filter');
|
|
402
|
+
* }
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
isSink(): boolean;
|
|
406
|
+
/**
|
|
407
|
+
* Check if the filter is ready for processing.
|
|
408
|
+
*
|
|
409
|
+
* Filters must be initialized before they can process data.
|
|
410
|
+
*
|
|
411
|
+
* @returns true if the filter has been properly initialized, false otherwise
|
|
412
|
+
*
|
|
413
|
+
* @example
|
|
414
|
+
* ```typescript
|
|
415
|
+
* filterCtx.initStr('1280:720');
|
|
416
|
+
* if (filterCtx.isReady()) {
|
|
417
|
+
* console.log('Filter is ready for processing');
|
|
418
|
+
* }
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
isReady(): boolean;
|
|
422
|
+
/**
|
|
423
|
+
* Get the native FFmpeg AVFilterContext pointer.
|
|
424
|
+
*
|
|
425
|
+
* @internal For use by other wrapper classes
|
|
426
|
+
* @returns The underlying native filter context object
|
|
427
|
+
*/
|
|
428
|
+
getNative(): NativeFilterContext;
|
|
429
|
+
/**
|
|
430
|
+
* Dispose of the filter context.
|
|
431
|
+
*
|
|
432
|
+
* Implements the Disposable interface for automatic cleanup.
|
|
433
|
+
* Equivalent to calling free().
|
|
434
|
+
*
|
|
435
|
+
* @example
|
|
436
|
+
* ```typescript
|
|
437
|
+
* {
|
|
438
|
+
* using filterCtx = filterGraph.createFilter(filter, 'my_filter');
|
|
439
|
+
* filterCtx.initStr('args');
|
|
440
|
+
* // ... use filter context
|
|
441
|
+
* } // Automatically freed when leaving scope
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
444
|
+
[Symbol.dispose](): void;
|
|
445
|
+
}
|