@revizly/node-av 5.2.2-beta.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 (254) hide show
  1. package/BUILD_LINUX.md +61 -0
  2. package/LICENSE.md +22 -0
  3. package/README.md +662 -0
  4. package/build_mac_local.sh +69 -0
  5. package/dist/api/audio-frame-buffer.d.ts +205 -0
  6. package/dist/api/audio-frame-buffer.js +287 -0
  7. package/dist/api/audio-frame-buffer.js.map +1 -0
  8. package/dist/api/bitstream-filter.d.ts +820 -0
  9. package/dist/api/bitstream-filter.js +1242 -0
  10. package/dist/api/bitstream-filter.js.map +1 -0
  11. package/dist/api/constants.d.ts +44 -0
  12. package/dist/api/constants.js +45 -0
  13. package/dist/api/constants.js.map +1 -0
  14. package/dist/api/data/test_av1.ivf +0 -0
  15. package/dist/api/data/test_h264.h264 +0 -0
  16. package/dist/api/data/test_hevc.h265 +0 -0
  17. package/dist/api/data/test_mjpeg.mjpeg +0 -0
  18. package/dist/api/data/test_vp8.ivf +0 -0
  19. package/dist/api/data/test_vp9.ivf +0 -0
  20. package/dist/api/decoder.d.ts +1088 -0
  21. package/dist/api/decoder.js +1775 -0
  22. package/dist/api/decoder.js.map +1 -0
  23. package/dist/api/demuxer.d.ts +1219 -0
  24. package/dist/api/demuxer.js +2081 -0
  25. package/dist/api/demuxer.js.map +1 -0
  26. package/dist/api/device.d.ts +586 -0
  27. package/dist/api/device.js +961 -0
  28. package/dist/api/device.js.map +1 -0
  29. package/dist/api/encoder.d.ts +1132 -0
  30. package/dist/api/encoder.js +1988 -0
  31. package/dist/api/encoder.js.map +1 -0
  32. package/dist/api/filter-complex.d.ts +821 -0
  33. package/dist/api/filter-complex.js +1604 -0
  34. package/dist/api/filter-complex.js.map +1 -0
  35. package/dist/api/filter-presets.d.ts +1286 -0
  36. package/dist/api/filter-presets.js +2152 -0
  37. package/dist/api/filter-presets.js.map +1 -0
  38. package/dist/api/filter.d.ts +1234 -0
  39. package/dist/api/filter.js +1976 -0
  40. package/dist/api/filter.js.map +1 -0
  41. package/dist/api/fmp4-stream.d.ts +426 -0
  42. package/dist/api/fmp4-stream.js +739 -0
  43. package/dist/api/fmp4-stream.js.map +1 -0
  44. package/dist/api/hardware.d.ts +651 -0
  45. package/dist/api/hardware.js +1260 -0
  46. package/dist/api/hardware.js.map +1 -0
  47. package/dist/api/index.d.ts +17 -0
  48. package/dist/api/index.js +32 -0
  49. package/dist/api/index.js.map +1 -0
  50. package/dist/api/io-stream.d.ts +307 -0
  51. package/dist/api/io-stream.js +282 -0
  52. package/dist/api/io-stream.js.map +1 -0
  53. package/dist/api/muxer.d.ts +957 -0
  54. package/dist/api/muxer.js +2002 -0
  55. package/dist/api/muxer.js.map +1 -0
  56. package/dist/api/pipeline.d.ts +607 -0
  57. package/dist/api/pipeline.js +1145 -0
  58. package/dist/api/pipeline.js.map +1 -0
  59. package/dist/api/utilities/async-queue.d.ts +120 -0
  60. package/dist/api/utilities/async-queue.js +211 -0
  61. package/dist/api/utilities/async-queue.js.map +1 -0
  62. package/dist/api/utilities/audio-sample.d.ts +117 -0
  63. package/dist/api/utilities/audio-sample.js +112 -0
  64. package/dist/api/utilities/audio-sample.js.map +1 -0
  65. package/dist/api/utilities/channel-layout.d.ts +76 -0
  66. package/dist/api/utilities/channel-layout.js +80 -0
  67. package/dist/api/utilities/channel-layout.js.map +1 -0
  68. package/dist/api/utilities/electron-shared-texture.d.ts +328 -0
  69. package/dist/api/utilities/electron-shared-texture.js +503 -0
  70. package/dist/api/utilities/electron-shared-texture.js.map +1 -0
  71. package/dist/api/utilities/image.d.ts +207 -0
  72. package/dist/api/utilities/image.js +213 -0
  73. package/dist/api/utilities/image.js.map +1 -0
  74. package/dist/api/utilities/index.d.ts +12 -0
  75. package/dist/api/utilities/index.js +25 -0
  76. package/dist/api/utilities/index.js.map +1 -0
  77. package/dist/api/utilities/media-type.d.ts +49 -0
  78. package/dist/api/utilities/media-type.js +53 -0
  79. package/dist/api/utilities/media-type.js.map +1 -0
  80. package/dist/api/utilities/pixel-format.d.ts +89 -0
  81. package/dist/api/utilities/pixel-format.js +97 -0
  82. package/dist/api/utilities/pixel-format.js.map +1 -0
  83. package/dist/api/utilities/sample-format.d.ts +129 -0
  84. package/dist/api/utilities/sample-format.js +141 -0
  85. package/dist/api/utilities/sample-format.js.map +1 -0
  86. package/dist/api/utilities/scheduler.d.ts +138 -0
  87. package/dist/api/utilities/scheduler.js +98 -0
  88. package/dist/api/utilities/scheduler.js.map +1 -0
  89. package/dist/api/utilities/streaming.d.ts +186 -0
  90. package/dist/api/utilities/streaming.js +309 -0
  91. package/dist/api/utilities/streaming.js.map +1 -0
  92. package/dist/api/utilities/timestamp.d.ts +193 -0
  93. package/dist/api/utilities/timestamp.js +206 -0
  94. package/dist/api/utilities/timestamp.js.map +1 -0
  95. package/dist/api/utilities/whisper-model.d.ts +310 -0
  96. package/dist/api/utilities/whisper-model.js +528 -0
  97. package/dist/api/utilities/whisper-model.js.map +1 -0
  98. package/dist/api/utils.d.ts +19 -0
  99. package/dist/api/utils.js +39 -0
  100. package/dist/api/utils.js.map +1 -0
  101. package/dist/api/whisper.d.ts +324 -0
  102. package/dist/api/whisper.js +362 -0
  103. package/dist/api/whisper.js.map +1 -0
  104. package/dist/constants/channel-layouts.d.ts +53 -0
  105. package/dist/constants/channel-layouts.js +57 -0
  106. package/dist/constants/channel-layouts.js.map +1 -0
  107. package/dist/constants/constants.d.ts +2325 -0
  108. package/dist/constants/constants.js +1887 -0
  109. package/dist/constants/constants.js.map +1 -0
  110. package/dist/constants/decoders.d.ts +633 -0
  111. package/dist/constants/decoders.js +641 -0
  112. package/dist/constants/decoders.js.map +1 -0
  113. package/dist/constants/encoders.d.ts +295 -0
  114. package/dist/constants/encoders.js +308 -0
  115. package/dist/constants/encoders.js.map +1 -0
  116. package/dist/constants/hardware.d.ts +26 -0
  117. package/dist/constants/hardware.js +27 -0
  118. package/dist/constants/hardware.js.map +1 -0
  119. package/dist/constants/index.d.ts +5 -0
  120. package/dist/constants/index.js +6 -0
  121. package/dist/constants/index.js.map +1 -0
  122. package/dist/ffmpeg/index.d.ts +99 -0
  123. package/dist/ffmpeg/index.js +115 -0
  124. package/dist/ffmpeg/index.js.map +1 -0
  125. package/dist/ffmpeg/utils.d.ts +31 -0
  126. package/dist/ffmpeg/utils.js +68 -0
  127. package/dist/ffmpeg/utils.js.map +1 -0
  128. package/dist/ffmpeg/version.d.ts +6 -0
  129. package/dist/ffmpeg/version.js +7 -0
  130. package/dist/ffmpeg/version.js.map +1 -0
  131. package/dist/index.d.ts +4 -0
  132. package/dist/index.js +9 -0
  133. package/dist/index.js.map +1 -0
  134. package/dist/lib/audio-fifo.d.ts +399 -0
  135. package/dist/lib/audio-fifo.js +431 -0
  136. package/dist/lib/audio-fifo.js.map +1 -0
  137. package/dist/lib/binding.d.ts +228 -0
  138. package/dist/lib/binding.js +60 -0
  139. package/dist/lib/binding.js.map +1 -0
  140. package/dist/lib/bitstream-filter-context.d.ts +379 -0
  141. package/dist/lib/bitstream-filter-context.js +441 -0
  142. package/dist/lib/bitstream-filter-context.js.map +1 -0
  143. package/dist/lib/bitstream-filter.d.ts +140 -0
  144. package/dist/lib/bitstream-filter.js +154 -0
  145. package/dist/lib/bitstream-filter.js.map +1 -0
  146. package/dist/lib/codec-context.d.ts +1071 -0
  147. package/dist/lib/codec-context.js +1354 -0
  148. package/dist/lib/codec-context.js.map +1 -0
  149. package/dist/lib/codec-parameters.d.ts +616 -0
  150. package/dist/lib/codec-parameters.js +761 -0
  151. package/dist/lib/codec-parameters.js.map +1 -0
  152. package/dist/lib/codec-parser.d.ts +201 -0
  153. package/dist/lib/codec-parser.js +213 -0
  154. package/dist/lib/codec-parser.js.map +1 -0
  155. package/dist/lib/codec.d.ts +586 -0
  156. package/dist/lib/codec.js +713 -0
  157. package/dist/lib/codec.js.map +1 -0
  158. package/dist/lib/device.d.ts +291 -0
  159. package/dist/lib/device.js +324 -0
  160. package/dist/lib/device.js.map +1 -0
  161. package/dist/lib/dictionary.d.ts +333 -0
  162. package/dist/lib/dictionary.js +372 -0
  163. package/dist/lib/dictionary.js.map +1 -0
  164. package/dist/lib/error.d.ts +242 -0
  165. package/dist/lib/error.js +303 -0
  166. package/dist/lib/error.js.map +1 -0
  167. package/dist/lib/fifo.d.ts +416 -0
  168. package/dist/lib/fifo.js +453 -0
  169. package/dist/lib/fifo.js.map +1 -0
  170. package/dist/lib/filter-context.d.ts +712 -0
  171. package/dist/lib/filter-context.js +789 -0
  172. package/dist/lib/filter-context.js.map +1 -0
  173. package/dist/lib/filter-graph-segment.d.ts +160 -0
  174. package/dist/lib/filter-graph-segment.js +171 -0
  175. package/dist/lib/filter-graph-segment.js.map +1 -0
  176. package/dist/lib/filter-graph.d.ts +641 -0
  177. package/dist/lib/filter-graph.js +704 -0
  178. package/dist/lib/filter-graph.js.map +1 -0
  179. package/dist/lib/filter-inout.d.ts +198 -0
  180. package/dist/lib/filter-inout.js +257 -0
  181. package/dist/lib/filter-inout.js.map +1 -0
  182. package/dist/lib/filter.d.ts +243 -0
  183. package/dist/lib/filter.js +272 -0
  184. package/dist/lib/filter.js.map +1 -0
  185. package/dist/lib/format-context.d.ts +1254 -0
  186. package/dist/lib/format-context.js +1379 -0
  187. package/dist/lib/format-context.js.map +1 -0
  188. package/dist/lib/frame-utils.d.ts +116 -0
  189. package/dist/lib/frame-utils.js +98 -0
  190. package/dist/lib/frame-utils.js.map +1 -0
  191. package/dist/lib/frame.d.ts +1222 -0
  192. package/dist/lib/frame.js +1435 -0
  193. package/dist/lib/frame.js.map +1 -0
  194. package/dist/lib/hardware-device-context.d.ts +362 -0
  195. package/dist/lib/hardware-device-context.js +383 -0
  196. package/dist/lib/hardware-device-context.js.map +1 -0
  197. package/dist/lib/hardware-frames-context.d.ts +419 -0
  198. package/dist/lib/hardware-frames-context.js +477 -0
  199. package/dist/lib/hardware-frames-context.js.map +1 -0
  200. package/dist/lib/index.d.ts +35 -0
  201. package/dist/lib/index.js +60 -0
  202. package/dist/lib/index.js.map +1 -0
  203. package/dist/lib/input-format.d.ts +249 -0
  204. package/dist/lib/input-format.js +306 -0
  205. package/dist/lib/input-format.js.map +1 -0
  206. package/dist/lib/io-context.d.ts +696 -0
  207. package/dist/lib/io-context.js +769 -0
  208. package/dist/lib/io-context.js.map +1 -0
  209. package/dist/lib/log.d.ts +174 -0
  210. package/dist/lib/log.js +184 -0
  211. package/dist/lib/log.js.map +1 -0
  212. package/dist/lib/native-types.d.ts +946 -0
  213. package/dist/lib/native-types.js +2 -0
  214. package/dist/lib/native-types.js.map +1 -0
  215. package/dist/lib/option.d.ts +927 -0
  216. package/dist/lib/option.js +1583 -0
  217. package/dist/lib/option.js.map +1 -0
  218. package/dist/lib/output-format.d.ts +180 -0
  219. package/dist/lib/output-format.js +213 -0
  220. package/dist/lib/output-format.js.map +1 -0
  221. package/dist/lib/packet.d.ts +501 -0
  222. package/dist/lib/packet.js +590 -0
  223. package/dist/lib/packet.js.map +1 -0
  224. package/dist/lib/rational.d.ts +251 -0
  225. package/dist/lib/rational.js +278 -0
  226. package/dist/lib/rational.js.map +1 -0
  227. package/dist/lib/software-resample-context.d.ts +552 -0
  228. package/dist/lib/software-resample-context.js +592 -0
  229. package/dist/lib/software-resample-context.js.map +1 -0
  230. package/dist/lib/software-scale-context.d.ts +344 -0
  231. package/dist/lib/software-scale-context.js +366 -0
  232. package/dist/lib/software-scale-context.js.map +1 -0
  233. package/dist/lib/stream.d.ts +379 -0
  234. package/dist/lib/stream.js +526 -0
  235. package/dist/lib/stream.js.map +1 -0
  236. package/dist/lib/sync-queue.d.ts +179 -0
  237. package/dist/lib/sync-queue.js +197 -0
  238. package/dist/lib/sync-queue.js.map +1 -0
  239. package/dist/lib/types.d.ts +34 -0
  240. package/dist/lib/types.js +2 -0
  241. package/dist/lib/types.js.map +1 -0
  242. package/dist/lib/utilities.d.ts +1127 -0
  243. package/dist/lib/utilities.js +1225 -0
  244. package/dist/lib/utilities.js.map +1 -0
  245. package/dist/utils/electron.d.ts +49 -0
  246. package/dist/utils/electron.js +63 -0
  247. package/dist/utils/electron.js.map +1 -0
  248. package/dist/utils/index.d.ts +4 -0
  249. package/dist/utils/index.js +5 -0
  250. package/dist/utils/index.js.map +1 -0
  251. package/install/check.js +121 -0
  252. package/install/ffmpeg.js +66 -0
  253. package/jellyfin-ffmpeg.patch +181 -0
  254. package/package.json +129 -0
