supervision 0.2.5 → 0.2.7

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 (197) hide show
  1. package/dist/depth-preview-probe-DG7McQEN.js +314 -0
  2. package/dist/depth-preview-probe-DG7McQEN.js.map +1 -0
  3. package/dist/depth-preview-track-BvgwNEE9.js +612 -0
  4. package/dist/depth-preview-track-BvgwNEE9.js.map +1 -0
  5. package/dist/detections/chunked-detection-frame-source.d.ts.map +1 -1
  6. package/dist/editing.d.ts +1 -1
  7. package/dist/editing.d.ts.map +1 -1
  8. package/dist/index.d.ts +4 -2
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +9845 -4759
  11. package/dist/index.js.map +1 -1
  12. package/dist/mask-preparation.worker.js +788 -25
  13. package/dist/mask-preparation.worker.js.map +1 -1
  14. package/dist/media/decoder-deadline.d.ts +18 -0
  15. package/dist/media/decoder-deadline.d.ts.map +1 -0
  16. package/dist/media/depth-preview-probe.d.ts +65 -0
  17. package/dist/media/depth-preview-probe.d.ts.map +1 -0
  18. package/dist/media/depth-preview-track.d.ts +96 -0
  19. package/dist/media/depth-preview-track.d.ts.map +1 -0
  20. package/dist/media/media-normalization.d.ts.map +1 -1
  21. package/dist/media/media-source.d.ts +7 -0
  22. package/dist/media/media-source.d.ts.map +1 -1
  23. package/dist/media/mediabunny-frame-clock.d.ts +7 -0
  24. package/dist/media/mediabunny-frame-clock.d.ts.map +1 -0
  25. package/dist/media/mediabunny-media-source.d.ts +3 -0
  26. package/dist/media/mediabunny-media-source.d.ts.map +1 -1
  27. package/dist/media/track-frame-index.d.ts +14 -0
  28. package/dist/media/track-frame-index.d.ts.map +1 -0
  29. package/dist/media/video-engine-media-source.d.ts.map +1 -1
  30. package/dist/media/video-engine-media-source.js +1 -1
  31. package/dist/render-preparation/depth/clip-preview.d.ts +41 -0
  32. package/dist/render-preparation/depth/clip-preview.d.ts.map +1 -0
  33. package/dist/render-preparation/depth/clip-timing.d.ts +18 -0
  34. package/dist/render-preparation/depth/clip-timing.d.ts.map +1 -0
  35. package/dist/render-preparation/depth/clip.d.ts +14 -0
  36. package/dist/render-preparation/depth/clip.d.ts.map +1 -0
  37. package/dist/render-preparation/depth/exact-at-rest.d.ts +44 -0
  38. package/dist/render-preparation/depth/exact-at-rest.d.ts.map +1 -0
  39. package/dist/render-preparation/depth/exact-playback.d.ts +40 -0
  40. package/dist/render-preparation/depth/exact-playback.d.ts.map +1 -0
  41. package/dist/render-preparation/depth/files.d.ts +55 -0
  42. package/dist/render-preparation/depth/files.d.ts.map +1 -0
  43. package/dist/render-preparation/depth/frame-decode.d.ts +20 -0
  44. package/dist/render-preparation/depth/frame-decode.d.ts.map +1 -0
  45. package/dist/render-preparation/depth/frame-preparer.d.ts +51 -0
  46. package/dist/render-preparation/depth/frame-preparer.d.ts.map +1 -0
  47. package/dist/render-preparation/depth/frame-window.d.ts +146 -0
  48. package/dist/render-preparation/depth/frame-window.d.ts.map +1 -0
  49. package/dist/render-preparation/depth/options.d.ts +37 -0
  50. package/dist/render-preparation/depth/options.d.ts.map +1 -0
  51. package/dist/render-preparation/depth/png16.d.ts +40 -0
  52. package/dist/render-preparation/depth/png16.d.ts.map +1 -0
  53. package/dist/render-preparation/depth/preview-luma-copier.d.ts +12 -0
  54. package/dist/render-preparation/depth/preview-luma-copier.d.ts.map +1 -0
  55. package/dist/render-preparation/depth/preview-luma.d.ts +48 -0
  56. package/dist/render-preparation/depth/preview-luma.d.ts.map +1 -0
  57. package/dist/render-preparation/depth/source.d.ts +123 -0
  58. package/dist/render-preparation/depth/source.d.ts.map +1 -0
  59. package/dist/render-preparation/depth/worker-protocol.d.ts +76 -0
  60. package/dist/render-preparation/depth/worker-protocol.d.ts.map +1 -0
  61. package/dist/render-preparation/mask-frame-artifact.d.ts +10 -0
  62. package/dist/render-preparation/mask-frame-artifact.d.ts.map +1 -1
  63. package/dist/render-preparation/mask-frame-compositor.d.ts +2 -1
  64. package/dist/render-preparation/mask-frame-compositor.d.ts.map +1 -1
  65. package/dist/render-preparation/mask-frame-preparer.d.ts.map +1 -1
  66. package/dist/render-preparation/mask-outline-paths.d.ts +3 -0
  67. package/dist/render-preparation/mask-outline-paths.d.ts.map +1 -0
  68. package/dist/render-preparation/mask-preparation-worker-protocol.d.ts +2 -1
  69. package/dist/render-preparation/mask-preparation-worker-protocol.d.ts.map +1 -1
  70. package/dist/render-preparation/playhead-motion.d.ts +67 -0
  71. package/dist/render-preparation/playhead-motion.d.ts.map +1 -0
  72. package/dist/render-preparation/prepared-render-window.d.ts +12 -0
  73. package/dist/render-preparation/prepared-render-window.d.ts.map +1 -1
  74. package/dist/renderers/depth-textures.d.ts +79 -0
  75. package/dist/renderers/depth-textures.d.ts.map +1 -0
  76. package/dist/renderers/detection-render-order.d.ts +4 -0
  77. package/dist/renderers/detection-render-order.d.ts.map +1 -0
  78. package/dist/renderers/id-mask-stroke-coverage.d.ts +3 -0
  79. package/dist/renderers/id-mask-stroke-coverage.d.ts.map +1 -0
  80. package/dist/renderers/media-renderer-core.d.ts.map +1 -1
  81. package/dist/renderers/media-renderer-scene.d.ts +16 -2
  82. package/dist/renderers/media-renderer-scene.d.ts.map +1 -1
  83. package/dist/renderers/pixi-batch-texture-bindings.d.ts +9 -0
  84. package/dist/renderers/pixi-batch-texture-bindings.d.ts.map +1 -0
  85. package/dist/renderers/pixi-box-layer.d.ts +1 -0
  86. package/dist/renderers/pixi-box-layer.d.ts.map +1 -1
  87. package/dist/renderers/pixi-depth-layer.d.ts +76 -0
  88. package/dist/renderers/pixi-depth-layer.d.ts.map +1 -0
  89. package/dist/renderers/pixi-depth-shader.d.ts +76 -0
  90. package/dist/renderers/pixi-depth-shader.d.ts.map +1 -0
  91. package/dist/renderers/pixi-focus-layer.d.ts +1 -0
  92. package/dist/renderers/pixi-focus-layer.d.ts.map +1 -1
  93. package/dist/renderers/pixi-frame-present.d.ts +1 -0
  94. package/dist/renderers/pixi-frame-present.d.ts.map +1 -1
  95. package/dist/renderers/pixi-id-mask-shader.d.ts +1 -0
  96. package/dist/renderers/pixi-id-mask-shader.d.ts.map +1 -1
  97. package/dist/renderers/pixi-interaction-layer.d.ts +1 -1
  98. package/dist/renderers/pixi-interaction-layer.d.ts.map +1 -1
  99. package/dist/renderers/pixi-interaction-presentation-layer.d.ts +1 -0
  100. package/dist/renderers/pixi-interaction-presentation-layer.d.ts.map +1 -1
  101. package/dist/renderers/pixi-mask-brush-preview.d.ts.map +1 -1
  102. package/dist/renderers/pixi-mask-halo.d.ts +1 -0
  103. package/dist/renderers/pixi-mask-halo.d.ts.map +1 -1
  104. package/dist/renderers/pixi-mask-layer.d.ts +8 -2
  105. package/dist/renderers/pixi-mask-layer.d.ts.map +1 -1
  106. package/dist/renderers/pixi-mask-screen-stroke.d.ts +17 -0
  107. package/dist/renderers/pixi-mask-screen-stroke.d.ts.map +1 -0
  108. package/dist/renderers/pixi-media-scene.d.ts.map +1 -1
  109. package/dist/renderers/pixi-region-coverage-mask.d.ts +1 -0
  110. package/dist/renderers/pixi-region-coverage-mask.d.ts.map +1 -1
  111. package/dist/renderers/pixi-region-layer.d.ts +1 -0
  112. package/dist/renderers/pixi-region-layer.d.ts.map +1 -1
  113. package/dist/renderers/pixi-scene-layer-slot.d.ts +1 -0
  114. package/dist/renderers/pixi-scene-layer-slot.d.ts.map +1 -1
  115. package/dist/renderers/pixi-vector-layer.d.ts +1 -0
  116. package/dist/renderers/pixi-vector-layer.d.ts.map +1 -1
  117. package/dist/renderers/prepared-annotation-window.d.ts +1 -0
  118. package/dist/renderers/prepared-annotation-window.d.ts.map +1 -1
  119. package/dist/renderers/render-preparation-report.d.ts +23 -0
  120. package/dist/renderers/render-preparation-report.d.ts.map +1 -0
  121. package/dist/sessions/media-session-defaults.d.ts.map +1 -1
  122. package/dist/sessions/media-session-state.d.ts.map +1 -1
  123. package/dist/sessions/media-session.d.ts.map +1 -1
  124. package/dist/tracking.worker.js +64 -0
  125. package/dist/tracking.worker.js.map +1 -1
  126. package/dist/types/media-depth.d.ts +55 -0
  127. package/dist/types/media-depth.d.ts.map +1 -0
  128. package/dist/types/media-renderer.d.ts +33 -0
  129. package/dist/types/media-renderer.d.ts.map +1 -1
  130. package/dist/types/media-session.d.ts +21 -0
  131. package/dist/types/media-session.d.ts.map +1 -1
  132. package/dist/types/render-preparation.d.ts +105 -3
  133. package/dist/types/render-preparation.d.ts.map +1 -1
  134. package/dist/{video-engine-media-source-DR-x1UfK.js → video-engine-media-source-DOFsuGS4.js} +35 -29
  135. package/dist/video-engine-media-source-DOFsuGS4.js.map +1 -0
  136. package/dist/web-video-engine/analysis.js +6 -43
  137. package/dist/web-video-engine/cache-budget.d.ts +4 -7
  138. package/dist/web-video-engine/constants.d.ts +3 -4
  139. package/dist/web-video-engine/create-scrub-cursor.d.ts +1 -0
  140. package/dist/web-video-engine/decode-resolution-fynpRIAG.js +109 -0
  141. package/dist/web-video-engine/decode-scheduler.d.ts +1 -0
  142. package/dist/web-video-engine/engine-core.d.ts +4 -2
  143. package/dist/web-video-engine/engine.js +8 -6
  144. package/dist/web-video-engine/engine.worker.js +164 -66
  145. package/dist/web-video-engine/frame-cache.d.ts +9 -0
  146. package/dist/web-video-engine/frame-index.d.ts +1 -0
  147. package/dist/web-video-engine/frame-index.js +97 -0
  148. package/dist/web-video-engine/{frame-timeline-DreEwsRY.js → frame-timeline-CYgzzmpA.js} +1 -109
  149. package/dist/web-video-engine/frame-timeline-reader.d.ts +21 -0
  150. package/dist/web-video-engine/video-engine.d.ts +9 -4
  151. package/node_modules/supervision-js-core/THIRD_PARTY_NOTICES.md +132 -0
  152. package/node_modules/supervision-js-core/dist/detections/buffered-detection-timeline.d.ts.map +1 -1
  153. package/node_modules/supervision-js-core/dist/index.d.ts +8 -3
  154. package/node_modules/supervision-js-core/dist/index.d.ts.map +1 -1
  155. package/node_modules/supervision-js-core/dist/index.js +1172 -70
  156. package/node_modules/supervision-js-core/dist/index.js.map +1 -1
  157. package/node_modules/supervision-js-core/dist/interactions/annotation-editing-engine.d.ts +2 -2
  158. package/node_modules/supervision-js-core/dist/interactions/annotation-editing-engine.d.ts.map +1 -1
  159. package/node_modules/supervision-js-core/dist/interactions/annotation-handles.d.ts +2 -2
  160. package/node_modules/supervision-js-core/dist/interactions/annotation-handles.d.ts.map +1 -1
  161. package/node_modules/supervision-js-core/dist/interactions/detection-picker.d.ts.map +1 -1
  162. package/node_modules/supervision-js-core/dist/interactions/viewport-controller.d.ts.map +1 -1
  163. package/node_modules/supervision-js-core/dist/styles/annotation-renderer-presentation.d.ts.map +1 -1
  164. package/node_modules/supervision-js-core/dist/styles/annotation-renderer-registry.d.ts.map +1 -1
  165. package/node_modules/supervision-js-core/dist/types/annotation-renderer.d.ts +50 -3
  166. package/node_modules/supervision-js-core/dist/types/annotation-renderer.d.ts.map +1 -1
  167. package/node_modules/supervision-js-core/dist/types/depth-map.d.ts +203 -0
  168. package/node_modules/supervision-js-core/dist/types/depth-map.d.ts.map +1 -0
  169. package/node_modules/supervision-js-core/dist/types/detections.d.ts +2 -1
  170. package/node_modules/supervision-js-core/dist/types/detections.d.ts.map +1 -1
  171. package/node_modules/supervision-js-core/dist/types/editing.d.ts +9 -0
  172. package/node_modules/supervision-js-core/dist/types/editing.d.ts.map +1 -1
  173. package/node_modules/supervision-js-core/dist/types/interaction.d.ts +4 -0
  174. package/node_modules/supervision-js-core/dist/types/interaction.d.ts.map +1 -1
  175. package/node_modules/supervision-js-core/dist/types/mask-style.d.ts +3 -0
  176. package/node_modules/supervision-js-core/dist/types/mask-style.d.ts.map +1 -1
  177. package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts +3 -0
  178. package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts.map +1 -1
  179. package/node_modules/supervision-js-core/dist/types/viewport.d.ts +3 -0
  180. package/node_modules/supervision-js-core/dist/types/viewport.d.ts.map +1 -1
  181. package/node_modules/supervision-js-core/dist/utils/depth-color-mapping.d.ts +91 -0
  182. package/node_modules/supervision-js-core/dist/utils/depth-color-mapping.d.ts.map +1 -0
  183. package/node_modules/supervision-js-core/dist/utils/depth-colormap-tables.d.ts +30 -0
  184. package/node_modules/supervision-js-core/dist/utils/depth-colormap-tables.d.ts.map +1 -0
  185. package/node_modules/supervision-js-core/dist/utils/depth-colormaps.d.ts +16 -0
  186. package/node_modules/supervision-js-core/dist/utils/depth-colormaps.d.ts.map +1 -0
  187. package/node_modules/supervision-js-core/dist/utils/depth-manifest.d.ts +23 -0
  188. package/node_modules/supervision-js-core/dist/utils/depth-manifest.d.ts.map +1 -0
  189. package/node_modules/supervision-js-core/dist/utils/depth-readout.d.ts +14 -0
  190. package/node_modules/supervision-js-core/dist/utils/depth-readout.d.ts.map +1 -0
  191. package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts +21 -0
  192. package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts.map +1 -1
  193. package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts +3 -7
  194. package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts.map +1 -1
  195. package/node_modules/supervision-js-core/package.json +2 -1
  196. package/package.json +6 -1
  197. package/dist/video-engine-media-source-DR-x1UfK.js.map +0 -1
