From ae5cac9f7cb649d34e1e04ed2bbf205a6451a327 Mon Sep 17 00:00:00 2001 From: Flavio De Stefano Date: Thu, 3 Oct 2024 10:03:31 +0200 Subject: [PATCH] Add video options --- config.schema.json | 35 +++++++++++++++++++++++++++++++++++ src/cameraAccessory.ts | 17 +++++++++++++---- src/types/tapo.ts | 18 ++++++++++++++++++ 3 files changed, 66 insertions(+), 4 deletions(-) diff --git a/config.schema.json b/config.schema.json index 505f7da..14b3902 100644 --- a/config.schema.json +++ b/config.schema.json @@ -131,6 +131,41 @@ "type": "string", "description": "Name of the LED toggle", "placeholder": "LED" + }, + "videoMaxWidth": { + "title": "Video Max Width", + "type": "integer", + "description": "Maximum width of the video stream", + "placeholder": 1280 + }, + "videoMaxHeight": { + "title": "Video Max Height", + "type": "integer", + "description": "Maximum height of the video stream", + "placeholder": 720 + }, + "videoMaxFPS": { + "title": "Video Max FPS", + "type": "integer", + "description": "Maximum frames per second of the video stream", + "placeholder": 30 + }, + "videoMaxBitrate": { + "title": "Video Max Bitrate", + "type": "integer", + "description": "Maximum bitrate of the video stream", + "placeholder": 300 + }, + "videoPacketSize": { + "title": "Video Packet Size", + "type": "integer", + "description": "Size of the video packets", + "placeholder": 1316 + }, + "videoForceMax": { + "title": "Force Max Video", + "type": "boolean", + "description": "Force the video stream to use the maximum values" } } } diff --git a/src/cameraAccessory.ts b/src/cameraAccessory.ts index 8dfde96..3e90f07 100644 --- a/src/cameraAccessory.ts +++ b/src/cameraAccessory.ts @@ -32,6 +32,13 @@ export type CameraConfig = { disableMotionSensorAccessory?: boolean; lowQuality?: boolean; + videoMaxWidth?: number; + videoMaxHeight?: number; + videoMaxFPS?: number; + videoForceMax?: boolean; + videoMaxBirate?: number; + videoPacketSize?: number; + videoConfig?: VideoConfig; eyesToggleAccessoryName?: string; @@ -168,10 +175,12 @@ export class CameraAccessory { audio: true, videoFilter: "none", vcodec: "copy", - maxWidth: this.config.lowQuality ? 640 : 1920, - maxHeight: this.config.lowQuality ? 480 : 1080, - maxFPS: 15, - forceMax: true, + maxWidth: this.config.videoMaxWidth, + maxHeight: this.config.videoMaxHeight, + maxFPS: this.config.videoMaxFPS, + maxBitrate: this.config.videoMaxBirate, + packetSize: this.config.videoPacketSize, + forceMax: this.config.videoForceMax, ...(this.config.videoConfig || {}), }; return config; diff --git a/src/types/tapo.ts b/src/types/tapo.ts index 1e5ea31..dc45507 100644 --- a/src/types/tapo.ts +++ b/src/types/tapo.ts @@ -46,6 +46,14 @@ export type TAPOCameraGetRequest = name: "config"; }; }; + } + | { + method: "getWhitelampStatus"; + params: { + image: { + get_wtl_status: "null"; + }; + }; }; export type TAPOCameraSetRequest = @@ -102,6 +110,16 @@ export type TAPOCameraSetRequest = }; }; }; + } + | { + method: "setWhitelampConfig"; + params: { + image: { + switch: { + wtl_intensity_level: string; + }; + }; + }; }; export type TAPOCameraUnencryptedRequest = {