@@ -0,0 +1,641 @@
1
+ import { FilterContext } from './filter-context.js';
2
+ import { FilterGraphSegment } from './filter-graph-segment.js';
3
+ import { OptionMember } from './option.js';
4
+ import type { AVFilterCmdFlag, AVFilterConstants } from '../constants/constants.js';
5
+ import type { FilterInOut } from './filter-inout.js';
6
+ import type { Filter } from './filter.js';
7
+ import type { NativeFilterGraph, NativeWrapper } from './native-types.js';
8
+ /**
9
+ * Filter graph for audio/video processing pipelines.
10
+ *
11
+ * Manages a collection of interconnected filters forming a processing pipeline.
12
+ * Filters are connected through their input/output pads to create complex
13
+ * audio/video transformations. Supports both simple linear chains and complex
14
+ * graphs with multiple inputs/outputs. Essential for effects, format conversions,
15
+ * scaling, and other media processing operations.
16
+ *
17
+ * Direct mapping to FFmpeg's AVFilterGraph.
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { FilterGraph, Filter, FilterInOut, FFmpegError } from 'node-av';
22
+ *
23
+ * // Create and configure filter graph
24
+ * const graph = new FilterGraph();
25
+ * graph.alloc();
26
+ *
27
+ * // Create filters
28
+ * const bufferSrc = graph.createFilter(
29
+ * Filter.getByName('buffer')!,
30
+ * 'src',
31
+ * 'video_size=1920x1080:pix_fmt=yuv420p'
32
+ * );
33
+ *
34
+ * const scale = graph.createFilter(
35
+ * Filter.getByName('scale')!,
36
+ * 'scale',
37
+ * '640:480'
38
+ * );
39
+ *
40
+ * const bufferSink = graph.createFilter(
41
+ * Filter.getByName('buffersink')!,
42
+ * 'sink'
43
+ * );
44
+ *
45
+ * // Link filters
46
+ * bufferSrc.link(0, scale, 0);
47
+ * scale.link(0, bufferSink, 0);
48
+ *
49
+ * // Configure graph
50
+ * const ret = await graph.config();
51
+ * FFmpegError.throwIfError(ret, 'config');
52
+ *
53
+ * // Parse filter string
54
+ * const ret2 = graph.parse2('[in]scale=640:480[out]');
55
+ * FFmpegError.throwIfError(ret2, 'parse2');
56
+ * ```
57
+ *
58
+ * @see [AVFilterGraph](https://ffmpeg.org/doxygen/trunk/structAVFilterGraph.html) - FFmpeg Doxygen
59
+ * @see {@link FilterContext} For filter instances
60
+ * @see {@link Filter} For filter descriptors
61
+ */
62
+ export declare class FilterGraph extends OptionMember<NativeFilterGraph> implements Disposable, NativeWrapper<NativeFilterGraph> {
63
+ constructor();
64
+ /**
65
+ * Number of filters in the graph.
66
+ *
67
+ * Total count of filter contexts in this graph.
68
+ *
69
+ * Direct mapping to AVFilterGraph->nb_filters.
70
+ */
71
+ get nbFilters(): number;
72
+ /**
73
+ * Array of filters in the graph.
74
+ *
75
+ * All filter contexts currently in the graph.
76
+ *
77
+ * Direct mapping to AVFilterGraph->filters.
78
+ */
79
+ get filters(): FilterContext[] | null;
80
+ /**
81
+ * Threading type for graph execution.
82
+ *
83
+ * Controls how filters are executed in parallel.
84
+ * Use AVFILTER_THREAD_SLICE for slice-based threading.
85
+ *
86
+ * Direct mapping to AVFilterGraph->thread_type.
87
+ */
88
+ get threadType(): AVFilterConstants;
89
+ set threadType(value: AVFilterConstants);
90
+ /**
91
+ * Number of threads for parallel processing.
92
+ *
93
+ * Number of threads used for filter execution.
94
+ * 0 means automatic detection.
95
+ *
96
+ * Direct mapping to AVFilterGraph->nb_threads.
97
+ */
98
+ get nbThreads(): number;
99
+ set nbThreads(value: number);
100
+ /**
101
+ * Swscale options for scale filter.
102
+ *
103
+ * Options string passed to swscale for scaling operations.
104
+ *
105
+ * Direct mapping to AVFilterGraph->scale_sws_opts.
106
+ */
107
+ get scaleSwsOpts(): string | null;
108
+ set scaleSwsOpts(value: string | null);
109
+ /**
110
+ * Swresample options for aresample filter.
111
+ *
112
+ * Options string passed to swresample for audio resampling operations.
113
+ *
114
+ * Direct mapping to AVFilterGraph->aresample_swr_opts.
115
+ */
116
+ get aresampleSwrOpts(): string | null;
117
+ set aresampleSwrOpts(value: string | null);
118
+ /**
119
+ * Allocate a filter graph.
120
+ *
121
+ * Allocates memory for the filter graph structure.
122
+ * Must be called before using the graph.
123
+ *
124
+ * Direct mapping to avfilter_graph_alloc().
125
+ *
126
+ * @throws {Error} If allocation fails (ENOMEM)
127
+ *
128
+ * @example
129
+ * ```typescript
130
+ * const graph = new FilterGraph();
131
+ * graph.alloc();
132
+ * // Graph is now ready for filter creation
133
+ * ```
134
+ *
135
+ * @see {@link free} To deallocate
136
+ * @see {@link config} To configure after building
137
+ */
138
+ alloc(): void;
139
+ /**
140
+ * Free the filter graph.
141
+ *
142
+ * Releases all resources associated with the graph,
143
+ * including all contained filters.
144
+ *
145
+ * Direct mapping to avfilter_graph_free().
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * graph.free();
150
+ * // Graph is now invalid
151
+ * ```
152
+ *
153
+ * @see {@link alloc} To allocate
154
+ * @see {@link Symbol.dispose} For automatic cleanup
155
+ */
156
+ free(): void;
157
+ /**
158
+ * Create and initialize a filter in the graph.
159
+ *
160
+ * Creates a new filter context, adds it to the graph,
161
+ * and initializes it with the provided arguments.
162
+ *
163
+ * Direct mapping to avfilter_graph_create_filter().
164
+ *
165
+ * @param filter - Filter descriptor to instantiate
166
+ *
167
+ * @param name - Name for this filter instance
168
+ *
169
+ * @param args - Initialization arguments (filter-specific)
170
+ *
171
+ * @returns Created filter context, or null on failure
172
+ *
173
+ * @example
174
+ * ```typescript
175
+ * // Create a scale filter
176
+ * const scale = graph.createFilter(
177
+ * Filter.getByName('scale')!,
178
+ * 'scaler',
179
+ * '640:480' // width:height
180
+ * );
181
+ *
182
+ * // Create a buffer source
183
+ * const src = graph.createFilter(
184
+ * Filter.getByName('buffer')!,
185
+ * 'source',
186
+ * 'video_size=1920x1080:pix_fmt=yuv420p:time_base=1/25'
187
+ * );
188
+ * ```
189
+ *
190
+ * @see {@link allocFilter} To allocate without initializing
191
+ * @see {@link getFilter} To retrieve by name
192
+ */
193
+ createFilter(filter: Filter, name: string, args?: string | null): FilterContext | null;
194
+ /**
195
+ * Allocate a filter in the graph.
196
+ *
197
+ * Creates a new filter context and adds it to the graph,
198
+ * but does not initialize it. Call init() on the context afterwards.
199
+ *
200
+ * Direct mapping to avfilter_graph_alloc_filter().
201
+ *
202
+ * @param filter - Filter descriptor to instantiate
203
+ *
204
+ * @param name - Name for this filter instance
205
+ *
206
+ * @returns Allocated filter context, or null on failure
207
+ *
208
+ * @example
209
+ * ```typescript
210
+ * import { FFmpegError } from 'node-av';
211
+ *
212
+ * const filter = graph.allocFilter(
213
+ * Filter.getByName('scale')!,
214
+ * 'scaler'
215
+ * );
216
+ * if (filter) {
217
+ * // Initialize separately
218
+ * const ret = filter.initStr('640:480');
219
+ * FFmpegError.throwIfError(ret, 'initStr');
220
+ * }
221
+ * ```
222
+ *
223
+ * @see {@link createFilter} To allocate and initialize
224
+ */
225
+ allocFilter(filter: Filter, name: string): FilterContext | null;
226
+ /**
227
+ * Get a filter by name from the graph.
228
+ *
229
+ * Retrieves an existing filter context by its instance name.
230
+ *
231
+ * Direct mapping to avfilter_graph_get_filter().
232
+ *
233
+ * @param name - Name of the filter instance
234
+ *
235
+ * @returns Filter context if found, null otherwise
236
+ *
237
+ * @example
238
+ * ```typescript
239
+ * // Find a previously created filter
240
+ * const scaler = graph.getFilter('scaler');
241
+ * if (scaler) {
242
+ * console.log('Found scaler filter');
243
+ * }
244
+ * ```
245
+ *
246
+ * @see {@link createFilter} To create new filters
247
+ */
248
+ getFilter(name: string): FilterContext | null;
249
+ /**
250
+ * Configure the filter graph.
251
+ *
252
+ * Validates and finalizes the graph configuration.
253
+ * Must be called after all filters are created and linked.
254
+ *
255
+ * Direct mapping to avfilter_graph_config().
256
+ *
257
+ * @returns 0 on success, negative AVERROR on error:
258
+ * - AVERROR_EINVAL: Invalid graph configuration
259
+ * - AVERROR_ENOMEM: Memory allocation failure
260
+ *
261
+ * @example
262
+ * ```typescript
263
+ * import { FFmpegError } from 'node-av';
264
+ *
265
+ * // Build graph...
266
+ * // Link filters...
267
+ *
268
+ * // Configure the complete graph
269
+ * const ret = await graph.config();
270
+ * FFmpegError.throwIfError(ret, 'config');
271
+ * // Graph is now ready for processing
272
+ * ```
273
+ *
274
+ * @see {@link validate} To check configuration
275
+ */
276
+ config(): Promise<number>;
277
+ /**
278
+ * Configure the filter graph synchronously.
279
+ * Synchronous version of config.
280
+ *
281
+ * Validates and finalizes the graph structure after all filters
282
+ * have been added and connected. Must be called before processing.
283
+ *
284
+ * Direct mapping to avfilter_graph_config().
285
+ *
286
+ * @returns 0 on success, negative AVERROR on error:
287
+ * - AVERROR_EINVAL: Invalid graph structure
288
+ * - AVERROR_ENOMEM: Memory allocation failure
289
+ *
290
+ * @example
291
+ * ```typescript
292
+ * import { FFmpegError } from 'node-av';
293
+ *
294
+ * // Configure graph after building
295
+ * const ret = graph.configSync();
296
+ * FFmpegError.throwIfError(ret, 'configSync');
297
+ * // Graph is now ready for processing
298
+ * ```
299
+ *
300
+ * @see {@link config} For async version
301
+ */
302
+ configSync(): number;
303
+ /**
304
+ * Parse a filter graph description.
305
+ *
306
+ * Parses a textual representation of a filter graph and adds
307
+ * filters to this graph. Handles labeled inputs and outputs.
308
+ *
309
+ * Direct mapping to avfilter_graph_parse().
310
+ *
311
+ * @param filters - Filter graph description string
312
+ *
313
+ * @param inputs - Linked list of graph inputs
314
+ *
315
+ * @param outputs - Linked list of graph outputs
316
+ *
317
+ * @returns 0 on success, negative AVERROR on error:
318
+ * - AVERROR_EINVAL: Parse error
319
+ * - AVERROR_ENOMEM: Memory allocation failure
320
+ *
321
+ * @example
322
+ * ```typescript
323
+ * import { FFmpegError, FilterInOut } from 'node-av';
324
+ *
325
+ * const inputs = FilterInOut.createList([
326
+ * { name: 'in', filterCtx: bufferSrc, padIdx: 0 }
327
+ * ]);
328
+ * const outputs = FilterInOut.createList([
329
+ * { name: 'out', filterCtx: bufferSink, padIdx: 0 }
330
+ * ]);
331
+ *
332
+ * const ret = graph.parse(
333
+ * '[in]scale=640:480,format=yuv420p[out]',
334
+ * inputs,
335
+ * outputs
336
+ * );
337
+ * FFmpegError.throwIfError(ret, 'parse');
338
+ * ```
339
+ *
340
+ * @see {@link parse2} For simpler syntax
341
+ * @see {@link parsePtr} For alternative parsing
342
+ */
343
+ parse(filters: string, inputs: FilterInOut | null, outputs: FilterInOut | null): number;
344
+ /**
345
+ * Parse a filter graph description (simplified).
346
+ *
347
+ * Parses a textual filter description with automatic input/output handling.
348
+ * Simpler than parse() but less flexible.
349
+ *
350
+ * Direct mapping to avfilter_graph_parse2().
351
+ *
352
+ * @param filters - Filter graph description string
353
+ *
354
+ * @returns 0 on success, negative AVERROR on error:
355
+ * - AVERROR_EINVAL: Parse error
356
+ * - AVERROR_ENOMEM: Memory allocation failure
357
+ *
358
+ * @example
359
+ * ```typescript
360
+ * import { FFmpegError } from 'node-av';
361
+ *
362
+ * // Parse a simple filter chain
363
+ * const ret = graph.parse2(
364
+ * 'scale=640:480,format=yuv420p'
365
+ * );
366
+ * FFmpegError.throwIfError(ret, 'parse2');
367
+ * ```
368
+ *
369
+ * @see {@link parse} For labeled inputs/outputs
370
+ */
371
+ parse2(filters: string): number;
372
+ /**
373
+ * Parse a filter graph description with pointer.
374
+ *
375
+ * Alternative parsing method with different parameter handling.
376
+ *
377
+ * Direct mapping to avfilter_graph_parse_ptr().
378
+ *
379
+ * @param filters - Filter graph description string
380
+ *
381
+ * @param inputs - Optional linked list of inputs
382
+ *
383
+ * @param outputs - Optional linked list of outputs
384
+ *
385
+ * @returns 0 on success, negative AVERROR on error:
386
+ * - AVERROR_EINVAL: Parse error
387
+ * - AVERROR_ENOMEM: Memory allocation failure
388
+ *
389
+ * @example
390
+ * ```typescript
391
+ * import { FFmpegError } from 'node-av';
392
+ *
393
+ * const ret = graph.parsePtr(
394
+ * '[in]scale=w=640:h=480[out]'
395
+ * );
396
+ * FFmpegError.throwIfError(ret, 'parsePtr');
397
+ * ```
398
+ *
399
+ * @see {@link parse} For standard parsing
400
+ * @see {@link parse2} For simplified parsing
401
+ */
402
+ parsePtr(filters: string, inputs?: FilterInOut | null, outputs?: FilterInOut | null): number;
403
+ /**
404
+ * Parse a filter graph into a segment.
405
+ *
406
+ * Parses a textual filter description and returns a segment object.
407
+ * The segment separates parsing from initialization, allowing filter
408
+ * contexts to be configured before initialization.
409
+ *
410
+ * Direct mapping to avfilter_graph_segment_parse().
411
+ *
412
+ * @param filters - Filter graph description string
413
+ *
414
+ * @param flags - Parsing flags (default: 0)
415
+ *
416
+ * @returns FilterGraphSegment instance or null on error
417
+ *
418
+ * @example
419
+ * ```typescript
420
+ * import { FFmpegError } from 'node-av';
421
+ *
422
+ * const segment = graph.segmentParse('scale=640:480');
423
+ * if (!segment) {
424
+ * throw new Error('Failed to parse filter');
425
+ * }
426
+ *
427
+ * // Create and configure filters
428
+ * FFmpegError.throwIfError(segment.createFilters(), 'createFilters');
429
+ * FFmpegError.throwIfError(segment.applyOpts(), 'applyOpts');
430
+ * FFmpegError.throwIfError(segment.apply(inputs, outputs), 'apply');
431
+ *
432
+ * segment.free();
433
+ * ```
434
+ *
435
+ * @see {@link FilterGraphSegment} For segment operations
436
+ * @see {@link parse} For standard parsing
437
+ */
438
+ segmentParse(filters: string, flags?: number): FilterGraphSegment | null;
439
+ /**
440
+ * Validate the filter graph configuration.
441
+ *
442
+ * Checks if the graph is valid and properly configured.
443
+ * Does not finalize the graph like config() does.
444
+ *
445
+ * @returns 0 on success, negative AVERROR on error:
446
+ * - AVERROR_EINVAL: Invalid configuration
447
+ *
448
+ * @example
449
+ * ```typescript
450
+ * import { FFmpegError } from 'node-av';
451
+ *
452
+ * const ret = graph.validate();
453
+ * FFmpegError.throwIfError(ret, 'validate');
454
+ * ```
455
+ *
456
+ * @see {@link config} To configure and finalize
457
+ */
458
+ validate(): number;
459
+ /**
460
+ * Request a frame from the oldest sink.
461
+ *
462
+ * Requests that a frame be output from the oldest sink in the graph.
463
+ * Used to drive the filter graph processing.
464
+ *
465
+ * Direct mapping to avfilter_graph_request_oldest().
466
+ *
467
+ * @returns 0 on success, negative AVERROR on error:
468
+ * - AVERROR_EOF: End of stream reached
469
+ * - AVERROR_EAGAIN: Need more input
470
+ *
471
+ * @example
472
+ * ```typescript
473
+ * import { FFmpegError } from 'node-av';
474
+ * import { AVERROR_EOF, AVERROR_EAGAIN } from 'node-av/constants';
475
+ *
476
+ * const ret = await graph.requestOldest();
477
+ * if (ret === AVERROR_EOF) {
478
+ * // No more frames
479
+ * } else if (ret === AVERROR_EAGAIN) {
480
+ * // Need to provide more input
481
+ * } else {
482
+ * FFmpegError.throwIfError(ret, 'requestOldest');
483
+ * }
484
+ * ```
485
+ */
486
+ requestOldest(): Promise<number>;
487
+ /**
488
+ * Request the oldest queued frame from filters synchronously.
489
+ * Synchronous version of requestOldest.
490
+ *
491
+ * Requests a frame from the oldest sink in the graph.
492
+ * Used for pulling frames through the filter pipeline.
493
+ *
494
+ * Direct mapping to avfilter_graph_request_oldest().
495
+ *
496
+ * @returns 0 on success, negative AVERROR on error:
497
+ * - AVERROR_EOF: No more frames
498
+ * - AVERROR_EAGAIN: Need more input
499
+ *
500
+ * @example
501
+ * ```typescript
502
+ * import { FFmpegError } from 'node-av';
503
+ * import { AVERROR_EOF, AVERROR_EAGAIN } from 'node-av/constants';
504
+ *
505
+ * // Pull frames through the graph
506
+ * const ret = graph.requestOldestSync();
507
+ * if (ret === AVERROR_EOF) {
508
+ * // All frames processed
509
+ * } else if (ret === AVERROR_EAGAIN) {
510
+ * // Need more input frames
511
+ * } else {
512
+ * FFmpegError.throwIfError(ret, 'requestOldestSync');
513
+ * }
514
+ * ```
515
+ *
516
+ * @see {@link requestOldest} For async version
517
+ */
518
+ requestOldestSync(): number;
519
+ /**
520
+ * Dump the filter graph to a string.
521
+ *
522
+ * Returns a textual representation of the graph structure.
523
+ * Useful for debugging and visualization.
524
+ *
525
+ * Direct mapping to avfilter_graph_dump().
526
+ *
527
+ * @returns Graph description string, or null on failure
528
+ *
529
+ * @example
530
+ * ```typescript
531
+ * const graphStr = graph.dump();
532
+ * if (graphStr) {
533
+ * console.log('Graph structure:');
534
+ * console.log(graphStr);
535
+ * }
536
+ * ```
537
+ */
538
+ dump(): string | null;
539
+ /**
540
+ * Send a command to filters in the graph.
541
+ *
542
+ * Sends a command to one or more filters for immediate execution.
543
+ * Target can be a specific filter name or "all" for all filters.
544
+ *
545
+ * Direct mapping to avfilter_graph_send_command().
546
+ *
547
+ * @param target - Filter name or "all"
548
+ *
549
+ * @param cmd - Command to send
550
+ *
551
+ * @param arg - Command argument
552
+ *
553
+ * @param flags - Command flags
554
+ *
555
+ * @returns Error code or response object
556
+ *
557
+ * @example
558
+ * ```typescript
559
+ * // Send command to specific filter
560
+ * const result = graph.sendCommand(
561
+ * 'volume',
562
+ * 'volume',
563
+ * '0.5'
564
+ * );
565
+ *
566
+ * // Send to all filters
567
+ * const result2 = graph.sendCommand(
568
+ * 'all',
569
+ * 'enable',
570
+ * 'timeline'
571
+ * );
572
+ * ```
573
+ *
574
+ * @see {@link queueCommand} For delayed execution
575
+ */
576
+ sendCommand(target: string, cmd: string, arg: string, flags?: AVFilterCmdFlag): number | {
577
+ response: string | null;
578
+ };
579
+ /**
580
+ * Queue a command for delayed execution.
581
+ *
582
+ * Schedules a command to be executed at a specific timestamp.
583
+ * The command is executed when the filter processes a frame with that timestamp.
584
+ *
585
+ * Direct mapping to avfilter_graph_queue_command().
586
+ *
587
+ * @param target - Filter name or "all"
588
+ *
589
+ * @param cmd - Command to queue
590
+ *
591
+ * @param arg - Command argument
592
+ *
593
+ * @param ts - Timestamp for execution
594
+ *
595
+ * @param flags - Command flags
596
+ *
597
+ * @returns 0 on success, negative AVERROR on error
598
+ *
599
+ * @example
600
+ * ```typescript
601
+ * import { FFmpegError } from 'node-av';
602
+ *
603
+ * // Queue volume change at 5 seconds
604
+ * const ret = graph.queueCommand(
605
+ * 'volume',
606
+ * 'volume',
607
+ * '0.2',
608
+ * 5000000, // microseconds
609
+ * 0
610
+ * );
611
+ * FFmpegError.throwIfError(ret, 'queueCommand');
612
+ * ```
613
+ *
614
+ * @see {@link sendCommand} For immediate execution
615
+ */
616
+ queueCommand(target: string, cmd: string, arg: string, ts: number, flags?: AVFilterCmdFlag): number;
617
+ /**
618
+ * Get the underlying native FilterGraph object.
619
+ *
620
+ * @returns The native FilterGraph binding object
621
+ *
622
+ * @internal
623
+ */
624
+ getNative(): NativeFilterGraph;
625
+ /**
626
+ * Dispose of the filter graph.
627
+ *
628
+ * Implements the Disposable interface for automatic cleanup.
629
+ * Equivalent to calling free().
630
+ *
631
+ * @example
632
+ * ```typescript
633
+ * {
634
+ * using graph = new FilterGraph();
635
+ * graph.alloc();
636
+ * // Build and use graph...
637
+ * } // Automatically freed when leaving scope
638
+ * ```
639
+ */
640
+ [Symbol.dispose](): void;
641
+ }