supervision 0.1.7 → 0.2.0-next.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 (215) hide show
  1. package/dist/detections/chunked-detection-frame-source.d.ts.map +1 -1
  2. package/dist/index.d.ts +11 -4
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +8856 -4559
  5. package/dist/index.js.map +1 -1
  6. package/dist/mask-preparation.worker.js +310 -164
  7. package/dist/mask-preparation.worker.js.map +1 -1
  8. package/dist/media/display-pixel-ratio.d.ts +15 -0
  9. package/dist/media/display-pixel-ratio.d.ts.map +1 -0
  10. package/dist/media/engine-import-failure.d.ts +16 -0
  11. package/dist/media/engine-import-failure.d.ts.map +1 -0
  12. package/dist/media/media-condition-probe.d.ts +51 -0
  13. package/dist/media/media-condition-probe.d.ts.map +1 -0
  14. package/dist/media/media-conditions.d.ts +28 -0
  15. package/dist/media/media-conditions.d.ts.map +1 -0
  16. package/dist/media/media-errors.d.ts +6 -0
  17. package/dist/media/media-errors.d.ts.map +1 -1
  18. package/dist/media/media-normalization.d.ts.map +1 -1
  19. package/dist/media/media-probe.d.ts.map +1 -1
  20. package/dist/media/media-source.d.ts +17 -0
  21. package/dist/media/media-source.d.ts.map +1 -1
  22. package/dist/media/mediabunny-media-source.d.ts.map +1 -1
  23. package/dist/media/video-engine-media-source.d.ts +44 -0
  24. package/dist/media/video-engine-media-source.d.ts.map +1 -0
  25. package/dist/render-preparation/mask-frame-artifact.d.ts +46 -12
  26. package/dist/render-preparation/mask-frame-artifact.d.ts.map +1 -1
  27. package/dist/render-preparation/mask-frame-compositor.d.ts +5 -5
  28. package/dist/render-preparation/mask-frame-compositor.d.ts.map +1 -1
  29. package/dist/render-preparation/mask-frame-preparer.d.ts.map +1 -1
  30. package/dist/render-preparation/mask-preparation-worker-count.d.ts +4 -4
  31. package/dist/render-preparation/mask-preparation-worker-protocol.d.ts +12 -3
  32. package/dist/render-preparation/mask-preparation-worker-protocol.d.ts.map +1 -1
  33. package/dist/render-preparation/prepared-render-window.d.ts +23 -0
  34. package/dist/render-preparation/prepared-render-window.d.ts.map +1 -1
  35. package/dist/render-preparation/prepared-window-timeline.d.ts +2 -6
  36. package/dist/render-preparation/prepared-window-timeline.d.ts.map +1 -1
  37. package/dist/renderers/mask-palette.d.ts +14 -0
  38. package/dist/renderers/mask-palette.d.ts.map +1 -0
  39. package/dist/renderers/mask-vertex.d.ts +14 -0
  40. package/dist/renderers/mask-vertex.d.ts.map +1 -0
  41. package/dist/renderers/media-renderer-core.d.ts.map +1 -1
  42. package/dist/renderers/media-renderer-scene.d.ts +37 -0
  43. package/dist/renderers/media-renderer-scene.d.ts.map +1 -1
  44. package/dist/renderers/media-renderer-state.d.ts +11 -1
  45. package/dist/renderers/media-renderer-state.d.ts.map +1 -1
  46. package/dist/renderers/media-renderer-transport.d.ts +59 -0
  47. package/dist/renderers/media-renderer-transport.d.ts.map +1 -0
  48. package/dist/renderers/pixi-box-layer.d.ts +5 -0
  49. package/dist/renderers/pixi-box-layer.d.ts.map +1 -1
  50. package/dist/renderers/pixi-focus-layer.d.ts +18 -2
  51. package/dist/renderers/pixi-focus-layer.d.ts.map +1 -1
  52. package/dist/renderers/pixi-frame-present.d.ts +77 -0
  53. package/dist/renderers/pixi-frame-present.d.ts.map +1 -0
  54. package/dist/renderers/pixi-id-mask-shader.d.ts +12 -2
  55. package/dist/renderers/pixi-id-mask-shader.d.ts.map +1 -1
  56. package/dist/renderers/pixi-interaction-layer.d.ts.map +1 -1
  57. package/dist/renderers/pixi-interaction-presentation-layer.d.ts +13 -2
  58. package/dist/renderers/pixi-interaction-presentation-layer.d.ts.map +1 -1
  59. package/dist/renderers/pixi-mask-halo.d.ts +24 -0
  60. package/dist/renderers/pixi-mask-halo.d.ts.map +1 -1
  61. package/dist/renderers/pixi-mask-layer.d.ts +71 -8
  62. package/dist/renderers/pixi-mask-layer.d.ts.map +1 -1
  63. package/dist/renderers/pixi-media-scene.d.ts +67 -0
  64. package/dist/renderers/pixi-media-scene.d.ts.map +1 -1
  65. package/dist/renderers/pixi-polygon-layer.d.ts +7 -2
  66. package/dist/renderers/pixi-polygon-layer.d.ts.map +1 -1
  67. package/dist/renderers/pixi-region-coverage-mask.d.ts +91 -0
  68. package/dist/renderers/pixi-region-coverage-mask.d.ts.map +1 -0
  69. package/dist/renderers/pixi-region-effect.d.ts +42 -0
  70. package/dist/renderers/pixi-region-effect.d.ts.map +1 -0
  71. package/dist/renderers/pixi-region-layer.d.ts +68 -2
  72. package/dist/renderers/pixi-region-layer.d.ts.map +1 -1
  73. package/dist/renderers/pixi-vector-layer.d.ts.map +1 -1
  74. package/dist/renderers/prepared-annotation-window.d.ts +47 -0
  75. package/dist/renderers/prepared-annotation-window.d.ts.map +1 -0
  76. package/dist/renderers/presented-frame-channel.d.ts +107 -0
  77. package/dist/renderers/presented-frame-channel.d.ts.map +1 -0
  78. package/dist/renderers/scene-render-scheduler.d.ts +20 -0
  79. package/dist/renderers/scene-render-scheduler.d.ts.map +1 -0
  80. package/dist/sessions/media-session-defaults.d.ts +10 -6
  81. package/dist/sessions/media-session-defaults.d.ts.map +1 -1
  82. package/dist/sessions/media-session-media.d.ts.map +1 -1
  83. package/dist/sessions/media-session-state.d.ts.map +1 -1
  84. package/dist/sessions/media-session.d.ts.map +1 -1
  85. package/dist/tracking.worker.js +58 -3
  86. package/dist/tracking.worker.js.map +1 -1
  87. package/dist/types/media-conditions.d.ts +149 -0
  88. package/dist/types/media-conditions.d.ts.map +1 -0
  89. package/dist/types/media-normalization.d.ts +34 -0
  90. package/dist/types/media-normalization.d.ts.map +1 -1
  91. package/dist/types/media-renderer.d.ts +31 -1
  92. package/dist/types/media-renderer.d.ts.map +1 -1
  93. package/dist/types/media-session.d.ts +89 -8
  94. package/dist/types/media-session.d.ts.map +1 -1
  95. package/dist/types/render-preparation.d.ts +101 -4
  96. package/dist/types/render-preparation.d.ts.map +1 -1
  97. package/dist/web-video-engine/analysis-session.d.ts +76 -0
  98. package/dist/web-video-engine/analysis-session.d.ts.map +1 -0
  99. package/dist/web-video-engine/analysis.d.ts +7 -0
  100. package/dist/web-video-engine/analysis.d.ts.map +1 -0
  101. package/dist/web-video-engine/analysis.js +1678 -0
  102. package/dist/web-video-engine/analysis.js.map +1 -0
  103. package/dist/web-video-engine/cache-budget.d.ts +19 -0
  104. package/dist/web-video-engine/cache-budget.d.ts.map +1 -0
  105. package/dist/web-video-engine/canvas-sink-scrub-cursor.d.ts +90 -0
  106. package/dist/web-video-engine/canvas-sink-scrub-cursor.d.ts.map +1 -0
  107. package/dist/web-video-engine/clock.d.ts +83 -0
  108. package/dist/web-video-engine/clock.d.ts.map +1 -0
  109. package/dist/web-video-engine/constants.d.ts +253 -0
  110. package/dist/web-video-engine/constants.d.ts.map +1 -0
  111. package/dist/web-video-engine/create-scrub-cursor.d.ts +62 -0
  112. package/dist/web-video-engine/create-scrub-cursor.d.ts.map +1 -0
  113. package/dist/web-video-engine/decode-resolution.d.ts +115 -0
  114. package/dist/web-video-engine/decode-resolution.d.ts.map +1 -0
  115. package/dist/web-video-engine/decode-scheduler.d.ts +356 -0
  116. package/dist/web-video-engine/decode-scheduler.d.ts.map +1 -0
  117. package/dist/web-video-engine/decode-session.d.ts +276 -0
  118. package/dist/web-video-engine/decode-session.d.ts.map +1 -0
  119. package/dist/web-video-engine/decode-source.d.ts +250 -0
  120. package/dist/web-video-engine/decode-source.d.ts.map +1 -0
  121. package/dist/web-video-engine/diagnostics-store.d.ts +18 -0
  122. package/dist/web-video-engine/diagnostics-store.d.ts.map +1 -0
  123. package/dist/web-video-engine/diagnostics.d.ts +316 -0
  124. package/dist/web-video-engine/diagnostics.d.ts.map +1 -0
  125. package/dist/web-video-engine/embedded-engine-worker.d.ts +2 -0
  126. package/dist/web-video-engine/embedded-engine-worker.d.ts.map +1 -0
  127. package/dist/web-video-engine/engine-core.d.ts +258 -0
  128. package/dist/web-video-engine/engine-core.d.ts.map +1 -0
  129. package/dist/web-video-engine/engine.d.ts +26 -0
  130. package/dist/web-video-engine/engine.d.ts.map +1 -0
  131. package/dist/web-video-engine/engine.js +873 -0
  132. package/dist/web-video-engine/engine.js.map +1 -0
  133. package/dist/web-video-engine/engine.worker.d.ts +2 -0
  134. package/dist/web-video-engine/engine.worker.d.ts.map +1 -0
  135. package/dist/web-video-engine/engine.worker.js +31320 -0
  136. package/dist/web-video-engine/engine.worker.js.map +1 -0
  137. package/dist/web-video-engine/frame-cache.d.ts +129 -0
  138. package/dist/web-video-engine/frame-cache.d.ts.map +1 -0
  139. package/dist/web-video-engine/frame-extractor.d.ts +28 -0
  140. package/dist/web-video-engine/frame-extractor.d.ts.map +1 -0
  141. package/dist/web-video-engine/frame-timeline-GINI8Gum.js +560 -0
  142. package/dist/web-video-engine/frame-timeline-GINI8Gum.js.map +1 -0
  143. package/dist/web-video-engine/frame-timeline.d.ts +71 -0
  144. package/dist/web-video-engine/frame-timeline.d.ts.map +1 -0
  145. package/dist/web-video-engine/frame-walker.d.ts +74 -0
  146. package/dist/web-video-engine/frame-walker.d.ts.map +1 -0
  147. package/dist/web-video-engine/index.d.ts +3 -0
  148. package/dist/web-video-engine/index.d.ts.map +1 -0
  149. package/dist/web-video-engine/index.js +3 -0
  150. package/dist/web-video-engine/index.js.map +1 -0
  151. package/dist/web-video-engine/key-packet.d.ts +65 -0
  152. package/dist/web-video-engine/key-packet.d.ts.map +1 -0
  153. package/dist/web-video-engine/keyframe-index.d.ts +91 -0
  154. package/dist/web-video-engine/keyframe-index.d.ts.map +1 -0
  155. package/dist/web-video-engine/mirror-store.d.ts +56 -0
  156. package/dist/web-video-engine/mirror-store.d.ts.map +1 -0
  157. package/dist/web-video-engine/renderer.d.ts +94 -0
  158. package/dist/web-video-engine/renderer.d.ts.map +1 -0
  159. package/dist/web-video-engine/rotation.d.ts +35 -0
  160. package/dist/web-video-engine/rotation.d.ts.map +1 -0
  161. package/dist/web-video-engine/scrub-controller.d.ts +376 -0
  162. package/dist/web-video-engine/scrub-controller.d.ts.map +1 -0
  163. package/dist/web-video-engine/scrub-cursor.d.ts +342 -0
  164. package/dist/web-video-engine/scrub-cursor.d.ts.map +1 -0
  165. package/dist/web-video-engine/scrub-trajectory.d.ts +30 -0
  166. package/dist/web-video-engine/scrub-trajectory.d.ts.map +1 -0
  167. package/dist/web-video-engine/source-residency.d.ts +57 -0
  168. package/dist/web-video-engine/source-residency.d.ts.map +1 -0
  169. package/dist/web-video-engine/trace-recorder.d.ts +164 -0
  170. package/dist/web-video-engine/trace-recorder.d.ts.map +1 -0
  171. package/dist/web-video-engine/types.d.ts +204 -0
  172. package/dist/web-video-engine/types.d.ts.map +1 -0
  173. package/dist/web-video-engine/video-engine.d.ts +426 -0
  174. package/dist/web-video-engine/video-engine.d.ts.map +1 -0
  175. package/dist/web-video-engine/webgpu-renderer.d.ts +62 -0
  176. package/dist/web-video-engine/webgpu-renderer.d.ts.map +1 -0
  177. package/dist/web-video-engine/worker-bridge.d.ts +12 -0
  178. package/dist/web-video-engine/worker-bridge.d.ts.map +1 -0
  179. package/dist/web-video-engine/worker-dispatch.d.ts +17 -0
  180. package/dist/web-video-engine/worker-dispatch.d.ts.map +1 -0
  181. package/dist/web-video-engine/worker-protocol.d.ts +267 -0
  182. package/dist/web-video-engine/worker-protocol.d.ts.map +1 -0
  183. package/node_modules/supervision-js-core/dist/detections/buffered-detection-timeline.d.ts.map +1 -1
  184. package/node_modules/supervision-js-core/dist/detections/composite-detection-frame-source.d.ts.map +1 -1
  185. package/node_modules/supervision-js-core/dist/index.d.ts +4 -3
  186. package/node_modules/supervision-js-core/dist/index.d.ts.map +1 -1
  187. package/node_modules/supervision-js-core/dist/index.js +1075 -266
  188. package/node_modules/supervision-js-core/dist/index.js.map +1 -1
  189. package/node_modules/supervision-js-core/dist/styles/default-annotation-presentation.d.ts.map +1 -1
  190. package/node_modules/supervision-js-core/dist/styles/interaction-style.d.ts +4 -36
  191. package/node_modules/supervision-js-core/dist/styles/interaction-style.d.ts.map +1 -1
  192. package/node_modules/supervision-js-core/dist/styles/polyline-style.d.ts +5 -0
  193. package/node_modules/supervision-js-core/dist/styles/polyline-style.d.ts.map +1 -1
  194. package/node_modules/supervision-js-core/dist/types/annotation-renderer.d.ts +92 -7
  195. package/node_modules/supervision-js-core/dist/types/annotation-renderer.d.ts.map +1 -1
  196. package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts +179 -17
  197. package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts.map +1 -1
  198. package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts +78 -2
  199. package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts.map +1 -1
  200. package/node_modules/supervision-js-core/dist/types/polyline-style.d.ts +2 -0
  201. package/node_modules/supervision-js-core/dist/types/polyline-style.d.ts.map +1 -1
  202. package/node_modules/supervision-js-core/dist/types/session-lifecycle.d.ts +16 -0
  203. package/node_modules/supervision-js-core/dist/types/session-lifecycle.d.ts.map +1 -1
  204. package/node_modules/supervision-js-core/dist/utils/detection-conversions.d.ts.map +1 -1
  205. package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts +5 -0
  206. package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts.map +1 -1
  207. package/node_modules/supervision-js-core/dist/utils/detection-masks.d.ts +9 -0
  208. package/node_modules/supervision-js-core/dist/utils/detection-masks.d.ts.map +1 -1
  209. package/node_modules/supervision-js-core/dist/utils/detection-ranges.d.ts +18 -0
  210. package/node_modules/supervision-js-core/dist/utils/detection-ranges.d.ts.map +1 -0
  211. package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts +15 -2
  212. package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts.map +1 -1
  213. package/node_modules/supervision-js-core/dist/utils/wait-bound.d.ts +7 -0
  214. package/node_modules/supervision-js-core/dist/utils/wait-bound.d.ts.map +1 -0
  215. package/package.json +22 -1
