@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,1071 @@
1
+ import { HardwareDeviceContext } from './hardware-device-context.js';
2
+ import { HardwareFramesContext } from './hardware-frames-context.js';
3
+ import { OptionMember } from './option.js';
4
+ import { Rational } from './rational.js';
5
+ import type { AVChromaLocation, AVCodecFlag, AVCodecFlag2, AVCodecID, AVColorPrimaries, AVColorRange, AVColorSpace, AVColorTransferCharacteristic, AVMediaType, AVPixelFormat, AVProfile, AVSampleFormat, AVThreadType } from '../constants/constants.js';
6
+ import type { CodecParameters } from './codec-parameters.js';
7
+ import type { Codec } from './codec.js';
8
+ import type { Dictionary } from './dictionary.js';
9
+ import type { Frame } from './frame.js';
10
+ import type { NativeCodecContext, NativeWrapper } from './native-types.js';
11
+ import type { Packet } from './packet.js';
12
+ import type { ChannelLayout } from './types.js';
13
+ /**
14
+ * Codec context for encoding and decoding.
15
+ *
16
+ * Main structure for codec operations, containing all codec parameters and state.
17
+ * Handles encoding raw frames to packets and decoding packets to frames.
18
+ * Supports both software and hardware-accelerated codecs.
19
+ * Must be configured and opened before use.
20
+ *
21
+ * Direct mapping to FFmpeg's AVCodecContext.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * import { CodecContext, Codec, FFmpegError } from 'node-av';
26
+ * import { AV_CODEC_ID_H264, AV_PIX_FMT_YUV420P } from 'node-av/constants';
27
+ *
28
+ * // Create decoder
29
+ * const decoder = new CodecContext();
30
+ * const codec = Codec.findDecoder(AV_CODEC_ID_H264);
31
+ * decoder.allocContext3(codec);
32
+ *
33
+ * // Configure from stream parameters
34
+ * decoder.parametersToContext(stream.codecpar);
35
+ *
36
+ * // Open decoder
37
+ * let ret = await decoder.open2(codec);
38
+ * FFmpegError.throwIfError(ret, 'open2');
39
+ *
40
+ * // Decode packets
41
+ * ret = await decoder.sendPacket(packet);
42
+ * if (ret >= 0) {
43
+ * ret = await decoder.receiveFrame(frame);
44
+ * if (ret >= 0) {
45
+ * // Process decoded frame
46
+ * }
47
+ * }
48
+ *
49
+ * // Cleanup
50
+ * decoder.freeContext();
51
+ * ```
52
+ *
53
+ * @see [AVCodecContext](https://ffmpeg.org/doxygen/trunk/structAVCodecContext.html) - FFmpeg Doxygen
54
+ * @see {@link Codec} For finding codecs
55
+ * @see {@link CodecParameters} For stream parameters
56
+ */
57
+ export declare class CodecContext extends OptionMember<NativeCodecContext> implements Disposable, NativeWrapper<NativeCodecContext> {
58
+ private _hwDeviceCtx?;
59
+ private _hwFramesCtx?;
60
+ constructor();
61
+ /**
62
+ * Type of codec (video/audio/subtitle).
63
+ *
64
+ * Direct mapping to AVCodecContext->codec_type.
65
+ */
66
+ get codecType(): AVMediaType;
67
+ set codecType(value: AVMediaType);
68
+ /**
69
+ * Codec identifier.
70
+ *
71
+ * Direct mapping to AVCodecContext->codec_id.
72
+ */
73
+ get codecId(): AVCodecID;
74
+ set codecId(value: AVCodecID);
75
+ /**
76
+ * Codec tag.
77
+ *
78
+ * Additional codec tag used by some formats.
79
+ *
80
+ * Direct mapping to AVCodecContext->codec_tag.
81
+ */
82
+ get codecTag(): number;
83
+ set codecTag(value: number | string);
84
+ /**
85
+ * Codec tag as string (FourCC).
86
+ *
87
+ * Human-readable string representation of the codec tag.
88
+ * Returns the FourCC (Four Character Code) format.
89
+ */
90
+ get codecTagString(): string | null;
91
+ /**
92
+ * Average bitrate.
93
+ *
94
+ * Target bitrate for encoding, detected bitrate for decoding.
95
+ * In bits per second.
96
+ *
97
+ * Direct mapping to AVCodecContext->bit_rate.
98
+ */
99
+ get bitRate(): bigint;
100
+ set bitRate(value: bigint);
101
+ /**
102
+ * Time base for timestamps.
103
+ *
104
+ * Fundamental unit of time in seconds for this context.
105
+ *
106
+ * Direct mapping to AVCodecContext->time_base.
107
+ */
108
+ get timeBase(): Rational;
109
+ set timeBase(value: Rational);
110
+ /**
111
+ * Packet time base.
112
+ *
113
+ * Time base of the packets from/to the demuxer/muxer.
114
+ *
115
+ * Direct mapping to AVCodecContext->pkt_timebase.
116
+ */
117
+ get pktTimebase(): Rational;
118
+ set pktTimebase(value: Rational);
119
+ /**
120
+ * Codec delay.
121
+ *
122
+ * Number of frames the decoder needs to output before first frame.
123
+ *
124
+ * Direct mapping to AVCodecContext->delay.
125
+ */
126
+ get delay(): number;
127
+ /**
128
+ * Codec flags.
129
+ *
130
+ * Combination of AV_CODEC_FLAG_* values.
131
+ *
132
+ * Direct mapping to AVCodecContext->flags.
133
+ */
134
+ get flags(): AVCodecFlag;
135
+ set flags(value: AVCodecFlag);
136
+ /**
137
+ * Additional codec flags.
138
+ *
139
+ * Combination of AV_CODEC_FLAG2_* values.
140
+ *
141
+ * Direct mapping to AVCodecContext->flags2.
142
+ */
143
+ get flags2(): AVCodecFlag2;
144
+ set flags2(value: AVCodecFlag2);
145
+ /**
146
+ * Extra binary data for codec.
147
+ *
148
+ * Contains codec-specific initialization data.
149
+ *
150
+ * Direct mapping to AVCodecContext->extradata.
151
+ */
152
+ get extraData(): Buffer | null;
153
+ set extraData(value: Buffer | null);
154
+ /**
155
+ * Codec profile.
156
+ *
157
+ * FF_PROFILE_* value indicating codec profile.
158
+ *
159
+ * Direct mapping to AVCodecContext->profile.
160
+ */
161
+ get profile(): AVProfile;
162
+ set profile(value: AVProfile);
163
+ /**
164
+ * Codec level.
165
+ *
166
+ * Level within the specified profile.
167
+ *
168
+ * Direct mapping to AVCodecContext->level.
169
+ */
170
+ get level(): number;
171
+ set level(value: number);
172
+ /**
173
+ * Thread count for codec.
174
+ *
175
+ * Number of threads to use for decoding/encoding.
176
+ * 0 for automatic selection.
177
+ *
178
+ * Direct mapping to AVCodecContext->thread_count.
179
+ */
180
+ get threadCount(): number;
181
+ set threadCount(value: number);
182
+ /**
183
+ * Thread type for codec.
184
+ *
185
+ * Which multithreading methods to use.
186
+ * - FF_THREAD_FRAME (1): Decode more than one frame at once
187
+ * - FF_THREAD_SLICE (2): Decode more than one part of a single frame at once
188
+ *
189
+ * Direct mapping to AVCodecContext->thread_type.
190
+ */
191
+ get threadType(): AVThreadType;
192
+ set threadType(value: AVThreadType);
193
+ /**
194
+ * Picture width in pixels.
195
+ *
196
+ * Direct mapping to AVCodecContext->width.
197
+ */
198
+ get width(): number;
199
+ set width(value: number);
200
+ /**
201
+ * Picture height in pixels.
202
+ *
203
+ * Direct mapping to AVCodecContext->height.
204
+ */
205
+ get height(): number;
206
+ set height(value: number);
207
+ /**
208
+ * Group of pictures size.
209
+ *
210
+ * Maximum number of frames between keyframes.
211
+ *
212
+ * Direct mapping to AVCodecContext->gop_size.
213
+ */
214
+ get gopSize(): number;
215
+ set gopSize(value: number);
216
+ /**
217
+ * Pixel format.
218
+ *
219
+ * Format of the video frames.
220
+ *
221
+ * Direct mapping to AVCodecContext->pix_fmt.
222
+ */
223
+ get pixelFormat(): AVPixelFormat;
224
+ set pixelFormat(value: AVPixelFormat);
225
+ /**
226
+ * Maximum number of B-frames.
227
+ *
228
+ * B-frames between non-B-frames.
229
+ *
230
+ * Direct mapping to AVCodecContext->max_b_frames.
231
+ */
232
+ get maxBFrames(): number;
233
+ set maxBFrames(value: number);
234
+ /**
235
+ * Macroblock decision mode.
236
+ *
237
+ * Algorithm for macroblock decision.
238
+ *
239
+ * Direct mapping to AVCodecContext->mb_decision.
240
+ */
241
+ get mbDecision(): number;
242
+ set mbDecision(value: number);
243
+ /**
244
+ * Number of frames delay in decoder.
245
+ *
246
+ * For codecs with B-frames.
247
+ *
248
+ * Direct mapping to AVCodecContext->has_b_frames.
249
+ */
250
+ get hasBFrames(): number;
251
+ /**
252
+ * Sample aspect ratio.
253
+ *
254
+ * Pixel width/height ratio.
255
+ *
256
+ * Direct mapping to AVCodecContext->sample_aspect_ratio.
257
+ */
258
+ get sampleAspectRatio(): Rational;
259
+ set sampleAspectRatio(value: Rational);
260
+ /**
261
+ * Frame rate.
262
+ *
263
+ * Frames per second for encoding.
264
+ *
265
+ * Direct mapping to AVCodecContext->framerate.
266
+ */
267
+ get framerate(): Rational;
268
+ set framerate(value: Rational);
269
+ /**
270
+ * Color range.
271
+ *
272
+ * MPEG (limited) or JPEG (full) range.
273
+ *
274
+ * Direct mapping to AVCodecContext->color_range.
275
+ */
276
+ get colorRange(): AVColorRange;
277
+ set colorRange(value: AVColorRange);
278
+ /**
279
+ * Color primaries.
280
+ *
281
+ * Chromaticity coordinates of source primaries.
282
+ *
283
+ * Direct mapping to AVCodecContext->color_primaries.
284
+ */
285
+ get colorPrimaries(): AVColorPrimaries;
286
+ set colorPrimaries(value: AVColorPrimaries);
287
+ /**
288
+ * Color transfer characteristic.
289
+ *
290
+ * Transfer function (gamma).
291
+ *
292
+ * Direct mapping to AVCodecContext->color_trc.
293
+ */
294
+ get colorTrc(): AVColorTransferCharacteristic;
295
+ set colorTrc(value: AVColorTransferCharacteristic);
296
+ /**
297
+ * YUV color space.
298
+ *
299
+ * Color space for YUV content.
300
+ *
301
+ * Direct mapping to AVCodecContext->colorspace.
302
+ */
303
+ get colorSpace(): AVColorSpace;
304
+ set colorSpace(value: AVColorSpace);
305
+ /**
306
+ * Chroma sample location.
307
+ *
308
+ * Position of chroma samples.
309
+ *
310
+ * Direct mapping to AVCodecContext->chroma_sample_location.
311
+ */
312
+ get chromaLocation(): AVChromaLocation;
313
+ set chromaLocation(value: AVChromaLocation);
314
+ /**
315
+ * Audio sample rate.
316
+ *
317
+ * Samples per second.
318
+ *
319
+ * Direct mapping to AVCodecContext->sample_rate.
320
+ */
321
+ get sampleRate(): number;
322
+ set sampleRate(value: number);
323
+ /**
324
+ * Number of audio channels.
325
+ *
326
+ * Direct mapping to AVCodecContext->channels.
327
+ */
328
+ get channels(): number;
329
+ set channels(value: number);
330
+ /**
331
+ * Audio sample format.
332
+ *
333
+ * Format of audio samples.
334
+ *
335
+ * Direct mapping to AVCodecContext->sample_fmt.
336
+ */
337
+ get sampleFormat(): AVSampleFormat;
338
+ set sampleFormat(value: AVSampleFormat);
339
+ /**
340
+ * Number of samples per audio frame.
341
+ *
342
+ * Direct mapping to AVCodecContext->frame_size.
343
+ */
344
+ get frameSize(): number;
345
+ set frameSize(value: number);
346
+ /**
347
+ * Number of bits per coded sample.
348
+ *
349
+ * Bits per sample/pixel from the demuxer (needed by some codecs).
350
+ * For uncompressed formats, this is the bits per sample.
351
+ *
352
+ * Direct mapping to AVCodecContext->bits_per_coded_sample.
353
+ */
354
+ get bitsPerCodedSample(): number;
355
+ set bitsPerCodedSample(value: number);
356
+ /**
357
+ * Number of bits per raw sample.
358
+ *
359
+ * Bits per sample before compression/encoding.
360
+ * Only set when different from bitsPerCodedSample.
361
+ *
362
+ * Direct mapping to AVCodecContext->bits_per_raw_sample.
363
+ */
364
+ get bitsPerRawSample(): number;
365
+ set bitsPerRawSample(value: number);
366
+ /**
367
+ * Current frame number.
368
+ *
369
+ * Frame counter for debugging.
370
+ *
371
+ * Direct mapping to AVCodecContext->frame_number.
372
+ */
373
+ get frameNumber(): number;
374
+ /**
375
+ * Audio channel layout.
376
+ *
377
+ * Describes channel configuration.
378
+ *
379
+ * Direct mapping to AVCodecContext->ch_layout.
380
+ */
381
+ get channelLayout(): ChannelLayout;
382
+ set channelLayout(value: ChannelLayout);
383
+ /**
384
+ * Minimum quantizer.
385
+ *
386
+ * Minimum quantization parameter.
387
+ *
388
+ * Direct mapping to AVCodecContext->qmin.
389
+ */
390
+ get qMin(): number;
391
+ set qMin(value: number);
392
+ /**
393
+ * Maximum quantizer.
394
+ *
395
+ * Maximum quantization parameter.
396
+ *
397
+ * Direct mapping to AVCodecContext->qmax.
398
+ */
399
+ get qMax(): number;
400
+ set qMax(value: number);
401
+ /**
402
+ * Global quality for constant quality mode.
403
+ *
404
+ * Used by encoders that support constant quality mode (e.g., -qscale in FFmpeg CLI).
405
+ * Set this value to enable constant quality encoding instead of constant bitrate.
406
+ * Valid range depends on the codec (e.g., 0-69 for MPEG-4, FF_LAMBDA_SCALE for others).
407
+ *
408
+ * Direct mapping to AVCodecContext->global_quality.
409
+ *
410
+ * @example
411
+ * ```typescript
412
+ * // MPEG-4 constant quality (lower = better quality)
413
+ * codecContext.globalQuality = 5 * FF_QP2LAMBDA;
414
+ * ```
415
+ */
416
+ get globalQuality(): number;
417
+ set globalQuality(value: number);
418
+ /**
419
+ * Rate control buffer size.
420
+ *
421
+ * Decoder bitstream buffer size.
422
+ *
423
+ * Direct mapping to AVCodecContext->rc_buffer_size.
424
+ */
425
+ get rcBufferSize(): number;
426
+ set rcBufferSize(value: number);
427
+ /**
428
+ * Maximum bitrate.
429
+ *
430
+ * Maximum bitrate in bits per second.
431
+ *
432
+ * Direct mapping to AVCodecContext->rc_max_rate.
433
+ */
434
+ get rcMaxRate(): bigint;
435
+ set rcMaxRate(value: bigint);
436
+ /**
437
+ * Minimum bitrate.
438
+ *
439
+ * Minimum bitrate in bits per second.
440
+ *
441
+ * Direct mapping to AVCodecContext->rc_min_rate.
442
+ */
443
+ get rcMinRate(): bigint;
444
+ set rcMinRate(value: bigint);
445
+ /**
446
+ * Hardware device context.
447
+ *
448
+ * Reference to hardware device for acceleration.
449
+ *
450
+ * Direct mapping to AVCodecContext->hw_device_ctx.
451
+ */
452
+ get hwDeviceCtx(): HardwareDeviceContext | null;
453
+ set hwDeviceCtx(value: HardwareDeviceContext | null);
454
+ /**
455
+ * Number of extra hardware frames to allocate.
456
+ *
457
+ * Specifies additional hardware frame buffers for decoders that need them.
458
+ * Useful for hardware decoders requiring frame buffering or reordering.
459
+ *
460
+ * Direct mapping to AVCodecContext->extra_hw_frames.
461
+ */
462
+ get extraHWFrames(): number;
463
+ set extraHWFrames(value: number);
464
+ /**
465
+ * Hardware frames context.
466
+ *
467
+ * Reference to hardware frames for GPU memory.
468
+ *
469
+ * Direct mapping to AVCodecContext->hw_frames_ctx.
470
+ */
471
+ get hwFramesCtx(): HardwareFramesContext | null;
472
+ set hwFramesCtx(value: HardwareFramesContext | null);
473
+ /**
474
+ * Check if codec is open.
475
+ *
476
+ * True if the codec has been opened.
477
+ */
478
+ get isOpen(): boolean;
479
+ /**
480
+ * Allocate codec context.
481
+ *
482
+ * Allocates and initializes the context for the given codec.
483
+ *
484
+ * Direct mapping to avcodec_alloc_context3().
485
+ *
486
+ * @param codec - Codec to use (null for default)
487
+ *
488
+ * @example
489
+ * ```typescript
490
+ * import { Codec } from 'node-av';
491
+ * import { AV_CODEC_ID_H264 } from 'node-av/constants';
492
+ *
493
+ * const codec = Codec.findDecoder(AV_CODEC_ID_H264);
494
+ * ctx.allocContext3(codec);
495
+ * ```
496
+ *
497
+ * @see {@link open2} To open the codec
498
+ * @see {@link freeContext} To free the context
499
+ */
500
+ allocContext3(codec?: Codec | null): void;
501
+ /**
502
+ * Free the codec context.
503
+ *
504
+ * Releases all resources. The context becomes invalid.
505
+ *
506
+ * Direct mapping to avcodec_free_context().
507
+ *
508
+ * @example
509
+ * ```typescript
510
+ * ctx.freeContext();
511
+ * // Context is now invalid
512
+ * ```
513
+ *
514
+ * @see {@link Symbol.dispose} For automatic cleanup
515
+ * @see {@link allocContext3} To allocate a new context
516
+ */
517
+ freeContext(): void;
518
+ /**
519
+ * Open the codec.
520
+ *
521
+ * Initializes the codec for encoding/decoding.
522
+ * Must be called before processing frames/packets.
523
+ *
524
+ * Direct mapping to avcodec_open2().
525
+ *
526
+ * @param codec - Codec to open with (null to use already set)
527
+ *
528
+ * @param options - Codec-specific options
529
+ *
530
+ * @returns 0 on success, negative AVERROR on error:
531
+ * - AVERROR_EINVAL: Invalid parameters
532
+ * - AVERROR_ENOMEM: Memory allocation failure
533
+ *
534
+ * @example
535
+ * ```typescript
536
+ * import { FFmpegError } from 'node-av';
537
+ *
538
+ * const ret = await ctx.open2(codec);
539
+ * FFmpegError.throwIfError(ret, 'open2');
540
+ * // Codec is now open and ready
541
+ * ```
542
+ *
543
+ * @see {@link allocContext3} Must be called first
544
+ * @see {@link isOpen} To check if open
545
+ */
546
+ open2(codec?: Codec | null, options?: Dictionary | null): Promise<number>;
547
+ /**
548
+ * Open the codec synchronously.
549
+ * Synchronous version of open2.
550
+ *
551
+ * Initializes the codec for encoding/decoding.
552
+ * Must be called before processing frames/packets.
553
+ *
554
+ * Direct mapping to avcodec_open2().
555
+ *
556
+ * @param codec - Codec to open with (null to use already set)
557
+ *
558
+ * @param options - Codec-specific options
559
+ *
560
+ * @returns 0 on success, negative AVERROR on error:
561
+ * - AVERROR_EINVAL: Invalid parameters
562
+ * - AVERROR_ENOMEM: Memory allocation failure
563
+ *
564
+ * @example
565
+ * ```typescript
566
+ * import { FFmpegError } from 'node-av';
567
+ *
568
+ * const ret = ctx.open2Sync(codec);
569
+ * FFmpegError.throwIfError(ret, 'open2Sync');
570
+ * // Codec is now open and ready
571
+ * ```
572
+ *
573
+ * @see {@link open2} For async version
574
+ */
575
+ open2Sync(codec?: Codec | null, options?: Dictionary | null): number;
576
+ /**
577
+ * Fill codec context from parameters.
578
+ *
579
+ * Copies codec parameters from stream to context.
580
+ * Used when setting up decoders.
581
+ *
582
+ * Direct mapping to avcodec_parameters_to_context().
583
+ *
584
+ * @param params - Source codec parameters
585
+ *
586
+ * @returns 0 on success, negative AVERROR on error:
587
+ * - AVERROR_EINVAL: Invalid parameters
588
+ *
589
+ * @example
590
+ * ```typescript
591
+ * import { FFmpegError } from 'node-av';
592
+ *
593
+ * const ret = ctx.parametersToContext(stream.codecpar);
594
+ * FFmpegError.throwIfError(ret, 'parametersToContext');
595
+ * ```
596
+ *
597
+ * @see {@link parametersFromContext} For the reverse
598
+ */
599
+ parametersToContext(params: CodecParameters): number;
600
+ /**
601
+ * Fill parameters from codec context.
602
+ *
603
+ * Copies codec parameters from context to stream.
604
+ * Used when setting up encoders.
605
+ *
606
+ * Direct mapping to avcodec_parameters_from_context().
607
+ *
608
+ * @param params - Destination codec parameters
609
+ *
610
+ * @returns 0 on success, negative AVERROR on error:
611
+ * - AVERROR_EINVAL: Invalid parameters
612
+ *
613
+ * @example
614
+ * ```typescript
615
+ * import { FFmpegError } from 'node-av';
616
+ *
617
+ * const ret = ctx.parametersFromContext(stream.codecpar);
618
+ * FFmpegError.throwIfError(ret, 'parametersFromContext');
619
+ * ```
620
+ *
621
+ * @see {@link parametersToContext} For the reverse
622
+ */
623
+ parametersFromContext(params: CodecParameters): number;
624
+ /**
625
+ * Flush codec buffers.
626
+ *
627
+ * Resets the internal codec state.
628
+ * Used when seeking or switching streams.
629
+ *
630
+ * Direct mapping to avcodec_flush_buffers().
631
+ *
632
+ * @example
633
+ * ```typescript
634
+ * // Flush when seeking
635
+ * ctx.flushBuffers();
636
+ * // Codec is now ready for new data
637
+ * ```
638
+ */
639
+ flushBuffers(): void;
640
+ /**
641
+ * Send packet to decoder.
642
+ *
643
+ * Submits encoded data for decoding.
644
+ * Call receiveFrame() to get decoded frames.
645
+ *
646
+ * Direct mapping to avcodec_send_packet().
647
+ *
648
+ * @param packet - Packet to decode (null to flush)
649
+ *
650
+ * @returns 0 on success, negative AVERROR on error:
651
+ * - AVERROR_EAGAIN: Must receive frames first
652
+ * - AVERROR_EOF: Decoder has been flushed
653
+ * - AVERROR_EINVAL: Invalid decoder state
654
+ * - AVERROR_ENOMEM: Memory allocation failure
655
+ *
656
+ * @example
657
+ * ```typescript
658
+ * import { FFmpegError } from 'node-av';
659
+ * import { AVERROR_EAGAIN } from 'node-av';
660
+ *
661
+ * const ret = await ctx.sendPacket(packet);
662
+ * if (ret === AVERROR_EAGAIN) {
663
+ * // Need to receive frames first
664
+ * } else {
665
+ * FFmpegError.throwIfError(ret, 'sendPacket');
666
+ * }
667
+ * ```
668
+ *
669
+ * @see {@link receiveFrame} To get decoded frames
670
+ */
671
+ sendPacket(packet: Packet | null): Promise<number>;
672
+ /**
673
+ * Send packet to decoder synchronously.
674
+ * Synchronous version of sendPacket.
675
+ *
676
+ * Submits compressed data for decoding.
677
+ * Call receiveFrameSync() to get decoded frames.
678
+ *
679
+ * Direct mapping to avcodec_send_packet().
680
+ *
681
+ * @param packet - Packet to decode (null to flush)
682
+ *
683
+ * @returns 0 on success, negative AVERROR on error:
684
+ * - AVERROR_EAGAIN: Must receive frames first
685
+ * - AVERROR_EOF: Decoder has been flushed
686
+ * - AVERROR_EINVAL: Invalid decoder state
687
+ * - AVERROR_ENOMEM: Memory allocation failure
688
+ *
689
+ * @example
690
+ * ```typescript
691
+ * import { FFmpegError } from 'node-av';
692
+ * import { AVERROR_EAGAIN } from 'node-av';
693
+ *
694
+ * const ret = ctx.sendPacketSync(packet);
695
+ * if (ret === AVERROR_EAGAIN) {
696
+ * // Need to receive frames first
697
+ * ctx.receiveFrameSync(frame);
698
+ * }
699
+ * ```
700
+ *
701
+ * @see {@link sendPacket} For async version
702
+ */
703
+ sendPacketSync(packet: Packet | null): number;
704
+ /**
705
+ * Receive decoded frame.
706
+ *
707
+ * Gets a decoded frame from the decoder.
708
+ * Call after sendPacket().
709
+ *
710
+ * Direct mapping to avcodec_receive_frame().
711
+ *
712
+ * @param frame - Frame to receive into
713
+ *
714
+ * @returns 0 on success, negative AVERROR on error:
715
+ * - AVERROR_EAGAIN: Need more input
716
+ * - AVERROR_EOF: All frames have been output
717
+ * - AVERROR_EINVAL: Invalid decoder state
718
+ *
719
+ * @example
720
+ * ```typescript
721
+ * import { FFmpegError } from 'node-av';
722
+ * import { AVERROR_EAGAIN, AVERROR_EOF } from 'node-av';
723
+ *
724
+ * const ret = await ctx.receiveFrame(frame);
725
+ * if (ret === AVERROR_EAGAIN || ret === AVERROR_EOF) {
726
+ * // No frame available
727
+ * } else {
728
+ * FFmpegError.throwIfError(ret, 'receiveFrame');
729
+ * // Process decoded frame
730
+ * }
731
+ * ```
732
+ *
733
+ * @see {@link sendPacket} To send packets for decoding
734
+ */
735
+ receiveFrame(frame: Frame): Promise<number>;
736
+ /**
737
+ * Receive decoded frame synchronously.
738
+ * Synchronous version of receiveFrame.
739
+ *
740
+ * Gets a decoded frame from the decoder.
741
+ * Call after sendPacketSync().
742
+ *
743
+ * Direct mapping to avcodec_receive_frame().
744
+ *
745
+ * @param frame - Frame to receive into
746
+ *
747
+ * @returns 0 on success, negative AVERROR on error:
748
+ * - AVERROR_EAGAIN: Need more input
749
+ * - AVERROR_EOF: All frames have been output
750
+ * - AVERROR_EINVAL: Invalid decoder state
751
+ *
752
+ * @example
753
+ * ```typescript
754
+ * import { FFmpegError } from 'node-av';
755
+ * import { AVERROR_EAGAIN, AVERROR_EOF } from 'node-av';
756
+ *
757
+ * const ret = ctx.receiveFrameSync(frame);
758
+ * if (ret === AVERROR_EAGAIN || ret === AVERROR_EOF) {
759
+ * // No frame available
760
+ * } else {
761
+ * FFmpegError.throwIfError(ret, 'receiveFrameSync');
762
+ * // Process frame
763
+ * }
764
+ * ```
765
+ *
766
+ * @see {@link receiveFrame} For async version
767
+ */
768
+ receiveFrameSync(frame: Frame): number;
769
+ /**
770
+ * Send frame to encoder.
771
+ *
772
+ * Submits raw frame for encoding.
773
+ * Call receivePacket() to get encoded packets.
774
+ *
775
+ * Direct mapping to avcodec_send_frame().
776
+ *
777
+ * @param frame - Frame to encode (null to flush)
778
+ *
779
+ * @returns 0 on success, negative AVERROR on error:
780
+ * - AVERROR_EAGAIN: Must receive packets first
781
+ * - AVERROR_EOF: Encoder has been flushed
782
+ * - AVERROR_EINVAL: Invalid encoder state
783
+ * - AVERROR_ENOMEM: Memory allocation failure
784
+ *
785
+ * @example
786
+ * ```typescript
787
+ * import { FFmpegError } from 'node-av';
788
+ * import { AVERROR_EAGAIN } from 'node-av';
789
+ *
790
+ * const ret = await ctx.sendFrame(frame);
791
+ * if (ret === AVERROR_EAGAIN) {
792
+ * // Need to receive packets first
793
+ * } else {
794
+ * FFmpegError.throwIfError(ret, 'sendFrame');
795
+ * }
796
+ * ```
797
+ *
798
+ * @see {@link receivePacket} To get encoded packets
799
+ */
800
+ sendFrame(frame: Frame | null): Promise<number>;
801
+ /**
802
+ * Send frame to encoder synchronously.
803
+ * Synchronous version of sendFrame.
804
+ *
805
+ * Submits raw frame for encoding.
806
+ * Call receivePacketSync() to get encoded packets.
807
+ *
808
+ * Direct mapping to avcodec_send_frame().
809
+ *
810
+ * @param frame - Frame to encode (null to flush)
811
+ *
812
+ * @returns 0 on success, negative AVERROR on error:
813
+ * - AVERROR_EAGAIN: Must receive packets first
814
+ * - AVERROR_EOF: Encoder has been flushed
815
+ * - AVERROR_EINVAL: Invalid encoder state
816
+ * - AVERROR_ENOMEM: Memory allocation failure
817
+ *
818
+ * @example
819
+ * ```typescript
820
+ * import { FFmpegError } from 'node-av';
821
+ * import { AVERROR_EAGAIN } from 'node-av';
822
+ *
823
+ * const ret = ctx.sendFrameSync(frame);
824
+ * if (ret === AVERROR_EAGAIN) {
825
+ * // Need to receive packets first
826
+ * ctx.receivePacketSync(packet);
827
+ * }
828
+ * ```
829
+ *
830
+ * @see {@link sendFrame} For async version
831
+ */
832
+ sendFrameSync(frame: Frame | null): number;
833
+ /**
834
+ * Receive encoded packet.
835
+ *
836
+ * Gets an encoded packet from the encoder.
837
+ * Call after sendFrame().
838
+ *
839
+ * Direct mapping to avcodec_receive_packet().
840
+ *
841
+ * @param packet - Packet to receive into
842
+ *
843
+ * @returns 0 on success, negative AVERROR on error:
844
+ * - AVERROR_EAGAIN: Need more input
845
+ * - AVERROR_EOF: All packets have been output
846
+ * - AVERROR_EINVAL: Invalid encoder state
847
+ *
848
+ * @example
849
+ * ```typescript
850
+ * import { FFmpegError } from 'node-av';
851
+ * import { AVERROR_EAGAIN, AVERROR_EOF } from 'node-av';
852
+ *
853
+ * const ret = await ctx.receivePacket(packet);
854
+ * if (ret === AVERROR_EAGAIN || ret === AVERROR_EOF) {
855
+ * // No packet available
856
+ * } else {
857
+ * FFmpegError.throwIfError(ret, 'receivePacket');
858
+ * // Process encoded packet
859
+ * }
860
+ * ```
861
+ *
862
+ * @see {@link sendFrame} To send frames for encoding
863
+ */
864
+ receivePacket(packet: Packet): Promise<number>;
865
+ /**
866
+ * Receive encoded packet synchronously.
867
+ * Synchronous version of receivePacket.
868
+ *
869
+ * Gets an encoded packet from the encoder.
870
+ * Call after sendFrameSync().
871
+ *
872
+ * Direct mapping to avcodec_receive_packet().
873
+ *
874
+ * @param packet - Packet to receive into
875
+ *
876
+ * @returns 0 on success, negative AVERROR on error:
877
+ * - AVERROR_EAGAIN: Need more input
878
+ * - AVERROR_EOF: All packets have been output
879
+ * - AVERROR_EINVAL: Invalid encoder state
880
+ *
881
+ * @example
882
+ * ```typescript
883
+ * import { FFmpegError } from 'node-av';
884
+ * import { AVERROR_EAGAIN, AVERROR_EOF } from 'node-av';
885
+ *
886
+ * const ret = ctx.receivePacketSync(packet);
887
+ * if (ret === AVERROR_EAGAIN || ret === AVERROR_EOF) {
888
+ * // No packet available
889
+ * } else {
890
+ * FFmpegError.throwIfError(ret, 'receivePacketSync');
891
+ * // Process packet
892
+ * }
893
+ * ```
894
+ *
895
+ * @see {@link receivePacket} For async version
896
+ */
897
+ receivePacketSync(packet: Packet): number;
898
+ /**
899
+ * Set hardware pixel format.
900
+ *
901
+ * Configures hardware acceleration pixel formats.
902
+ * Used in get_format callback for hardware decoding.
903
+ *
904
+ * @param hwFormat - Hardware pixel format
905
+ *
906
+ * @param swFormat - Software pixel format (optional)
907
+ *
908
+ * @example
909
+ * ```typescript
910
+ * import { AV_PIX_FMT_CUDA, AV_PIX_FMT_NV12 } from 'node-av/constants';
911
+ *
912
+ * ctx.setHardwarePixelFormat(AV_PIX_FMT_CUDA, AV_PIX_FMT_NV12);
913
+ * ```
914
+ */
915
+ setHardwarePixelFormat(hwFormat: AVPixelFormat, swFormat?: AVPixelFormat): void;
916
+ /**
917
+ * Set codec flags.
918
+ *
919
+ * Sets one or more flags using bitwise OR. Allows setting multiple flags
920
+ * without manually performing bitwise operations.
921
+ *
922
+ * @param flags - One or more flag values to set
923
+ *
924
+ * @example
925
+ * ```typescript
926
+ * import { AV_CODEC_FLAG_QSCALE, AV_CODEC_FLAG_PSNR } from 'node-av/constants';
927
+ *
928
+ * // Set multiple flags at once
929
+ * codecContext.setFlags(AV_CODEC_FLAG_QSCALE, AV_CODEC_FLAG_PSNR);
930
+ * ```
931
+ *
932
+ * @see {@link clearFlags} To unset flags
933
+ * @see {@link hasFlags} To check flags
934
+ * @see {@link flags} For direct flag access
935
+ */
936
+ setFlags(...flags: AVCodecFlag[]): void;
937
+ /**
938
+ * Clear codec flags.
939
+ *
940
+ * Clears one or more flags using bitwise AND NOT. Allows clearing multiple
941
+ * flags without manually performing bitwise operations.
942
+ *
943
+ * @param flags - One or more flag values to clear
944
+ *
945
+ * @example
946
+ * ```typescript
947
+ * import { AV_CODEC_FLAG_PSNR } from 'node-av/constants';
948
+ *
949
+ * // Clear specific flag
950
+ * codecContext.clearFlags(AV_CODEC_FLAG_PSNR);
951
+ * ```
952
+ *
953
+ * @see {@link setFlags} To set flags
954
+ * @see {@link hasFlags} To check flags
955
+ * @see {@link flags} For direct flag access
956
+ */
957
+ clearFlags(...flags: AVCodecFlag[]): void;
958
+ /**
959
+ * Check if codec has specific flags.
960
+ *
961
+ * Tests whether all specified flags are set using bitwise AND.
962
+ *
963
+ * @param flags - One or more flag values to check
964
+ *
965
+ * @returns true if all specified flags are set, false otherwise
966
+ *
967
+ * @example
968
+ * ```typescript
969
+ * import { AV_CODEC_FLAG_QSCALE } from 'node-av/constants';
970
+ *
971
+ * if (codecContext.hasFlags(AV_CODEC_FLAG_QSCALE)) {
972
+ * console.log('QSCALE flag is set');
973
+ * }
974
+ * ```
975
+ *
976
+ * @see {@link setFlags} To set flags
977
+ * @see {@link clearFlags} To unset flags
978
+ * @see {@link flags} For direct flag access
979
+ */
980
+ hasFlags(...flags: AVCodecFlag[]): boolean;
981
+ /**
982
+ * Set codec flags2.
983
+ *
984
+ * Sets one or more flags2 values using bitwise OR. Allows setting multiple flags
985
+ * without manually performing bitwise operations.
986
+ *
987
+ * @param flags - One or more flag2 values to set
988
+ *
989
+ * @example
990
+ * ```typescript
991
+ * import { AV_CODEC_FLAG2_FAST } from 'node-av/constants';
992
+ *
993
+ * // Set multiple flags2 at once
994
+ * codecContext.setFlags2(AV_CODEC_FLAG2_FAST);
995
+ * ```
996
+ *
997
+ * @see {@link clearFlags2} To unset flags2
998
+ * @see {@link hasFlags2} To check flags2
999
+ * @see {@link flags2} For direct flag2 access
1000
+ */
1001
+ setFlags2(...flags: AVCodecFlag2[]): void;
1002
+ /**
1003
+ * Clear codec flags2.
1004
+ *
1005
+ * Clears one or more flags2 values using bitwise AND NOT. Allows clearing multiple
1006
+ * flags without manually performing bitwise operations.
1007
+ *
1008
+ * @param flags - One or more flag2 values to clear
1009
+ *
1010
+ * @example
1011
+ * ```typescript
1012
+ * import { AV_CODEC_FLAG2_FAST } from 'node-av/constants';
1013
+ *
1014
+ * // Clear specific flag2
1015
+ * codecContext.clearFlags2(AV_CODEC_FLAG2_FAST);
1016
+ * ```
1017
+ *
1018
+ * @see {@link setFlags2} To set flags2
1019
+ * @see {@link hasFlags2} To check flags2
1020
+ * @see {@link flags2} For direct flag2 access
1021
+ */
1022
+ clearFlags2(...flags: AVCodecFlag2[]): void;
1023
+ /**
1024
+ * Check if codec has specific flags2.
1025
+ *
1026
+ * Tests whether all specified flags2 are set using bitwise AND.
1027
+ *
1028
+ * @param flags - One or more flag2 values to check
1029
+ *
1030
+ * @returns true if all specified flags2 are set, false otherwise
1031
+ *
1032
+ * @example
1033
+ * ```typescript
1034
+ * import { AV_CODEC_FLAG2_FAST } from 'node-av/constants';
1035
+ *
1036
+ * if (codecContext.hasFlags2(AV_CODEC_FLAG2_FAST)) {
1037
+ * console.log('FAST flag2 is set');
1038
+ * }
1039
+ * ```
1040
+ *
1041
+ * @see {@link setFlags2} To set flags2
1042
+ * @see {@link clearFlags2} To unset flags2
1043
+ * @see {@link flags2} For direct flag2 access
1044
+ */
1045
+ hasFlags2(...flags: AVCodecFlag2[]): boolean;
1046
+ /**
1047
+ * Get the underlying native CodecContext object.
1048
+ *
1049
+ * @returns The native CodecContext binding object
1050
+ *
1051
+ * @internal
1052
+ */
1053
+ getNative(): NativeCodecContext;
1054
+ /**
1055
+ * Dispose of the codec context.
1056
+ *
1057
+ * Implements the Disposable interface for automatic cleanup.
1058
+ * Equivalent to calling freeContext().
1059
+ *
1060
+ * @example
1061
+ * ```typescript
1062
+ * {
1063
+ * using ctx = new CodecContext();
1064
+ * ctx.allocContext3(codec);
1065
+ * await ctx.open2();
1066
+ * // Use context...
1067
+ * } // Automatically freed when leaving scope
1068
+ * ```
1069
+ */
1070
+ [Symbol.dispose](): void;
1071
+ }