homebridge-plugin-utils 1.35.0 → 2.1.0

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 (204) hide show
  1. package/README.md +130 -2
  2. package/build/eslint-plugin/README.md +164 -0
  3. package/build/eslint-plugin/config.mjs +308 -0
  4. package/build/eslint-plugin/index.mjs +7 -0
  5. package/build/eslint-plugin/plugin.mjs +46 -0
  6. package/build/eslint-plugin/rules/blank-line-after-open-brace.mjs +137 -0
  7. package/build/eslint-plugin/rules/blank-line-after-open-brace.test.mjs +112 -0
  8. package/build/eslint-plugin/rules/comment-style.mjs +190 -0
  9. package/build/eslint-plugin/rules/comment-style.test.mjs +190 -0
  10. package/build/eslint-plugin/rules/enforce-node-protocol.mjs +114 -0
  11. package/build/eslint-plugin/rules/enforce-node-protocol.test.mjs +116 -0
  12. package/build/eslint-plugin/rules/paren-comparisons-in-logical.mjs +94 -0
  13. package/build/eslint-plugin/rules/paren-comparisons-in-logical.test.mjs +107 -0
  14. package/build/eslint-plugin/rules/split-type-imports.mjs +354 -0
  15. package/build/eslint-plugin/rules/split-type-imports.test.mjs +268 -0
  16. package/build/eslint-plugin/test-setup.mjs +21 -0
  17. package/build/fs-ops.mjs +184 -0
  18. package/build/tsconfig.json +18 -3
  19. package/dist/backpressure.d.ts +94 -45
  20. package/dist/backpressure.js +229 -93
  21. package/dist/backpressure.js.map +1 -1
  22. package/dist/cli/index.d.ts +166 -0
  23. package/dist/cli/index.js +551 -0
  24. package/dist/cli/index.js.map +1 -0
  25. package/dist/clock-double.d.ts +93 -0
  26. package/dist/clock-double.js +141 -0
  27. package/dist/clock-double.js.map +1 -0
  28. package/dist/clock.d.ts +39 -0
  29. package/dist/clock.js +34 -0
  30. package/dist/clock.js.map +1 -0
  31. package/dist/disposable-stack.d.ts +59 -0
  32. package/dist/disposable-stack.js +155 -0
  33. package/dist/disposable-stack.js.map +1 -0
  34. package/dist/docChrome.d.ts +260 -0
  35. package/dist/docChrome.js +361 -0
  36. package/dist/docChrome.js.map +1 -0
  37. package/dist/eslint-plugin/config.d.mts +193 -0
  38. package/dist/eslint-plugin/index.d.mts +2 -0
  39. package/dist/eslint-plugin/plugin.d.mts +87 -0
  40. package/dist/eslint-plugin/rules/blank-line-after-open-brace.d.mts +19 -0
  41. package/dist/eslint-plugin/rules/comment-style.d.mts +15 -0
  42. package/dist/eslint-plugin/rules/enforce-node-protocol.d.mts +18 -0
  43. package/dist/eslint-plugin/rules/paren-comparisons-in-logical.d.mts +15 -0
  44. package/dist/eslint-plugin/rules/split-type-imports.d.mts +16 -0
  45. package/dist/featureOptions-docs.d.ts +96 -0
  46. package/dist/featureOptions-docs.js +193 -0
  47. package/dist/featureOptions-docs.js.map +1 -0
  48. package/dist/featureOptions.d.ts +674 -0
  49. package/dist/featureOptions.js +870 -0
  50. package/dist/featureOptions.js.map +1 -0
  51. package/dist/ffmpeg/codecs.d.ts +256 -72
  52. package/dist/ffmpeg/codecs.js +477 -262
  53. package/dist/ffmpeg/codecs.js.map +1 -1
  54. package/dist/ffmpeg/dgram-util.d.ts +46 -0
  55. package/dist/ffmpeg/dgram-util.js +38 -0
  56. package/dist/ffmpeg/dgram-util.js.map +1 -0
  57. package/dist/ffmpeg/exec.d.ts +83 -64
  58. package/dist/ffmpeg/exec.js +77 -86
  59. package/dist/ffmpeg/exec.js.map +1 -1
  60. package/dist/ffmpeg/fmp4.d.ts +49 -2
  61. package/dist/ffmpeg/fmp4.js +47 -11
  62. package/dist/ffmpeg/fmp4.js.map +1 -1
  63. package/dist/ffmpeg/hap-enums.d.ts +214 -0
  64. package/dist/ffmpeg/hap-enums.js +92 -0
  65. package/dist/ffmpeg/hap-enums.js.map +1 -0
  66. package/dist/ffmpeg/index.d.ts +16 -9
  67. package/dist/ffmpeg/index.js +6 -0
  68. package/dist/ffmpeg/index.js.map +1 -1
  69. package/dist/ffmpeg/mp4-assembler.d.ts +161 -0
  70. package/dist/ffmpeg/mp4-assembler.js +424 -0
  71. package/dist/ffmpeg/mp4-assembler.js.map +1 -0
  72. package/dist/ffmpeg/mp4-parser.d.ts +94 -0
  73. package/dist/ffmpeg/mp4-parser.js +130 -0
  74. package/dist/ffmpeg/mp4-parser.js.map +1 -0
  75. package/dist/ffmpeg/options.d.ts +62 -149
  76. package/dist/ffmpeg/options.js +608 -499
  77. package/dist/ffmpeg/options.js.map +1 -1
  78. package/dist/ffmpeg/process.d.ts +142 -96
  79. package/dist/ffmpeg/process.js +406 -278
  80. package/dist/ffmpeg/process.js.map +1 -1
  81. package/dist/ffmpeg/record.d.ts +325 -186
  82. package/dist/ffmpeg/record.js +418 -565
  83. package/dist/ffmpeg/record.js.map +1 -1
  84. package/dist/ffmpeg/recording-process-double.d.ts +157 -0
  85. package/dist/ffmpeg/recording-process-double.js +190 -0
  86. package/dist/ffmpeg/recording-process-double.js.map +1 -0
  87. package/dist/ffmpeg/rtp-parser.d.ts +70 -0
  88. package/dist/ffmpeg/rtp-parser.js +77 -0
  89. package/dist/ffmpeg/rtp-parser.js.map +1 -0
  90. package/dist/ffmpeg/rtp.d.ts +198 -141
  91. package/dist/ffmpeg/rtp.js +474 -251
  92. package/dist/ffmpeg/rtp.js.map +1 -1
  93. package/dist/ffmpeg/settings.d.ts +5 -2
  94. package/dist/ffmpeg/settings.js +20 -5
  95. package/dist/ffmpeg/settings.js.map +1 -1
  96. package/dist/ffmpeg/stream.d.ts +57 -107
  97. package/dist/ffmpeg/stream.js +121 -150
  98. package/dist/ffmpeg/stream.js.map +1 -1
  99. package/dist/formatters.d.ts +106 -0
  100. package/dist/formatters.js +174 -0
  101. package/dist/formatters.js.map +1 -0
  102. package/dist/homebridge-enums.d.ts +30 -0
  103. package/dist/homebridge-enums.js +17 -0
  104. package/dist/homebridge-enums.js.map +1 -0
  105. package/dist/index.d.ts +13 -6
  106. package/dist/index.js +8 -2
  107. package/dist/index.js.map +1 -1
  108. package/dist/logclient/auth.d.ts +114 -0
  109. package/dist/logclient/auth.js +199 -0
  110. package/dist/logclient/auth.js.map +1 -0
  111. package/dist/logclient/cli-run.d.ts +76 -0
  112. package/dist/logclient/cli-run.js +639 -0
  113. package/dist/logclient/cli-run.js.map +1 -0
  114. package/dist/logclient/cli.d.ts +3 -0
  115. package/dist/logclient/cli.js +97 -0
  116. package/dist/logclient/cli.js.map +1 -0
  117. package/dist/logclient/client.d.ts +145 -0
  118. package/dist/logclient/client.js +600 -0
  119. package/dist/logclient/client.js.map +1 -0
  120. package/dist/logclient/config.d.ts +173 -0
  121. package/dist/logclient/config.js +199 -0
  122. package/dist/logclient/config.js.map +1 -0
  123. package/dist/logclient/endpoints.d.ts +54 -0
  124. package/dist/logclient/endpoints.js +73 -0
  125. package/dist/logclient/endpoints.js.map +1 -0
  126. package/dist/logclient/filter.d.ts +45 -0
  127. package/dist/logclient/filter.js +51 -0
  128. package/dist/logclient/filter.js.map +1 -0
  129. package/dist/logclient/frame.d.ts +93 -0
  130. package/dist/logclient/frame.js +203 -0
  131. package/dist/logclient/frame.js.map +1 -0
  132. package/dist/logclient/index.d.ts +31 -0
  133. package/dist/logclient/index.js +12 -0
  134. package/dist/logclient/index.js.map +1 -0
  135. package/dist/logclient/parser.d.ts +211 -0
  136. package/dist/logclient/parser.js +393 -0
  137. package/dist/logclient/parser.js.map +1 -0
  138. package/dist/logclient/rest.d.ts +41 -0
  139. package/dist/logclient/rest.js +111 -0
  140. package/dist/logclient/rest.js.map +1 -0
  141. package/dist/logclient/settings.d.ts +15 -0
  142. package/dist/logclient/settings.js +64 -0
  143. package/dist/logclient/settings.js.map +1 -0
  144. package/dist/logclient/socket-double.d.ts +201 -0
  145. package/dist/logclient/socket-double.js +384 -0
  146. package/dist/logclient/socket-double.js.map +1 -0
  147. package/dist/logclient/socket.d.ts +257 -0
  148. package/dist/logclient/socket.js +620 -0
  149. package/dist/logclient/socket.js.map +1 -0
  150. package/dist/logclient/stitch.d.ts +83 -0
  151. package/dist/logclient/stitch.js +146 -0
  152. package/dist/logclient/stitch.js.map +1 -0
  153. package/dist/logclient/time-expression.d.ts +42 -0
  154. package/dist/logclient/time-expression.js +181 -0
  155. package/dist/logclient/time-expression.js.map +1 -0
  156. package/dist/logclient/time-window.d.ts +38 -0
  157. package/dist/logclient/time-window.js +53 -0
  158. package/dist/logclient/time-window.js.map +1 -0
  159. package/dist/logclient/types.d.ts +107 -0
  160. package/dist/logclient/types.js +6 -0
  161. package/dist/logclient/types.js.map +1 -0
  162. package/dist/mqttClient.d.ts +287 -0
  163. package/dist/mqttClient.js +433 -0
  164. package/dist/mqttClient.js.map +1 -0
  165. package/dist/service.d.ts +64 -15
  166. package/dist/service.js +93 -66
  167. package/dist/service.js.map +1 -1
  168. package/dist/ui/featureOptions.js +870 -0
  169. package/dist/ui/featureOptions.js.map +1 -0
  170. package/dist/ui/formatters.js +174 -0
  171. package/dist/ui/formatters.js.map +1 -0
  172. package/dist/ui/pluginConfigSession.mjs +141 -0
  173. package/dist/ui/webUi-featureOptions/categoryState.mjs +135 -0
  174. package/dist/ui/webUi-featureOptions/effects/keyboard.mjs +61 -0
  175. package/dist/ui/webUi-featureOptions/effects/persist.mjs +226 -0
  176. package/dist/ui/webUi-featureOptions/effects/theme.mjs +398 -0
  177. package/dist/ui/webUi-featureOptions/effects/tokens.mjs +152 -0
  178. package/dist/ui/webUi-featureOptions/rendering.mjs +431 -0
  179. package/dist/ui/webUi-featureOptions/selectors.mjs +360 -0
  180. package/dist/ui/webUi-featureOptions/state.mjs +319 -0
  181. package/dist/ui/webUi-featureOptions/store.mjs +181 -0
  182. package/dist/ui/webUi-featureOptions/utils.mjs +213 -0
  183. package/dist/ui/webUi-featureOptions/views/connectionError.mjs +152 -0
  184. package/dist/ui/webUi-featureOptions/views/deviceInfo.mjs +80 -0
  185. package/dist/ui/webUi-featureOptions/views/header.mjs +77 -0
  186. package/dist/ui/webUi-featureOptions/views/nav.mjs +341 -0
  187. package/dist/ui/webUi-featureOptions/views/options.mjs +521 -0
  188. package/dist/ui/webUi-featureOptions/views/search.mjs +395 -0
  189. package/dist/ui/webUi-featureOptions.mjs +702 -0
  190. package/dist/ui/webUi.mjs +225 -88
  191. package/dist/util.d.ts +679 -45
  192. package/dist/util.js +830 -77
  193. package/dist/util.js.map +1 -1
  194. package/package.json +33 -15
  195. package/build/eslint-rules.mjs +0 -511
  196. package/dist/featureoptions.d.ts +0 -264
  197. package/dist/featureoptions.js +0 -480
  198. package/dist/featureoptions.js.map +0 -1
  199. package/dist/mqttclient.d.ts +0 -178
  200. package/dist/mqttclient.js +0 -310
  201. package/dist/mqttclient.js.map +0 -1
  202. package/dist/ui/featureoptions.js +0 -480
  203. package/dist/ui/featureoptions.js.map +0 -1
  204. package/dist/ui/webUi-featureoptions.mjs +0 -3765