@@ -50,6 +50,32 @@ export declare enum RenderPreparationArtifactFrameStatus {
50
50
  Pending = "pending",
51
51
  Prepared = "prepared"
52
52
  }
53
+ /**
54
+ * Why an enabled render-preparation gate is holding playback.
55
+ *
56
+ * The two holds are different events for a viewer. One says the picture is
57
+ * incomplete; the other says the picture is finished and the gate is banking a
58
+ * lead in front of it. A host shown only that playback stopped cannot tell them
59
+ * apart, and describing the second as missing media is wrong on any source.
60
+ */
61
+ export declare enum RenderPreparationGateHoldReason {
62
+ /** The frame about to be presented has no artifact yet. */
63
+ ActiveFrameUnprepared = "activeFrameUnprepared",
64
+ /** That frame is ready, and the prepared lead in front of it is short. */
65
+ LeadBelowRequirement = "leadBelowRequirement"
66
+ }
67
+ /**
68
+ * The hold an enabled gate is applying, absent when it is not holding.
69
+ */
70
+ export interface RenderPreparationGateHoldDiagnostics {
71
+ readonly reason: RenderPreparationGateHoldReason;
72
+ /**
73
+ * Prepared lead the wait has to reach before it ends, after the target
74
+ * window's own span has capped it. Against `preparedAheadSeconds` it gives a
75
+ * host the progress of the wait.
76
+ */
77
+ readonly requiredAheadSeconds: number;
78
+ }
53
79
  /**
54
80
  * Worker creation hook for hosts that need custom CSP or deployment handling.
55
81
  */
