node-av 1.1.0 → 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.
- package/README.md +51 -38
- package/dist/api/bitstream-filter.d.ts +180 -123
- package/dist/api/bitstream-filter.js +180 -125
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +279 -132
- package/dist/api/decoder.js +285 -142
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/encoder.d.ts +246 -162
- package/dist/api/encoder.js +272 -208
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter-presets.d.ts +690 -94
- package/dist/api/filter-presets.js +686 -102
- package/dist/api/filter-presets.js.map +1 -1
- package/dist/api/filter.d.ts +249 -213
- package/dist/api/filter.js +252 -242
- package/dist/api/filter.js.map +1 -1
- package/dist/api/hardware.d.ts +224 -117
- package/dist/api/hardware.js +380 -214
- package/dist/api/hardware.js.map +1 -1
- package/dist/api/index.d.ts +3 -3
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/io-stream.d.ts +65 -61
- package/dist/api/io-stream.js +43 -46
- package/dist/api/io-stream.js.map +1 -1
- package/dist/api/media-input.d.ts +242 -140
- package/dist/api/media-input.js +205 -103
- package/dist/api/media-input.js.map +1 -1
- package/dist/api/media-output.d.ts +206 -128
- package/dist/api/media-output.js +210 -128
- package/dist/api/media-output.js.map +1 -1
- package/dist/api/pipeline.d.ts +168 -38
- package/dist/api/pipeline.js +238 -14
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/types.d.ts +21 -187
- package/dist/api/utils.d.ts +1 -2
- package/dist/api/utils.js +9 -0
- package/dist/api/utils.js.map +1 -1
- package/dist/lib/audio-fifo.d.ts +127 -170
- package/dist/lib/audio-fifo.js +130 -173
- package/dist/lib/audio-fifo.js.map +1 -1
- package/dist/lib/binding.js +5 -0
- package/dist/lib/binding.js.map +1 -1
- package/dist/lib/bitstream-filter-context.d.ts +139 -184
- package/dist/lib/bitstream-filter-context.js +139 -188
- package/dist/lib/bitstream-filter-context.js.map +1 -1
- package/dist/lib/bitstream-filter.d.ts +68 -54
- package/dist/lib/bitstream-filter.js +68 -54
- package/dist/lib/bitstream-filter.js.map +1 -1
- package/dist/lib/codec-context.d.ts +316 -380
- package/dist/lib/codec-context.js +316 -381
- package/dist/lib/codec-context.js.map +1 -1
- package/dist/lib/codec-parameters.d.ts +160 -170
- package/dist/lib/codec-parameters.js +162 -172
- package/dist/lib/codec-parameters.js.map +1 -1
- package/dist/lib/codec-parser.d.ts +91 -104
- package/dist/lib/codec-parser.js +92 -103
- package/dist/lib/codec-parser.js.map +1 -1
- package/dist/lib/codec.d.ts +264 -281
- package/dist/lib/codec.js +268 -285
- package/dist/lib/codec.js.map +1 -1
- package/dist/lib/dictionary.d.ts +149 -203
- package/dist/lib/dictionary.js +158 -212
- package/dist/lib/dictionary.js.map +1 -1
- package/dist/lib/error.d.ts +96 -130
- package/dist/lib/error.js +98 -128
- package/dist/lib/error.js.map +1 -1
- package/dist/lib/filter-context.d.ts +284 -218
- package/dist/lib/filter-context.js +290 -227
- package/dist/lib/filter-context.js.map +1 -1
- package/dist/lib/filter-graph.d.ts +251 -292
- package/dist/lib/filter-graph.js +253 -294
- package/dist/lib/filter-graph.js.map +1 -1
- package/dist/lib/filter-inout.d.ts +87 -95
- package/dist/lib/filter-inout.js +87 -95
- package/dist/lib/filter-inout.js.map +1 -1
- package/dist/lib/filter.d.ts +93 -111
- package/dist/lib/filter.js +93 -111
- package/dist/lib/filter.js.map +1 -1
- package/dist/lib/format-context.d.ts +320 -428
- package/dist/lib/format-context.js +313 -385
- package/dist/lib/format-context.js.map +1 -1
- package/dist/lib/frame.d.ts +262 -405
- package/dist/lib/frame.js +263 -408
- package/dist/lib/frame.js.map +1 -1
- package/dist/lib/hardware-device-context.d.ts +149 -203
- package/dist/lib/hardware-device-context.js +149 -203
- package/dist/lib/hardware-device-context.js.map +1 -1
- package/dist/lib/hardware-frames-context.d.ts +170 -180
- package/dist/lib/hardware-frames-context.js +171 -181
- package/dist/lib/hardware-frames-context.js.map +1 -1
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.js +2 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/input-format.d.ts +89 -117
- package/dist/lib/input-format.js +89 -117
- package/dist/lib/input-format.js.map +1 -1
- package/dist/lib/io-context.d.ts +209 -241
- package/dist/lib/io-context.js +220 -252
- package/dist/lib/io-context.js.map +1 -1
- package/dist/lib/log.d.ts +85 -119
- package/dist/lib/log.js +85 -122
- package/dist/lib/log.js.map +1 -1
- package/dist/lib/native-types.d.ts +117 -106
- package/dist/lib/native-types.js +0 -7
- package/dist/lib/native-types.js.map +1 -1
- package/dist/lib/option.d.ts +284 -241
- package/dist/lib/option.js +309 -249
- package/dist/lib/option.js.map +1 -1
- package/dist/lib/output-format.d.ts +77 -101
- package/dist/lib/output-format.js +77 -101
- package/dist/lib/output-format.js.map +1 -1
- package/dist/lib/packet.d.ts +172 -240
- package/dist/lib/packet.js +172 -241
- package/dist/lib/packet.js.map +1 -1
- package/dist/lib/rational.d.ts +0 -2
- package/dist/lib/rational.js +0 -2
- package/dist/lib/rational.js.map +1 -1
- package/dist/lib/software-resample-context.d.ts +241 -325
- package/dist/lib/software-resample-context.js +242 -326
- package/dist/lib/software-resample-context.js.map +1 -1
- package/dist/lib/software-scale-context.d.ts +129 -173
- package/dist/lib/software-scale-context.js +131 -175
- package/dist/lib/software-scale-context.js.map +1 -1
- package/dist/lib/stream.d.ts +87 -197
- package/dist/lib/stream.js +87 -197
- package/dist/lib/stream.js.map +1 -1
- package/dist/lib/utilities.d.ts +372 -181
- package/dist/lib/utilities.js +373 -182
- package/dist/lib/utilities.js.map +1 -1
- package/install/check.js +0 -1
- package/package.json +21 -12
- package/release_notes.md +43 -59
- package/CHANGELOG.md +0 -8
package/dist/lib/codec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.js","sourceRoot":"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,CAAC,MAAM,CAAC,OAAO,GAAG,uCAAuC,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzI,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iBAAiB,CAAC,UAA0B;QAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,GAAI,CAAC,EAAE,EAAE,CAAC;YACtB,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YACnC,IAAI,CAAC,MAAM;gBAAE,MAAM;YAEnB,IAAI,MAAM,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;gBACrC,OAAO,MAAM,CAAC,OAAO,CAAC;YACxB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,WAAW,CAAC,KAAa;QAKvB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,MAA0B;QAC1C,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACzB,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;CACF"}
|
package/dist/lib/dictionary.d.ts
CHANGED
|
@@ -1,234 +1,186 @@
|
|
|
1
1
|
import type { AVDictFlag } from '../constants/constants.js';
|
|
2
2
|
import type { NativeDictionary, NativeWrapper } from './native-types.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Key-value dictionary for FFmpeg options and metadata.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Stores string key-value pairs used throughout FFmpeg for options, metadata,
|
|
7
|
+
* and configuration. Provides methods for setting, getting, and manipulating
|
|
8
|
+
* dictionary entries. Used extensively for codec options, format options,
|
|
9
|
+
* and metadata handling.
|
|
9
10
|
*
|
|
10
11
|
* Direct mapping to FFmpeg's AVDictionary.
|
|
11
12
|
*
|
|
12
13
|
* @example
|
|
13
14
|
* ```typescript
|
|
14
|
-
* import { Dictionary, CodecContext, FFmpegError } from 'node-av';
|
|
15
|
-
*
|
|
16
|
-
* // Using Dictionary for codec options
|
|
17
|
-
* const options = new Dictionary();
|
|
18
|
-
* const ret1 = options.set('preset', 'fast', 0);
|
|
19
|
-
* FFmpegError.throwIfError(ret1, 'set preset');
|
|
20
|
-
* const ret2 = options.set('crf', '23', 0);
|
|
21
|
-
* FFmpegError.throwIfError(ret2, 'set crf');
|
|
22
|
-
*
|
|
23
|
-
* const codecContext = new CodecContext();
|
|
24
|
-
* codecContext.allocContext3(codec);
|
|
25
|
-
* const openRet = await codecContext.open2(codec, options);
|
|
26
|
-
* FFmpegError.throwIfError(openRet, 'open2');
|
|
27
|
-
*
|
|
28
|
-
* // Using Dictionary for format options
|
|
29
|
-
* const formatOptions = new Dictionary();
|
|
30
|
-
* const ret3 = formatOptions.set('movflags', 'faststart', 0);
|
|
31
|
-
* FFmpegError.throwIfError(ret3, 'set movflags');
|
|
32
|
-
* const headerRet = await formatContext.writeHeader(formatOptions);
|
|
33
|
-
* FFmpegError.throwIfError(headerRet, 'writeHeader');
|
|
34
|
-
*
|
|
35
|
-
* // Reading metadata
|
|
36
|
-
* const metadata = stream.metadata;
|
|
37
|
-
* if (metadata) {
|
|
38
|
-
* const title = metadata.get('title', 0);
|
|
39
|
-
* const artist = metadata.get('artist', 0);
|
|
40
|
-
* console.log(`Title: ${title}, Artist: ${artist}`);
|
|
41
|
-
* }
|
|
42
|
-
*
|
|
43
|
-
* // Cleanup
|
|
44
|
-
* options.free();
|
|
45
|
-
* formatOptions.free();
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
15
|
* import { Dictionary, FFmpegError } from 'node-av';
|
|
16
|
+
* import { AV_DICT_IGNORE_SUFFIX } from 'node-av/constants';
|
|
51
17
|
*
|
|
52
|
-
* //
|
|
53
|
-
* const dict =
|
|
54
|
-
*
|
|
55
|
-
*
|
|
18
|
+
* // Create from object
|
|
19
|
+
* const dict = Dictionary.fromObject({
|
|
20
|
+
* 'title': 'My Video',
|
|
21
|
+
* 'artist': 'Me',
|
|
22
|
+
* 'year': '2024'
|
|
23
|
+
* });
|
|
56
24
|
*
|
|
57
|
-
* //
|
|
58
|
-
* const
|
|
59
|
-
*
|
|
25
|
+
* // Set individual values
|
|
26
|
+
* const dict2 = new Dictionary();
|
|
27
|
+
* dict2.alloc();
|
|
28
|
+
* let ret = dict2.set('preset', 'fast');
|
|
29
|
+
* FFmpegError.throwIfError(ret, 'set');
|
|
60
30
|
*
|
|
61
|
-
* //
|
|
62
|
-
*
|
|
63
|
-
*
|
|
31
|
+
* // Parse from string
|
|
32
|
+
* ret = dict2.parseString('key1=value1:key2=value2', '=', ':');
|
|
33
|
+
* FFmpegError.throwIfError(ret, 'parseString');
|
|
64
34
|
*
|
|
65
|
-
*
|
|
35
|
+
* // Get all entries
|
|
36
|
+
* const entries = dict2.getAll();
|
|
37
|
+
* console.log(entries); // { key1: 'value1', key2: 'value2' }
|
|
66
38
|
* ```
|
|
39
|
+
*
|
|
40
|
+
* @see [AVDictionary](https://ffmpeg.org/doxygen/trunk/group__lavu__dict.html) - FFmpeg Doxygen
|
|
41
|
+
* @see {@link CodecContext} For codec options
|
|
42
|
+
* @see {@link FormatContext} For format options
|
|
67
43
|
*/
|
|
68
44
|
export declare class Dictionary implements Disposable, NativeWrapper<NativeDictionary> {
|
|
69
45
|
private native;
|
|
46
|
+
constructor();
|
|
70
47
|
/**
|
|
71
|
-
* Create
|
|
48
|
+
* Create dictionary from JavaScript object.
|
|
72
49
|
*
|
|
73
|
-
*
|
|
74
|
-
* No FFmpeg resources are allocated until first use.
|
|
50
|
+
* Convenience method to create a dictionary from a plain object.
|
|
75
51
|
*
|
|
76
|
-
*
|
|
52
|
+
* @param obj - Object with string key-value pairs
|
|
53
|
+
* @param flags - Flags for setting entries
|
|
54
|
+
* @returns New dictionary with entries from object
|
|
77
55
|
*
|
|
78
56
|
* @example
|
|
79
57
|
* ```typescript
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
58
|
+
* const metadata = Dictionary.fromObject({
|
|
59
|
+
* 'title': 'My Song',
|
|
60
|
+
* 'album': 'My Album',
|
|
61
|
+
* 'date': '2024',
|
|
62
|
+
* 'track': '1/10'
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* // Use for codec options
|
|
66
|
+
* const options = Dictionary.fromObject({
|
|
67
|
+
* 'preset': 'medium',
|
|
68
|
+
* 'crf': '23',
|
|
69
|
+
* 'profile': 'high'
|
|
70
|
+
* });
|
|
85
71
|
* ```
|
|
86
72
|
*/
|
|
87
|
-
|
|
73
|
+
static fromObject(obj: Record<string, string>, flags?: AVDictFlag): Dictionary;
|
|
88
74
|
/**
|
|
89
|
-
* Create
|
|
90
|
-
*
|
|
75
|
+
* Create dictionary from native instance.
|
|
76
|
+
*
|
|
77
|
+
* @param native - Native dictionary instance
|
|
78
|
+
* @returns Dictionary wrapper
|
|
79
|
+
*
|
|
91
80
|
* @internal
|
|
92
81
|
*/
|
|
93
82
|
static fromNative(native: NativeDictionary): Dictionary;
|
|
94
83
|
/**
|
|
95
|
-
*
|
|
84
|
+
* Allocate a dictionary.
|
|
96
85
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
86
|
+
* Allocates memory for the dictionary structure.
|
|
87
|
+
* Must be called before using the dictionary.
|
|
99
88
|
*
|
|
100
|
-
*
|
|
101
|
-
* @param flags - AV_DICT_* flags for set operations
|
|
89
|
+
* Direct mapping to av_dict_alloc().
|
|
102
90
|
*
|
|
103
|
-
* @
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```typescript
|
|
107
|
-
* import { Dictionary } from 'node-av';
|
|
108
|
-
*
|
|
109
|
-
* const options = {
|
|
110
|
-
* bitrate: '128k',
|
|
111
|
-
* preset: 'fast',
|
|
112
|
-
* crf: '23'
|
|
113
|
-
* };
|
|
114
|
-
*
|
|
115
|
-
* const dict = Dictionary.fromObject(options);
|
|
116
|
-
* // Use with codec or format context
|
|
117
|
-
* await codecContext.open2(codec, dict);
|
|
118
|
-
* dict.free();
|
|
119
|
-
* ```
|
|
120
|
-
*/
|
|
121
|
-
static fromObject(obj: Record<string, string>, flags?: AVDictFlag): Dictionary;
|
|
122
|
-
/**
|
|
123
|
-
* Allocate a new dictionary.
|
|
124
|
-
*
|
|
125
|
-
* Usually not needed as set() will auto-allocate.
|
|
126
|
-
* This is mainly for compatibility - FFmpeg doesn't have explicit av_dict_alloc.
|
|
91
|
+
* @throws {Error} If allocation fails (ENOMEM)
|
|
127
92
|
*
|
|
128
93
|
* @example
|
|
129
94
|
* ```typescript
|
|
130
95
|
* const dict = new Dictionary();
|
|
131
|
-
* dict.alloc();
|
|
96
|
+
* dict.alloc();
|
|
97
|
+
* // Dictionary is now ready for use
|
|
132
98
|
* ```
|
|
99
|
+
*
|
|
100
|
+
* @see {@link free} To deallocate
|
|
133
101
|
*/
|
|
134
102
|
alloc(): void;
|
|
135
103
|
/**
|
|
136
|
-
* Free
|
|
104
|
+
* Free the dictionary.
|
|
137
105
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
106
|
+
* Releases all memory associated with the dictionary.
|
|
107
|
+
* The dictionary becomes invalid after calling this.
|
|
108
|
+
*
|
|
109
|
+
* Direct mapping to av_dict_free().
|
|
140
110
|
*
|
|
141
111
|
* @example
|
|
142
112
|
* ```typescript
|
|
143
113
|
* dict.free();
|
|
144
|
-
* // Dictionary is now
|
|
145
|
-
* dict.set('new_key', 'new_value', 0);
|
|
114
|
+
* // Dictionary is now invalid
|
|
146
115
|
* ```
|
|
116
|
+
*
|
|
117
|
+
* @see {@link alloc} To allocate
|
|
118
|
+
* @see {@link Symbol.dispose} For automatic cleanup
|
|
147
119
|
*/
|
|
148
120
|
free(): void;
|
|
149
121
|
/**
|
|
150
|
-
* Copy entries
|
|
151
|
-
*
|
|
152
|
-
* Copies all entries to the destination dictionary.
|
|
153
|
-
* Destination entries can be preserved or overwritten based on flags.
|
|
122
|
+
* Copy entries to another dictionary.
|
|
154
123
|
*
|
|
155
|
-
*
|
|
124
|
+
* Copies all entries from this dictionary to the destination.
|
|
156
125
|
*
|
|
157
|
-
*
|
|
158
|
-
* @param flags - AV_DICT_* flags for the copy operation
|
|
126
|
+
* Direct mapping to av_dict_copy().
|
|
159
127
|
*
|
|
128
|
+
* @param dst - Destination dictionary
|
|
129
|
+
* @param flags - Copy flags
|
|
160
130
|
* @returns 0 on success, negative AVERROR on error:
|
|
161
|
-
* -
|
|
162
|
-
* - AVERROR(ENOMEM): Memory allocation failure
|
|
131
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
163
132
|
*
|
|
164
133
|
* @example
|
|
165
134
|
* ```typescript
|
|
166
|
-
* import {
|
|
167
|
-
*
|
|
168
|
-
* const src = new Dictionary();
|
|
169
|
-
* src.set('key1', 'value1');
|
|
170
|
-
* src.set('key2', 'value2');
|
|
135
|
+
* import { FFmpegError } from 'node-av';
|
|
171
136
|
*
|
|
172
137
|
* const dst = new Dictionary();
|
|
138
|
+
* dst.alloc();
|
|
173
139
|
* const ret = src.copy(dst);
|
|
174
140
|
* FFmpegError.throwIfError(ret, 'copy');
|
|
175
141
|
* ```
|
|
176
|
-
*
|
|
177
|
-
* @note Common flags:
|
|
178
|
-
* - AVFLAG_NONE: Default behavior
|
|
179
|
-
* - AV_DICT_DONT_OVERWRITE: Don't overwrite existing entries
|
|
180
|
-
* - AV_DICT_MULTIKEY: Allow multiple entries with same key
|
|
181
142
|
*/
|
|
182
143
|
copy(dst: Dictionary, flags?: AVDictFlag): number;
|
|
183
144
|
/**
|
|
184
|
-
* Set
|
|
185
|
-
*
|
|
186
|
-
* Adds or modifies a key-value pair in the dictionary.
|
|
187
|
-
* If key or value are empty, the entry is deleted.
|
|
188
|
-
* The dictionary will be auto-allocated on first call if needed.
|
|
145
|
+
* Set a dictionary entry.
|
|
189
146
|
*
|
|
190
|
-
*
|
|
147
|
+
* Sets or updates a key-value pair in the dictionary.
|
|
191
148
|
*
|
|
192
|
-
*
|
|
193
|
-
* @param value - Entry value to add/modify
|
|
194
|
-
* @param flags - AV_DICT_* flags
|
|
149
|
+
* Direct mapping to av_dict_set().
|
|
195
150
|
*
|
|
151
|
+
* @param key - Entry key
|
|
152
|
+
* @param value - Entry value
|
|
153
|
+
* @param flags - Set flags (e.g., AV_DICT_DONT_OVERWRITE)
|
|
196
154
|
* @returns 0 on success, negative AVERROR on error:
|
|
197
|
-
* -
|
|
198
|
-
* - AVERROR(ENOMEM): Memory allocation failure
|
|
155
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
199
156
|
*
|
|
200
157
|
* @example
|
|
201
158
|
* ```typescript
|
|
202
|
-
* import {
|
|
159
|
+
* import { FFmpegError } from 'node-av';
|
|
203
160
|
* import { AV_DICT_DONT_OVERWRITE } from 'node-av/constants';
|
|
204
161
|
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* const ret2 = dict.set('preset', 'fast', AV_DICT_DONT_OVERWRITE);
|
|
209
|
-
* FFmpegError.throwIfError(ret2, 'set preset');
|
|
162
|
+
* // Set or update entry
|
|
163
|
+
* let ret = dict.set('bitrate', '128k');
|
|
164
|
+
* FFmpegError.throwIfError(ret, 'set');
|
|
210
165
|
*
|
|
211
|
-
* //
|
|
212
|
-
* dict.set('
|
|
166
|
+
* // Set only if not exists
|
|
167
|
+
* ret = dict.set('preset', 'fast', AV_DICT_DONT_OVERWRITE);
|
|
168
|
+
* FFmpegError.throwIfError(ret, 'set');
|
|
213
169
|
* ```
|
|
214
170
|
*
|
|
215
|
-
* @
|
|
216
|
-
* - AVFLAG_NONE: Default behavior (replace existing, copy strings)
|
|
217
|
-
* - AV_DICT_DONT_OVERWRITE: Don't overwrite existing entries
|
|
218
|
-
* - AV_DICT_APPEND: Append to existing value (with comma separator)
|
|
219
|
-
* - AV_DICT_MULTIKEY: Allow multiple entries with same key
|
|
220
|
-
* - AV_DICT_MATCH_CASE: Case sensitive key matching
|
|
171
|
+
* @see {@link get} To retrieve values
|
|
221
172
|
*/
|
|
222
173
|
set(key: string, value: string, flags?: AVDictFlag): number;
|
|
223
174
|
/**
|
|
224
|
-
* Get a dictionary entry
|
|
175
|
+
* Get a dictionary entry.
|
|
225
176
|
*
|
|
226
|
-
*
|
|
177
|
+
* Retrieves the value for a given key.
|
|
227
178
|
*
|
|
228
|
-
*
|
|
229
|
-
* @param flags - AV_DICT_* flags for matching
|
|
179
|
+
* Direct mapping to av_dict_get().
|
|
230
180
|
*
|
|
231
|
-
* @
|
|
181
|
+
* @param key - Entry key to look up
|
|
182
|
+
* @param flags - Search flags (e.g., AV_DICT_IGNORE_SUFFIX)
|
|
183
|
+
* @returns Entry value, or null if not found
|
|
232
184
|
*
|
|
233
185
|
* @example
|
|
234
186
|
* ```typescript
|
|
@@ -237,20 +189,21 @@ export declare class Dictionary implements Disposable, NativeWrapper<NativeDicti
|
|
|
237
189
|
* console.log(`Bitrate: ${value}`);
|
|
238
190
|
* }
|
|
239
191
|
*
|
|
240
|
-
* // Case
|
|
192
|
+
* // Case-insensitive search
|
|
193
|
+
* import { AV_DICT_MATCH_CASE } from 'node-av/constants';
|
|
241
194
|
* const title = dict.get('Title', AV_DICT_MATCH_CASE);
|
|
242
195
|
* ```
|
|
243
196
|
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* - AV_DICT_MATCH_CASE: Case sensitive matching
|
|
247
|
-
* - AV_DICT_IGNORE_SUFFIX: Match entries starting with key
|
|
197
|
+
* @see {@link set} To set values
|
|
198
|
+
* @see {@link getAll} To get all entries
|
|
248
199
|
*/
|
|
249
200
|
get(key: string, flags?: AVDictFlag): string | null;
|
|
250
201
|
/**
|
|
251
|
-
*
|
|
202
|
+
* Count dictionary entries.
|
|
203
|
+
*
|
|
204
|
+
* Returns the number of key-value pairs in the dictionary.
|
|
252
205
|
*
|
|
253
|
-
* Direct mapping to av_dict_count()
|
|
206
|
+
* Direct mapping to av_dict_count().
|
|
254
207
|
*
|
|
255
208
|
* @returns Number of entries
|
|
256
209
|
*
|
|
@@ -262,89 +215,86 @@ export declare class Dictionary implements Disposable, NativeWrapper<NativeDicti
|
|
|
262
215
|
*/
|
|
263
216
|
count(): number;
|
|
264
217
|
/**
|
|
265
|
-
* Get all entries
|
|
218
|
+
* Get all dictionary entries.
|
|
266
219
|
*
|
|
267
|
-
*
|
|
268
|
-
* Internally iterates through all entries using av_dict_get().
|
|
220
|
+
* Returns all key-value pairs as a JavaScript object.
|
|
269
221
|
*
|
|
270
|
-
* @returns Object with all
|
|
222
|
+
* @returns Object with all entries
|
|
271
223
|
*
|
|
272
224
|
* @example
|
|
273
225
|
* ```typescript
|
|
274
|
-
* const
|
|
275
|
-
* for (const [key, value] of Object.entries(
|
|
226
|
+
* const entries = dict.getAll();
|
|
227
|
+
* for (const [key, value] of Object.entries(entries)) {
|
|
276
228
|
* console.log(`${key}: ${value}`);
|
|
277
229
|
* }
|
|
278
|
-
*
|
|
279
|
-
* // Check if dictionary is empty
|
|
280
|
-
* if (Object.keys(dict.getAll()).length === 0) {
|
|
281
|
-
* console.log('Dictionary is empty');
|
|
282
|
-
* }
|
|
283
230
|
* ```
|
|
231
|
+
*
|
|
232
|
+
* @see {@link get} To get individual entries
|
|
284
233
|
*/
|
|
285
234
|
getAll(): Record<string, string>;
|
|
286
235
|
/**
|
|
287
|
-
* Parse
|
|
236
|
+
* Parse entries from a string.
|
|
288
237
|
*
|
|
289
|
-
* Parses a formatted string
|
|
290
|
-
*
|
|
238
|
+
* Parses key-value pairs from a formatted string and adds them
|
|
239
|
+
* to the dictionary.
|
|
291
240
|
*
|
|
292
|
-
* Direct mapping to av_dict_parse_string()
|
|
293
|
-
*
|
|
294
|
-
* @param str - String to parse (e.g., "key1=value1:key2=value2")
|
|
295
|
-
* @param keyValSep - String separator between key and value (e.g., '=' or ':=')
|
|
296
|
-
* @param pairsSep - String separator between pairs (e.g., ':' or ',' or ';')
|
|
297
|
-
* @param flags - AV_DICT_* flags (default: AVFLAG_NONE)
|
|
241
|
+
* Direct mapping to av_dict_parse_string().
|
|
298
242
|
*
|
|
243
|
+
* @param str - String to parse
|
|
244
|
+
* @param keyValSep - Separator between key and value
|
|
245
|
+
* @param pairsSep - Separator between pairs
|
|
246
|
+
* @param flags - Parse flags
|
|
299
247
|
* @returns 0 on success, negative AVERROR on error:
|
|
300
|
-
* -
|
|
301
|
-
* -
|
|
302
|
-
* - AVERROR(ENOMEM): Memory allocation failure
|
|
248
|
+
* - AVERROR_EINVAL: Invalid format
|
|
249
|
+
* - AVERROR_ENOMEM: Memory allocation failure
|
|
303
250
|
*
|
|
304
251
|
* @example
|
|
305
252
|
* ```typescript
|
|
306
|
-
* import {
|
|
253
|
+
* import { FFmpegError } from 'node-av';
|
|
307
254
|
*
|
|
308
|
-
* // Parse
|
|
309
|
-
*
|
|
255
|
+
* // Parse colon-separated pairs
|
|
256
|
+
* let ret = dict.parseString('key1=val1:key2=val2', '=', ':');
|
|
310
257
|
* FFmpegError.throwIfError(ret, 'parseString');
|
|
311
258
|
*
|
|
312
|
-
* // Parse
|
|
313
|
-
*
|
|
314
|
-
* FFmpegError.throwIfError(
|
|
259
|
+
* // Parse comma-separated pairs
|
|
260
|
+
* ret = dict.parseString('width=1920,height=1080', '=', ',');
|
|
261
|
+
* FFmpegError.throwIfError(ret, 'parseString');
|
|
315
262
|
* ```
|
|
316
263
|
*
|
|
317
|
-
* @see {@link getString} To
|
|
264
|
+
* @see {@link getString} To serialize to string
|
|
318
265
|
*/
|
|
319
266
|
parseString(str: string, keyValSep: string, pairsSep: string, flags?: AVDictFlag): number;
|
|
320
267
|
/**
|
|
321
|
-
*
|
|
268
|
+
* Convert dictionary to string.
|
|
322
269
|
*
|
|
323
|
-
*
|
|
270
|
+
* Serializes all entries to a formatted string.
|
|
324
271
|
*
|
|
325
|
-
*
|
|
326
|
-
* @param pairsSep - Character to separate pairs
|
|
272
|
+
* Direct mapping to av_dict_get_string().
|
|
327
273
|
*
|
|
328
|
-
* @
|
|
274
|
+
* @param keyValSep - Separator between key and value
|
|
275
|
+
* @param pairsSep - Separator between pairs
|
|
276
|
+
* @returns Formatted string, or null on error
|
|
329
277
|
*
|
|
330
278
|
* @example
|
|
331
279
|
* ```typescript
|
|
280
|
+
* // Serialize to colon-separated format
|
|
332
281
|
* const str = dict.getString('=', ':');
|
|
333
|
-
* console.log(str); // "key1=
|
|
282
|
+
* console.log(str); // "key1=val1:key2=val2"
|
|
334
283
|
*
|
|
335
|
-
* //
|
|
284
|
+
* // Serialize to comma-separated format
|
|
336
285
|
* const csv = dict.getString('=', ',');
|
|
337
|
-
* console.log(csv); // "key1=
|
|
286
|
+
* console.log(csv); // "key1=val1,key2=val2"
|
|
338
287
|
* ```
|
|
339
288
|
*
|
|
340
|
-
* @see parseString
|
|
289
|
+
* @see {@link parseString} To parse from string
|
|
341
290
|
*/
|
|
342
291
|
getString(keyValSep: string, pairsSep: string): string | null;
|
|
343
292
|
/**
|
|
344
|
-
* Get the native
|
|
293
|
+
* Get the underlying native Dictionary object.
|
|
294
|
+
*
|
|
295
|
+
* @returns The native Dictionary binding object
|
|
345
296
|
*
|
|
346
|
-
* @internal
|
|
347
|
-
* @returns The underlying native dictionary object
|
|
297
|
+
* @internal
|
|
348
298
|
*/
|
|
349
299
|
getNative(): NativeDictionary;
|
|
350
300
|
/**
|
|
@@ -355,17 +305,13 @@ export declare class Dictionary implements Disposable, NativeWrapper<NativeDicti
|
|
|
355
305
|
*
|
|
356
306
|
* @example
|
|
357
307
|
* ```typescript
|
|
358
|
-
* import { Dictionary, FFmpegError } from 'node-av';
|
|
359
|
-
*
|
|
360
308
|
* {
|
|
361
309
|
* using dict = new Dictionary();
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
* // ...
|
|
310
|
+
* dict.alloc();
|
|
311
|
+
* dict.set('key', 'value');
|
|
312
|
+
* // Use dict...
|
|
365
313
|
* } // Automatically freed when leaving scope
|
|
366
314
|
* ```
|
|
367
|
-
*
|
|
368
|
-
* @see {@link free} For manual cleanup
|
|
369
315
|
*/
|
|
370
316
|
[Symbol.dispose](): void;
|
|
371
317
|
}
|