homebridge-plugin-utils 1.15.2 → 1.16.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 (51) hide show
  1. package/README.md +4 -1
  2. package/build/eslint-rules.mjs +1 -0
  3. package/dist/featureoptions.d.ts +83 -5
  4. package/dist/featureoptions.js +65 -6
  5. package/dist/featureoptions.js.map +1 -1
  6. package/dist/ffmpeg/codecs.d.ts +172 -0
  7. package/dist/ffmpeg/codecs.js +374 -0
  8. package/dist/ffmpeg/codecs.js.map +1 -0
  9. package/dist/ffmpeg/exec.d.ts +108 -0
  10. package/dist/ffmpeg/exec.js +122 -0
  11. package/dist/ffmpeg/exec.js.map +1 -0
  12. package/dist/ffmpeg/index.d.ts +8 -0
  13. package/dist/ffmpeg/index.js +13 -0
  14. package/dist/ffmpeg/index.js.map +1 -0
  15. package/dist/ffmpeg/options.d.ts +345 -0
  16. package/dist/ffmpeg/options.js +750 -0
  17. package/dist/ffmpeg/options.js.map +1 -0
  18. package/dist/ffmpeg/process.d.ts +155 -0
  19. package/dist/ffmpeg/process.js +344 -0
  20. package/dist/ffmpeg/process.js.map +1 -0
  21. package/dist/ffmpeg/record.d.ts +230 -0
  22. package/dist/ffmpeg/record.js +504 -0
  23. package/dist/ffmpeg/record.js.map +1 -0
  24. package/dist/ffmpeg/rtp.d.ts +205 -0
  25. package/dist/ffmpeg/rtp.js +335 -0
  26. package/dist/ffmpeg/rtp.js.map +1 -0
  27. package/dist/ffmpeg/settings.d.ts +6 -0
  28. package/dist/ffmpeg/settings.js +17 -0
  29. package/dist/ffmpeg/settings.js.map +1 -0
  30. package/dist/ffmpeg/stream.d.ts +143 -0
  31. package/dist/ffmpeg/stream.js +186 -0
  32. package/dist/ffmpeg/stream.js.map +1 -0
  33. package/dist/index.d.ts +1 -1
  34. package/dist/index.js +1 -1
  35. package/dist/index.js.map +1 -1
  36. package/dist/mqttclient.d.ts +161 -1
  37. package/dist/mqttclient.js +161 -9
  38. package/dist/mqttclient.js.map +1 -1
  39. package/dist/service.d.ts +9 -2
  40. package/dist/service.js +6 -0
  41. package/dist/service.js.map +1 -1
  42. package/dist/ui/featureoptions.js +65 -6
  43. package/dist/ui/featureoptions.js.map +1 -1
  44. package/dist/ui/webUi-featureoptions.mjs +5 -4
  45. package/dist/util.d.ts +203 -12
  46. package/dist/util.js +95 -12
  47. package/dist/util.js.map +1 -1
  48. package/package.json +13 -9
  49. package/dist/rtp.d.ts +0 -32
  50. package/dist/rtp.js +0 -178
  51. package/dist/rtp.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/ffmpeg/options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAmG5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,OAAO,aAAa;IAExB;;;OAGG;IACI,YAAY,CAAe;IAElC;;OAEG;IACa,KAAK,CAAU;IAE/B;;OAEG;IACa,GAAG,CAAoC;IAEvD;;OAEG;IACa,IAAI,CAAe;IAEnC;;OAEG;IACa,OAAO,CAAsB;IAE5B,aAAa,CAAW;IAEzC;;;;;;;;;;OAUG;IACH,YAAY,OAA4B;QAEtC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;QAEpC,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,+CAA+C;QAC/C,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;O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E,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;YAElC;gBAEE,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;YAEjC;gBAEE,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;QACnC,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,155 @@
