node-av 1.0.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/README.md +56 -41
  2. package/dist/api/bitstream-filter.d.ts +180 -123
  3. package/dist/api/bitstream-filter.js +182 -126
  4. package/dist/api/bitstream-filter.js.map +1 -1
  5. package/dist/api/decoder.d.ts +286 -130
  6. package/dist/api/decoder.js +321 -159
  7. package/dist/api/decoder.js.map +1 -1
  8. package/dist/api/encoder.d.ts +254 -158
  9. package/dist/api/encoder.js +326 -298
  10. package/dist/api/encoder.js.map +1 -1
  11. package/dist/api/filter-presets.d.ts +912 -0
  12. package/dist/api/filter-presets.js +1407 -0
  13. package/dist/api/filter-presets.js.map +1 -0
  14. package/dist/api/filter.d.ts +280 -284
  15. package/dist/api/filter.js +435 -509
  16. package/dist/api/filter.js.map +1 -1
  17. package/dist/api/hardware.d.ts +226 -159
  18. package/dist/api/hardware.js +405 -287
  19. package/dist/api/hardware.js.map +1 -1
  20. package/dist/api/index.d.ts +3 -2
  21. package/dist/api/index.js +1 -0
  22. package/dist/api/index.js.map +1 -1
  23. package/dist/api/io-stream.d.ts +65 -61
  24. package/dist/api/io-stream.js +45 -47
  25. package/dist/api/io-stream.js.map +1 -1
  26. package/dist/api/media-input.d.ts +244 -141
  27. package/dist/api/media-input.js +207 -104
  28. package/dist/api/media-input.js.map +1 -1
  29. package/dist/api/media-output.d.ts +206 -128
  30. package/dist/api/media-output.js +212 -129
  31. package/dist/api/media-output.js.map +1 -1
  32. package/dist/api/pipeline.d.ts +168 -38
  33. package/dist/api/pipeline.js +238 -14
  34. package/dist/api/pipeline.js.map +1 -1
  35. package/dist/api/types.d.ts +22 -182
  36. package/dist/api/utilities/audio-sample.d.ts +1 -1
  37. package/dist/api/utilities/image.d.ts +1 -1
  38. package/dist/api/utilities/media-type.d.ts +1 -1
  39. package/dist/api/utilities/pixel-format.d.ts +1 -1
  40. package/dist/api/utilities/sample-format.d.ts +1 -1
  41. package/dist/api/utilities/timestamp.d.ts +1 -1
  42. package/dist/api/utils.d.ts +1 -2
  43. package/dist/api/utils.js +9 -0
  44. package/dist/api/utils.js.map +1 -1
  45. package/dist/{lib → constants}/channel-layouts.d.ts +1 -1
  46. package/dist/constants/channel-layouts.js.map +1 -0
  47. package/dist/{lib → constants}/constants.d.ts +19 -4
  48. package/dist/{lib → constants}/constants.js +15 -1
  49. package/dist/constants/constants.js.map +1 -0
  50. package/dist/constants/decoders.d.ts +609 -0
  51. package/dist/constants/decoders.js +617 -0
  52. package/dist/constants/decoders.js.map +1 -0
  53. package/dist/constants/encoders.d.ts +285 -0
  54. package/dist/constants/encoders.js +298 -0
  55. package/dist/constants/encoders.js.map +1 -0
  56. package/dist/constants/index.d.ts +4 -0
  57. package/dist/constants/index.js +5 -0
  58. package/dist/constants/index.js.map +1 -0
  59. package/dist/index.d.ts +1 -0
  60. package/dist/index.js +2 -0
  61. package/dist/index.js.map +1 -1
  62. package/dist/lib/audio-fifo.d.ts +128 -171
  63. package/dist/lib/audio-fifo.js +130 -173
  64. package/dist/lib/audio-fifo.js.map +1 -1
  65. package/dist/lib/binding.d.ts +7 -5
  66. package/dist/lib/binding.js +5 -0
  67. package/dist/lib/binding.js.map +1 -1
  68. package/dist/lib/bitstream-filter-context.d.ts +139 -184
  69. package/dist/lib/bitstream-filter-context.js +139 -188
  70. package/dist/lib/bitstream-filter-context.js.map +1 -1
  71. package/dist/lib/bitstream-filter.d.ts +69 -55
  72. package/dist/lib/bitstream-filter.js +68 -54
  73. package/dist/lib/bitstream-filter.js.map +1 -1
  74. package/dist/lib/codec-context.d.ts +317 -381
  75. package/dist/lib/codec-context.js +316 -381
  76. package/dist/lib/codec-context.js.map +1 -1
  77. package/dist/lib/codec-parameters.d.ts +161 -171
  78. package/dist/lib/codec-parameters.js +162 -172
  79. package/dist/lib/codec-parameters.js.map +1 -1
  80. package/dist/lib/codec-parser.d.ts +92 -105
  81. package/dist/lib/codec-parser.js +92 -103
  82. package/dist/lib/codec-parser.js.map +1 -1
  83. package/dist/lib/codec.d.ts +328 -217
  84. package/dist/lib/codec.js +392 -218
  85. package/dist/lib/codec.js.map +1 -1
  86. package/dist/lib/dictionary.d.ts +150 -204
  87. package/dist/lib/dictionary.js +159 -213
  88. package/dist/lib/dictionary.js.map +1 -1
  89. package/dist/lib/error.d.ts +97 -131
  90. package/dist/lib/error.js +98 -128
  91. package/dist/lib/error.js.map +1 -1
  92. package/dist/lib/filter-context.d.ts +317 -194
  93. package/dist/lib/filter-context.js +335 -200
  94. package/dist/lib/filter-context.js.map +1 -1
  95. package/dist/lib/filter-graph.d.ts +252 -293
  96. package/dist/lib/filter-graph.js +253 -294
  97. package/dist/lib/filter-graph.js.map +1 -1
  98. package/dist/lib/filter-inout.d.ts +87 -95
  99. package/dist/lib/filter-inout.js +87 -95
  100. package/dist/lib/filter-inout.js.map +1 -1
  101. package/dist/lib/filter.d.ts +93 -111
  102. package/dist/lib/filter.js +94 -112
  103. package/dist/lib/filter.js.map +1 -1
  104. package/dist/lib/format-context.d.ts +321 -429
  105. package/dist/lib/format-context.js +314 -386
  106. package/dist/lib/format-context.js.map +1 -1
  107. package/dist/lib/frame.d.ts +263 -406
  108. package/dist/lib/frame.js +263 -408
  109. package/dist/lib/frame.js.map +1 -1
  110. package/dist/lib/hardware-device-context.d.ts +150 -204
  111. package/dist/lib/hardware-device-context.js +149 -203
  112. package/dist/lib/hardware-device-context.js.map +1 -1
  113. package/dist/lib/hardware-frames-context.d.ts +171 -181
  114. package/dist/lib/hardware-frames-context.js +171 -181
  115. package/dist/lib/hardware-frames-context.js.map +1 -1
  116. package/dist/lib/index.d.ts +2 -3
  117. package/dist/lib/index.js +2 -5
  118. package/dist/lib/index.js.map +1 -1
  119. package/dist/lib/input-format.d.ts +90 -118
  120. package/dist/lib/input-format.js +89 -117
  121. package/dist/lib/input-format.js.map +1 -1
  122. package/dist/lib/io-context.d.ts +210 -242
  123. package/dist/lib/io-context.js +221 -253
  124. package/dist/lib/io-context.js.map +1 -1
  125. package/dist/lib/log.d.ts +86 -120
  126. package/dist/lib/log.js +85 -122
  127. package/dist/lib/log.js.map +1 -1
  128. package/dist/lib/native-types.d.ts +127 -112
  129. package/dist/lib/native-types.js +9 -0
  130. package/dist/lib/native-types.js.map +1 -1
  131. package/dist/lib/option.d.ts +285 -242
  132. package/dist/lib/option.js +310 -250
  133. package/dist/lib/option.js.map +1 -1
  134. package/dist/lib/output-format.d.ts +78 -102
  135. package/dist/lib/output-format.js +77 -101
  136. package/dist/lib/output-format.js.map +1 -1
  137. package/dist/lib/packet.d.ts +173 -241
  138. package/dist/lib/packet.js +172 -241
  139. package/dist/lib/packet.js.map +1 -1
  140. package/dist/lib/rational.d.ts +0 -2
  141. package/dist/lib/rational.js +0 -2
  142. package/dist/lib/rational.js.map +1 -1
  143. package/dist/lib/software-resample-context.d.ts +242 -326
  144. package/dist/lib/software-resample-context.js +242 -326
  145. package/dist/lib/software-resample-context.js.map +1 -1
  146. package/dist/lib/software-scale-context.d.ts +130 -174
  147. package/dist/lib/software-scale-context.js +132 -176
  148. package/dist/lib/software-scale-context.js.map +1 -1
  149. package/dist/lib/stream.d.ts +88 -198
  150. package/dist/lib/stream.js +87 -197
  151. package/dist/lib/stream.js.map +1 -1
  152. package/dist/lib/types.d.ts +1 -1
  153. package/dist/lib/utilities.d.ts +372 -181
  154. package/dist/lib/utilities.js +373 -182
  155. package/dist/lib/utilities.js.map +1 -1
  156. package/install/check.js +0 -1
  157. package/package.json +32 -24
  158. package/release_notes.md +43 -13
  159. package/CHANGELOG.md +0 -8
  160. package/dist/lib/channel-layouts.js.map +0 -1
  161. package/dist/lib/constants.js.map +0 -1
  162. /package/dist/{lib → constants}/channel-layouts.js +0 -0
