node-av 1.0.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/README.md +56 -41
  2. package/dist/api/bitstream-filter.d.ts +180 -123
  3. package/dist/api/bitstream-filter.js +182 -126
  4. package/dist/api/bitstream-filter.js.map +1 -1
  5. package/dist/api/decoder.d.ts +286 -130
  6. package/dist/api/decoder.js +321 -159
  7. package/dist/api/decoder.js.map +1 -1
  8. package/dist/api/encoder.d.ts +254 -158
  9. package/dist/api/encoder.js +326 -298
  10. package/dist/api/encoder.js.map +1 -1
  11. package/dist/api/filter-presets.d.ts +912 -0
  12. package/dist/api/filter-presets.js +1407 -0
  13. package/dist/api/filter-presets.js.map +1 -0
  14. package/dist/api/filter.d.ts +280 -284
  15. package/dist/api/filter.js +435 -509
  16. package/dist/api/filter.js.map +1 -1
  17. package/dist/api/hardware.d.ts +226 -159
  18. package/dist/api/hardware.js +405 -287
  19. package/dist/api/hardware.js.map +1 -1
  20. package/dist/api/index.d.ts +3 -2
  21. package/dist/api/index.js +1 -0
  22. package/dist/api/index.js.map +1 -1
  23. package/dist/api/io-stream.d.ts +65 -61
  24. package/dist/api/io-stream.js +45 -47
  25. package/dist/api/io-stream.js.map +1 -1
  26. package/dist/api/media-input.d.ts +244 -141
  27. package/dist/api/media-input.js +207 -104
  28. package/dist/api/media-input.js.map +1 -1
  29. package/dist/api/media-output.d.ts +206 -128
  30. package/dist/api/media-output.js +212 -129
  31. package/dist/api/media-output.js.map +1 -1
  32. package/dist/api/pipeline.d.ts +168 -38
  33. package/dist/api/pipeline.js +238 -14
  34. package/dist/api/pipeline.js.map +1 -1
  35. package/dist/api/types.d.ts +22 -182
  36. package/dist/api/utilities/audio-sample.d.ts +1 -1
  37. package/dist/api/utilities/image.d.ts +1 -1
  38. package/dist/api/utilities/media-type.d.ts +1 -1
  39. package/dist/api/utilities/pixel-format.d.ts +1 -1
  40. package/dist/api/utilities/sample-format.d.ts +1 -1
  41. package/dist/api/utilities/timestamp.d.ts +1 -1
  42. package/dist/api/utils.d.ts +1 -2
  43. package/dist/api/utils.js +9 -0
  44. package/dist/api/utils.js.map +1 -1
  45. package/dist/{lib → constants}/channel-layouts.d.ts +1 -1
  46. package/dist/constants/channel-layouts.js.map +1 -0
  47. package/dist/{lib → constants}/constants.d.ts +19 -4
  48. package/dist/{lib → constants}/constants.js +15 -1
  49. package/dist/constants/constants.js.map +1 -0
  50. package/dist/constants/decoders.d.ts +609 -0
  51. package/dist/constants/decoders.js +617 -0
  52. package/dist/constants/decoders.js.map +1 -0
  53. package/dist/constants/encoders.d.ts +285 -0
  54. package/dist/constants/encoders.js +298 -0
  55. package/dist/constants/encoders.js.map +1 -0
  56. package/dist/constants/index.d.ts +4 -0
  57. package/dist/constants/index.js +5 -0
  58. package/dist/constants/index.js.map +1 -0
  59. package/dist/index.d.ts +1 -0
  60. package/dist/index.js +2 -0
  61. package/dist/index.js.map +1 -1
  62. package/dist/lib/audio-fifo.d.ts +128 -171
  63. package/dist/lib/audio-fifo.js +130 -173
  64. package/dist/lib/audio-fifo.js.map +1 -1
  65. package/dist/lib/binding.d.ts +7 -5
  66. package/dist/lib/binding.js +5 -0
  67. package/dist/lib/binding.js.map +1 -1
  68. package/dist/lib/bitstream-filter-context.d.ts +139 -184
  69. package/dist/lib/bitstream-filter-context.js +139 -188
  70. package/dist/lib/bitstream-filter-context.js.map +1 -1
  71. package/dist/lib/bitstream-filter.d.ts +69 -55
  72. package/dist/lib/bitstream-filter.js +68 -54
  73. package/dist/lib/bitstream-filter.js.map +1 -1
  74. package/dist/lib/codec-context.d.ts +317 -381
  75. package/dist/lib/codec-context.js +316 -381
  76. package/dist/lib/codec-context.js.map +1 -1
  77. package/dist/lib/codec-parameters.d.ts +161 -171
  78. package/dist/lib/codec-parameters.js +162 -172
  79. package/dist/lib/codec-parameters.js.map +1 -1
  80. package/dist/lib/codec-parser.d.ts +92 -105
  81. package/dist/lib/codec-parser.js +92 -103
  82. package/dist/lib/codec-parser.js.map +1 -1
  83. package/dist/lib/codec.d.ts +328 -217
  84. package/dist/lib/codec.js +392 -218
  85. package/dist/lib/codec.js.map +1 -1
  86. package/dist/lib/dictionary.d.ts +150 -204
  87. package/dist/lib/dictionary.js +159 -213
  88. package/dist/lib/dictionary.js.map +1 -1
  89. package/dist/lib/error.d.ts +97 -131
  90. package/dist/lib/error.js +98 -128
  91. package/dist/lib/error.js.map +1 -1
  92. package/dist/lib/filter-context.d.ts +317 -194
  93. package/dist/lib/filter-context.js +335 -200
  94. package/dist/lib/filter-context.js.map +1 -1
  95. package/dist/lib/filter-graph.d.ts +252 -293
  96. package/dist/lib/filter-graph.js +253 -294
  97. package/dist/lib/filter-graph.js.map +1 -1
  98. package/dist/lib/filter-inout.d.ts +87 -95
  99. package/dist/lib/filter-inout.js +87 -95
  100. package/dist/lib/filter-inout.js.map +1 -1
  101. package/dist/lib/filter.d.ts +93 -111
  102. package/dist/lib/filter.js +94 -112
  103. package/dist/lib/filter.js.map +1 -1
  104. package/dist/lib/format-context.d.ts +321 -429
  105. package/dist/lib/format-context.js +314 -386
  106. package/dist/lib/format-context.js.map +1 -1
  107. package/dist/lib/frame.d.ts +263 -406
  108. package/dist/lib/frame.js +263 -408
  109. package/dist/lib/frame.js.map +1 -1
  110. package/dist/lib/hardware-device-context.d.ts +150 -204
  111. package/dist/lib/hardware-device-context.js +149 -203
  112. package/dist/lib/hardware-device-context.js.map +1 -1
  113. package/dist/lib/hardware-frames-context.d.ts +171 -181
  114. package/dist/lib/hardware-frames-context.js +171 -181
  115. package/dist/lib/hardware-frames-context.js.map +1 -1
  116. package/dist/lib/index.d.ts +2 -3
  117. package/dist/lib/index.js +2 -5
  118. package/dist/lib/index.js.map +1 -1
  119. package/dist/lib/input-format.d.ts +90 -118
  120. package/dist/lib/input-format.js +89 -117
  121. package/dist/lib/input-format.js.map +1 -1
  122. package/dist/lib/io-context.d.ts +210 -242
  123. package/dist/lib/io-context.js +221 -253
  124. package/dist/lib/io-context.js.map +1 -1
  125. package/dist/lib/log.d.ts +86 -120
  126. package/dist/lib/log.js +85 -122
  127. package/dist/lib/log.js.map +1 -1
  128. package/dist/lib/native-types.d.ts +127 -112
  129. package/dist/lib/native-types.js +9 -0
  130. package/dist/lib/native-types.js.map +1 -1
  131. package/dist/lib/option.d.ts +285 -242
  132. package/dist/lib/option.js +310 -250
  133. package/dist/lib/option.js.map +1 -1
  134. package/dist/lib/output-format.d.ts +78 -102
  135. package/dist/lib/output-format.js +77 -101
  136. package/dist/lib/output-format.js.map +1 -1
  137. package/dist/lib/packet.d.ts +173 -241
  138. package/dist/lib/packet.js +172 -241
  139. package/dist/lib/packet.js.map +1 -1
  140. package/dist/lib/rational.d.ts +0 -2
  141. package/dist/lib/rational.js +0 -2
  142. package/dist/lib/rational.js.map +1 -1
  143. package/dist/lib/software-resample-context.d.ts +242 -326
  144. package/dist/lib/software-resample-context.js +242 -326
  145. package/dist/lib/software-resample-context.js.map +1 -1
  146. package/dist/lib/software-scale-context.d.ts +130 -174
  147. package/dist/lib/software-scale-context.js +132 -176
  148. package/dist/lib/software-scale-context.js.map +1 -1
  149. package/dist/lib/stream.d.ts +88 -198
  150. package/dist/lib/stream.js +87 -197
  151. package/dist/lib/stream.js.map +1 -1
  152. package/dist/lib/types.d.ts +1 -1
  153. package/dist/lib/utilities.d.ts +372 -181
  154. package/dist/lib/utilities.js +373 -182
  155. package/dist/lib/utilities.js.map +1 -1
  156. package/install/check.js +0 -1
  157. package/package.json +32 -24
  158. package/release_notes.md +43 -13
  159. package/CHANGELOG.md +0 -8
  160. package/dist/lib/channel-layouts.js.map +0 -1
  161. package/dist/lib/constants.js.map +0 -1
  162. /package/dist/{lib → constants}/channel-layouts.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoders.js","sourceRoot":"","sources":["../../src/constants/encoders.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+BAA+B;AAC/B,MAAM,aAAa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AkC;AAClC,+EAA+E;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAG,KAA0B,CAAC;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAA6B,CAAC;AAC/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAA6B,CAAC;AAC/D,MAAM,CAAC,MAAM,cAAc,GAAG,KAA0B,CAAC;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG,KAA0B,CAAC;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAA6B,CAAC;AAC/D,MAAM,CAAC,MAAM,eAAe,GAAG,MAA2B,CAAC;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAG,MAA2B,CAAC;AAC3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAA6B,CAAC;AAC/D,MAAM,CAAC,MAAM,eAAe,GAAG,MAA2B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './channel-layouts.js';
