mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-10 02:29:19 +03:00
save optimal detect resolution to config on wizard save
This commit is contained in:
parent
00b9a53ba2
commit
0a5af3a90f
@ -20,7 +20,10 @@ import type {
|
||||
CameraConfigData,
|
||||
ConfigSetBody,
|
||||
} from "@/types/cameraWizard";
|
||||
import { processCameraName } from "@/utils/cameraUtil";
|
||||
import {
|
||||
processCameraName,
|
||||
calculateDetectDimensions,
|
||||
} from "@/utils/cameraUtil";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type WizardState = {
|
||||
@ -203,6 +206,25 @@ export default function CameraWizardDialog({
|
||||
},
|
||||
};
|
||||
|
||||
// Calculate detect dimensions from the detect stream's probed resolution
|
||||
const detectStream = wizardData.streams.find((stream) =>
|
||||
stream.roles.includes("detect"),
|
||||
);
|
||||
if (detectStream?.testResult?.resolution) {
|
||||
const [streamWidth, streamHeight] = detectStream.testResult.resolution
|
||||
.split("x")
|
||||
.map(Number);
|
||||
if (streamWidth > 0 && streamHeight > 0) {
|
||||
const detectDimensions = calculateDetectDimensions(
|
||||
streamWidth,
|
||||
streamHeight,
|
||||
);
|
||||
if (detectDimensions) {
|
||||
configData.cameras[finalCameraName].detect = detectDimensions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add live.streams configuration for go2rtc streams
|
||||
if (wizardData.streams && wizardData.streams.length > 0) {
|
||||
configData.cameras[finalCameraName].live = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user