@camstack/addon-provider-rtsp 0.1.13 → 0.1.14
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/assets/icon.svg +11 -5
- package/dist/addon.d.mts +15 -10
- package/dist/addon.d.ts +15 -10
- package/dist/addon.js +511 -247
- package/dist/addon.js.map +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/chunk-BXTWJIXO.mjs +560 -0
- package/dist/chunk-BXTWJIXO.mjs.map +1 -0
- package/dist/index.d.mts +79 -44
- package/dist/index.d.ts +79 -44
- package/dist/index.js +519 -253
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/package.json +13 -7
- package/dist/chunk-2B5J5HPN.mjs +0 -294
- package/dist/chunk-2B5J5HPN.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,48 +1,83 @@
|
|
|
1
1
|
export { RtspProviderAddon } from './addon.mjs';
|
|
2
|
-
import {
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { BaseDevice, ICameraDevice, DeviceType, DeviceContext, StreamSourceEntry, ConfigUISchemaWithValues } from '@camstack/types';
|
|
3
4
|
|
|
4
|
-
declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
declare const rtspCameraSchema: z.ZodObject<{
|
|
6
|
+
streams: z.ZodPreprocess<z.ZodArray<z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
url: z.ZodString;
|
|
9
|
+
profileHint: z.ZodOptional<z.ZodEnum<{
|
|
10
|
+
high: "high";
|
|
11
|
+
mid: "mid";
|
|
12
|
+
low: "low";
|
|
13
|
+
}>>;
|
|
14
|
+
resolution: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
width: z.ZodNumber;
|
|
16
|
+
height: z.ZodNumber;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
}, z.core.$strip>>>;
|
|
19
|
+
snapshotUrl: z.ZodDefault<z.ZodString>;
|
|
20
|
+
username: z.ZodDefault<z.ZodString>;
|
|
21
|
+
password: z.ZodDefault<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
declare class RtspCamera extends BaseDevice<typeof rtspCameraSchema> implements ICameraDevice {
|
|
24
|
+
readonly type: DeviceType.Camera;
|
|
25
|
+
features: readonly [];
|
|
26
|
+
constructor(ctx: DeviceContext);
|
|
27
|
+
/**
|
|
28
|
+
* Detect legacy `{label, url}` stream shapes and reshape to
|
|
29
|
+
* `{id, url, profileHint}`. Persists via `config.setAll` once, so
|
|
30
|
+
* subsequent boots find the new shape and this branch is inert.
|
|
31
|
+
*
|
|
32
|
+
* Runs fire-and-forget — the constructor can't await. The reshape is
|
|
33
|
+
* additive (ids are newly minted) so a failed persist is recoverable
|
|
34
|
+
* on next boot.
|
|
35
|
+
*/
|
|
36
|
+
private migrateLegacyStreamsIfNeeded;
|
|
37
|
+
/**
|
|
38
|
+
* Publish every configured stream to the system stream-broker as a
|
|
39
|
+
* `pull-rtsp` cam stream. Idempotent — the broker's publishCameraStream
|
|
40
|
+
* entry is keyed by `(deviceId, camStreamId)` so callers may invoke
|
|
41
|
+
* this at will (e.g. on stream-broker restart). Fire-and-forget safe.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Lifecycle hook fired by the kernel after registration. Publishes
|
|
45
|
+
* the camera's streams to the broker — the kernel doesn't know
|
|
46
|
+
* about the broker, but the camera does. Best-effort: if the
|
|
47
|
+
* broker isn't ready, the provider's `system.ready-state`
|
|
48
|
+
* subscription re-publishes on the next ready fire.
|
|
49
|
+
*/
|
|
50
|
+
onActivate(): Promise<void>;
|
|
51
|
+
publishToBroker(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Thin compat shim: reflects the stored `{id, url, profileHint?}`
|
|
54
|
+
* streams into the legacy `StreamSourceEntry` shape so
|
|
55
|
+
* `ICameraDevice`-aware consumers (device-manager legacy paths,
|
|
56
|
+
* device-cap-proxy fallback) still find data. The broker itself does
|
|
57
|
+
* NOT read this anymore — it consumes `publishCameraStream`. This
|
|
58
|
+
* shim goes away when every consumer migrates (C5/C7).
|
|
59
|
+
*/
|
|
60
|
+
getStreamSources(): Promise<readonly StreamSourceEntry[]>;
|
|
61
|
+
removeDevice(): Promise<void>;
|
|
62
|
+
getSettingsUISchema(): ConfigUISchemaWithValues;
|
|
63
|
+
/**
|
|
64
|
+
* Project stored config into the flat UI keys referenced by the schema.
|
|
65
|
+
* Form only sees URLs — the internal id/profileHint/resolution stay
|
|
66
|
+
* invisible to the operator (the broker decides profiles from probed
|
|
67
|
+
* metadata at save time).
|
|
68
|
+
*/
|
|
69
|
+
private collectFormValues;
|
|
70
|
+
applySettingsPatch(patch: Record<string, unknown>): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Probe a list of RTSP URLs through the kernel stream-probe and return
|
|
73
|
+
* the new `{id, url, profileHint?, resolution?}` entries. Ids are
|
|
74
|
+
* assigned `stream-1/2/3` in input order so the UI's slot ordering is
|
|
75
|
+
* preserved across edits. The broker is in charge of the actual
|
|
76
|
+
* (high/mid/low) profile assignment via `computeInitialAssignment`.
|
|
77
|
+
*/
|
|
78
|
+
private probeAndClassify;
|
|
79
|
+
private registerSnapshotProvider;
|
|
80
|
+
private fetchHttpSnapshot;
|
|
20
81
|
}
|
|
21
82
|
|
|
22
|
-
|
|
23
|
-
readonly id: string;
|
|
24
|
-
readonly type = "rtsp";
|
|
25
|
-
readonly name: string;
|
|
26
|
-
readonly discoveryMode: 'manual';
|
|
27
|
-
readonly ctx: CamstackContext;
|
|
28
|
-
private readonly integration;
|
|
29
|
-
private readonly registry;
|
|
30
|
-
private readonly devices;
|
|
31
|
-
constructor(integration: Integration, registry: IIntegrationRegistry, ctx: CamstackContext);
|
|
32
|
-
start(): Promise<void>;
|
|
33
|
-
stop(): Promise<void>;
|
|
34
|
-
getStatus(): ProviderStatus;
|
|
35
|
-
discoverDevices(): Promise<DiscoveredDevice[]>;
|
|
36
|
-
getDevices(): IDevice[];
|
|
37
|
-
getDeviceConfigSchema(): ConfigUISchema;
|
|
38
|
-
createDevice(config: Record<string, unknown>): Promise<IDevice>;
|
|
39
|
-
subscribeLiveEvents(_callback: (event: LiveEvent) => void): () => void;
|
|
40
|
-
private buildDevice;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface RtspProviderConfig {
|
|
44
|
-
readonly id: string;
|
|
45
|
-
readonly name: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { RtspDevice, RtspProvider, type RtspProviderConfig };
|
|
83
|
+
export { RtspCamera, rtspCameraSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,48 +1,83 @@
|
|
|
1
1
|
export { RtspProviderAddon } from './addon.js';
|
|
2
|
-
import {
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { BaseDevice, ICameraDevice, DeviceType, DeviceContext, StreamSourceEntry, ConfigUISchemaWithValues } from '@camstack/types';
|
|
3
4
|
|
|
4
|
-
declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
declare const rtspCameraSchema: z.ZodObject<{
|
|
6
|
+
streams: z.ZodPreprocess<z.ZodArray<z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
url: z.ZodString;
|
|
9
|
+
profileHint: z.ZodOptional<z.ZodEnum<{
|
|
10
|
+
high: "high";
|
|
11
|
+
mid: "mid";
|
|
12
|
+
low: "low";
|
|
13
|
+
}>>;
|
|
14
|
+
resolution: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
width: z.ZodNumber;
|
|
16
|
+
height: z.ZodNumber;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
}, z.core.$strip>>>;
|
|
19
|
+
snapshotUrl: z.ZodDefault<z.ZodString>;
|
|
20
|
+
username: z.ZodDefault<z.ZodString>;
|
|
21
|
+
password: z.ZodDefault<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
declare class RtspCamera extends BaseDevice<typeof rtspCameraSchema> implements ICameraDevice {
|
|
24
|
+
readonly type: DeviceType.Camera;
|
|
25
|
+
features: readonly [];
|
|
26
|
+
constructor(ctx: DeviceContext);
|
|
27
|
+
/**
|
|
28
|
+
* Detect legacy `{label, url}` stream shapes and reshape to
|
|
29
|
+
* `{id, url, profileHint}`. Persists via `config.setAll` once, so
|
|
30
|
+
* subsequent boots find the new shape and this branch is inert.
|
|
31
|
+
*
|
|
32
|
+
* Runs fire-and-forget — the constructor can't await. The reshape is
|
|
33
|
+
* additive (ids are newly minted) so a failed persist is recoverable
|
|
34
|
+
* on next boot.
|
|
35
|
+
*/
|
|
36
|
+
private migrateLegacyStreamsIfNeeded;
|
|
37
|
+
/**
|
|
38
|
+
* Publish every configured stream to the system stream-broker as a
|
|
39
|
+
* `pull-rtsp` cam stream. Idempotent — the broker's publishCameraStream
|
|
40
|
+
* entry is keyed by `(deviceId, camStreamId)` so callers may invoke
|
|
41
|
+
* this at will (e.g. on stream-broker restart). Fire-and-forget safe.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Lifecycle hook fired by the kernel after registration. Publishes
|
|
45
|
+
* the camera's streams to the broker — the kernel doesn't know
|
|
46
|
+
* about the broker, but the camera does. Best-effort: if the
|
|
47
|
+
* broker isn't ready, the provider's `system.ready-state`
|
|
48
|
+
* subscription re-publishes on the next ready fire.
|
|
49
|
+
*/
|
|
50
|
+
onActivate(): Promise<void>;
|
|
51
|
+
publishToBroker(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Thin compat shim: reflects the stored `{id, url, profileHint?}`
|
|
54
|
+
* streams into the legacy `StreamSourceEntry` shape so
|
|
55
|
+
* `ICameraDevice`-aware consumers (device-manager legacy paths,
|
|
56
|
+
* device-cap-proxy fallback) still find data. The broker itself does
|
|
57
|
+
* NOT read this anymore — it consumes `publishCameraStream`. This
|
|
58
|
+
* shim goes away when every consumer migrates (C5/C7).
|
|
59
|
+
*/
|
|
60
|
+
getStreamSources(): Promise<readonly StreamSourceEntry[]>;
|
|
61
|
+
removeDevice(): Promise<void>;
|
|
62
|
+
getSettingsUISchema(): ConfigUISchemaWithValues;
|
|
63
|
+
/**
|
|
64
|
+
* Project stored config into the flat UI keys referenced by the schema.
|
|
65
|
+
* Form only sees URLs — the internal id/profileHint/resolution stay
|
|
66
|
+
* invisible to the operator (the broker decides profiles from probed
|
|
67
|
+
* metadata at save time).
|
|
68
|
+
*/
|
|
69
|
+
private collectFormValues;
|
|
70
|
+
applySettingsPatch(patch: Record<string, unknown>): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Probe a list of RTSP URLs through the kernel stream-probe and return
|
|
73
|
+
* the new `{id, url, profileHint?, resolution?}` entries. Ids are
|
|
74
|
+
* assigned `stream-1/2/3` in input order so the UI's slot ordering is
|
|
75
|
+
* preserved across edits. The broker is in charge of the actual
|
|
76
|
+
* (high/mid/low) profile assignment via `computeInitialAssignment`.
|
|
77
|
+
*/
|
|
78
|
+
private probeAndClassify;
|
|
79
|
+
private registerSnapshotProvider;
|
|
80
|
+
private fetchHttpSnapshot;
|
|
20
81
|
}
|
|
21
82
|
|
|
22
|
-
|
|
23
|
-
readonly id: string;
|
|
24
|
-
readonly type = "rtsp";
|
|
25
|
-
readonly name: string;
|
|
26
|
-
readonly discoveryMode: 'manual';
|
|
27
|
-
readonly ctx: CamstackContext;
|
|
28
|
-
private readonly integration;
|
|
29
|
-
private readonly registry;
|
|
30
|
-
private readonly devices;
|
|
31
|
-
constructor(integration: Integration, registry: IIntegrationRegistry, ctx: CamstackContext);
|
|
32
|
-
start(): Promise<void>;
|
|
33
|
-
stop(): Promise<void>;
|
|
34
|
-
getStatus(): ProviderStatus;
|
|
35
|
-
discoverDevices(): Promise<DiscoveredDevice[]>;
|
|
36
|
-
getDevices(): IDevice[];
|
|
37
|
-
getDeviceConfigSchema(): ConfigUISchema;
|
|
38
|
-
createDevice(config: Record<string, unknown>): Promise<IDevice>;
|
|
39
|
-
subscribeLiveEvents(_callback: (event: LiveEvent) => void): () => void;
|
|
40
|
-
private buildDevice;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface RtspProviderConfig {
|
|
44
|
-
readonly id: string;
|
|
45
|
-
readonly name: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { RtspDevice, RtspProvider, type RtspProviderConfig };
|
|
83
|
+
export { RtspCamera, rtspCameraSchema };
|