@@ -1,501 +1,507 @@
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
1
  import { Dictionary } from './dictionary.js';
2
+ 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/index.js';
13
3
  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
4
  import type { NativeOption } from './native-types.js';
16
5
  import type { ChannelLayout, IRational } from './types.js';
17
6
  /**
18
- * Low-level wrapper for a single AVOption.
7
+ * Option information descriptor.
19
8
  *
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().
9
+ * Describes a single option available on an FFmpeg object.
10
+ * Contains metadata about the option including name, type, default value,
11
+ * valid range, and documentation. Used to discover and validate options.
12
+ *
13
+ * Direct mapping to FFmpeg's AVOption.
22
14
  *
23
15
  * @example
24
16
  * ```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}`);
17
+ * import { Option } from 'node-av';
18
+ *
19
+ * // Get option info
20
+ * const optInfo = Option.find(obj, 'bitrate');
21
+ * if (optInfo) {
22
+ * console.log(`Option: ${optInfo.name}`);
23
+ * console.log(`Help: ${optInfo.help}`);
24
+ * console.log(`Type: ${optInfo.type}`);
25
+ * console.log(`Default: ${optInfo.defaultValue}`);
26
+ * console.log(`Range: ${optInfo.min} - ${optInfo.max}`);
29
27
  * }
30
28
  * ```
29
+ *
30
+ * @see [AVOption](https://ffmpeg.org/doxygen/trunk/structAVOption.html) - FFmpeg Doxygen
31
31
  */
