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.
Files changed (175) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE.md +22 -0
  3. package/README.md +377 -0
  4. package/binding.gyp +78 -0
  5. package/dist/api/bitstream-filter.d.ts +246 -0
  6. package/dist/api/bitstream-filter.js +369 -0
  7. package/dist/api/bitstream-filter.js.map +1 -0
  8. package/dist/api/decoder.d.ts +257 -0
  9. package/dist/api/decoder.js +424 -0
  10. package/dist/api/decoder.js.map +1 -0
  11. package/dist/api/encoder.d.ts +298 -0
  12. package/dist/api/encoder.js +574 -0
  13. package/dist/api/encoder.js.map +1 -0
  14. package/dist/api/filter.d.ts +457 -0
  15. package/dist/api/filter.js +876 -0
  16. package/dist/api/filter.js.map +1 -0
  17. package/dist/api/hardware.d.ts +318 -0
  18. package/dist/api/hardware.js +558 -0
  19. package/dist/api/hardware.js.map +1 -0
  20. package/dist/api/index.d.ts +12 -0
  21. package/dist/api/index.js +20 -0
  22. package/dist/api/index.js.map +1 -0
  23. package/dist/api/io-stream.d.ts +109 -0
  24. package/dist/api/io-stream.js +124 -0
  25. package/dist/api/io-stream.js.map +1 -0
  26. package/dist/api/media-input.d.ts +295 -0
  27. package/dist/api/media-input.js +456 -0
  28. package/dist/api/media-input.js.map +1 -0
  29. package/dist/api/media-output.d.ts +274 -0
  30. package/dist/api/media-output.js +486 -0
  31. package/dist/api/media-output.js.map +1 -0
  32. package/dist/api/pipeline.d.ts +117 -0
  33. package/dist/api/pipeline.js +836 -0
  34. package/dist/api/pipeline.js.map +1 -0
  35. package/dist/api/types.d.ts +440 -0
  36. package/dist/api/types.js +2 -0
  37. package/dist/api/types.js.map +1 -0
  38. package/dist/api/utilities/audio-sample.d.ts +115 -0
  39. package/dist/api/utilities/audio-sample.js +110 -0
  40. package/dist/api/utilities/audio-sample.js.map +1 -0
  41. package/dist/api/utilities/channel-layout.d.ts +83 -0
  42. package/dist/api/utilities/channel-layout.js +87 -0
  43. package/dist/api/utilities/channel-layout.js.map +1 -0
  44. package/dist/api/utilities/image.d.ts +177 -0
  45. package/dist/api/utilities/image.js +183 -0
  46. package/dist/api/utilities/image.js.map +1 -0
  47. package/dist/api/utilities/index.d.ts +8 -0
  48. package/dist/api/utilities/index.js +17 -0
  49. package/dist/api/utilities/index.js.map +1 -0
  50. package/dist/api/utilities/media-type.d.ts +56 -0
  51. package/dist/api/utilities/media-type.js +60 -0
  52. package/dist/api/utilities/media-type.js.map +1 -0
  53. package/dist/api/utilities/pixel-format.d.ts +94 -0
  54. package/dist/api/utilities/pixel-format.js +102 -0
  55. package/dist/api/utilities/pixel-format.js.map +1 -0
  56. package/dist/api/utilities/sample-format.d.ts +132 -0
  57. package/dist/api/utilities/sample-format.js +144 -0
  58. package/dist/api/utilities/sample-format.js.map +1 -0
  59. package/dist/api/utilities/streaming.d.ts +104 -0
  60. package/dist/api/utilities/streaming.js +137 -0
  61. package/dist/api/utilities/streaming.js.map +1 -0
  62. package/dist/api/utilities/timestamp.d.ts +187 -0
  63. package/dist/api/utilities/timestamp.js +200 -0
  64. package/dist/api/utilities/timestamp.js.map +1 -0
  65. package/dist/api/utils.d.ts +61 -0
  66. package/dist/api/utils.js +330 -0
  67. package/dist/api/utils.js.map +1 -0
  68. package/dist/index.d.ts +2 -0
  69. package/dist/index.js +5 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/lib/audio-fifo.d.ts +339 -0
  72. package/dist/lib/audio-fifo.js +365 -0
  73. package/dist/lib/audio-fifo.js.map +1 -0
  74. package/dist/lib/binding.d.ts +192 -0
  75. package/dist/lib/binding.js +70 -0
  76. package/dist/lib/binding.js.map +1 -0
  77. package/dist/lib/bitstream-filter-context.d.ts +345 -0
  78. package/dist/lib/bitstream-filter-context.js +407 -0
  79. package/dist/lib/bitstream-filter-context.js.map +1 -0
  80. package/dist/lib/bitstream-filter.d.ts +124 -0
  81. package/dist/lib/bitstream-filter.js +138 -0
  82. package/dist/lib/bitstream-filter.js.map +1 -0
  83. package/dist/lib/channel-layouts.d.ts +51 -0
  84. package/dist/lib/channel-layouts.js +55 -0
  85. package/dist/lib/channel-layouts.js.map +1 -0
  86. package/dist/lib/codec-context.d.ts +763 -0
  87. package/dist/lib/codec-context.js +974 -0
  88. package/dist/lib/codec-context.js.map +1 -0
  89. package/dist/lib/codec-parameters.d.ts +362 -0
  90. package/dist/lib/codec-parameters.js +460 -0
  91. package/dist/lib/codec-parameters.js.map +1 -0
  92. package/dist/lib/codec-parser.d.ts +185 -0
  93. package/dist/lib/codec-parser.js +193 -0
  94. package/dist/lib/codec-parser.js.map +1 -0
  95. package/dist/lib/codec.d.ts +432 -0
  96. package/dist/lib/codec.js +492 -0
  97. package/dist/lib/codec.js.map +1 -0
  98. package/dist/lib/constants.d.ts +2037 -0
  99. package/dist/lib/constants.js +1659 -0
  100. package/dist/lib/constants.js.map +1 -0
  101. package/dist/lib/dictionary.d.ts +371 -0
  102. package/dist/lib/dictionary.js +406 -0
  103. package/dist/lib/dictionary.js.map +1 -0
  104. package/dist/lib/error.d.ts +216 -0
  105. package/dist/lib/error.js +254 -0
  106. package/dist/lib/error.js.map +1 -0
  107. package/dist/lib/filter-context.d.ts +445 -0
  108. package/dist/lib/filter-context.js +505 -0
  109. package/dist/lib/filter-context.js.map +1 -0
  110. package/dist/lib/filter-graph.d.ts +556 -0
  111. package/dist/lib/filter-graph.js +608 -0
  112. package/dist/lib/filter-graph.js.map +1 -0
  113. package/dist/lib/filter-inout.d.ts +205 -0
  114. package/dist/lib/filter-inout.js +264 -0
  115. package/dist/lib/filter-inout.js.map +1 -0
  116. package/dist/lib/filter.d.ts +231 -0
  117. package/dist/lib/filter.js +260 -0
  118. package/dist/lib/filter.js.map +1 -0
  119. package/dist/lib/format-context.d.ts +798 -0
  120. package/dist/lib/format-context.js +845 -0
  121. package/dist/lib/format-context.js.map +1 -0
  122. package/dist/lib/frame.d.ts +784 -0
  123. package/dist/lib/frame.js +933 -0
  124. package/dist/lib/frame.js.map +1 -0
  125. package/dist/lib/hardware-device-context.d.ts +407 -0
  126. package/dist/lib/hardware-device-context.js +429 -0
  127. package/dist/lib/hardware-device-context.js.map +1 -0
  128. package/dist/lib/hardware-frames-context.d.ts +374 -0
  129. package/dist/lib/hardware-frames-context.js +430 -0
  130. package/dist/lib/hardware-frames-context.js.map +1 -0
  131. package/dist/lib/index.d.ts +31 -0
  132. package/dist/lib/index.js +54 -0
  133. package/dist/lib/index.js.map +1 -0
  134. package/dist/lib/input-format.d.ts +216 -0
  135. package/dist/lib/input-format.js +246 -0
  136. package/dist/lib/input-format.js.map +1 -0
  137. package/dist/lib/io-context.d.ts +495 -0
  138. package/dist/lib/io-context.js +550 -0
  139. package/dist/lib/io-context.js.map +1 -0
  140. package/dist/lib/log.d.ts +201 -0
  141. package/dist/lib/log.js +219 -0
  142. package/dist/lib/log.js.map +1 -0
  143. package/dist/lib/native-types.d.ts +719 -0
  144. package/dist/lib/native-types.js +2 -0
  145. package/dist/lib/native-types.js.map +1 -0
  146. package/dist/lib/option.d.ts +589 -0
  147. package/dist/lib/option.js +853 -0
  148. package/dist/lib/option.js.map +1 -0
  149. package/dist/lib/output-format.d.ts +179 -0
  150. package/dist/lib/output-format.js +205 -0
  151. package/dist/lib/output-format.js.map +1 -0
  152. package/dist/lib/packet.d.ts +487 -0
  153. package/dist/lib/packet.js +558 -0
  154. package/dist/lib/packet.js.map +1 -0
  155. package/dist/lib/rational.d.ts +210 -0
  156. package/dist/lib/rational.js +233 -0
  157. package/dist/lib/rational.js.map +1 -0
  158. package/dist/lib/software-resample-context.d.ts +572 -0
  159. package/dist/lib/software-resample-context.js +610 -0
  160. package/dist/lib/software-resample-context.js.map +1 -0
  161. package/dist/lib/software-scale-context.d.ts +290 -0
  162. package/dist/lib/software-scale-context.js +308 -0
  163. package/dist/lib/software-scale-context.js.map +1 -0
  164. package/dist/lib/stream.d.ts +322 -0
  165. package/dist/lib/stream.js +408 -0
  166. package/dist/lib/stream.js.map +1 -0
  167. package/dist/lib/types.d.ts +59 -0
  168. package/dist/lib/types.js +8 -0
  169. package/dist/lib/types.js.map +1 -0
  170. package/dist/lib/utilities.d.ts +346 -0
  171. package/dist/lib/utilities.js +424 -0
  172. package/dist/lib/utilities.js.map +1 -0
  173. package/install/check.js +113 -0
  174. package/install/ffmpeg.js +163 -0
  175. package/package.json +107 -0