@@ -0,0 +1,18 @@
1
+ export interface DecoderDeadlinePage {
2
+ readonly visibilityState: DocumentVisibilityState;
3
+ addEventListener(type: "visibilitychange", listener: () => void): void;
4
+ removeEventListener(type: "visibilitychange", listener: () => void): void;
5
+ }
6
+ /**
7
+ * Waits for one step of a video decoder, which answers in milliseconds when
8
+ * it works and may never answer when it does not. Rejects with a
9
+ * `TimeoutError` naming the step once `milliseconds` pass; the step itself
10
+ * carries on, and its owner closes the decoder.
11
+ *
12
+ * The budget runs only while the page is visible: a browser may hold a
13
+ * hidden page's decoder work back, and a step that waited on that is no
14
+ * broken decoder.
15
+ */
16
+ export declare function withinDecoderDeadline<T>(step: Promise<T>, milliseconds: number, what: string, page?: DecoderDeadlinePage | undefined): Promise<T>;
17
+ export declare function formatSeconds(milliseconds: number): string;
18
+ //# sourceMappingURL=decoder-deadline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decoder-deadline.d.ts","sourceRoot":"","sources":["../../src/media/decoder-deadline.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,eAAe,EAAE,uBAAuB,CAAC;IAClD,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACvE,mBAAmB,CAAC,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,mBAAmB,GAAG,SAElB,GACT,OAAO,CAAC,CAAC,CAAC,CAkDZ;AAED,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE1D"}
@@ -0,0 +1,65 @@
1
+ import type { DepthPreviewLevels } from "supervision-js-core";
2
+ import { type DepthPreviewLumaPath, type DepthPreviewTrackReader, type DepthPreviewTrackInput } from "./depth-preview-track";
3
+ /**
4
+ * How long one decoder may take to return the probe's first frame. The clip
5
+ * is in memory, so this is decoder time alone; a decoder that works takes a
6
+ * few milliseconds.
7
+ */
8
+ export declare const PROBE_DECODE_MILLISECONDS = 5000;
9
+ /** What a browser's decoder did to the codes a producer wrote. */
10
+ export interface DepthPreviewCodeProbe {
11
+ /** Every judged code came back exactly as written. */
12
+ readonly exact: boolean;
13
+ /** Codes judged: 256 at full levels, the 220 from 16 to 235 at TV levels. */
14
+ readonly judgedCodes: number;
15
+ readonly mismatchedCodes: number;
16
+ readonly maxError: number;
17
+ /** The code read back for each written code, indexed by the written one. */
18
+ readonly decoded: Uint8Array;
19
+ readonly lumaPath: DepthPreviewLumaPath | null;
20
+ }
21
+ export interface DepthPreviewDecoderVerdict {
22
+ readonly hardwareAcceleration: HardwareAcceleration;
23
+ readonly supported: boolean;
24
+ readonly probe: DepthPreviewCodeProbe | null;
25
+ readonly error?: string;
26
+ }
27
+ /** How this page decodes depth previews, chosen once by probing. */
28
+ export interface DepthPreviewDecoding {
29
+ readonly hardwareAcceleration: HardwareAcceleration;
30
+ /**
31
+ * The probe through the chosen decoder, before any correction; null when
32
+ * no decoder returned a frame of it, and a preview would not decode either.
33
+ */
34
+ readonly probe: DepthPreviewCodeProbe | null;
35
+ /**
36
+ * Maps a code read back to the code written, when the chosen decoder
37
+ * changes codes and the table brings them closer; null when it does not.
38
+ */
39
+ readonly correction: Uint8Array | null;
40
+ /** Largest error left after the correction, in codes. */
41
+ readonly residualError: number;
42
+ readonly verdicts: readonly DepthPreviewDecoderVerdict[];
43
+ }
44
+ type OpenTrack = (input: DepthPreviewTrackInput, options?: {
45
+ readonly hardwareAcceleration?: HardwareAcceleration;
46
+ }) => Promise<DepthPreviewTrackReader>;
47
+ /**
48
+ * Decodes a clip of known codes, written at the preview's levels, through
49
+ * each decoder the page offers in the same path a depth preview takes, and
50
+ * keeps the first that returns them as written, directly or through a
51
+ * table that undoes a conversion it makes. Without one, it picks the
52
+ * closest. Run once per page and level: the answer is a property of the
53
+ * browser, not of any one preview. Probes run one after another, so the
54
+ * page never holds two of their decoders.
55
+ */
56
+ export declare function chooseDepthPreviewDecoding(levels?: DepthPreviewLevels, open?: OpenTrack, isSupported?: (preference: HardwareAcceleration) => Promise<boolean>): Promise<DepthPreviewDecoding>;
57
+ export declare function depthPreviewProbeBytes(levels?: DepthPreviewLevels): Uint8Array;
58
+ /**
59
+ * For each code a decoder can return, the written code from `firstCode` to
60
+ * `lastCode` it most likely came from: the one whose read-back value is
61
+ * nearest, the nearest written code on a tie.
62
+ */
63
+ export declare function createCodeCorrection(decoded: Uint8Array, firstCode?: number, lastCode?: number): Uint8Array;
64
+ export {};
65
+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,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,SAAS,0BAA0B,EAAE,CAAC;CAC1D;AAED,KAAK,SAAS,GAAG,CACf,KAAK,EAAE,sBAAsB,EAC7B,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;CAAE,KAC/D,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAOtC;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,GAAE,kBAA2B,EACnC,IAAI,GAAE,SAAiC,EACvC,WAAW,GAAE,CACX,UAAU,EAAE,oBAAoB,KAC7B,OAAO,CAAC,OAAO,CAA0B,GAC7C,OAAO,CAAC,oBAAoB,CAAC,CAY/B;AAED,wBAAgB,sBAAsB,CACpC,MAAM,GAAE,kBAA2B,GAClC,UAAU,CASZ;AAkID;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,UAAU,EACnB,SAAS,SAAI,EACb,QAAQ,SAAM,GACb,UAAU,CAuBZ"}
@@ -0,0 +1,96 @@
1
+ import type { EncodedPacket } from "mediabunny";
2
+ import { type DepthPreviewLumaCopier, type DepthPreviewLumaPath } from "#render-preparation/depth/preview-luma";
3
+ import { type TrackFrameIndex } from "./track-frame-index";
4
+ /** How long the browser may take to say whether it decodes the preview. */
5
+ export declare const DECODER_SUPPORT_MILLISECONDS = 3000;
6
+ export type DepthPreviewTrackInput = string | URL | ArrayBuffer | Uint8Array;
7
+ export interface DepthPreviewTrackOptions {
8
+ /** Defaults to the browser's own choice. */
9
+ readonly hardwareAcceleration?: HardwareAcceleration;
10
+ /**
11
+ * Maps each code the decoder returns to the code written, for a decoder
12
+ * known to change them.
13
+ */
14
+ readonly correction?: Uint8Array | null;
15
+ /**
16
+ * Copies decoded frames' luma out: the render-preparation worker's, to
17
+ * keep the copies off the page. Defaults to copying on the page.
18
+ */
19
+ readonly copier?: DepthPreviewLumaCopier;
20
+ /** Stops opening: the container's reads are cancelled. */
21
+ readonly signal?: AbortSignal;
22
+ }
23
+ export type { DepthPreviewLumaPath };
24
+ /** One decoded preview frame's luma, one byte per map pixel. */
25
+ export interface DepthPreviewLumaFrame {
26
+ /** Frame index on the preview's own timeline, in presentation order. */
27
+ readonly index: number;
28
+ readonly luma: Uint8Array;
29
+ readonly width: number;
30
+ readonly height: number;
31
+ }
32
+ /** One pass of decoding, from a key frame forward. */
33
+ export interface DepthPreviewDecodeRun {
34
+ /**
35
+ * The next decoded frame, or null once the track has ended or the run was
36
+ * cancelled. Frames arrive in the decoder's output order, which is
37
+ * presentation order except on browsers that reorder late.
38
+ */
39
+ next(): Promise<DepthPreviewLumaFrame | null>;
40
+ cancel(): void;
41
+ }
42
+ export interface DepthPreviewDecodeOptions {
43
+ /** Frames this answers false for are closed without copying their pixels. */
44
+ readonly keep?: (index: number) => boolean;
45
+ }
46
+ /**
47
+ * The 8-bit preview video of a depth clip, decoded to luma codes.
48
+ *
49
+ * It holds one `VideoDecoder` for its whole life and resets it for each new
50
+ * run, so a seek or a drag never has two of its decoders alive at once,
51
+ * however slowly the browser tears an old one down.
52
+ */
53
+ export interface DepthPreviewTrackReader {
54
+ readonly width: number;
55
+ readonly height: number;
56
+ readonly frameCount: number;
57
+ /** Frame start times, in seconds from the preview's first frame. */
58
+ readonly times: Float64Array;
59
+ keyIndexAtOrBefore(index: number): number;
60
+ /**
61
+ * Starts decoding at the key frame at or before `fromIndex`. The run
62
+ * replaces the previous one, whose `next` answers null from then on.
63
+ */
64
+ decode(fromIndex: number, options?: DepthPreviewDecodeOptions): DepthPreviewDecodeRun;
65
+ /** How decoded frames reached their codes; null before the first. */
66
+ lumaPath(): DepthPreviewLumaPath | null;
67
+ dispose(): void;
68
+ }
69
+ /**
70
+ * Opens a depth preview video: an 8-bit grayscale H.264 whose luma codes are
71
+ * depth. Mediabunny is loaded on first use, so a page without a preview never
72
+ * downloads it.
73
+ */
74
+ export declare function openDepthPreviewTrack(input: DepthPreviewTrackInput, options?: DepthPreviewTrackOptions): Promise<DepthPreviewTrackReader>;
75
+ interface PacketReader {
76
+ getKeyPacket(timestamp: number, options: {
77
+ verifyKeyPackets: boolean;
78
+ }): Promise<EncodedPacket | null>;
79
+ getFirstKeyPacket(options: {
80
+ verifyKeyPackets: boolean;
81
+ }): Promise<EncodedPacket | null>;
82
+ packets(start?: EncodedPacket, end?: EncodedPacket): AsyncGenerator<EncodedPacket, void, unknown>;
83
+ }
84
+ /** The decoding half, apart from the container so it can be driven directly. */
85
+ export declare function createDepthPreviewTrackReader(options: {
86
+ readonly config: VideoDecoderConfig;
87
+ readonly copier?: DepthPreviewLumaCopier;
88
+ readonly correction?: Uint8Array | null;
89
+ readonly packetSink: PacketReader;
90
+ readonly timeline: TrackFrameIndex;
91
+ readonly width: number;
92
+ readonly height: number;
93
+ readonly dispose?: () => void;
94
+ readonly VideoDecoder?: typeof VideoDecoder;
95
+ }): DepthPreviewTrackReader;
96
+ //# sourceMappingURL=depth-preview-track.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depth-preview-track.d.ts","sourceRoot":"","sources":["../../src/media/depth-preview-track.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAKhD,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAC1B,MAAM,wCAAwC,CAAC;AAGhD,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA2BhF,2EAA2E;AAC3E,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAGjD,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,GAAG,GAAG,WAAW,GAAG,UAAU,CAAC;AAE7E,MAAM,WAAW,wBAAwB;IACvC,4CAA4C;IAC5C,QAAQ,CAAC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IACrD;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IACxC;;;OA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AC5B,2BAA2B,EAC3B,qBAAqB,EACrB,4BAA4B,EAC5B,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACpC,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,0BAA0B,GAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAUhD,wBAAsB,cAAc,CAClC,MAAM,EAAE,IAAI,EACZ,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,eAAe,CAAC,CAkG1B;AAED,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,IAAI,EACZ,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,0BAA0B,CAAC,CA8IrC"}
1
+ {"version":3,"file":"media-normalization.d.ts","sourceRoot":"","sources":["../../src/media/media-normalization.ts"],"names":[],"mappings":"AAUA,OAAO,EAML,KAAK,yBAAyB,EAE9B,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAChC,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,qBAAqB,EACrB,4BAA4B,EAC5B,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACpC,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,0BAA0B,GAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAUhD,wBAAsB,cAAc,CAClC,MAAM,EAAE,IAAI,EACZ,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,eAAe,CAAC,CAkG1B;AAED,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,IAAI,EACZ,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,0BAA0B,CAAC,CAgJrC"}
@@ -59,5 +59,12 @@ export interface DecodedMediaSource {
59
59
  readonly engine?: PresentedFrameChannel;
60
60
  /** Exact timing when the source already owns a presentation frame index. */
61
61
  readonly frameClock?: MediaFrameClock;
62
+ /**
63
+ * Reads the frame index on first call and reuses it after, for a source
64
+ * that can read one but does not keep it.
65
+ */
66
+ readonly readFrameClock?: () => Promise<MediaFrameClock>;
67
+ /** Why this source has no frame index, for whatever asked for one. */
68
+ readonly frameClockUnavailableReason?: string;
62
69
  }