32
32
  export declare class OptionInfo {
33
33
  private native;
34
- /** @internal */
34
+ /**
35
+ * @param native - The native option instance
36
+ * @internal
37
+ */
35
38
  constructor(native: NativeOption);
36
39
  /**
37
40
  * Option name.
38
41
  *
39
- * The key used to get/set this option.
42
+ * The name used to get/set this option.
43
+ *
44
+ * Direct mapping to AVOption->name.
40
45
  */
41
46
  get name(): string | null;
42
47
  /**
43
48
  * Option help text.
44
49
  *
45
- * Human-readable description of the option.
50
+ * Human-readable description of the option's purpose.
51
+ *
52
+ * Direct mapping to AVOption->help.
46
53
  */
47
54
  get help(): string | null;
48
55
  /**
49
56
  * Option type.
50
57
  *
51
- * Determines the data type and valid range of values.
58
+ * Data type of the option value (AV_OPT_TYPE_*).
59
+ *
60
+ * Direct mapping to AVOption->type.
52
61
  */
53
62
  get type(): AVOptionType;
54
63
  /**
55
64
  * Default value.
56
65
  *
57
- * The value used if not explicitly set.
66
+ * The default value for this option.
58
67
  * Type depends on the option type.
68
+ *
69
+ * Direct mapping to AVOption->default_val.
59
70
  */
60
71
  get defaultValue(): unknown;
61
72
  /**
62
73
  * Minimum value.
63
74
  *
64
- * For numeric types, the minimum allowed value.
75
+ * Minimum valid value for numeric options.
76
+ *
77
+ * Direct mapping to AVOption->min.
65
78
  */
66
79
  get min(): number;
67
80
  /**
68
81
  * Maximum value.
69
82
  *
70
- * For numeric types, the maximum allowed value.
83
+ * Maximum valid value for numeric options.
84
+ *
85
+ * Direct mapping to AVOption->max.
71
86
  */
72
87
  get max(): number;
73
88
  /**
74
89
  * Option flags.
75
90
  *
76
- * Bitfield of AV_OPT_FLAG_* values indicating option properties.
91
+ * Combination of AV_OPT_FLAG_* indicating option properties.
92
+ *
93
+ * Direct mapping to AVOption->flags.
77
94
  */
78
95
  get flags(): AVOptionFlag;
79
96
  /**
80
97
  * Option unit.
81
98
  *
82
- * For options that are part of a named group.
99
+ * Unit string for grouping related options.
100
+ *
101
+ * Direct mapping to AVOption->unit.
83
102
  */
84
103
  get unit(): string | null;
85
104
  /**
86
- * Get the native FFmpeg AVOption pointer.
105
+ * Get the underlying native Option object.
106
+ *
107
+ * @returns The native Option binding object
87
108
  *
88
- * @internal For use by other wrapper classes
89
- * @returns The underlying native option object
109
+ * @internal
90
110
  */
91
111
  getNative(): NativeOption;
92
112
  }
