homebridge-plugin-utils 1.28.0 → 1.29.1
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/build/eslint-rules.mjs +1 -0
- package/dist/ffmpeg/codecs.d.ts +6 -6
- package/dist/ffmpeg/codecs.js +32 -39
- package/dist/ffmpeg/codecs.js.map +1 -1
- package/dist/ffmpeg/options.d.ts +25 -1
- package/dist/ffmpeg/options.js +191 -110
- package/dist/ffmpeg/options.js.map +1 -1
- package/dist/ffmpeg/record.d.ts +6 -0
- package/dist/ffmpeg/record.js +21 -10
- package/dist/ffmpeg/record.js.map +1 -1
- package/dist/ui/webUi-featureoptions.mjs +188 -9
- package/package.json +4 -4
package/build/eslint-rules.mjs
CHANGED
|
@@ -136,6 +136,7 @@ const tsRules = {
|
|
|
136
136
|
|
|
137
137
|
...tsEslint.configs.strictTypeChecked,
|
|
138
138
|
...tsEslint.configs.stylisticTypeChecked,
|
|
139
|
+
"@stylistic/member-delimiter-style": "warn",
|
|
139
140
|
"@typescript-eslint/await-thenable": "warn",
|
|
140
141
|
"@typescript-eslint/consistent-type-imports": "warn",
|
|
141
142
|
"@typescript-eslint/explicit-function-return-type": "warn",
|
package/dist/ffmpeg/codecs.d.ts
CHANGED
|
@@ -56,10 +56,10 @@ export declare class FfmpegCodecs {
|
|
|
56
56
|
* The path or command name to invoke FFmpeg.
|
|
57
57
|
*/
|
|
58
58
|
readonly ffmpegExec: string;
|
|
59
|
-
private _ffmpegVersion
|
|
60
|
-
private _gpuMem
|
|
61
|
-
private _hostSystem
|
|
62
|
-
private
|
|
59
|
+
private _ffmpegVersion?;
|
|
60
|
+
private _gpuMem?;
|
|
61
|
+
private _hostSystem?;
|
|
62
|
+
private _cpuGeneration?;
|
|
63
63
|
private readonly log;
|
|
64
64
|
private readonly ffmpegCodecs;
|
|
65
65
|
private readonly ffmpegHwAccels;
|
|
@@ -165,11 +165,11 @@ export declare class FfmpegCodecs {
|
|
|
165
165
|
*/
|
|
166
166
|
get hostSystem(): string;
|
|
167
167
|
/**
|
|
168
|
-
* Returns the
|
|
168
|
+
* Returns the CPU generation if we're on Linux and have an Intel processor or on macOS and have an Apple Silicon processor.
|
|
169
169
|
*
|
|
170
170
|
* @returns Returns the CPU generation or 0 if it can't be detected or an invalid platform.
|
|
171
171
|
*/
|
|
172
|
-
get
|
|
172
|
+
get cpuGeneration(): number;
|
|
173
173
|
private probeFfmpegVersion;
|
|
174
174
|
private probeFfmpegHwAccel;
|
|
175
175
|
private probeFfmpegCodecs;
|
package/dist/ffmpeg/codecs.js
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
* @module
|
|
24
24
|
*/
|
|
25
25
|
import { EOL, cpus } from "node:os";
|
|
26
|
-
import { env, platform } from "node:process";
|
|
27
26
|
import { execFile } from "node:child_process";
|
|
27
|
+
import { env, platform } from "node:process";
|
|
28
28
|
import { readFileSync } from "node:fs";
|
|
29
29
|
import util from "node:util";
|
|
30
30
|
/**
|
|
@@ -67,7 +67,7 @@ export class FfmpegCodecs {
|
|
|
67
67
|
_ffmpegVersion;
|
|
68
68
|
_gpuMem;
|
|
69
69
|
_hostSystem;
|
|
70
|
-
|
|
70
|
+
_cpuGeneration;
|
|
71
71
|
log;
|
|
72
72
|
ffmpegCodecs;
|
|
73
73
|
ffmpegHwAccels;
|
|
@@ -81,10 +81,6 @@ export class FfmpegCodecs {
|
|
|
81
81
|
* @param options - Options used to configure FFmpeg probing.
|
|
82
82
|
*/
|
|
83
83
|
constructor(options) {
|
|
84
|
-
this._gpuMem = 0;
|
|
85
|
-
this._ffmpegVersion = "";
|
|
86
|
-
this._hostSystem = "";
|
|
87
|
-
this._intelGeneration = 0;
|
|
88
84
|
this.ffmpegExec = options.ffmpegExec ?? "ffmpeg";
|
|
89
85
|
this.ffmpegCodecs = {};
|
|
90
86
|
this.ffmpegHwAccels = {};
|
|
@@ -207,13 +203,13 @@ export class FfmpegCodecs {
|
|
|
207
203
|
* @remarks Always returns `0` on non-Raspberry Pi systems.
|
|
208
204
|
*/
|
|
209
205
|
get gpuMem() {
|
|
210
|
-
return this._gpuMem;
|
|
206
|
+
return this._gpuMem ?? 0;
|
|
211
207
|
}
|
|
212
208
|
/**
|
|
213
209
|
* Returns the detected FFmpeg version string, or "unknown" if detection failed.
|
|
214
210
|
*/
|
|
215
211
|
get ffmpegVersion() {
|
|
216
|
-
return this._ffmpegVersion;
|
|
212
|
+
return this._ffmpegVersion ?? "";
|
|
217
213
|
}
|
|
218
214
|
/**
|
|
219
215
|
* Returns the host system type we are running on as one of "generic", "macOS.Apple", "macOS.Intel", or "raspbian".
|
|
@@ -221,15 +217,15 @@ export class FfmpegCodecs {
|
|
|
221
217
|
* @remarks We are only trying to detect host capabilities to the extent they impact which FFmpeg options we are going to use.
|
|
222
218
|
*/
|
|
223
219
|
get hostSystem() {
|
|
224
|
-
return this._hostSystem;
|
|
220
|
+
return this._hostSystem ?? "generic";
|
|
225
221
|
}
|
|
226
222
|
/**
|
|
227
|
-
* Returns the
|
|
223
|
+
* Returns the CPU generation if we're on Linux and have an Intel processor or on macOS and have an Apple Silicon processor.
|
|
228
224
|
*
|
|
229
225
|
* @returns Returns the CPU generation or 0 if it can't be detected or an invalid platform.
|
|
230
226
|
*/
|
|
231
|
-
get
|
|
232
|
-
return this.
|
|
227
|
+
get cpuGeneration() {
|
|
228
|
+
return this._cpuGeneration ?? 0;
|
|
233
229
|
}
|
|
234
230
|
// Probe our video processor's version.
|
|
235
231
|
async probeFfmpegVersion() {
|
|
@@ -307,13 +303,20 @@ export class FfmpegCodecs {
|
|
|
307
303
|
}
|
|
308
304
|
// Identify what hardware and operating system environment we're actually running on.
|
|
309
305
|
probeHwOs() {
|
|
310
|
-
// Start off with a generic identifier.
|
|
311
|
-
this._hostSystem = "generic";
|
|
312
306
|
// Take a look at the platform we're on for an initial hint of what we are.
|
|
313
307
|
switch (platform) {
|
|
314
308
|
// The beloved macOS.
|
|
315
309
|
case "darwin":
|
|
316
310
|
this._hostSystem = "macOS." + (cpus()[0].model.includes("Apple") ? "Apple" : "Intel");
|
|
311
|
+
// Identify what generation of Apple Silicon we have.
|
|
312
|
+
if (cpus()[0].model.includes("Apple")) {
|
|
313
|
+
// Extract the CPU model.
|
|
314
|
+
const cpuModel = cpus()[0].model.match(/Apple M(\d+) .*/i);
|
|
315
|
+
this._cpuGeneration = 0;
|
|
316
|
+
if (cpuModel && cpuModel[1]) {
|
|
317
|
+
this._cpuGeneration = Number(cpuModel[1]);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
317
320
|
break;
|
|
318
321
|
// The indomitable Linux.
|
|
319
322
|
case "linux":
|
|
@@ -333,7 +336,7 @@ export class FfmpegCodecs {
|
|
|
333
336
|
if (cpus()[0].model.includes("Intel")) {
|
|
334
337
|
// Extract the CPU model.
|
|
335
338
|
const cpuModel = cpus()[0].model.match(/Intel.*Core.*i\d+-(\d{3,5})/i);
|
|
336
|
-
this.
|
|
339
|
+
this._cpuGeneration = 0;
|
|
337
340
|
if (cpuModel && cpuModel[1]) {
|
|
338
341
|
// Grab the individual SKU as both a number and string.
|
|
339
342
|
const skuStr = cpuModel[1];
|
|
@@ -341,15 +344,15 @@ export class FfmpegCodecs {
|
|
|
341
344
|
// Now deduce the CPU generation.
|
|
342
345
|
if (skuNum < 1000) {
|
|
343
346
|
// First generation CPUs are three digit SKUs.
|
|
344
|
-
this.
|
|
347
|
+
this._cpuGeneration = 1;
|
|
345
348
|
}
|
|
346
349
|
else if (skuStr.length > 4) {
|
|
347
350
|
// For five-digit SKUs, the generation are the leading digits before the last three.
|
|
348
|
-
this.
|
|
351
|
+
this._cpuGeneration = Number(skuStr.slice(0, skuStr.length - 3));
|
|
349
352
|
}
|
|
350
353
|
else {
|
|
351
354
|
// Finally, for four-digit SKUs, the generation is the first digit.
|
|
352
|
-
this.
|
|
355
|
+
this._cpuGeneration = Number(skuStr.charAt(0));
|
|
353
356
|
}
|
|
354
357
|
}
|
|
355
358
|
}
|
|
@@ -366,15 +369,8 @@ export class FfmpegCodecs {
|
|
|
366
369
|
const gpuRegex = /^gpu=(.*)M\n$/;
|
|
367
370
|
// Let's see what we've got.
|
|
368
371
|
const gpuMatch = gpuRegex.exec(stdout);
|
|
369
|
-
//
|
|
370
|
-
|
|
371
|
-
// Parse the result and retrieve our allocated GPU memory.
|
|
372
|
-
this._gpuMem = parseInt(gpuMatch[1]);
|
|
373
|
-
// Something went wrong.
|
|
374
|
-
if (isNaN(this._gpuMem)) {
|
|
375
|
-
this._gpuMem = 0;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
372
|
+
// Parse the result and retrieve our allocated GPU memory.
|
|
373
|
+
this._gpuMem = Number.parseInt(gpuMatch?.[1] ?? "", 10) || 0;
|
|
378
374
|
});
|
|
379
375
|
}
|
|
380
376
|
// Utility to probe the capabilities of FFmpeg and the host platform.
|
|
@@ -388,18 +384,15 @@ export class FfmpegCodecs {
|
|
|
388
384
|
return true;
|
|
389
385
|
}
|
|
390
386
|
catch (error) {
|
|
391
|
-
|
|
392
|
-
if (
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
else {
|
|
401
|
-
this.log.error("Error running %s: %s", command, error.message);
|
|
402
|
-
}
|
|
387
|
+
const execError = error;
|
|
388
|
+
if (execError.code === "ENOENT") {
|
|
389
|
+
this.log.error("Unable to find '%s' in path: '%s'.", command, env.PATH);
|
|
390
|
+
}
|
|
391
|
+
else if (quietRunErrors) {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
this.log.error("Error running %s: %s", command, execError.message);
|
|
403
396
|
}
|
|
404
397
|
this.log.error("Unable to probe the capabilities of your Homebridge host without access to '%s'. Ensure that it is available in your path and correctly working.", command);
|
|
405
398
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../src/ffmpeg/codecs.ts"],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AAC;YAEX,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
|
package/dist/ffmpeg/options.d.ts
CHANGED
|
@@ -210,7 +210,6 @@ export declare class FfmpegOptions {
|
|
|
210
210
|
* Function returning the name for this options instance to be used for logging.
|
|
211
211
|
*/
|
|
212
212
|
readonly name: () => string;
|
|
213
|
-
private readonly hwPixelFormat;
|
|
214
213
|
/**
|
|
215
214
|
* Creates an instance of Homebridge FFmpeg encoding and decoding options.
|
|
216
215
|
*
|
|
@@ -248,6 +247,26 @@ export declare class FfmpegOptions {
|
|
|
248
247
|
* @see FfmpegOptions
|
|
249
248
|
*/
|
|
250
249
|
private configureHwAccel;
|
|
250
|
+
/**
|
|
251
|
+
* Determines the required hardware transfer filters based on the decoding and encoding configuration.
|
|
252
|
+
*
|
|
253
|
+
* This method manages the transition between software and hardware processing contexts. When video data needs to move between the CPU and GPU for processing, we
|
|
254
|
+
* provide the appropriate FFmpeg filters to handle that transfer efficiently.
|
|
255
|
+
*
|
|
256
|
+
* @param options - Video encoder options including hardware decoding and transcoding state.
|
|
257
|
+
* @returns Array of filter strings for hardware upload or download operations.
|
|
258
|
+
*/
|
|
259
|
+
private getHardwareTransferFilters;
|
|
260
|
+
/**
|
|
261
|
+
* Gets hardware device initialization options for encoders that need them.
|
|
262
|
+
*
|
|
263
|
+
* When we're using hardware encoding without hardware decoding, we need to initialize the hardware device context explicitly. This method provides the
|
|
264
|
+
* platform-specific initialization arguments required by FFmpeg.
|
|
265
|
+
*
|
|
266
|
+
* @param options - Video encoder options.
|
|
267
|
+
* @returns Array of FFmpeg arguments for hardware device initialization.
|
|
268
|
+
*/
|
|
269
|
+
private getHardwareDeviceInit;
|
|
251
270
|
/**
|
|
252
271
|
* Returns the audio encoder arguments to use when transcoding.
|
|
253
272
|
*
|
|
@@ -286,6 +305,11 @@ export declare class FfmpegOptions {
|
|
|
286
305
|
* @returns The crop filter string for FFmpeg.
|
|
287
306
|
*/
|
|
288
307
|
get cropFilter(): string;
|
|
308
|
+
/**
|
|
309
|
+
* Generate the appropriate scale filter for the current platform. This method returns platform-specific scale filters to leverage hardware acceleration capabilities
|
|
310
|
+
* where available.
|
|
311
|
+
*/
|
|
312
|
+
private getScaleFilter;
|
|
289
313
|
/**
|
|
290
314
|
* Generates the default set of FFmpeg video encoder arguments for software transcoding using libx264.
|
|
291
315
|
*
|