63
70
  //# sourceMappingURL=media-source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"media-source.d.ts","sourceRoot":"","sources":["../../src/media/media-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,IAAI,CACF,OAAO,EAAE,wBAAwB,GAAG,iCAAiC,EACrE,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAAC;IACR,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,CACP,SAAS,EAA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AE,MAAM,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9C;AAED,MAAM,WAAW,kBAAkB;IACjC,kGAAkG;IAClG,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1E,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;IAC9C,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAC;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC;IACxC,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;IACzD,sEAAsE;IACtE,QAAQ,CAAC,2BAA2B,CAAC,EAAE,MAAM,CAAC;CAC/C"}
@@ -0,0 +1,7 @@
1
+ import type { MediaFrameClock } from "#types/media-frame-clock";
2
+ /**
3
+ * Read by the same packet walk the web video engine uses, so a depth clip
4
+ * pairs frames on this path exactly as it does on the engine's.
5
+ */
6
+ export declare function readMediabunnyFrameClock(track: unknown): Promise<MediaFrameClock>;
7
+ //# sourceMappingURL=mediabunny-frame-clock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediabunny-frame-clock.d.ts","sourceRoot":"","sources":["../../src/media/mediabunny-frame-clock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,eAAe,CAAC,CAI1B"}
@@ -7,6 +7,9 @@ export interface MediabunnyMediaSourceInput {
7
7
  readonly duration?: number | null;
8
8
  };
