homebridge-plugin-utils 1.34.0 → 2.0.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 (198) 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 +128 -0
  20. package/dist/backpressure.js +273 -0
  21. package/dist/backpressure.js.map +1 -0
  22. package/dist/cli/index.d.ts +95 -0
  23. package/dist/cli/index.js +355 -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/eslint-plugin/config.d.mts +193 -0
  32. package/dist/eslint-plugin/index.d.mts +2 -0
  33. package/dist/eslint-plugin/plugin.d.mts +87 -0
  34. package/dist/eslint-plugin/rules/blank-line-after-open-brace.d.mts +19 -0
  35. package/dist/eslint-plugin/rules/comment-style.d.mts +15 -0
  36. package/dist/eslint-plugin/rules/enforce-node-protocol.d.mts +18 -0
  37. package/dist/eslint-plugin/rules/paren-comparisons-in-logical.d.mts +15 -0
  38. package/dist/eslint-plugin/rules/split-type-imports.d.mts +16 -0
  39. package/dist/featureOptions-docs.d.ts +96 -0
  40. package/dist/featureOptions-docs.js +193 -0
  41. package/dist/featureOptions-docs.js.map +1 -0
  42. package/dist/featureOptions.d.ts +674 -0
  43. package/dist/featureOptions.js +870 -0
  44. package/dist/featureOptions.js.map +1 -0
  45. package/dist/ffmpeg/codecs.d.ts +256 -72
  46. package/dist/ffmpeg/codecs.js +477 -257
  47. package/dist/ffmpeg/codecs.js.map +1 -1
  48. package/dist/ffmpeg/dgram-util.d.ts +46 -0
  49. package/dist/ffmpeg/dgram-util.js +38 -0
  50. package/dist/ffmpeg/dgram-util.js.map +1 -0
  51. package/dist/ffmpeg/exec.d.ts +83 -64
  52. package/dist/ffmpeg/exec.js +77 -86
  53. package/dist/ffmpeg/exec.js.map +1 -1
  54. package/dist/ffmpeg/fmp4.d.ts +70 -4
  55. package/dist/ffmpeg/fmp4.js +100 -11
  56. package/dist/ffmpeg/fmp4.js.map +1 -1
  57. package/dist/ffmpeg/hap-enums.d.ts +214 -0
  58. package/dist/ffmpeg/hap-enums.js +92 -0
  59. package/dist/ffmpeg/hap-enums.js.map +1 -0
  60. package/dist/ffmpeg/index.d.ts +16 -9
  61. package/dist/ffmpeg/index.js +6 -0
  62. package/dist/ffmpeg/index.js.map +1 -1
  63. package/dist/ffmpeg/mp4-assembler.d.ts +120 -0
  64. package/dist/ffmpeg/mp4-assembler.js +387 -0
  65. package/dist/ffmpeg/mp4-assembler.js.map +1 -0
  66. package/dist/ffmpeg/mp4-parser.d.ts +94 -0
  67. package/dist/ffmpeg/mp4-parser.js +130 -0
  68. package/dist/ffmpeg/mp4-parser.js.map +1 -0
  69. package/dist/ffmpeg/options.d.ts +62 -149
  70. package/dist/ffmpeg/options.js +608 -499
  71. package/dist/ffmpeg/options.js.map +1 -1
  72. package/dist/ffmpeg/process.d.ts +143 -91
  73. package/dist/ffmpeg/process.js +406 -265
  74. package/dist/ffmpeg/process.js.map +1 -1
  75. package/dist/ffmpeg/record.d.ts +302 -188
  76. package/dist/ffmpeg/record.js +408 -560
  77. package/dist/ffmpeg/record.js.map +1 -1
  78. package/dist/ffmpeg/recording-process-double.d.ts +144 -0
  79. package/dist/ffmpeg/recording-process-double.js +168 -0
  80. package/dist/ffmpeg/recording-process-double.js.map +1 -0
  81. package/dist/ffmpeg/rtp-parser.d.ts +70 -0
  82. package/dist/ffmpeg/rtp-parser.js +77 -0
  83. package/dist/ffmpeg/rtp-parser.js.map +1 -0
  84. package/dist/ffmpeg/rtp.d.ts +198 -141
  85. package/dist/ffmpeg/rtp.js +473 -244
  86. package/dist/ffmpeg/rtp.js.map +1 -1
  87. package/dist/ffmpeg/settings.d.ts +5 -1
  88. package/dist/ffmpeg/settings.js +20 -2
  89. package/dist/ffmpeg/settings.js.map +1 -1
  90. package/dist/ffmpeg/stream.d.ts +57 -107
  91. package/dist/ffmpeg/stream.js +121 -148
  92. package/dist/ffmpeg/stream.js.map +1 -1
  93. package/dist/formatters.d.ts +106 -0
  94. package/dist/formatters.js +174 -0
  95. package/dist/formatters.js.map +1 -0
  96. package/dist/homebridge-enums.d.ts +30 -0
  97. package/dist/homebridge-enums.js +17 -0
  98. package/dist/homebridge-enums.js.map +1 -0
  99. package/dist/index.d.ts +12 -5
  100. package/dist/index.js +8 -2
  101. package/dist/index.js.map +1 -1
  102. package/dist/logclient/auth.d.ts +114 -0
  103. package/dist/logclient/auth.js +199 -0
  104. package/dist/logclient/auth.js.map +1 -0
  105. package/dist/logclient/cli-run.d.ts +76 -0
  106. package/dist/logclient/cli-run.js +639 -0
  107. package/dist/logclient/cli-run.js.map +1 -0
  108. package/dist/logclient/cli.d.ts +3 -0
  109. package/dist/logclient/cli.js +97 -0
  110. package/dist/logclient/cli.js.map +1 -0
  111. package/dist/logclient/client.d.ts +145 -0
  112. package/dist/logclient/client.js +600 -0
  113. package/dist/logclient/client.js.map +1 -0
  114. package/dist/logclient/config.d.ts +173 -0
  115. package/dist/logclient/config.js +199 -0
  116. package/dist/logclient/config.js.map +1 -0
  117. package/dist/logclient/endpoints.d.ts +54 -0
  118. package/dist/logclient/endpoints.js +73 -0
  119. package/dist/logclient/endpoints.js.map +1 -0
  120. package/dist/logclient/filter.d.ts +45 -0
  121. package/dist/logclient/filter.js +51 -0
  122. package/dist/logclient/filter.js.map +1 -0
  123. package/dist/logclient/frame.d.ts +93 -0
  124. package/dist/logclient/frame.js +203 -0
  125. package/dist/logclient/frame.js.map +1 -0
  126. package/dist/logclient/index.d.ts +31 -0
  127. package/dist/logclient/index.js +12 -0
  128. package/dist/logclient/index.js.map +1 -0
  129. package/dist/logclient/parser.d.ts +211 -0
  130. package/dist/logclient/parser.js +393 -0
  131. package/dist/logclient/parser.js.map +1 -0
  132. package/dist/logclient/rest.d.ts +41 -0
  133. package/dist/logclient/rest.js +111 -0
  134. package/dist/logclient/rest.js.map +1 -0
  135. package/dist/logclient/settings.d.ts +15 -0
  136. package/dist/logclient/settings.js +64 -0
  137. package/dist/logclient/settings.js.map +1 -0
  138. package/dist/logclient/socket-double.d.ts +201 -0
  139. package/dist/logclient/socket-double.js +384 -0
  140. package/dist/logclient/socket-double.js.map +1 -0
  141. package/dist/logclient/socket.d.ts +257 -0
  142. package/dist/logclient/socket.js +620 -0
  143. package/dist/logclient/socket.js.map +1 -0
  144. package/dist/logclient/stitch.d.ts +83 -0
  145. package/dist/logclient/stitch.js +146 -0
  146. package/dist/logclient/stitch.js.map +1 -0
  147. package/dist/logclient/time-expression.d.ts +42 -0
  148. package/dist/logclient/time-expression.js +181 -0
  149. package/dist/logclient/time-expression.js.map +1 -0
  150. package/dist/logclient/time-window.d.ts +38 -0
  151. package/dist/logclient/time-window.js +53 -0
  152. package/dist/logclient/time-window.js.map +1 -0
  153. package/dist/logclient/types.d.ts +107 -0
  154. package/dist/logclient/types.js +6 -0
  155. package/dist/logclient/types.js.map +1 -0
  156. package/dist/mqttClient.d.ts +287 -0
  157. package/dist/mqttClient.js +433 -0
  158. package/dist/mqttClient.js.map +1 -0
  159. package/dist/service.d.ts +64 -15
  160. package/dist/service.js +93 -66
  161. package/dist/service.js.map +1 -1
  162. package/dist/ui/featureOptions.js +870 -0
  163. package/dist/ui/featureOptions.js.map +1 -0
  164. package/dist/ui/formatters.js +174 -0
  165. package/dist/ui/formatters.js.map +1 -0
  166. package/dist/ui/pluginConfigSession.mjs +141 -0
  167. package/dist/ui/webUi-featureOptions/categoryState.mjs +135 -0
  168. package/dist/ui/webUi-featureOptions/effects/keyboard.mjs +61 -0
  169. package/dist/ui/webUi-featureOptions/effects/persist.mjs +226 -0
  170. package/dist/ui/webUi-featureOptions/effects/theme.mjs +398 -0
  171. package/dist/ui/webUi-featureOptions/effects/tokens.mjs +152 -0
  172. package/dist/ui/webUi-featureOptions/rendering.mjs +431 -0
  173. package/dist/ui/webUi-featureOptions/selectors.mjs +360 -0
  174. package/dist/ui/webUi-featureOptions/state.mjs +319 -0
  175. package/dist/ui/webUi-featureOptions/store.mjs +181 -0
  176. package/dist/ui/webUi-featureOptions/utils.mjs +200 -0
  177. package/dist/ui/webUi-featureOptions/views/connectionError.mjs +152 -0
  178. package/dist/ui/webUi-featureOptions/views/deviceInfo.mjs +80 -0
  179. package/dist/ui/webUi-featureOptions/views/header.mjs +77 -0
  180. package/dist/ui/webUi-featureOptions/views/nav.mjs +327 -0
  181. package/dist/ui/webUi-featureOptions/views/options.mjs +521 -0
  182. package/dist/ui/webUi-featureOptions/views/search.mjs +395 -0
  183. package/dist/ui/webUi-featureOptions.mjs +677 -0
  184. package/dist/ui/webUi.mjs +192 -87
  185. package/dist/util.d.ts +597 -45
  186. package/dist/util.js +787 -68
  187. package/dist/util.js.map +1 -1
  188. package/package.json +33 -15
  189. package/build/eslint-rules.mjs +0 -511
  190. package/dist/featureoptions.d.ts +0 -264
  191. package/dist/featureoptions.js +0 -480
  192. package/dist/featureoptions.js.map +0 -1
  193. package/dist/mqttclient.d.ts +0 -178
  194. package/dist/mqttclient.js +0 -310
  195. package/dist/mqttclient.js.map +0 -1
  196. package/dist/ui/featureoptions.js +0 -480
  197. package/dist/ui/featureoptions.js.map +0 -1
  198. package/dist/ui/webUi-featureoptions.mjs +0 -3765
