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,408 @@
1
+ import { CodecParameters } from './codec-parameters.js';
2
+ import { Dictionary } from './dictionary.js';
3
+ import { Rational } from './rational.js';
4
+ /**
5
+ * Stream information within a media container.
6
+ *
7
+ * Represents a single stream (video, audio, subtitle, etc.) within a media file.
8
+ * Streams are created and managed by FormatContext and contain all the metadata
9
+ * and parameters needed to decode or encode the stream. Each stream has its own
10
+ * timebase, codec parameters, and metadata.
11
+ *
12
+ * Direct mapping to FFmpeg's AVStream.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * import { FormatContext, FFmpegError } from 'node-av';
17
+ * import { AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO } from 'node-av/constants';
18
+ *
19
+ * // Streams are obtained from FormatContext
20
+ * const formatContext = new FormatContext();
21
+ * const ret = await formatContext.openInput('video.mp4', null, null);
22
+ * FFmpegError.throwIfError(ret, 'openInput');
23
+ *
24
+ * const infoRet = await formatContext.findStreamInfo(null);
25
+ * FFmpegError.throwIfError(infoRet, 'findStreamInfo');
26
+ *
27
+ * // Access streams
28
+ * const streams = formatContext.streams;
29
+ * for (const stream of streams) {
30
+ * console.log(`Stream ${stream.index}: ${stream.codecpar.codecType}`);
31
+ * console.log(`Time base: ${stream.timeBase.num}/${stream.timeBase.den}`);
32
+ *
33
+ * // Direct access to codec parameters
34
+ * const codecpar = stream.codecpar;
35
+ * if (codecpar.codecType === AVMEDIA_TYPE_VIDEO) {
36
+ * console.log(`Video: ${codecpar.width}x${codecpar.height}`);
37
+ * } else if (codecpar.codecType === AVMEDIA_TYPE_AUDIO) {
38
+ * console.log(`Audio: ${codecpar.sampleRate}Hz ${codecpar.channels} channels`);
39
+ * }
40
+ * }
41
+ * ```
42
+ *
43
+ * @see {@link FormatContext} For creating and managing streams
44
+ * @see {@link CodecParameters} For codec-specific stream parameters
45
+ */
46
+ export class Stream {
47
+ native;
48
+ _codecpar; // Cache the wrapped codecpar
49
+ /**
50
+ * Constructor is internal - use FormatContext to create streams.
51
+ *
52
+ * Streams are created and managed by FormatContext.
53
+ * For demuxing, streams are created automatically when opening input.
54
+ * For muxing, use formatContext.newStream() to create streams.
55
+ *
56
+ * @internal
57
+ *
58
+ * @param native - Native AVStream to wrap
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * // Don't create streams directly
63
+ * // const stream = new Stream(); // Wrong
64
+ *
65
+ * // For demuxing: streams are created automatically
66
+ * const streams = formatContext.streams; // Correct
67
+ *
68
+ * // For muxing: use newStream
69
+ * const stream = formatContext.newStream(null); // Correct
70
+ * ```
71
+ */
72
+ constructor(native) {
73
+ this.native = native;
74
+ }
75
+ /**
76
+ * Stream index in the format context.
77
+ *
78
+ * Zero-based index of this stream in the format context's stream array.
79
+ * This is the index used to identify the stream in packets.
80
+ *
81
+ * Direct mapping to AVStream->index
82
+ *
83
+ * @readonly
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * // Find video stream index
88
+ * const videoStreamIndex = streams.findIndex(
89
+ * s => s.codecpar.codecType === AVMEDIA_TYPE_VIDEO
90
+ * );
91
+ *
92
+ * // Check packet's stream
93
+ * if (packet.streamIndex === videoStreamIndex) {
94
+ * // This packet belongs to the video stream
95
+ * }
96
+ * ```
97
+ */
98
+ get index() {
99
+ return this.native.index;
100
+ }
101
+ /**
102
+ * Format-specific stream ID.
103
+ *
104
+ * Stream ID as defined by the container format.
105
+ * Different from index - this is format-specific.
106
+ *
107
+ * Direct mapping to AVStream->id
108
+ *
109
+ * - decoding: Set by libavformat
110
+ * - encoding: Set by the user, replaced by libavformat if left unset
111
+ */
112
+ get id() {
113
+ return this.native.id;
114
+ }
115
+ set id(value) {
116
+ this.native.id = value;
117
+ }
118
+ /**
119
+ * Codec parameters associated with this stream.
120
+ *
121
+ * Contains all the parameters needed to set up a codec for this stream,
122
+ * including codec ID, dimensions for video, sample rate for audio, etc.
123
+ *
124
+ * Direct mapping to AVStream->codecpar
125
+ *
126
+ * - demuxing: Filled by libavformat on stream creation or in findStreamInfo()
127
+ * - muxing: Must be filled by the caller before writeHeader()
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * // For video stream
132
+ * stream.codecpar.codecType = AVMEDIA_TYPE_VIDEO;
133
+ * stream.codecpar.codecId = AV_CODEC_ID_H264;
134
+ * stream.codecpar.width = 1920;
135
+ * stream.codecpar.height = 1080;
136
+ *
137
+ * // For audio stream
138
+ * stream.codecpar.codecType = AVMEDIA_TYPE_AUDIO;
139
+ * stream.codecpar.codecId = AV_CODEC_ID_AAC;
140
+ * stream.codecpar.sampleRate = 48000;
141
+ * stream.codecpar.channels = 2;
142
+ * ```
143
+ *
144
+ * @see {@link CodecParameters} For detailed parameter documentation
145
+ */
146
+ get codecpar() {
147
+ // Return cached wrapper if we already have one
148
+ if (this._codecpar) {
149
+ return this._codecpar;
150
+ }
151
+ // Create and cache the wrapper
152
+ const params = Object.create(CodecParameters.prototype);
153
+ params.native = this.native.codecpar;
154
+ this._codecpar = params;
155
+ return params;
156
+ }
157
+ set codecpar(value) {
158
+ // Copy codec parameters to the stream
159
+ // The native binding handles the copying
160
+ this.native.codecpar = value.getNative();
161
+ // Clear the cache as the underlying parameters have changed
162
+ this._codecpar = undefined;
163
+ }
164
+ /**
165
+ * Time base for this stream.
166
+ *
167
+ * The fundamental unit of time (in seconds) in terms of which frame
168
+ * timestamps are represented. For example, a time base of 1/25 means
169
+ * each time unit is 1/25 of a second (40ms).
170
+ *
171
+ * Direct mapping to AVStream->time_base
172
+ *
173
+ * - decoding: Set by libavformat
174
+ * - encoding: May be set before writeHeader() as a hint to the muxer.
175
+ * The muxer will overwrite with the actual timebase used.
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * import { Rational } from 'node-av';
180
+ *
181
+ * // Common time bases
182
+ * stream.timeBase = new Rational(1, 90000); // 90kHz (MPEG-TS)
183
+ * stream.timeBase = new Rational(1, 1000); // milliseconds
184
+ * stream.timeBase = new Rational(1, 25); // 25 fps video
185
+ *
186
+ * // Convert PTS to seconds
187
+ * const pts = 45000n;
188
+ * const seconds = Number(pts) * stream.timeBase.toDouble();
189
+ * ```
190
+ *
191
+ * @see {@link Rational} For time base representation
192
+ */
193
+ get timeBase() {
194
+ const tb = this.native.timeBase;
195
+ return new Rational(tb.num, tb.den);
196
+ }
197
+ set timeBase(value) {
198
+ this.native.timeBase = { num: value.num, den: value.den };
199
+ }
200
+ /**
201
+ * Decoding: pts of the first frame of the stream in presentation order, in stream time base.
202
+ *
203
+ * Direct mapping to AVStream->start_time
204
+ *
205
+ * Only set this if you are absolutely 100% sure that the value you set
206
+ * it to really is the pts of the first frame.
207
+ * This may be undefined (AV_NOPTS_VALUE).
208
+ *
209
+ * @note The ASF header does NOT contain a correct start_time the ASF
210
+ * demuxer must NOT set this.
211
+ */
212
+ get startTime() {
213
+ return this.native.startTime;
214
+ }
215
+ set startTime(value) {
216
+ this.native.startTime = value;
217
+ }
218
+ /**
219
+ * Decoding: duration of the stream, in stream time base.
220
+ *
221
+ * Direct mapping to AVStream->duration
222
+ *
223
+ * If a source file does not specify a duration, but does specify
224
+ * a bitrate, this value will be estimated from bitrate and file size.
225
+ *
226
+ * Encoding: May be set by the caller before avformat_write_header() to
227
+ * provide a hint to the muxer about the estimated duration.
228
+ */
229
+ get duration() {
230
+ return this.native.duration;
231
+ }
232
+ set duration(value) {
233
+ this.native.duration = value;
234
+ }
235
+ /**
236
+ * Number of frames in this stream if known or 0.
237
+ *
238
+ * Direct mapping to AVStream->nb_frames
239
+ */
240
+ get nbFrames() {
241
+ return this.native.nbFrames;
242
+ }
243
+ set nbFrames(value) {
244
+ this.native.nbFrames = value;
245
+ }
246
+ /**
247
+ * Stream disposition - a combination of AV_DISPOSITION_* flags.
248
+ *
249
+ * Direct mapping to AVStream->disposition
250
+ *
251
+ * - demuxing: set by libavformat when creating the stream or in
252
+ * avformat_find_stream_info().
253
+ * - muxing: may be set by the caller before avformat_write_header().
254
+ *
255
+ * Common flags:
256
+ * - AV_DISPOSITION_DEFAULT: default track
257
+ * - AV_DISPOSITION_ATTACHED_PIC: stream is an attached picture (album art)
258
+ * - AV_DISPOSITION_CAPTIONS: stream contains captions
259
+ * - AV_DISPOSITION_DESCRIPTIONS: stream contains descriptions
260
+ * - AV_DISPOSITION_METADATA: stream contains metadata
261
+ */
262
+ get disposition() {
263
+ return this.native.disposition;
264
+ }
265
+ set disposition(value) {
266
+ this.native.disposition = value;
267
+ }
268
+ /**
269
+ * Selects which packets can be discarded at will and do not need to be demuxed.
270
+ *
271
+ * Direct mapping to AVStream->discard
272
+ *
273
+ * - AVDISCARD_NONE: discard nothing
274
+ * - AVDISCARD_DEFAULT: discard useless packets like 0 size packets in avi
275
+ * - AVDISCARD_NONREF: discard all non reference
276
+ * - AVDISCARD_BIDIR: discard all bidirectional frames
277
+ * - AVDISCARD_NONINTRA: discard all non intra frames
278
+ * - AVDISCARD_NONKEY: discard all frames except keyframes
279
+ * - AVDISCARD_ALL: discard all
280
+ */
281
+ get discard() {
282
+ return this.native.discard;
283
+ }
284
+ set discard(value) {
285
+ this.native.discard = value;
286
+ }
287
+ /**
288
+ * Sample aspect ratio (0 if unknown).
289
+ *
290
+ * Direct mapping to AVStream->sample_aspect_ratio
291
+ *
292
+ * This is the width of a pixel divided by the height of the pixel.
293
+ * - encoding: Set by user.
294
+ * - decoding: Set by libavformat.
295
+ */
296
+ get sampleAspectRatio() {
297
+ const sar = this.native.sampleAspectRatio;
298
+ return new Rational(sar.num || 0, sar.den || 1);
299
+ }
300
+ set sampleAspectRatio(value) {
301
+ this.native.sampleAspectRatio = { num: value.num, den: value.den };
302
+ }
303
+ /**
304
+ * Average framerate.
305
+ *
306
+ * Direct mapping to AVStream->avg_frame_rate
307
+ *
308
+ * - demuxing: May be set by libavformat when creating the stream or in
309
+ * avformat_find_stream_info().
310
+ * - muxing: May be set by the caller before avformat_write_header().
311
+ */
312
+ get avgFrameRate() {
313
+ const fr = this.native.avgFrameRate;
314
+ // Handle 0/0 case (unknown frame rate in FFmpeg)
315
+ if (fr.den === 0) {
316
+ return new Rational(0, 1);
317
+ }
318
+ return new Rational(fr.num, fr.den);
319
+ }
320
+ set avgFrameRate(value) {
321
+ this.native.avgFrameRate = { num: value.num, den: value.den };
322
+ }
323
+ /**
324
+ * Real base framerate of the stream.
325
+ *
326
+ * Direct mapping to AVStream->r_frame_rate
327
+ *
328
+ * This is the lowest framerate with which all timestamps can be
329
+ * represented accurately (it is the least common multiple of all
330
+ * framerates in the stream). Note, this value is just a guess!
331
+ * For example, if the time base is 1/90000 and all frames have either
332
+ * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.
333
+ */
334
+ get rFrameRate() {
335
+ const fr = this.native.rFrameRate;
336
+ // Handle 0/0 case (unknown frame rate in FFmpeg)
337
+ if (fr.den === 0) {
338
+ return new Rational(0, 1);
339
+ }
340
+ return new Rational(fr.num, fr.den);
341
+ }
342
+ set rFrameRate(value) {
343
+ this.native.rFrameRate = { num: value.num, den: value.den };
344
+ }
345
+ /**
346
+ * Metadata dictionary for this stream.
347
+ *
348
+ * Direct mapping to AVStream->metadata
349
+ *
350
+ * Contains key-value pairs of metadata.
351
+ */
352
+ get metadata() {
353
+ const nativeDict = this.native.metadata;
354
+ if (!nativeDict) {
355
+ return null;
356
+ }
357
+ return Dictionary.fromNative(nativeDict);
358
+ }
359
+ set metadata(value) {
360
+ this.native.metadata = value?.getNative() ?? null;
361
+ }
362
+ /**
363
+ * For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet
364
+ * will contain the attached picture (e.g., album art).
365
+ *
366
+ * Direct mapping to AVStream->attached_pic
367
+ *
368
+ * - decoding: set by libavformat, must not be modified by the caller.
369
+ * - encoding: unused
370
+ * @readonly
371
+ */
372
+ get attachedPic() {
373
+ return this.native.attachedPic;
374
+ }
375
+ /**
376
+ * Flags indicating events happening on the stream, a combination of
377
+ * AVSTREAM_EVENT_FLAG_*.
378
+ *
379
+ * Direct mapping to AVStream->event_flags
380
+ *
381
+ * - demuxing: may be set by the demuxer in avformat_open_input(),
382
+ * avformat_find_stream_info() and av_read_frame(). Flags must be cleared
383
+ * by the user once the event has been handled.
384
+ * - muxing: may be set by the user after avformat_write_header() to
385
+ * indicate a user-triggered event. The muxer will clear the flags for
386
+ * events it has handled in av_[interleaved]_write_frame().
387
+ *
388
+ * Flags:
389
+ * - AVSTREAM_EVENT_FLAG_METADATA_UPDATED: metadata was updated
390
+ * - AVSTREAM_EVENT_FLAG_NEW_PACKETS: new packets were read for this stream
391
+ */
392
+ get eventFlags() {
393
+ return this.native.eventFlags;
394
+ }
395
+ set eventFlags(value) {
396
+ this.native.eventFlags = value;
397
+ }
398
+ /**
399
+ * Get the native FFmpeg AVStream pointer.
400
+ *
401
+ * @internal For use by other wrapper classes
402
+ * @returns The underlying native stream object
403
+ */
404
+ getNative() {
405
+ return this.native;
406
+ }
407
+ }
408
+ //# sourceMappingURL=stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/lib/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAMzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,OAAO,MAAM;IACT,MAAM,CAAe;IACrB,SAAS,CAAmB,CAAC,6BAA6B;IAElE;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM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AG,EAAE,CAAC;IAC9D,CAAC;IAED;;;;;;OAMG;IACH,IAAI,QAAQ;QACV,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACxC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,QAAQ,CAAC,KAAwB;QACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,KAAK,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC;IACpD,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,WAAgC,CAAC;IACtD,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;IAChC,CAAC;IAED,IAAI,UAAU,CAAC,KAAwB;QACrC,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,KAAK,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Common TypeScript type definitions
3
+ *
4
+ * Types that are used across multiple modules but are not
5
+ * directly from FFmpeg constants.
6
+ */
7
+ import type { AVLogLevel, AVMediaType } from './constants.ts';
8
+ /**
9
+ * Rational number (fraction) interface
10
+ * Maps to AVRational in FFmpeg
11
+ * Used for time bases, aspect ratios, frame rates
12
+ */
13
+ export interface IRational {
14
+ /** Numerator */
15
+ num: number;
16
+ /** Denominator */
17
+ den: number;
18
+ }
19
+ /**
20
+ * Audio channel layout description
21
+ * Maps to AVChannelLayout in FFmpeg
22
+ */
23
+ export interface ChannelLayout {
24
+ /** Number of channels */
25
+ nbChannels: number;
26
+ /** Channel order (AVChannelOrder) */
27
+ order: number;
28
+ /** Channel mask for native layouts */
29
+ mask: bigint;
30
+ }
31
+ /**
32
+ * Filter pad information
33
+ */
34
+ export interface FilterPad {
35
+ /** Name of the pad (e.g., "in", "out") */
36
+ name: string | null;
37
+ /** Media type of the pad (e.g., "video", "audio") */
38
+ type: AVMediaType;
39
+ }
40
+ /**
41
+ * Codec profile definition
42
+ */
43
+ export interface CodecProfile {
44
+ /** Profile ID (FF_PROFILE_*) */
45
+ profile: number;
46
+ /** Human-readable profile name */
47
+ name?: string;
48
+ }
49
+ /**
50
+ * Log callback options for performance tuning.
51
+ */
52
+ export interface LogOptions {
53
+ /**
54
+ * Maximum log level to capture.
55
+ * Messages above this level are ignored at the C level for maximum performance.
56
+ * Default: AV_LOG_INFO
57
+ */
58
+ maxLevel?: AVLogLevel;
59
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Common TypeScript type definitions
3
+ *
4
+ * Types that are used across multiple modules but are not
5
+ * directly from FFmpeg constants.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}