9
9
  readonly source: Source;
10
+ /** Set when the source cannot be indexed yet, such as a file still being
11
+ * written. */
12
+ readonly frameClockUnavailableReason?: string;
10
13
  }
11
14
  export declare function openMediabunnyMediaSource(sourceInput: string | URL | Request | MediabunnyMediaSourceInput): Promise<DecodedMediaSource>;
12
15
  export declare function createMediabunnyMediaRendererSource(sourceInput: MediabunnyMediaSourceInput): MediaRendererSource;
@@ -1 +1 @@
1
- {"version":3,"file":"mediabunny-media-source.d.ts","sourceRoot":"","sources":["../../src/media/mediabunny-media-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACnC,CAAC;IACF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAID,wBAAsB,yBAAyB,CAC7C,WAAW,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,GAAG,0BAA0B,GAC/D,OAAO,CAAC,kBAAkB,CAAC,CA6G7B;AAkCD,wBAAgB,mCAAmC,CACjD,WAAW,EAAE,0BAA0B,GACtC,mBAAmB,CAMrB"}
1
+ {"version":3,"file":"mediabunny-media-source.d.ts","sourceRoot":"","sources":["../../src/media/mediabunny-media-source.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACnC,CAAC;IACF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;mBACe;IACf,QAAQ,CAAC,2BAA2B,CAAC,EAAE,MAAM,CAAC;CAC/C;AAID,wBAAsB,yBAAyB,CAC7C,WAAW,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,GAAG,0BAA0B,GAC/D,OAAO,CAAC,kBAAkB,CAAC,CA+H7B;AAkCD,wBAAgB,mCAAmC,CACjD,WAAW,EAAE,0BAA0B,GACtC,mBAAmB,CAMrB"}
@@ -0,0 +1,14 @@
1
+ export interface TrackFrameIndex {
2
+ /** Seconds from the first presented frame. */
3
+ readonly times: Float64Array;
4
+ /** Container presentation times in seconds, which packets are found by. */
5
+ readonly sourceTimes: Float64Array;
6
+ /** Presentation indices of key frames, ascending. */
7
+ readonly keyIndices: Int32Array;
8
+ }
9
+ /**
10
+ * Read by the same packet walk the web video engine uses, so a track decoded
11
+ * beside the media and the media itself agree on every frame.
12
+ */
13
+ export declare function readTrackFrameIndex(track: unknown): Promise<TrackFrameIndex>;
14
+ //# sourceMappingURL=track-frame-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"track-frame-index.d.ts","sourceRoot":"","sources":["../../src/media/track-frame-index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC;IACnC,qDAAqD;IACrD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,eAAe,CAAC,CAgB1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"video-engine-media-source.d.ts","sourceRoot":"","sources":["../../src/media/video-engine-media-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAInB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EACV,eAAe,EACf,wBAAwB,EACxB,2BAA2B,EAE3B,cAAc,EACd,cAAc,EACd,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAqB3B,MAAM,WAAW,gCAAiC,SAAQ,IAAI,CAC5D,qBAAqB,EACrB,cAAc,GAAG,QAAQ,CAC1B;IACC;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,eAAe,CAAC;IAClD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,2BAA2B,CAAC;IAC/C;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,wBAAwB,CAAC;CACzD;AAED,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;IACnE;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,qBAAqB,CAAC;CACzD;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,gCAAgC,GACxC,OAAO,CAAC,yBAAyB,CAAC,CAoDpC;AAwDD,wBAAgB,uCAAuC,CACrD,OAAO,EAAE,gCAAgC,GACxC,mBAAmB,CAMrB"}
1
+ {"version":3,"file":"video-engine-media-source.d.ts","sourceRoot":"","sources":["../../src/media/video-engine-media-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAInB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EACV,eAAe,EACf,wBAAwB,EACxB,2BAA2B,EAE3B,cAAc,EACd,cAAc,EACd,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAqB3B,MAAM,WAAW,gCAAiC,SAAQ,IAAI,CAC5D,qBAAqB,EACrB,cAAc,GAAG,QAAQ,CAC1B;IACC;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,eAAe,CAAC;IAClD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,2BAA2B,CAAC;IAC/C;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,wBAAwB,CAAC;CACzD;AAED,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;IACnE;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,qBAAqB,CAAC;CACzD;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,gCAAgC,GACxC,OAAO,CAAC,yBAAyB,CAAC,CA6DpC;AAwDD,wBAAgB,uCAAuC,CACrD,OAAO,EAAE,gCAAgC,GACxC,mBAAmB,CAMrB"}
@@ -1,3 +1,3 @@
1
- export { c as createWebVideoEngineMediaRendererSource, o as openWebVideoEngineMediaSource } from '../video-engine-media-source-DR-x1UfK.js';
1
+ export { a as createWebVideoEngineMediaRendererSource, o as openWebVideoEngineMediaSource } from '../video-engine-media-source-DOFsuGS4.js';
2
2
  import 'supervision-js-core';
3
3
  //# sourceMappingURL=video-engine-media-source.js.map
@@ -0,0 +1,41 @@
1
+ import { type DepthManifest } from "supervision-js-core";
2
+ import type { DepthPreviewDecoding } from "#media/depth-preview-probe";
3
+ import type { DepthPreviewTrackReader } from "#media/depth-preview-track";
4
+ import type { DepthPreviewLumaCopier } from "./preview-luma";
5
+ import type { DepthSourceContext } from "./source";
6
+ export interface OpenedClipPreview {
7
+ readonly reader: DepthPreviewTrackReader;
8
+ /** What copies decoded frames' codes out, when not the page itself. */
9
+ readonly copier: DepthPreviewLumaCopier | undefined;
10
+ readonly track: NonNullable<DepthManifest["preview"]>;
11
+ /** What diagnostics say about the preview, such as altered codes. */
12
+ readonly message: string | null;
13
+ }
14
+ export interface ClipPreview {
15
+ readonly preview: OpenedClipPreview | null;
16
+ /** Why a clip with a preview draws none; else null. */
17
+ readonly unavailable: string | null;
18
+ }
19
+ /**
20
+ * Opens the clip's preview video and checks it against the media it is
21
+ * drawn over: one preview frame per depth frame, each at its video frame's
22
+ * time. A preview that disagrees is refused with a `RangeError`. One this
23
+ * browser cannot open or decode leaves the clip without it, and says why
24
+ * once in the console and in diagnostics.
25
+ */
26
+ export declare function openClipPreview(manifest: DepthManifest, base: string | URL | undefined, context: DepthSourceContext, frameCount: number, timeAt: (index: number) => number): Promise<ClipPreview>;
27
+ /**
28
+ * What diagnostics say about the page's preview decoder: nothing when its
29
+ * codes come back as written, directly or through the probe's table.
30
+ */
31
+ export declare function describePreviewDecoding(decoding: DepthPreviewDecoding | null): string | null;
32
+ /**
33
+ * Refuses a preview whose frames are not the depth frames, one for one, at
34
+ * the same times. Each timeline is measured from its own first frame, so a
35
+ * preview that starts its clock elsewhere still lines up.
36
+ */
37
+ export declare function assertDepthPreviewTimeline(preview: {
38
+ readonly frameCount: number;
39
+ readonly times: Float64Array;
40
+ }, count: number, expectedTime: (index: number) => number): void;
41
+ //# sourceMappingURL=clip-preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clip-preview.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/clip-preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,4BAA4B,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tC,IAAI,CAoBN"}
@@ -0,0 +1,18 @@
1
+ import { type DepthClipFrames } from "supervision-js-core";
2
+ import type { MediaFrameClock } from "#types/media-frame-clock";
3
+ /** Where each depth frame of a clip sits on the media timeline. */
4
+ export interface DepthClipTiming {
5
+ readonly frameCount: number;
6
+ /** Depth frames per second, over the whole clip. */
7
+ readonly frameRate: number;
8
+ /** The depth frame drawn over `mediaTime`, or null before the first. */
9
+ indexAt(mediaTime: number): number | null;
10
+ timeAt(index: number): number;
11
+ endAt(index: number): number;
12
+ }
13
+ /**
14
+ * Pairs depth frames with the media's frames: one for one by index, or by
15
+ * `frames.times_s` when depth covers only some of them.
16
+ */
17
+ export declare function createDepthClipTiming(clock: MediaFrameClock, frames: DepthClipFrames): DepthClipTiming;
18
+ //# sourceMappingURL=clip-timing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clip-timing.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/clip-timing.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,oDAAoD;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,wEAAwE;IACxE,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC1C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,eAAe,GACtB,eAAe,CAuCjB"}
@@ -0,0 +1,14 @@
1
+ import type { DepthClipFrames, DepthManifest } from "supervision-js-core";
2
+ import type { DepthFrameProvider, DepthSourceContext } from "./source";
3
+ /**
4
+ * A clip's depth: exact 16-bit PNGs, one per frame, and an optional 8-bit
5
+ * preview video.
6
+ *
7
+ * While playback runs, the preview or the exact frame for the video frame on
8
+ * screen is drawn, loaded ahead of the playhead; a frame not loaded yet draws
9
+ * no depth, never another frame's. Once playback has rested, the exact frame
10
+ * on screen replaces it. A frame that lands for the frame on screen asks for
11
+ * one redraw.
12
+ */
13
+ export declare function openDepthClip(manifest: DepthManifest, frames: DepthClipFrames, base: string | URL | undefined, context: DepthSourceContext): Promise<DepthFrameProvider>;
14
+ //# sourceMappingURL=clip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clip.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/clip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EAEd,MAAM,qBAAqB,CAAC;AAY7B,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAIlB;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,EAC9B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CAic7B"}
@@ -0,0 +1,44 @@
1
+ import type { DepthMap } from "supervision-js-core";
2
+ import { type RenderPreparationArtifactDiagnostics } from "#types/render-preparation";
3
+ import type { DepthClipOptions } from "./options";
4
+ /** A clip's exact frames around the frame at rest. */
5
+ export interface ExactFramesAtRest {
6
+ get(index: number): DepthMap | undefined;
7
+ /**
8
+ * The playhead rests on `center`: once it has for `settleSeconds`, that
9
+ * frame loads, then its neighbours nearest first, most of them the way the
10
+ * playhead last moved, so a step lands on a frame already loaded. A later
11
+ * call or `cancel` starts none of the frames not yet asked for; a frame
12
+ * already loading finishes and is kept.
13
+ */
14
+ settleOn(center: number): void;
15
+ cancel(): void;
16
+ /** Resolves once frame `index` is in, or `signal` aborts. */
17
+ landing(index: number, signal?: AbortSignal): Promise<void>;
18
+ diagnostics(): RenderPreparationArtifactDiagnostics;
19
+ destroy(): void;
20
+ }
21
+ /**
22
+ * Loads each frame once; a second ask shares the first. Frames are kept up
23
+ * to `maxCacheBytes`, dropping the ones farthest from the frame on screen
24
+ * first.
25
+ */
26
+ export declare function createExactFramesAtRest(options: {
27
+ readonly frameCount: number;
28
+ readonly exactFrameBytes: number;
29
+ readonly options: DepthClipOptions["exact"];
30
+ readonly load: (index: number, signal: AbortSignal) => Promise<DepthMap>;
31
+ /** A frame exact playback already holds, kept here without a second load. */
32
+ readonly loadedAhead: (index: number) => DepthMap | null;
33
+ /** Loads run at once: one per decode worker. */
34
+ readonly concurrency: () => number;
35
+ readonly onScreen: () => number | null;
36
+ /** Which way the playhead last moved. */
37
+ readonly heading: () => -1 | 0 | 1;
38
+ readonly timeAt: (index: number) => number;
39
+ readonly onLanded: (index: number) => void;
40
+ readonly onChange: () => void;
41
+ /** What a frame that does not load leaves on screen, for its warning. */
42
+ readonly stillDrawn: string;
43
+ }): ExactFramesAtRest;
44
+ //# sourceMappingURL=exact-at-rest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exact-at-rest.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/exact-at-rest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAGL,KAAK,oCAAoC,EAC1C,MAAM,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,sDAAsD;AACtD,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzC;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,C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from "#types/render-preparation";
3
+ import type { DepthClipTiming } from "./clip-timing";
4
+ import { type DepthFrameWindow } from "./frame-window";
5
+ import type { DepthClipOptions } from "./options";
6
+ /** Exact frames loaded ahead of playback, and whether they are what plays. */
7
+ export interface ExactPlayback {
8
+ readonly window: DepthFrameWindow;
9
+ /** Whether exact depth plays now. */
10
+ readonly drawn: boolean;
11
+ /**
12
+ * Whether exact depth plays the frame at `index`. In "auto" this is where
13
+ * it takes over once its lead reaches three quarters of what it loads
14
+ * ahead, and hands back to the preview when that lead falls under a
15
+ * quarter or the frame is missing, waiting longer each time before it
16
+ * tries again; a stretch of steady exact playback earns the short wait
17
+ * back.
18
+ */
19
+ playsAt(index: number): boolean;
20
+ /** Playback starts, or resumes after a drag: "auto" opens on the preview. */
21
+ restart(): void;
22
+ }
23
+ export declare function createExactPlayback(options: {
24
+ readonly source: Exclude<DepthPlaybackSource, "preview">;
25
+ /**
26
+ * Whether a preview can stand in for exact depth; false once its decoder
27
+ * stops.
28
+ */
29
+ readonly hasPreview: () => boolean;
30
+ readonly timing: DepthClipTiming;
31
+ readonly exactFrameBytes: number;
32
+ readonly budgets: DepthClipOptions;
33
+ readonly load: (index: number, signal: AbortSignal) => Promise<DepthMap>;
34
+ readonly concurrency: () => number;
35
+ readonly looping: () => boolean;
36
+ /** A frame landed for `index`, while exact depth plays. */
37
+ readonly onFrame: (index: number) => void;
38
+ readonly onChange: () => void;
39
+ }): ExactPlayback;
40
+ //# sourceMappingURL=exact-playback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exact-playback.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/exact-playback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAYlD,8EAA8E;AAC9E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,qCAAqC;IACrC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,6EAA6E;IAC7E,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAC3C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC;IACzD;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,OAAO,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzE,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC;IAChC,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAC/B,GAAG,aAAa,CA4GhB"}
@@ -0,0 +1,55 @@
1
+ import { type DepthClipFrames, type DepthManifest, type DepthMap } from "supervision-js-core";
2
+ import type { MediaRendererDepthInput } from "#types/media-depth";
3
+ import type { DepthSourceContext } from "./source";
4
+ /** The files of one depth map: the 16-bit depth PNG and its confidence. */
5
+ export interface DepthMapFiles {
6
+ readonly file: string;
7
+ readonly confidenceFile?: string;
8
+ }
9
+ type ManifestInput = Extract<MediaRendererDepthInput, {
10
+ manifest: unknown;
11
+ }>;
12
+ /**
13
+ * Fetches and parses a manifest URL, or checks one passed parsed. Relative
14
+ * files resolve against the manifest's URL, or against `baseUrl` for a
15
+ * manifest passed already parsed.
16
+ */
17
+ export declare function loadDepthManifest(input: ManifestInput, context: DepthSourceContext): Promise<{
18
+ manifest: DepthManifest;
19
+ base: string | URL | undefined;
20
+ }>;
21
+ export declare function clipFrameFiles(frames: DepthClipFrames, index: number): DepthMapFiles;
22
+ /** Bytes a decoded exact map holds, its confidence plane included. */
23
+ export declare function exactMapBytes(map: DepthMap): number;
24
+ /**
25
+ * Fetches and decodes one depth PNG, and its confidence plane, into a map.
26
+ * The decode runs in the render-preparation worker when there is one.
27
+ */
28
+ export declare function loadDepthMap(manifest: DepthManifest, files: DepthMapFiles, base: string | URL | undefined, context: DepthSourceContext, signal: AbortSignal | undefined): Promise<DepthMap>;
29
+ /**
30
+ * The whole factor a map can shrink by for upload and still have a texel
31
+ * for every pixel of the box it is shown in, at the box's pixel ratio; 1
32
+ * without a box.
33
+ */
34
+ export declare function displayDecimation(map: {
35
+ readonly width: number;
36
+ readonly height: number;
37
+ }, context: Pick<DepthSourceContext, "display" | "media">): number;
38
+ /**
39
+ * Resolves `file` against `base`, itself resolved against the page. Without
40
+ * a page (a worker, a test), a relative base still joins by path.
41
+ */
42
+ export declare function resolveUrl(file: string, base: string | URL | undefined): string;
43
+ /**
44
+ * The map is stretched over the media rectangle, so a map of another shape
45
+ * would put depth beside the pixels it measures.
46
+ */
47
+ export declare function assertMediaAspect(map: {
48
+ readonly width: number;
49
+ readonly height: number;
50
+ }, media: {
51
+ readonly width: number;
52
+ readonly height: number;
53
+ }): void;
54
+ export {};
55
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src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M,CAAA;CAAE,EACxD,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,OAAO,CAAC,GACrD,MAAM,CAkBR;AA8BD;;;GAGG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAC7B,MAAM,CAiBR;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACxD,KAAK,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzD,IAAI,CAgBN"}
@@ -0,0 +1,20 @@
1
+ import { type DecimatedDepthUpload, type DepthPreparationWorkerRequest, type DepthPreparationWorkerResponse } from "./worker-protocol";
2
+ /**
3
+ * Answers one decode request, in the worker or on the main thread: the reply
4
+ * and the buffers it can transfer. A file that does not decode is an error
5
+ * reply, never a thrown exception, so the caller can tell a bad file from a
6
+ * broken worker.
7
+ */
8
+ export declare function decodeDepthPreparationRequest(request: Omit<DepthPreparationWorkerRequest, "requestId"> & {
9
+ readonly requestId?: number;
10
+ }): Promise<{
11
+ readonly response: DepthPreparationWorkerResponse;
12
+ readonly transfer: Transferable[];
13
+ }>;
14
+ /**
15
+ * Depth for a texture `factor` times smaller on each side, each texel the
16
+ * sample at its block's centre, as the renderer decimates a map larger than
17
+ * the GPU allows.
18
+ */
19
+ export declare function decimateDepthUpload(values: Uint16Array, width: number, height: number, factor: number, padRowsForWebGl: boolean): DecimatedDepthUpload<Uint8Array> | null;
20
+ //# sourceMappingURL=frame-decode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame-decode.d.ts","sourceRoot":"","sources":["../../../src/render-preparation/depth/frame-decode.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACpC,MAAM,mBAAmB,CAAC;AAE3B;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,IAAI,CAAC,6BAA6B,EAAE,WAAW,CAAC,GAAG;IAC1D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,GACA,OAAO,CAAC;IACT,QAAQ,CAAC,QAAQ,EAAE,8BAA8B,CAAC;IAClD,QAAQ,CAAC,QAAQ,EAAE,YAAY,EAAE,CAAC;CACnC,CAAC,CAsED;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,OAAO,GACvB,oBAAoB,CAAC,UAAU,CAAC,GAAG,IAAI,CAmCzC"}
@@ -0,0 +1,51 @@
1
+ import { type DecimatedDepthUpload } from "./worker-protocol";
2
+ import { type RenderPreparationOptions } from "#types/render-preparation";
3
+ /** A decoded depth PNG: host-order samples, or bytes for a confidence plane. */
4
+ export interface DecodedDepthImage<Values extends Uint16Array | Uint8Array> {
5
+ readonly width: number;
6
+ readonly height: number;
7
+ readonly values: Values;
8
+ /** Odd-width depth rows padded for WebGL, when asked for. */
9
+ readonly paddedUpload?: {
10
+ readonly bytes: Uint8Array;
11
+ readonly textureWidth: number;
12
+ };
13
+ /** Depth decimated for upload, when `decimateBy` asked for it. */
14
+ readonly decimatedUpload?: DecimatedDepthUpload<Uint8Array>;
15
+ }
16
+ export interface DepthDecodeOptions {
17
+ readonly padRowsForWebGl?: boolean;
18
+ /** Also decimate depth by this whole factor for upload, from 2 up. */
19
+ readonly decimateBy?: number;
20
+ /** Drops the result; the decode itself runs to the end in the worker. */
21
+ readonly signal?: AbortSignal;
22
+ }
23
+ export interface DepthFramePreparer {
24
+ /**
25
+ * Decodes worth running at once: one per worker in the pool, sized as the
26
+ * mask workers are, or 1 on the main thread.
27
+ */
28
+ readonly concurrency: number;
29
+ /** Decodes a 16-bit depth PNG. The bytes are the preparer's from here on. */
30
+ decodeDepth(bytes: ArrayBuffer, options?: DepthDecodeOptions): Promise<DecodedDepthImage<Uint16Array>>;
31
+ decodeConfidence(bytes: ArrayBuffer, options?: Pick<DepthDecodeOptions, "signal">): Promise<DecodedDepthImage<Uint8Array>>;
32
+ destroy(): void;
33
+ }
34
+ /**
35
+ * Decodes depth and confidence PNGs in a pool of render-preparation workers,
36
+ * sized the way the mask pool is (`maskFrame.workerCount`, by default half
37
+ * the cores up to 4), or on the main thread when the mode asks for it or
38
+ * `Auto` finds no working worker. The first worker starts at once, so a
39
+ * factory that throws fails `Worker` mode here; the others start only when
40
+ * every running one is busy, so a still map never spawns a pool.
41
+ *
42
+ * Until a worker has answered once, `Auto` posts a copy of the bytes, so a
43
+ * worker that fails to start (a CSP that blocks blob workers, say) leaves the
44
+ * original to decode here. After that the bytes are transferred. Nothing ever
45
+ * terminates a worker to cancel a decode: an aborted request's reply is
46
+ * dropped when it arrives.
47
+ */
48
+ export declare function createDepthFramePreparer(options: RenderPreparationOptions | undefined): DepthFramePreparer;
49
+ /** Rejects when the signal aborts; the work itself carries on unobserved. */
50
+ export declare function abortable<T>(work: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
51
+ //# sourceMappingURL=frame-preparer.d.ts.map