node-av 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE.md +22 -0
  3. package/README.md +377 -0
  4. package/binding.gyp +78 -0
  5. package/dist/api/bitstream-filter.d.ts +246 -0
  6. package/dist/api/bitstream-filter.js +369 -0
  7. package/dist/api/bitstream-filter.js.map +1 -0
  8. package/dist/api/decoder.d.ts +257 -0
  9. package/dist/api/decoder.js +424 -0
  10. package/dist/api/decoder.js.map +1 -0
  11. package/dist/api/encoder.d.ts +298 -0
  12. package/dist/api/encoder.js +574 -0
  13. package/dist/api/encoder.js.map +1 -0
  14. package/dist/api/filter.d.ts +457 -0
  15. package/dist/api/filter.js +876 -0
  16. package/dist/api/filter.js.map +1 -0
  17. package/dist/api/hardware.d.ts +318 -0
  18. package/dist/api/hardware.js +558 -0
  19. package/dist/api/hardware.js.map +1 -0
  20. package/dist/api/index.d.ts +12 -0
  21. package/dist/api/index.js +20 -0
  22. package/dist/api/index.js.map +1 -0
  23. package/dist/api/io-stream.d.ts +109 -0
  24. package/dist/api/io-stream.js +124 -0
  25. package/dist/api/io-stream.js.map +1 -0
  26. package/dist/api/media-input.d.ts +295 -0
  27. package/dist/api/media-input.js +456 -0
  28. package/dist/api/media-input.js.map +1 -0
  29. package/dist/api/media-output.d.ts +274 -0
  30. package/dist/api/media-output.js +486 -0
  31. package/dist/api/media-output.js.map +1 -0
  32. package/dist/api/pipeline.d.ts +117 -0
  33. package/dist/api/pipeline.js +836 -0
  34. package/dist/api/pipeline.js.map +1 -0
  35. package/dist/api/types.d.ts +440 -0
  36. package/dist/api/types.js +2 -0
  37. package/dist/api/types.js.map +1 -0
  38. package/dist/api/utilities/audio-sample.d.ts +115 -0
  39. package/dist/api/utilities/audio-sample.js +110 -0
  40. package/dist/api/utilities/audio-sample.js.map +1 -0
  41. package/dist/api/utilities/channel-layout.d.ts +83 -0
  42. package/dist/api/utilities/channel-layout.js +87 -0
  43. package/dist/api/utilities/channel-layout.js.map +1 -0
  44. package/dist/api/utilities/image.d.ts +177 -0
  45. package/dist/api/utilities/image.js +183 -0
  46. package/dist/api/utilities/image.js.map +1 -0
  47. package/dist/api/utilities/index.d.ts +8 -0
  48. package/dist/api/utilities/index.js +17 -0
  49. package/dist/api/utilities/index.js.map +1 -0
  50. package/dist/api/utilities/media-type.d.ts +56 -0
  51. package/dist/api/utilities/media-type.js +60 -0
  52. package/dist/api/utilities/media-type.js.map +1 -0
  53. package/dist/api/utilities/pixel-format.d.ts +94 -0
  54. package/dist/api/utilities/pixel-format.js +102 -0
  55. package/dist/api/utilities/pixel-format.js.map +1 -0
  56. package/dist/api/utilities/sample-format.d.ts +132 -0
  57. package/dist/api/utilities/sample-format.js +144 -0
  58. package/dist/api/utilities/sample-format.js.map +1 -0
  59. package/dist/api/utilities/streaming.d.ts +104 -0
  60. package/dist/api/utilities/streaming.js +137 -0
  61. package/dist/api/utilities/streaming.js.map +1 -0
  62. package/dist/api/utilities/timestamp.d.ts +187 -0
  63. package/dist/api/utilities/timestamp.js +200 -0
  64. package/dist/api/utilities/timestamp.js.map +1 -0
  65. package/dist/api/utils.d.ts +61 -0
  66. package/dist/api/utils.js +330 -0
  67. package/dist/api/utils.js.map +1 -0
  68. package/dist/index.d.ts +2 -0
  69. package/dist/index.js +5 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/lib/audio-fifo.d.ts +339 -0
  72. package/dist/lib/audio-fifo.js +365 -0
  73. package/dist/lib/audio-fifo.js.map +1 -0
  74. package/dist/lib/binding.d.ts +192 -0
  75. package/dist/lib/binding.js +70 -0
  76. package/dist/lib/binding.js.map +1 -0
  77. package/dist/lib/bitstream-filter-context.d.ts +345 -0
  78. package/dist/lib/bitstream-filter-context.js +407 -0
  79. package/dist/lib/bitstream-filter-context.js.map +1 -0
  80. package/dist/lib/bitstream-filter.d.ts +124 -0
  81. package/dist/lib/bitstream-filter.js +138 -0
  82. package/dist/lib/bitstream-filter.js.map +1 -0
  83. package/dist/lib/channel-layouts.d.ts +51 -0
  84. package/dist/lib/channel-layouts.js +55 -0
  85. package/dist/lib/channel-layouts.js.map +1 -0
  86. package/dist/lib/codec-context.d.ts +763 -0
  87. package/dist/lib/codec-context.js +974 -0
  88. package/dist/lib/codec-context.js.map +1 -0
  89. package/dist/lib/codec-parameters.d.ts +362 -0
  90. package/dist/lib/codec-parameters.js +460 -0
  91. package/dist/lib/codec-parameters.js.map +1 -0
  92. package/dist/lib/codec-parser.d.ts +185 -0
  93. package/dist/lib/codec-parser.js +193 -0
  94. package/dist/lib/codec-parser.js.map +1 -0
  95. package/dist/lib/codec.d.ts +432 -0
  96. package/dist/lib/codec.js +492 -0
  97. package/dist/lib/codec.js.map +1 -0
  98. package/dist/lib/constants.d.ts +2037 -0
  99. package/dist/lib/constants.js +1659 -0
  100. package/dist/lib/constants.js.map +1 -0
  101. package/dist/lib/dictionary.d.ts +371 -0
  102. package/dist/lib/dictionary.js +406 -0
  103. package/dist/lib/dictionary.js.map +1 -0
  104. package/dist/lib/error.d.ts +216 -0
  105. package/dist/lib/error.js +254 -0
  106. package/dist/lib/error.js.map +1 -0
  107. package/dist/lib/filter-context.d.ts +445 -0
  108. package/dist/lib/filter-context.js +505 -0
  109. package/dist/lib/filter-context.js.map +1 -0
  110. package/dist/lib/filter-graph.d.ts +556 -0
  111. package/dist/lib/filter-graph.js +608 -0
  112. package/dist/lib/filter-graph.js.map +1 -0
  113. package/dist/lib/filter-inout.d.ts +205 -0
  114. package/dist/lib/filter-inout.js +264 -0
  115. package/dist/lib/filter-inout.js.map +1 -0
  116. package/dist/lib/filter.d.ts +231 -0
  117. package/dist/lib/filter.js +260 -0
  118. package/dist/lib/filter.js.map +1 -0
  119. package/dist/lib/format-context.d.ts +798 -0
  120. package/dist/lib/format-context.js +845 -0
  121. package/dist/lib/format-context.js.map +1 -0
  122. package/dist/lib/frame.d.ts +784 -0
  123. package/dist/lib/frame.js +933 -0
  124. package/dist/lib/frame.js.map +1 -0
  125. package/dist/lib/hardware-device-context.d.ts +407 -0
  126. package/dist/lib/hardware-device-context.js +429 -0
  127. package/dist/lib/hardware-device-context.js.map +1 -0
  128. package/dist/lib/hardware-frames-context.d.ts +374 -0
  129. package/dist/lib/hardware-frames-context.js +430 -0
  130. package/dist/lib/hardware-frames-context.js.map +1 -0
  131. package/dist/lib/index.d.ts +31 -0
  132. package/dist/lib/index.js +54 -0
  133. package/dist/lib/index.js.map +1 -0
  134. package/dist/lib/input-format.d.ts +216 -0
  135. package/dist/lib/input-format.js +246 -0
  136. package/dist/lib/input-format.js.map +1 -0
  137. package/dist/lib/io-context.d.ts +495 -0
  138. package/dist/lib/io-context.js +550 -0
  139. package/dist/lib/io-context.js.map +1 -0
  140. package/dist/lib/log.d.ts +201 -0
  141. package/dist/lib/log.js +219 -0
  142. package/dist/lib/log.js.map +1 -0
  143. package/dist/lib/native-types.d.ts +719 -0
  144. package/dist/lib/native-types.js +2 -0
  145. package/dist/lib/native-types.js.map +1 -0
  146. package/dist/lib/option.d.ts +589 -0
  147. package/dist/lib/option.js +853 -0
  148. package/dist/lib/option.js.map +1 -0
  149. package/dist/lib/output-format.d.ts +179 -0
  150. package/dist/lib/output-format.js +205 -0
  151. package/dist/lib/output-format.js.map +1 -0
  152. package/dist/lib/packet.d.ts +487 -0
  153. package/dist/lib/packet.js +558 -0
  154. package/dist/lib/packet.js.map +1 -0
  155. package/dist/lib/rational.d.ts +210 -0
  156. package/dist/lib/rational.js +233 -0
  157. package/dist/lib/rational.js.map +1 -0
  158. package/dist/lib/software-resample-context.d.ts +572 -0
  159. package/dist/lib/software-resample-context.js +610 -0
  160. package/dist/lib/software-resample-context.js.map +1 -0
  161. package/dist/lib/software-scale-context.d.ts +290 -0
  162. package/dist/lib/software-scale-context.js +308 -0
  163. package/dist/lib/software-scale-context.js.map +1 -0
  164. package/dist/lib/stream.d.ts +322 -0
  165. package/dist/lib/stream.js +408 -0
  166. package/dist/lib/stream.js.map +1 -0
  167. package/dist/lib/types.d.ts +59 -0
  168. package/dist/lib/types.js +8 -0
  169. package/dist/lib/types.js.map +1 -0
  170. package/dist/lib/utilities.d.ts +346 -0
  171. package/dist/lib/utilities.js +424 -0
  172. package/dist/lib/utilities.js.map +1 -0
  173. package/install/check.js +113 -0
  174. package/install/ffmpeg.js +163 -0
  175. package/package.json +107 -0
