@camera.ui/browser 0.0.73 → 0.0.75

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.
Files changed (53) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +1 -1
  3. package/dist/types/packages/client/browser/src/types.d.ts +2 -2
  4. package/dist/types/server/src/api/controllers/cameras.controller.d.ts +5 -5
  5. package/dist/types/server/src/api/database/types.d.ts +22 -5
  6. package/dist/types/server/src/api/index.d.ts +13 -7
  7. package/dist/types/server/src/api/schemas/cameras.schema.d.ts +192 -158
  8. package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +6 -6
  9. package/dist/types/server/src/api/schemas/users.schema.d.ts +2 -2
  10. package/dist/types/server/src/api/services/cameras.service.d.ts +4 -3
  11. package/dist/types/server/src/api/types/index.d.ts +0 -5
  12. package/dist/types/server/src/api.d.ts +4 -4
  13. package/dist/types/server/src/{devices/camera/controller/index.d.ts → camera/controller.d.ts} +10 -6
  14. package/dist/types/server/src/{devices/camera/cameraDevice.d.ts → camera/device.d.ts} +2 -2
  15. package/dist/types/server/src/{devices/camera → camera}/index.d.ts +30 -23
  16. package/dist/types/server/src/camera/polygon.d.ts +3 -0
  17. package/dist/types/server/src/{devices/camera → camera}/streaming/peer-connection.d.ts +4 -4
  18. package/dist/types/server/src/{devices/camera → camera}/streaming/streaming-session.d.ts +3 -3
  19. package/dist/types/server/src/{devices/camera → camera}/streaming/webrtc-connection.d.ts +4 -4
  20. package/dist/types/server/src/{devices/camera/controller → camera}/types.d.ts +39 -23
  21. package/dist/types/server/src/camera/videoFrame.d.ts +18 -0
  22. package/dist/types/server/src/decoder/ffmpeg.d.ts +2 -1
  23. package/dist/types/server/src/decoder/index.d.ts +2 -13
  24. package/dist/types/server/src/decoder/types.d.ts +29 -9
  25. package/dist/types/server/src/decoder/{worker/index.d.ts → worker.d.ts} +7 -15
  26. package/dist/types/server/src/nats/constants.d.ts +0 -1
  27. package/dist/types/server/src/nats/index.d.ts +2 -2
  28. package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +8 -20
  29. package/dist/types/server/src/nats/proxy/deviceManager.d.ts +1 -1
  30. package/dist/types/server/src/nats/proxy/pluginsManager.d.ts +1 -1
  31. package/dist/types/server/src/nats/server.d.ts +4 -2
  32. package/dist/types/server/src/nats/types.d.ts +14 -23
  33. package/dist/types/server/src/nats/websocket.d.ts +1 -1
  34. package/dist/types/server/src/plugins/base.d.ts +1 -1
  35. package/dist/types/server/src/plugins/plugin.d.ts +1 -1
  36. package/dist/types/server/src/plugins/worker.d.ts +5 -1
  37. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/api.d.ts +3 -3
  38. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/cameraStorage.d.ts +1 -1
  39. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/config.d.ts +1 -1
  40. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/proxy/cameraDevice.d.ts +20 -19
  41. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/proxy/deviceManager.d.ts +10 -8
  42. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/proxy/pluginsManager.d.ts +7 -6
  43. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/proxy/queue.d.ts +2 -2
  44. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/proxy/systemManager.d.ts +7 -6
  45. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/schema.d.ts +2 -2
  46. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/storageController.d.ts +1 -1
  47. package/dist/types/server/src/utils/pythonInstaller.d.ts +1 -1
  48. package/dist/types/shared/types/index.d.ts +2 -1
  49. package/package.json +3 -3
  50. package/dist/types/server/src/api/plugins/logger.plugin.d.ts +0 -7
  51. package/dist/types/server/src/plugins/worker-ipc.d.ts +0 -25
  52. /package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/logger.d.ts +0 -0
  53. /package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/proxy/index.d.ts +0 -0