@@ -62,6 +88,18 @@ export interface RenderPreparationWorkerFactory {
62
88
  * playback without duplicating scheduling controls.
63
89
  */
64
90
  export interface RenderPreparationMaskFrameOptions {
91
+ /**
92
+ * The box the host paints prepared masks into, in CSS pixels, with the pixel
93
+ * ratio it paints them at. A mask frame's id raster is then capped to the
94
+ * size that box can show; absent, it is cooked at the detections' own
95
+ * resolution.
96
+ */
97
+ readonly display?: {
98
+ readonly boxHeight: number;
99
+ readonly boxWidth: number;
100
+ readonly devicePixelRatio: number;
101
+ readonly maxDevicePixelRatio?: number;
102
+ };
65
103
  /**
66
104
  * Maximum number of prepared mask frames retained in memory.
67
105
  */
@@ -88,19 +126,41 @@ export interface RenderPreparationMaskFrameOptions {
88
126
  readonly workerCount?: number;
89
127
  }
90
128
  /**
91
- * Playback gate for prepared render artifacts.
129
+ * Prepared-artifact playback gate, off unless `enabled` says otherwise.
130
+ *
131
+ * Off, preparation runs behind the picture and a frame the prepared window
132
+ * does not cover reaches no annotation layer instead of holding playback back.
133
+ * On, playback waits until the prepared window leads the playhead, so masks and
134
+ * polygons arrive with their frame rather than after it.
135
+ *
136
+ * The renderer can only hold a frame it is about to draw itself, so this gate
137
+ * reaches only a media source it pulls decoded samples from. A source that
138
+ * presents its own frames owns the playhead and paces itself, and there this
139
+ * gate holds the start of playback and nothing after it: the wait runs once,
140
+ * before the producer is told to play, and the renderer reports `Buffering`
141
+ * while it does. Once the producer is running, unprepared layers stay absent
142
+ * until preparation catches up.
92
143
  */
93
144
  export interface RenderPreparationPlaybackGateOptions {
94
145
  /**
95
- * Pause playback while required artifacts are not prepared.
146
+ * Pause playback while required artifacts are unprepared. A session turns
147
+ * this on by default, so a preview opens with its annotations rather than
148
+ * opening bare; `playbackGate: false` on the session turns it off. A renderer
149
+ * created directly leaves it off.
96
150
  */
97
151
  readonly enabled?: boolean;
98
152
  /**
99
- * Soft target ahead of the active frame.
153
+ * Prepared lead that is enough not to start a wait at all. Defaults to
154
+ * `requiredAheadSeconds` and is capped by it: playback stalls only below this
155
+ * lead, and a stall then clears only once the lead reaches
156
+ * `requiredAheadSeconds`. Setting it lower buys hysteresis, so a lead
157
+ * hovering at the requirement does not stutter.
100
158
  */
101
159
  readonly minimumAheadSeconds?: number;
102
160
  /**
103
- * Required ahead time before playback can continue.
161
+ * Prepared lead a wait in progress must reach before an enabled gate lets
162
+ * playback continue. Defaults to none, which asks only that the frame about
163
+ * to be presented is no longer pending.
104
164
  */
105
165
  readonly requiredAheadSeconds?: number;
106
166
  }
@@ -125,13 +185,33 @@ export interface RenderPreparationArtifactWindowDiagnostics {
125
185
  */
126
186
  export interface RenderPreparationArtifactDiagnostics {
127
187
  readonly activeFrame?: RenderPreparationActiveFrameDiagnostics | null;
188
+ readonly gateHold?: RenderPreparationGateHoldDiagnostics | null;
128
189
  readonly inFlightCount?: number;
129
190
  readonly kind: RenderPreparationArtifactKind;
130
191
  readonly maxInFlightCount?: number;
131
192
  readonly maxPendingCount?: number;
132
193
  readonly maxPreparedCount?: number;
133
194
  readonly pendingCount: number;
195
+ /**
196
+ * Frames in the unbroken run of prepared frames starting at the active
197
+ * detection frame.
198
+ *
199
+ * This is a count of frames, not of media time. Above 1x the preparer strides,
200
+ * so N frames here do not cover N frame durations of playback, and the two
201
+ * numbers diverge by design. Deriving one from the other is wrong in both
202
+ * directions.
203
+ */
134
204
  readonly preparedAheadFrameCount?: number;
205
+ /**
206
+ * Media-time reach of that same unbroken run, in seconds, measured forward
207
+ * from the active detection frame and wrapping at the media end on a looping
208
+ * clip.
209
+ *
210
+ * The run stops at the first frame that is not prepared, so this is how long
211
+ * playback can continue before annotations stop, not the furthest frame
212
+ * prepared anywhere. It is also what a detection gate compares against its
213
+ * required lead, so it stays a single comparable scalar.
214
+ */
135
215
  readonly preparedAheadSeconds?: number;
136
216
  readonly prefetchCount?: number;
137
217
  readonly preparedCount: number;
@@ -158,6 +238,23 @@ export interface RenderPreparationOptions {
158
238
  readonly maskFrame?: RenderPreparationMaskFrameOptions;
159
239
  readonly mode?: RenderPreparationMode;
160
240
  readonly onDiagnostics?: (diagnostics: RenderPreparationDiagnostics) => void;
241
+ /**
242
+ * Hold playback until prepared artifacts cover the frame about to be
243
+ * presented.
244
+ *
245
+ * **This option reaches two different distances depending on the source.** A
246
+ * source the renderer pulls samples from is held at every frame. A source that
247
+ * presents its own frames is held only at the start of playback, because
248
+ * stopping the producer mid-run needs an answer about coverage that render
249
+ * preparation cannot give without waiting for it, so frames after the start
250
+ * arrive whether their artifacts are ready or not. `playbackGateReach` on the
251
+ * renderer's state reports the furthest any of its gates reaches.
252
+ *
253
+ * A renderer created directly leaves this off. `createMediaSession()` turns it
254
+ * on, so a session opens with its annotations rather than opening bare; pass
255
+ * `playbackGate: false` to the session to opt out. See
256
+ * {@link RenderPreparationPlaybackGateOptions}.
257
+ */
161
258
  readonly playbackGate?: RenderPreparationPlaybackGateOptions;
162
259
  readonly workerFactory?: RenderPreparationWorkerFactory;
163
260
  }
@@ -1 +1 @@
1
- {"version":3,"file":"render-preparation.d.ts","sourceRoot":"","sources":["../../src/types/render-preparation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,qBAAqB;IAC/B;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,UAAU,eAAe;IACzB;;;OAGG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,oBAAY,8BAA8B;IACxC,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,oBAAY,6BAA6B;IACvC,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,WAAW,gBAAgB;IAC3B,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,oBAAY,6BAA6B;IACvC,iEAAiE;IACjE,SAAS,cAAc;IACvB,sEAAsE;IACtE,YAAY,iBAAiB;CAC9B;AAED;;GAEG;AACH,oBAAY,oCAAoC;IAC9C,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,YAAY,IAAI,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,iCAAiC;IAChD;;OAEG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC;;OAEG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD;;OAEG;IACH,QAAQ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,QAAQ,CAAC,MAAM,CAAC,EAAE,0CAA0C,CAAC;CAC9D;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,SAAS,EAAE,SAAS,oCAAoC,EAAE,CAAC;IACpE,QAAQ,CAAC,aAAa,EAAE,8BAA8B,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,6BAA6B,CAAC;CACtD;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,iCAAiC,CAAC;IACvD,QAAQ,CAAC,IAAI,CAAC,EAAE,qBAAqB,CAAC;IACtC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,4BAA4B,KAAK,IAAI,CAAC;IAC7E,QAAQ,CAAC,YAAY,CAAC,EAAE,oCAAoC,CAAC;IAC7D,QAAQ,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC;CACzD"}
1
+ {"version":3,"file":"render-preparation.d.ts","sourceRoot":"","sources":["../../src/types/render-preparation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,qBAAqB;IAC/B;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,UAAU,eAAe;IACzB;;;OAGG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,oBAAY,8BAA8B;IACxC,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,oBAAY,6BAA6B;IACvC,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,WAAW,gBAAgB;IAC3B,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,oBAAY,6BAA6B;IACvC,iEAAiE;IACjE,SAAS,cAAc;IACvB,sEAAsE;IACtE,YAAY,iBAAiB;CAC9B;AAED;;GAEG;AACH,oBAAY,oCAAoC;IAC9C,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,OAAO,Y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AAM,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,0CAA0C,CAAC;CAC9D;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,SAAS,EAAE,SAAS,oCAAoC,EAAE,CAAC;IACpE,QAAQ,CAAC,aAAa,EAAE,8BAA8B,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,6BAA6B,CAAC;CACtD;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,iCAAiC,CAAC;IACvD,QAAQ,CAAC,IAAI,CAAC,EAAE,qBAAqB,CAAC;IACtC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,4BAA4B,KAAK,IAAI,CAAC;IAC7E;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,oCAAoC,CAAC;IAC7D,QAAQ,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC;CACzD"}
@@ -0,0 +1,76 @@
1
+ import { type DecodeSourceHandle } from "./decode-source";
2
+ import type { DecodeResolutionStrategy } from "./decode-resolution";
3
+ import type { VideoSource } from "./types";
4
+ /**
5
+ * Playback-independent analysis over a video source: metadata, keyframe
6
+ * discovery, and frame extraction at arbitrary timestamps. It rides the same
7
+ * opened decode source as the playback cursor but spins no worker, binds no
8
+ * canvas, and runs no clock, so a consumer can pull thumbnails or build a
9
+ * contact sheet without standing up a player.
10
+ *
11
+ * Extracted frames are copied into their own canvases before the next decode,
12
+ * because the underlying sink recycles a small pool round-robin; the copy is
13
+ * what makes a returned frame safe to hold.
14
+ */
15
+ export interface AnalysisOptions {
16
+ source: VideoSource;
17
+ /**
18
+ * Output frame resolution: it sizes the decode sink, so frames decode (and
19
+ * paint, and copy) at this width with height following native aspect. Native
20
+ * when omitted; a capped strategy makes a thumbnail pass cheaper end to end
21
+ * rather than decoding native and scaling down afterward.
22
+ */
23
+ decodeStrategy?: DecodeResolutionStrategy;
24
+ poolSize?: number;
25
+ }
26
+ export interface AnalysisMetadata {
27
+ readonly durationS: number;
28
+ readonly width: number;
29
+ readonly height: number;
30
+ /** Resolution extracted frames are sized to, after the decode strategy. */
31
+ readonly frameWidth: number;
32
+ readonly frameHeight: number;
33
+ readonly nativeFps: number | null;
34
+ }
35
+ export interface ExtractedFrame {
36
+ readonly timestampS: number;
37
+ readonly canvas: OffscreenCanvas;
38
+ readonly width: number;
39
+ readonly height: number;
40
+ }
41
+ export declare class AnalysisSession {
42
+ private readonly sink;
43
+ private readonly keyframeIndex;
44
+ private readonly track;
45
+ private readonly disposeSource;
46
+ private closed;
47
+ constructor(source: DecodeSourceHandle);
48
+ /** Opens a source for analysis. The returned session owns the source. */
49
+ static open(options: AnalysisOptions): Promise<AnalysisSession>;
50
+ get metadata(): AnalysisMetadata;
51
+ /**
52
+ * Keyframe timestamps (seconds) whose GOP overlaps the range, resolved
53
+ * lazily through the container. Useful for a contact sheet that lands on
54
+ * real I-frames, which decode without a GOP walk.
55
+ */
56
+ keyframeTimestamps(startS?: number, endS?: number): Promise<readonly number[]>;
57
+ /**
58
+ * Decodes a frame for each requested timestamp and returns a stable copy of
59
+ * each. Timestamps are sorted so the sink decodes each packet at most once;
60
+ * a timestamp with no frame is skipped rather than yielding a gap.
61
+ */
62
+ extractFrames(timestampsS: readonly number[]): Promise<ExtractedFrame[]>;
63
+ /**
64
+ * One frame per requested timestamp, in the order asked for, `null` where no
65
+ * frame covers it, so a caller pairing frames with its own indices keeps the
66
+ * gaps attributable. Timestamps that climb decode in a single pass over the
67
+ * track: one seek and GOP walk for the whole set.
68
+ *
69
+ * A consumer that finishes with each frame before pulling the next holds one
70
+ * frame of memory; {@link extractFrames} holds the whole set.
71
+ */
72
+ framesAtTimestamps(timestampsS: readonly number[]): AsyncGenerator<ExtractedFrame | null, void, unknown>;
73
+ close(): Promise<void>;
74
+ private copyFrame;
75
+ }
76
+ //# sourceMappingURL=analysis-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-session.d.ts","sourceRoot":"","sources":["../src/analysis-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EAGxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAGpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,CAAC;IACpB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,wBAAwB,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;IACvC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsB;IACpD,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,kBAAkB;IAOtC,yEAAyE;WAC5D,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAIrE,IAAI,QAAQ,IAAI,gBAAgB,CAS/B;IAED;;;;OAIG;IACH,kBAAkB,CAChB,MAAM,SAAI,EACV,IAAI,GAAE,MAA6B,GAClC,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAI7B;;;;OAIG;IACG,aAAa,CACjB,WAAW,EAAE,SAAS,MAAM,EAAE,GAC7B,OAAO,CAAC,cAAc,EAAE,CAAC;IAS5B;;;;;;;;OAQG;IACI,kBAAkB,CACvB,WAAW,EAAE,SAAS,MAAM,EAAE,GAC7B,cAAc,CAAC,cAAc,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC;IAqBjD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,OAAO,CAAC,SAAS;CASlB"}
@@ -0,0 +1,7 @@
1
+ export { AnalysisSession } from "./analysis-session";
2
+ export type { AnalysisMetadata, AnalysisOptions, ExtractedFrame, } from "./analysis-session";
3
+ export { FrameExtractor } from "./frame-extractor";
4
+ export { FrameWalker, walkFrames } from "./frame-walker";
5
+ export type { FrameWalkMetadata, FrameWalkRange, WalkedFrame, } from "./frame-walker";
6
+ export type { WalkFrameSource } from "./decode-source";
7
+ //# sourceMappingURL=analysis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../src/analysis.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}