93
113
  /**
94
- * Low-level FFmpeg AVOption API.
114
+ * FFmpeg option management utilities.
95
115
  *
96
- * Provides static methods for accessing and modifying options on FFmpeg objects.
97
- * All methods work with native objects from the low-level API.
116
+ * Provides static methods for getting, setting, and querying options
117
+ * on FFmpeg objects that support the AVOption API. Handles type conversion
118
+ * and validation for various option types including strings, numbers,
119
+ * rationals, pixel formats, and more.
98
120
  *
99
- * Uses av_opt_* functions internally.
121
+ * Direct mapping to FFmpeg's AVOption API.
100
122
  *
101
123
  * @example
102
124
  * ```typescript
103
- * // Set codec bitrate
104
- * Option.setInt(codecContext, 'b', 2000000);
125
+ * import { Option, FFmpegError } from 'node-av';
126
+ * import { AV_OPT_SEARCH_CHILDREN, AV_PIX_FMT_YUV420P } from 'node-av/constants';
127
+ *
128
+ * // Set various option types
129
+ * let ret = Option.set(obj, 'preset', 'fast');
130
+ * FFmpegError.throwIfError(ret, 'set preset');
131
+ *
132
+ * ret = Option.setInt(obj, 'bitrate', 2000000);
133
+ * FFmpegError.throwIfError(ret, 'set bitrate');
134
+ *
135
+ * ret = Option.setRational(obj, 'framerate', { num: 30, den: 1 });
136
+ * FFmpegError.throwIfError(ret, 'set framerate');
105
137
  *
106
- * // Get current bitrate
107
- * const bitrate = Option.getInt(codecContext, 'b');
138
+ * // Get option values
139
+ * const preset = Option.get(obj, 'preset');
140
+ * const bitrate = Option.getInt(obj, 'bitrate');
141
+ * const framerate = Option.getRational(obj, 'framerate');
108
142
  *
109
- * // Iterate through all options
143
+ * // List all options
110
144
  * let opt = null;
111
- * while ((opt = Option.next(codecContext, opt))) {
145
+ * while ((opt = Option.next(obj, opt))) {
112
146
  * console.log(`${opt.name}: ${opt.help}`);
113
147
  * }
114
148
  * ```
149
+ *
150
+ * @see [AVOption API](https://ffmpeg.org/doxygen/trunk/group__avoptions.html) - FFmpeg Doxygen
151
+ * @see {@link OptionMember} For inherited option support
115
152
  */