@@ -0,0 +1,556 @@
1
+ import { FilterContext } from './filter-context.js';
2
+ import { OptionMember } from './option.js';
3
+ import type { AVFilterCmdFlag, AVFilterConstants } from './constants.js';
4
+ import type { FilterInOut } from './filter-inout.js';
5
+ import type { Filter } from './filter.js';
6
+ import type { NativeFilterGraph, NativeWrapper } from './native-types.js';
7
+ /**
8
+ * Filter graph for media processing.
9
+ *
10
+ * Container for filters and their connections in a processing pipeline.
11
+ * Manages the entire filtering system from sources to sinks.
12
+ * Supports complex filter chains with multiple inputs and outputs.
13
+ *
14
+ * Direct mapping to FFmpeg's AVFilterGraph.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * import { FilterGraph, Filter, FilterContext, FFmpegError } from 'node-av';
19
+ *
20
+ * // Create and configure a simple filter graph
21
+ * const graph = new FilterGraph();
22
+ * graph.alloc();
23
+ *
24
+ * // Create buffer source
25
+ * const bufferFilter = Filter.getByName('buffer');
26
+ * if (!bufferFilter) throw new Error('Buffer filter not found');
27
+ * const bufferSrc = graph.createFilter(
28
+ * bufferFilter,
29
+ * 'in',
30
+ * 'video_size=1920x1080:pix_fmt=yuv420p:time_base=1/25'
31
+ * );
32
+ * if (!bufferSrc) throw new Error('Failed to create buffer source');
33
+ *
34
+ * // Create scale filter
35
+ * const scaleFilter = Filter.getByName('scale');
36
+ * if (!scaleFilter) throw new Error('Scale filter not found');
37
+ * const scale = graph.createFilter(
38
+ * scaleFilter,
39
+ * 'scale',
40
+ * '1280:720'
41
+ * );
42
+ * if (!scale) throw new Error('Failed to create scale filter');
43
+ *
44
+ * // Create buffer sink
45
+ * const sinkFilter = Filter.getByName('buffersink');
46
+ * if (!sinkFilter) throw new Error('Buffersink filter not found');
47
+ * const bufferSink = graph.createFilter(
48
+ * sinkFilter,
49
+ * 'out'
50
+ * );
51
+ * if (!bufferSink) throw new Error('Failed to create buffer sink');
52
+ *
53
+ * // Link filters
54
+ * const linkRet1 = bufferSrc.link(0, scale, 0);
55
+ * FFmpegError.throwIfError(linkRet1, 'link buffer to scale');
56
+ *
57
+ * const linkRet2 = scale.link(0, bufferSink, 0);
58
+ * FFmpegError.throwIfError(linkRet2, 'link scale to sink');
59
+ *
60
+ * // Configure the graph
61
+ * const configRet = graph.config();
62
+ * FFmpegError.throwIfError(configRet, 'config');
63
+ *
64
+ * // Clean up
65
+ * graph.free();
66
+ * ```
67
+ */
68
+ export declare class FilterGraph extends OptionMember<NativeFilterGraph> implements Disposable, NativeWrapper<NativeFilterGraph> {
69
+ /**
70
+ * Create a new FilterGraph instance.
71
+ *
72
+ * The graph is uninitialized - you must call alloc() before use.
73
+ * No FFmpeg resources are allocated until alloc() is called.
74
+ *
75
+ * Direct wrapper around AVFilterGraph.
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * import { FilterGraph } from 'node-av';
80
+ *
81
+ * const graph = new FilterGraph();
82
+ * graph.alloc();
83
+ * // Graph is now ready for use
84
+ * ```
85
+ */
86
+ constructor();
87
+ /**
88
+ * Number of filters in the graph.
89
+ *
90
+ * Direct mapping to AVFilterGraph->nb_filters
91
+ *
92
+ * The total count of filters currently in the graph.
93
+ */
94
+ get nbFilters(): number;
95
+ /**
96
+ * Array of all filters in the graph.
97
+ *
98
+ * Direct mapping to AVFilterGraph->filters
99
+ *
100
+ * All filter contexts currently in the graph.
101
+ */
102
+ get filters(): FilterContext[] | null;
103
+ /**
104
+ * Thread type for graph processing.
105
+ *
106
+ * Direct mapping to AVFilterGraph->thread_type
107
+ *
108
+ * Controls threading behavior of the graph (0 = disabled, AVFILTER_THREAD_SLICE = slice threading).
109
+ */
110
+ get threadType(): AVFilterConstants;
111
+ set threadType(value: AVFilterConstants);
112
+ /**
113
+ * Number of threads for graph processing.
114
+ *
115
+ * Direct mapping to AVFilterGraph->nb_threads
116
+ *
117
+ * 0 means automatic detection based on CPU cores.
118
+ */
119
+ get nbThreads(): number;
120
+ set nbThreads(value: number);
121
+ /**
122
+ * Software scaler options.
123
+ *
124
+ * Direct mapping to AVFilterGraph->scale_sws_opts
125
+ *
126
+ * Options string passed to the software scaler (e.g., "flags=bicubic").
127
+ */
128
+ get scaleSwsOpts(): string | null;
129
+ set scaleSwsOpts(value: string | null);
130
+ /**
131
+ * Allocate the filter graph.
132
+ *
133
+ * Allocates the graph structure and initializes it.
134
+ * Must be called before adding filters to the graph.
135
+ *
136
+ * Direct mapping to avfilter_graph_alloc()
137
+ *
138
+ * @throws {Error} Memory allocation failure (ENOMEM)
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * import { FilterGraph } from 'node-av';
143
+ *
144
+ * const graph = new FilterGraph();
145
+ * graph.alloc();
146
+ * // Graph is now allocated and ready
147
+ * ```
148
+ *
149
+ * @see {@link free} To free the graph
150
+ */
151
+ alloc(): void;
152
+ /**
153
+ * Free the filter graph.
154
+ *
155
+ * Releases all resources associated with the graph.
156
+ * All filters in the graph are also freed.
157
+ *
158
+ * Direct mapping to avfilter_graph_free()
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * graph.free();
163
+ * // graph is now invalid and should not be used
164
+ * ```
165
+ */
166
+ free(): void;
167
+ /**
168
+ * Create a filter instance in the graph.
169
+ *
170
+ * Direct mapping to avfilter_graph_create_filter()
171
+ *
172
+ * @param filter - The filter definition
173
+ * @param name - Name for this filter instance (must be unique in the graph)
174
+ * @param args - Optional initialization arguments (filter-specific format)
175
+ *
176
+ * @returns The created filter context or null on failure
177
+ *
178
+ * @example
179
+ * ```typescript
180
+ * // Create a scale filter
181
+ * const scaleFilter = Filter.getByName('scale');
182
+ * const scaleCtx = graph.createFilter(
183
+ * scaleFilter!,
184
+ * 'my_scale',
185
+ * '1280:720' // width:height
186
+ * );
187
+ *
188
+ * // Create a buffer source for video
189
+ * const bufferFilter = Filter.getByName('buffer');
190
+ * const bufferCtx = graph.createFilter(
191
+ * bufferFilter!,
192
+ * 'video_in',
193
+ * 'video_size=1920x1080:pix_fmt=yuv420p:time_base=1/25:pixel_aspect=1/1'
194
+ * );
195
+ * ```
196
+ */
197
+ createFilter(filter: Filter, name: string, args?: string | null): FilterContext | null;
198
+ /**
199
+ * Allocate a filter instance in the graph without initializing it.
200
+ *
201
+ * Direct mapping to avfilter_graph_alloc_filter()
202
+ *
203
+ * This method allocates the filter but does not initialize it.
204
+ * You must call filter.init() or filter.initStr() afterwards.
205
+ *
206
+ * @param filter - The filter definition
207
+ * @param name - Name for this filter instance (must be unique in the graph)
208
+ *
209
+ * @returns The allocated filter context or null on failure
210
+ *
211
+ * @example
212
+ * ```typescript
213
+ * import { FilterGraph, Filter, FFmpegError } from 'node-av';
214
+ *
215
+ * // Allocate a filter without initializing
216
+ * const scaleFilter = Filter.getByName('scale');
217
+ * if (!scaleFilter) throw new Error('Scale filter not found');
218
+ * const scaleCtx = graph.allocFilter(scaleFilter, 'my_scale');
219
+ * if (!scaleCtx) throw new Error('Failed to allocate filter');
220
+ *
221
+ * // Set options using setOpt
222
+ * const ret1 = scaleCtx.setOpt('width', '1280');
223
+ * FFmpegError.throwIfError(ret1, 'setOpt width');
224
+ * const ret2 = scaleCtx.setOpt('height', '720');
225
+ * FFmpegError.throwIfError(ret2, 'setOpt height');
226
+ *
227
+ * // Initialize the filter
228
+ * const initRet = scaleCtx.init();
229
+ * FFmpegError.throwIfError(initRet, 'init');
230
+ * ```
231
+ *
232
+ * @note This provides an alternative workflow to createFilter,
233
+ * allowing options to be set before initialization.
234
+ */
235
+ allocFilter(filter: Filter, name: string): FilterContext | null;
236
+ /**
237
+ * Get a filter by name from the graph.
238
+ *
239
+ * Direct mapping to avfilter_graph_get_filter()
240
+ *
241
+ * @param name - The filter instance name
242
+ *
243
+ * @returns The filter context or null if not found
244
+ *
245
+ * @example
246
+ * ```typescript
247
+ * const scaleCtx = graph.getFilter('my_scale');
248
+ * if (scaleCtx) {
249
+ * console.log('Found scale filter');
250
+ * }
251
+ * ```
252
+ */
253
+ getFilter(name: string): FilterContext | null;
254
+ /**
255
+ * Configure the filter graph.
256
+ *
257
+ * Direct mapping to avfilter_graph_config()
258
+ *
259
+ * @returns 0 on success, negative AVERROR on error:
260
+ * - 0: Success
261
+ * - AVERROR(EINVAL): Invalid graph configuration
262
+ * - AVERROR(ENOMEM): Memory allocation failure
263
+ * - <0: Other configuration errors
264
+ *
265
+ * @example
266
+ * ```typescript
267
+ * import { FilterGraph, FFmpegError } from 'node-av';
268
+ *
269
+ * // After creating and linking all filters
270
+ * const ret = graph.config();
271
+ * FFmpegError.throwIfError(ret, 'config');
272
+ * // Graph is now ready for processing
273
+ * ```
274
+ *
275
+ * @note Must be called after all filters are added and connected.
276
+ */
277
+ config(): Promise<number>;
278
+ /**
279
+ * Parse a filtergraph description.
280
+ *
281
+ * Direct mapping to avfilter_graph_parse()
282
+ *
283
+ * @param filters - Filtergraph description string
284
+ * @param inputs - Input pad list
285
+ * @param outputs - Output pad list
286
+ *
287
+ * @returns 0 on success, negative AVERROR on error:
288
+ * - 0: Success
289
+ * - AVERROR(EINVAL): Invalid filtergraph syntax
290
+ * - AVERROR(ENOMEM): Memory allocation failure
291
+ * - <0: Other parsing errors
292
+ *
293
+ * @example
294
+ * ```typescript
295
+ * import { FilterGraph, FilterInOut, FFmpegError } from 'node-av';
296
+ *
297
+ * const inputs = new FilterInOut();
298
+ * inputs.alloc();
299
+ * inputs.name = 'in';
300
+ * inputs.filterCtx = bufferSrcCtx;
301
+ * inputs.padIdx = 0;
302
+ *
303
+ * const outputs = new FilterInOut();
304
+ * outputs.alloc();
305
+ * outputs.name = 'out';
306
+ * outputs.filterCtx = bufferSinkCtx;
307
+ * outputs.padIdx = 0;
308
+ *
309
+ * const ret = graph.parse('[in] scale=1280:720 [out]', inputs, outputs);
310
+ * FFmpegError.throwIfError(ret, 'parse');
311
+ * ```
312
+ */
313
+ parse(filters: string, inputs: FilterInOut | null, outputs: FilterInOut | null): number;
314
+ /**
315
+ * Parse a filtergraph description (simplified).
316
+ *
317
+ * Direct mapping to avfilter_graph_parse2()
318
+ *
319
+ * @param filters - Filtergraph description string
320
+ *
321
+ * @returns 0 on success, negative AVERROR on error:
322
+ * - 0: Success
323
+ * - AVERROR(EINVAL): Invalid filtergraph syntax
324
+ * - AVERROR(ENOMEM): Memory allocation failure
325
+ * - <0: Other parsing errors
326
+ *
327
+ * @example
328
+ * ```typescript
329
+ * import { FilterGraph, FFmpegError } from 'node-av';
330
+ *
331
+ * // Parse a simple filter chain
332
+ * const ret = graph.parse2('scale=1280:720,format=yuv420p');
333
+ * FFmpegError.throwIfError(ret, 'parse2');
334
+ * ```
335
+ *
336
+ * @note Automatically handles inputs and outputs.
337
+ */
338
+ parse2(filters: string): number;
339
+ /**
340
+ * Parse a filtergraph description (pointer version).
341
+ *
342
+ * Direct mapping to avfilter_graph_parse_ptr()
343
+ *
344
+ * @param filters - Filtergraph description string
345
+ * @param inputs - Optional input pad list (FilterInOut)
346
+ * @param outputs - Optional output pad list (FilterInOut)
347
+ *
348
+ * @returns 0 on success, negative AVERROR on error:
349
+ * - 0: Success
350
+ * - AVERROR(EINVAL): Invalid filtergraph syntax
351
+ * - AVERROR(ENOMEM): Memory allocation failure
352
+ * - <0: Other parsing errors
353
+ *
354
+ * @example
355
+ * ```typescript
356
+ * import { FilterGraph, FFmpegError } from 'node-av';
357
+ *
358
+ * // Parse a complex filter graph
359
+ * const ret = graph.parsePtr(
360
+ * '[0:v] scale=1280:720 [scaled]; [scaled] split [out1][out2]'
361
+ * );
362
+ * FFmpegError.throwIfError(ret, 'parsePtr');
363
+ * ```
364
+ *
365
+ * @example
366
+ * ```typescript
367
+ * import { FilterGraph, FilterInOut, FFmpegError } from 'node-av';
368
+ *
369
+ * // Parse with explicit inputs/outputs
370
+ * const inputs = new FilterInOut();
371
+ * inputs.name = 'in';
372
+ * inputs.filterCtx = buffersrcCtx;
373
+ * inputs.padIdx = 0;
374
+ *
375
+ * const outputs = new FilterInOut();
376
+ * outputs.name = 'out';
377
+ * outputs.filterCtx = buffersinkCtx;
378
+ * outputs.padIdx = 0;
379
+ *
380
+ * const ret = graph.parsePtr(filtersDescr, inputs, outputs);
381
+ * FFmpegError.throwIfError(ret, 'parsePtr');
382
+ * ```
383
+ *
384
+ * @note Similar to parse2 but with different internal handling.
385
+ */
386
+ parsePtr(filters: string, inputs?: FilterInOut | null, outputs?: FilterInOut | null): number;
387
+ /**
388
+ * Validate the filter graph.
389
+ *
390
+ * Direct mapping to avfilter_graph_validate()
391
+ *
392
+ * @returns 0 on success, negative AVERROR on error:
393
+ * - 0: Valid graph structure
394
+ * - AVERROR(EINVAL): Invalid graph structure
395
+ * - <0: Other validation errors
396
+ *
397
+ * @example
398
+ * ```typescript
399
+ * // Validate before configuring
400
+ * const ret = graph.validate();
401
+ * if (ret < 0) {
402
+ * console.error('Graph validation failed');
403
+ * }
404
+ * ```
405
+ *
406
+ * @note Checks that the graph structure is valid without configuring it.
407
+ */
408
+ validate(): number;
409
+ /**
410
+ * Request a frame from the oldest sink.
411
+ *
412
+ * Direct mapping to avfilter_graph_request_oldest()
413
+ *
414
+ * @returns 0 on success, negative AVERROR on error:
415
+ * - 0: Success
416
+ * - AVERROR_EOF: No more frames available
417
+ * - AVERROR(EAGAIN): Need more input data
418
+ * - <0: Other processing errors
419
+ *
420
+ * @example
421
+ * ```typescript
422
+ * import { FilterGraph, FFmpegError } from 'node-av';
423
+ * import { AVERROR_EOF, AVERROR_EAGAIN } from 'node-av/constants';
424
+ *
425
+ * // Pull frames from the graph
426
+ * while (true) {
427
+ * const ret = await graph.requestOldest();
428
+ * if (FFmpegError.is(ret, AVERROR_EOF)) {
429
+ * break; // No more frames
430
+ * }
431
+ * if (ret < 0 && !FFmpegError.is(ret, AVERROR_EAGAIN)) {
432
+ * FFmpegError.throwIfError(ret, 'requestOldest');
433
+ * }
434
+ * // Process output from sinks
435
+ * }
436
+ * ```
437
+ *
438
+ * @note Triggers processing in the graph to produce output.
439
+ */
440
+ requestOldest(): Promise<number>;
441
+ /**
442
+ * Get the graph structure as a string.
443
+ *
444
+ * Returns a string representation of the filter graph in DOT format.
445
+ * Uses avfilter_graph_dump() internally.
446
+ *
447
+ * @returns String representation of the filter graph or null if not allocated
448
+ *
449
+ * @example
450
+ * ```typescript
451
+ * const graphDescription = graph.dump();
452
+ * console.log('Filter graph:', graphDescription);
453
+ * ```
454
+ */
455
+ dump(): string | null;
456
+ /**
457
+ * Send a command to one or more filters in the graph.
458
+ *
459
+ * Direct mapping to avfilter_graph_send_command()
460
+ *
461
+ * @param target - Filter name or "all" to send to all filters
462
+ * @param cmd - Command name (e.g., "volume", "hue", "rate")
463
+ * @param arg - Command argument (e.g., "0.5", "2.0")
464
+ * @param flags - Command flags (AVFilterCmdFlag, default: 0)
465
+ * - AVFILTER_CMD_FLAG_ONE: Stop once a filter understood the command
466
+ * - AVFILTER_CMD_FLAG_FAST: Only execute if fast (hardware acceleration)
467
+ *
468
+ * @returns Error code (negative) or response object { response: string | null }
469
+ *
470
+ * @example
471
+ * ```typescript
472
+ * import { FilterGraph, FFmpegError, AVFILTER_CMD_FLAG_ONE } from 'node-av';
473
+ *
474
+ * // Send volume change command to audio filter
475
+ * const result = graph.sendCommand('volume', 'volume', '0.5');
476
+ * if (typeof result === 'number') {
477
+ * console.error('Command failed:', FFmpegError.strerror(result));
478
+ * } else {
479
+ * console.log('Response:', result.response);
480
+ * }
481
+ * ```
482
+ *
483
+ * @example
484
+ * ```typescript
485
+ * // Send command to all filters, stop at first one that handles it
486
+ * const result = graph.sendCommand('all', 'enable', 'expr=gte(t,10)', AVFILTER_CMD_FLAG_ONE);
487
+ *
488
+ * // Send command to specific filter
489
+ * const result = graph.sendCommand('scale', 'width', '1920');
490
+ * ```
491
+ *
492
+ * @note Not all filters support commands. Check filter documentation.
493
+ */
494
+ sendCommand(target: string, cmd: string, arg: string, flags?: AVFilterCmdFlag): number | {
495
+ response: string | null;
496
+ };
497
+ /**
498
+ * Queue a command to be executed at a specific time.
499
+ *
500
+ * Direct mapping to avfilter_graph_queue_command()
501
+ *
502
+ * @param target - Filter name or "all" to send to all filters
503
+ * @param cmd - Command name (e.g., "volume", "hue", "rate")
504
+ * @param arg - Command argument (e.g., "0.5", "2.0")
505
+ * @param ts - Timestamp when the command should be executed
506
+ * @param flags - Command flags (AVFilterCmdFlag, default: 0)
507
+ * - AVFILTER_CMD_FLAG_ONE: Stop once a filter understood the command
508
+ * - AVFILTER_CMD_FLAG_FAST: Only execute if fast (hardware acceleration)
509
+ *
510
+ * @returns 0 on success, negative AVERROR on error
511
+ *
512
+ * @example
513
+ * ```typescript
514
+ * import { FilterGraph, FFmpegError, AVFILTER_CMD_FLAG_ONE } from 'node-av';
515
+ *
516
+ * // Queue volume change at 10 seconds
517
+ * const ret = graph.queueCommand('volume', 'volume', '0.2', 10.0);
518
+ * FFmpegError.throwIfError(ret, 'queueCommand');
519
+ * ```
520
+ *
521
+ * @example
522
+ * ```typescript
523
+ * // Queue multiple commands at different times
524
+ * graph.queueCommand('volume', 'volume', '0.5', 5.0);
525
+ * graph.queueCommand('volume', 'volume', '1.0', 10.0);
526
+ * graph.queueCommand('volume', 'volume', '0.2', 15.0);
527
+ * ```
528
+ *
529
+ * @note Commands are executed when processing frames with matching timestamps.
530
+ * @note Not all filters support queued commands.
531
+ */
532
+ queueCommand(target: string, cmd: string, arg: string, ts: number, flags?: AVFilterCmdFlag): number;
533
+ /**
534
+ * Get the native FFmpeg AVFilterGraph pointer.
535
+ *
536
+ * @internal For use by other wrapper classes
537
+ * @returns The underlying native filter graph object
538
+ */
539
+ getNative(): NativeFilterGraph;
540
+ /**
541
+ * Dispose of the filter graph.
542
+ *
543
+ * Implements the Disposable interface for automatic cleanup.
544
+ * Equivalent to calling free().
545
+ *
546
+ * @example
547
+ * ```typescript
548
+ * {
549
+ * using graph = new FilterGraph();
550
+ * graph.alloc();
551
+ * // ... use graph
552
+ * } // Automatically freed when leaving scope
553
+ * ```
554
+ */
555
+ [Symbol.dispose](): void;
556
+ }