homebridge-plugin-utils 1.27.2 → 1.29.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/build/eslint-rules.mjs +5 -0
- package/dist/featureoptions.js +7 -8
- package/dist/featureoptions.js.map +1 -1
- package/dist/ffmpeg/codecs.d.ts +10 -10
- package/dist/ffmpeg/codecs.js +37 -43
- package/dist/ffmpeg/codecs.js.map +1 -1
- package/dist/ffmpeg/options.d.ts +27 -3
- package/dist/ffmpeg/options.js +191 -110
- package/dist/ffmpeg/options.js.map +1 -1
- package/dist/ffmpeg/process.d.ts +1 -1
- package/dist/ffmpeg/process.js +4 -9
- package/dist/ffmpeg/process.js.map +1 -1
- package/dist/ffmpeg/record.d.ts +6 -0
- package/dist/ffmpeg/record.js +22 -11
- package/dist/ffmpeg/record.js.map +1 -1
- package/dist/ffmpeg/rtp.js +2 -4
- package/dist/ffmpeg/rtp.js.map +1 -1
- package/dist/mqttclient.js.map +1 -1
- package/dist/service.js +1 -4
- package/dist/service.js.map +1 -1
- package/dist/ui/featureoptions.js +7 -8
- package/dist/ui/featureoptions.js.map +1 -1
- package/dist/ui/webUi-featureoptions.mjs +190 -13
- package/package.json +7 -7
package/build/eslint-rules.mjs
CHANGED
|
@@ -136,6 +136,8 @@ const tsRules = {
|
|
|
136
136
|
|
|
137
137
|
...tsEslint.configs.strictTypeChecked,
|
|
138
138
|
...tsEslint.configs.stylisticTypeChecked,
|
|
139
|
+
"@stylistic/member-delimiter-style": [ "warn",
|
|
140
|
+
{ "multiline": { "delimiter": "semi", "requireLast": true }, "singleline": { "delimiter": "comma", "requireLast": false }} ],
|
|
139
141
|
"@typescript-eslint/await-thenable": "warn",
|
|
140
142
|
"@typescript-eslint/consistent-type-imports": "warn",
|
|
141
143
|
"@typescript-eslint/explicit-function-return-type": "warn",
|
|
@@ -143,8 +145,10 @@ const tsRules = {
|
|
|
143
145
|
"@typescript-eslint/no-explicit-any": "warn",
|
|
144
146
|
"@typescript-eslint/no-floating-promises": [ "warn", { "ignoreIIFE": true } ],
|
|
145
147
|
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
148
|
+
"@typescript-eslint/no-unnecessary-condition": "warn",
|
|
146
149
|
"@typescript-eslint/no-unused-expressions": "warn",
|
|
147
150
|
"@typescript-eslint/no-unused-vars": [ "warn", { "caughtErrors": "none" } ],
|
|
151
|
+
"@typescript-eslint/prefer-nullish-coalescing": "warn",
|
|
148
152
|
"@typescript-eslint/promise-function-async": "warn",
|
|
149
153
|
"require-await": "off",
|
|
150
154
|
// eslint-disable-next-line sort-keys
|
|
@@ -218,6 +222,7 @@ const commonRules = {
|
|
|
218
222
|
"curly": [ "warn", "all" ],
|
|
219
223
|
"dot-notation": "warn",
|
|
220
224
|
"eqeqeq": "warn",
|
|
225
|
+
"logical-assignment-operators": [ "warn", "always", { "enforceForIfStatements": true } ],
|
|
221
226
|
"no-await-in-loop": "warn",
|
|
222
227
|
"no-console": "warn",
|
|
223
228
|
"no-restricted-syntax": [ "warn", "TemplateLiteral" ],
|
package/dist/featureoptions.js
CHANGED
|
@@ -75,9 +75,9 @@ export class FeatureOptions {
|
|
|
75
75
|
this.defaultReturnValue = false;
|
|
76
76
|
this.defaults = {};
|
|
77
77
|
this.valueOptions = {};
|
|
78
|
-
this.categories = categories
|
|
78
|
+
this.categories = categories;
|
|
79
79
|
this.configuredOptions = configuredOptions;
|
|
80
|
-
this.options = options
|
|
80
|
+
this.options = options;
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* Return a Bootstrap-specific color reference depending on the scope of a given feature option.
|
|
@@ -174,9 +174,7 @@ export class FeatureOptions {
|
|
|
174
174
|
* @returns Returns true if the option is set at the device or controller level and false otherwise.
|
|
175
175
|
*/
|
|
176
176
|
isScopeDevice(option, device) {
|
|
177
|
-
|
|
178
|
-
// Return the value if it's set, or the default value for this option.
|
|
179
|
-
return (value !== undefined) ? value : this.defaultValue(option);
|
|
177
|
+
return this.exists(option, device);
|
|
180
178
|
}
|
|
181
179
|
/**
|
|
182
180
|
* Return whether an option has been set in the global scope context.
|
|
@@ -186,9 +184,7 @@ export class FeatureOptions {
|
|
|
186
184
|
* @returns Returns true if the option is set globally and false otherwise.
|
|
187
185
|
*/
|
|
188
186
|
isScopeGlobal(option) {
|
|
189
|
-
|
|
190
|
-
// Return the value if it's set, or the default value for this option.
|
|
191
|
-
return (value !== undefined) ? value : this.defaultValue(option);
|
|
187
|
+
return this.exists(option);
|
|
192
188
|
}
|
|
193
189
|
/**
|
|
194
190
|
* Return whether an option is value-centric or not.
|
|
@@ -320,6 +316,7 @@ export class FeatureOptions {
|
|
|
320
316
|
* @param options - Array of configured feature options.
|
|
321
317
|
*/
|
|
322
318
|
set configuredOptions(options) {
|
|
319
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
323
320
|
this._configuredOptions = options ?? [];
|
|
324
321
|
}
|
|
325
322
|
/**
|
|
@@ -344,6 +341,7 @@ export class FeatureOptions {
|
|
|
344
341
|
* @param options - Array of available feature options.
|
|
345
342
|
*/
|
|
346
343
|
set options(options) {
|
|
344
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
347
345
|
this._options = options ?? {};
|
|
348
346
|
// Regenerate our defaults.
|
|
349
347
|
this.generateDefaults();
|
|
@@ -355,6 +353,7 @@ export class FeatureOptions {
|
|
|
355
353
|
this.valueOptions = {};
|
|
356
354
|
for (const category of this.categories) {
|
|
357
355
|
// If the category doesn't exist, let's skip it.
|
|
356
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
358
357
|
if (!this.options[category.name]) {
|
|
359
358
|
continue;
|
|
360
359
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featureoptions.js","sourceRoot":"","sources":["../src/featureoptions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0DH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAA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AAI,CAAC,CAAC;IACnK,CAAC;CACF"}
|
package/dist/ffmpeg/codecs.d.ts
CHANGED
|
@@ -7,17 +7,17 @@ import type { Logging } from "homebridge";
|
|
|
7
7
|
*/
|
|
8
8
|
export interface FOptions {
|
|
9
9
|
/**
|
|
10
|
-
* The path or command used to execute FFmpeg.
|
|
10
|
+
* Optional. The path or command used to execute FFmpeg. Defaults to "ffmpeg".
|
|
11
11
|
*/
|
|
12
|
-
ffmpegExec
|
|
12
|
+
ffmpegExec?: string;
|
|
13
13
|
/**
|
|
14
14
|
* Logging interface for output and errors.
|
|
15
15
|
*/
|
|
16
16
|
log: HomebridgePluginLogging | Logging;
|
|
17
17
|
/**
|
|
18
|
-
* Enables or disables verbose logging output.
|
|
18
|
+
* Optional. Enables or disables verbose logging output. Defaults to `false`.
|
|
19
19
|
*/
|
|
20
|
-
verbose
|
|
20
|
+
verbose?: boolean;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Probe FFmpeg capabilities and codecs on the host system.
|
|
@@ -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,15 +81,11 @@ 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 = {};
|
|
91
87
|
this.log = options.log;
|
|
92
|
-
this.verbose
|
|
88
|
+
this.verbose = options.verbose ?? false;
|
|
93
89
|
// Detect our host system type.
|
|
94
90
|
this.probeHwOs();
|
|
95
91
|
}
|
|
@@ -154,6 +150,7 @@ export class FfmpegCodecs {
|
|
|
154
150
|
// Normalize our lookups.
|
|
155
151
|
codec = codec.toLowerCase();
|
|
156
152
|
decoder = decoder.toLowerCase();
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
157
154
|
return this.ffmpegCodecs[codec]?.decoders.some(x => x === decoder);
|
|
158
155
|
}
|
|
159
156
|
/**
|
|
@@ -178,6 +175,7 @@ export class FfmpegCodecs {
|
|
|
178
175
|
// Normalize our lookups.
|
|
179
176
|
codec = codec.toLowerCase();
|
|
180
177
|
encoder = encoder.toLowerCase();
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
181
179
|
return this.ffmpegCodecs[codec]?.encoders.some(x => x === encoder);
|
|
182
180
|
}
|
|
183
181
|
/**
|
|
@@ -205,13 +203,13 @@ export class FfmpegCodecs {
|
|
|
205
203
|
* @remarks Always returns `0` on non-Raspberry Pi systems.
|
|
206
204
|
*/
|
|
207
205
|
get gpuMem() {
|
|
208
|
-
return this._gpuMem;
|
|
206
|
+
return this._gpuMem ?? 0;
|
|
209
207
|
}
|
|
210
208
|
/**
|
|
211
209
|
* Returns the detected FFmpeg version string, or "unknown" if detection failed.
|
|
212
210
|
*/
|
|
213
211
|
get ffmpegVersion() {
|
|
214
|
-
return this._ffmpegVersion;
|
|
212
|
+
return this._ffmpegVersion ?? "";
|
|
215
213
|
}
|
|
216
214
|
/**
|
|
217
215
|
* Returns the host system type we are running on as one of "generic", "macOS.Apple", "macOS.Intel", or "raspbian".
|
|
@@ -219,15 +217,15 @@ export class FfmpegCodecs {
|
|
|
219
217
|
* @remarks We are only trying to detect host capabilities to the extent they impact which FFmpeg options we are going to use.
|
|
220
218
|
*/
|
|
221
219
|
get hostSystem() {
|
|
222
|
-
return this._hostSystem;
|
|
220
|
+
return this._hostSystem ?? "generic";
|
|
223
221
|
}
|
|
224
222
|
/**
|
|
225
|
-
* 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.
|
|
226
224
|
*
|
|
227
225
|
* @returns Returns the CPU generation or 0 if it can't be detected or an invalid platform.
|
|
228
226
|
*/
|
|
229
|
-
get
|
|
230
|
-
return this.
|
|
227
|
+
get cpuGeneration() {
|
|
228
|
+
return this._cpuGeneration ?? 0;
|
|
231
229
|
}
|
|
232
230
|
// Probe our video processor's version.
|
|
233
231
|
async probeFfmpegVersion() {
|
|
@@ -296,9 +294,8 @@ export class FfmpegCodecs {
|
|
|
296
294
|
}
|
|
297
295
|
// If we found decoders, add them to our list of supported decoders for this format.
|
|
298
296
|
if (encodersMatch) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
297
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
298
|
+
this.ffmpegCodecs[encodersMatch[1]] ||= { decoders: [], encoders: [] };
|
|
302
299
|
this.ffmpegCodecs[encodersMatch[1]].encoders = encodersMatch[2].split(" ").map(x => x.toLowerCase());
|
|
303
300
|
}
|
|
304
301
|
}
|
|
@@ -306,13 +303,20 @@ export class FfmpegCodecs {
|
|
|
306
303
|
}
|
|
307
304
|
// Identify what hardware and operating system environment we're actually running on.
|
|
308
305
|
probeHwOs() {
|
|
309
|
-
// Start off with a generic identifier.
|
|
310
|
-
this._hostSystem = "generic";
|
|
311
306
|
// Take a look at the platform we're on for an initial hint of what we are.
|
|
312
307
|
switch (platform) {
|
|
313
308
|
// The beloved macOS.
|
|
314
309
|
case "darwin":
|
|
315
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
|
+
}
|
|
316
320
|
break;
|
|
317
321
|
// The indomitable Linux.
|
|
318
322
|
case "linux":
|
|
@@ -332,7 +336,7 @@ export class FfmpegCodecs {
|
|
|
332
336
|
if (cpus()[0].model.includes("Intel")) {
|
|
333
337
|
// Extract the CPU model.
|
|
334
338
|
const cpuModel = cpus()[0].model.match(/Intel.*Core.*i\d+-(\d{3,5})/i);
|
|
335
|
-
this.
|
|
339
|
+
this._cpuGeneration = 0;
|
|
336
340
|
if (cpuModel && cpuModel[1]) {
|
|
337
341
|
// Grab the individual SKU as both a number and string.
|
|
338
342
|
const skuStr = cpuModel[1];
|
|
@@ -340,15 +344,15 @@ export class FfmpegCodecs {
|
|
|
340
344
|
// Now deduce the CPU generation.
|
|
341
345
|
if (skuNum < 1000) {
|
|
342
346
|
// First generation CPUs are three digit SKUs.
|
|
343
|
-
this.
|
|
347
|
+
this._cpuGeneration = 1;
|
|
344
348
|
}
|
|
345
349
|
else if (skuStr.length > 4) {
|
|
346
350
|
// For five-digit SKUs, the generation are the leading digits before the last three.
|
|
347
|
-
this.
|
|
351
|
+
this._cpuGeneration = Number(skuStr.slice(0, skuStr.length - 3));
|
|
348
352
|
}
|
|
349
353
|
else {
|
|
350
354
|
// Finally, for four-digit SKUs, the generation is the first digit.
|
|
351
|
-
this.
|
|
355
|
+
this._cpuGeneration = Number(skuStr.charAt(0));
|
|
352
356
|
}
|
|
353
357
|
}
|
|
354
358
|
}
|
|
@@ -365,15 +369,8 @@ export class FfmpegCodecs {
|
|
|
365
369
|
const gpuRegex = /^gpu=(.*)M\n$/;
|
|
366
370
|
// Let's see what we've got.
|
|
367
371
|
const gpuMatch = gpuRegex.exec(stdout);
|
|
368
|
-
//
|
|
369
|
-
|
|
370
|
-
// Parse the result and retrieve our allocated GPU memory.
|
|
371
|
-
this._gpuMem = parseInt(gpuMatch[1]);
|
|
372
|
-
// Something went wrong.
|
|
373
|
-
if (isNaN(this._gpuMem)) {
|
|
374
|
-
this._gpuMem = 0;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
372
|
+
// Parse the result and retrieve our allocated GPU memory.
|
|
373
|
+
this._gpuMem = Number.parseInt(gpuMatch?.[1] ?? "", 10) || 0;
|
|
377
374
|
});
|
|
378
375
|
}
|
|
379
376
|
// Utility to probe the capabilities of FFmpeg and the host platform.
|
|
@@ -387,18 +384,15 @@ export class FfmpegCodecs {
|
|
|
387
384
|
return true;
|
|
388
385
|
}
|
|
389
386
|
catch (error) {
|
|
390
|
-
|
|
391
|
-
if (
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
else {
|
|
400
|
-
this.log.error("Error running %s: %s", command, error.message);
|
|
401
|
-
}
|
|
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);
|
|
402
396
|
}
|
|
403
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);
|
|
404
398
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../src/ffmpeg/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../src/ffmpeg/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAA0B,QAAQ,EAAE,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AqE;IAC7D,KAAK,CAAC,QAAQ,CAAC,OAAe,EAAE,eAAyB,EAAE,aAAuC,EAAE,cAAc,GAAG,KAAK;QAEhI,IAAI,CAAC;YAEH,4DAA4D;YAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAE3C,+CAA+C;YAC/C,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;YAE7D,aAAa,CAAC,MAAM,CAAC,CAAC;YAEtB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAM,KAAK,EAAE,CAAC;YAEd,MAAM,SAAS,GAAG,KAA0B,CAAC;YAE7C,IAAG,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAE/B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,oCAAoC,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1E,CAAC;iBAAM,IAAG,cAAc,EAAE,CAAC;gBAEzB,OAAO,KAAK,CAAC;YACf,CAAC;iBAAM,CAAC;gBAEN,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,sBAAsB,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;YACrE,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,kJAAkJ,EAC/J,OAAO,CAAC,CAAC;YAEX,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
|
package/dist/ffmpeg/options.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ import type { HomebridgePluginLogging } from "../util.js";
|
|
|
25
25
|
*
|
|
26
26
|
* @property codecSupport - FFmpeg codec capabilities and hardware support.
|
|
27
27
|
* @property crop - Optional. Cropping rectangle for output video.
|
|
28
|
-
* @property debug - Enable debug logging.
|
|
28
|
+
* @property debug - Optional. Enable debug logging.
|
|
29
29
|
* @property hardwareDecoding - Enable hardware-accelerated video decoding if available.
|
|
30
30
|
* @property hardwareTranscoding - Enable hardware-accelerated video encoding if available.
|
|
31
31
|
* @property log - Logging interface for output and errors.
|
|
@@ -58,7 +58,7 @@ export interface FfmpegOptionsConfig {
|
|
|
58
58
|
x: number;
|
|
59
59
|
y: number;
|
|
60
60
|
};
|
|
61
|
-
debug
|
|
61
|
+
debug?: boolean;
|
|
62
62
|
hardwareDecoding: boolean;
|
|
63
63
|
hardwareTranscoding: boolean;
|
|
64
64
|
log: HomebridgePluginLogging | Logging;
|
|
@@ -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
|
*
|