@camera.ui/browser 0.0.75 → 0.0.77
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/dist/bundle.js +1 -1
- package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +3 -1
- package/dist/types/packages/client/browser/src/types.d.ts +3 -1
- package/dist/types/server/src/api/controllers/frameWorkers.controller.d.ts +16 -0
- package/dist/types/server/src/api/database/types.d.ts +3 -2
- package/dist/types/server/src/api/routes/frameWorkers.routes.d.ts +2 -0
- package/dist/types/server/src/api/schemas/cameras.schema.d.ts +74 -35
- package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +99 -0
- package/dist/types/server/src/api/services/auth.service.d.ts +0 -1
- package/dist/types/server/src/api/services/plugins.service.d.ts +0 -1
- package/dist/types/server/src/api/services/users.service.d.ts +0 -1
- package/dist/types/server/src/api/types/index.d.ts +14 -1
- package/dist/types/server/src/api/websocket/nsp/frameWorker.d.ts +13 -0
- package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +6 -1
- package/dist/types/server/src/api/websocket/nsp/status.d.ts +6 -0
- package/dist/types/server/src/api/websocket/types.d.ts +6 -2
- package/dist/types/server/src/camera/controller.d.ts +6 -3
- package/dist/types/server/src/camera/device.d.ts +11 -3
- package/dist/types/server/src/camera/index.d.ts +15 -7
- package/dist/types/server/src/camera/polygon.d.ts +2 -0
- package/dist/types/server/src/camera/types.d.ts +11 -6
- package/dist/types/server/src/camera/videoFrame.d.ts +14 -7
- package/dist/types/server/src/decoder/types.d.ts +26 -6
- package/dist/types/server/src/decoder/worker.d.ts +10 -2
- package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +2 -2
- package/dist/types/server/src/nats/types.d.ts +2 -2
- package/dist/types/server/src/plugins/types.d.ts +2 -0
- package/dist/types/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +20 -6
- package/dist/types/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +3 -3
- package/dist/types/server/src/polyglot/node/plugins/proxy/pluginsManager.d.ts +3 -3
- package/dist/types/server/src/polyglot/node/plugins/proxy/queue.d.ts +2 -0
- package/dist/types/server/src/polyglot/node/plugins/proxy/systemManager.d.ts +3 -3
- package/dist/types/server/src/services/config/types.d.ts +8 -0
- package/dist/types/shared/types/index.d.ts +1 -0
- package/package.json +7 -5
|
@@ -2,7 +2,6 @@ import type { Plugin } from '../../plugins/plugin.js';
|
|
|
2
2
|
import type { PluginWorker } from '../../plugins/worker.js';
|
|
3
3
|
import type { DBPlugin } from '../database/types.js';
|
|
4
4
|
export declare class PluginsService {
|
|
5
|
-
private configService;
|
|
6
5
|
private dbs;
|
|
7
6
|
private pluginManager;
|
|
8
7
|
constructor();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import type { Readable } from 'node:stream';
|
|
4
|
-
import type { CameraExtension, PluginContract, PluginRootSchema } from '../../plugins/types.js';
|
|
4
|
+
import type { CameraExtension, PLUGIN_STATUS, PluginContract, PluginRootSchema } from '../../plugins/types.js';
|
|
5
5
|
import type { LoggingLevel } from '../../services/config/types.js';
|
|
6
6
|
import type { CameraExtensions, CameraZone, DBCamera, DBCamviewLayout, DBRoles, DBUser } from '../database/types.js';
|
|
7
7
|
import type { ApplicationResponse } from '../go2rtc/types.js';
|
|
@@ -139,6 +139,10 @@ export interface PluginsResponse {
|
|
|
139
139
|
pagination: Pagination;
|
|
140
140
|
result: CameraUiPlugin[];
|
|
141
141
|
}
|
|
142
|
+
export interface FrameWorkerResponse {
|
|
143
|
+
pagination: Pagination;
|
|
144
|
+
result: FrameWorker[];
|
|
145
|
+
}
|
|
142
146
|
export interface PluginContractCamera {
|
|
143
147
|
name: string;
|
|
144
148
|
extensions: CameraExtensions;
|
|
@@ -291,6 +295,11 @@ export type PluginsParamsNameRequest = {
|
|
|
291
295
|
pluginname: string;
|
|
292
296
|
};
|
|
293
297
|
};
|
|
298
|
+
export type FrameWorkerParamsNameRequest = {
|
|
299
|
+
Params: {
|
|
300
|
+
frameworkername: string;
|
|
301
|
+
};
|
|
302
|
+
};
|
|
294
303
|
export type PluginsParamsRemoveRequest = {
|
|
295
304
|
Querystring: {
|
|
296
305
|
removeStorage?: boolean;
|
|
@@ -534,3 +543,7 @@ export interface CameraUiPlugin {
|
|
|
534
543
|
node?: string;
|
|
535
544
|
};
|
|
536
545
|
}
|
|
546
|
+
export interface FrameWorker {
|
|
547
|
+
name: string;
|
|
548
|
+
status: PLUGIN_STATUS;
|
|
549
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Namespace, Server } from 'socket.io';
|
|
2
|
+
import type { PLUGIN_STATUS } from '../../../plugins/types.js';
|
|
3
|
+
import type { SocketNsp } from '../types.js';
|
|
4
|
+
export declare class FrameWorkerNamespace {
|
|
5
|
+
nsp: Namespace;
|
|
6
|
+
nspName: SocketNsp;
|
|
7
|
+
private frameManager;
|
|
8
|
+
constructor(io: Server);
|
|
9
|
+
frameWorkerStatus(frameWorkerName: string, callback?: Function): Promise<void | {
|
|
10
|
+
frameWorkerName: string;
|
|
11
|
+
status: PLUGIN_STATUS;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import type { Namespace, Server } from 'socket.io';
|
|
2
|
-
import type { CpuInfo, CpuTempInfo, MemoryInfo, NetworkInfo, PluginProcessesInfo, ProcessesInfo, SocketNsp } from '../types.js';
|
|
2
|
+
import type { CpuInfo, CpuTempInfo, FrameWorkerProcessesInfo, MemoryInfo, NetworkInfo, PluginProcessesInfo, ProcessesInfo, SocketNsp } from '../types.js';
|
|
3
3
|
export declare class MetricsNamespace {
|
|
4
4
|
nsp: Namespace;
|
|
5
5
|
nspName: SocketNsp;
|
|
6
6
|
private logger;
|
|
7
7
|
private configService;
|
|
8
8
|
private pluginManager;
|
|
9
|
+
private frameManager;
|
|
9
10
|
private go2rtc;
|
|
11
|
+
private natsServer;
|
|
10
12
|
private cpuHistory;
|
|
11
13
|
private cpuTempHistory;
|
|
12
14
|
private memHistory;
|
|
13
15
|
private networkHistory;
|
|
14
16
|
private processServerHistory;
|
|
15
17
|
private processGo2RtcHistory;
|
|
18
|
+
private processNatHistory;
|
|
16
19
|
private processPluginsHistory;
|
|
20
|
+
private processFrameWorkerHistory;
|
|
17
21
|
private memoryInfo?;
|
|
18
22
|
constructor(io: Server);
|
|
19
23
|
getProcessesInfo(payload: any, callback?: Function): Promise<ProcessesInfo>;
|
|
20
24
|
getPluginsProcessesInfo(payload: any, callback?: Function): Promise<PluginProcessesInfo>;
|
|
25
|
+
getFrameWorkerProcessesInfo(payload: any, callback?: Function): Promise<FrameWorkerProcessesInfo>;
|
|
21
26
|
getServerCpuInfo(payload?: any, callback?: Function): Promise<CpuInfo>;
|
|
22
27
|
getServerMemoryInfo(payload?: any, callback?: Function): Promise<MemoryInfo>;
|
|
23
28
|
getCpuTempInfo(payload?: any, callback?: Function): Promise<CpuTempInfo>;
|
|
@@ -7,7 +7,9 @@ export declare class StatusNamespace {
|
|
|
7
7
|
nspName: SocketNsp;
|
|
8
8
|
private configService;
|
|
9
9
|
private pluginManager;
|
|
10
|
+
private frameManager;
|
|
10
11
|
private go2rtc;
|
|
12
|
+
private natsServer;
|
|
11
13
|
constructor(io: Server);
|
|
12
14
|
watchStats(socket: Socket, payload: any, callback?: Function): {
|
|
13
15
|
name: string;
|
|
@@ -17,4 +19,8 @@ export declare class StatusNamespace {
|
|
|
17
19
|
name: string;
|
|
18
20
|
status: PLUGIN_STATUS;
|
|
19
21
|
}[];
|
|
22
|
+
watchFrameWorkerStats(socket: Socket, payload: any, callback?: Function): {
|
|
23
|
+
name: string;
|
|
24
|
+
status: PLUGIN_STATUS;
|
|
25
|
+
}[];
|
|
20
26
|
}
|
|
@@ -2,7 +2,7 @@ import type { Namespace } from 'socket.io';
|
|
|
2
2
|
import type { WebSocket } from 'ws';
|
|
3
3
|
import type { PLUGIN_STATUS } from '../../plugins/types.js';
|
|
4
4
|
import type { VideoStreamingMode } from '../database/types.js';
|
|
5
|
-
export type SocketNsp = '/camera.ui' | '/metrics' | '/logs' | '/status' | '/notifications' | '/streams' | '/plugins' | '/proxy' | '/frame';
|
|
5
|
+
export type SocketNsp = '/camera.ui' | '/metrics' | '/logs' | '/status' | '/notifications' | '/streams' | '/plugins' | '/proxy' | '/frame' | '/frameWorker';
|
|
6
6
|
export interface SocketNspMap {
|
|
7
7
|
nsp: Namespace;
|
|
8
8
|
[key: string]: any;
|
|
@@ -52,11 +52,15 @@ export interface ProcessInfo {
|
|
|
52
52
|
export interface ProcessesInfo {
|
|
53
53
|
server: ProcessInfo;
|
|
54
54
|
go2rtc: ProcessInfo;
|
|
55
|
+
nats: ProcessInfo;
|
|
55
56
|
}
|
|
56
57
|
export interface PluginProcessesInfo {
|
|
57
58
|
plugins: ProcessInfo[];
|
|
58
59
|
}
|
|
59
|
-
export interface
|
|
60
|
+
export interface FrameWorkerProcessesInfo {
|
|
61
|
+
worker: ProcessInfo[];
|
|
62
|
+
}
|
|
63
|
+
export interface AllProcessesInfo extends ProcessesInfo, PluginProcessesInfo, FrameWorkerProcessesInfo {
|
|
60
64
|
}
|
|
61
65
|
export interface CpuInfo {
|
|
62
66
|
currentLoad: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CameraDevice } from './device.js';
|
|
2
2
|
import type { Camera } from '../api/database/types.js';
|
|
3
|
-
import type { VideoFrame } from '../decoder/types.js';
|
|
3
|
+
import type { MotionFrame, VideoFrame } from '../decoder/types.js';
|
|
4
4
|
import type { ProxyServer } from '../nats/index.js';
|
|
5
5
|
import type { IceServer } from '../services/config/types.js';
|
|
6
|
-
import type { BaseLogger, CameraSource } from './types.js';
|
|
6
|
+
import type { BaseLogger, CameraSource, SetValues } from './types.js';
|
|
7
7
|
export declare class CameraController extends CameraDevice {
|
|
8
8
|
private proxy;
|
|
9
9
|
private motionTimeout?;
|
|
@@ -15,9 +15,12 @@ export declare class CameraController extends CameraDevice {
|
|
|
15
15
|
connect(): Promise<void>;
|
|
16
16
|
disconnect(): Promise<void>;
|
|
17
17
|
reboot(): Promise<void>;
|
|
18
|
-
|
|
18
|
+
getFrames(): AsyncIterableIterator<VideoFrame>;
|
|
19
|
+
getMotionFrames(): AsyncIterableIterator<MotionFrame>;
|
|
20
|
+
getPrebufferedFrames(): AsyncIterableIterator<VideoFrame>;
|
|
19
21
|
getFfmpegPath(): Promise<string>;
|
|
20
22
|
getIceServers(): Promise<IceServer[]>;
|
|
23
|
+
updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T]): Promise<void>;
|
|
21
24
|
updateCamera(updatedCamera: Camera): void;
|
|
22
25
|
cleanup(): void;
|
|
23
26
|
private subscribeToCameraState;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import { BehaviorSubject } from 'rxjs';
|
|
1
3
|
import { BaseCameraDevice } from './index.js';
|
|
2
4
|
import { StreamingSession } from './streaming/streaming-session.js';
|
|
3
|
-
import type { VideoFrame } from '../decoder/types.js';
|
|
5
|
+
import type { MotionFrame, VideoFrame } from '../decoder/types.js';
|
|
4
6
|
import type { StreamingConnectionOptions } from './streaming/peer-connection.js';
|
|
5
|
-
import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions } from './types.js';
|
|
7
|
+
import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions, FrameState } from './types.js';
|
|
6
8
|
export declare abstract class CameraDevice extends BaseCameraDevice {
|
|
9
|
+
protected readonly frameState: BehaviorSubject<FrameState>;
|
|
10
|
+
protected readonly onFrame: Observable<FrameState>;
|
|
7
11
|
private _delegate?;
|
|
8
12
|
private _prebufferDelegate?;
|
|
9
13
|
get delegate(): CameraDelegate | undefined;
|
|
10
14
|
set delegate(delegate: CameraDelegate);
|
|
11
15
|
get prebufferDelegate(): CameraPrebufferDelegate | undefined;
|
|
12
16
|
set prebufferDelegate(delegate: CameraPrebufferDelegate);
|
|
13
|
-
abstract
|
|
17
|
+
abstract getFrames(): AsyncIterableIterator<VideoFrame>;
|
|
18
|
+
abstract getMotionFrames(): AsyncIterableIterator<MotionFrame>;
|
|
19
|
+
abstract getPrebufferedFrames(): AsyncIterableIterator<VideoFrame>;
|
|
14
20
|
abstract getFfmpegPath(): Promise<string>;
|
|
15
21
|
snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
16
22
|
createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
|
|
17
23
|
streamVideo(sourceName: string, options: FfmpegOptions): Promise<StreamingSession>;
|
|
18
24
|
recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
|
|
25
|
+
removeAllListeners(): void;
|
|
26
|
+
private createMotionFrameObservable;
|
|
19
27
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
1
2
|
import { LRUCache } from 'lru-cache';
|
|
2
3
|
import { BehaviorSubject } from 'rxjs';
|
|
3
4
|
import type { Observable, Subscription } from 'rxjs';
|
|
4
5
|
import type { Camera, CameraActivitySettings, CameraInformation, CameraPublicProperties, CameraType } from '../api/database/types.js';
|
|
5
6
|
import type { IceServer } from '../services/config/types.js';
|
|
6
|
-
import type { AudioSetEvent, AudioState, BaseLogger, BatterySetEvent, BatteryState, CameraSource, DetectionZone, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState,
|
|
7
|
+
import type { AudioSetEvent, AudioState, BaseLogger, BatterySetEvent, BatteryState, CameraSource, Container, DetectionZone, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, PrebufferState, SetValues, Sets, SirenSetEvent, SirenState, StateValues, States } from './types.js';
|
|
7
8
|
declare class Subscribed {
|
|
8
9
|
private readonly subscriptions;
|
|
9
10
|
private readonly additionalSubscriptions;
|
|
@@ -71,7 +72,14 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
71
72
|
abstract getIceServers(): Promise<IceServer[]>;
|
|
72
73
|
protected abstract cleanup(): void;
|
|
73
74
|
getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
|
|
74
|
-
updateState
|
|
75
|
+
abstract updateState(stateName: 'light', eventData: LightSetEvent): Promise<void>;
|
|
76
|
+
abstract updateState(stateName: 'motion', eventData: MotionSetEvent, frame?: Buffer): Promise<void>;
|
|
77
|
+
abstract updateState(stateName: 'audio', eventData: AudioSetEvent): Promise<void>;
|
|
78
|
+
abstract updateState(stateName: 'object', eventData: ObjectSetEvent): Promise<void>;
|
|
79
|
+
abstract updateState(stateName: 'doorbell', eventData: DoorbellSetEvent): Promise<void>;
|
|
80
|
+
abstract updateState(stateName: 'siren', eventData: SirenSetEvent): Promise<void>;
|
|
81
|
+
abstract updateState(stateName: 'battery', eventData: BatterySetEvent): Promise<void>;
|
|
82
|
+
protected updateStateInternal<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], skipCheck?: boolean): void;
|
|
75
83
|
onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
|
|
76
84
|
newState: StateValues[T];
|
|
77
85
|
oldState: StateValues[T];
|
|
@@ -83,7 +91,7 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
83
91
|
removeAllListeners(): void;
|
|
84
92
|
protected checkStateInternal<T extends keyof SetValues>(stateName: T, event: SetValues[T]): {
|
|
85
93
|
changed: boolean;
|
|
86
|
-
event:
|
|
94
|
+
event: StateValues[T];
|
|
87
95
|
};
|
|
88
96
|
protected getAudioState(event: AudioSetEvent): AudioState;
|
|
89
97
|
protected getMotionState(event: MotionSetEvent): MotionState;
|
|
@@ -93,12 +101,12 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
93
101
|
protected getSirenState(event: SirenSetEvent): SirenState;
|
|
94
102
|
protected getBatteryState(event: BatterySetEvent): BatteryState;
|
|
95
103
|
protected updateCamera(updatedCamera: Camera): void;
|
|
96
|
-
protected updatePrebuffer(sourceId: string, container:
|
|
97
|
-
|
|
104
|
+
protected updatePrebuffer(sourceId: string, container: Container, state: PrebufferState): Promise<void>;
|
|
105
|
+
private updateCameraSourcesState;
|
|
98
106
|
protected updateCameraState(state: boolean): void;
|
|
99
|
-
protected cameraSourcePrebufferState(sourceId: string, container:
|
|
107
|
+
protected cameraSourcePrebufferState(sourceId: string, container: Container): PrebufferState;
|
|
100
108
|
private createStateObservable;
|
|
101
|
-
protected createPrebufferStateObservable(sourceId: string, container:
|
|
109
|
+
protected createPrebufferStateObservable(sourceId: string, container: Container): Observable<PrebufferState>;
|
|
102
110
|
protected stateChanged<T extends keyof SetValues>(oldState?: SetValues[T], newState?: SetValues[T], type?: keyof StateValues): boolean;
|
|
103
111
|
protected isStateEvent(state: States | Sets): state is States;
|
|
104
112
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { Detection, DetectionZone } from './types.js';
|
|
2
|
+
export declare const convertZonePointsToPixels: (zone: DetectionZone, detection: Detection) => DetectionZone;
|
|
3
|
+
export declare const convertBoundingBoxToPixels: (detection: Detection) => Detection;
|
|
2
4
|
export declare const areObjectDetectionsValid: (detections: Detection[], zones: DetectionZone[]) => Detection[];
|
|
3
5
|
export declare const areMotionDetectionsValid: (detections: Detection[], zones: DetectionZone[]) => Detection[];
|
|
@@ -7,6 +7,7 @@ export interface BaseLogger {
|
|
|
7
7
|
warn: (...args: any[]) => void;
|
|
8
8
|
debug: (...args: any[]) => void;
|
|
9
9
|
trace: (...args: any[]) => void;
|
|
10
|
+
attention: (...args: any[]) => void;
|
|
10
11
|
}
|
|
11
12
|
export type SpawnInput = string | number;
|
|
12
13
|
export interface FfmpegOptions {
|
|
@@ -15,7 +16,7 @@ export interface FfmpegOptions {
|
|
|
15
16
|
audio?: SpawnInput[];
|
|
16
17
|
output: SpawnInput[];
|
|
17
18
|
}
|
|
18
|
-
export type
|
|
19
|
+
export type Container = 'mp4' | 'mpegts';
|
|
19
20
|
export interface BasePrebufferState {
|
|
20
21
|
maxDuration: number;
|
|
21
22
|
availableDuration: number;
|
|
@@ -29,9 +30,9 @@ export interface PrebufferStateFalse extends BasePrebufferState {
|
|
|
29
30
|
}
|
|
30
31
|
export type PrebufferState = PrebufferStateTrue | PrebufferStateFalse;
|
|
31
32
|
export interface CameraSource extends CameraInput {
|
|
32
|
-
updatePrebufferingState(container:
|
|
33
|
-
getPrebufferingState(container:
|
|
34
|
-
onPrebuffering(container:
|
|
33
|
+
updatePrebufferingState(container: Container, state: PrebufferState): Promise<void>;
|
|
34
|
+
getPrebufferingState(container: Container): PrebufferState;
|
|
35
|
+
onPrebuffering(container: Container): Observable<PrebufferState>;
|
|
35
36
|
getStreamInfo(): Promise<StreamInfo | undefined>;
|
|
36
37
|
}
|
|
37
38
|
export interface CameraPrebufferDelegate {
|
|
@@ -100,7 +101,7 @@ export type CameraConfig = (BaseCameraConfig & {
|
|
|
100
101
|
});
|
|
101
102
|
export interface Detection {
|
|
102
103
|
id?: string;
|
|
103
|
-
label:
|
|
104
|
+
label: ObjectClasses;
|
|
104
105
|
confidence: number;
|
|
105
106
|
boundingBox: [number, number, number, number];
|
|
106
107
|
inputWidth: number;
|
|
@@ -113,9 +114,10 @@ export interface DetectionZone {
|
|
|
113
114
|
points: Point[];
|
|
114
115
|
type: ZoneType;
|
|
115
116
|
filter: ZoneFilter;
|
|
116
|
-
classes:
|
|
117
|
+
classes: ObjectClasses[];
|
|
117
118
|
isPrivacyMask: boolean;
|
|
118
119
|
}
|
|
120
|
+
export type ObjectClasses = 'person' | 'bicycle' | 'car' | 'motorcycle' | 'airplane' | 'bus' | 'train' | 'truck' | 'boat' | 'traffic light' | 'fire hydrant' | 'stop sign' | 'parking meter' | 'bench' | 'bird' | 'cat' | 'dog' | 'horse' | 'sheep' | 'cow' | 'elephant' | 'bear' | 'zebra' | 'giraffe' | 'backpack' | 'umbrella' | 'handbag' | 'tie' | 'suitcase' | 'frisbee' | 'skis' | 'snowboard' | 'sports ball' | 'kite' | 'baseball bat' | 'baseball glove' | 'skateboard' | 'surfboard' | 'tennis racket' | 'bottle' | 'wine glass' | 'cup' | 'fork' | 'knife' | 'spoon' | 'bowl' | 'banana' | 'apple' | 'sandwich' | 'orange' | 'broccoli' | 'carrot' | 'hot dog' | 'pizza' | 'donut' | 'cake' | 'chair' | 'couch' | 'potted plant' | 'bed' | 'dining table' | 'toilet' | 'tv' | 'laptop' | 'mouse' | 'remote' | 'keyboard' | 'cell phone' | 'microwave' | 'oven' | 'toaster' | 'sink' | 'refrigerator' | 'book' | 'clock' | 'vase' | 'scissors' | 'teddy bear' | 'hair drier' | 'toothbrush' | 'motion';
|
|
119
121
|
export interface BaseState<T extends LightState | AudioState | MotionState | ObjectState | SirenState | BatteryState | DoorbellState> {
|
|
120
122
|
timestamp: string;
|
|
121
123
|
lastEvent?: Omit<T, 'lastEvent'>;
|
|
@@ -153,6 +155,9 @@ export type DoorbellState = BaseState<DoorbellState> & DoorbellSetEvent;
|
|
|
153
155
|
export type SirenState = BaseState<SirenState> & SirenSetEvent;
|
|
154
156
|
export type ObjectState = BaseState<ObjectState> & ObjectSetEvent;
|
|
155
157
|
export type BatteryState = BaseState<BatteryState> & BatterySetEvent;
|
|
158
|
+
export interface FrameState extends MotionState {
|
|
159
|
+
frame: Buffer;
|
|
160
|
+
}
|
|
156
161
|
export type States = LightState | MotionState | AudioState | ObjectState | DoorbellState | SirenState | BatteryState;
|
|
157
162
|
export type Sets = LightSetEvent | MotionSetEvent | AudioSetEvent | ObjectSetEvent | DoorbellSetEvent | SirenSetEvent | BatterySetEvent;
|
|
158
163
|
export interface StateValues {
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
export declare class
|
|
2
|
+
import type { NatsConnection } from 'nats';
|
|
3
|
+
import type { FrameBuffer, FrameImage, FrameMetadata, ImageOptions, MotionFrame as MotionFrameMethods, VideoFrame as VideoFrameMethods } from '../decoder/types.js';
|
|
4
|
+
import type { MotionState } from './types.js';
|
|
5
|
+
export declare class VideoFrame implements VideoFrameMethods {
|
|
6
|
+
readonly imageBuffer: Buffer;
|
|
6
7
|
private frameGeneratorSubject;
|
|
7
8
|
private publisher;
|
|
8
|
-
private imageBuffer;
|
|
9
9
|
private _metadata;
|
|
10
10
|
get metadata(): FrameMetadata;
|
|
11
11
|
get inputWidth(): number;
|
|
12
12
|
get inputHeight(): number;
|
|
13
13
|
get inputFormat(): string;
|
|
14
14
|
constructor(cameraId: string, publisher: NatsConnection, imageBuffer: Buffer, metadata: FrameMetadata);
|
|
15
|
-
toBuffer(options?: ImageOptions): Promise<
|
|
16
|
-
toImage(options?: ImageOptions): Promise<
|
|
15
|
+
toBuffer(options?: ImageOptions): Promise<FrameBuffer>;
|
|
16
|
+
toImage(options?: ImageOptions): Promise<FrameImage>;
|
|
17
|
+
save(path: string, options?: ImageOptions | undefined): Promise<void>;
|
|
17
18
|
private send;
|
|
19
|
+
private getImageInformation;
|
|
20
|
+
private validateOptions;
|
|
21
|
+
}
|
|
22
|
+
export declare class MotionFrame extends VideoFrame implements MotionFrameMethods {
|
|
23
|
+
motion: MotionState;
|
|
24
|
+
constructor(cameraId: string, publisher: NatsConnection, imageBuffer: Buffer, motionState: MotionState, metadata: FrameMetadata);
|
|
18
25
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import type { ChildProcess } from 'node:child_process';
|
|
4
4
|
import type { Sharp } from 'sharp';
|
|
5
|
+
import type { MotionState } from '../camera/types.js';
|
|
5
6
|
export interface FrameMetadata {
|
|
6
7
|
format: string;
|
|
7
8
|
frameSize: number;
|
|
@@ -20,9 +21,6 @@ export interface ImageResize {
|
|
|
20
21
|
width?: number;
|
|
21
22
|
height?: number;
|
|
22
23
|
}
|
|
23
|
-
export interface ImageRotate {
|
|
24
|
-
angle: number;
|
|
25
|
-
}
|
|
26
24
|
export interface ImageFormat {
|
|
27
25
|
to: 'rgba' | 'gray';
|
|
28
26
|
}
|
|
@@ -30,19 +28,36 @@ export interface ImageOptions {
|
|
|
30
28
|
format?: ImageFormat;
|
|
31
29
|
crop?: ImageCrop;
|
|
32
30
|
resize?: ImageResize;
|
|
33
|
-
rotate?: ImageRotate;
|
|
34
31
|
}
|
|
35
32
|
export interface ProcessImageRequest {
|
|
36
33
|
options: ImageOptions;
|
|
37
34
|
data: Buffer;
|
|
38
35
|
}
|
|
36
|
+
export interface ImageInformation {
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
channels: number;
|
|
40
|
+
}
|
|
41
|
+
export interface FrameBuffer {
|
|
42
|
+
image: Buffer;
|
|
43
|
+
info: ImageInformation;
|
|
44
|
+
}
|
|
45
|
+
export interface FrameImage {
|
|
46
|
+
image: Sharp;
|
|
47
|
+
info: ImageInformation;
|
|
48
|
+
}
|
|
39
49
|
export interface VideoFrame {
|
|
50
|
+
readonly imageBuffer: Buffer;
|
|
40
51
|
metadata: FrameMetadata;
|
|
41
52
|
inputWidth: number;
|
|
42
53
|
inputHeight: number;
|
|
43
54
|
inputFormat: string;
|
|
44
|
-
toBuffer: (options?: ImageOptions) => Promise<
|
|
45
|
-
toImage: (options?: ImageOptions) => Promise<
|
|
55
|
+
toBuffer: (options?: ImageOptions) => Promise<FrameBuffer>;
|
|
56
|
+
toImage: (options?: ImageOptions) => Promise<FrameImage>;
|
|
57
|
+
save: (path: string, options?: ImageOptions) => Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
export interface MotionFrame extends VideoFrame {
|
|
60
|
+
motion: MotionState;
|
|
46
61
|
}
|
|
47
62
|
export interface VideoSession {
|
|
48
63
|
isActive(): boolean;
|
|
@@ -61,6 +76,7 @@ export interface BaseFrameWorkerConfig {
|
|
|
61
76
|
pass: string;
|
|
62
77
|
};
|
|
63
78
|
proxyPort: number;
|
|
79
|
+
useWasm: boolean;
|
|
64
80
|
}
|
|
65
81
|
export type WorkerMessage = 'started' | 'getFFmpegArgs' | 'updateClient' | 'removeClient' | 'clearClients';
|
|
66
82
|
export type MainMessage = 'setCameraName' | 'recoverClients';
|
|
@@ -118,3 +134,7 @@ export interface RecoveredClient {
|
|
|
118
134
|
pluginId: string;
|
|
119
135
|
requestIds: string[];
|
|
120
136
|
}
|
|
137
|
+
export interface PrebufferContainer {
|
|
138
|
+
time: number;
|
|
139
|
+
frame: Buffer;
|
|
140
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Subscribed } from '../utils/subscribed.js';
|
|
2
2
|
import type { CameraController } from '../camera/controller.js';
|
|
3
|
+
import { PLUGIN_STATUS } from '../plugins/types.js';
|
|
3
4
|
export declare class FrameWorker extends Subscribed {
|
|
4
5
|
token: string;
|
|
6
|
+
name: string;
|
|
5
7
|
private readonly clients;
|
|
6
8
|
private subject;
|
|
7
9
|
private ipcSubject;
|
|
@@ -10,25 +12,31 @@ export declare class FrameWorker extends Subscribed {
|
|
|
10
12
|
private subscriber?;
|
|
11
13
|
private logger;
|
|
12
14
|
private configService;
|
|
15
|
+
private socketService;
|
|
13
16
|
private camera;
|
|
14
17
|
private frameWorker?;
|
|
15
18
|
private initialized;
|
|
16
19
|
private stopped;
|
|
20
|
+
private restarting;
|
|
17
21
|
private auth;
|
|
18
22
|
private proxyPort;
|
|
19
23
|
private ffmpegArgs;
|
|
20
24
|
private py;
|
|
25
|
+
private _status;
|
|
26
|
+
get status(): PLUGIN_STATUS;
|
|
21
27
|
constructor(camera: CameraController, proxyPort: number, auth: {
|
|
22
28
|
user: string;
|
|
23
29
|
pass: string;
|
|
24
30
|
});
|
|
25
|
-
|
|
31
|
+
start(): Promise<void>;
|
|
26
32
|
close(): Promise<void>;
|
|
27
|
-
|
|
33
|
+
restart(): Promise<void>;
|
|
34
|
+
getPID(): number;
|
|
28
35
|
private startWorker;
|
|
29
36
|
private restartWorker;
|
|
30
37
|
private killWorker;
|
|
31
38
|
private sendMessage;
|
|
32
39
|
private listenToMessages;
|
|
40
|
+
private setStatus;
|
|
33
41
|
private getLogPrefix;
|
|
34
42
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import type { Camera } from '../../api/database/types.js';
|
|
3
|
-
import type { CameraDelegate, CameraPrebufferDelegate,
|
|
3
|
+
import type { CameraDelegate, CameraPrebufferDelegate, Container, FfmpegOptions, PrebufferState, SetValues, StateValues, StreamInfo } from '../../camera/types.js';
|
|
4
4
|
import type { IceServer } from '../../services/config/types.js';
|
|
5
5
|
import type { MessageQueue } from '../queue.js';
|
|
6
6
|
import type { CameraDeviceProxyMethods, ProxyMessageStructure } from '../types.js';
|
|
@@ -57,7 +57,7 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
|
57
57
|
}): Promise<void>;
|
|
58
58
|
updatePrebufferState(data: {
|
|
59
59
|
sourceId: string;
|
|
60
|
-
container:
|
|
60
|
+
container: Container;
|
|
61
61
|
state: PrebufferState;
|
|
62
62
|
cameraId: string;
|
|
63
63
|
pluginId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Camera } from '../api/database/types.js';
|
|
2
2
|
import type { CameraDevice } from '../camera/device.js';
|
|
3
|
-
import type { CameraConfig,
|
|
3
|
+
import type { CameraConfig, Container, FfmpegOptions, PrebufferState, SetValues, StateValues, StreamInfo } from '../camera/types.js';
|
|
4
4
|
import type { BasePlugin } from '../plugins/base.js';
|
|
5
5
|
import type { CameraExtension } from '../plugins/types.js';
|
|
6
6
|
import type { CameraStorage } from '../polyglot/node/plugins/cameraStorage.js';
|
|
@@ -130,7 +130,7 @@ export interface CameraDeviceProxyMethods {
|
|
|
130
130
|
}): void;
|
|
131
131
|
updatePrebufferState(data: {
|
|
132
132
|
sourceId: string;
|
|
133
|
-
container:
|
|
133
|
+
container: Container;
|
|
134
134
|
state: PrebufferState;
|
|
135
135
|
cameraId: string;
|
|
136
136
|
pluginId: string;
|
|
@@ -91,11 +91,13 @@ export interface JsonSchemaNumber extends JsonBaseSchema<number> {
|
|
|
91
91
|
type: 'number';
|
|
92
92
|
minimum?: number;
|
|
93
93
|
maximum?: number;
|
|
94
|
+
step?: number;
|
|
94
95
|
}
|
|
95
96
|
export interface PluginJsonSchemaNumber extends PluginJsonBaseSchema<number> {
|
|
96
97
|
type: 'number';
|
|
97
98
|
minimum?: number;
|
|
98
99
|
maximum?: number;
|
|
100
|
+
step?: number;
|
|
99
101
|
}
|
|
100
102
|
export interface JsonSchemaBoolean extends JsonBaseSchema<boolean> {
|
|
101
103
|
type: 'boolean';
|
|
@@ -1,27 +1,35 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
1
2
|
import { CameraDevice } from '../../../../camera/device.js';
|
|
3
|
+
import { MotionFrame, VideoFrame } from '../../../../camera/videoFrame.js';
|
|
2
4
|
import type { Camera } from '../../../../api/database/types.js';
|
|
3
5
|
import type { CameraSource, SetValues } from '../../../../camera/types.js';
|
|
4
|
-
import type { VideoFrame } from '../../../../decoder/types.js';
|
|
5
6
|
import type { IceServer } from '../../../../services/config/types.js';
|
|
6
7
|
import type { PluginAPI } from '../api.js';
|
|
7
8
|
import type { PluginLogger } from '../logger.js';
|
|
8
9
|
export declare class CameraDeviceProxy extends CameraDevice {
|
|
9
10
|
private api;
|
|
10
11
|
private initialized;
|
|
11
|
-
private
|
|
12
|
+
private subject;
|
|
13
|
+
private subjectMotionFrame;
|
|
12
14
|
private cameraSubscriberSubject;
|
|
13
15
|
private cameraPluginSubscriberSubject;
|
|
14
16
|
private frameSubject;
|
|
17
|
+
private framePrebufferSubject;
|
|
18
|
+
private motionFrameSubject;
|
|
15
19
|
private signalingSubject;
|
|
16
20
|
private signalingTargetSubject;
|
|
17
21
|
private publisher?;
|
|
18
|
-
private
|
|
22
|
+
private framePublisher?;
|
|
23
|
+
private subscriber?;
|
|
19
24
|
private cameraSubscriber?;
|
|
20
25
|
private cameraPluginSubscriber?;
|
|
21
26
|
private signalingSubscriber?;
|
|
22
27
|
private frameSubscriber?;
|
|
23
|
-
private
|
|
28
|
+
private prebufferFrameSubsciber?;
|
|
29
|
+
private motionFrameSubscriber?;
|
|
24
30
|
private messageQueue?;
|
|
31
|
+
private activeRequests;
|
|
32
|
+
private activeMotionRequests;
|
|
25
33
|
private auth;
|
|
26
34
|
private proxyPort;
|
|
27
35
|
private pluginID;
|
|
@@ -35,14 +43,20 @@ export declare class CameraDeviceProxy extends CameraDevice {
|
|
|
35
43
|
connect(): Promise<void>;
|
|
36
44
|
disconnect(): Promise<void>;
|
|
37
45
|
reboot(): Promise<void>;
|
|
38
|
-
|
|
46
|
+
getFrames(): AsyncIterableIterator<VideoFrame>;
|
|
47
|
+
getMotionFrames(): AsyncIterableIterator<MotionFrame>;
|
|
48
|
+
getPrebufferedFrames(): AsyncIterableIterator<VideoFrame>;
|
|
39
49
|
getFfmpegPath(): Promise<string>;
|
|
40
50
|
getIceServers(): Promise<IceServer[]>;
|
|
41
|
-
updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T]): Promise<void>;
|
|
51
|
+
updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], frame?: Buffer): Promise<void>;
|
|
42
52
|
refreshStates(): Promise<void>;
|
|
43
53
|
cleanup(): Promise<void>;
|
|
54
|
+
private onMotionFrame;
|
|
44
55
|
private connectToDecoder;
|
|
56
|
+
private getMetadata;
|
|
45
57
|
private disconnectFromDecoder;
|
|
58
|
+
private closeFrameSubscriber;
|
|
59
|
+
private closeMotionFrameSubsciber;
|
|
46
60
|
private requestHandler;
|
|
47
61
|
private listenToMessages;
|
|
48
62
|
private listenToSignalingMessages;
|
|
@@ -17,16 +17,16 @@ export declare class DeviceManager extends EventEmitter implements DeviceManager
|
|
|
17
17
|
private api;
|
|
18
18
|
private logger;
|
|
19
19
|
private initialized;
|
|
20
|
+
private subject;
|
|
21
|
+
private dmSubject;
|
|
20
22
|
private publisher?;
|
|
21
|
-
private client?;
|
|
22
23
|
private subscriber?;
|
|
24
|
+
private dmSubscriber?;
|
|
23
25
|
private messageQueue?;
|
|
24
26
|
private auth;
|
|
25
27
|
private proxyPort;
|
|
26
28
|
private pluginId;
|
|
27
29
|
private pluginName;
|
|
28
|
-
private clientSubject;
|
|
29
|
-
private subscriberSubject;
|
|
30
30
|
private devices;
|
|
31
31
|
constructor(api: PluginAPI, logger: PluginLogger, pluginId: string, pluginName: string, proxyPort: number, auth: {
|
|
32
32
|
user: string;
|
|
@@ -14,16 +14,16 @@ export declare class PluginsManager extends EventEmitter implements PluginsManag
|
|
|
14
14
|
private api;
|
|
15
15
|
private logger;
|
|
16
16
|
private initialized;
|
|
17
|
+
private subject;
|
|
18
|
+
private pmSubject;
|
|
17
19
|
private publisher?;
|
|
18
|
-
private client?;
|
|
19
20
|
private subscriber?;
|
|
21
|
+
private pmSubscriber?;
|
|
20
22
|
private messageQueue?;
|
|
21
23
|
private auth;
|
|
22
24
|
private proxyPort;
|
|
23
25
|
private pluginId;
|
|
24
26
|
private pluginName;
|
|
25
|
-
private clientSubject;
|
|
26
|
-
private subscriberSubject;
|
|
27
27
|
constructor(api: PluginAPI, logger: PluginLogger, pluginId: string, pluginName: string, proxyPort: number, auth: {
|
|
28
28
|
user: string;
|
|
29
29
|
pass: string;
|