@@ -2,14 +2,64 @@
2
2
  * ISO BMFF (fMP4) box parsing utilities for working with fragmented MP4 data.
3
3
  *
4
4
  * This module provides lightweight, Buffer-based utilities for inspecting ISO Base Media File Format (ISO BMFF) structures commonly found in fragmented MP4 (fMP4)
5
- * streams. It enables locating specific box types, splitting fragments into their moof/mdat components, and detecting keyframe (sync sample) segments by parsing the
6
- * TRUN sample flags.
5
+ * streams. It enables locating specific box types, splitting fragments into their moof/mdat components, detecting keyframe (sync sample) segments by parsing the TRUN
6
+ * sample flags, and identifying audio track presence in initialization segments.
7
7
  *
8
8
  * These utilities operate on complete Buffers and are independent of FFmpeg processes or streaming pipelines.
9
9
  *
10
10
  * @module
11
11
  */
12
- import type { Nullable } from "../util.js";
12
+ import type { Nullable } from "../util.ts";
13
+ /**
14
+ * ISO BMFF box header size in bytes: 4 bytes big-endian size + 4 bytes ASCII type.
15
+ *
16
+ * @category FFmpeg
17
+ */
18
+ export declare const BOX_HEADER_SIZE = 8;
19
+ /**
20
+ * TRUN fullbox flags bit indicating that a `data_offset` field follows the sample_count in the box header.
21
+ *
22
+ * @category FFmpeg
23
+ */
24
+ export declare const TRUN_FLAG_DATA_OFFSET = 1;
25
+ /**
26
+ * TRUN fullbox flags bit indicating that a `first_sample_flags` field follows (after `data_offset` if present). When this flag is set, the first sample's flags are
27
+ * stored in a dedicated header field rather than in the per-sample entries - the common arrangement for fragments emitted with FFmpeg's `frag_keyframe` movflag.
28
+ *
29
+ * @category FFmpeg
30
+ */
31
+ export declare const TRUN_FLAG_FIRST_SAMPLE_FLAGS = 4;
32
+ /**
33
+ * TRUN fullbox flags bit indicating that each sample entry carries a 4-byte duration field.
34
+ *
35
+ * @category FFmpeg
36
+ */
37
+ export declare const TRUN_FLAG_SAMPLE_DURATION = 256;
38
+ /**
39
+ * TRUN fullbox flags bit indicating that each sample entry carries a 4-byte size field.
40
+ *
41
+ * @category FFmpeg
42
+ */
43
+ export declare const TRUN_FLAG_SAMPLE_SIZE = 512;
44
+ /**
45
+ * TRUN fullbox flags bit indicating that each sample entry carries a 4-byte sample_flags field.
46
+ *
47
+ * @category FFmpeg
48
+ */
49
+ export declare const TRUN_FLAG_SAMPLE_FLAGS = 1024;
50
+ /**
51
+ * Sample-flags bit indicating a non-sync (non-keyframe) sample. When this bit is clear (0), the sample is a sync sample / IDR frame / keyframe.
52
+ *
53
+ * @category FFmpeg
54
+ */
55
+ export declare const SAMPLE_FLAG_NON_SYNC = 65536;
56
+ /**
57
+ * Handler-type code for audio tracks in ISO BMFF `hdlr` boxes: ASCII `"soun"` encoded as a 32-bit big-endian integer. Compared against the `handler_type` field of
58
+ * each track's `hdlr` fullbox to identify the audio track during init-segment inspection.
59
+ *
60
+ * @category FFmpeg
61
+ */
62
+ export declare const HDLR_TYPE_SOUN = 1936684398;
13
63
  /**
14
64
  * Describes the location of an ISO BMFF box within a buffer.
15
65
  *
@@ -26,7 +76,9 @@ export interface FMp4Box {
26
76
  * Locates the first ISO BMFF box of a given type within a byte range.
27
77
  *
28
78
  * Walks the standard box headers (4-byte big-endian size + 4-byte ASCII type) starting at `start` and ending at `end`. Returns the offset and size of the first
29
- * matching box, or `null` if no match is found. Does not handle extended-size boxes (64-bit size field) as these are uncommon in fMP4 livestream contexts.
79
+ * matching box. Returns `null` when no box of the requested type is found in range, and also when the walk encounters a box whose declared size is invalid - below
80
+ * the header size, extending past the search range, or an extended/open-ended size (64-bit size field, uncommon in fMP4 livestream contexts and unsupported here) -
81
+ * since a malformed size makes it unsafe to keep walking; the two cases are indistinguishable from the return value alone.
30
82
  *
31
83
  * @param buffer - The buffer containing ISO BMFF box data.
32
84
  * @param type - The 4-character ASCII box type to search for (e.g. "moof", "traf", "trun"). Must be exactly 4 characters.
@@ -52,6 +104,19 @@ export declare function findBox(buffer: Buffer, type: string, start?: number, en
52
104
  * @category FFmpeg
53
105
  */