1
+ /**
2
+ * FFmpeg process management and capability introspection.
3
+ *
4
+ * This module defines the `FfmpegProcess` class, which abstracts the spawning, monitoring, and logging of FFmpeg subprocesses. It manages process state, handles
5
+ * command-line argument composition, processes standard streams (stdin, stdout, stderr), and robustly reports process errors and exit conditions.
6
+ *
7
+ * Designed for use in Homebridge plugins, this module enables safe and flexible execution of FFmpeg commands, making it easier to integrate video/audio processing
8
+ * pipelines with realtime control and diagnostics.
9
+ *
10
+ * Key features:
11
+ *
12
+ * - Comprehensive FFmpeg subprocess management (start, monitor, stop, cleanup).
13
+ * - Streamlined error handling and logging, with pluggable loggers.
14
+ * - Access to process I/O streams for data injection and consumption.
15
+ * - Flexible callback and event-based architecture for streaming scenarios.
16
+ *
17
+ * Intended for developers needing direct, reliable control over FFmpeg process lifecycles with detailed runtime insights, especially in plugin or media automation
18
+ * contexts.
19
+ *
20
+ * @module
21
+ */
22
+ import { type ChildProcessWithoutNullStreams } from "node:child_process";
23
+ import type { HomebridgePluginLogging, Nullable } from "../util.js";
24
+ import type { Readable, Writable } from "node:stream";
25
+ import { EventEmitter } from "node:events";
26
+ import type { FfmpegOptions } from "./options.js";
27
+ import type { StreamRequestCallback } from "homebridge";
28
+ /**
29
+ * Base class providing FFmpeg process management and capability introspection.
30
+ *
31
+ * This class encapsulates spawning, managing, and logging of FFmpeg processes, as well as handling process I/O and errors. It is designed as a reusable foundation for
32
+ * advanced FFmpeg process control in Homebridge plugins or similar environments. Originally inspired by the Homebridge and homebridge-camera-ffmpeg source code.
33
+ *
34
+ * @example
35
+ *
36
+ * ```ts
37
+ * // Create and start an FFmpeg process.
38
+ * const process = new FfmpegProcess(options, ["-i", "input.mp4", "-f", "null", "-"]);
39
+ * process.start();
40
+ *
41
+ * // Access process streams if needed.
42
+ * const stdin = process.stdin;
43
+ * const stdout = process.stdout;
44
+ * const stderr = process.stderr;
45
+ *
46
+ * // Stop the FFmpeg process when done.
47
+ * process.stop();
48
+ * ```
49
+ *
50
+ * @see {@link https://ffmpeg.org/documentation.html | FFmpeg Documentation}
51
+ *
52
+ * @see {@link https://nodejs.org/api/child_process.html | Node.js child_process}
53
+ *
54
+ * @see FfmpegOptions
55
+ *
56
+ * @category FFmpeg
57
+ */
58
+ export declare class FfmpegProcess extends EventEmitter {
59
+ /**
60
+ * Indicates if an error has occurred during FFmpeg process execution.
61
+ */
62
+ hasError: boolean;
63
+ /**
64
+ * Indicates whether the FFmpeg process has ended.
65
+ */
66
+ isEnded: boolean;
67
+ /**
68
+ * Indicates whether the FFmpeg process has started.
69
+ */
70
+ isStarted: boolean;
71
+ /**
72
+ * Optional callback to be called when the FFmpeg process is ready for streaming.
73
+ */
74
+ protected callback: Nullable<StreamRequestCallback>;
75
+ /**
76
+ * The command line arguments for invoking FFmpeg.
77
+ */
78
+ protected commandLineArgs: string[];
79
+ /**
80
+ * Enables verbose logging for FFmpeg process output.
81
+ */
82
+ protected isVerbose: boolean;
83
+ /**
84
+ * Logger instance for output and error reporting.
85
+ */
86
+ protected readonly log: HomebridgePluginLogging;
87
+ /**
88
+ * FFmpeg process configuration options.
89
+ */
90
+ protected readonly options: FfmpegOptions;
91
+ /**
92
+ * The underlying Node.js ChildProcess instance for the FFmpeg process.
93
+ */
94
+ protected process: Nullable<ChildProcessWithoutNullStreams>;
95
+ /**
96
+ * Accumulated log lines from standard error for error reporting and debugging.
97
+ */
98
+ protected stderrLog: string[];
99
+ private ffmpegTimeout?;
100
+ private isLogging;
101
+ private stderrBuffer;
102
+ constructor(options: FfmpegOptions, commandLineArgs?: string[], callback?: StreamRequestCallback);
103
+ private prepareProcess;
104
+ /**
105
+ * Starts the FFmpeg process with the provided command line and callback.
106
+ *
107
+ * @param commandLineArgs - Optional. Arguments for FFmpeg command line.
108
+ * @param callback - Optional. Callback invoked when streaming is ready.
109
+ * @param errorHandler - Optional. Function called if FFmpeg fails to start or terminates with error.
110
+ *
111
+ * @example
112
+ *
113
+ * ```ts
114
+ * process.start(["-i", "input.mp4", "-f", "null", "-"]);
115
+ * ```
116
+ */
117
+ protected start(commandLineArgs?: string[], callback?: StreamRequestCallback, errorHandler?: (errorMessage: string) => Promise<void> | void): void;
118
+ protected configureProcess(errorHandler?: (errorMessage: string) => Promise<void> | void): void;
119
+ protected stopProcess(): void;
120
+ /**
121
+ * Stops the FFmpeg process and performs necessary cleanup.
122
+ *
123
+ * @example
124
+ *
125
+ * ```ts
126
+ * process.stop();
127
+ * ```
128
+ */
129
+ stop(): void;
130
+ /**
131
+ * Logs an error message for FFmpeg process termination.
132
+ *
133
+ * @param exitCode - The exit code from FFmpeg.
134
+ * @param signal - The signal, if any, used to terminate the process.
135
+ */
136
+ protected logFfmpegError(exitCode: number, signal: NodeJS.Signals): void;
137
+ /**
138
+ * Returns the writable standard input stream for the FFmpeg process, if available.
139
+ *
140
+ * @returns The standard input stream, or `null` if not available.
141
+ */
142
+ get stdin(): Nullable<Writable>;
143
+ /**
144
+ * Returns the readable standard output stream for the FFmpeg process, if available.
145
+ *
146
+ * @returns The standard output stream, or `null` if not available.
147
+ */
148
+ get stdout(): Nullable<Readable>;
149
+ /**
150
+ * Returns the readable standard error stream for the FFmpeg process, if available.
151
+ *
152
+ * @returns The standard error stream, or `null` if not available.
153
+ */
154
+ get stderr(): Nullable<Readable>;
155
+ }
@@ -0,0 +1,344 @@
1
+ /* Copyright(C) 2017-2025, HJD (https://github.com/hjdhjd). All rights reserved.
2
+ *
3
+ * ffmpeg/process.ts: Base class to provide FFmpeg process control and capability introspection.
4
+ */
5
+ /**
6
+ * FFmpeg process management and capability introspection.
7
+ *
8
+ * This module defines the `FfmpegProcess` class, which abstracts the spawning, monitoring, and logging of FFmpeg subprocesses. It manages process state, handles
9
+ * command-line argument composition, processes standard streams (stdin, stdout, stderr), and robustly reports process errors and exit conditions.
10
+ *
11
+ * Designed for use in Homebridge plugins, this module enables safe and flexible execution of FFmpeg commands, making it easier to integrate video/audio processing
12
+ * pipelines with realtime control and diagnostics.
13
+ *
14
+ * Key features:
15
+ *
16
+ * - Comprehensive FFmpeg subprocess management (start, monitor, stop, cleanup).
17
+ * - Streamlined error handling and logging, with pluggable loggers.
18
+ * - Access to process I/O streams for data injection and consumption.
19
+ * - Flexible callback and event-based architecture for streaming scenarios.
20
+ *
21
+ * Intended for developers needing direct, reliable control over FFmpeg process lifecycles with detailed runtime insights, especially in plugin or media automation
22
+ * contexts.
23
+ *
24
+ * @module
25
+ */
26
+ import { spawn } from "node:child_process";
27
+ import { EventEmitter } from "node:events";
28
+ import os from "node:os";
29
+ import util from "node:util";
30
+ /**
31
+ * Base class providing FFmpeg process management and capability introspection.
32
+ *
33
+ * This class encapsulates spawning, managing, and logging of FFmpeg processes, as well as handling process I/O and errors. It is designed as a reusable foundation for
34
+ * advanced FFmpeg process control in Homebridge plugins or similar environments. Originally inspired by the Homebridge and homebridge-camera-ffmpeg source code.
35
+ *
36
+ * @example
37
+ *
38
+ * ```ts
39
+ * // Create and start an FFmpeg process.
40
+ * const process = new FfmpegProcess(options, ["-i", "input.mp4", "-f", "null", "-"]);
41
+ * process.start();
42
+ *
43
+ * // Access process streams if needed.
44
+ * const stdin = process.stdin;
45
+ * const stdout = process.stdout;
46
+ * const stderr = process.stderr;
47
+ *
48
+ * // Stop the FFmpeg process when done.
49
+ * process.stop();
50
+ * ```
51
+ *
52
+ * @see {@link https://ffmpeg.org/documentation.html | FFmpeg Documentation}
53
+ *
54
+ * @see {@link https://nodejs.org/api/child_process.html | Node.js child_process}
55
+ *
56
+ * @see FfmpegOptions
57
+ *
58
+ * @category FFmpeg
59
+ */
60
+ export class FfmpegProcess extends EventEmitter {
61
+ /**
62
+ * Indicates if an error has occurred during FFmpeg process execution.
63
+ */
64
+ hasError;
65
+ /**
66
+ * Indicates whether the FFmpeg process has ended.
67
+ */
68
+ isEnded;
69
+ /**
70
+ * Indicates whether the FFmpeg process has started.
71
+ */
72
+ isStarted;
73
+ /**
74
+ * Optional callback to be called when the FFmpeg process is ready for streaming.
75
+ */
76
+ callback;
77
+ /**
78
+ * The command line arguments for invoking FFmpeg.
79
+ */
80
+ commandLineArgs;
81
+ /**
82
+ * Enables verbose logging for FFmpeg process output.
83
+ */
84
+ isVerbose;
85
+ /**
86
+ * Logger instance for output and error reporting.
87
+ */
88
+ log;
89
+ /**
90
+ * FFmpeg process configuration options.
91
+ */
92
+ options;
93
+ /**
94
+ * The underlying Node.js ChildProcess instance for the FFmpeg process.
95
+ */
96
+ process;
97
+ /**
98
+ * Accumulated log lines from standard error for error reporting and debugging.
99
+ */
100
+ stderrLog;
101
+ ffmpegTimeout;
102
+ isLogging;
103
+ stderrBuffer;
104
+ // Create a new FFmpeg process instance.
105
+ constructor(options, commandLineArgs, callback) {
106
+ // Initialize our parent.
107
+ super();
108
+ this.callback = null;
109
+ this.commandLineArgs = [];
110
+ this.hasError = false;
111
+ this.isLogging = false;
112
+ this.isEnded = false;
113
+ this.isStarted = false;
114
+ this.log = options.log;
115
+ this.options = options;
116
+ this.process = null;
117
+ this.stderrBuffer = "";
118
+ this.stderrLog = [];
119
+ // Toggle FFmpeg logging, if configured.
120
+ this.isVerbose = this.options.codecSupport.verbose;
121
+ // If we've specified a command line or a callback, let's save them.
122
+ if (commandLineArgs) {
123
+ this.commandLineArgs = commandLineArgs;
124
+ }
125
+ if (callback) {
126
+ this.callback = callback;
127
+ }
128
+ }
129
+ // Prepare and start our FFmpeg process.
130
+ prepareProcess(commandLineArgs, callback) {
131
+ // If we've specified a new command line or callback, let's save them.
132
+ if (commandLineArgs) {
133
+ this.commandLineArgs = commandLineArgs;
134
+ }
135
+ // No command line arguments - we're done.
136
+ if (!this.commandLineArgs) {
137
+ this.log.error("No FFmpeg command line specified.");
138
+ return false;
139
+ }
140
+ // Save the callback, if we have one.
141
+ if (callback) {
142
+ this.callback = callback;
143
+ }
144
+ // See if we should display ffmpeg command output.
145
+ this.isLogging = false;
146
+ // Track if we've started or ended FFmpeg.
147
+ this.isStarted = false;
148
+ this.isEnded = false;
149
+ // If we've got a loglevel specified, ensure we display it.
150
+ if (this.commandLineArgs.indexOf("-loglevel") !== -1) {
151
+ this.isLogging = true;
152
+ }
153
+ // Inform the user, if we've been asked to do so.
154
+ if (this.isLogging || this.isVerbose || this.options.debug) {
155
+ this.log.info("FFmpeg command (version: %s): %s %s", this.options.codecSupport.ffmpegVersion, this.options.codecSupport.ffmpegExec, this.commandLineArgs.join(" "));
156
+ }
157
+ else {
158
+ this.log.debug("FFmpeg command (version: %s): %s %s", this.options.codecSupport.ffmpegVersion, this.options.codecSupport.ffmpegExec, this.commandLineArgs.join(" "));
159
+ }
160
+ return true;
161
+ }
162
+ /**
163
+ * Starts the FFmpeg process with the provided command line and callback.
164
+ *
165
+ * @param commandLineArgs - Optional. Arguments for FFmpeg command line.
166
+ * @param callback - Optional. Callback invoked when streaming is ready.
167
+ * @param errorHandler - Optional. Function called if FFmpeg fails to start or terminates with error.
168
+ *
169
+ * @example
170
+ *
171
+ * ```ts
172
+ * process.start(["-i", "input.mp4", "-f", "null", "-"]);
173
+ * ```
174
+ */
175
+ start(commandLineArgs, callback, errorHandler) {
176
+ // Prepared our FFmpeg process.
177
+ if (!this.prepareProcess(commandLineArgs, callback)) {
178
+ this.log.error("Error preparing to run FFmpeg.");
179
+ return;
180
+ }
181
+ // Execute the command line based on what we've prepared.
182
+ this.process = spawn(this.options.codecSupport.ffmpegExec, this.commandLineArgs);
183
+ // Configure any post-spawn listeners and other plumbing.
184
+ this.configureProcess(errorHandler);
185
+ }
186
+ // Configure our FFmpeg process, once started.
187
+ configureProcess(errorHandler) {
188
+ let dataListener;
189
+ let errorListener;
190
+ // Handle errors emitted during process creation, such as an invalid command line.
191
+ this.process?.once("error", (error) => {
192
+ this.log.error("FFmpeg failed to start: %s.", error.message);
193
+ // Execute our error handler, if one is provided.
194
+ if (errorHandler) {
195
+ void errorHandler(error.name + ": " + error.message);
196
+ }
197
+ });
198
+ // Handle errors on stdin.
199
+ this.process?.stdin?.on("error", errorListener = (error) => {
200
+ if (!error.message.includes("EPIPE")) {
201
+ this.log.error("FFmpeg error: %s.", error.message);
202
+ }
203
+ });
204
+ // Handle logging output that gets sent to stderr.
205
+ this.process?.stderr?.on("data", dataListener = (data) => {
206
+ // Inform us when we start receiving data back from FFmpeg. We do this here because it's the only
207
+ // truly reliable place we can check on FFmpeg. stdin and stdout may not be used at all, depending
208
+ // on the way FFmpeg is called, but stderr will always be there.
209
+ if (!this.isStarted) {
210
+ this.isStarted = true;
211
+ this.isEnded = false;
212
+ this.log.debug("Received the first frame.");
213
+ // Always remember to execute the callback once we're setup to let homebridge know we're streaming.
214
+ if (this.callback) {
215
+ this.callback();
216
+ this.callback = null;
217
+ }
218
+ }
219
+ // Append to the current line we've been buffering. We don't want to output not-printable characters to ensure the log output is readable.
220
+ this.stderrBuffer += data.toString().replace(/\p{C}+/gu, os.EOL);
221
+ // Debugging and additional logging collection.
222
+ for (;;) {
223
+ // Find the next newline.
224
+ const lineIndex = this.stderrBuffer.indexOf(os.EOL);
225
+ // If there's no newline, we're done until we get more data.
226
+ if (lineIndex === -1) {
227
+ return;
228
+ }
229
+ // Grab the next complete line, and increment our buffer.
230
+ const line = this.stderrBuffer.slice(0, lineIndex);
231
+ this.stderrBuffer = this.stderrBuffer.slice(lineIndex + os.EOL.length);
232
+ this.stderrLog.push(line);
233
+ // Show it to the user if it's been requested.
234
+ if (this.isLogging || this.isVerbose || this.options.debug) {
235
+ this.log.info(line);
236
+ }
237
+ }
238
+ });
239
+ // Handle our process termination.
240
+ this.process?.once("exit", (exitCode, signal) => {
241
+ // Clear out our canary.
242
+ if (this.ffmpegTimeout) {
243
+ clearTimeout(this.ffmpegTimeout);
244
+ }
245
+ this.isStarted = false;
246
+ this.isEnded = true;
247
+ // Some utilities to streamline things.
248
+ const logPrefix = "FFmpeg process ended ";
249
+ // FFmpeg ended normally and our canary didn't need to enforce FFmpeg's extinction.
250
+ if (this.ffmpegTimeout && (exitCode === 0)) {
251
+ this.log.debug(logPrefix + "(Normal).");
252
+ }
253
+ else if (((exitCode === null) || (exitCode === 255)) && this.process?.killed) {
254
+ // FFmpeg has ended. Let's figure out if it's because we killed it or whether it died of natural causes.
255
+ this.log.debug(logPrefix + (signal === "SIGKILL" ? "(Killed)." : "(Expected)."));
256
+ }
257
+ else {
258
+ // Flag that we've run into an FFmpeg error.
259
+ this.hasError = true;
260
+ // Flush out any remaining output in our error buffer.
261
+ if (this.stderrBuffer.length) {
262
+ this.stderrLog.push(this.stderrBuffer + "\n");
263
+ this.stderrBuffer = "";
264
+ }
265
+ // Inform the user.
266
+ this.logFfmpegError(exitCode, signal);
267
+ // Execute our error handler, if one is provided.
268
+ if (errorHandler) {
269
+ void errorHandler(util.format(this.options.name() + ": " + logPrefix + " unexpectedly with exit code %s and signal %s.", exitCode, signal));
270
+ }
271
+ }
272
+ // Cleanup after ourselves.
273
+ this.process?.stdin?.off("error", errorListener);
274
+ this.process?.stderr?.off("data", dataListener);
275
+ this.process = null;
276
+ this.stderrLog = [];
277
+ });
278
+ }
279
+ // Stop the FFmpeg process and complete any cleanup activities.
280
+ stopProcess() {
281
+ // Check to make sure we aren't using stdin for data before telling FFmpeg we're done.
282
+ if (!this.commandLineArgs.includes("pipe:0")) {
283
+ this.process?.stdin.end("q");
284
+ }
285
+ // Close our input and output.
286
+ this.process?.stdin.destroy();
287
+ this.process?.stdout.destroy();
288
+ // In case we need to kill it again, just to be sure it's really dead.
289
+ this.ffmpegTimeout = setTimeout(() => {
290
+ this.process?.kill("SIGKILL");
291
+ }, 5000);
292
+ // Send the kill shot.
293
+ this.process?.kill();
294
+ }
295
+ /**
296
+ * Stops the FFmpeg process and performs necessary cleanup.
297
+ *
298
+ * @example
299
+ *
300
+ * ```ts
301
+ * process.stop();
302
+ * ```
303
+ */
304
+ stop() {
305
+ this.stopProcess();
306
+ }
307
+ /**
308
+ * Logs an error message for FFmpeg process termination.
309
+ *
310
+ * @param exitCode - The exit code from FFmpeg.
311
+ * @param signal - The signal, if any, used to terminate the process.
312
+ */
313
+ logFfmpegError(exitCode, signal) {
314
+ // Something else has occurred. Inform the user, and stop everything.
315
+ this.log.error("FFmpeg process ended unexpectedly with %s%s%s.", (exitCode !== null) ? "an exit code of " + exitCode.toString() : "", ((exitCode !== null) && signal) ? " and " : "", signal ? "a signal received of " + signal : "");
316
+ this.log.error("FFmpeg (%s) command that errored out was: %s %s", this.options.codecSupport.ffmpegVersion, this.options.codecSupport.ffmpegExec, this.commandLineArgs.join(" "));
317
+ this.stderrLog.map(x => this.log.error(x));
318
+ }
319
+ /**
320
+ * Returns the writable standard input stream for the FFmpeg process, if available.
321
+ *
322
+ * @returns The standard input stream, or `null` if not available.
323
+ */
324
+ get stdin() {
325
+ return this.process?.stdin ?? null;
326
+ }
327
+ /**
328
+ * Returns the readable standard output stream for the FFmpeg process, if available.
329
+ *
330
+ * @returns The standard output stream, or `null` if not available.
331
+ */
332
+ get stdout() {
333
+ return this.process?.stdout ?? null;
334
+ }
335
+ /**
336
+ * Returns the readable standard error stream for the FFmpeg process, if available.
337
+ *
338
+ * @returns The standard error stream, or `null` if not available.
339
+ */
340
+ get stderr() {
341
+ return this.process?.stderr ?? null;
342
+ }
343
+ }
344
+ //# sourceMappingURL=process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/ffmpeg/process.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAuC,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGhF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OA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