@@ -17,11 +17,11 @@ export declare const logSchema: zod.ZodObject<{
17
17
  streams: zod.ZodUnion<[zod.ZodLiteral<"info">, zod.ZodLiteral<"debug">, zod.ZodLiteral<"trace">, zod.ZodLiteral<"warn">, zod.ZodLiteral<"error">, zod.ZodLiteral<"fatal">]>;
18
18
  webrtc: zod.ZodUnion<[zod.ZodLiteral<"info">, zod.ZodLiteral<"debug">, zod.ZodLiteral<"trace">, zod.ZodLiteral<"warn">, zod.ZodLiteral<"error">, zod.ZodLiteral<"fatal">]>;
19
19
  }, "strict", zod.ZodTypeAny, {
20
+ mp4: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
20
21
  rtsp: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
21
22
  webrtc: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
22
23
  mjpeg: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
23
24
  hls: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
24
- mp4: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
25
25
  level: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
26
26
  format: string;
27
27
  api: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
@@ -33,11 +33,11 @@ export declare const logSchema: zod.ZodObject<{
33
33
  hass: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
34
34
  streams: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
35
35
  }, {
36
+ mp4: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
36
37
  rtsp: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
37
38
  webrtc: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
38
39
  mjpeg: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
39
40
  hls: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
40
- mp4: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
41
41
  api: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
42
42
  exec: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
43
43
  ngrok: "error" | "info" | "debug" | "warn" | "trace" | "fatal";
@@ -270,11 +270,11 @@ export declare const patchGo2RtcSchema: zod.ZodObject<{
270
270
  streams: zod.ZodOptional<zod.ZodUnion<[zod.ZodLiteral<"info">, zod.ZodLiteral<"debug">, zod.ZodLiteral<"trace">, zod.ZodLiteral<"warn">, zod.ZodLiteral<"error">, zod.ZodLiteral<"fatal">]>>;
271
271
  webrtc: zod.ZodOptional<zod.ZodUnion<[zod.ZodLiteral<"info">, zod.ZodLiteral<"debug">, zod.ZodLiteral<"trace">, zod.ZodLiteral<"warn">, zod.ZodLiteral<"error">, zod.ZodLiteral<"fatal">]>>;
272
272
  }, "strict", zod.ZodTypeAny, {
273
+ mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
273
274
  rtsp?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
274
275
  webrtc?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
275
276
  mjpeg?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
276
277
  hls?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
277
- mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
278
278
  level?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
279
279
  format?: string | undefined;
280
280
  api?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
@@ -286,11 +286,11 @@ export declare const patchGo2RtcSchema: zod.ZodObject<{
286
286
  hass?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
287
287
  streams?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
288
288
  }, {
289
+ mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
289
290
  rtsp?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
290
291
  webrtc?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
291
292
  mjpeg?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
292
293
  hls?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
293
- mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
294
294
  level?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
295
295
  format?: string | undefined;
296
296
  api?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
@@ -490,11 +490,11 @@ export declare const patchGo2RtcSchema: zod.ZodObject<{
490
490
  output: string;
491
491
  };
492
492
  log: {
493
+ mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
493
494
  rtsp?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
494
495
  webrtc?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
495
496
  mjpeg?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
496
497
  hls?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
497
- mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
498
498
  level?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
499
499
  format?: string | undefined;
500
500
  api?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
@@ -581,11 +581,11 @@ export declare const patchGo2RtcSchema: zod.ZodObject<{
581
581
  output?: string | undefined;
582
582
  }) | undefined;
583
583
  log?: {
584
+ mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
584
585
  rtsp?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
585
586
  webrtc?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
586
587
  mjpeg?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
587
588
  hls?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
588
- mp4?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
589
589
  level?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
590
590
  format?: string | undefined;
591
591
  api?: "error" | "info" | "debug" | "warn" | "trace" | "fatal" | undefined;
@@ -243,8 +243,8 @@ export declare const createUserSchema: zod.ZodEffects<zod.ZodObject<{
243
243
  };
244
244
  }>>;
245
245
  }, "strict", zod.ZodTypeAny, {
246
- password: string;
247
246
  _id: string;
247
+ password: string;
248
248
  preferences: {
249
249
  camview: {
250
250
  grids: {
@@ -287,8 +287,8 @@ export declare const createUserSchema: zod.ZodEffects<zod.ZodObject<{
287
287
  oneLogin?: boolean | undefined;
288
288
  firstLogin?: boolean | undefined;
289
289
  }>, {
290
- password: string;
291
290
  _id: string;
291
+ password: string;
292
292
  preferences: {
293
293
  camview: {
294
294
  grids: {
@@ -13,9 +13,9 @@ export declare class CamerasService {
13
13
  constructor();
14
14
  createCamera(cameraData: DBCamera): Promise<DBCamera>;
15
15
  createTransformedCamera(cameraData: DBCamera): Promise<Camera>;
16
- createZone(cameraname: string, zoneData: CameraZone, zoneType: 'motion' | 'object'): Promise<DBCamera | undefined>;
17
- patchZoneByName(cameraname: string, zonename: string, zoneData: CameraZone, zoneType: 'motion' | 'object'): Promise<DBCamera | undefined>;
18
- removeZoneByName(cameraname: string, zonename: string, zoneType: 'motion' | 'object'): Promise<void>;
16
+ createZone(cameraname: string, zoneData: CameraZone): Promise<DBCamera | undefined>;
17
+ patchZoneByName(cameraname: string, zonename: string, zoneData: CameraZone): Promise<DBCamera | undefined>;
18
+ removeZoneByName(cameraname: string, zonename: string): Promise<void>;
19
19
  createCameraSource(cameraname: string, sourceName: string, address: string): Promise<void>;
20
20
  resetCameraSource(cameraname: string, sourceName: string): Promise<void>;
21
21
  list(): DBCamera[];
@@ -50,5 +50,6 @@ export declare class CamerasService {
50
50
  private generateFFmpegUrls;
51
51
  private generateWWWUrls;
52
52
  private extensionIsEnabled;
53
+ private convertToDetectionZones;
53
54
  }
54
55
  export {};
@@ -249,11 +249,6 @@ export type CamerasExtensionsRequest = {
249
249
  type: CameraExtension;
250
250
  };
251
251
  };
252
- export type CameraZonesTypeRequest = {
253
- Querystring: {
254
- type: 'motion' | 'object';
255
- };
256
- };
257
252
  export type CameraZoneInsertPatchRequest = {
258
253
  Body: CameraZone;
259
254
  };
@@ -1,13 +1,13 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  import 'reflect-metadata';
3
3
  import { EventEmitter } from 'node:events';
4
- import { CameraController } from './devices/camera/controller/index.js';
4
+ import { CameraController } from './camera/controller.js';
5
5
  import type { Camera, CameraExtensions } from './api/database/types.js';
6
- import type { FrameWorker } from './decoder/worker/index.js';
6
+ import type { FrameWorker } from './decoder/worker.js';
7
7
  import type { BasePlugin } from './plugins/base.js';
8
- import type { API } from './plugins/node/api.js';
9
- import type { PluginLogger } from './plugins/node/logger.js';
10
8
  import type { CameraExtension } from './plugins/types.js';
9
+ import type { API } from './polyglot/node/plugins/api.js';
10
+ import type { PluginLogger } from './polyglot/node/plugins/logger.js';
11
11
  export interface PluginConstructor {
12
12
  new (logger: PluginLogger, api: API): BasePlugin;
13
13
  }
@@ -1,14 +1,16 @@
1
- import { CameraDevice } from '../cameraDevice.js';
2
- import type { Camera } from '../../../api/database/types.js';
3
- import type { VideoFrame } from '../../../decoder/types.js';
4
- import type { ProxyServer } from '../../../nats/index.js';
5
- import type { IceServer } from '../../../services/config/types.js';
6
- import type { BaseLogger } from './types.js';
1
+ import { CameraDevice } from './device.js';
2
+ import type { Camera } from '../api/database/types.js';
3
+ import type { VideoFrame } from '../decoder/types.js';
4
+ import type { ProxyServer } from '../nats/index.js';
5
+ import type { IceServer } from '../services/config/types.js';
6
+ import type { BaseLogger, CameraSource } from './types.js';
7
7
  export declare class CameraController extends CameraDevice {
8
8
  private proxy;
9
9
  private motionTimeout?;
10
10
  private doorbellTimeout?;
11
11
  private doorbellTimeoutDuration;
12
+ private prebufferStateSubscriptions;
13
+ get sources(): CameraSource[];
12
14
  constructor(camera: Camera, logger: BaseLogger, proxy: ProxyServer);
13
15
  connect(): Promise<void>;
14
16
  disconnect(): Promise<void>;
@@ -19,9 +21,11 @@ export declare class CameraController extends CameraDevice {
19
21
  updateCamera(updatedCamera: Camera): void;
20
22
  cleanup(): void;
21
23
  private subscribeToCameraState;
24
+ private subscribeToCameraSourcesState;
22
25
  private subscribeToMotionState;
23
26
  private subscribeToDoorbellState;
24
27
  private subscribeToCameraChanges;
25
28
  private subscribeToStateChanges;
26
29
  private triggerProxyEvent;
30
+ private isCameraEvent;
27
31
  }
@@ -1,8 +1,8 @@
1
1
  import { BaseCameraDevice } from './index.js';
2
2
  import { StreamingSession } from './streaming/streaming-session.js';
3
- import type { VideoFrame } from '../../decoder/types.js';
4
- import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions } from './controller/types.js';
3
+ import type { VideoFrame } from '../decoder/types.js';
5
4
  import type { StreamingConnectionOptions } from './streaming/peer-connection.js';
5
+ import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions } from './types.js';
6
6
  export declare abstract class CameraDevice extends BaseCameraDevice {
7
7
  private _delegate?;
8
8
  private _prebufferDelegate?;
@@ -1,9 +1,9 @@
1
1
  import { LRUCache } from 'lru-cache';
2
2
  import { BehaviorSubject } from 'rxjs';
3
3
  import type { Observable, Subscription } from 'rxjs';
4
- import type { Camera, CameraInformation, CameraPublicProperties, CameraType, CameraZone } from '../../api/database/types.js';
5
- import type { IceServer } from '../../services/config/types.js';
6
- import type { AudioSetEvent, AudioState, BaseLogger, BatterySetEvent, BatteryState, CameraSource, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, SetValues, Sets, SirenSetEvent, SirenState, StateValues, States } from './controller/types.js';
4
+ import type { Camera, CameraActivitySettings, CameraInformation, CameraPublicProperties, CameraType } from '../api/database/types.js';
5
+ 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, PrebufferContainer, PrebufferState, SetValues, Sets, SirenSetEvent, SirenState, StateValues, States } from './types.js';
7
7
  declare class Subscribed {
8
8
  private readonly subscriptions;
9
9
  private readonly additionalSubscriptions;
@@ -24,18 +24,23 @@ export declare abstract class BaseCameraDevice extends Subscribed {
24
24
  protected doorbellState: BehaviorSubject<DoorbellState>;
25
25
  protected sirenState: BehaviorSubject<SirenState>;
26
26
  protected batteryState: BehaviorSubject<BatteryState>;
27
- onConnected: Observable<boolean>;
28
- onLightSwitched: Observable<LightState>;
29
- onMotionDetected: Observable<MotionState>;
30
- onAudioDetected: Observable<AudioState>;
31
- onObjectDetected: Observable<ObjectState>;
32
- onDoorbellPressed: Observable<DoorbellState>;
33
- onSirenDetected: Observable<SirenState>;
34
- onBatteryChanged: Observable<BatteryState>;
27
+ protected prebufferStateSubjects: {
28
+ [sourceId: string]: {
29
+ [container: string]: BehaviorSubject<PrebufferState>;
30
+ };
31
+ };
32
+ readonly onConnected: Observable<boolean>;
33
+ readonly onLightSwitched: Observable<LightState>;
34
+ readonly onMotionDetected: Observable<MotionState>;
35
+ readonly onAudioDetected: Observable<AudioState>;
36
+ readonly onObjectDetected: Observable<ObjectState>;
37
+ readonly onDoorbellPressed: Observable<DoorbellState>;
38
+ readonly onSirenDetected: Observable<SirenState>;
39
+ readonly onBatteryChanged: Observable<BatteryState>;
35
40
  get id(): string;
36
41
  get nativeId(): string | undefined;
37
42
  get pluginId(): string;
38
- get state(): boolean;
43
+ get connected(): boolean;
39
44
  get disabled(): boolean;
40
45
  get name(): string;
41
46
  get type(): CameraType;
@@ -51,8 +56,8 @@ export declare abstract class BaseCameraDevice extends Subscribed {
51
56
  get hasPtz(): boolean;
52
57
  get hasPrebuffer(): boolean;
53
58
  get hasIntercom(): boolean;
54
- get motionZones(): CameraZone[];
55
- get objectZones(): CameraZone[];
59
+ get activityZones(): DetectionZone[];
60
+ get activitySettings(): CameraActivitySettings;
56
61
  get sources(): CameraSource[];
57
62
  get streamSource(): CameraSource;
58
63
  get snapshotSource(): CameraSource;
@@ -66,7 +71,7 @@ export declare abstract class BaseCameraDevice extends Subscribed {
66
71
  abstract getIceServers(): Promise<IceServer[]>;
67
72
  protected abstract cleanup(): void;
68
73
  getValue<T extends keyof StateValues>(stateName: T): StateValues[T];
69
- updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T]): Promise<void>;
74
+ updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], skipCheck?: boolean): Promise<void>;
70
75
  onStateChange<T extends keyof StateValues>(stateName: T): Observable<{
71
76
  newState: StateValues[T];
72
77
  oldState: StateValues[T];
@@ -76,6 +81,10 @@ export declare abstract class BaseCameraDevice extends Subscribed {
76
81
  newData: Camera[T];
77
82
  }>;
78
83
  removeAllListeners(): void;
84
+ protected checkStateInternal<T extends keyof SetValues>(stateName: T, event: SetValues[T]): {
85
+ changed: boolean;
86
+ event: SetValues[T];
87
+ };
79
88
  protected getAudioState(event: AudioSetEvent): AudioState;
80
89
  protected getMotionState(event: MotionSetEvent): MotionState;
81
90
  protected getObjectState(event: ObjectSetEvent): ObjectState;
@@ -83,16 +92,14 @@ export declare abstract class BaseCameraDevice extends Subscribed {
83
92
  protected getLightState(event: LightSetEvent | LightState): LightState;
84
93
  protected getSirenState(event: SirenSetEvent): SirenState;
85
94
  protected getBatteryState(event: BatterySetEvent): BatteryState;
86
- private createStateObservable;
87
95
  protected updateCamera(updatedCamera: Camera): void;
96
+ protected updatePrebuffer(sourceId: string, container: PrebufferContainer, state: PrebufferState): Promise<void>;
97
+ protected updateCameraSourcesState(): void;
88
98
  protected updateCameraState(state: boolean): void;
89
- protected stateChanged<T extends keyof SetValues>(oldState?: SetValues[T], newState?: SetValues[T]): boolean;
90
- protected isAudioState(state: Sets): state is AudioSetEvent;
91
- protected isMotionState(state: Sets): state is MotionSetEvent;
92
- protected isObjectState(state: Sets): state is ObjectSetEvent;
93
- protected isSirenState(state: Sets): state is SirenSetEvent;
94
- protected isBatteryState(state: Sets): state is BatterySetEvent;
95
- protected isGenericState(state: Sets): state is DoorbellSetEvent;
99
+ protected cameraSourcePrebufferState(sourceId: string, container: PrebufferContainer): PrebufferState;
100
+ private createStateObservable;
101
+ protected createPrebufferStateObservable(sourceId: string, container: PrebufferContainer): Observable<PrebufferState>;
102
+ protected stateChanged<T extends keyof SetValues>(oldState?: SetValues[T], newState?: SetValues[T], type?: keyof StateValues): boolean;
96
103
  protected isStateEvent(state: States | Sets): state is States;
97
104
  }
98
105
  export {};
@@ -0,0 +1,3 @@
1
+ import type { Detection, DetectionZone } from './types.js';
2
+ export declare const areObjectDetectionsValid: (detections: Detection[], zones: DetectionZone[]) => Detection[];
3
+ export declare const areMotionDetectionsValid: (detections: Detection[], zones: DetectionZone[]) => Detection[];
@@ -1,11 +1,11 @@
1
1
  import { ReplaySubject, Subject } from 'rxjs';
2
2
  import { MediaStreamTrack } from 'werift';
3
- import { Subscribed } from '../../../utils/subscribed.js';
3
+ import { Subscribed } from '../../utils/subscribed.js';
4
4
  import type { Observable } from 'rxjs';
5
5
  import type { ConnectionState, RTCIceCandidate, RTCSessionDescription, RtcpPacket, RtpPacket, RTCIceCandidate as WeriftRTCICECandidate } from 'werift';
6
- import type { IceServer } from '../../../services/config/types.js';
7
- import type { CameraDevice } from '../cameraDevice.js';
8
- import type { BaseLogger } from '../controller/types.js';
6
+ import type { IceServer } from '../../services/config/types.js';
7
+ import type { CameraDevice } from '../device.js';
8
+ import type { BaseLogger } from '../types.js';
9
9
  export interface BasicPeerConnection {
10
10
  createOffer(): Promise<RTCSessionDescription>;
11
11
  acceptAnswer(answer: {
@@ -1,8 +1,8 @@
1
1
  import { ReplaySubject, Subject } from 'rxjs';
2
2
  import { RtpPacket } from 'werift';
3
- import { Subscribed } from '../../../utils/subscribed.js';
4
- import type { CameraDevice } from '../cameraDevice.js';
5
- import type { BaseLogger, FfmpegOptions, SpawnInput } from '../controller/types.js';
3
+ import { Subscribed } from '../../utils/subscribed.js';
4
+ import type { CameraDevice } from '../device.js';
5
+ import type { BaseLogger, FfmpegOptions, SpawnInput } from '../types.js';
6
6
  import type { WebrtcConnection } from './webrtc-connection.js';
7
7
  export declare class StreamingSession extends Subscribed {
8
8
  readonly onCallEnded: ReplaySubject<void>;
@@ -1,9 +1,9 @@
1
1
  import { ReplaySubject, Subject, type Observable } from 'rxjs';
2
- import { Subscribed } from '../../../utils/subscribed.js';
2
+ import { Subscribed } from '../../utils/subscribed.js';
3
3
  import type { RtpPacket } from 'werift';
4
- import type { IceServer } from '../../../services/config/types.js';
5
- import type { CameraDevice } from '../cameraDevice.js';
6
- import type { BaseLogger } from '../controller/types.js';
4
+ import type { IceServer } from '../../services/config/types.js';
5
+ import type { CameraDevice } from '../device.js';
6
+ import type { BaseLogger } from '../types.js';
7
7
  import type { StreamingConnectionOptions } from './peer-connection.js';
8
8
  export declare class WebrtcConnection extends Subscribed {
9
9
  readonly onCameraConnected: ReplaySubject<void>;
@@ -1,12 +1,6 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
- import type { CameraInformation, CameraInput, CameraInputSettings } from '../../../api/database/types.js';
3
- export type SpawnInput = string | number;
4
- export type PrebufferType = 'recording' | 'stream';
5
- export interface CameraSource extends CameraInput {
6
- isPrebuffering(type: PrebufferType): Promise<boolean>;
7
- getPrebufferRawUrl(type: PrebufferType): Promise<string | undefined>;
8
- getStreamInfo(): Promise<StreamInfo | undefined>;
9
- }
2
+ import type { Observable } from 'rxjs';
3
+ import type { CameraInformation, CameraInput, CameraInputSettings, Point, ZoneFilter, ZoneType } from '../api/database/types.js';
10
4
  export interface BaseLogger {
11
5
  log: (...args: any[]) => void;
12
6
  error: (...args: any[]) => void;
@@ -14,12 +8,35 @@ export interface BaseLogger {
14
8
  debug: (...args: any[]) => void;
15
9
  trace: (...args: any[]) => void;
16
10
  }
11
+ export type SpawnInput = string | number;
17
12
  export interface FfmpegOptions {
18
13
  input?: SpawnInput[];
19
14
  video?: SpawnInput[] | false;
20
15
  audio?: SpawnInput[];
21
16
  output: SpawnInput[];
22
17
  }
18
+ export type PrebufferContainer = 'mp4' | 'mpegts';
19
+ export interface BasePrebufferState {
20
+ maxDuration: number;
21
+ availableDuration: number;
22
+ }
23
+ export interface PrebufferStateTrue extends BasePrebufferState {
24
+ state: true;
25
+ url: string;
26
+ }
27
+ export interface PrebufferStateFalse extends BasePrebufferState {
28
+ state: false;
29
+ }
30
+ export type PrebufferState = PrebufferStateTrue | PrebufferStateFalse;
31
+ export interface CameraSource extends CameraInput {
32
+ updatePrebufferingState(container: PrebufferContainer, state: PrebufferState): Promise<void>;
33
+ getPrebufferingState(container: PrebufferContainer): PrebufferState;
34
+ onPrebuffering(container: PrebufferContainer): Observable<PrebufferState>;
35
+ getStreamInfo(): Promise<StreamInfo | undefined>;
36
+ }
37
+ export interface CameraPrebufferDelegate {
38
+ getStreamInfo(sourceName: string): Promise<StreamInfo | undefined>;
39
+ }
23
40
  export interface CameraDelegate {
24
41
  snapshotRequest(requestId: string): Promise<Buffer>;
25
42
  prepareStream(requestId: string): Promise<void>;
@@ -27,10 +44,9 @@ export interface CameraDelegate {
27
44
  onCandidates(requestId: string, candidates: string): Promise<void>;
28
45
  reboot(): Promise<void>;
29
46
  }
30
- export interface CameraPrebufferDelegate {
31
- isPrebuffering(sourceName: string, type: PrebufferType): Promise<boolean>;
32
- getPrebufferRawUrl(sourceName: string, type: PrebufferType): Promise<string | undefined>;
33
- getStreamInfo(sourceName: string): Promise<StreamInfo | undefined>;
47
+ export interface StreamInfo {
48
+ audio: AudioStreamOptions;
49
+ video: VideoStreamOptions;
34
50
  }
35
51
  export interface AudioStreamOptions {
36
52
  enabled?: boolean;
@@ -46,10 +62,6 @@ export interface VideoStreamOptions {
46
62
  fps?: number;
47
63
  idrInterval?: number;
48
64
  }
49
- export interface StreamInfo {
50
- audio: AudioStreamOptions;
51
- video: VideoStreamOptions;
52
- }
53
65
  export type Sdp = string;
54
66
  export type IceCandiate = string;
55
67
  export interface Go2RtcOfferMessage {
@@ -86,7 +98,7 @@ export type CameraConfig = (BaseCameraConfig & {
86
98
  }) | (BaseCameraConfig & {
87
99
  delegate?: CameraDelegate;
88
100
  });
89
- export interface BaseDetection {
101
+ export interface Detection {
90
102
  id?: string;
91
103
  label: string;
92
104
  confidence: number;
@@ -96,24 +108,28 @@ export interface BaseDetection {
96
108
  origWidth: number;
97
109
  origHeight: number;
98
110
  }
99
- export interface MotionDetection extends BaseDetection {
100
- }
101
- export interface ObjectDetection extends BaseDetection {
111
+ export interface DetectionZone {
112
+ name: string;
113
+ points: Point[];
114
+ type: ZoneType;
115
+ filter: ZoneFilter;
116
+ classes: string[];
117
+ isPrivacyMask: boolean;
102
118
  }
103
119
  export interface BaseState<T extends LightState | AudioState | MotionState | ObjectState | SirenState | BatteryState | DoorbellState> {
104
120
  timestamp: string;
105
121
  lastEvent?: Omit<T, 'lastEvent'>;
106
122
  }
107
123
  export interface MotionSetEvent {
108
- state: boolean;
109
- detections: MotionDetection[];
124
+ state?: boolean;
125
+ detections: Detection[];
110
126
  }
111
127
  export interface AudioSetEvent {
112
128
  state: boolean;
113
129
  db?: number;
114
130
  }
115
131
  export interface ObjectSetEvent {
116
- detections: ObjectDetection[];
132
+ detections: Detection[];
117
133
  }
118
134
  export interface LightSetEvent {
119
135
  state: boolean;
@@ -0,0 +1,18 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { type NatsConnection } from 'nats';
3
+ import type { Sharp } from 'sharp';
4
+ import type { FrameMetadata, ImageOptions, VideoFrame } from '../decoder/types.js';
5
+ export declare class VideoFrameUtil implements VideoFrame {
6
+ private frameGeneratorSubject;
7
+ private publisher;
8
+ private imageBuffer;
9
+ private _metadata;
10
+ get metadata(): FrameMetadata;
11
+ get inputWidth(): number;
12
+ get inputHeight(): number;
13
+ get inputFormat(): string;
14
+ constructor(cameraId: string, publisher: NatsConnection, imageBuffer: Buffer, metadata: FrameMetadata);
15
+ toBuffer(options?: ImageOptions): Promise<Buffer>;
16
+ toImage(options?: ImageOptions): Promise<Sharp>;
17
+ private send;
18
+ }
@@ -1 +1,2 @@
1
- export declare function buildFfmpegArguments(ffmpegPath: string, streamUrl: string, port: number): Promise<string[]>;
1
+ import type { FfmpegArgs } from './types.js';
2
+ export declare const getHwaccelInfo: (port: number) => Promise<FfmpegArgs>;
@@ -1,22 +1,11 @@
1
- import { FrameWorker } from './worker/index.js';
2
- import type { CameraController } from '../devices/camera/controller/index.js';
1
+ import { FrameWorker } from './worker.js';
2
+ import type { CameraController } from '../camera/controller.js';
3
3
  export declare class FrameManager {
4
4
  frameWorkers: Map<string, FrameWorker>;
5
- private initialized;
6
5
  private api;
7
6
  private proxyServer;
8
7
  private logger;
9
- private publisher?;
10
- private subscriber?;
11
- private subject;
12
8
  constructor();
13
- init(): Promise<void>;
14
9
  addCamera(camera: CameraController): Promise<FrameWorker>;
15
10
  removeCamera(camera: CameraController): Promise<void>;
16
- private handleConnectMessage;
17
- private handleDisconnectMessage;
18
- private disconnectClient;
19
- private disconnectAllClients;
20
- private startPingPongForClient;
21
- private listenToMessages;
22
11
  }
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
3
  import type { ChildProcess } from 'node:child_process';
4
- import type { ResizeOptions, RotateOptions, Sharp } from 'sharp';
4
+ import type { Sharp } from 'sharp';
5
5
  export interface FrameMetadata {
6
6
  format: string;
7
7
  frameSize: number;
@@ -19,14 +19,12 @@ export interface ImageCrop {
19
19
  export interface ImageResize {
20
20
  width?: number;
21
21
  height?: number;
22
- options?: ResizeOptions;
23
22
  }
24
23
  export interface ImageRotate {
25
24
  angle: number;
26
- options?: RotateOptions;
27
25
  }
28
26
  export interface ImageFormat {
29
- format: 'rgba' | 'gray';
27
+ to: 'rgba' | 'gray';
30
28
  }
31
29
  export interface ImageOptions {
32
30
  format?: ImageFormat;
@@ -62,9 +60,10 @@ export interface BaseFrameWorkerConfig {
62
60
  user: string;
63
61
  pass: string;
64
62
  };
63
+ proxyPort: number;
65
64
  }
66
- export type WorkerMessage = 'started' | 'getFFmpegArgs';
67
- export type MainMessage = 'getMetadata' | 'startVideoSession' | 'stopVideoSession' | 'setCameraName';
65
+ export type WorkerMessage = 'started' | 'getFFmpegArgs' | 'updateClient' | 'removeClient' | 'clearClients';
66
+ export type MainMessage = 'setCameraName' | 'recoverClients';
68
67
  export interface MainToWorkerMessage {
69
68
  message: MainMessage;
70
69
  data: Record<string, any>;
@@ -80,15 +79,15 @@ export interface MainToWorkerResponse {
80
79
  response?: Record<string, any>;
81
80
  }
82
81
  export interface SignalingRequest {
83
- type: 'connect' | 'disconnect';
82
+ type: 'connect' | 'disconnect' | 'metadata';
84
83
  requestId: string;
85
84
  cameraId: string;
86
85
  pluginId: string;
87
86
  }
88
87
  export interface SignalingResponse {
89
- type: 'connected' | 'disconnected' | 'error';
88
+ type: 'connected' | 'disconnected' | 'metadata';
90
89
  requestId: string;
91
- message?: string;
90
+ metadata?: FrameMetadata;
92
91
  }
93
92
  export interface PingMessage {
94
93
  type: 'ping';
@@ -98,3 +97,24 @@ export interface PongMessage {
98
97
  type: 'pong';
99
98
  requestId: string;
100
99
  }
100
+ export interface HardwareSource {
101
+ name: string;
102
+ url: string;
103
+ }
104
+ export interface HardwareResponse {
105
+ sources: HardwareSource[];
106
+ }
107
+ export interface FfmpegArgs {
108
+ hwaccel: string;
109
+ hwaccelArgs: string[];
110
+ hwaccelFilter: string;
111
+ threads: string;
112
+ }
113
+ export interface FrameWorkerClient {
114
+ pluginId: string;
115
+ requestIds: string[];
116
+ }
117
+ export interface RecoveredClient {
118
+ pluginId: string;
119
+ requestIds: string[];
120
+ }
@@ -1,13 +1,8 @@
1
- import { Subscribed } from '../../utils/subscribed.js';
2
- import type { CameraController } from '../../devices/camera/controller/index.js';
3
- import type { FrameMetadata } from '../types.js';
4
- interface FrameWorkerClient {
5
- pluginId: string;
6
- requestIds: string[];
7
- }
1
+ import { Subscribed } from '../utils/subscribed.js';
2
+ import type { CameraController } from '../camera/controller.js';
8
3
  export declare class FrameWorker extends Subscribed {
9
4
  token: string;
10
- readonly clients: Map<string, FrameWorkerClient>;
5
+ private readonly clients;
11
6
  private subject;
12
7
  private ipcSubject;
13
8
  private frameWorkerId;
@@ -20,23 +15,20 @@ export declare class FrameWorker extends Subscribed {
20
15
  private initialized;
21
16
  private stopped;
22
17
  private auth;
18
+ private proxyPort;
23
19
  private ffmpegArgs;
24
20
  private py;
25
- constructor(camera: CameraController, auth: {
21
+ constructor(camera: CameraController, proxyPort: number, auth: {
26
22
  user: string;
27
23
  pass: string;
28
24
  });
29
25
  init(): Promise<void>;
30
26
  close(): Promise<void>;
31
27
  workerPID(): number;
32
- getMetadata(): Promise<FrameMetadata>;
33
- addClient(pluginId: string, requestId: string): Promise<void>;
34
- removeClient(pluginId: string, requestId: string): Promise<void>;
35
- private startVideoSession;
36
- private stopVideoSession;
37
28
  private startWorker;
29
+ private restartWorker;
30
+ private killWorker;
38
31
  private sendMessage;
39
32
  private listenToMessages;
40
33
  private getLogPrefix;
41
34
  }
42
- export {};