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