54
106
  export declare function isKeyframe(segment: Buffer): boolean;
107
+ /**
108
+ * Determines whether an fMP4 initialization segment contains an audio track by inspecting the handler type in each track's media handler box.
109
+ *
110
+ * Traverses the box hierarchy `moov -> trak -> mdia -> hdlr` for every track in the init segment and checks the handler_type field for "soun" (0x736F756E). This is the
111
+ * standard ISO BMFF mechanism for identifying track media types - "soun" for audio, "vide" for video, "subt" for subtitles, etc.
112
+ *
113
+ * @param initSegment - A buffer containing a complete fMP4 initialization segment (typically ftyp + moov).
114
+ *
115
+ * @returns `true` if the init segment contains at least one audio track, `false` otherwise.
116
+ *
117
+ * @category FFmpeg
118
+ */
119
+ export declare function hasAudioTrack(initSegment: Buffer): boolean;
55
120
  /**
56
121
  * Splits an fMP4 fragment into its moof and mdat components.
57
122
  *
@@ -69,3 +134,4 @@ export declare function splitMoofMdat(fragment: Buffer): Nullable<{
69
134
  mdat: Buffer;
70
135
  moof: Buffer;
71
136
  }>;
137
+ //# sourceMappingURL=fmp4.d.ts.map
@@ -2,23 +2,67 @@
2
2
  *
3
3
  * ffmpeg/fmp4.ts: ISO BMFF (fMP4) box parsing utilities.
4
4
  */
5
- // ISO BMFF box header size: 4 bytes big-endian size + 4 bytes ASCII type.
6
- const BOX_HEADER_SIZE = 8;
5
+ /**
6
+ * ISO BMFF box header size in bytes: 4 bytes big-endian size + 4 bytes ASCII type.
7
+ *
8
+ * @category FFmpeg
9
+ */
10
+ export const BOX_HEADER_SIZE = 8;
7
11
  // TRUN fullbox header size: standard box header + 4 bytes version/flags + 4 bytes sample_count.