2
+ export * from './constants.js';
3
+ export * from './decoders.js';
4
+ export * from './encoders.js';
@@ -0,0 +1,5 @@
1
+ export * from './channel-layouts.js';
2
+ export * from './constants.js';
3
+ export * from './decoders.js';
4
+ export * from './encoders.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './lib/index.js';
2
2
  export * from './api/index.js';
3
+ export * from './constants/index.js';
package/dist/index.js CHANGED
@@ -2,4 +2,6 @@
2
2
  export * from './lib/index.js';
3
3
  // Export high-level API
4
4
  export * from './api/index.js';
5
+ // Export all generated constants
6
+ export * from './constants/index.js';
5
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,cAAc,gBAAgB,CAAC;AAE/B,wBAAwB;AACxB,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,cAAc,gBAAgB,CAAC;AAE/B,wBAAwB;AACxB,cAAc,gBAAgB,CAAC;AAE/B,iCAAiC;AACjC,cAAc,sBAAsB,CAAC"}
@@ -1,11 +1,11 @@
1
- import type { AVSampleFormat } from './constants.js';
1
+ import type { AVSampleFormat } from '../constants/constants.js';
2
2
  import type { NativeAudioFifo, NativeWrapper } from './native-types.js';
3
3
  /**
4
- * Audio FIFO buffer for sample management.
4
+ * Audio FIFO (First-In-First-Out) buffer for managing audio samples.
5
5
  *
6
- * Provides a first-in-first-out buffer for audio samples.
7
- * Supports both planar and interleaved audio formats.
8
- * Automatically handles reallocation when needed.
6
+ * Provides a thread-safe buffer for audio sample data, supporting both planar and interleaved formats.
7
+ * Automatically handles buffer reallocation when needed. Essential for audio resampling,
8
+ * format conversion, and buffering operations.
9
9
  *
10
10
  * Direct mapping to FFmpeg's AVAudioFifo.
11
11
  *
@@ -14,236 +14,191 @@ import type { NativeAudioFifo, NativeWrapper } from './native-types.js';
14
14
  * import { AudioFifo, FFmpegError } from 'node-av';
15
15
  * import { AV_SAMPLE_FMT_FLTP } from 'node-av/constants';
16
16
  *
17
- * // Create audio FIFO for stereo float samples
17
+ * // Create FIFO for stereo float planar audio
18
18
  * const fifo = new AudioFifo();
19
19
  * fifo.alloc(AV_SAMPLE_FMT_FLTP, 2, 4096);
20
20
  *
21
- * // Write samples to FIFO
22
- * const samplesWritten = await fifo.write(inputBuffers, frameSize);
23
- * FFmpegError.throwIfError(samplesWritten, 'write');
21
+ * // Write samples
22
+ * const leftChannel = Buffer.alloc(1024 * 4); // 1024 float samples
23
+ * const rightChannel = Buffer.alloc(1024 * 4);
24
+ * const written = await fifo.write([leftChannel, rightChannel], 1024);
25
+ * FFmpegError.throwIfError(written, 'write');
24
26
  *
25
- * // Read samples from FIFO
26
- * const samplesRead = await fifo.read(outputBuffers, frameSize);
27
- * FFmpegError.throwIfError(samplesRead, 'read');
28
- *
29
- * // Check available samples
30
- * console.log(`Samples in FIFO: ${fifo.size}`);
27
+ * // Read samples when enough available
28
+ * if (fifo.size >= 512) {
29
+ * const outLeft = Buffer.alloc(512 * 4);
30
+ * const outRight = Buffer.alloc(512 * 4);
31
+ * const read = await fifo.read([outLeft, outRight], 512);
32
+ * FFmpegError.throwIfError(read, 'read');
33
+ * }
31
34
  *
32
35
  * // Cleanup
33
36
  * fifo.free();
34
37
  * ```
38
+ *
39
+ * @see [AudioFifo](https://ffmpeg.org/doxygen/trunk/structAVAudioFifo.html) - FFmpeg Doxygen
35
40
  */
