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
@@ -1,11 +1,12 @@
1
- import type { AVCodecID } from './constants.js';
1
+ import type { AVCodecID } from '../constants/constants.js';
2
2
  import type { NativeBitStreamFilter, NativeWrapper } from './native-types.js';
3
3
  /**
4
- * Bitstream filter definition.
4
+ * Bitstream filter descriptor.
5
5
  *
6
- * Represents a bitstream filter for manipulating encoded data without decoding.
7
- * Allows modification of codec-specific headers, packet metadata, and bitstream syntax.
8
- * This is an immutable descriptor - actual filtering happens via BitStreamFilterContext.
6
+ * Provides access to bitstream filter properties and codec compatibility information.
7
+ * Bitstream filters are used to modify or analyze compressed bitstreams without
8
+ * full decoding/encoding. Common uses include H.264/HEVC parameter set extraction,
9
+ * VP9 superframe splitting, and adding/removing codec-specific headers.
9
10
  *
10
11
  * Direct mapping to FFmpeg's AVBitStreamFilter.
11
12
  *
@@ -13,111 +14,124 @@ import type { NativeBitStreamFilter, NativeWrapper } from './native-types.js';
13
14
  * ```typescript
14
15
  * import { BitStreamFilter } from 'node-av';
15
16
  *
16
- * // Find a specific bitstream filter
17
- * const h264Mp4ToAnnexB = BitStreamFilter.getByName('h264_mp4toannexb');
18
- * if (!h264Mp4ToAnnexB) throw new Error('h264_mp4toannexb filter not found');
19
- *
20
- * console.log(`Filter: ${h264Mp4ToAnnexB.name}`);
21
- * console.log(`Supported codecs: ${h264Mp4ToAnnexB.codecIds}`);
17
+ * // Get a specific bitstream filter
18
+ * const h264Filter = BitStreamFilter.getByName('h264_mp4toannexb');
19
+ * if (h264Filter) {
20
+ * console.log(`Filter: ${h264Filter.name}`);
21
+ * console.log(`Supported codecs: ${h264Filter.codecIds}`);
22
+ * }
22
23
  *
23
24
  * // List all available bitstream filters
24
25
  * const filters = BitStreamFilter.iterate();
25
26
  * for (const filter of filters) {
26
- * console.log(`Found filter: ${filter.name}`);
27
+ * console.log(`- ${filter.name}`);
27
28
  * }
28
29
  * ```
30
+ *
31
+ * @see [AVBitStreamFilter](https://ffmpeg.org/doxygen/trunk/structAVBitStreamFilter.html) - FFmpeg Doxygen
29
32
  */
