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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io-context.js","sourceRoot":"","sources":["../../src/lib/io-context.ts"],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,MAAM,CAAC;IACrB,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QACzB,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;IAC3C,CAAC;CACF"}
|
package/dist/lib/log.d.ts
CHANGED
|
@@ -1,201 +1,167 @@
|
|
|
1
1
|
import type { AVLogLevel } from '../constants/constants.js';
|
|
2
2
|
import type { LogOptions } from './types.js';
|
|
3
3
|
/**
|
|
4
|
-
* FFmpeg logging
|
|
4
|
+
* FFmpeg logging control and configuration.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Provides control over FFmpeg's internal logging system.
|
|
7
|
+
* Allows setting log levels, custom callbacks, and formatting options.
|
|
8
|
+
* Essential for debugging, monitoring, and error tracking in FFmpeg operations.
|
|
9
9
|
*
|
|
10
|
-
* Direct mapping to FFmpeg's logging API
|
|
10
|
+
* Direct mapping to FFmpeg's logging API.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```typescript
|
|
14
|
-
* import { Log
|
|
14
|
+
* import { Log } from 'node-av';
|
|
15
|
+
* import { AV_LOG_ERROR, AV_LOG_WARNING, AV_LOG_INFO, AV_LOG_DEBUG } from 'node-av/constants';
|
|
15
16
|
*
|
|
16
|
-
* // Set log level
|
|
17
|
-
* Log.setLevel(AV_LOG_WARNING);
|
|
17
|
+
* // Set log level
|
|
18
|
+
* Log.setLevel(AV_LOG_WARNING); // Only show warnings and errors
|
|
18
19
|
*
|
|
19
|
-
* //
|
|
20
|
-
* Log.
|
|
21
|
-
*
|
|
22
|
-
* }, { maxLevel: AV_LOG_ERROR });
|
|
20
|
+
* // Get current log level
|
|
21
|
+
* const level = Log.getLevel();
|
|
22
|
+
* console.log(`Current log level: ${level}`);
|
|
23
23
|
*
|
|
24
|
-
* //
|
|
24
|
+
* // Custom log callback
|
|
25
25
|
* Log.setCallback((level, message) => {
|
|
26
|
-
*
|
|
26
|
+
* if (level <= AV_LOG_ERROR) {
|
|
27
|
+
* console.error(`FFmpeg Error: ${message}`);
|
|
28
|
+
* } else if (level <= AV_LOG_WARNING) {
|
|
29
|
+
* console.warn(`FFmpeg Warning: ${message}`);
|
|
30
|
+
* } else {
|
|
31
|
+
* console.log(`FFmpeg: ${message}`);
|
|
32
|
+
* }
|
|
33
|
+
* }, {
|
|
34
|
+
* printPrefix: true,
|
|
35
|
+
* skipRepeated: true
|
|
27
36
|
* });
|
|
28
37
|
*
|
|
29
|
-
* //
|
|
38
|
+
* // Log a custom message
|
|
39
|
+
* Log.log(AV_LOG_INFO, 'Custom log message');
|
|
40
|
+
*
|
|
41
|
+
* // Reset to default callback
|
|
30
42
|
* Log.resetCallback();
|
|
31
43
|
* ```
|
|
32
44
|
*
|
|
33
|
-
*
|
|
34
|
-
* FFmpeg can generate thousands of log messages per second.
|
|
35
|
-
* Use maxLevel to filter messages and buffered mode for better performance.
|
|
45
|
+
* @see [av_log](https://ffmpeg.org/doxygen/trunk/group__lavu__log.html) - FFmpeg Doxygen
|
|
36
46
|
*/
|
|
37
47
|
export declare class Log {
|
|
38
|
-
private constructor();
|
|
39
48
|
/**
|
|
40
|
-
* Set
|
|
49
|
+
* Set global log level.
|
|
41
50
|
*
|
|
42
|
-
*
|
|
43
|
-
* Messages
|
|
51
|
+
* Sets the minimum log level for FFmpeg messages.
|
|
52
|
+
* Messages below this level will be suppressed.
|
|
44
53
|
*
|
|
45
|
-
* Direct mapping to av_log_set_level()
|
|
54
|
+
* Direct mapping to av_log_set_level().
|
|
46
55
|
*
|
|
47
|
-
* @param level -
|
|
48
|
-
* - AV_LOG_QUIET: Disable all logging
|
|
49
|
-
* - AV_LOG_PANIC: Only extremely fatal issues
|
|
50
|
-
* - AV_LOG_FATAL: Fatal errors only
|
|
51
|
-
* - AV_LOG_ERROR: Errors that can't be recovered
|
|
52
|
-
* - AV_LOG_WARNING: Warnings about potential issues
|
|
53
|
-
* - AV_LOG_INFO: Informational messages
|
|
54
|
-
* - AV_LOG_VERBOSE: Detailed information
|
|
55
|
-
* - AV_LOG_DEBUG: Debug information
|
|
56
|
-
* - AV_LOG_TRACE: Very detailed trace information
|
|
56
|
+
* @param level - Minimum log level to display
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
59
|
* ```typescript
|
|
60
|
-
* import {
|
|
61
|
-
*
|
|
62
|
-
* // Only show errors and fatal messages
|
|
63
|
-
* Log.setLevel(AV_LOG_ERROR);
|
|
60
|
+
* import { AV_LOG_QUIET, AV_LOG_ERROR, AV_LOG_WARNING, AV_LOG_INFO } from 'node-av/constants';
|
|
64
61
|
*
|
|
65
|
-
* //
|
|
66
|
-
* Log.setLevel(
|
|
67
|
-
*
|
|
68
|
-
* //
|
|
69
|
-
* Log.setLevel(AV_LOG_QUIET);
|
|
62
|
+
* Log.setLevel(AV_LOG_QUIET); // Disable all logging
|
|
63
|
+
* Log.setLevel(AV_LOG_ERROR); // Only errors
|
|
64
|
+
* Log.setLevel(AV_LOG_WARNING); // Errors and warnings
|
|
65
|
+
* Log.setLevel(AV_LOG_INFO); // Errors, warnings, and info
|
|
70
66
|
* ```
|
|
71
|
-
*
|
|
72
|
-
* @see {@link getLevel} To retrieve current level
|
|
73
67
|
*/
|
|
74
68
|
static setLevel(level: AVLogLevel): void;
|
|
75
69
|
/**
|
|
76
|
-
* Get
|
|
70
|
+
* Get current log level.
|
|
77
71
|
*
|
|
78
|
-
* Returns the current
|
|
72
|
+
* Returns the current minimum log level setting.
|
|
79
73
|
*
|
|
80
|
-
* Direct mapping to av_log_get_level()
|
|
74
|
+
* Direct mapping to av_log_get_level().
|
|
81
75
|
*
|
|
82
|
-
* @returns Current log level
|
|
76
|
+
* @returns Current log level
|
|
83
77
|
*
|
|
84
78
|
* @example
|
|
85
79
|
* ```typescript
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* // Temporarily change log level
|
|
92
|
-
* const savedLevel = Log.getLevel();
|
|
93
|
-
* Log.setLevel(AV_LOG_INFO);
|
|
94
|
-
* // ... do something ...
|
|
95
|
-
* Log.setLevel(savedLevel); // Restore
|
|
80
|
+
* const level = Log.getLevel();
|
|
81
|
+
* if (level <= AV_LOG_WARNING) {
|
|
82
|
+
* console.log('Logging warnings and above');
|
|
83
|
+
* }
|
|
96
84
|
* ```
|
|
97
85
|
*
|
|
98
|
-
* @see {@link setLevel} To change
|
|
86
|
+
* @see {@link setLevel} To change log level
|
|
99
87
|
*/
|
|
100
88
|
static getLevel(): AVLogLevel;
|
|
101
89
|
/**
|
|
102
|
-
* Log a message
|
|
90
|
+
* Log a message.
|
|
103
91
|
*
|
|
104
|
-
* Sends a message through FFmpeg's
|
|
105
|
-
* The message will be processed according to
|
|
92
|
+
* Sends a log message through FFmpeg's logging system.
|
|
93
|
+
* The message will be processed according to current settings.
|
|
106
94
|
*
|
|
107
|
-
* Direct mapping to av_log()
|
|
95
|
+
* Direct mapping to av_log().
|
|
108
96
|
*
|
|
109
|
-
* @param level - Log level
|
|
97
|
+
* @param level - Log level for this message
|
|
110
98
|
* @param message - Message to log
|
|
111
99
|
*
|
|
112
100
|
* @example
|
|
113
101
|
* ```typescript
|
|
114
|
-
* import {
|
|
115
|
-
*
|
|
116
|
-
* Log.log(AV_LOG_INFO, 'Starting processing...');
|
|
117
|
-
* Log.log(AV_LOG_WARNING, 'Frame rate might be inaccurate');
|
|
118
|
-
* Log.log(AV_LOG_ERROR, 'Failed to open codec');
|
|
102
|
+
* import { AV_LOG_ERROR, AV_LOG_WARNING, AV_LOG_INFO } from 'node-av/constants';
|
|
119
103
|
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* Log.log(AV_LOG_INFO,
|
|
104
|
+
* Log.log(AV_LOG_ERROR, 'Critical error occurred');
|
|
105
|
+
* Log.log(AV_LOG_WARNING, 'Non-fatal warning');
|
|
106
|
+
* Log.log(AV_LOG_INFO, 'Processing started');
|
|
123
107
|
* ```
|
|
124
108
|
*/
|
|
125
109
|
static log(level: AVLogLevel, message: string): void;
|
|
126
110
|
/**
|
|
127
|
-
* Set
|
|
111
|
+
* Set custom log callback.
|
|
128
112
|
*
|
|
129
|
-
* Installs a custom callback to
|
|
130
|
-
*
|
|
131
|
-
* Messages are processed asynchronously without impacting FFmpeg performance.
|
|
132
|
-
* Use options.maxLevel to filter messages at the C level for best performance.
|
|
113
|
+
* Installs a custom callback to handle FFmpeg log messages.
|
|
114
|
+
* Allows redirecting logs to custom handlers or loggers.
|
|
133
115
|
*
|
|
134
|
-
* Direct mapping to av_log_set_callback()
|
|
116
|
+
* Direct mapping to av_log_set_callback().
|
|
135
117
|
*
|
|
136
|
-
* @param callback - Function to
|
|
137
|
-
* @param options -
|
|
138
|
-
* - maxLevel: Only capture messages at or below this level (filtered in C++)
|
|
139
|
-
* - buffered: Buffer messages for batch processing
|
|
118
|
+
* @param callback - Function to handle log messages, or null to remove
|
|
119
|
+
* @param options - Additional logging options
|
|
140
120
|
*
|
|
141
121
|
* @example
|
|
142
122
|
* ```typescript
|
|
143
|
-
* import {
|
|
144
|
-
*
|
|
145
|
-
* // Simple callback (warning: can be slow!)
|
|
146
|
-
* Log.setCallback((level, message) => {
|
|
147
|
-
* console.log(`[${level}] ${message}`);
|
|
148
|
-
* });
|
|
123
|
+
* import { AV_LOG_ERROR, AV_LOG_WARNING } from 'node-av/constants';
|
|
149
124
|
*
|
|
150
|
-
* //
|
|
125
|
+
* // Set custom callback with options
|
|
151
126
|
* Log.setCallback((level, message) => {
|
|
152
|
-
*
|
|
127
|
+
* const timestamp = new Date().toISOString();
|
|
128
|
+
*
|
|
129
|
+
* if (level <= AV_LOG_ERROR) {
|
|
130
|
+
* console.error(`[${timestamp}] ERROR: ${message}`);
|
|
131
|
+
* } else if (level <= AV_LOG_WARNING) {
|
|
132
|
+
* console.warn(`[${timestamp}] WARN: ${message}`);
|
|
133
|
+
* } else {
|
|
134
|
+
* console.log(`[${timestamp}] INFO: ${message}`);
|
|
135
|
+
* }
|
|
153
136
|
* }, {
|
|
154
|
-
*
|
|
137
|
+
* printPrefix: true, // Include context prefix
|
|
138
|
+
* skipRepeated: true, // Skip repeated messages
|
|
139
|
+
* level: AV_LOG_WARNING // Filter level
|
|
155
140
|
* });
|
|
156
141
|
*
|
|
157
|
-
* //
|
|
158
|
-
* Log.setCallback((level, message) => {
|
|
159
|
-
* myLogger.log({
|
|
160
|
-
* level: level,
|
|
161
|
-
* message: message,
|
|
162
|
-
* timestamp: Date.now(),
|
|
163
|
-
* source: 'ffmpeg'
|
|
164
|
-
* });
|
|
165
|
-
* }, {
|
|
166
|
-
* maxLevel: AV_LOG_WARNING
|
|
167
|
-
* });
|
|
168
|
-
*
|
|
169
|
-
* // Reset to default (output to stderr)
|
|
142
|
+
* // Remove custom callback
|
|
170
143
|
* Log.setCallback(null);
|
|
171
144
|
* ```
|
|
172
145
|
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* @see {@link resetCallback} To remove callback
|
|
146
|
+
* @see {@link resetCallback} To restore default
|
|
176
147
|
*/
|
|
177
148
|
static setCallback(callback: ((level: AVLogLevel, message: string) => void) | null, options?: LogOptions): void;
|
|
178
149
|
/**
|
|
179
|
-
* Reset
|
|
150
|
+
* Reset to default log callback.
|
|
180
151
|
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
152
|
+
* Restores the default FFmpeg logging behavior.
|
|
153
|
+
* Removes any custom callback previously set.
|
|
183
154
|
*
|
|
184
|
-
* Direct mapping to av_log_set_callback(
|
|
155
|
+
* Direct mapping to av_log_set_callback() with default handler.
|
|
185
156
|
*
|
|
186
157
|
* @example
|
|
187
158
|
* ```typescript
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* // Remove custom callback
|
|
159
|
+
* // After using custom callback
|
|
191
160
|
* Log.resetCallback();
|
|
192
|
-
* // Now
|
|
193
|
-
*
|
|
194
|
-
* // Equivalent to:
|
|
195
|
-
* Log.setCallback(null);
|
|
161
|
+
* // Now using default FFmpeg logging
|
|
196
162
|
* ```
|
|
197
163
|
*
|
|
198
|
-
* @see {@link setCallback} To
|
|
164
|
+
* @see {@link setCallback} To set custom callback
|
|
199
165
|
*/
|
|
200
166
|
static resetCallback(): void;
|
|
201
167
|
}
|
package/dist/lib/log.js
CHANGED
|
@@ -1,186 +1,154 @@
|
|
|
1
1
|
import { bindings } from './binding.js';
|
|
2
2
|
/**
|
|
3
|
-
* FFmpeg logging
|
|
3
|
+
* FFmpeg logging control and configuration.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Provides control over FFmpeg's internal logging system.
|
|
6
|
+
* Allows setting log levels, custom callbacks, and formatting options.
|
|
7
|
+
* Essential for debugging, monitoring, and error tracking in FFmpeg operations.
|
|
8
8
|
*
|
|
9
|
-
* Direct mapping to FFmpeg's logging API
|
|
9
|
+
* Direct mapping to FFmpeg's logging API.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
|
-
* import { Log
|
|
13
|
+
* import { Log } from 'node-av';
|
|
14
|
+
* import { AV_LOG_ERROR, AV_LOG_WARNING, AV_LOG_INFO, AV_LOG_DEBUG } from 'node-av/constants';
|
|
14
15
|
*
|
|
15
|
-
* // Set log level
|
|
16
|
-
* Log.setLevel(AV_LOG_WARNING);
|
|
16
|
+
* // Set log level
|
|
17
|
+
* Log.setLevel(AV_LOG_WARNING); // Only show warnings and errors
|
|
17
18
|
*
|
|
18
|
-
* //
|
|
19
|
-
* Log.
|
|
20
|
-
*
|
|
21
|
-
* }, { maxLevel: AV_LOG_ERROR });
|
|
19
|
+
* // Get current log level
|
|
20
|
+
* const level = Log.getLevel();
|
|
21
|
+
* console.log(`Current log level: ${level}`);
|
|
22
22
|
*
|
|
23
|
-
* //
|
|
23
|
+
* // Custom log callback
|
|
24
24
|
* Log.setCallback((level, message) => {
|
|
25
|
-
*
|
|
25
|
+
* if (level <= AV_LOG_ERROR) {
|
|
26
|
+
* console.error(`FFmpeg Error: ${message}`);
|
|
27
|
+
* } else if (level <= AV_LOG_WARNING) {
|
|
28
|
+
* console.warn(`FFmpeg Warning: ${message}`);
|
|
29
|
+
* } else {
|
|
30
|
+
* console.log(`FFmpeg: ${message}`);
|
|
31
|
+
* }
|
|
32
|
+
* }, {
|
|
33
|
+
* printPrefix: true,
|
|
34
|
+
* skipRepeated: true
|
|
26
35
|
* });
|
|
27
36
|
*
|
|
28
|
-
* //
|
|
37
|
+
* // Log a custom message
|
|
38
|
+
* Log.log(AV_LOG_INFO, 'Custom log message');
|
|
39
|
+
*
|
|
40
|
+
* // Reset to default callback
|
|
29
41
|
* Log.resetCallback();
|
|
30
42
|
* ```
|
|
31
43
|
*
|
|
32
|
-
*
|
|
33
|
-
* FFmpeg can generate thousands of log messages per second.
|
|
34
|
-
* Use maxLevel to filter messages and buffered mode for better performance.
|
|
44
|
+
* @see [av_log](https://ffmpeg.org/doxygen/trunk/group__lavu__log.html) - FFmpeg Doxygen
|
|
35
45
|
*/
|
|
36
46
|
export class Log {
|
|
37
|
-
// Private constructor - this is a static-only class
|
|
38
|
-
constructor() {
|
|
39
|
-
throw new Error('Log class cannot be instantiated');
|
|
40
|
-
}
|
|
41
47
|
/**
|
|
42
|
-
* Set
|
|
48
|
+
* Set global log level.
|
|
43
49
|
*
|
|
44
|
-
*
|
|
45
|
-
* Messages
|
|
50
|
+
* Sets the minimum log level for FFmpeg messages.
|
|
51
|
+
* Messages below this level will be suppressed.
|
|
46
52
|
*
|
|
47
|
-
* Direct mapping to av_log_set_level()
|
|
53
|
+
* Direct mapping to av_log_set_level().
|
|
48
54
|
*
|
|
49
|
-
* @param level -
|
|
50
|
-
* - AV_LOG_QUIET: Disable all logging
|
|
51
|
-
* - AV_LOG_PANIC: Only extremely fatal issues
|
|
52
|
-
* - AV_LOG_FATAL: Fatal errors only
|
|
53
|
-
* - AV_LOG_ERROR: Errors that can't be recovered
|
|
54
|
-
* - AV_LOG_WARNING: Warnings about potential issues
|
|
55
|
-
* - AV_LOG_INFO: Informational messages
|
|
56
|
-
* - AV_LOG_VERBOSE: Detailed information
|
|
57
|
-
* - AV_LOG_DEBUG: Debug information
|
|
58
|
-
* - AV_LOG_TRACE: Very detailed trace information
|
|
55
|
+
* @param level - Minimum log level to display
|
|
59
56
|
*
|
|
60
57
|
* @example
|
|
61
58
|
* ```typescript
|
|
62
|
-
* import {
|
|
59
|
+
* import { AV_LOG_QUIET, AV_LOG_ERROR, AV_LOG_WARNING, AV_LOG_INFO } from 'node-av/constants';
|
|
63
60
|
*
|
|
64
|
-
* //
|
|
65
|
-
* Log.setLevel(AV_LOG_ERROR);
|
|
66
|
-
*
|
|
67
|
-
* //
|
|
68
|
-
* Log.setLevel(AV_LOG_TRACE);
|
|
69
|
-
*
|
|
70
|
-
* // Disable all logging for maximum performance
|
|
71
|
-
* Log.setLevel(AV_LOG_QUIET);
|
|
61
|
+
* Log.setLevel(AV_LOG_QUIET); // Disable all logging
|
|
62
|
+
* Log.setLevel(AV_LOG_ERROR); // Only errors
|
|
63
|
+
* Log.setLevel(AV_LOG_WARNING); // Errors and warnings
|
|
64
|
+
* Log.setLevel(AV_LOG_INFO); // Errors, warnings, and info
|
|
72
65
|
* ```
|
|
73
|
-
*
|
|
74
|
-
* @see {@link getLevel} To retrieve current level
|
|
75
66
|
*/
|
|
76
67
|
static setLevel(level) {
|
|
77
68
|
bindings.Log.setLevel(level);
|
|
78
69
|
}
|
|
79
70
|
/**
|
|
80
|
-
* Get
|
|
71
|
+
* Get current log level.
|
|
81
72
|
*
|
|
82
|
-
* Returns the current
|
|
73
|
+
* Returns the current minimum log level setting.
|
|
83
74
|
*
|
|
84
|
-
* Direct mapping to av_log_get_level()
|
|
75
|
+
* Direct mapping to av_log_get_level().
|
|
85
76
|
*
|
|
86
|
-
* @returns Current log level
|
|
77
|
+
* @returns Current log level
|
|
87
78
|
*
|
|
88
79
|
* @example
|
|
89
80
|
* ```typescript
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* // Temporarily change log level
|
|
96
|
-
* const savedLevel = Log.getLevel();
|
|
97
|
-
* Log.setLevel(AV_LOG_INFO);
|
|
98
|
-
* // ... do something ...
|
|
99
|
-
* Log.setLevel(savedLevel); // Restore
|
|
81
|
+
* const level = Log.getLevel();
|
|
82
|
+
* if (level <= AV_LOG_WARNING) {
|
|
83
|
+
* console.log('Logging warnings and above');
|
|
84
|
+
* }
|
|
100
85
|
* ```
|
|
101
86
|
*
|
|
102
|
-
* @see {@link setLevel} To change
|
|
87
|
+
* @see {@link setLevel} To change log level
|
|
103
88
|
*/
|
|
104
89
|
static getLevel() {
|
|
105
90
|
return bindings.Log.getLevel();
|
|
106
91
|
}
|
|
107
92
|
/**
|
|
108
|
-
* Log a message
|
|
93
|
+
* Log a message.
|
|
109
94
|
*
|
|
110
|
-
* Sends a message through FFmpeg's
|
|
111
|
-
* The message will be processed according to
|
|
95
|
+
* Sends a log message through FFmpeg's logging system.
|
|
96
|
+
* The message will be processed according to current settings.
|
|
112
97
|
*
|
|
113
|
-
* Direct mapping to av_log()
|
|
98
|
+
* Direct mapping to av_log().
|
|
114
99
|
*
|
|
115
|
-
* @param level - Log level
|
|
100
|
+
* @param level - Log level for this message
|
|
116
101
|
* @param message - Message to log
|
|
117
102
|
*
|
|
118
103
|
* @example
|
|
119
104
|
* ```typescript
|
|
120
|
-
* import {
|
|
121
|
-
*
|
|
122
|
-
* Log.log(AV_LOG_INFO, 'Starting processing...');
|
|
123
|
-
* Log.log(AV_LOG_WARNING, 'Frame rate might be inaccurate');
|
|
124
|
-
* Log.log(AV_LOG_ERROR, 'Failed to open codec');
|
|
105
|
+
* import { AV_LOG_ERROR, AV_LOG_WARNING, AV_LOG_INFO } from 'node-av/constants';
|
|
125
106
|
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* Log.log(AV_LOG_INFO,
|
|
107
|
+
* Log.log(AV_LOG_ERROR, 'Critical error occurred');
|
|
108
|
+
* Log.log(AV_LOG_WARNING, 'Non-fatal warning');
|
|
109
|
+
* Log.log(AV_LOG_INFO, 'Processing started');
|
|
129
110
|
* ```
|
|
130
111
|
*/
|
|
131
112
|
static log(level, message) {
|
|
132
113
|
bindings.Log.log(level, message);
|
|
133
114
|
}
|
|
134
115
|
/**
|
|
135
|
-
* Set
|
|
116
|
+
* Set custom log callback.
|
|
136
117
|
*
|
|
137
|
-
* Installs a custom callback to
|
|
138
|
-
*
|
|
139
|
-
* Messages are processed asynchronously without impacting FFmpeg performance.
|
|
140
|
-
* Use options.maxLevel to filter messages at the C level for best performance.
|
|
118
|
+
* Installs a custom callback to handle FFmpeg log messages.
|
|
119
|
+
* Allows redirecting logs to custom handlers or loggers.
|
|
141
120
|
*
|
|
142
|
-
* Direct mapping to av_log_set_callback()
|
|
121
|
+
* Direct mapping to av_log_set_callback().
|
|
143
122
|
*
|
|
144
|
-
* @param callback - Function to
|
|
145
|
-
* @param options -
|
|
146
|
-
* - maxLevel: Only capture messages at or below this level (filtered in C++)
|
|
147
|
-
* - buffered: Buffer messages for batch processing
|
|
123
|
+
* @param callback - Function to handle log messages, or null to remove
|
|
124
|
+
* @param options - Additional logging options
|
|
148
125
|
*
|
|
149
126
|
* @example
|
|
150
127
|
* ```typescript
|
|
151
|
-
* import {
|
|
152
|
-
*
|
|
153
|
-
* // Simple callback (warning: can be slow!)
|
|
154
|
-
* Log.setCallback((level, message) => {
|
|
155
|
-
* console.log(`[${level}] ${message}`);
|
|
156
|
-
* });
|
|
157
|
-
*
|
|
158
|
-
* // Performance-optimized callback (filters at C level)
|
|
159
|
-
* Log.setCallback((level, message) => {
|
|
160
|
-
* errorReporter.log(message);
|
|
161
|
-
* }, {
|
|
162
|
-
* maxLevel: AV_LOG_ERROR // Only capture errors (filtered in C++)
|
|
163
|
-
* });
|
|
128
|
+
* import { AV_LOG_ERROR, AV_LOG_WARNING } from 'node-av/constants';
|
|
164
129
|
*
|
|
165
|
-
* //
|
|
130
|
+
* // Set custom callback with options
|
|
166
131
|
* Log.setCallback((level, message) => {
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* timestamp:
|
|
171
|
-
*
|
|
172
|
-
*
|
|
132
|
+
* const timestamp = new Date().toISOString();
|
|
133
|
+
*
|
|
134
|
+
* if (level <= AV_LOG_ERROR) {
|
|
135
|
+
* console.error(`[${timestamp}] ERROR: ${message}`);
|
|
136
|
+
* } else if (level <= AV_LOG_WARNING) {
|
|
137
|
+
* console.warn(`[${timestamp}] WARN: ${message}`);
|
|
138
|
+
* } else {
|
|
139
|
+
* console.log(`[${timestamp}] INFO: ${message}`);
|
|
140
|
+
* }
|
|
173
141
|
* }, {
|
|
174
|
-
*
|
|
142
|
+
* printPrefix: true, // Include context prefix
|
|
143
|
+
* skipRepeated: true, // Skip repeated messages
|
|
144
|
+
* level: AV_LOG_WARNING // Filter level
|
|
175
145
|
* });
|
|
176
146
|
*
|
|
177
|
-
* //
|
|
147
|
+
* // Remove custom callback
|
|
178
148
|
* Log.setCallback(null);
|
|
179
149
|
* ```
|
|
180
150
|
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
* @see {@link resetCallback} To remove callback
|
|
151
|
+
* @see {@link resetCallback} To restore default
|
|
184
152
|
*/
|
|
185
153
|
static setCallback(callback, options) {
|
|
186
154
|
if (callback === null) {
|
|
@@ -191,26 +159,21 @@ export class Log {
|
|
|
191
159
|
}
|
|
192
160
|
}
|
|
193
161
|
/**
|
|
194
|
-
* Reset
|
|
162
|
+
* Reset to default log callback.
|
|
195
163
|
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
164
|
+
* Restores the default FFmpeg logging behavior.
|
|
165
|
+
* Removes any custom callback previously set.
|
|
198
166
|
*
|
|
199
|
-
* Direct mapping to av_log_set_callback(
|
|
167
|
+
* Direct mapping to av_log_set_callback() with default handler.
|
|
200
168
|
*
|
|
201
169
|
* @example
|
|
202
170
|
* ```typescript
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* // Remove custom callback
|
|
171
|
+
* // After using custom callback
|
|
206
172
|
* Log.resetCallback();
|
|
207
|
-
* // Now
|
|
208
|
-
*
|
|
209
|
-
* // Equivalent to:
|
|
210
|
-
* Log.setCallback(null);
|
|
173
|
+
* // Now using default FFmpeg logging
|
|
211
174
|
* ```
|
|
212
175
|
*
|
|
213
|
-
* @see {@link setCallback} To
|
|
176
|
+
* @see {@link setCallback} To set custom callback
|
|
214
177
|
*/
|
|
215
178
|
static resetCallback() {
|
|
216
179
|
bindings.Log.resetCallback();
|
package/dist/lib/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/lib/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/lib/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,OAAO,GAAG;IACd;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAiB;QAC/B,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,QAAQ;QACb,OAAO,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,GAAG,CAAC,KAAiB,EAAE,OAAe;QAC3C,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,MAAM,CAAC,WAAW,CAAC,QAA+D,EAAE,OAAoB;QACtG,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,aAAa;QAClB,QAAQ,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;IAC/B,CAAC;CACF"}
|