@@ -0,0 +1,719 @@
1
+ import type { AVDictFlag, AVFilterCmdFlag, AVFilterConstants, AVFilterFlag, AVFrameSideDataType, AVHWDeviceType, AVHWFrameTransferDirection, AVIOFlag, AVOptionFlag, AVOptionType, AVPacketSideDataType, AVPixelFormat, AVSeekFlag, AVSeekWhence, SWSFlag } from './constants.js';
2
+ /**
3
+ * Native FFmpeg Binding Type Definitions
4
+ * =======================================
5
+ *
6
+ * This file contains all TypeScript interfaces for the native C++ FFmpeg bindings.
7
+ * These interfaces represent the exact API surface exposed by the C++ layer.
8
+ *
9
+ * IMPORTANT:
10
+ * - These are internal interfaces - users should use the wrapper classes in lib/
11
+ * - All interfaces map 1:1 to C++ binding implementations
12
+ * - Properties marked as readonly only have getters in C++
13
+ * - Resource-owning classes provide both free() and Symbol.dispose for cleanup
14
+ *
15
+ * @internal
16
+ * @packageDocumentation
17
+ */
18
+ import type { AVChromaLocation, AVCodecCap, AVCodecFlag, AVCodecFlag2, AVCodecID, AVColorPrimaries, AVColorRange, AVColorSpace, AVColorTransferCharacteristic, AVDiscard, AVDisposition, AVFormatFlag, AVMediaType, AVPacketFlag, AVPictureType, AVProfile, AVSampleFormat, AVStreamEventFlag } from './constants.js';
19
+ import type { ChannelLayout, CodecProfile, FilterPad, IRational } from './types.js';
20
+ /**
21
+ * Native AVPacket binding interface
22
+ *
23
+ * Represents compressed audio/video data.
24
+ * Must be allocated before use and properly disposed after.
25
+ *
26
+ * @internal
27
+ */
28
+ export interface NativePacket extends Disposable {
29
+ readonly __brand: 'NativePacket';
30
+ alloc(): void;
31
+ free(): void;
32
+ ref(src: NativePacket): number;
33
+ unref(): void;
34
+ clone(): NativePacket | null;
35
+ rescaleTs(srcTb: IRational, dstTb: IRational): void;
36
+ makeRefcounted(): number;
37
+ makeWritable(): number;
38
+ streamIndex: number;
39
+ pts: bigint;
40
+ dts: bigint;
41
+ duration: bigint;
42
+ pos: bigint;
43
+ readonly size: number;
44
+ flags: AVPacketFlag;
45
+ data: Buffer | null;
46
+ isKeyframe: boolean;
47
+ getSideData(type: AVPacketSideDataType): Buffer | null;
48
+ addSideData(type: AVPacketSideDataType, data: Buffer): number;
49
+ newSideData(type: AVPacketSideDataType, size: number): Buffer;
50
+ freeSideData(): void;
51
+ [Symbol.dispose](): void;
52
+ }
53
+ /**
54
+ * Native AVFrame binding interface
55
+ *
56
+ * Represents uncompressed audio/video data.
57
+ * Must be allocated before use and properly disposed after.
58
+ *
59
+ * @internal
60
+ */
61
+ export interface NativeFrame extends Disposable {
62
+ readonly __brand: 'NativeFrame';
63
+ alloc(): void;
64
+ free(): void;
65
+ ref(src: NativeFrame): number;
66
+ unref(): void;
67
+ clone(): NativeFrame | null;
68
+ getBuffer(align?: number): number;
69
+ allocBuffer(): number;
70
+ makeWritable(): number;
71
+ copyProps(src: NativeFrame): number;
72
+ copy(src: NativeFrame): number;
73
+ format: AVPixelFormat | AVSampleFormat;
74
+ width: number;
75
+ height: number;
76
+ nbSamples: number;
77
+ pts: bigint;
78
+ pktDts: bigint;
79
+ bestEffortTimestamp: bigint;
80
+ timeBase: IRational;
81
+ keyFrame: number;
82
+ pictType: AVPictureType;
83
+ sampleAspectRatio: IRational;
84
+ sampleRate: number;
85
+ channelLayout: ChannelLayout;
86
+ readonly channels: number;
87
+ readonly linesize: number[];
88
+ colorRange: AVColorRange;
89
+ colorPrimaries: AVColorPrimaries;
90
+ colorTrc: AVColorTransferCharacteristic;
91
+ colorSpace: AVColorSpace;
92
+ chromaLocation: AVChromaLocation;
93
+ readonly data: Buffer[] | null;
94
+ readonly extendedData: Buffer[] | null;
95
+ hwFramesCtx: NativeHardwareFramesContext | null;
96
+ hwframeTransferData(dst: NativeFrame, flags?: number): Promise<number>;
97
+ isHwFrame(): boolean;
98
+ isSwFrame(): boolean;
99
+ readonly isWritable: boolean;
100
+ getSideData(type: AVFrameSideDataType): Buffer | null;
101
+ newSideData(type: AVFrameSideDataType, size: number): Buffer;
102
+ removeSideData(type: AVFrameSideDataType): void;
103
+ [Symbol.dispose](): void;
104
+ }
105
+ /**
106
+ * Native AVCodec binding interface
107
+ *
108
+ * Represents a codec (encoder or decoder) definition.
109
+ * This is an immutable descriptor - actual encoding/decoding happens via CodecContext.
110
+ *
111
+ * @internal
112
+ */
113
+ export interface NativeCodec {
114
+ readonly __brand: 'NativeCodec';
115
+ readonly name: string | null;
116
+ readonly longName: string | null;
117
+ readonly type: AVMediaType;
118
+ readonly id: AVCodecID;
119
+ readonly capabilities: AVCodecCap;
120
+ readonly maxLowres: number;
121
+ readonly profiles: CodecProfile[] | null;
122
+ readonly wrapper: string | null;
123
+ readonly supportedFramerates: IRational[] | null;
124
+ readonly pixelFormats: AVPixelFormat[] | null;
125
+ readonly supportedSamplerates: number[] | null;
126
+ readonly sampleFormats: AVSampleFormat[] | null;
127
+ readonly channelLayouts: ChannelLayout[] | null;
128
+ isEncoder(): boolean;
129
+ isDecoder(): boolean;
130
+ isExperimental(): boolean;
131
+ getHwConfig(index: number): {
132
+ pixFmt: AVPixelFormat;
133
+ methods: number;
134
+ deviceType: AVHWDeviceType;
135
+ } | null;
136
+ }
137
+ /**
138
+ * Native AVCodecContext binding interface
139
+ *
140
+ * The main interface for encoding and decoding operations.
141
+ * Must be opened before use and properly disposed after.
142
+ *
143
+ * @internal
144
+ */
145
+ export interface NativeCodecContext extends Disposable {
146
+ readonly __brand: 'NativeCodecContext';
147
+ allocContext3(codec?: NativeCodec | null): void;
148
+ freeContext(): void;
149
+ open2(codec?: NativeCodec | null, options?: NativeDictionary | null): Promise<number>;
150
+ close(): number;
151
+ parametersToContext(params: NativeCodecParameters): number;
152
+ parametersFromContext(params: NativeCodecParameters): number;
153
+ flushBuffers(): void;
154
+ sendPacket(packet: NativePacket | null): Promise<number>;
155
+ receiveFrame(frame: NativeFrame): Promise<number>;
156
+ sendFrame(frame: NativeFrame | null): Promise<number>;
157
+ receivePacket(packet: NativePacket): Promise<number>;
158
+ codecType: AVMediaType;
159
+ codecId: AVCodecID;
160
+ bitRate: bigint;
161
+ timeBase: IRational;
162
+ pktTimebase: IRational;
163
+ readonly delay: number;
164
+ flags: AVCodecFlag;
165
+ flags2: AVCodecFlag2;
166
+ extraData: Buffer | null;
167
+ profile: AVProfile;
168
+ level: number;
169
+ threadCount: number;
170
+ width: number;
171
+ height: number;
172
+ gopSize: number;
173
+ pixelFormat: AVPixelFormat;
174
+ maxBFrames: number;
175
+ mbDecision: number;
176
+ readonly hasBFrames: number;
177
+ sampleAspectRatio: IRational;
178
+ framerate: IRational;
179
+ colorRange: AVColorRange;
180
+ colorPrimaries: AVColorPrimaries;
181
+ colorTrc: AVColorTransferCharacteristic;
182
+ colorSpace: AVColorSpace;
183
+ chromaLocation: AVChromaLocation;
184
+ sampleRate: number;
185
+ channels: number;
186
+ sampleFormat: AVSampleFormat;
187
+ frameSize: number;
188
+ readonly frameNumber: number;
189
+ channelLayout: ChannelLayout;
190
+ qMin: number;
191
+ qMax: number;
192
+ rcBufferSize: number;
193
+ rcMaxRate: bigint;
194
+ rcMinRate: bigint;
195
+ hwDeviceCtx: NativeHardwareDeviceContext | null;
196
+ hwFramesCtx: NativeHardwareFramesContext | null;
197
+ setHardwarePixelFormat(hwFormat: AVPixelFormat, swFormat?: AVPixelFormat): void;
198
+ readonly isOpen: boolean;
199
+ [Symbol.dispose](): void;
200
+ }
201
+ /**
202
+ * Native AVCodecParserContext binding interface
203
+ *
204
+ * Parser for splitting elementary streams into frames.
205
+ * Used when decoding raw streams without a container.
206
+ *
207
+ * @internal
208
+ */
209
+ export interface NativeCodecParser {
210
+ readonly __brand: 'NativeCodecParser';
211
+ init(codecId: AVCodecID): void;
212
+ parse2(codecContext: NativeCodecContext, packet: NativePacket, data: Buffer, pts: bigint, dts: bigint, pos: number): number;
213
+ close(): void;
214
+ }
215
+ /**
216
+ * Native AVCodecParameters binding interface
217
+ *
218
+ * This struct describes the properties of an encoded stream.
219
+ * All fields are read/write.
220
+ *
221
+ * @internal
222
+ */
223
+ export interface NativeCodecParameters extends Disposable {
224
+ readonly __brand: 'NativeCodecParameters';
225
+ alloc(): void;
226
+ free(): void;
227
+ copy(dst: NativeCodecParameters): number;
228
+ fromContext(codecContext: NativeCodecContext): number;
229
+ toContext(codecContext: NativeCodecContext): number;
230
+ codecType: AVMediaType;
231
+ codecId: AVCodecID;
232
+ codecTag: number;
233
+ extradata: Buffer | null;
234
+ readonly extradataSize: number;
235
+ format: AVPixelFormat | AVSampleFormat;
236
+ bitRate: bigint;
237
+ profile: AVProfile;
238
+ level: number;
239
+ width: number;
240
+ height: number;
241
+ sampleAspectRatio: IRational;
242
+ frameRate: IRational;
243
+ colorRange: AVColorRange;
244
+ colorPrimaries: AVColorPrimaries;
245
+ colorTrc: AVColorTransferCharacteristic;
246
+ colorSpace: AVColorSpace;
247
+ chromaLocation: AVChromaLocation;
248
+ channelLayout: ChannelLayout;
249
+ channels: number;
250
+ sampleRate: number;
251
+ [Symbol.dispose](): void;
252
+ }
253
+ /**
254
+ * Native AVDictionary binding interface
255
+ *
256
+ * Key-value store for options and metadata.
257
+ * Used throughout FFmpeg for configuration and metadata.
258
+ * Direct mapping to FFmpeg's AVDictionary.
259
+ *
260
+ * @internal
261
+ */
262
+ export interface NativeDictionary extends Disposable {
263
+ readonly __brand: 'NativeDictionary';
264
+ alloc(): void;
265
+ free(): void;
266
+ copy(dst: NativeDictionary, flags: AVDictFlag): number;
267
+ set(key: string, value: string, flags: AVDictFlag): number;
268
+ get(key: string, flags: AVDictFlag): string | null;
269
+ count(): number;
270
+ getAll(): Record<string, string>;
271
+ parseString(str: string, keyValSep: string, pairsSep: string, flags: AVDictFlag): number;
272
+ getString(keyValSep: string, pairsSep: string): string | null;
273
+ [Symbol.dispose](): void;
274
+ }
275
+ /**
276
+ * Native AVIOContext binding interface
277
+ *
278
+ * Bytestream I/O context for custom I/O.
279
+ * Used for reading/writing data from/to files, network, memory, etc.
280
+ *
281
+ * @internal
282
+ */
283
+ export interface NativeIOContext extends AsyncDisposable {
284
+ readonly __brand: 'NativeIOContext';
285
+ allocContext(bufferSize: number, writeFlag: number): void;
286
+ allocContextWithCallbacks(bufferSize: number, writeFlag: 0 | 1, readCallback?: (size: number) => Buffer | null | number, writeCallback?: (buffer: Buffer) => number | void, seekCallback?: (offset: bigint, whence: AVSeekWhence) => bigint | number): void;
287
+ freeContext(): void;
288
+ open2(url: string, flags: AVIOFlag): Promise<number>;
289
+ closep(): Promise<number>;
290
+ read(size: number): Promise<Buffer | number>;
291
+ write(buffer: Buffer): Promise<void>;
292
+ seek(offset: bigint, whence: AVSeekWhence): Promise<bigint>;
293
+ size(): Promise<bigint>;
294
+ flush(): Promise<void>;
295
+ skip(offset: bigint): Promise<bigint>;
296
+ tell(): bigint;
297
+ readonly eof: boolean;
298
+ readonly error: number;
299
+ readonly seekable: number;
300
+ maxPacketSize: number;
301
+ direct: number;
302
+ readonly pos: bigint;
303
+ readonly bufferSize: number;
304
+ readonly writeFlag: boolean;
305
+ [Symbol.asyncDispose](): Promise<void>;
306
+ }
307
+ /**
308
+ * Native AVInputFormat binding interface
309
+ *
310
+ * Demuxer definition.
311
+ * Describes a supported input container format.
312
+ *
313
+ * @internal
314
+ */
315
+ export interface NativeInputFormat {
316
+ readonly __brand: 'NativeInputFormat';
317
+ readonly name: string | null;
318
+ readonly longName: string | null;
319
+ readonly extensions: string | null;
320
+ readonly mimeType: string | null;
321
+ readonly flags: AVFormatFlag;
322
+ }
323
+ /**
324
+ * Native AVOutputFormat binding interface
325
+ *
326
+ * Muxer definition.
327
+ * Describes a supported output container format.
328
+ *
329
+ * @internal
330
+ */
331
+ export interface NativeOutputFormat {
332
+ readonly __brand: 'NativeOutputFormat';
333
+ readonly name: string | null;
334
+ readonly longName: string | null;
335
+ readonly extensions: string | null;
336
+ readonly mimeType: string | null;
337
+ readonly audioCodec: AVCodecID;
338
+ readonly videoCodec: AVCodecID;
339
+ readonly subtitleCodec: AVCodecID;
340
+ readonly flags: AVFormatFlag;
341
+ }
342
+ /**
343
+ * Native AVStream binding interface
344
+ *
345
+ * Stream structure.
346
+ * Contains information about one stream in a format context.
347
+ * Note: Streams are created and managed by FormatContext - no lifecycle methods.
348
+ *
349
+ * @internal
350
+ */
351
+ export interface NativeStream {
352
+ readonly __brand: 'NativeStream';
353
+ readonly index: number;
354
+ id: number;
355
+ codecpar: NativeCodecParameters;
356
+ timeBase: IRational;
357
+ startTime: bigint;
358
+ duration: bigint;
359
+ nbFrames: bigint;
360
+ disposition: AVDisposition;
361
+ discard: AVDiscard;
362
+ sampleAspectRatio: IRational;
363
+ avgFrameRate: IRational;
364
+ rFrameRate: IRational;
365
+ metadata: NativeDictionary | null;
366
+ readonly attachedPic: NativePacket | null;
367
+ eventFlags: AVStreamEventFlag;
368
+ }
369
+ /**
370
+ * Native AVFormatContext binding interface
371
+ *
372
+ * Main interface for demuxing and muxing operations.
373
+ * Must be allocated before use and properly disposed after.
374
+ *
375
+ * @internal
376
+ */
377
+ export interface NativeFormatContext extends AsyncDisposable {
378
+ readonly __brand: 'NativeFormatContext';
379
+ allocContext(): void;
380
+ allocOutputContext2(oformat: NativeOutputFormat | null, formatName: string | null, filename: string | null): number;
381
+ freeContext(): void;
382
+ openInput(url: string, fmt: NativeInputFormat | null, options: NativeDictionary | null): Promise<number>;
383
+ closeInput(): Promise<void>;
384
+ findStreamInfo(options: NativeDictionary[] | null): Promise<number>;
385
+ readFrame(pkt: NativePacket): Promise<number>;
386
+ seekFrame(streamIndex: number, timestamp: bigint, flags: AVSeekFlag): Promise<number>;
387
+ seekFile(streamIndex: number, minTs: bigint, ts: bigint, maxTs: bigint, flags: AVSeekFlag): Promise<number>;
388
+ openOutput(): Promise<number>;
389
+ closeOutput(): Promise<void>;
390
+ writeHeader(options: NativeDictionary | null): Promise<number>;
391
+ writeFrame(pkt: NativePacket | null): Promise<number>;
392
+ interleavedWriteFrame(pkt: NativePacket | null): Promise<number>;
393
+ writeTrailer(): Promise<number>;
394
+ flush(): void;
395
+ newStream(c: NativeCodec | null): NativeStream;
396
+ dumpFormat(index: number, url: string, isOutput: boolean): void;
397
+ findBestStream(type: AVMediaType, wantedStreamNb: number, relatedStream: number, wantDecoder: boolean, flags: number): number | {
398
+ streamIndex: number;
399
+ decoder: NativeCodec | null;
400
+ };
401
+ url: string | null;
402
+ readonly startTime: bigint;
403
+ readonly duration: bigint;
404
+ readonly bitRate: bigint;
405
+ flags: AVFormatFlag;
406
+ probesize: bigint;
407
+ maxAnalyzeDuration: bigint;
408
+ metadata: NativeDictionary | null;
409
+ readonly iformat: NativeInputFormat | null;
410
+ oformat: NativeOutputFormat | null;
411
+ pb: NativeIOContext | null;
412
+ readonly nbStreams: number;
413
+ readonly streams: NativeStream[] | null;
414
+ strictStdCompliance: number;
415
+ maxStreams: number;
416
+ [Symbol.dispose](): void;
417
+ }
418
+ /**
419
+ * Native FFmpegError binding interface
420
+ *
421
+ * Provides error code translation and string representation.
422
+ * Maps FFmpeg error codes to human-readable messages.
423
+ */
424
+ export interface NativeFFmpegError {
425
+ readonly code: number;
426
+ readonly message: string;
427
+ }
428
+ /**
429
+ * Native AudioFifo binding interface
430
+ *
431
+ * Audio FIFO buffer for sample storage and buffering.
432
+ * Provides thread-safe audio sample buffering with automatic reallocation.
433
+ *
434
+ * @internal
435
+ */
436
+ export interface NativeAudioFifo extends Disposable {
437
+ readonly __brand: 'NativeAudioFifo';
438
+ alloc(sampleFmt: AVSampleFormat, channels: number, nbSamples: number): void;
439
+ free(): void;
440
+ write(data: Buffer | Buffer[], nbSamples: number): Promise<number>;
441
+ read(data: Buffer | Buffer[], nbSamples: number): Promise<number>;
442
+ peek(data: Buffer | Buffer[], nbSamples: number): Promise<number>;
443
+ drain(nbSamples: number): void;
444
+ reset(): void;
445
+ realloc(nbSamples: number): number;
446
+ readonly size: number;
447
+ readonly space: number;
448
+ }
449
+ /**
450
+ * Native SwsContext binding interface
451
+ *
452
+ * Software scaling and format conversion context.
453
+ * Provides pixel format conversion and image scaling capabilities.
454
+ *
455
+ * @internal
456
+ */
457
+ export interface NativeSoftwareScaleContext extends Disposable {
458
+ readonly __brand: 'NativeSoftwareScaleContext';
459
+ allocContext(): void;
460
+ getContext(srcW: number, srcH: number, srcFormat: AVPixelFormat, dstW: number, dstH: number, dstFormat: AVPixelFormat, flags: SWSFlag): void;
461
+ initContext(): number;
462
+ freeContext(): void;
463
+ scale(srcSlice: Buffer[], srcStride: number[], srcSliceY: number, srcSliceH: number, dst: Buffer[], dstStride: number[]): Promise<number>;
464
+ scaleFrame(dst: NativeFrame, src: NativeFrame): Promise<number>;
465
+ [Symbol.dispose](): void;
466
+ }
467
+ /**
468
+ * Native SwrContext binding interface
469
+ *
470
+ * Audio resampling, sample format conversion and mixing context.
471
+ * Provides audio format conversion, resampling and channel remapping.
472
+ *
473
+ * @internal
474
+ */
475
+ export interface NativeSoftwareResampleContext extends Disposable {
476
+ readonly __brand: 'NativeSoftwareResampleContext';
477
+ alloc(): void;
478
+ allocSetOpts2(outChLayout: ChannelLayout, outSampleFmt: AVSampleFormat, outSampleRate: number, inChLayout: ChannelLayout, inSampleFmt: AVSampleFormat, inSampleRate: number): number;
479
+ init(): number;
480
+ free(): void;
481
+ close(): void;
482
+ convert(outBuffer: Buffer[] | null, outCount: number, inBuffer: Buffer[] | null, inCount: number): Promise<number>;
483
+ convertFrame(outFrame: NativeFrame | null, inFrame: NativeFrame | null): number;
484
+ configFrame(outFrame: NativeFrame | null, inFrame: NativeFrame | null): number;
485
+ isInitialized(): boolean;
486
+ getDelay(base: bigint): bigint;
487
+ getOutSamples(inSamples: number): number;
488
+ nextPts(pts: bigint): bigint;
489
+ setCompensation(sampleDelta: number, compensationDistance: number): number;
490
+ setChannelMapping(channelMap: number[]): number;
491
+ setMatrix(matrix: number[], stride: number): number;
492
+ dropOutput(count: number): number;
493
+ injectSilence(count: number): number;
494
+ [Symbol.dispose](): void;
495
+ }
496
+ /**
497
+ * Native AVFilter binding interface
498
+ *
499
+ * Represents a filter definition (e.g., "scale", "overlay", etc.).
500
+ * Filters are static definitions - actual processing happens via FilterContext.
501
+ *
502
+ * @internal
503
+ */
504
+ export interface NativeFilter {
505
+ readonly __brand: 'NativeFilter';
506
+ readonly name: string | null;
507
+ readonly description: string | null;
508
+ readonly inputs: FilterPad[];
509
+ readonly outputs: FilterPad[];
510
+ readonly flags: AVFilterFlag;
511
+ }
512
+ /**
513
+ * Native AVFilterContext binding interface
514
+ *
515
+ * An instance of a filter in a filter graph.
516
+ * Must be created through FilterGraph.createFilter() and properly disposed after.
517
+ *
518
+ * @internal
519
+ */
520
+ export interface NativeFilterContext extends Disposable {
521
+ readonly __brand: 'NativeFilterContext';
522
+ init(options?: NativeDictionary | null): number;
523
+ initStr(args?: string | null): number;
524
+ link(srcPad: number, dst: NativeFilterContext, dstPad: number): number;
525
+ unlink(pad: number): void;
526
+ buffersrcAddFrame(frame: NativeFrame | null): Promise<number>;
527
+ buffersrcParametersSet(params: {
528
+ width?: number;
529
+ height?: number;
530
+ format?: number;
531
+ timeBase?: IRational;
532
+ frameRate?: IRational;
533
+ sampleAspectRatio?: IRational;
534
+ hwFramesCtx?: NativeHardwareFramesContext | null;
535
+ sampleRate?: number;
536
+ channelLayout?: bigint;
537
+ }): number;
538
+ buffersinkGetFrame(frame: NativeFrame): Promise<number>;
539
+ buffersinkGetTimeBase(): {
540
+ num: number;
541
+ den: number;
542
+ };
543
+ free(): void;
544
+ name: string | null;
545
+ readonly filter: NativeFilter | null;
546
+ readonly graph: NativeFilterGraph | null;
547
+ readonly nbInputs: number;
548
+ readonly nbOutputs: number;
549
+ readonly ready: number;
550
+ hwDeviceCtx: NativeHardwareDeviceContext | null;
551
+ [Symbol.dispose](): void;
552
+ }
553
+ /**
554
+ * Native AVFilterGraph binding interface
555
+ *
556
+ * Container for all filters and their connections.
557
+ * Must be allocated before use and properly disposed after.
558
+ *
559
+ * @internal
560
+ */
561
+ export interface NativeFilterGraph extends Disposable {
562
+ readonly __brand: 'NativeFilterGraph';
563
+ alloc(): void;
564
+ free(): void;
565
+ createFilter(filter: NativeFilter, name: string, args?: string | null): NativeFilterContext | null;
566
+ allocFilter(filter: NativeFilter, name: string): NativeFilterContext | null;
567
+ getFilter(name: string): NativeFilterContext | null;
568
+ config(): Promise<number>;
569
+ parse(filters: string, inputs: NativeFilterInOut | null, outputs: NativeFilterInOut | null): number;
570
+ parse2(filters: string): number;
571
+ parsePtr(filters: string, inputs?: NativeFilterInOut | null, outputs?: NativeFilterInOut | null): number;
572
+ validate(): number;
573
+ requestOldest(): Promise<number>;
574
+ dump(): string | null;
575
+ sendCommand(target: string, cmd: string, arg: string, flags?: AVFilterCmdFlag): number | {
576
+ response: string | null;
577
+ };
578
+ queueCommand(target: string, cmd: string, arg: string, ts: number, flags?: AVFilterCmdFlag): number;
579
+ readonly nbFilters: number;
580
+ readonly filters: NativeFilterContext[] | null;
581
+ threadType: AVFilterConstants;
582
+ nbThreads: number;
583
+ scaleSwsOpts: string | null;
584
+ [Symbol.dispose](): void;
585
+ }
586
+ /**
587
+ * Native AVFilterInOut binding interface
588
+ *
589
+ * Helper structure for parsing filter graphs.
590
+ * Used with FilterGraph.parse() to define inputs/outputs.
591
+ *
592
+ * @internal
593
+ */
594
+ export interface NativeFilterInOut extends Disposable {
595
+ readonly __brand: 'NativeFilterInOut';
596
+ alloc(): void;
597
+ free(): void;
598
+ name: string | null;
599
+ filterCtx: NativeFilterContext | null;
600
+ padIdx: number;
601
+ next: NativeFilterInOut | null;
602
+ [Symbol.dispose](): void;
603
+ }
604
+ /**
605
+ * Native AVHWDeviceContext binding interface
606
+ *
607
+ * Hardware device context for hardware acceleration.
608
+ * Direct mapping to FFmpeg's AVHWDeviceContext.
609
+ */
610
+ export interface NativeHardwareDeviceContext extends Disposable {
611
+ readonly __brand: 'NativeHardwareDeviceContext';
612
+ alloc(type: AVHWDeviceType): void;
613
+ init(): number;
614
+ create(type: AVHWDeviceType, device: string | null, options: any | null): number;
615
+ createDerived(source: NativeHardwareDeviceContext, type: AVHWDeviceType): number;
616
+ hwconfigAlloc(): bigint | null;
617
+ getHwframeConstraints(hwconfig?: bigint): {
618
+ validHwFormats?: AVPixelFormat[];
619
+ validSwFormats?: AVPixelFormat[];
620
+ minWidth: number;
621
+ minHeight: number;
622
+ maxWidth: number;
623
+ maxHeight: number;
624
+ } | null;
625
+ free(): void;
626
+ readonly type: AVHWDeviceType;
627
+ readonly hwctx: bigint | null;
628
+ [Symbol.dispose](): void;
629
+ }
630
+ /**
631
+ * Native AVHWFramesContext binding interface
632
+ *
633
+ * Hardware frames context for hardware acceleration.
634
+ * Direct mapping to FFmpeg's AVHWFramesContext.
635
+ */
636
+ export interface NativeHardwareFramesContext extends Disposable {
637
+ readonly __brand: 'NativeHardwareFramesContext';
638
+ alloc(device: NativeHardwareDeviceContext): void;
639
+ init(): number;
640
+ getBuffer(frame: NativeFrame, flags?: number): number;
641
+ transferData(dst: NativeFrame, src: NativeFrame, flags?: number): Promise<number>;
642
+ transferGetFormats(direction: AVHWFrameTransferDirection): AVPixelFormat[] | number;
643
+ map(dst: NativeFrame, src: NativeFrame, flags?: number): number;
644
+ createDerived(format: AVPixelFormat, derivedDevice: NativeHardwareDeviceContext, source: NativeHardwareFramesContext, flags?: number): number;
645
+ free(): void;
646
+ format: AVPixelFormat;
647
+ swFormat: AVPixelFormat;
648
+ width: number;
649
+ height: number;
650
+ initialPoolSize: number;
651
+ readonly deviceRef: NativeHardwareDeviceContext | null;
652
+ [Symbol.dispose](): void;
653
+ }
654
+ /**
655
+ * Native BitStreamFilter (avcodec)
656
+ * @internal
657
+ */
658
+ export interface NativeBitStreamFilter {
659
+ readonly __brand: 'NativeBitStreamFilter';
660
+ readonly name: string | null;
661
+ readonly codecIds: number[] | null;
662
+ }
663
+ /**
664
+ * Native BitStreamFilterContext (avcodec)
665
+ * @internal
666
+ */
667
+ export interface NativeBitStreamFilterContext extends Disposable {
668
+ readonly __brand: 'NativeBitStreamFilterContext';
669
+ alloc(filter: NativeBitStreamFilter): number;
670
+ init(): number;
671
+ free(): void;
672
+ flush(): void;
673
+ sendPacket(packet: NativePacket | null): Promise<number>;
674
+ receivePacket(packet: NativePacket): Promise<number>;
675
+ isInitialized(): boolean;
676
+ readonly inputCodecParameters: NativeCodecParameters | null;
677
+ readonly outputCodecParameters: NativeCodecParameters | null;
678
+ inputTimeBase: IRational;
679
+ readonly outputTimeBase: IRational | null;
680
+ readonly filter: NativeBitStreamFilter | null;
681
+ [Symbol.dispose](): void;
682
+ }
683
+ /**
684
+ * Native Log binding interface
685
+ *
686
+ * Static-only class for controlling FFmpeg's logging.
687
+ * Direct mapping to av_log functions.
688
+ *
689
+ * @internal
690
+ */
691
+ export interface NativeLog {
692
+ readonly __brand: 'NativeLog';
693
+ }
694
+ /**
695
+ * Native AVOption
696
+ *
697
+ * Represents a single option metadata from FFmpeg's AVOption system.
698
+ * Retrieved via Option.next() or Option.find().
699
+ *
700
+ * @internal
701
+ */
702
+ export interface NativeOption {
703
+ readonly __brand: 'NativeOption';
704
+ readonly name: string | null;
705
+ readonly help: string | null;
706
+ readonly type: AVOptionType;
707
+ readonly defaultValue: unknown;
708
+ readonly min: number;
709
+ readonly max: number;
710
+ readonly flags: AVOptionFlag;
711
+ readonly unit: string | null;
712
+ }
713
+ /**
714
+ * Interface for classes that wrap native objects
715
+ * @internal
716
+ */
717
+ export interface NativeWrapper<T> {
718
+ getNative(): T;
719
+ }