36
41
  export declare class AudioFifo implements Disposable, NativeWrapper<NativeAudioFifo> {
37
42
  private native;
38
- /**
39
- * Create a new audio FIFO buffer.
40
- *
41
- * The FIFO is uninitialized - you must call alloc() before use.
42
- * No FFmpeg resources are allocated until alloc() is called.
43
- *
44
- * Direct wrapper around AVAudioFifo.
45
- *
46
- * @example
47
- * ```typescript
48
- * import { AudioFifo } from 'node-av';
49
- * import { AV_SAMPLE_FMT_S16 } from 'node-av/constants';
50
- *
51
- * const fifo = new AudioFifo();
52
- * fifo.alloc(AV_SAMPLE_FMT_S16, 2, 1024);
53
- * // FIFO is now ready for use
54
- * ```
55
- */
56
43
  constructor();
57
44
  /**
58
- * Get the current number of samples in the AVAudioFifo.
59
- *
60
- * Returns the number of samples currently buffered in the FIFO.
61
- *
62
- * Direct mapping to av_audio_fifo_size()
63
- *
64
- * @returns Number of samples currently in the FIFO
65
- *
66
- * @example
67
- * ```typescript
68
- * import { FFmpegError } from 'node-av';
69
- *
70
- * if (fifo.size >= frameSize) {
71
- * // Enough samples available for a full frame
72
- * const ret = await fifo.read(outputBuffer, frameSize);
73
- * FFmpegError.throwIfError(ret, 'read');
74
- * }
75
- * ```
45
+ * Number of samples currently in the FIFO.
76
46
  *
77
- * @readonly
47
+ * Direct mapping to av_audio_fifo_size().
78
48
  */
79
49
  get size(): number;
80
50
  /**
81
- * Get the available space in the AVAudioFifo.
51
+ * Number of samples that can be written without reallocation.
82
52
  *
83
- * Returns the number of samples that can be written without reallocation.
84
- *
85
- * Direct mapping to av_audio_fifo_space()
86
- *
87
- * @returns Number of samples that can be written to the FIFO
88
- *
89
- * @example
90
- * ```typescript
91
- * import { FFmpegError } from 'node-av';
92
- *
93
- * if (fifo.space >= frameSize) {
94
- * // Enough space for a full frame
95
- * const ret = await fifo.write(inputBuffer, frameSize);
96
- * FFmpegError.throwIfError(ret, 'write');
97
- * }
98
- * ```
99
- *
100
- * @readonly
53
+ * Direct mapping to av_audio_fifo_space().
101
54
  */
102
55
  get space(): number;
103
56
  /**
104
- * Allocate an AVAudioFifo.
57
+ * Allocate an AVAudioFifo buffer.
105
58
  *
106
- * Allocates a FIFO buffer for the specified audio format and size.
59
+ * Creates a FIFO buffer for the specified audio format and size.
107
60
  * The FIFO will automatically grow if more data is written than allocated.
108
61
  *
109
- * Direct mapping to av_audio_fifo_alloc()
62
+ * Direct mapping to av_audio_fifo_alloc().
110
63
  *
111
64
  * @param sampleFmt - Sample format (e.g., AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP)
112
- * @param channels - Number of channels
113
- * @param nbSamples - Initial allocation size, in samples
65
+ * @param channels - Number of audio channels
66
+ * @param nbSamples - Initial buffer size in samples
114
67
  *
115
- * @throws {Error} Memory allocation failure (ENOMEM)
68
+ * @throws {Error} If allocation fails (ENOMEM)
116
69
  *
117
70
  * @example
118
71
  * ```typescript
119
72
  * import { AudioFifo } from 'node-av';
120
- * import { AV_SAMPLE_FMT_FLTP } from 'node-av/constants';
73
+ * import { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP } from 'node-av/constants';
74
+ *
75
+ * // For interleaved 16-bit stereo
76
+ * const fifo1 = new AudioFifo();
77
+ * fifo1.alloc(AV_SAMPLE_FMT_S16, 2, 4096);
121
78
  *
122
- * const fifo = new AudioFifo();
123
- * fifo.alloc(AV_SAMPLE_FMT_FLTP, 2, 4096);
124
- * // FIFO can now hold up to 4096 stereo float samples
79
+ * // For planar float 5.1 audio
80
+ * const fifo2 = new AudioFifo();
81
+ * fifo2.alloc(AV_SAMPLE_FMT_FLTP, 6, 8192);
125
82
  * ```
126
83
  *
127
84
  * @see {@link realloc} To resize the FIFO
85
+ * @see {@link free} To release the FIFO
128
86
  */
129
87
  alloc(sampleFmt: AVSampleFormat, channels: number, nbSamples: number): void;
130
88
  /**
131
- * Free an AVAudioFifo.
89
+ * Free the FIFO buffer and all associated resources.
132
90
  *
133
- * Frees the FIFO buffer and all associated resources.
134
- * The FIFO object becomes invalid after this call.
91
+ * After calling this, the FIFO is invalid and must be reallocated before use.
135
92
  *
136
- * Direct mapping to av_audio_fifo_free()
93
+ * Direct mapping to av_audio_fifo_free().
137
94
  *
138
95
  * @example
139
96
  * ```typescript
140
97
  * fifo.free();
141
- * // FIFO is now invalid and should not be used
98
+ * // FIFO is now invalid, must call alloc() before using again
142
99
  * ```
100
+ *
101
+ * @see {@link Symbol.dispose} For automatic cleanup
102
+ * @see {@link alloc} To allocate
143
103
  */
144
104
  free(): void;
145
105
  /**
146
- * Write data to an AVAudioFifo.
106
+ * Write audio samples to the FIFO.
147
107
  *
148
- * Writes audio samples to the FIFO buffer.
149
- * Automatically reallocates the FIFO if more space is needed.
108
+ * Writes samples to the FIFO buffer. Automatically reallocates if more space is needed.
109
+ * For planar formats, provide an array of buffers (one per channel).
110
+ * For interleaved formats, provide a single buffer.
150
111
  *
151
- * Direct mapping to av_audio_fifo_write()
112
+ * Direct mapping to av_audio_fifo_write().
152
113
  *
153
- * @param data - Audio buffer(s) to write from.
154
- * For planar formats: array of buffers (one per channel).
155
- * For interleaved formats: single buffer.
114
+ * @param data - Audio data buffer(s). Array for planar, single Buffer for interleaved
156
115
  * @param nbSamples - Number of samples to write
157
116
  *
158
- * @returns Number of samples actually written, or negative AVERROR on error:
159
- * - >=0: Number of samples written
160
- * - AVERROR(EINVAL): Invalid parameters
161
- * - AVERROR(ENOMEM): Memory allocation failure
117
+ * @returns Number of samples written, or negative AVERROR:
118
+ * - AVERROR_EINVAL: Invalid parameters
119
+ * - AVERROR_ENOMEM: Memory allocation failure
162
120
  *
163
121
  * @example
164
122
  * ```typescript
165
123
  * import { FFmpegError } from 'node-av';
166
124
  *
167
- * // Planar format (separate buffers per channel)
168
- * const leftChannel = Buffer.alloc(frameSize * 4); // float32
169
- * const rightChannel = Buffer.alloc(frameSize * 4);
170
- * const written = await fifo.write([leftChannel, rightChannel], frameSize);
125
+ * // Planar format (e.g., FLTP) - separate buffers per channel
126
+ * const leftData = Buffer.alloc(1024 * 4); // 1024 float samples
127
+ * const rightData = Buffer.alloc(1024 * 4);
128
+ * const written = await fifo.write([leftData, rightData], 1024);
171
129
  * FFmpegError.throwIfError(written, 'write');
130
+ * console.log(`Wrote ${written} samples`);
172
131
  *
173
- * // Interleaved format (single buffer)
174
- * const interleavedBuffer = Buffer.alloc(frameSize * 2 * 2); // stereo s16
175
- * const written2 = await fifo.write(interleavedBuffer, frameSize);
132
+ * // Interleaved format (e.g., S16) - single buffer
133
+ * const interleavedData = Buffer.alloc(1024 * 2 * 2); // 1024 stereo S16 samples
134
+ * const written2 = await fifo.write(interleavedData, 1024);
176
135
  * FFmpegError.throwIfError(written2, 'write');
177
136
  * ```
178
137
  *
179
- * @see {@link read} To read samples from FIFO
138
+ * @see {@link read} To retrieve samples from FIFO
139
+ * @see {@link space} To check available space
180
140
  */
181
141
  write(data: Buffer | Buffer[], nbSamples: number): Promise<number>;
182
142
  /**
183
- * Read data from an AVAudioFifo.
143
+ * Read and remove samples from the FIFO.
184
144
  *
185
- * Reads and removes samples from the FIFO buffer.
186
- * Reads up to nb_samples or the available amount, whichever is less.
145
+ * Reads up to the specified number of samples from the FIFO.
146
+ * The samples are removed from the FIFO after reading.
147
+ * Buffers must be pre-allocated with sufficient size.
187
148
  *
188
- * Direct mapping to av_audio_fifo_read()
149
+ * Direct mapping to av_audio_fifo_read().
189
150
  *
190
- * @param data - Audio buffer(s) to read into.
191
- * For planar formats: array of buffers (one per channel).
192
- * For interleaved formats: single buffer.
193
- * Buffers must be pre-allocated with sufficient size.
194
- * @param nbSamples - Number of samples to read
151
+ * @param data - Pre-allocated buffer(s) to read into. Array for planar, single Buffer for interleaved
152
+ * @param nbSamples - Maximum number of samples to read
195
153
  *
196
- * @returns Number of samples actually read, or negative AVERROR on error:
197
- * - >=0: Number of samples read
198
- * - AVERROR(EINVAL): Invalid parameters
154
+ * @returns Number of samples read, or negative AVERROR:
155
+ * - AVERROR_EINVAL: Invalid parameters
199
156
  *
200
157
  * @example
201
158
  * ```typescript
202
159
  * import { FFmpegError } from 'node-av';
203
160
  *
204
- * // Planar format (separate buffers per channel)
205
- * const leftChannel = Buffer.alloc(frameSize * 4); // float32
206
- * const rightChannel = Buffer.alloc(frameSize * 4);
207
- * const read = await fifo.read([leftChannel, rightChannel], frameSize);
208
- * FFmpegError.throwIfError(read, 'read');
209
- *
210
- * // Interleaved format (single buffer)
211
- * const interleavedBuffer = Buffer.alloc(frameSize * 2 * 2); // stereo s16
212
- * const read2 = await fifo.read(interleavedBuffer, frameSize);
213
- * FFmpegError.throwIfError(read2, 'read');
161
+ * // Check available samples
162
+ * const available = fifo.size;
163
+ * if (available >= 1024) {
164
+ * // Planar format
165
+ * const leftOut = Buffer.alloc(1024 * 4);
166
+ * const rightOut = Buffer.alloc(1024 * 4);
167
+ * const read = await fifo.read([leftOut, rightOut], 1024);
168
+ * FFmpegError.throwIfError(read, 'read');
169
+ * console.log(`Read ${read} samples`);
170
+ * }
214
171
  * ```
215
172
  *
216
173
  * @see {@link peek} To read without removing
217
- * @see {@link write} To write samples to FIFO
174
+ * @see {@link size} To check available samples
218
175
  */
219
176
  read(data: Buffer | Buffer[], nbSamples: number): Promise<number>;
220
177
  /**
221
- * Peek data from an AVAudioFifo.
178
+ * Read samples from the FIFO without removing them.
222
179
  *
223
- * Reads samples from the FIFO without removing them.
224
- * Useful for inspecting upcoming data.
180
+ * Similar to read() but leaves the samples in the FIFO.
181
+ * Useful for inspecting upcoming data without consuming it.
225
182
  *
226
- * Direct mapping to av_audio_fifo_peek()
183
+ * Direct mapping to av_audio_fifo_peek().
227
184
  *
228
- * @param data - Audio buffer(s) to peek into.
229
- * For planar formats: array of buffers (one per channel).
230
- * For interleaved formats: single buffer.
231
- * Buffers must be pre-allocated.
232
- * @param nbSamples - Number of samples to peek
185
+ * @param data - Pre-allocated buffer(s) to peek into. Array for planar, single Buffer for interleaved
186
+ * @param nbSamples - Maximum number of samples to peek
233
187
  *
234
- * @returns Number of samples actually peeked, or negative AVERROR on error:
235
- * - >=0: Number of samples peeked
236
- * - AVERROR(EINVAL): Invalid parameters
188
+ * @returns Number of samples peeked, or negative AVERROR:
189
+ * - AVERROR_EINVAL: Invalid parameters
237
190
  *
238
191
  * @example
239
192
  * ```typescript
240
193
  * import { FFmpegError } from 'node-av';
241
194
  *
242
195
  * // Peek at next samples without removing them
243
- * const peekBuffer = Buffer.alloc(frameSize * 4);
244
- * const peeked = await fifo.peek(peekBuffer, frameSize);
196
+ * const peekBuffer = Buffer.alloc(256 * 4);
197
+ * const peeked = await fifo.peek(peekBuffer, 256);
245
198
  * FFmpegError.throwIfError(peeked, 'peek');
246
- * // Samples are still in FIFO after peek
199
+ *
200
+ * // Samples are still in FIFO
201
+ * console.log(`FIFO still has ${fifo.size} samples`);
247
202
  * ```
248
203
  *
249
204
  * @see {@link read} To read and remove samples
@@ -255,64 +210,71 @@ export declare class AudioFifo implements Disposable, NativeWrapper<NativeAudioF
255
210
  * Discards the specified number of samples from the FIFO.
256
211
  * Useful for skipping unwanted audio data.
257
212
  *
258
- * Direct mapping to av_audio_fifo_drain()
213
+ * Direct mapping to av_audio_fifo_drain().
259
214
  *
260
- * @param nbSamples - Number of samples to drain
215
+ * @param nbSamples - Number of samples to discard
261
216
  *
262
217
  * @example
263
218
  * ```typescript
264
- * // Skip next 100 samples
219
+ * // Skip 100 samples
265
220
  * fifo.drain(100);
221
+ * console.log(`FIFO now has ${fifo.size} samples`);
266
222
  * ```
223
+ *
224
+ * @see {@link reset} To remove all samples
267
225
  */
268
226
  drain(nbSamples: number): void;
269
227
  /**
270
- * Reset the AVAudioFifo buffer.
228
+ * Remove all samples from the FIFO.
271
229
  *
272
- * Empties all data in the FIFO without deallocating the buffer.
273
- * The FIFO remains allocated and ready for use.
230
+ * Empties the FIFO buffer without deallocating it.
231
+ * The FIFO remains allocated and ready for new data.
274
232
  *
275
- * Direct mapping to av_audio_fifo_reset()
233
+ * Direct mapping to av_audio_fifo_reset().
276
234
  *
277
235
  * @example
278
236
  * ```typescript
279
237
  * fifo.reset();
280
- * // FIFO is now empty but still allocated
238
+ * console.log(fifo.size); // 0
239
+ * console.log(fifo.space); // Original allocation size
281
240
  * ```
241
+ *
242
+ * @see {@link drain} To remove specific number of samples
282
243
  */
283
244
  reset(): void;
284
245
  /**
285
- * Reallocate an AVAudioFifo to a new size.
246
+ * Resize the FIFO buffer.
286
247
  *
287
- * Changes the size of the FIFO buffer.
288
- * Can be used to grow or shrink the buffer.
248
+ * Changes the allocated size of the FIFO. Can grow or shrink the buffer.
249
+ * Existing samples are preserved up to the new size.
289
250
  *
290
- * Direct mapping to av_audio_fifo_realloc()
251
+ * Direct mapping to av_audio_fifo_realloc().
291
252
  *
292
- * @param nbSamples - New allocation size, in samples
253
+ * @param nbSamples - New allocation size in samples
293
254
  *
294
255
  * @returns 0 on success, negative AVERROR on error:
295
- * - 0: Success
296
- * - AVERROR(EINVAL): Invalid parameters
297
- * - AVERROR(ENOMEM): Memory allocation failure
256
+ * - AVERROR_EINVAL: Invalid size
257
+ * - AVERROR_ENOMEM: Memory allocation failure
298
258
  *
299
259
  * @example
300
260
  * ```typescript
301
261
  * import { FFmpegError } from 'node-av';
302
262
  *
303
- * // Increase FIFO capacity
304
- * const ret = fifo.realloc(8192);
263
+ * // Grow FIFO to handle larger buffers
264
+ * const ret = fifo.realloc(16384);
305
265
  * FFmpegError.throwIfError(ret, 'realloc');
266
+ * console.log(`New space: ${fifo.space} samples`);
306
267
  * ```
307
268
  *
308
269
  * @see {@link alloc} For initial allocation
309
270
  */
310
271
  realloc(nbSamples: number): number;
311
272
  /**
312
- * Get the native FFmpeg AVAudioFifo pointer.
273
+ * Get the underlying native AudioFifo object.
274
+ *
275
+ * @returns The native AudioFifo binding object
313
276
  *
314
- * @internal For use by other wrapper classes
315
- * @returns The underlying native AudioFifo object
277
+ * @internal
316
278
  */
317
279
  getNative(): NativeAudioFifo;
318
280
  /**
@@ -323,17 +285,12 @@ export declare class AudioFifo implements Disposable, NativeWrapper<NativeAudioF
323
285
  *
324
286
  * @example
325
287
  * ```typescript
326
- * import { AudioFifo } from 'node-av';
327
- * import { AV_SAMPLE_FMT_S16 } from 'node-av/constants';
328
- *
329
288
  * {
330
289
  * using fifo = new AudioFifo();
331
- * fifo.alloc(AV_SAMPLE_FMT_S16, 2, 1024);
332
- * // ... use FIFO
290
+ * fifo.alloc(AV_SAMPLE_FMT_FLTP, 2, 4096);
291
+ * // Use fifo...
333
292
  * } // Automatically freed when leaving scope
334
293
  * ```
335
- *
336
- * @see {@link free} For manual cleanup
337
294
  */
338
295
  [Symbol.dispose](): void;
339
296
  }