@@ -1 +1 @@
1
- {"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/ffmpeg/record.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAqC,cAAc,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAsGnC,oKAAoK;AACpK,uCAAuC;AACvC,MAAM,gCAAgC,GAAG;IAEvC,yCAAmC,EAAI,IAAI;IAC3C,wCAAkC,EAAK,GAAG;CACgB,CAAC;AAE7D,iKAAiK;AACjK,MAAM,wBAAwB,GAAG;IAE/B,wCAAkC,EAAK,GAAG;IAC1C,yCAAmC,EAAI,IAAI;IAC3C,yCAAmC,EAAI,IAAI;IAC3C,yCAAmC,EAAI,IAAI;IAC3C,2CAAqC,EAAE,MAAM;IAC7C,yCAAmC,EAAI,IAAI;CACgB,CAAC;AAE9D,+HAA+H;AAC/H,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,aAAa,GAAG,UA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AAyB,EAAoB,EAAE,CAAC,IAAI,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC;CAC3H,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBAAiB;IAE5D;;;;;OAKG;IACH,YAAmB,OAAsB,EAAE,IAA0B;QAEnE,KAAK,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,0BAA0B,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5F,CAAC;CACF"}
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Reusable test doubles for the recording dependency-inversion seam.
3
+ *
4
+ * The {@link RecordingProcess} / {@link RecordingProcessFactory} seam in `ffmpeg/record.ts` exists so a consuming plugin's HKSV recording path can be driven without
5
+ * spawning a real FFmpeg child. This module ships the fakes that cash that in: a configurable {@link TestRecordingProcess} that yields caller-supplied init and media
6
+ * segments deterministically, and a {@link TestRecordingProcessFactory} that records every `create` call and hands back the process. Any HKSV-capable plugin can hold
7
+ * the test factory in place of {@link ffmpeg/record!recordingProcessFactory | recordingProcessFactory} to exercise its recording delegate FFmpeg-free, in CI, with
8
+ * no binary on the path.
9
+ *
10
+ * The double needs no real fMP4: a recording consumer forwards `segments()` output opaquely to HomeKit, so the segments are opaque `Buffer`s the test chooses. The
11
+ * keyframe-bearing fMP4 concern (timeshift / prebuffer) lives entirely in a consumer's own segment double, not here.
12
+ *
13
+ * @module
14
+ */
15
+ import type { FfmpegRecordingInit, RecordingProcess, RecordingProcessFactory } from "./record.ts";
16
+ import type { FfmpegOptions } from "./options.ts";
17
+ import type { Mp4Segment } from "./mp4-assembler.ts";
18
+ import { Writable } from "node:stream";
19
+ /**
20
+ * Construction-time configuration for a {@link TestRecordingProcess}. Every field has a deterministic default so a bare `new TestRecordingProcess()` is usable; supply
21
+ * only the fields a given test steers a branch with.
22
+ *
23
+ * @property bufferedSegments - The value the `bufferedSegments` getter reports. Defaults to `0`.
24
+ * @property initSegment - The buffer `getInitSegment()` resolves with. Defaults to an empty buffer.
25
+ * @property isTimedOut - The value the `isTimedOut` getter reports. Defaults to `false`.
26
+ * @property segments - The media-segment buffers `segments()` yields, in order. Defaults to an empty array.
27
+ * @property stderrLog - The lines the `stderrLog` getter reports. Defaults to an empty array.
28
+ *
29
+ * @category Testing
30
+ */
31
+ export interface TestRecordingProcessInit {
32
+ bufferedSegments?: number;
33
+ initSegment?: Buffer;
34
+ isTimedOut?: boolean;
35
+ segments?: Buffer[];
36
+ stderrLog?: readonly string[];
37
+ }
38
+ /**
39
+ * A configurable, FFmpeg-free {@link RecordingProcess} fake. It satisfies the same interface the production
40
+ * {@link ffmpeg/record!FfmpegRecordingProcess | FfmpegRecordingProcess} does, so a recording delegate constructs and drives it exactly as it would the real class - but
41
+ * it spawns no child and yields caller-supplied bytes deterministically.
42
+ *
43
+ * Fidelity to the real contract: `abort()` aborts a genuine {@link AbortSignal} with a real {@link HbpuAbortError} reason (defaulting to `"shutdown"` exactly as
44
+ * {@link ffmpeg/process!FfmpegProcess.abort | FfmpegProcess.abort} does), so a consumer's `isHbpuAbortReason` / timeout derivations stay meaningful; `getInitSegment()`
45
+ * rejects with `signal.reason` after a pre-init abort, mirroring the real assembler's init-reject contract; and `segments()` terminates on EITHER its own signal or the
46
+ * passed per-call signal, mirroring how
47
+ * the real assembler composes the two. The `stdin` sink records every written chunk and stays writable across abort, so a consumer driving a `BackpressureWriter` over it
48
+ * can assert the segment feed regardless of abort ordering.
49
+ *
50
+ * @see RecordingProcess
51
+ * @see TestRecordingProcessFactory
52
+ *
53
+ * @category Testing
54
+ */
55
+ export declare class TestRecordingProcess implements RecordingProcess {
56
+ #private;
57
+ readonly abortCalls: unknown[];
58
+ readonly stdinWrites: Buffer[];
59
+ readonly stdin: Writable;
60
+ /**
61
+ * Construct a configurable recording-process fake.
62
+ *
63
+ * @param init - Optional configuration. See {@link TestRecordingProcessInit}. Every field defaults, so a bare `new TestRecordingProcess()` is valid.
64
+ */
65
+ constructor(init?: TestRecordingProcessInit);
66
+ /**
67
+ * Abort the recording process. Aborts the internal signal with the supplied reason, defaulting to a real `HbpuAbortError("shutdown")` exactly as the production
68
+ * `FfmpegProcess.abort` does, and records the (defaulted) reason for assertions. Safe to call more than once: the underlying signal aborts only once.
69
+ *
70
+ * @param reason - Optional abort reason. Typically an {@link HbpuAbortError}.
71
+ */
72
+ abort(reason?: unknown): void;
73
+ /**
74
+ * The configured buffered-segment depth.
75
+ */
76
+ get bufferedSegments(): number;
77
+ /**
78
+ * Resolve with the configured init segment. Rejects with `signal.reason` if `abort()` fired before init was requested, mirroring the real
79
+ * `FfmpegFMp4Process.getInitSegment` -> `Mp4SegmentAssembler.initSegment` reject-on-pre-init-abort contract.
80
+ *
81
+ * @returns A promise resolving to the configured init segment bytes.
82
+ */
83
+ getInitSegment(): Promise<Buffer>;
84
+ /**
85
+ * The configured timed-out flag.
86
+ */
87
+ get isTimedOut(): boolean;
88
+ /**
89
+ * Yield the configured media segments in order. Terminates (returns) when EITHER this process's own signal aborts OR the passed `init.signal` aborts - composing both,
90
+ * mirroring how the real `Mp4SegmentAssembler.segments` honors the process signal and the per-call signal together.
91
+ *
92
+ * This double does NOT gate media delivery on init-first the way the real assembler does. The real HKSV consumer always awaits `getInitSegment()` before iterating, so
93
+ * the simplification is invisible to it; a future `segments()`-first consumer must not assume an ordering this double does not enforce.
94
+ *
95
+ * @param init - Optional init options. `signal` composes with this process's own signal; aborting either terminates this generator call.
96
+ *
97
+ * @returns An async generator yielding the configured media segment buffers in order.
98
+ */
99
+ segments(init?: {
100
+ signal?: AbortSignal;
101
+ }): AsyncGenerator<Buffer>;
102
+ /**
103
+ * The composed abort signal representing this process's lifetime. Aborts exactly once, when `abort()` is called; `signal.reason` carries the recorded reason.
104
+ */
105
+ get signal(): AbortSignal;
106
+ /**
107
+ * The configured stderr lines.
108
+ */
109
+ get stderrLog(): readonly string[];
110
+ /**
111
+ * Yield the whole segment stream as a kind-tagged sequence: one {@link Mp4Segment} of kind `"init"` carrying the configured init segment, then one of kind `"media"`
112
+ * per configured media segment, in order. Terminates on this process's own signal or the passed `init.signal` the same way {@link TestRecordingProcess.segments} does;
113
+ * an abort before the init item is yielded ends the stream with nothing yielded, mirroring the real `Mp4SegmentAssembler.stream` return-on-pre-init-abort behavior.
114
+ *
115
+ * @param init - Optional init options. `signal` composes with this process's own signal; aborting either terminates this generator call.
116
+ *
117
+ * @returns An async generator yielding one `"init"` segment followed by the configured `"media"` segments in order.
118
+ */
119
+ stream(init?: {
120
+ signal?: AbortSignal;
121
+ }): AsyncGenerator<Mp4Segment>;
122
+ }
123
+ /**
124
+ * A {@link RecordingProcessFactory} fake that records every `create` call (the options and init it was passed, for assertions) and returns a
125
+ * {@link TestRecordingProcess}, mirroring the create-call-recording discipline a consumer's streaming-delegate factory double uses. By default it returns a fresh,
126
+ * default-configured process per call; supply a process to the constructor to return a single pre-configured instance from every `create`.
127
+ *
128
+ * @see RecordingProcessFactory
129
+ * @see TestRecordingProcess
130
+ *
131
+ * @category Testing
132
+ */
133
+ export declare class TestRecordingProcessFactory implements RecordingProcessFactory {
134
+ #private;
135
+ readonly createCalls: {
136
+ init: FfmpegRecordingInit;
137
+ options: FfmpegOptions;
138
+ process: TestRecordingProcess;
139
+ }[];
140
+ /**
141
+ * Construct a recording-process factory fake.
142
+ *
143
+ * @param process - Optional pre-configured {@link TestRecordingProcess} to return from every `create`. When omitted, each `create` returns a fresh,
144
+ * default-configured process.
145
+ */
146
+ constructor(process?: TestRecordingProcess);
147
+ /**
148
+ * Record the create call and return a {@link TestRecordingProcess} - the constructor-supplied instance when one was given, otherwise a fresh default-configured one.
149
+ *
150
+ * @param options - The {@link FfmpegOptions} the consumer passed.
151
+ * @param init - The {@link FfmpegRecordingInit} the consumer passed.
152
+ *
153
+ * @returns The recording-process double.
154
+ */
155
+ create(options: FfmpegOptions, init: FfmpegRecordingInit): RecordingProcess;
156
+ }
157
+ //# sourceMappingURL=recording-process-double.d.ts.map
@@ -0,0 +1,190 @@
1
+ /* Copyright(C) 2017-2026, HJD (https://github.com/hjdhjd). All rights reserved.
2
+ *
3
+ * ffmpeg/recording-process-double.ts: A reusable, FFmpeg-free test double for the RecordingProcess dependency-inversion seam.
4
+ */
5
+ import { HbpuAbortError, composeSignals } from "../util.js";
6
+ import { Writable } from "node:stream";
7
+ /**
8
+ * A configurable, FFmpeg-free {@link RecordingProcess} fake. It satisfies the same interface the production
9
+ * {@link ffmpeg/record!FfmpegRecordingProcess | FfmpegRecordingProcess} does, so a recording delegate constructs and drives it exactly as it would the real class - but
10
+ * it spawns no child and yields caller-supplied bytes deterministically.
11
+ *
12
+ * Fidelity to the real contract: `abort()` aborts a genuine {@link AbortSignal} with a real {@link HbpuAbortError} reason (defaulting to `"shutdown"` exactly as
13
+ * {@link ffmpeg/process!FfmpegProcess.abort | FfmpegProcess.abort} does), so a consumer's `isHbpuAbortReason` / timeout derivations stay meaningful; `getInitSegment()`
14
+ * rejects with `signal.reason` after a pre-init abort, mirroring the real assembler's init-reject contract; and `segments()` terminates on EITHER its own signal or the
15
+ * passed per-call signal, mirroring how
16
+ * the real assembler composes the two. The `stdin` sink records every written chunk and stays writable across abort, so a consumer driving a `BackpressureWriter` over it
17
+ * can assert the segment feed regardless of abort ordering.
18
+ *
19
+ * @see RecordingProcess
20
+ * @see TestRecordingProcessFactory
21
+ *
22
+ * @category Testing
23
+ */
24
+ export class TestRecordingProcess {
25
+ // The reasons every `abort(reason?)` call was invoked with, in order, for assertions. A no-argument call records the defaulted `HbpuAbortError("shutdown")` so the
26
+ // recorded reason matches `signal.reason`.
27
+ abortCalls = [];
28
+ // Every chunk written to `stdin`, in order, so a consumer feeding the recording-write path can assert exactly what it fed.
29
+ stdinWrites = [];
30
+ stdin;
31
+ // The internal controller whose signal is exposed as the process lifetime. Owned privately so the only way to abort is through `abort()`, which records the call.
32
+ #controller = new AbortController();
33
+ #bufferedSegments;
34
+ #initSegment;
35
+ #isTimedOut;
36
+ #segments;
37
+ #stderrLog;
38
+ /**
39
+ * Construct a configurable recording-process fake.
40
+ *
41
+ * @param init - Optional configuration. See {@link TestRecordingProcessInit}. Every field defaults, so a bare `new TestRecordingProcess()` is valid.
42
+ */
43
+ constructor(init = {}) {
44
+ this.#bufferedSegments = init.bufferedSegments ?? 0;
45
+ this.#initSegment = init.initSegment ?? Buffer.alloc(0);
46
+ this.#isTimedOut = init.isTimedOut ?? false;
47
+ this.#segments = init.segments ?? [];
48
+ this.#stderrLog = init.stderrLog ?? [];
49
+ // A genuine recording sink that records each chunk and immediately acknowledges the write. It is intentionally independent of the abort path: `abort()` never ends or
50
+ // destroys it, so it stays `writable` and a consumer's writes land regardless of abort ordering. This is a deliberate divergence from the real `FfmpegProcess.stdin`,
51
+ // which Node destroys as soon as the abort signal fires and the kill signal takes effect; the double stays open indefinitely so a recording consumer can flush its
52
+ // in-flight segment feed and assert on it without racing the abort-triggered teardown the real stream would otherwise undergo.
53
+ this.stdin = new Writable({
54
+ write: (chunk, _encoding, callback) => {
55
+ this.stdinWrites.push(chunk);
56
+ callback();
57
+ }
58
+ });
59
+ }
60
+ /**
61
+ * Abort the recording process. Aborts the internal signal with the supplied reason, defaulting to a real `HbpuAbortError("shutdown")` exactly as the production
62
+ * `FfmpegProcess.abort` does, and records the (defaulted) reason for assertions. Safe to call more than once: the underlying signal aborts only once.
63
+ *
64
+ * @param reason - Optional abort reason. Typically an {@link HbpuAbortError}.
65
+ */
66
+ abort(reason) {
67
+ const resolvedReason = reason ?? new HbpuAbortError("shutdown");
68
+ this.abortCalls.push(resolvedReason);
69
+ this.#controller.abort(resolvedReason);
70
+ }
71
+ /**
72
+ * The configured buffered-segment depth.
73
+ */
74
+ get bufferedSegments() {
75
+ return this.#bufferedSegments;
76
+ }
77
+ /**
78
+ * Resolve with the configured init segment. Rejects with `signal.reason` if `abort()` fired before init was requested, mirroring the real
79
+ * `FfmpegFMp4Process.getInitSegment` -> `Mp4SegmentAssembler.initSegment` reject-on-pre-init-abort contract.
80
+ *
81
+ * @returns A promise resolving to the configured init segment bytes.
82
+ */
83
+ async getInitSegment() {
84
+ if (this.#controller.signal.aborted) {
85
+ throw this.#controller.signal.reason;
86
+ }
87
+ return this.#initSegment;
88
+ }
89
+ /**
90
+ * The configured timed-out flag.
91
+ */
92
+ get isTimedOut() {
93
+ return this.#isTimedOut;
94
+ }
95
+ /**
96
+ * Yield the configured media segments in order. Terminates (returns) when EITHER this process's own signal aborts OR the passed `init.signal` aborts - composing both,
97
+ * mirroring how the real `Mp4SegmentAssembler.segments` honors the process signal and the per-call signal together.
98
+ *
99
+ * This double does NOT gate media delivery on init-first the way the real assembler does. The real HKSV consumer always awaits `getInitSegment()` before iterating, so
100
+ * the simplification is invisible to it; a future `segments()`-first consumer must not assume an ordering this double does not enforce.
101
+ *
102
+ * @param init - Optional init options. `signal` composes with this process's own signal; aborting either terminates this generator call.
103
+ *
104
+ * @returns An async generator yielding the configured media segment buffers in order.
105
+ */
106
+ async *segments(init = {}) {
107
+ // Compose the per-call signal with our own signal upfront so a single check governs both cancellation sources, mirroring the real assembler. The composed signal is
108
+ // checked before each yield so an abort that fires mid-iteration terminates the generator without yielding the remaining configured segments.
109
+ const composed = composeSignals(this.#controller.signal, init.signal);
110
+ for (const segment of this.#segments) {
111
+ if (composed.aborted) {
112
+ return;
113
+ }
114
+ yield segment;
115
+ }
116
+ }
117
+ /**
118
+ * The composed abort signal representing this process's lifetime. Aborts exactly once, when `abort()` is called; `signal.reason` carries the recorded reason.
119
+ */
120
+ get signal() {
121
+ return this.#controller.signal;
122
+ }
123
+ /**
124
+ * The configured stderr lines.
125
+ */
126
+ get stderrLog() {
127
+ return this.#stderrLog;
128
+ }
129
+ /**
130
+ * Yield the whole segment stream as a kind-tagged sequence: one {@link Mp4Segment} of kind `"init"` carrying the configured init segment, then one of kind `"media"`
131
+ * per configured media segment, in order. Terminates on this process's own signal or the passed `init.signal` the same way {@link TestRecordingProcess.segments} does;
132
+ * an abort before the init item is yielded ends the stream with nothing yielded, mirroring the real `Mp4SegmentAssembler.stream` return-on-pre-init-abort behavior.
133
+ *
134
+ * @param init - Optional init options. `signal` composes with this process's own signal; aborting either terminates this generator call.
135
+ *
136
+ * @returns An async generator yielding one `"init"` segment followed by the configured `"media"` segments in order.
137
+ */
138
+ async *stream(init = {}) {
139
+ // Compose the per-call signal with our own so one check governs both cancellation sources, mirroring the real assembler.
140
+ const composed = composeSignals(this.#controller.signal, init.signal);
141
+ // The init item leads, then each configured media segment, all tagged by kind. One abort check per item - before every yield - mirrors segments(): an abort before
142
+ // the init item ends the stream with nothing yielded, matching the real assembler's return-on-pre-init-abort behavior.
143
+ const items = [{ bytes: this.#initSegment, kind: "init" }, ...this.#segments.map((bytes) => ({ bytes, kind: "media" }))];
144
+ for (const item of items) {
145
+ if (composed.aborted) {
146
+ return;
147
+ }
148
+ yield item;
149
+ }
150
+ }
151
+ }
152
+ /**
153
+ * A {@link RecordingProcessFactory} fake that records every `create` call (the options and init it was passed, for assertions) and returns a
154
+ * {@link TestRecordingProcess}, mirroring the create-call-recording discipline a consumer's streaming-delegate factory double uses. By default it returns a fresh,
155
+ * default-configured process per call; supply a process to the constructor to return a single pre-configured instance from every `create`.
156
+ *
157
+ * @see RecordingProcessFactory
158
+ * @see TestRecordingProcess
159
+ *
160
+ * @category Testing
161
+ */
162
+ export class TestRecordingProcessFactory {
163
+ // Every create call's arguments and the process returned, in order, so a test can assert the seam was exercised exactly once with exactly the expected options/init.
164
+ createCalls = [];
165
+ // The pre-configured process to return from every create, when supplied; otherwise each create returns a fresh default-configured process.
166
+ #process;
167
+ /**
168
+ * Construct a recording-process factory fake.
169
+ *
170
+ * @param process - Optional pre-configured {@link TestRecordingProcess} to return from every `create`. When omitted, each `create` returns a fresh,
171
+ * default-configured process.
172
+ */
173
+ constructor(process) {
174
+ this.#process = process;
175
+ }
176
+ /**
177
+ * Record the create call and return a {@link TestRecordingProcess} - the constructor-supplied instance when one was given, otherwise a fresh default-configured one.
178
+ *
179
+ * @param options - The {@link FfmpegOptions} the consumer passed.
180
+ * @param init - The {@link FfmpegRecordingInit} the consumer passed.
181
+ *
182
+ * @returns The recording-process double.
183
+ */
184
+ create(options, init) {
185
+ const process = this.#process ?? new TestRecordingProcess();
186
+ this.createCalls.push({ init, options, process });
187
+ return process;
188
+ }
189
+ }
190
+ //# sourceMappingURL=recording-process-double.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recording-process-double.js","sourceRoot":"","sources":["../../src/ffmpeg/recording-process-double.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAuBvC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,oBAAoB;IAE/B,mKAAmK;IACnK,2CAA2C;IAC3B,UAAU,GAAc,EAAE,CAAC;IAE3C,2HAA2H;IAC3G,WAAW,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAW;IAEhC,kKAAkK;IACzJ,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;IAEpC,iBAAiB,CAAS;IAC1B,YAAY,CAAS;IACrB,WAAW,CAAU;IACrB,SAAS,CAAoB;IAC7B,UAAU,CAAoB;IAEvC;;;;OAIG;IACH,YAAmB,OAAiC,EAAE;QAEpD,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC;QAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,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AAQ,IAAI,IAAI,oBAAoB,EAAE,CAAC;QAE5D,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAElD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Classification of a UDP datagram emitted by {@link RtpPacketParser}. `"rtp"` denotes a media packet; `"rtcp"` denotes a control packet. Consumers typically
3
+ * branch on this union to route to the correct downstream FFmpeg port.
4
+ *
5
+ * @category FFmpeg
6
+ */
7
+ export type RtpPacketKind = "rtcp" | "rtp";
8
+ /**
9
+ * A single classified RTP or RTCP packet.
10
+ *
11
+ * @property bytes - The complete UDP datagram bytes. Emitted as-is from the parser; consumers that need to hold it past the iteration loop should copy with
12
+ * `Buffer.from()` if the upstream datagram lifetime is suspect.
13
+ * @property kind - `"rtp"` or `"rtcp"`, derived from the header's payload type field.
14
+ * @property payloadType - The 7-bit payload type value from the second byte of the header, masked against `0x7F`. Provided raw so consumers can match specific RTP
15
+ * payload types (e.g., opus, g711) without re-parsing the header.
16
+ *
17
+ * @category FFmpeg
18
+ */
19
+ export interface RtpPacket {
20
+ bytes: Buffer;
21
+ kind: RtpPacketKind;
22
+ payloadType: number;
23
+ }
24
+ /**
25
+ * Pure stateful parser that classifies UDP datagrams as RTP or RTCP and surfaces them as {@link RtpPacket} records.
26
+ *
27
+ * Unlike {@link ffmpeg/mp4-parser!Mp4BoxParser | Mp4BoxParser}, the RTP wire format is already datagram-framed - each UDP message is a complete packet - so there is no
28
+ * cross-call state to carry. The class shape mirrors the MP4 parser for consistency: composing resource classes (demuxers, assemblers) drive any parser of this shape
29
+ * without having to know whether the wire format was stream-oriented or datagram-oriented.
30
+ *
31
+ * The class is intentionally signal-free and event-free. Resource lifecycle, liveness monitoring, and async consumption are the composing caller's concern - see
32
+ * {@link ffmpeg/rtp!RtpDemuxer | RtpDemuxer}.
33
+ *
34
+ * @example
35
+ *
36
+ * ```ts
37
+ * import { RtpPacketParser } from "homebridge-plugin-utils";
38
+ *
39
+ * const parser = new RtpPacketParser();
40
+ *
41
+ * socket.on("message", (datagram) => {
42
+ *
43
+ * for(const packet of parser.consume(datagram)) {
44
+ *
45
+ * if(packet.kind === "rtp") {
46
+ *
47
+ * socket.send(packet.bytes, rtpPort);
48
+ * }
49
+ * }
50
+ * });
51
+ * ```
52
+ *
53
+ * @see RtpDemuxer
54
+ *
55
+ * @category FFmpeg
56
+ */
57
+ export declare class RtpPacketParser {
58
+ /**
59
+ * Feed the parser a UDP datagram and yield the single classified packet it contains.
60
+ *
61
+ * Datagrams shorter than the two-byte minimum required to read the payload type field are silently dropped. Callers that need to observe malformed input should do so
62
+ * at the socket layer; the parser's contract is "classify well-formed headers," not "diagnose corruption."
63
+ *
64
+ * @param datagram - A complete UDP datagram received from the RTP/RTCP socket.
65
+ *
66
+ * @returns An iterable yielding zero packets (empty datagram) or exactly one packet (well-formed datagram).
67
+ */
68
+ consume(datagram: Buffer): Iterable<RtpPacket>;
69
+ }
70
+ //# sourceMappingURL=rtp-parser.d.ts.map
@@ -0,0 +1,77 @@
1
+ /* Copyright(C) 2017-2026, HJD (https://github.com/hjdhjd). All rights reserved.
2
+ *
3
+ * ffmpeg/rtp-parser.ts: Pure byte-to-record parser for RTP/RTCP datagrams.
4
+ */
5
+ /**
6
+ * Pure stateful byte-to-record parser for RTP and RTCP datagrams multiplexed on a single UDP port per RFC 5761.
7
+ *
8
+ * Each RTP or RTCP packet arrives as a self-contained UDP datagram, so the parser does not have to reassemble anything across chunks. Its job is classification: given
9
+ * the raw datagram bytes, decide whether the packet is RTP or RTCP and surface the payload type for callers that distinguish further. This mirrors the shape of
10
+ * {@link ffmpeg/mp4-parser!Mp4BoxParser | Mp4BoxParser} (pure, stateful class, `consume(chunk)` returning an iterable) so the composing caller - typically
11
+ * {@link ffmpeg/rtp!RtpDemuxer | RtpDemuxer} - can drive either parser through the same wiring.
12
+ *
13
+ * @module
14
+ */
15
+ // RTP/RTCP demultiplexing threshold per RFC 5761. The second byte of every RTP/RTCP header carries the payload type in its low seven bits. RFC 5761 documents that
16
+ // values above 90 (and the distinguished value 0) are never used by standard RTCP packet types, so they are safe to treat as RTP; everything else is routed to RTCP.
17
+ const RTP_PAYLOAD_TYPE_THRESHOLD = 90;
18
+ /**
19
+ * Pure stateful parser that classifies UDP datagrams as RTP or RTCP and surfaces them as {@link RtpPacket} records.
20
+ *
21
+ * Unlike {@link ffmpeg/mp4-parser!Mp4BoxParser | Mp4BoxParser}, the RTP wire format is already datagram-framed - each UDP message is a complete packet - so there is no
22
+ * cross-call state to carry. The class shape mirrors the MP4 parser for consistency: composing resource classes (demuxers, assemblers) drive any parser of this shape
23
+ * without having to know whether the wire format was stream-oriented or datagram-oriented.
24
+ *
25
+ * The class is intentionally signal-free and event-free. Resource lifecycle, liveness monitoring, and async consumption are the composing caller's concern - see
26
+ * {@link ffmpeg/rtp!RtpDemuxer | RtpDemuxer}.
27
+ *
28
+ * @example
29
+ *
30
+ * ```ts
31
+ * import { RtpPacketParser } from "homebridge-plugin-utils";
32
+ *
33
+ * const parser = new RtpPacketParser();
34
+ *
35
+ * socket.on("message", (datagram) => {
36
+ *
37
+ * for(const packet of parser.consume(datagram)) {
38
+ *
39
+ * if(packet.kind === "rtp") {
40
+ *
41
+ * socket.send(packet.bytes, rtpPort);
42
+ * }
43
+ * }
44
+ * });
45
+ * ```
46
+ *
47
+ * @see RtpDemuxer
48
+ *
49
+ * @category FFmpeg
50
+ */
51
+ export class RtpPacketParser {
52
+ /**
53
+ * Feed the parser a UDP datagram and yield the single classified packet it contains.
54
+ *
55
+ * Datagrams shorter than the two-byte minimum required to read the payload type field are silently dropped. Callers that need to observe malformed input should do so
56
+ * at the socket layer; the parser's contract is "classify well-formed headers," not "diagnose corruption."
57
+ *
58
+ * @param datagram - A complete UDP datagram received from the RTP/RTCP socket.
59
+ *
60
+ * @returns An iterable yielding zero packets (empty datagram) or exactly one packet (well-formed datagram).
61
+ */
62
+ *consume(datagram) {
63
+ // Two bytes is the minimum needed to read the payload type. Anything shorter is silently dropped - the RTP/RTCP fixed headers are at least 12 and 8 bytes
64
+ // respectively, so a datagram this short cannot be a legitimate packet.
65
+ if (datagram.length < 2) {
66
+ return;
67
+ }
68
+ // Payload type lives in the low seven bits of the second header byte (the top bit is the marker bit in RTP and the padding bit in RTCP; we only care about the
69
+ // low seven here).
70
+ const payloadType = datagram.readUInt8(1) & 0x7F;
71
+ // Classification follows the RFC 5761 demux rule: values above 90 and the distinguished value 0 are RTP; everything else is RTCP. The split is intentionally
72
+ // expressed as a single boolean so the path stays branch-predictable in the hot loop.
73
+ const kind = ((payloadType > RTP_PAYLOAD_TYPE_THRESHOLD) || (payloadType === 0)) ? "rtp" : "rtcp";
74
+ yield { bytes: datagram, kind, payloadType };
75
+ }
76
+ }
77
+ //# sourceMappingURL=rtp-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rtp-parser.js","sourceRoot":"","sources":["../../src/ffmpeg/rtp-parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,mKAAmK;AACnK,qKAAqK;AACrK,MAAM,0BAA0B,GAAG,EAAE,CAAC;AA4BtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAO,eAAe;IAE1B;;;;;;;;;OASG;IACI,CAAC,OAAO,CAAC,QAAgB;QAE9B,0JAA0J;QAC1J,wEAAwE;QACxE,IAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAEvB,OAAO;QACT,CAAC;QAED,+JAA+J;QAC/J,mBAAmB;QACnB,MAAM,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QAEjD,6JAA6J;QAC7J,sFAAsF;QACtF,MAAM,IAAI,GAAkB,CAAC,CAAC,WAAW,GAAG,0BAA0B,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QAEjH,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC/C,CAAC;CACF"}