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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=native-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-types.js","sourceRoot":"","sources":["../../src/lib/native-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,589 @@
1
+ /**
2
+ * Option - FFmpeg AVOption System Bindings
3
+ *
4
+ * Provides low-level access to FFmpeg's AVOption API for getting and setting
5
+ * options on various FFmpeg objects (CodecContext, FormatContext, FilterContext, etc).
6
+ *
7
+ * The AVOption API is FFmpeg's unified system for runtime configuration,
8
+ * allowing type-safe access to object properties with validation.
9
+ *
10
+ * @module lib/option
11
+ */
12
+ import { Dictionary } from './dictionary.js';
13
+ import type { OptionCapableObject } from './binding.js';
14
+ import type { AVOptionFlag, AVOptionSearchFlags, AVOptionType, AVOptionTypeBinary, AVOptionTypeBinaryIntArray, AVOptionTypeBool, AVOptionTypeChLayout, AVOptionTypeColor, AVOptionTypeConst, AVOptionTypeDict, AVOptionTypeDouble, AVOptionTypeDuration, AVOptionTypeFlags, AVOptionTypeFloat, AVOptionTypeImageSize, AVOptionTypeInt, AVOptionTypeInt64, AVOptionTypePixelFmt, AVOptionTypeRational, AVOptionTypeSampleFmt, AVOptionTypeString, AVOptionTypeUint, AVOptionTypeUint64, AVOptionTypeVideoRate, AVPixelFormat, AVSampleFormat } from './constants.js';
15
+ import type { NativeOption } from './native-types.js';
16
+ import type { ChannelLayout, IRational } from './types.js';
17
+ /**
18
+ * Low-level wrapper for a single AVOption.
19
+ *
20
+ * Provides metadata about an option including its name, type, range, and default value.
21
+ * Options are not created directly but retrieved through Option.next() or Option.find().
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const opt = Option.find(codecContext, 'bitrate');
26
+ * if (opt) {
27
+ * console.log(`Option ${opt.name}: ${opt.help}`);
28
+ * console.log(`Type: ${opt.type}, Default: ${opt.defaultValue}`);
29
+ * }
30
+ * ```
31
+ */
32
+ export declare class OptionInfo {
33
+ private native;
34
+ /** @internal */
35
+ constructor(native: NativeOption);
36
+ /**
37
+ * Option name.
38
+ *
39
+ * The key used to get/set this option.
40
+ */
41
+ get name(): string | null;
42
+ /**
43
+ * Option help text.
44
+ *
45
+ * Human-readable description of the option.
46
+ */
47
+ get help(): string | null;
48
+ /**
49
+ * Option type.
50
+ *
51
+ * Determines the data type and valid range of values.
52
+ */
53
+ get type(): AVOptionType;
54
+ /**
55
+ * Default value.
56
+ *
57
+ * The value used if not explicitly set.
58
+ * Type depends on the option type.
59
+ */
60
+ get defaultValue(): unknown;
61
+ /**
62
+ * Minimum value.
63
+ *
64
+ * For numeric types, the minimum allowed value.
65
+ */
66
+ get min(): number;
67
+ /**
68
+ * Maximum value.
69
+ *
70
+ * For numeric types, the maximum allowed value.
71
+ */
72
+ get max(): number;
73
+ /**
74
+ * Option flags.
75
+ *
76
+ * Bitfield of AV_OPT_FLAG_* values indicating option properties.
77
+ */
78
+ get flags(): AVOptionFlag;
79
+ /**
80
+ * Option unit.
81
+ *
82
+ * For options that are part of a named group.
83
+ */
84
+ get unit(): string | null;
85
+ /**
86
+ * Get the native FFmpeg AVOption pointer.
87
+ *
88
+ * @internal For use by other wrapper classes
89
+ * @returns The underlying native option object
90
+ */
91
+ getNative(): NativeOption;
92
+ }
93
+ /**
94
+ * Low-level FFmpeg AVOption API.
95
+ *
96
+ * Provides static methods for accessing and modifying options on FFmpeg objects.
97
+ * All methods work with native objects from the low-level API.
98
+ *
99
+ * Uses av_opt_* functions internally.
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * // Set codec bitrate
104
+ * Option.setInt(codecContext, 'b', 2000000);
105
+ *
106
+ * // Get current bitrate
107
+ * const bitrate = Option.getInt(codecContext, 'b');
108
+ *
109
+ * // Iterate through all options
110
+ * let opt = null;
111
+ * while ((opt = Option.next(codecContext, opt))) {
112
+ * console.log(`${opt.name}: ${opt.help}`);
113
+ * }
114
+ * ```
115
+ */
116
+ export declare class Option {
117
+ private constructor();
118
+ /**
119
+ * Iterate through options of an object.
120
+ *
121
+ * Uses av_opt_next() internally.
122
+ *
123
+ * @param obj - Native object (CodecContext, FormatContext, FilterContext, etc.)
124
+ * @param prev - Previous option for iteration, or null to start
125
+ *
126
+ * @returns Next option or null when done
127
+ *
128
+ * @example
129
+ * ```typescript
130
+ * let opt = null;
131
+ * while ((opt = Option.next(codecContext, opt))) {
132
+ * console.log(`${opt.name}: ${opt.help}`);
133
+ * }
134
+ * ```
135
+ */
136
+ static next(obj: OptionCapableObject, prev?: OptionInfo | null): OptionInfo | null;
137
+ /**
138
+ * Find an option by name.
139
+ *
140
+ * Uses av_opt_find() internally.
141
+ *
142
+ * @param obj - Native object
143
+ * @param name - Option name to find
144
+ * @param searchFlags - Search flags (default: 0)
145
+ *
146
+ * @returns Found option or null
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * const opt = Option.find(codecContext, 'bitrate');
151
+ * if (opt) {
152
+ * console.log(`Found option: ${opt.name}`);
153
+ * }
154
+ * ```
155
+ */
156
+ static find(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): OptionInfo | null;
157
+ /**
158
+ * Find an option by name with target object information.
159
+ *
160
+ * Uses av_opt_find2() internally.
161
+ *
162
+ * @param obj - Native object
163
+ * @param name - Option name to find
164
+ * @param searchFlags - Search flags (default: 0)
165
+ *
166
+ * @returns Object with option and whether target differs, or null
167
+ */
168
+ static find2(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): {
169
+ option: OptionInfo | null;
170
+ isDifferentTarget: boolean;
171
+ } | null;
172
+ /**
173
+ * Get option value as string.
174
+ *
175
+ * Uses av_opt_get() internally.
176
+ * Converts any option type to its string representation.
177
+ *
178
+ * @param obj - Native object
179
+ * @param name - Option name
180
+ * @param searchFlags - Search flags (default: 0)
181
+ *
182
+ * @returns Value string on success, null if option not found or on error
183
+ */
184
+ static get(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): string | null;
185
+ /**
186
+ * Get option value as integer.
187
+ *
188
+ * Uses av_opt_get_int() internally.
189
+ * Option must be of integer type.
190
+ *
191
+ * @param obj - Native object
192
+ * @param name - Option name
193
+ * @param searchFlags - Search flags (default: 0)
194
+ *
195
+ * @returns Integer value on success, null if option not found or on error
196
+ */
197
+ static getInt(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): number | null;
198
+ /**
199
+ * Get option value as double.
200
+ *
201
+ * Uses av_opt_get_double() internally.
202
+ * Option must be of double/float type.
203
+ *
204
+ * @param obj - Native object
205
+ * @param name - Option name
206
+ * @param searchFlags - Search flags (default: 0)
207
+ *
208
+ * @returns Double value on success, null if option not found or on error
209
+ */
210
+ static getDouble(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): number | null;
211
+ /**
212
+ * Get option value as rational.
213
+ *
214
+ * Uses av_opt_get_q() internally.
215
+ * Option must be of rational type.
216
+ *
217
+ * @param obj - Native object
218
+ * @param name - Option name
219
+ * @param searchFlags - Search flags (default: 0)
220
+ *
221
+ * @returns Rational object {num, den} on success, null if option not found or on error
222
+ */
223
+ static getRational(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): IRational | null;
224
+ /**
225
+ * Get option value as pixel format.
226
+ *
227
+ * Uses av_opt_get_pixel_fmt() internally.
228
+ * Option must be of pixel format type.
229
+ *
230
+ * @param obj - Native object
231
+ * @param name - Option name
232
+ * @param searchFlags - Search flags (default: 0)
233
+ *
234
+ * @returns AVPixelFormat enum value on success, null if option not found or on error
235
+ */
236
+ static getPixelFormat(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): AVPixelFormat | null;
237
+ /**
238
+ * Get option value as sample format.
239
+ *
240
+ * Uses av_opt_get_sample_fmt() internally.
241
+ * Option must be of sample format type.
242
+ *
243
+ * @param obj - Native object
244
+ * @param name - Option name
245
+ * @param searchFlags - Search flags (default: 0)
246
+ *
247
+ * @returns AVSampleFormat enum value on success, null if option not found or on error
248
+ */
249
+ static getSampleFormat(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): AVSampleFormat | null;
250
+ /**
251
+ * Get option value as image size.
252
+ *
253
+ * Uses av_opt_get_image_size() internally.
254
+ * Option must be of image size type.
255
+ *
256
+ * @param obj - Native object
257
+ * @param name - Option name
258
+ * @param searchFlags - Search flags (default: 0)
259
+ *
260
+ * @returns Size object {width, height} on success, null if option not found or on error
261
+ */
262
+ static getImageSize(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): {
263
+ width: number;
264
+ height: number;
265
+ } | null;
266
+ /**
267
+ * Get option value as channel layout.
268
+ *
269
+ * Uses av_opt_get_chlayout() internally.
270
+ * Option must be of channel layout type.
271
+ *
272
+ * @param obj - Native object
273
+ * @param name - Option name
274
+ * @param searchFlags - Search flags (default: 0)
275
+ *
276
+ * @returns ChannelLayout object on success, null if option not found or on error
277
+ */
278
+ static getChannelLayout(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): ChannelLayout | null;
279
+ /**
280
+ * Get option value as dictionary.
281
+ *
282
+ * Uses av_opt_get_dict_val() internally.
283
+ * Option must be of dictionary type.
284
+ *
285
+ * @param obj - Native object
286
+ * @param name - Option name
287
+ * @param searchFlags - Search flags (default: 0)
288
+ *
289
+ * @returns Dictionary object on success, null if option not found or on error
290
+ */
291
+ static getDict(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): Dictionary | null;
292
+ /**
293
+ * Set option value from string.
294
+ *
295
+ * Uses av_opt_set() internally.
296
+ * Can be used for any option type - FFmpeg will parse the string.
297
+ *
298
+ * @param obj - Native object
299
+ * @param name - Option name
300
+ * @param value - String value to set
301
+ * @param searchFlags - Search flags (default: 0)
302
+ *
303
+ * @returns 0 on success, negative AVERROR code on failure
304
+ */
305
+ static set(obj: OptionCapableObject, name: string, value: string, searchFlags?: AVOptionSearchFlags): number;
306
+ /**
307
+ * Set option value as integer.
308
+ *
309
+ * Uses av_opt_set_int() internally.
310
+ * More efficient than set() for numeric options.
311
+ *
312
+ * @param obj - Native object
313
+ * @param name - Option name
314
+ * @param value - Number or BigInt value to set
315
+ * @param searchFlags - Search flags (default: 0)
316
+ *
317
+ * @returns 0 on success, negative AVERROR code on failure
318
+ */
319
+ static setInt(obj: OptionCapableObject, name: string, value: number | bigint, searchFlags?: AVOptionSearchFlags): number;
320
+ /**
321
+ * Set option value as double.
322
+ *
323
+ * Uses av_opt_set_double() internally.
324
+ * More efficient than set() for floating point options.
325
+ *
326
+ * @param obj - Native object
327
+ * @param name - Option name
328
+ * @param value - Double value to set
329
+ * @param searchFlags - Search flags (default: 0)
330
+ *
331
+ * @returns 0 on success, negative AVERROR code on failure
332
+ */
333
+ static setDouble(obj: OptionCapableObject, name: string, value: number, searchFlags?: AVOptionSearchFlags): number;
334
+ /**
335
+ * Set option value as rational.
336
+ *
337
+ * Uses av_opt_set_q() internally.
338
+ * For framerates, aspect ratios, time bases, etc.
339
+ *
340
+ * @param obj - Native object
341
+ * @param name - Option name
342
+ * @param value - Rational object {num, den} to set
343
+ * @param searchFlags - Search flags (default: 0)
344
+ *
345
+ * @returns 0 on success, negative AVERROR code on failure
346
+ */
347
+ static setRational(obj: OptionCapableObject, name: string, value: IRational, searchFlags?: AVOptionSearchFlags): number;
348
+ /**
349
+ * Set option value as pixel format.
350
+ *
351
+ * Uses av_opt_set_pixel_fmt() internally.
352
+ * More type-safe than using set() with string names.
353
+ *
354
+ * @param obj - Native object
355
+ * @param name - Option name
356
+ * @param value - AVPixelFormat enum value
357
+ * @param searchFlags - Search flags (default: 0)
358
+ *
359
+ * @returns 0 on success, negative AVERROR code on failure
360
+ */
361
+ static setPixelFormat(obj: OptionCapableObject, name: string, value: AVPixelFormat, searchFlags?: AVOptionSearchFlags): number;
362
+ /**
363
+ * Set option value as sample format.
364
+ *
365
+ * Uses av_opt_set_sample_fmt() internally.
366
+ * More type-safe than using set() with string names.
367
+ *
368
+ * @param obj - Native object
369
+ * @param name - Option name
370
+ * @param value - AVSampleFormat enum value
371
+ * @param searchFlags - Search flags (default: 0)
372
+ *
373
+ * @returns 0 on success, negative AVERROR code on failure
374
+ */
375
+ static setSampleFormat(obj: OptionCapableObject, name: string, value: AVSampleFormat, searchFlags?: AVOptionSearchFlags): number;
376
+ /**
377
+ * Set option value as image size.
378
+ *
379
+ * Uses av_opt_set_image_size() internally.
380
+ * Convenient for setting width and height together.
381
+ *
382
+ * @param obj - Native object
383
+ * @param name - Option name
384
+ * @param width - Width in pixels
385
+ * @param height - Height in pixels
386
+ * @param searchFlags - Search flags (default: 0)
387
+ *
388
+ * @returns 0 on success, negative AVERROR code on failure
389
+ */
390
+ static setImageSize(obj: OptionCapableObject, name: string, width: number, height: number, searchFlags?: AVOptionSearchFlags): number;
391
+ /**
392
+ * Set option value as channel layout.
393
+ *
394
+ * Uses av_opt_set_chlayout() internally.
395
+ * For audio channel configuration.
396
+ *
397
+ * @param obj - Native object
398
+ * @param name - Option name
399
+ * @param value - Channel layout mask (e.g., AV_CH_LAYOUT_STEREO)
400
+ * @param searchFlags - Search flags (default: 0)
401
+ *
402
+ * @returns 0 on success, negative AVERROR code on failure
403
+ */
404
+ static setChannelLayout(obj: OptionCapableObject, name: string, value: number, searchFlags?: AVOptionSearchFlags): number;
405
+ /**
406
+ * Set option value as dictionary.
407
+ *
408
+ * Uses av_opt_set_dict_val() internally.
409
+ * For options that accept key-value pairs.
410
+ *
411
+ * @param obj - Native object
412
+ * @param name - Option name
413
+ * @param value - Dictionary object
414
+ * @param searchFlags - Search flags (default: 0)
415
+ *
416
+ * @returns 0 on success, negative AVERROR code on failure
417
+ */
418
+ static setDict(obj: OptionCapableObject, name: string, value: Dictionary, searchFlags?: AVOptionSearchFlags): number;
419
+ /**
420
+ * Set option value as binary data.
421
+ *
422
+ * Uses av_opt_set_bin() internally.
423
+ * For options that accept raw binary data.
424
+ *
425
+ * @param obj - Native object
426
+ * @param name - Option name
427
+ * @param value - Binary data as Buffer
428
+ * @param searchFlags - Search flags (default: 0)
429
+ *
430
+ * @returns 0 on success, negative AVERROR code on failure
431
+ */
432
+ static setBin(obj: OptionCapableObject, name: string, value: Buffer, searchFlags?: AVOptionSearchFlags): number;
433
+ /**
434
+ * Set all options to their default values.
435
+ *
436
+ * Uses av_opt_set_defaults() internally.
437
+ *
438
+ * @param obj - Native object
439
+ */
440
+ static setDefaults(obj: OptionCapableObject): void;
441
+ /**
442
+ * Copy options from source to destination.
443
+ *
444
+ * Uses av_opt_copy() internally.
445
+ * Copies all option values from one object to another.
446
+ *
447
+ * @param dest - Destination object
448
+ * @param src - Source object
449
+ *
450
+ * @returns 0 on success, negative AVERROR code on failure
451
+ */
452
+ static copy(dest: OptionCapableObject, src: OptionCapableObject): number;
453
+ /**
454
+ * Check if option is set to its default value.
455
+ *
456
+ * Uses av_opt_is_set_to_default_by_name() internally.
457
+ *
458
+ * @param obj - Native object
459
+ * @param name - Option name
460
+ * @param searchFlags - Search flags (default: 0)
461
+ *
462
+ * @returns true if set to default, false if not, null if option not found or on error
463
+ */
464
+ static isSetToDefault(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): boolean | null;
465
+ /**
466
+ * Serialize options to string.
467
+ *
468
+ * Uses av_opt_serialize() internally.
469
+ * Converts all non-default options to a string representation.
470
+ *
471
+ * @param obj - Native object
472
+ * @param optFlags - Option flags to include (default: 0)
473
+ * @param flags - Serialization flags (default: 0)
474
+ * @param keyValSep - Key-value separator (default: '=')
475
+ * @param pairsSep - Pairs separator (default: ',')
476
+ *
477
+ * @returns Serialized string on success, null on error or if no options to serialize
478
+ */
479
+ static serialize(obj: OptionCapableObject, optFlags?: number, flags?: number, keyValSep?: string, pairsSep?: string): string | null;
480
+ /**
481
+ * Free options of an object.
482
+ *
483
+ * Uses av_opt_free() internally.
484
+ *
485
+ * @param obj - Native object
486
+ */
487
+ static free(obj: OptionCapableObject): void;
488
+ /**
489
+ * Show options to stderr for debugging.
490
+ *
491
+ * Uses av_opt_show2() internally.
492
+ * Prints all available options to stderr.
493
+ *
494
+ * @param obj - Native object
495
+ * @param reqFlags - Required flags (default: 0)
496
+ * @param rejFlags - Rejected flags (default: 0)
497
+ *
498
+ * @returns 0 on success, negative AVERROR code on failure
499
+ */
500
+ static show(obj: OptionCapableObject, reqFlags?: number, rejFlags?: number): number;
501
+ }
502
+ /**
503
+ * Base class for FFmpeg objects that support AVOptions.
504
+ *
505
+ * Provides a common interface for getting, setting, and listing options
506
+ * on FFmpeg objects that have an AVClass structure. This includes codecs,
507
+ * formats, filters, and various processing contexts.
508
+ *
509
+ * Classes that support AVOptions should extend this class to inherit
510
+ * the option management functionality.
511
+ *
512
+ * @template T - The native FFmpeg object type that supports AVOptions
513
+ *
514
+ * @example
515
+ * ```typescript
516
+ * class CodecContext extends OptionMember<NativeCodecContext> {
517
+ * // Inherits setOption, getOption, listOptions
518
+ * }
519
+ * ```
520
+ */
521
+ export declare class OptionMember<T extends OptionCapableObject> {
522
+ protected native: T;
523
+ constructor(native: T);
524
+ setOption(name: string, value: string, type?: AVOptionTypeString, searchFlags?: AVOptionSearchFlags): number;
525
+ setOption(name: string, value: string, type: AVOptionTypeColor, searchFlags?: AVOptionSearchFlags): number;
526
+ setOption(name: string, value: number, type: AVOptionTypeInt, searchFlags?: AVOptionSearchFlags): number;
527
+ setOption(name: string, value: bigint, type: AVOptionTypeInt64, searchFlags?: AVOptionSearchFlags): number;
528
+ setOption(name: string, value: number, type: AVOptionTypeUint, searchFlags?: AVOptionSearchFlags): number;
529
+ setOption(name: string, value: bigint, type: AVOptionTypeUint64, searchFlags?: AVOptionSearchFlags): number;
530
+ setOption(name: string, value: number, type: AVOptionTypeFlags, searchFlags?: AVOptionSearchFlags): number;
531
+ setOption(name: string, value: boolean, type: AVOptionTypeBool, searchFlags?: AVOptionSearchFlags): number;
532
+ setOption(name: string, value: number, type: AVOptionTypeDuration, searchFlags?: AVOptionSearchFlags): number;
533
+ setOption(name: string, value: number, type: AVOptionTypeConst, searchFlags?: AVOptionSearchFlags): number;
534
+ setOption(name: string, value: number, type: AVOptionTypeDouble, searchFlags?: AVOptionSearchFlags): number;
535
+ setOption(name: string, value: number, type: AVOptionTypeFloat, searchFlags?: AVOptionSearchFlags): number;
536
+ setOption(name: string, value: IRational, type: AVOptionTypeRational, searchFlags?: AVOptionSearchFlags): number;
537
+ setOption(name: string, value: IRational, type: AVOptionTypeVideoRate, searchFlags?: AVOptionSearchFlags): number;
538
+ setOption(name: string, value: AVPixelFormat, type: AVOptionTypePixelFmt, searchFlags?: AVOptionSearchFlags): number;
539
+ setOption(name: string, value: AVSampleFormat, type: AVOptionTypeSampleFmt, searchFlags?: AVOptionSearchFlags): number;
540
+ setOption(name: string, value: {
541
+ width: number;
542
+ height: number;
543
+ }, type: AVOptionTypeImageSize, searchFlags?: AVOptionSearchFlags): number;
544
+ setOption(name: string, value: number | bigint, type: AVOptionTypeChLayout, searchFlags?: AVOptionSearchFlags): number;
545
+ setOption(name: string, value: Buffer, type: AVOptionTypeBinary, searchFlags?: AVOptionSearchFlags): number;
546
+ setOption(name: string, value: number[], type: AVOptionTypeBinaryIntArray, searchFlags?: AVOptionSearchFlags): number;
547
+ setOption(name: string, value: Dictionary, type: AVOptionTypeDict, searchFlags?: AVOptionSearchFlags): number;
548
+ getOption(name: string, type?: AVOptionTypeString, searchFlags?: AVOptionSearchFlags): string | null;
549
+ getOption(name: string, type: AVOptionTypeColor, searchFlags?: AVOptionSearchFlags): string | null;
550
+ getOption(name: string, type: AVOptionTypeInt, searchFlags?: AVOptionSearchFlags): number | null;
551
+ getOption(name: string, type: AVOptionTypeInt64, searchFlags?: AVOptionSearchFlags): bigint | null;
552
+ getOption(name: string, type: AVOptionTypeUint, searchFlags?: AVOptionSearchFlags): number | null;
553
+ getOption(name: string, type: AVOptionTypeUint64, searchFlags?: AVOptionSearchFlags): bigint | null;
554
+ getOption(name: string, type: AVOptionTypeFlags, searchFlags?: AVOptionSearchFlags): number | null;
555
+ getOption(name: string, type: AVOptionTypeBool, searchFlags?: AVOptionSearchFlags): boolean | null;
556
+ getOption(name: string, type: AVOptionTypeDuration, searchFlags?: AVOptionSearchFlags): number | null;
557
+ getOption(name: string, type: AVOptionTypeConst, searchFlags?: AVOptionSearchFlags): number | null;
558
+ getOption(name: string, type: AVOptionTypeDouble, searchFlags?: AVOptionSearchFlags): number | null;
559
+ getOption(name: string, type: AVOptionTypeFloat, searchFlags?: AVOptionSearchFlags): number | null;
560
+ getOption(name: string, type: AVOptionTypeRational, searchFlags?: AVOptionSearchFlags): IRational | null;
561
+ getOption(name: string, type: AVOptionTypeVideoRate, searchFlags?: AVOptionSearchFlags): IRational | null;
562
+ getOption(name: string, type: AVOptionTypePixelFmt, searchFlags?: AVOptionSearchFlags): AVPixelFormat | null;
563
+ getOption(name: string, type: AVOptionTypeSampleFmt, searchFlags?: AVOptionSearchFlags): AVSampleFormat | null;
564
+ getOption(name: string, type: AVOptionTypeImageSize, searchFlags?: AVOptionSearchFlags): {
565
+ width: number;
566
+ height: number;
567
+ } | null;
568
+ getOption(name: string, type: AVOptionTypeChLayout, searchFlags?: AVOptionSearchFlags): ChannelLayout | null;
569
+ getOption(name: string, type: AVOptionTypeDict, searchFlags?: AVOptionSearchFlags): Dictionary | null;
570
+ getOption(name: string, type: AVOptionTypeBinary, searchFlags?: AVOptionSearchFlags): string | null;
571
+ /**
572
+ * List all available options for this object.
573
+ *
574
+ * Uses the AVOption API to enumerate all options.
575
+ * Useful for discovering available settings and their types.
576
+ *
577
+ * @returns Array of option information objects
578
+ *
579
+ * @example
580
+ * ```typescript
581
+ * const options = obj.listOptions();
582
+ * for (const opt of options) {
583
+ * console.log(`${opt.name}: ${opt.help}`);
584
+ * console.log(` Type: ${opt.type}, Default: ${opt.defaultValue}`);
585
+ * }
586
+ * ```
587
+ */
588
+ listOptions(): OptionInfo[];
589
+ }