8
12
  const TRUN_HEADER_SIZE = BOX_HEADER_SIZE + 8;
9
- // TRUN box flags indicating the presence of optional fields.
10
- const TRUN_FLAG_DATA_OFFSET = 0x000001;
11
- const TRUN_FLAG_FIRST_SAMPLE_FLAGS = 0x000004;
12
- const TRUN_FLAG_SAMPLE_DURATION = 0x000100;
13
- const TRUN_FLAG_SAMPLE_SIZE = 0x000200;
14
- const TRUN_FLAG_SAMPLE_FLAGS = 0x000400;
15
- // Sample flags bit indicating a non-sync sample. When this bit is clear (0), the sample is a sync sample (keyframe/IDR).
16
- const SAMPLE_FLAG_NON_SYNC = 0x00010000;
13
+ /**
14
+ * TRUN fullbox flags bit indicating that a `data_offset` field follows the sample_count in the box header.
15
+ *
16
+ * @category FFmpeg
17
+ */
18
+ export const TRUN_FLAG_DATA_OFFSET = 0x000001;
19
+ /**
20
+ * TRUN fullbox flags bit indicating that a `first_sample_flags` field follows (after `data_offset` if present). When this flag is set, the first sample's flags are
21
+ * stored in a dedicated header field rather than in the per-sample entries - the common arrangement for fragments emitted with FFmpeg's `frag_keyframe` movflag.
22
+ *
23
+ * @category FFmpeg
24
+ */
25
+ export const TRUN_FLAG_FIRST_SAMPLE_FLAGS = 0x000004;
26
+ /**
27
+ * TRUN fullbox flags bit indicating that each sample entry carries a 4-byte duration field.
28
+ *
29
+ * @category FFmpeg
30
+ */
31
+ export const TRUN_FLAG_SAMPLE_DURATION = 0x000100;
32
+ /**
33
+ * TRUN fullbox flags bit indicating that each sample entry carries a 4-byte size field.
34
+ *
35
+ * @category FFmpeg
36
+ */
37
+ export const TRUN_FLAG_SAMPLE_SIZE = 0x000200;
38
+ /**
39
+ * TRUN fullbox flags bit indicating that each sample entry carries a 4-byte sample_flags field.
40
+ *
41
+ * @category FFmpeg
42
+ */
43
+ export const TRUN_FLAG_SAMPLE_FLAGS = 0x000400;
44
+ /**
45
+ * Sample-flags bit indicating a non-sync (non-keyframe) sample. When this bit is clear (0), the sample is a sync sample / IDR frame / keyframe.
46
+ *
47
+ * @category FFmpeg
48
+ */
49
+ export const SAMPLE_FLAG_NON_SYNC = 0x00010000;
50
+ /**
51
+ * Handler-type code for audio tracks in ISO BMFF `hdlr` boxes: ASCII `"soun"` encoded as a 32-bit big-endian integer. Compared against the `handler_type` field of
52
+ * each track's `hdlr` fullbox to identify the audio track during init-segment inspection.
53
+ *
54
+ * @category FFmpeg
55
+ */
56
+ export const HDLR_TYPE_SOUN = 0x736F756E;
57
+ // Offset from the start of an hdlr fullbox to the handler_type field: standard box header (8 bytes) + version/flags (4 bytes) + pre_defined (4 bytes).
58
+ const HDLR_TYPE_OFFSET = BOX_HEADER_SIZE + 8;
17
59
  /**
18
60
  * Locates the first ISO BMFF box of a given type within a byte range.
19
61
  *
20
62
  * Walks the standard box headers (4-byte big-endian size + 4-byte ASCII type) starting at `start` and ending at `end`. Returns the offset and size of the first
21
- * matching box, or `null` if no match is found. Does not handle extended-size boxes (64-bit size field) as these are uncommon in fMP4 livestream contexts.
63
+ * matching box. Returns `null` when no box of the requested type is found in range, and also when the walk encounters a box whose declared size is invalid - below
64
+ * the header size, extending past the search range, or an extended/open-ended size (64-bit size field, uncommon in fMP4 livestream contexts and unsupported here) -
65
+ * since a malformed size makes it unsafe to keep walking; the two cases are indistinguishable from the return value alone.
22
66
  *
23
67
  * @param buffer - The buffer containing ISO BMFF box data.
24
68
  * @param type - The 4-character ASCII box type to search for (e.g. "moof", "traf", "trun"). Must be exactly 4 characters.
@@ -121,6 +165,51 @@ export function isKeyframe(segment) {
121
165
  // No sample flags information available in the trun...we can't determine keyframe status.
122
166
  return false;
123
167
  }
168
+ /**
169
+ * Determines whether an fMP4 initialization segment contains an audio track by inspecting the handler type in each track's media handler box.
170
+ *
171
+ * Traverses the box hierarchy `moov -> trak -> mdia -> hdlr` for every track in the init segment and checks the handler_type field for "soun" (0x736F756E). This is the
172
+ * standard ISO BMFF mechanism for identifying track media types - "soun" for audio, "vide" for video, "subt" for subtitles, etc.
173
+ *
174
+ * @param initSegment - A buffer containing a complete fMP4 initialization segment (typically ftyp + moov).
175
+ *
176
+ * @returns `true` if the init segment contains at least one audio track, `false` otherwise.
177
+ *
178
+ * @category FFmpeg
179
+ */
180
+ export function hasAudioTrack(initSegment) {
181
+ // Locate the moov box at the top level.
182
+ const moov = findBox(initSegment, "moov");
183
+ if (!moov) {
184
+ return false;
185
+ }
186
+ const moovStart = moov.offset + BOX_HEADER_SIZE;
187
+ const moovEnd = moov.offset + moov.size;
188
+ // Walk each trak box inside the moov, advancing past each one we find. Once we've passed the last trak, findBox runs out of range and returns null, which is how we
189
+ // know we're done.
190
+ let trakStart = moovStart;
191
+ for (;;) {
192
+ const trak = findBox(initSegment, "trak", trakStart, moovEnd);
193
+ if (!trak) {
194
+ return false;
195
+ }
196
+ // Locate the mdia box inside this trak.
197
+ const mdia = findBox(initSegment, "mdia", trak.offset + BOX_HEADER_SIZE, trak.offset + trak.size);
198
+ if (mdia) {
199
+ // Locate the hdlr box inside the mdia.
200
+ const hdlr = findBox(initSegment, "hdlr", mdia.offset + BOX_HEADER_SIZE, mdia.offset + mdia.size);
201
+ // Read the handler_type field. In a hdlr fullbox, the layout after the standard box header is: version/flags (4 bytes) + pre_defined (4 bytes) + handler_type
202
+ // (4 bytes). We check that the box is large enough to contain the field before reading.
203
+ if (hdlr && (hdlr.size >= (HDLR_TYPE_OFFSET + 4))) {
204
+ if (initSegment.readUInt32BE(hdlr.offset + HDLR_TYPE_OFFSET) === HDLR_TYPE_SOUN) {
205
+ return true;
206
+ }
207
+ }
208
+ }
209
+ // Advance past this trak to search for the next one.
210
+ trakStart = trak.offset + trak.size;
211
+ }
212
+ }
124
213
  /**
125
214
  * Splits an fMP4 fragment into its moof and mdat components.
126
215
  *
@@ -1 +1 @@
1
- {"version":3,"file":"fmp4.js","sourceRoot":"","sources":["../../src/ffmpeg/fmp4.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,0EAA0E;AAC1E,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B,gGAAgG;AAChG,MAAM,gBAAgB,GAAG,eAAe,GAAG,CAAC,CAAC;AAE7C,6DAA6D;AAC7D,MAAM,qB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AC,IAAI,CAAC,CAAC;YAElG,8JAA8J;YAC9J,wFAAwF;YACxF,IAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBAEjD,IAAG,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,GAAG,gBAAgB,CAAC,KAAK,cAAc,EAAE,CAAC;oBAE/E,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,SAAS,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC;IACtC,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB;IAE5C,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAEvC,IAAG,CAAC,IAAI,EAAE,CAAC;QAET,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,214 @@
1
+ /**
2
+ * Mirrors HAP protocol const enum values that HomeKit camera plugins need at value-side runtime. `verbatimModuleSyntax` disallows value imports of ambient const
3
+ * enums, so the numeric and string contracts from hap-nodejs must be re-declared at value-side. Centralizing the mirrors here gives every consumer a single import
4
+ * path and a single update point if upstream `hap-nodejs` ever changes a value.
5
+ *
6
+ * Values MUST stay in lockstep with the upstream definitions in `hap-nodejs/.../RecordingManagement.d.ts`, `hap-nodejs/.../RTPStreamManagement.d.ts`, and
7
+ * `hap-nodejs/.../DataStreamServer.d.ts`. The matching type aliases let consumers import the canonical names from one place rather than re-declaring them.
8
+ *
9
+ * @module
10
+ */
11
+ import type { AudioRecordingCodecType as AudioRecordingCodecTypeEnum, AudioRecordingSamplerate as AudioRecordingSamplerateEnum, AudioStreamingCodecType as AudioStreamingCodecTypeEnum, AudioStreamingSamplerate as AudioStreamingSamplerateEnum, H264Level as H264LevelEnum, H264Profile as H264ProfileEnum, HDSProtocolSpecificErrorReason as HDSProtocolSpecificErrorReasonEnum, MediaContainerType as MediaContainerTypeEnum, SRTPCryptoSuites as SRTPCryptoSuitesEnum, StreamRequestTypes as StreamRequestTypesEnum } from "homebridge";
12
+ import type { VideoCodecType as VideoCodecTypeEnum } from "@homebridge/hap-nodejs";
13
+ /**
14
+ * Numeric mirror of HAP's `AudioRecordingCodecType` const enum, suitable for runtime indexing into translation tables.
15
+ *
16
+ * @category FFmpeg
17
+ */
18
+ export declare const AudioRecordingCodecType: {
19
+ readonly AAC_ELD: AudioRecordingCodecTypeEnum.AAC_ELD;
20
+ readonly AAC_LC: AudioRecordingCodecTypeEnum.AAC_LC;
21
+ };
22
+ /**
23
+ * Type alias re-exposing the HAP enum under its canonical name so existing `codec?: AudioRecordingCodecType` annotations resolve through the shared module rather than
24
+ * a local redeclaration in each consumer.
25
+ *
26
+ * @category FFmpeg
27
+ */
28
+ export type AudioRecordingCodecType = AudioRecordingCodecTypeEnum;
29
+ /**
30
+ * Numeric mirror of HAP's `AudioRecordingSamplerate` const enum, suitable for runtime indexing into translation tables and for constructing recording configurations
31
+ * by enum name rather than by raw numeric value.
32
+ *
33
+ * @category FFmpeg
34
+ */
35
+ export declare const AudioRecordingSamplerate: {
36
+ readonly KHZ_8: AudioRecordingSamplerateEnum.KHZ_8;
37
+ readonly KHZ_16: AudioRecordingSamplerateEnum.KHZ_16;
38
+ readonly KHZ_24: AudioRecordingSamplerateEnum.KHZ_24;
39
+ readonly KHZ_32: AudioRecordingSamplerateEnum.KHZ_32;
40
+ readonly KHZ_44_1: AudioRecordingSamplerateEnum.KHZ_44_1;
41
+ readonly KHZ_48: AudioRecordingSamplerateEnum.KHZ_48;
42
+ };
43
+ /**
44
+ * Type alias re-exposing the HAP enum under its canonical name so existing `samplerate: AudioRecordingSamplerate` annotations resolve through the shared module rather
45
+ * than a local redeclaration in each consumer.
46
+ *
47
+ * @category FFmpeg
48
+ */
49
+ export type AudioRecordingSamplerate = AudioRecordingSamplerateEnum;
50
+ /**
51
+ * String mirror of HAP's `AudioStreamingCodecType` const enum, surfaced to HomeKit camera streaming delegates when declaring the audio codecs supported on live-stream
52
+ * sessions.
53
+ *
54
+ * @category FFmpeg
55
+ */
56
+ export declare const AudioStreamingCodecType: {
57
+ readonly AAC_ELD: AudioStreamingCodecTypeEnum.AAC_ELD;
58
+ readonly AMR: AudioStreamingCodecTypeEnum.AMR;
59
+ readonly AMR_WB: AudioStreamingCodecTypeEnum.AMR_WB;
60
+ readonly MSBC: AudioStreamingCodecTypeEnum.MSBC;
61
+ readonly OPUS: AudioStreamingCodecTypeEnum.OPUS;
62
+ readonly PCMA: AudioStreamingCodecTypeEnum.PCMA;
63
+ readonly PCMU: AudioStreamingCodecTypeEnum.PCMU;
64
+ };
65
+ /**
66
+ * Type alias re-exposing the HAP enum under its canonical name so existing `type: AudioStreamingCodecType` annotations resolve through the shared module rather than a
67
+ * local redeclaration in each consumer.
68
+ *
69
+ * @category FFmpeg
70
+ */
71
+ export type AudioStreamingCodecType = AudioStreamingCodecTypeEnum;
72
+ /**
73
+ * Numeric mirror of HAP's `AudioStreamingSamplerate` const enum, surfaced to HomeKit camera streaming delegates when declaring the audio sample rates supported on
74
+ * live-stream sessions.
75
+ *
76
+ * @category FFmpeg
77
+ */
78
+ export declare const AudioStreamingSamplerate: {
79
+ readonly KHZ_8: AudioStreamingSamplerateEnum.KHZ_8;
80
+ readonly KHZ_16: AudioStreamingSamplerateEnum.KHZ_16;
81
+ readonly KHZ_24: AudioStreamingSamplerateEnum.KHZ_24;
82
+ };
83
+ /**
84
+ * Type alias re-exposing the HAP enum under its canonical name so existing `samplerate: AudioStreamingSamplerate` annotations resolve through the shared module rather
85
+ * than a local redeclaration in each consumer.
86
+ *
87
+ * @category FFmpeg
88
+ */
89
+ export type AudioStreamingSamplerate = AudioStreamingSamplerateEnum;
90
+ /**
91
+ * Numeric mirror of HAP's `H264Level` const enum, surfaced when declaring the H.264 levels a camera codec configuration advertises to HomeKit.
92
+ *
93
+ * @category FFmpeg
94
+ */
95
+ export declare const H264Level: {
96
+ readonly LEVEL3_1: H264LevelEnum.LEVEL3_1;
97
+ readonly LEVEL3_2: H264LevelEnum.LEVEL3_2;
98
+ readonly LEVEL4_0: H264LevelEnum.LEVEL4_0;
99
+ };
100
+ /**
101
+ * Type alias re-exposing the HAP enum under its canonical name so existing `levels: H264Level[]` annotations resolve through the shared module rather than a local
102
+ * redeclaration in each consumer.
103
+ *
104
+ * @category FFmpeg
105
+ */
106
+ export type H264Level = H264LevelEnum;
107
+ /**
108
+ * Numeric mirror of HAP's `H264Profile` const enum, surfaced when declaring the H.264 profiles a camera codec configuration advertises to HomeKit.
109
+ *
110
+ * @category FFmpeg
111
+ */
112
+ export declare const H264Profile: {
113
+ readonly BASELINE: H264ProfileEnum.BASELINE;
114
+ readonly HIGH: H264ProfileEnum.HIGH;
115
+ readonly MAIN: H264ProfileEnum.MAIN;
116
+ };
117
+ /**
118
+ * Type alias re-exposing the HAP enum under its canonical name so existing `profiles: H264Profile[]` annotations resolve through the shared module rather than a local
119
+ * redeclaration in each consumer.
120
+ *
121
+ * @category FFmpeg
122
+ */
123
+ export type H264Profile = H264ProfileEnum;
124
+ /**
125
+ * Numeric mirror of HAP's `HDSProtocolSpecificErrorReason` const enum, surfaced to HKSV recording delegates as the categorical reason a HomeKit data stream session
126
+ * terminated. Recording delegates compare the value they receive in `close(reason)` against these names rather than against opaque numeric constants.
127
+ *
128
+ * @category FFmpeg
129
+ */
130
+ export declare const HDSProtocolSpecificErrorReason: {
131
+ readonly NORMAL: HDSProtocolSpecificErrorReasonEnum.NORMAL;
132
+ readonly NOT_ALLOWED: HDSProtocolSpecificErrorReasonEnum.NOT_ALLOWED;
133
+ readonly BUSY: HDSProtocolSpecificErrorReasonEnum.BUSY;
134
+ readonly CANCELLED: HDSProtocolSpecificErrorReasonEnum.CANCELLED;
135
+ readonly UNSUPPORTED: HDSProtocolSpecificErrorReasonEnum.UNSUPPORTED;
136
+ readonly UNEXPECTED_FAILURE: HDSProtocolSpecificErrorReasonEnum.UNEXPECTED_FAILURE;
137
+ readonly TIMEOUT: HDSProtocolSpecificErrorReasonEnum.TIMEOUT;
138
+ readonly BAD_DATA: HDSProtocolSpecificErrorReasonEnum.BAD_DATA;
139
+ readonly PROTOCOL_ERROR: HDSProtocolSpecificErrorReasonEnum.PROTOCOL_ERROR;
140
+ readonly INVALID_CONFIGURATION: HDSProtocolSpecificErrorReasonEnum.INVALID_CONFIGURATION;
141
+ };
142
+ /**
143
+ * Type alias re-exposing the HAP enum under its canonical name so existing `reason: HDSProtocolSpecificErrorReason` annotations resolve through the shared module
144
+ * rather than a local redeclaration in each consumer.
145
+ *
146
+ * @category FFmpeg
147
+ */
148
+ export type HDSProtocolSpecificErrorReason = HDSProtocolSpecificErrorReasonEnum;
149
+ /**
150
+ * Numeric mirror of HAP's `SRTPCryptoSuites` const enum, surfaced when negotiating the SRTP cipher suite for HomeKit camera streaming sessions.
151
+ *
152
+ * @category FFmpeg
153
+ */
154
+ export declare const SRTPCryptoSuites: {
155
+ readonly AES_CM_128_HMAC_SHA1_80: SRTPCryptoSuitesEnum.AES_CM_128_HMAC_SHA1_80;
156
+ readonly AES_CM_256_HMAC_SHA1_80: SRTPCryptoSuitesEnum.AES_CM_256_HMAC_SHA1_80;
157
+ readonly NONE: SRTPCryptoSuitesEnum.NONE;
158
+ };
159
+ /**
160
+ * Type alias re-exposing the HAP enum under its canonical name so existing `suite: SRTPCryptoSuites` annotations resolve through the shared module rather than a local
161
+ * redeclaration in each consumer.
162
+ *
163
+ * @category FFmpeg
164
+ */
165
+ export type SRTPCryptoSuites = SRTPCryptoSuitesEnum;
166
+ /**
167
+ * Numeric mirror of HAP's `VideoCodecType` const enum, surfaced when declaring the video codec a camera advertises to HomeKit.
168
+ *
169
+ * @category FFmpeg
170
+ */
171
+ export declare const VideoCodecType: {
172
+ readonly H264: VideoCodecTypeEnum.H264;
173
+ };
174
+ /**
175
+ * Type alias re-exposing the HAP enum under its canonical name so existing `type: VideoCodecType` annotations resolve through the shared module rather than a local
176
+ * redeclaration in each consumer.
177
+ *
178
+ * @category FFmpeg
179
+ */
180
+ export type VideoCodecType = VideoCodecTypeEnum;
181
+ /**
182
+ * Numeric mirror of HAP's `MediaContainerType` const enum, surfaced when declaring the container format of HKSV recording fragments.
183
+ *
184
+ * @category FFmpeg
185
+ */
186
+ export declare const MediaContainerType: {
187
+ readonly FRAGMENTED_MP4: MediaContainerTypeEnum.FRAGMENTED_MP4;
188
+ };
189
+ /**
190
+ * Type alias re-exposing the HAP enum under its canonical name so existing `type: MediaContainerType` annotations resolve through the shared module rather than a
191
+ * local redeclaration in each consumer.
192
+ *
193
+ * @category FFmpeg
194
+ */
195
+ export type MediaContainerType = MediaContainerTypeEnum;
196
+ /**
197
+ * String mirror of HAP's `StreamRequestTypes` const enum, used by HomeKit camera streaming delegates to dispatch on the `type` field of incoming streaming-control
198
+ * requests.
199
+ *
200
+ * @category FFmpeg
201
+ */
202
+ export declare const StreamRequestTypes: {
203
+ readonly RECONFIGURE: StreamRequestTypesEnum.RECONFIGURE;
204
+ readonly START: StreamRequestTypesEnum.START;
205
+ readonly STOP: StreamRequestTypesEnum.STOP;
206
+ };
207
+ /**
208
+ * Type alias re-exposing the HAP enum under its canonical name so existing `type: StreamRequestTypes` annotations resolve through the shared module rather than a
209
+ * local redeclaration in each consumer.
210
+ *
211
+ * @category FFmpeg
212
+ */
213
+ export type StreamRequestTypes = StreamRequestTypesEnum;
214
+ //# sourceMappingURL=hap-enums.d.ts.map
@@ -0,0 +1,92 @@
1
+ /* Copyright(C) 2017-2026, HJD (https://github.com/hjdhjd). All rights reserved.
2
+ *
3
+ * ffmpeg/hap-enums.ts: Single source of truth for the HAP protocol const enum mirrors that HomeKit camera plugins need at runtime.
4
+ */
5
+ /**
6
+ * Numeric mirror of HAP's `AudioRecordingCodecType` const enum, suitable for runtime indexing into translation tables.
7
+ *
8
+ * @category FFmpeg
9
+ */
10
+ export const AudioRecordingCodecType = { AAC_ELD: 1, AAC_LC: 0 };
11
+ /**
12
+ * Numeric mirror of HAP's `AudioRecordingSamplerate` const enum, suitable for runtime indexing into translation tables and for constructing recording configurations
13
+ * by enum name rather than by raw numeric value.
14
+ *
15
+ * @category FFmpeg
16
+ */
17
+ export const AudioRecordingSamplerate = { KHZ_16: 1, KHZ_24: 2, KHZ_32: 3, KHZ_44_1: 4, KHZ_48: 5, KHZ_8: 0 };
18
+ /**
19
+ * String mirror of HAP's `AudioStreamingCodecType` const enum, surfaced to HomeKit camera streaming delegates when declaring the audio codecs supported on live-stream
20
+ * sessions.
21
+ *
22
+ * @category FFmpeg
23
+ */
24
+ export const AudioStreamingCodecType = {
25
+ // String const enum members are nominal in TypeScript: a raw string literal is not assignable to the enum member type without an explicit brand. The per-property
26
+ // assertions make the intent visible at each value, and the assertion fails fast if the upstream string ever changes out from under us.
27
+ AAC_ELD: "AAC-eld",
28
+ AMR: "AMR",
29
+ AMR_WB: "AMR-WB",
30
+ MSBC: "mSBC",
31
+ OPUS: "OPUS",
32
+ PCMA: "PCMA",
33
+ PCMU: "PCMU"
34
+ };
35
+ /**
36
+ * Numeric mirror of HAP's `AudioStreamingSamplerate` const enum, surfaced to HomeKit camera streaming delegates when declaring the audio sample rates supported on
37
+ * live-stream sessions.
38
+ *
39
+ * @category FFmpeg
40
+ */
41
+ export const AudioStreamingSamplerate = { KHZ_16: 16, KHZ_24: 24, KHZ_8: 8 };
42
+ /**
43
+ * Numeric mirror of HAP's `H264Level` const enum, surfaced when declaring the H.264 levels a camera codec configuration advertises to HomeKit.
44
+ *
45
+ * @category FFmpeg
46
+ */
47
+ export const H264Level = { LEVEL3_1: 0, LEVEL3_2: 1, LEVEL4_0: 2 };
48
+ /**
49
+ * Numeric mirror of HAP's `H264Profile` const enum, surfaced when declaring the H.264 profiles a camera codec configuration advertises to HomeKit.
50
+ *
51
+ * @category FFmpeg
52
+ */
53
+ export const H264Profile = { BASELINE: 0, HIGH: 2, MAIN: 1 };
54
+ /**
55
+ * Numeric mirror of HAP's `HDSProtocolSpecificErrorReason` const enum, surfaced to HKSV recording delegates as the categorical reason a HomeKit data stream session
56
+ * terminated. Recording delegates compare the value they receive in `close(reason)` against these names rather than against opaque numeric constants.
57
+ *
58
+ * @category FFmpeg
59
+ */
60
+ export const HDSProtocolSpecificErrorReason = { BAD_DATA: 7, BUSY: 2, CANCELLED: 3, INVALID_CONFIGURATION: 9, NORMAL: 0, NOT_ALLOWED: 1, PROTOCOL_ERROR: 8, TIMEOUT: 6, UNEXPECTED_FAILURE: 5, UNSUPPORTED: 4 };
61
+ /**
62
+ * Numeric mirror of HAP's `SRTPCryptoSuites` const enum, surfaced when negotiating the SRTP cipher suite for HomeKit camera streaming sessions.
63
+ *
64
+ * @category FFmpeg
65
+ */
66
+ export const SRTPCryptoSuites = { AES_CM_128_HMAC_SHA1_80: 0, AES_CM_256_HMAC_SHA1_80: 1, NONE: 2 };
67
+ /**
68
+ * Numeric mirror of HAP's `VideoCodecType` const enum, surfaced when declaring the video codec a camera advertises to HomeKit.
69
+ *
70
+ * @category FFmpeg
71
+ */
72
+ export const VideoCodecType = { H264: 0 };
73
+ /**
74
+ * Numeric mirror of HAP's `MediaContainerType` const enum, surfaced when declaring the container format of HKSV recording fragments.
75
+ *
76
+ * @category FFmpeg
77
+ */
78
+ export const MediaContainerType = { FRAGMENTED_MP4: 0 };
79
+ /**
80
+ * String mirror of HAP's `StreamRequestTypes` const enum, used by HomeKit camera streaming delegates to dispatch on the `type` field of incoming streaming-control
81
+ * requests.
82
+ *
83
+ * @category FFmpeg
84
+ */
85
+ export const StreamRequestTypes = {
86
+ // String const enum members are nominal in TypeScript: a raw string literal is not assignable to the enum member type without an explicit brand. The per-property
87
+ // assertions make the intent visible at each value, and the assertion fails fast if the upstream string ever changes out from under us.
88
+ RECONFIGURE: "reconfigure",
89
+ START: "start",
90
+ STOP: "stop"
91
+ };
92
+ //# sourceMappingURL=hap-enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hap-enums.js","sourceRoot":"","sources":["../../src/ffmpeg/hap-enums.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuBH;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAClC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAU5B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAOjC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAU1E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAQhC;IAEF,kKAAkK;IAClK,wIAAwI;IACxI,OAAO,EAAE,SAAgD;IACzD,GAAG,EAAE,KAAwC;IAC7C,MAAM,EAAE,QAA8C;IACtD,IAAI,EAAE,MAA0C;IAChD,IAAI,EAAE,MAA0C;IAChD,IAAI,EAAE,MAA0C;IAChD,IAAI,EAAE,MAA0C;CACjD,CAAC;AAUF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAIjC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAUzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GACpB,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;AAU5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GACtB,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAUpC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAWvC,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,qBAAqB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;AAUtK;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAIzB,EAAE,uBAAuB,EAAE,CAAC,EAAE,uBAAuB,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAUxE;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAA+C,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAUtF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAuE,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC;AAU5H;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAI3B;IAEF,kKAAkK;IAClK,wIAAwI;IACxI,WAAW,EAAE,aAAmD;IAChE,KAAK,EAAE,OAAuC;IAC9C,IAAI,EAAE,MAAqC;CAC5C,CAAC"}
@@ -1,9 +1,16 @@
1
- export * from "./codecs.js";
2
- export * from "./exec.js";
3
- export * from "./fmp4.js";
4
- export * from "./options.js";
5
- export * from "./process.js";
6
- export * from "./record.js";
7
- export * from "./rtp.js";
8
- export * from "./settings.js";
9
- export * from "./stream.js";
1
+ export * from "./codecs.ts";
2
+ export * from "./dgram-util.ts";
3
+ export * from "./exec.ts";
4
+ export * from "./fmp4.ts";
5
+ export * from "./hap-enums.ts";
6
+ export * from "./mp4-assembler.ts";
7
+ export * from "./mp4-parser.ts";
8
+ export * from "./options.ts";
9
+ export * from "./process.ts";
10
+ export * from "./record.ts";
11
+ export * from "./recording-process-double.ts";
12
+ export * from "./rtp-parser.ts";
13
+ export * from "./rtp.ts";
14
+ export * from "./settings.ts";
15
+ export * from "./stream.ts";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -3,11 +3,17 @@
3
3
  * ffmpeg/index.ts: FFmpeg classes.
4
4
  */
5
5
  export * from "./codecs.js";
6
+ export * from "./dgram-util.js";
6
7
  export * from "./exec.js";
7
8
  export * from "./fmp4.js";
9
+ export * from "./hap-enums.js";
10
+ export * from "./mp4-assembler.js";
11
+ export * from "./mp4-parser.js";
8
12
  export * from "./options.js";
9
13
  export * from "./process.js";
10
14
  export * from "./record.js";
15
+ export * from "./recording-process-double.js";
16
+ export * from "./rtp-parser.js";
11
17
  export * from "./rtp.js";
12
18
  export * from "./settings.js";
13
19
  export * from "./stream.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ffmpeg/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ffmpeg/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}