116
153
  export declare class Option {
117
- private constructor();
118
154
  /**
119
- * Iterate through options of an object.
155
+ * Iterate to next option.
120
156
  *
121
- * Uses av_opt_next() internally.
157
+ * Iterates through available options on an object.
122
158
  *
123
- * @param obj - Native object (CodecContext, FormatContext, FilterContext, etc.)
124
- * @param prev - Previous option for iteration, or null to start
159
+ * Direct mapping to av_opt_next().
125
160
  *
126
- * @returns Next option or null when done
161
+ * @param obj - Object with options
162
+ * @param prev - Previous option (null to get first)
163
+ * @returns Next option, or null if no more
127
164
  *
128
165
  * @example
129
166
  * ```typescript
130
167
  * let opt = null;
131
- * while ((opt = Option.next(codecContext, opt))) {
132
- * console.log(`${opt.name}: ${opt.help}`);
168
+ * while ((opt = Option.next(obj, opt))) {
169
+ * console.log(`Option: ${opt.name}`);
133
170
  * }
134
171
  * ```
135
172
  */
136
173
  static next(obj: OptionCapableObject, prev?: OptionInfo | null): OptionInfo | null;
137
174
  /**
138
- * Find an option by name.
175
+ * Find option by name.
139
176
  *
140
- * Uses av_opt_find() internally.
177
+ * Searches for an option with the specified name.
141
178
  *
142
- * @param obj - Native object
143
- * @param name - Option name to find
144
- * @param searchFlags - Search flags (default: 0)
179
+ * Direct mapping to av_opt_find().
145
180
  *
146
- * @returns Found option or null
181
+ * @param obj - Object to search
182
+ * @param name - Option name
183
+ * @param searchFlags - Search flags
184
+ * @returns Option info if found, null otherwise
147
185
  *
148
186
  * @example
149
187
  * ```typescript
150
- * const opt = Option.find(codecContext, 'bitrate');
188
+ * const opt = Option.find(obj, 'bitrate');
151
189
  * if (opt) {
152
- * console.log(`Found option: ${opt.name}`);
190
+ * console.log(`Found: ${opt.name}, Type: ${opt.type}`);
153
191
  * }
154
192
  * ```
155
193
  */
156
194
  static find(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): OptionInfo | null;
157
195
  /**
158
- * Find an option by name with target object information.
196
+ * Find option with target info.
159
197
  *
160
- * Uses av_opt_find2() internally.
198
+ * Like find() but also indicates if option was found on different target.
161
199
  *
162
- * @param obj - Native object
163
- * @param name - Option name to find
164
- * @param searchFlags - Search flags (default: 0)
200
+ * Direct mapping to av_opt_find2().
165
201
  *
166
- * @returns Object with option and whether target differs, or null
202
+ * @param obj - Object to search
203
+ * @param name - Option name
204
+ * @param searchFlags - Search flags
205
+ * @returns Object with option and target info
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * const result = Option.find2(obj, 'bitrate', AV_OPT_SEARCH_CHILDREN);
210
+ * if (result?.option) {
211
+ * console.log(`Found on ${result.isDifferentTarget ? 'child' : 'object'}`);
212
+ * }
213
+ * ```
167
214
  */
168
215
  static find2(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): {
169
216
  option: OptionInfo | null;
170
217
  isDifferentTarget: boolean;
171
218
  } | null;
172
219
  /**
173
- * Get option value as string.
220
+ * Get string option value.
174
221
  *
175
- * Uses av_opt_get() internally.
176
- * Converts any option type to its string representation.
222
+ * Direct mapping to av_opt_get().
177
223
  *
178
- * @param obj - Native object
224
+ * @param obj - Object to query
179
225
  * @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
226
+ * @param searchFlags - Search flags
227
+ * @returns Option value as string, or null
183
228
  */
184
229
  static get(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): string | null;
185
230
  /**
186
- * Get option value as integer.
231
+ * Get integer option value.
187
232
  *
188
- * Uses av_opt_get_int() internally.
189
- * Option must be of integer type.
233
+ * Direct mapping to av_opt_get_int().
190
234
  *
191
- * @param obj - Native object
235
+ * @param obj - Object to query
192
236
  * @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
237
+ * @param searchFlags - Search flags
238
+ * @returns Option value as integer, or null
196
239
  */
197
240
  static getInt(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): number | null;
198
241
  /**
199
- * Get option value as double.
242
+ * Get double option value.
200
243
  *
201
- * Uses av_opt_get_double() internally.
202
- * Option must be of double/float type.
244
+ * Direct mapping to av_opt_get_double().
203
245
  *
204
- * @param obj - Native object
246
+ * @param obj - Object to query
205
247
  * @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
248
+ * @param searchFlags - Search flags
249
+ * @returns Option value as double, or null
209
250
  */
210
251
  static getDouble(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): number | null;
211
252
  /**
212
- * Get option value as rational.
253
+ * Get rational option value.
213
254
  *
214
- * Uses av_opt_get_q() internally.
215
- * Option must be of rational type.
255
+ * Direct mapping to av_opt_get_q().
216
256
  *
217
- * @param obj - Native object
257
+ * @param obj - Object to query
218
258
  * @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
259
+ * @param searchFlags - Search flags
260
+ * @returns Option value as rational, or null
222
261
  */
223
262
  static getRational(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): IRational | null;
224
263
  /**
225
- * Get option value as pixel format.
264
+ * Get pixel format option value.
226
265
  *
227
- * Uses av_opt_get_pixel_fmt() internally.
228
- * Option must be of pixel format type.
266
+ * Direct mapping to av_opt_get_pixel_fmt().
229
267
  *
230
- * @param obj - Native object
268
+ * @param obj - Object to query
231
269
  * @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
270
+ * @param searchFlags - Search flags
271
+ * @returns Pixel format value, or null
235
272
  */
236
273
  static getPixelFormat(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): AVPixelFormat | null;
237
274
  /**
238
- * Get option value as sample format.
275
+ * Get sample format option value.
239
276
  *
240
- * Uses av_opt_get_sample_fmt() internally.
241
- * Option must be of sample format type.
277
+ * Direct mapping to av_opt_get_sample_fmt().
242
278
  *
243
- * @param obj - Native object
279
+ * @param obj - Object to query
244
280
  * @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
281
+ * @param searchFlags - Search flags
282
+ * @returns Sample format value, or null
248
283
  */
249
284
  static getSampleFormat(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): AVSampleFormat | null;
250
285
  /**
251
- * Get option value as image size.
286
+ * Get image size option value.
252
287
  *
253
- * Uses av_opt_get_image_size() internally.
254
- * Option must be of image size type.
288
+ * Direct mapping to av_opt_get_image_size().
255
289
  *
256
- * @param obj - Native object
290
+ * @param obj - Object to query
257
291
  * @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
292
+ * @param searchFlags - Search flags
293
+ * @returns Width and height, or null
261
294
  */
262
295
  static getImageSize(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): {
263
296
  width: number;
264
297
  height: number;
265
298
  } | null;
266
299
  /**
267
- * Get option value as channel layout.
300
+ * Get channel layout option value.
268
301
  *
269
- * Uses av_opt_get_chlayout() internally.
270
- * Option must be of channel layout type.
302
+ * Direct mapping to av_opt_get_chlayout().
271
303
  *
272
- * @param obj - Native object
304
+ * @param obj - Object to query
273
305
  * @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
306
+ * @param searchFlags - Search flags
307
+ * @returns Channel layout, or null
277
308
  */
278
309
  static getChannelLayout(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): ChannelLayout | null;
279
310
  /**
280
- * Get option value as dictionary.
311
+ * Get dictionary option value.
281
312
  *
282
- * Uses av_opt_get_dict_val() internally.
283
- * Option must be of dictionary type.
313
+ * Direct mapping to av_opt_get_dict_val().
284
314
  *
285
- * @param obj - Native object
315
+ * @param obj - Object to query
286
316
  * @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
317
+ * @param searchFlags - Search flags
318
+ * @returns Dictionary value, or null
290
319
  */
291
320
  static getDict(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): Dictionary | null;
292
321
  /**
293
- * Set option value from string.
322
+ * Set string option value.
294
323
  *
295
- * Uses av_opt_set() internally.
296
- * Can be used for any option type - FFmpeg will parse the string.
324
+ * Direct mapping to av_opt_set().
297
325
  *
298
- * @param obj - Native object
326
+ * @param obj - Object to modify
299
327
  * @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
328
+ * @param value - String value
329
+ * @param searchFlags - Search flags
330
+ * @returns 0 on success, negative AVERROR on error
304
331
  */
305
332
  static set(obj: OptionCapableObject, name: string, value: string, searchFlags?: AVOptionSearchFlags): number;
306
333
  /**
307
- * Set option value as integer.
334
+ * Set integer option value.
308
335
  *
309
- * Uses av_opt_set_int() internally.
310
- * More efficient than set() for numeric options.
336
+ * Direct mapping to av_opt_set_int().
311
337
  *
312
- * @param obj - Native object
338
+ * @param obj - Object to modify
313
339
  * @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
340
+ * @param value - Integer value
341
+ * @param searchFlags - Search flags
342
+ * @returns 0 on success, negative AVERROR on error
318
343
  */
319
344
  static setInt(obj: OptionCapableObject, name: string, value: number | bigint, searchFlags?: AVOptionSearchFlags): number;
320
345
  /**
321
- * Set option value as double.
346
+ * Set double option value.
322
347
  *
323
- * Uses av_opt_set_double() internally.
324
- * More efficient than set() for floating point options.
348
+ * Direct mapping to av_opt_set_double().
325
349
  *
326
- * @param obj - Native object
350
+ * @param obj - Object to modify
327
351
  * @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
352
+ * @param value - Double value
353
+ * @param searchFlags - Search flags
354
+ * @returns 0 on success, negative AVERROR on error
332
355
  */
333
356
  static setDouble(obj: OptionCapableObject, name: string, value: number, searchFlags?: AVOptionSearchFlags): number;
334
357
  /**
335
- * Set option value as rational.
358
+ * Set rational option value.
336
359
  *
337
- * Uses av_opt_set_q() internally.
338
- * For framerates, aspect ratios, time bases, etc.
360
+ * Direct mapping to av_opt_set_q().
339
361
  *
340
- * @param obj - Native object
362
+ * @param obj - Object to modify
341
363
  * @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
364
+ * @param value - Rational value
365
+ * @param searchFlags - Search flags
366
+ * @returns 0 on success, negative AVERROR on error
346
367
  */
347
368
  static setRational(obj: OptionCapableObject, name: string, value: IRational, searchFlags?: AVOptionSearchFlags): number;
348
369
  /**
349
- * Set option value as pixel format.
370
+ * Set pixel format option value.
350
371
  *
351
- * Uses av_opt_set_pixel_fmt() internally.
352
- * More type-safe than using set() with string names.
372
+ * Direct mapping to av_opt_set_pixel_fmt().
353
373
  *
354
- * @param obj - Native object
374
+ * @param obj - Object to modify
355
375
  * @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
376
+ * @param value - Pixel format
377
+ * @param searchFlags - Search flags
378
+ * @returns 0 on success, negative AVERROR on error
360
379
  */
361
380
  static setPixelFormat(obj: OptionCapableObject, name: string, value: AVPixelFormat, searchFlags?: AVOptionSearchFlags): number;
362
381
  /**
363
- * Set option value as sample format.
382
+ * Set sample format option value.
364
383
  *
365
- * Uses av_opt_set_sample_fmt() internally.
366
- * More type-safe than using set() with string names.
384
+ * Direct mapping to av_opt_set_sample_fmt().
367
385
  *
368
- * @param obj - Native object
386
+ * @param obj - Object to modify
369
387
  * @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
388
+ * @param value - Sample format
389
+ * @param searchFlags - Search flags
390
+ * @returns 0 on success, negative AVERROR on error
374
391
  */
375
392
  static setSampleFormat(obj: OptionCapableObject, name: string, value: AVSampleFormat, searchFlags?: AVOptionSearchFlags): number;
376
393
  /**
377
- * Set option value as image size.
394
+ * Set image size option value.
378
395
  *
379
- * Uses av_opt_set_image_size() internally.
380
- * Convenient for setting width and height together.
396
+ * Direct mapping to av_opt_set_image_size().
381
397
  *
382
- * @param obj - Native object
398
+ * @param obj - Object to modify
383
399
  * @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
400
+ * @param width - Image width
401
+ * @param height - Image height
402
+ * @param searchFlags - Search flags
403
+ * @returns 0 on success, negative AVERROR on error
389
404
  */
390
405
  static setImageSize(obj: OptionCapableObject, name: string, width: number, height: number, searchFlags?: AVOptionSearchFlags): number;
391
406
  /**
392
- * Set option value as channel layout.
407
+ * Set channel layout option value.
393
408
  *
394
- * Uses av_opt_set_chlayout() internally.
395
- * For audio channel configuration.
409
+ * Direct mapping to av_opt_set_chlayout().
396
410
  *
397
- * @param obj - Native object
411
+ * @param obj - Object to modify
398
412
  * @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
413
+ * @param value - Channel layout
414
+ * @param searchFlags - Search flags
415
+ * @returns 0 on success, negative AVERROR on error
403
416
  */
404
417
  static setChannelLayout(obj: OptionCapableObject, name: string, value: number, searchFlags?: AVOptionSearchFlags): number;
405
418
  /**
406
- * Set option value as dictionary.
419
+ * Set dictionary option value.
407
420
  *
408
- * Uses av_opt_set_dict_val() internally.
409
- * For options that accept key-value pairs.
421
+ * Direct mapping to av_opt_set_dict_val().
410
422
  *
411
- * @param obj - Native object
423
+ * @param obj - Object to modify
412
424
  * @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
425
+ * @param value - Dictionary value
426
+ * @param searchFlags - Search flags
427
+ * @returns 0 on success, negative AVERROR on error
417
428
  */
418
429
  static setDict(obj: OptionCapableObject, name: string, value: Dictionary, searchFlags?: AVOptionSearchFlags): number;
419
430
  /**
420
- * Set option value as binary data.
431
+ * Set binary option value.
421
432
  *
422
- * Uses av_opt_set_bin() internally.
423
- * For options that accept raw binary data.
433
+ * Direct mapping to av_opt_set_bin().
424
434
  *
425
- * @param obj - Native object
435
+ * @param obj - Object to modify
426
436
  * @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
437
+ * @param value - Binary data
438
+ * @param searchFlags - Search flags
439
+ * @returns 0 on success, negative AVERROR on error
431
440
  */
432
441
  static setBin(obj: OptionCapableObject, name: string, value: Buffer, searchFlags?: AVOptionSearchFlags): number;
433
442
  /**
434
- * Set all options to their default values.
443
+ * Set defaults on object.
444
+ *
445
+ * Sets all options to their default values.
435
446
  *
436
- * Uses av_opt_set_defaults() internally.
447
+ * Direct mapping to av_opt_set_defaults().
437
448
  *
438
- * @param obj - Native object
449
+ * @param obj - Object to reset
439
450
  */
440
451
  static setDefaults(obj: OptionCapableObject): void;
441
452
  /**
442
- * Copy options from source to destination.
453
+ * Copy options between objects.
443
454
  *
444
- * Uses av_opt_copy() internally.
445
- * Copies all option values from one object to another.
455
+ * Copies option values from source to destination.
456
+ *
457
+ * Direct mapping to av_opt_copy().
446
458
  *
447
459
  * @param dest - Destination object
448
460
  * @param src - Source object
449
- *
450
- * @returns 0 on success, negative AVERROR code on failure
461
+ * @returns 0 on success, negative AVERROR on error
451
462
  */
452
463
  static copy(dest: OptionCapableObject, src: OptionCapableObject): number;
453
464
  /**
454
- * Check if option is set to its default value.
465
+ * Check if option is set to default.
455
466
  *
456
- * Uses av_opt_is_set_to_default_by_name() internally.
467
+ * Direct mapping to av_opt_is_set_to_default().
457
468
  *
458
- * @param obj - Native object
469
+ * @param obj - Object to check
459
470
  * @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
471
+ * @param searchFlags - Search flags
472
+ * @returns True if default, false if modified, null if not found
463
473
  */
464
474
  static isSetToDefault(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): boolean | null;
465
475
  /**
466
476
  * Serialize options to string.
467
477
  *
468
- * Uses av_opt_serialize() internally.
469
- * Converts all non-default options to a string representation.
478
+ * Direct mapping to av_opt_serialize().
470
479
  *
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
480
+ * @param obj - Object to serialize
481
+ * @param optFlags - Option flags filter
482
+ * @param flags - Serialization flags
483
+ * @param keyValSep - Key-value separator
484
+ * @param pairsSep - Pairs separator
485
+ * @returns Serialized string, or null on error
478
486
  */
479
487
  static serialize(obj: OptionCapableObject, optFlags?: number, flags?: number, keyValSep?: string, pairsSep?: string): string | null;
480
488
  /**
481
- * Free options of an object.
489
+ * Free option resources.
482
490
  *
483
- * Uses av_opt_free() internally.
491
+ * Direct mapping to av_opt_free().
484
492
  *
485
- * @param obj - Native object
493
+ * @param obj - Object to free options from
486
494
  */
487
495
  static free(obj: OptionCapableObject): void;
488
496
  /**
489
- * Show options to stderr for debugging.
490
- *
491
- * Uses av_opt_show2() internally.
492
- * Prints all available options to stderr.
497
+ * Show options for debugging.
493
498
  *
494
- * @param obj - Native object
495
- * @param reqFlags - Required flags (default: 0)
496
- * @param rejFlags - Rejected flags (default: 0)
499
+ * Direct mapping to av_opt_show2().
497
500
  *
498
- * @returns 0 on success, negative AVERROR code on failure
501
+ * @param obj - Object to show options for
502
+ * @param reqFlags - Required flags
503
+ * @param rejFlags - Rejected flags
504
+ * @returns 0 on success, negative AVERROR on error
499
505
  */
500
506
  static show(obj: OptionCapableObject, reqFlags?: number, rejFlags?: number): number;
501
507
  }
