@camstack/types 1.2.43 → 1.2.44
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/addon.js +8 -2
- package/dist/addon.mjs +8 -2
- package/dist/capabilities/index.d.ts +5 -2
- package/dist/capabilities/osd-manager.cap.d.ts +900 -0
- package/dist/capabilities/pipeline-analytics.cap.d.ts +171 -4
- package/dist/capabilities/pipeline-orchestrator.cap.d.ts +10 -0
- package/dist/capabilities/schemas/streaming-shared.d.ts +2 -0
- package/dist/capabilities/server-management.cap.d.ts +3 -3
- package/dist/capabilities/stream-broker.cap.d.ts +32 -0
- package/dist/ffmpeg/fmp4-box-splitter.d.ts +113 -0
- package/dist/ffmpeg/fmp4-fragment-child.d.ts +85 -0
- package/dist/ffmpeg/fmp4-fragment-plane.d.ts +142 -0
- package/dist/ffmpeg/invocation.d.ts +4 -2
- package/dist/fmp4-box-splitter-B53u9-Nu.mjs +615 -0
- package/dist/fmp4-box-splitter-BkWH7O3L.js +686 -0
- package/dist/generated/addon-api.d.ts +85 -0
- package/dist/generated/cap-input-defaults.d.ts +1 -1
- package/dist/generated/capability-router-map.d.ts +5 -2
- package/dist/generated/device-proxy.d.ts +3 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/system-proxy.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +581 -404
- package/dist/index.mjs +558 -394
- package/dist/interfaces/camera-switches.d.ts +48 -0
- package/dist/interfaces/stream-broker.d.ts +18 -0
- package/dist/node.d.ts +4 -0
- package/dist/node.js +509 -3
- package/dist/node.mjs +507 -3
- package/dist/notification/schedule.d.ts +20 -0
- package/dist/{sleep-DtstvzWm.mjs → sleep-cC4Fuup8.mjs} +26 -1
- package/dist/{sleep-Bx9IIoT0.js → sleep-eiC10_cX.js} +26 -1
- package/dist/types/pipeline-step.d.ts +1 -1
- package/package.json +1 -1
- package/dist/canonical-hash-7nfBbEqR.mjs +0 -35
- package/dist/canonical-hash-BcZHRHIx.js +0 -40
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { IScopedLogger } from '../interfaces/logging.js';
|
|
2
|
+
import type { Fmp4Unit, Fmp4UnitKind } from './fmp4-box-splitter.js';
|
|
3
|
+
/** One unit as a subscriber receives it. */
|
|
4
|
+
export interface Fmp4Packet {
|
|
5
|
+
readonly kind: Fmp4UnitKind;
|
|
6
|
+
readonly data: Uint8Array;
|
|
7
|
+
/** The producer's sequence number. NOT contiguous per subscriber — a
|
|
8
|
+
* subscriber that attached late starts at the retained init's own number. */
|
|
9
|
+
readonly sequence: number;
|
|
10
|
+
/** The final packet this subscriber will receive. Exactly one, or none. */
|
|
11
|
+
readonly isLast: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Why a subscription stopped. */
|
|
14
|
+
export type Fmp4CloseReason =
|
|
15
|
+
/** The producer ended: the child exited, or the consumer released it. */
|
|
16
|
+
'ended'
|
|
17
|
+
/** The subscriber did not drain fast enough; its stream would have a hole. */
|
|
18
|
+
| 'slow-consumer'
|
|
19
|
+
/** The subscriber closed it. */
|
|
20
|
+
| 'released';
|
|
21
|
+
export interface Fmp4Subscription {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly tag: string;
|
|
24
|
+
/** Packets delivered so far — the premise the `isLast` contract rests on. */
|
|
25
|
+
readonly delivered: number;
|
|
26
|
+
/** Non-null once no further packets will arrive. */
|
|
27
|
+
readonly closedReason: Fmp4CloseReason | null;
|
|
28
|
+
/**
|
|
29
|
+
* The packet stream, with real backpressure: the generator suspends until a
|
|
30
|
+
* packet is queued, so a consumer that awaits each packet paces itself.
|
|
31
|
+
* The bounded queue only exists for the case where it does NOT.
|
|
32
|
+
*/
|
|
33
|
+
packets(): AsyncGenerator<Fmp4Packet>;
|
|
34
|
+
/** Stop receiving. Idempotent. */
|
|
35
|
+
release(): void;
|
|
36
|
+
}
|
|
37
|
+
export interface Fmp4SubscriberInfo {
|
|
38
|
+
readonly tag: string;
|
|
39
|
+
readonly subscribedAt: number;
|
|
40
|
+
readonly delivered: number;
|
|
41
|
+
readonly closedReason: Fmp4CloseReason | null;
|
|
42
|
+
}
|
|
43
|
+
export interface Fmp4SubscribeInput {
|
|
44
|
+
/** Short caller identity for diagnostics — `hksv/615`, `clips/615`. */
|
|
45
|
+
readonly tag: string;
|
|
46
|
+
/**
|
|
47
|
+
* Fragments a subscriber may fall behind by before it is closed. Four is two
|
|
48
|
+
* negotiated fragment lengths of slack on a 4 s cadence — enough to ride out
|
|
49
|
+
* a GC pause, far short of the memory a real stall would take.
|
|
50
|
+
*
|
|
51
|
+
* A prebuffer replay is added ON TOP of this, never counted against it.
|
|
52
|
+
*/
|
|
53
|
+
readonly queueCapacity?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Replay the retained prebuffer before live fragments. Off by default: a
|
|
56
|
+
* clip consumer that joins an ongoing recording wants what happens NEXT, and
|
|
57
|
+
* handing it seconds of the past would silently shift its clip's start.
|
|
58
|
+
*/
|
|
59
|
+
readonly withPrebuffer?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** How much past the plane keeps for a {@link Fmp4SubscribeInput.withPrebuffer}. */
|
|
62
|
+
export interface Fmp4PrebufferOptions {
|
|
63
|
+
/**
|
|
64
|
+
* How far back the ring reaches, by fragment ARRIVAL time. HKSV's minimum
|
|
65
|
+
* prebuffer is 4000 ms and the fragment cadence is the source GOP on a copy
|
|
66
|
+
* branch (measured: 8 s on this fleet), so a window shorter than two
|
|
67
|
+
* cadences can hold nothing at all at the moment it is asked for.
|
|
68
|
+
*/
|
|
69
|
+
readonly windowMs: number;
|
|
70
|
+
/**
|
|
71
|
+
* The hard ceiling. Non-negotiable, because the window alone does not bound
|
|
72
|
+
* RAM: same 8 s, 255 KB at 720p and 6.35 MB at 4K on the same cameras.
|
|
73
|
+
*/
|
|
74
|
+
readonly maxBytes: number;
|
|
75
|
+
}
|
|
76
|
+
/** What the ring is holding right now — diagnostics, and a delegate's gate. */
|
|
77
|
+
export interface Fmp4PrebufferStats {
|
|
78
|
+
readonly fragments: number;
|
|
79
|
+
readonly bytes: number;
|
|
80
|
+
/** Age of the OLDEST retained fragment. `0` when the ring is empty. */
|
|
81
|
+
readonly spanMs: number;
|
|
82
|
+
}
|
|
83
|
+
export declare class Fmp4FragmentPlane {
|
|
84
|
+
private readonly logger?;
|
|
85
|
+
private readonly prebuffer?;
|
|
86
|
+
/** Injectable clock — the ring's window is the one thing here that is
|
|
87
|
+
* wall-clock dependent, and a test that sleeps 8 real seconds is a test
|
|
88
|
+
* nobody runs. */
|
|
89
|
+
private readonly now;
|
|
90
|
+
private readonly subscriptions;
|
|
91
|
+
/** The last init unit seen, handed to every later subscriber. */
|
|
92
|
+
private retainedInit;
|
|
93
|
+
private ended;
|
|
94
|
+
/** Oldest first. Empty unless {@link Fmp4PrebufferOptions} was supplied. */
|
|
95
|
+
private readonly ring;
|
|
96
|
+
private ringBytes;
|
|
97
|
+
constructor(logger?: IScopedLogger | undefined, prebuffer?: Fmp4PrebufferOptions | undefined,
|
|
98
|
+
/** Injectable clock — the ring's window is the one thing here that is
|
|
99
|
+
* wall-clock dependent, and a test that sleeps 8 real seconds is a test
|
|
100
|
+
* nobody runs. */
|
|
101
|
+
now?: () => number);
|
|
102
|
+
get subscriberCount(): number;
|
|
103
|
+
/** True once {@link end} has been called — no further units are accepted. */
|
|
104
|
+
get isEnded(): boolean;
|
|
105
|
+
/** What the prebuffer ring holds right now. All zeroes when disabled. */
|
|
106
|
+
prebufferStats(): Fmp4PrebufferStats;
|
|
107
|
+
subscribe(input: Fmp4SubscribeInput): Fmp4Subscription;
|
|
108
|
+
/**
|
|
109
|
+
* Fan one splitter unit out. An `init` REPLACES the retained one — ffmpeg
|
|
110
|
+
* emits exactly one per child, and a second means the child was respawned, in
|
|
111
|
+
* which case the old one describes a stream that no longer exists.
|
|
112
|
+
*/
|
|
113
|
+
publish(unit: Fmp4Unit): void;
|
|
114
|
+
/**
|
|
115
|
+
* The producer stopped. Every subscriber drains what it holds; its final
|
|
116
|
+
* packet carries `isLast`, and its generator then completes.
|
|
117
|
+
*/
|
|
118
|
+
end(reason?: string): void;
|
|
119
|
+
listSubscribers(): readonly Fmp4SubscriberInfo[];
|
|
120
|
+
/** End and forget everything. Idempotent. */
|
|
121
|
+
dispose(): void;
|
|
122
|
+
/**
|
|
123
|
+
* Add one fragment to the ring and evict from the front until BOTH bounds
|
|
124
|
+
* hold. Eviction is oldest-first, which is the one place in this file where
|
|
125
|
+
* dropping is correct: the ring is context, not stream — nobody is mid-decode
|
|
126
|
+
* on it, and a subscriber only ever receives a contiguous tail of it.
|
|
127
|
+
*/
|
|
128
|
+
private retain;
|
|
129
|
+
/**
|
|
130
|
+
* The ring as a subscriber should receive it — window applied AT SUBSCRIBE
|
|
131
|
+
* time, not only at publish time. A camera that went quiet keeps its last
|
|
132
|
+
* fragment in the ring indefinitely (see the never-evict-the-newest rule),
|
|
133
|
+
* and replaying a 40-second-old fragment as "prebuffer" would put stale video
|
|
134
|
+
* at the head of a clip iOS presents as the moment of the event.
|
|
135
|
+
*/
|
|
136
|
+
private trimmedRing;
|
|
137
|
+
private enqueue;
|
|
138
|
+
private closeSubscription;
|
|
139
|
+
private wake;
|
|
140
|
+
private facade;
|
|
141
|
+
private iterate;
|
|
142
|
+
}
|
|
@@ -198,8 +198,10 @@ export interface FfmpegFmp4Sink {
|
|
|
198
198
|
readonly container: 'mp4';
|
|
199
199
|
/**
|
|
200
200
|
* The negotiated fragment length in milliseconds. Emitted as
|
|
201
|
-
* `-min_frag_duration` (microseconds)
|
|
202
|
-
*
|
|
201
|
+
* `-min_frag_duration` (microseconds) at {@link FMP4_MIN_FRAG_MARGIN} of this
|
|
202
|
+
* value — read that constant before changing anything here, the margin is
|
|
203
|
+
* what stops a camera whose GOP equals `fragmentMs` emitting fragments at
|
|
204
|
+
* twice the requested length.
|
|
203
205
|
*/
|
|
204
206
|
readonly fragmentMs: number;
|
|
205
207
|
}
|