30
33
  export declare class BitStreamFilter implements NativeWrapper<NativeBitStreamFilter> {
31
34
  private native;
32
35
  /**
33
- * Create a BitStreamFilter wrapper.
34
- *
35
- * Usually not called directly - use static methods instead.
36
- * No FFmpeg resources are allocated.
37
- *
38
- * @param native - Native BitStreamFilter object from bindings
36
+ * @param native The native bitstream filter instance
39
37
  * @internal
40
38
  */
41
39
  constructor(native: NativeBitStreamFilter);
42
40
  /**
43
- * Find a bitstream filter by name.
41
+ * Get a bitstream filter by name.
44
42
  *
45
- * Searches for a registered bitstream filter with the given name.
46
- * Returns null if no filter with that name exists.
43
+ * Retrieves a specific bitstream filter descriptor by its name.
44
+ * Common filter names include 'h264_mp4toannexb', 'hevc_mp4toannexb',
45
+ * 'extract_extradata', 'vp9_superframe', etc.
47
46
  *
48
- * Calls av_bsf_get_by_name() internally.
47
+ * Direct mapping to av_bsf_get_by_name().
49
48
  *
50
- * @param name - Name of the bitstream filter (e.g., 'h264_mp4toannexb')
51
- * @returns BitStreamFilter if found, null otherwise
49
+ * @param name - Name of the bitstream filter
50
+ * @returns BitStreamFilter instance if found, null otherwise
52
51
  *
53
52
  * @example
54
53
  * ```typescript
55
- * const filter = BitStreamFilter.getByName('h264_mp4toannexb');
56
- * if (filter) {
57
- * console.log(`Found filter: ${filter.name}`);
54
+ * // Get H.264 stream format converter
55
+ * const h264Filter = BitStreamFilter.getByName('h264_mp4toannexb');
56
+ * if (!h264Filter) {
57
+ * throw new Error('H.264 bitstream filter not available');
58
58
  * }
59
+ *
60
+ * // Get HEVC metadata extractor
61
+ * const hevcFilter = BitStreamFilter.getByName('hevc_metadata');
59
62
  * ```
63
+ *
64
+ * @see {@link iterate} To list all available filters
65
+ * @see {@link BitStreamFilterContext.alloc} To use the filter
60
66
  */
61
67
  static getByName(name: string): BitStreamFilter | null;
62
68
  /**
63
- * Get all available bitstream filters.
69
+ * Iterate over all available bitstream filters.
64
70
  *
65
- * Returns an array of all registered bitstream filters.
66
- * Useful for discovery and debugging.
71
+ * Returns an array of all registered bitstream filters in FFmpeg.
72
+ * Useful for discovering available filters or building filter lists.
67
73
  *
68
- * Calls av_bsf_iterate() internally.
74
+ * Direct mapping to av_bsf_iterate().
69
75
  *
70
76
  * @returns Array of all available bitstream filters
71
77
  *
72
78
  * @example
73
79
  * ```typescript
80
+ * import { BitStreamFilter } from 'node-av';
81
+ * import { AV_CODEC_ID_H264 } from 'node-av/constants';
82
+ *
83
+ * // List all available filters
74
84
  * const filters = BitStreamFilter.iterate();
75
- * for (const filter of filters) {
76
- * console.log(`${filter.name}: ${filter.codecIds?.join(', ') || 'all codecs'}`);
85
+ * console.log(`Found ${filters.length} bitstream filters`);
86
+ *
87
+ * // Find filters that support H.264
88
+ * const h264Filters = filters.filter(f =>
89
+ * f.codecIds?.includes(AV_CODEC_ID_H264)
90
+ * );
91
+ * console.log('H.264 compatible filters:');
92
+ * for (const filter of h264Filters) {
93
+ * console.log(`- ${filter.name}`);
77
94
  * }
78
95
  * ```
96
+ *
97
+ * @see {@link getByName} To get a specific filter
79
98
  */
80
99
  static iterate(): BitStreamFilter[];
81
100
  /**
82
- * Filter name.
101
+ * Name of the bitstream filter.
83
102
  *
84
- * Short name used to identify the filter.
85
- * This is the name used with getByName().
103
+ * Human-readable name identifying the filter (e.g., 'h264_mp4toannexb').
86
104
  *
87
- * Maps to AVBitStreamFilter->name.
88
- *
89
- * @example
90
- * ```typescript
91
- * const filter = BitStreamFilter.getByName('h264_mp4toannexb');
92
- * console.log(filter.name); // 'h264_mp4toannexb'
93
- * ```
105
+ * Direct mapping to AVBitStreamFilter->name.
94
106
  */
95
107
  get name(): string | null;
96
108
  /**
97
- * Supported codec IDs.
109
+ * List of supported codec IDs.
98
110
  *
99
- * List of codec IDs this filter can process.
100
- * If null, the filter works with any codec.
111
+ * Array of codec IDs that this filter can process.
112
+ * If null, the filter supports all codecs.
101
113
  *
102
- * Maps to AVBitStreamFilter->codec_ids.
114
+ * Direct mapping to AVBitStreamFilter->codec_ids.
103
115
  *
104
116
  * @example
105
117
  * ```typescript
106
- * import { AV_CODEC_ID_H264 } from 'node-av/constants';
107
- *
108
- * const filter = BitStreamFilter.getByName('h264_mp4toannexb');
109
- * if (filter.codecIds?.includes(AV_CODEC_ID_H264)) {
110
- * console.log('Filter supports H.264');
118
+ * import { AV_CODEC_ID_H264, AV_CODEC_ID_HEVC } from 'node-av/constants';
119
+ *
120
+ * const filter = BitStreamFilter.getByName('extract_extradata');
121
+ * if (filter?.codecIds) {
122
+ * const supportsH264 = filter.codecIds.includes(AV_CODEC_ID_H264);
123
+ * const supportsHEVC = filter.codecIds.includes(AV_CODEC_ID_HEVC);
124
+ * console.log(`H.264 support: ${supportsH264}`);
125
+ * console.log(`HEVC support: ${supportsHEVC}`);
111
126
  * }
112
127
  * ```
113
128
  */
114
129
  get codecIds(): AVCodecID[] | null;
115
130
  /**
116
- * Get the underlying native object.
131
+ * Get the underlying native BitStreamFilter object.
117
132
  *
118
- * For advanced use cases that need direct access to the native bindings.
133
+ * @returns The native BitStreamFilter binding object
119
134
  *
120
- * @returns Native BitStreamFilter object
121
135
  * @internal
122
136
  */
123
137
  getNative(): NativeBitStreamFilter;
@@ -1,10 +1,11 @@
1
1
  import { bindings } from './binding.js';
2
2
  /**
3
- * Bitstream filter definition.
3
+ * Bitstream filter descriptor.
4
4
  *
5
- * Represents a bitstream filter for manipulating encoded data without decoding.
6
- * Allows modification of codec-specific headers, packet metadata, and bitstream syntax.
7
- * This is an immutable descriptor - actual filtering happens via BitStreamFilterContext.
5
+ * Provides access to bitstream filter properties and codec compatibility information.
6
+ * Bitstream filters are used to modify or analyze compressed bitstreams without
7
+ * full decoding/encoding. Common uses include H.264/HEVC parameter set extraction,
8
+ * VP9 superframe splitting, and adding/removing codec-specific headers.
8
9
  *
9
10
  * Direct mapping to FFmpeg's AVBitStreamFilter.
10
11
  *
@@ -12,111 +13,125 @@ import { bindings } from './binding.js';
12
13
  * ```typescript
13
14
  * import { BitStreamFilter } from 'node-av';
14
15
  *
15
- * // Find a specific bitstream filter
16
- * const h264Mp4ToAnnexB = BitStreamFilter.getByName('h264_mp4toannexb');
17
- * if (!h264Mp4ToAnnexB) throw new Error('h264_mp4toannexb filter not found');
18
- *
19
- * console.log(`Filter: ${h264Mp4ToAnnexB.name}`);
20
- * console.log(`Supported codecs: ${h264Mp4ToAnnexB.codecIds}`);
16
+ * // Get a specific bitstream filter
17
+ * const h264Filter = BitStreamFilter.getByName('h264_mp4toannexb');
18
+ * if (h264Filter) {
19
+ * console.log(`Filter: ${h264Filter.name}`);
20
+ * console.log(`Supported codecs: ${h264Filter.codecIds}`);
21
+ * }
21
22
  *
22
23
  * // List all available bitstream filters
23
24
  * const filters = BitStreamFilter.iterate();
24
25
  * for (const filter of filters) {
25
- * console.log(`Found filter: ${filter.name}`);
26
+ * console.log(`- ${filter.name}`);
26
27
  * }
27
28
  * ```
29
+ *
30
+ * @see [AVBitStreamFilter](https://ffmpeg.org/doxygen/trunk/structAVBitStreamFilter.html) - FFmpeg Doxygen
28
31
  */
29
32
  export class BitStreamFilter {
30
33
  native;
31
34
  /**
32
- * Create a BitStreamFilter wrapper.
33
- *
34
- * Usually not called directly - use static methods instead.
35
- * No FFmpeg resources are allocated.
36
- *
37
- * @param native - Native BitStreamFilter object from bindings
35
+ * @param native The native bitstream filter instance
38
36
  * @internal
39
37
  */
40
38
  constructor(native) {
41
39
  this.native = native;
42
40
  }
43
41
  /**
44
- * Find a bitstream filter by name.
42
+ * Get a bitstream filter by name.
45
43
  *
46
- * Searches for a registered bitstream filter with the given name.
47
- * Returns null if no filter with that name exists.
44
+ * Retrieves a specific bitstream filter descriptor by its name.
45
+ * Common filter names include 'h264_mp4toannexb', 'hevc_mp4toannexb',
46
+ * 'extract_extradata', 'vp9_superframe', etc.
48
47
  *
49
- * Calls av_bsf_get_by_name() internally.
48
+ * Direct mapping to av_bsf_get_by_name().
50
49
  *
51
- * @param name - Name of the bitstream filter (e.g., 'h264_mp4toannexb')
52
- * @returns BitStreamFilter if found, null otherwise
50
+ * @param name - Name of the bitstream filter
51
+ * @returns BitStreamFilter instance if found, null otherwise
53
52
  *
54
53
  * @example
55
54
  * ```typescript
56
- * const filter = BitStreamFilter.getByName('h264_mp4toannexb');
57
- * if (filter) {
58
- * console.log(`Found filter: ${filter.name}`);
55
+ * // Get H.264 stream format converter
56
+ * const h264Filter = BitStreamFilter.getByName('h264_mp4toannexb');
57
+ * if (!h264Filter) {
58
+ * throw new Error('H.264 bitstream filter not available');
59
59
  * }
60
+ *
61
+ * // Get HEVC metadata extractor
62
+ * const hevcFilter = BitStreamFilter.getByName('hevc_metadata');
60
63
  * ```
64
+ *
65
+ * @see {@link iterate} To list all available filters
66
+ * @see {@link BitStreamFilterContext.alloc} To use the filter
61
67
  */
62
68
  static getByName(name) {
63
69
  const native = bindings.BitStreamFilter.getByName(name);
64
70
  return native ? new BitStreamFilter(native) : null;
65
71
  }
66
72
  /**
67
- * Get all available bitstream filters.
73
+ * Iterate over all available bitstream filters.
68
74
  *
69
- * Returns an array of all registered bitstream filters.
70
- * Useful for discovery and debugging.
75
+ * Returns an array of all registered bitstream filters in FFmpeg.
76
+ * Useful for discovering available filters or building filter lists.
71
77
  *
72
- * Calls av_bsf_iterate() internally.
78
+ * Direct mapping to av_bsf_iterate().
73
79
  *
74
80
  * @returns Array of all available bitstream filters
75
81
  *
76
82
  * @example
77
83
  * ```typescript
84
+ * import { BitStreamFilter } from 'node-av';
85
+ * import { AV_CODEC_ID_H264 } from 'node-av/constants';
86
+ *
87
+ * // List all available filters
78
88
  * const filters = BitStreamFilter.iterate();
79
- * for (const filter of filters) {
80
- * console.log(`${filter.name}: ${filter.codecIds?.join(', ') || 'all codecs'}`);
89
+ * console.log(`Found ${filters.length} bitstream filters`);
90
+ *
91
+ * // Find filters that support H.264
92
+ * const h264Filters = filters.filter(f =>
93
+ * f.codecIds?.includes(AV_CODEC_ID_H264)
94
+ * );
95
+ * console.log('H.264 compatible filters:');
96
+ * for (const filter of h264Filters) {
97
+ * console.log(`- ${filter.name}`);
81
98
  * }
82
99
  * ```
100
+ *
101
+ * @see {@link getByName} To get a specific filter
83
102
  */
84
103
  static iterate() {
85
104
  const natives = bindings.BitStreamFilter.iterate();
86
105
  return natives.map((native) => new BitStreamFilter(native));
87
106
  }
88
107
  /**
89
- * Filter name.
108
+ * Name of the bitstream filter.
90
109
  *
91
- * Short name used to identify the filter.
92
- * This is the name used with getByName().
110
+ * Human-readable name identifying the filter (e.g., 'h264_mp4toannexb').
93
111
  *
94
- * Maps to AVBitStreamFilter->name.
95
- *
96
- * @example
97
- * ```typescript
98
- * const filter = BitStreamFilter.getByName('h264_mp4toannexb');
99
- * console.log(filter.name); // 'h264_mp4toannexb'
100
- * ```
112
+ * Direct mapping to AVBitStreamFilter->name.
101
113
  */
102
114
  get name() {
103
115
  return this.native.name;
104
116
  }
105
117
  /**
106
- * Supported codec IDs.
118
+ * List of supported codec IDs.
107
119
  *
108
- * List of codec IDs this filter can process.
109
- * If null, the filter works with any codec.
120
+ * Array of codec IDs that this filter can process.
121
+ * If null, the filter supports all codecs.
110
122
  *
111
- * Maps to AVBitStreamFilter->codec_ids.
123
+ * Direct mapping to AVBitStreamFilter->codec_ids.
112
124
  *
113
125
  * @example
114
126
  * ```typescript
115
- * import { AV_CODEC_ID_H264 } from 'node-av/constants';
116
- *
117
- * const filter = BitStreamFilter.getByName('h264_mp4toannexb');
118
- * if (filter.codecIds?.includes(AV_CODEC_ID_H264)) {
119
- * console.log('Filter supports H.264');
127
+ * import { AV_CODEC_ID_H264, AV_CODEC_ID_HEVC } from 'node-av/constants';
128
+ *
129
+ * const filter = BitStreamFilter.getByName('extract_extradata');
130
+ * if (filter?.codecIds) {
131
+ * const supportsH264 = filter.codecIds.includes(AV_CODEC_ID_H264);
132
+ * const supportsHEVC = filter.codecIds.includes(AV_CODEC_ID_HEVC);
133
+ * console.log(`H.264 support: ${supportsH264}`);
134
+ * console.log(`HEVC support: ${supportsHEVC}`);
120
135
  * }
121
136
  * ```
122
137
  */
@@ -124,11 +139,10 @@ export class BitStreamFilter {
124
139
  return this.native.codecIds;
125
140
  }
126
141
  /**
127
- * Get the underlying native object.
142
+ * Get the underlying native BitStreamFilter object.
128
143
  *
129
- * For advanced use cases that need direct access to the native bindings.
144
+ * @returns The native BitStreamFilter binding object
130
145
  *
131
- * @returns Native BitStreamFilter object
132
146
  * @internal
133
147
  */
134
148
  getNative() {
@@ -1 +1 @@
1
- {"version":3,"file":"bitstream-filter.js","sourceRoot":"","sources":["../../src/lib/bitstream-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,OAAO,eAAe;IAClB,MAAM,CAAwB;IAEtC;;;;;;;;OAQG;IACH,YAAY,MAA6B;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,SAAS,CAAC,IAAY;QAC3B,MAAM,MAAM,GAAG,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,OAAO;QACZ,MAAM,OAAO,GAAG,QAAQ,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QACnD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAA6B,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,QAA8B,CAAC;IACpD,CAAC;IAED;;;;;;;OAOG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
1
+ {"version":3,"file":"bitstream-filter.js","sourceRoot":"","sources":["../../src/lib/bitstream-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,eAAe;IAClB,MAAM,CAAwB;IAEtC;;;OAGG;IACH,YAAY,MAA6B;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,CAAC,SAAS,CAAC,IAAY;QAC3B,MAAM,MAAM,GAAG,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,CAAC,OAAO;QACZ,MAAM,OAAO,GAAG,QAAQ,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QACnD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAA6B,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;OAMG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,QAA8B,CAAC;IACpD,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}