@@ -513,10 +519,42 @@ export declare class Option {
513
519
  *
514
520
  * @example
515
521
  * ```typescript
522
+ * import { OptionMember, FFmpegError } from 'node-av';
523
+ * import { AV_OPT_TYPE_INT, AV_OPT_TYPE_STRING, AV_OPT_TYPE_RATIONAL } from 'node-av/constants';
524
+ *
516
525
  * class CodecContext extends OptionMember<NativeCodecContext> {
517
- * // Inherits setOption, getOption, listOptions
526
+ * constructor(native: NativeCodecContext) {
527
+ * super(native);
528
+ * }
529
+ * }
530
+ *
531
+ * // Use inherited methods
532
+ * const codec = new CodecContext(native);
533
+ *
534
+ * // Set options with automatic type handling
535
+ * let ret = codec.setOption('preset', 'fast');
536
+ * FFmpegError.throwIfError(ret, 'set preset');
537
+ *
538
+ * ret = codec.setOption('bitrate', 2000000, AV_OPT_TYPE_INT);
539
+ * FFmpegError.throwIfError(ret, 'set bitrate');
540
+ *
541
+ * ret = codec.setOption('framerate', { num: 30, den: 1 }, AV_OPT_TYPE_RATIONAL);
542
+ * FFmpegError.throwIfError(ret, 'set framerate');
543
+ *
544
+ * // Get typed options
545
+ * const preset = codec.getOption('preset');
546
+ * const bitrate = codec.getOption('bitrate', AV_OPT_TYPE_INT);
547
+ * const framerate = codec.getOption('framerate', AV_OPT_TYPE_RATIONAL);
548
+ *
549
+ * // List all available options
550
+ * const options = codec.listOptions();
551
+ * for (const opt of options) {
552
+ * console.log(`${opt.name}: ${opt.help}`);
518
553
  * }
519
554
  * ```
555
+ *
556
+ * @see {@link Option} For static option methods
557
+ * @see {@link OptionInfo} For option metadata
520
558
  */
521
559
  export declare class OptionMember<T extends OptionCapableObject> {
522
560
  protected native: T;
@@ -574,6 +612,8 @@ export declare class OptionMember<T extends OptionCapableObject> {
574
612
  * Uses the AVOption API to enumerate all options.
575
613
  * Useful for discovering available settings and their types.
576
614
  *
615
+ * Direct mapping to av_opt_next() iteration.
616
+ *
577
617
  * @returns Array of option information objects
578
618
  *
579
619
  * @example
@@ -582,8 +622,11 @@ export declare class OptionMember<T extends OptionCapableObject> {
582
622
  * for (const opt of options) {
583
623
  * console.log(`${opt.name}: ${opt.help}`);
584
624
  * console.log(` Type: ${opt.type}, Default: ${opt.defaultValue}`);
625
+ * console.log(` Range: ${opt.min} - ${opt.max}`);
585
626
  * }
586
627
  * ```
628
+ *
629
+ * @see {@link OptionInfo} For option metadata structure
587
630
  */
588
631
  listOptions(): OptionInfo[];
589
632
  }