@omnimedia/omnitool 1.1.0-4 → 1.1.0-40

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 (183) hide show
  1. package/package.json +8 -4
  2. package/s/context.ts +0 -7
  3. package/s/demo/demo.bundle.ts +35 -5
  4. package/s/demo/demo.css +5 -0
  5. package/s/demo/routines/transcode-test.ts +8 -4
  6. package/s/demo/routines/transitions-test.ts +43 -0
  7. package/s/demo/routines/waveform-test.ts +3 -2
  8. package/s/driver/driver.ts +19 -11
  9. package/s/driver/fns/schematic.ts +46 -23
  10. package/s/driver/fns/work.ts +114 -102
  11. package/s/features/transition/parts/fragment.ts +24 -0
  12. package/s/features/transition/parts/types.ts +94 -0
  13. package/s/features/transition/parts/uniforms.ts +29 -0
  14. package/s/features/transition/parts/vertex.ts +31 -0
  15. package/s/features/transition/transition.ts +60 -0
  16. package/s/index.html.ts +6 -1
  17. package/s/timeline/index.ts +1 -0
  18. package/s/timeline/parts/basics.ts +1 -1
  19. package/s/timeline/parts/compositor/export.ts +77 -0
  20. package/s/timeline/parts/compositor/parts/html-tree.ts +37 -0
  21. package/s/timeline/parts/compositor/parts/schedulers.ts +95 -0
  22. package/s/timeline/parts/compositor/parts/tree-builder.ts +196 -0
  23. package/s/timeline/parts/compositor/parts/webcodecs-tree.ts +30 -0
  24. package/s/timeline/parts/compositor/playback.ts +94 -0
  25. package/s/timeline/parts/compositor/samplers/html.ts +115 -0
  26. package/s/timeline/parts/compositor/samplers/webcodecs.ts +61 -0
  27. package/s/timeline/parts/filmstrip.ts +42 -15
  28. package/s/timeline/parts/item.ts +48 -6
  29. package/s/timeline/parts/media.ts +21 -0
  30. package/s/timeline/parts/waveform.ts +3 -4
  31. package/s/timeline/sugar/builders.ts +102 -0
  32. package/s/timeline/sugar/o.ts +163 -38
  33. package/s/timeline/sugar/omni-test.ts +5 -3
  34. package/s/timeline/sugar/omni.ts +26 -11
  35. package/s/timeline/types.ts +29 -0
  36. package/s/timeline/utils/audio-stream.ts +15 -0
  37. package/s/timeline/utils/matrix.ts +33 -0
  38. package/s/timeline/utils/video-cursor.ts +40 -0
  39. package/x/context.d.ts +1 -4
  40. package/x/context.js +1 -5
  41. package/x/context.js.map +1 -1
  42. package/x/demo/demo.bundle.js +23 -6
  43. package/x/demo/demo.bundle.js.map +1 -1
  44. package/x/demo/demo.bundle.min.js +606 -36
  45. package/x/demo/demo.bundle.min.js.map +4 -4
  46. package/x/demo/demo.css +5 -0
  47. package/x/demo/routines/transcode-test.js +8 -4
  48. package/x/demo/routines/transcode-test.js.map +1 -1
  49. package/x/demo/routines/transitions-test.d.ts +5 -0
  50. package/x/demo/routines/transitions-test.js +35 -0
  51. package/x/demo/routines/transitions-test.js.map +1 -0
  52. package/x/demo/routines/waveform-test.d.ts +2 -1
  53. package/x/demo/routines/waveform-test.js +2 -2
  54. package/x/demo/routines/waveform-test.js.map +1 -1
  55. package/x/driver/driver.d.ts +4 -6
  56. package/x/driver/driver.js +17 -10
  57. package/x/driver/driver.js.map +1 -1
  58. package/x/driver/driver.worker.bundle.min.js +2537 -148
  59. package/x/driver/driver.worker.bundle.min.js.map +4 -4
  60. package/x/driver/fns/host.d.ts +9 -2
  61. package/x/driver/fns/schematic.d.ts +40 -22
  62. package/x/driver/fns/work.d.ts +11 -4
  63. package/x/driver/fns/work.js +107 -101
  64. package/x/driver/fns/work.js.map +1 -1
  65. package/x/features/speech/transcribe/worker.bundle.min.js +542 -542
  66. package/x/features/speech/transcribe/worker.bundle.min.js.map +4 -4
  67. package/x/features/transition/parts/fragment.d.ts +1 -0
  68. package/x/features/transition/parts/fragment.js +25 -0
  69. package/x/features/transition/parts/fragment.js.map +1 -0
  70. package/x/features/transition/parts/types.d.ts +23 -0
  71. package/x/features/transition/parts/types.js.map +1 -0
  72. package/x/features/transition/parts/uniforms.d.ts +31 -0
  73. package/x/features/transition/parts/uniforms.js +27 -0
  74. package/x/features/transition/parts/uniforms.js.map +1 -0
  75. package/x/features/transition/parts/vertex.d.ts +1 -0
  76. package/x/features/transition/parts/vertex.js +32 -0
  77. package/x/features/transition/parts/vertex.js.map +1 -0
  78. package/x/features/transition/transition.d.ts +5 -0
  79. package/x/features/transition/transition.js +50 -0
  80. package/x/features/transition/transition.js.map +1 -0
  81. package/x/index.html +13 -3
  82. package/x/index.html.js +6 -1
  83. package/x/index.html.js.map +1 -1
  84. package/x/timeline/index.d.ts +1 -0
  85. package/x/timeline/index.js +1 -0
  86. package/x/timeline/index.js.map +1 -1
  87. package/x/timeline/parts/basics.d.ts +1 -1
  88. package/x/timeline/parts/compositor/export.d.ts +11 -0
  89. package/x/timeline/parts/compositor/export.js +64 -0
  90. package/x/timeline/parts/compositor/export.js.map +1 -0
  91. package/x/timeline/parts/compositor/parts/html-tree.d.ts +3 -0
  92. package/x/timeline/parts/compositor/parts/html-tree.js +40 -0
  93. package/x/timeline/parts/compositor/parts/html-tree.js.map +1 -0
  94. package/x/timeline/parts/compositor/parts/schedulers.d.ts +15 -0
  95. package/x/timeline/parts/compositor/parts/schedulers.js +70 -0
  96. package/x/timeline/parts/compositor/parts/schedulers.js.map +1 -0
  97. package/x/timeline/parts/compositor/parts/tree-builder.d.ts +37 -0
  98. package/x/timeline/parts/compositor/parts/tree-builder.js +160 -0
  99. package/x/timeline/parts/compositor/parts/tree-builder.js.map +1 -0
  100. package/x/timeline/parts/compositor/parts/webcodecs-tree.d.ts +3 -0
  101. package/x/timeline/parts/compositor/parts/webcodecs-tree.js +28 -0
  102. package/x/timeline/parts/compositor/parts/webcodecs-tree.js.map +1 -0
  103. package/x/timeline/parts/compositor/playback.d.ts +26 -0
  104. package/x/timeline/parts/compositor/playback.js +79 -0
  105. package/x/timeline/parts/compositor/playback.js.map +1 -0
  106. package/x/timeline/parts/compositor/samplers/html.d.ts +3 -0
  107. package/x/timeline/parts/compositor/samplers/html.js +106 -0
  108. package/x/timeline/parts/compositor/samplers/html.js.map +1 -0
  109. package/x/timeline/parts/compositor/samplers/webcodecs.d.ts +3 -0
  110. package/x/timeline/parts/compositor/samplers/webcodecs.js +52 -0
  111. package/x/timeline/parts/compositor/samplers/webcodecs.js.map +1 -0
  112. package/x/timeline/parts/filmstrip.d.ts +2 -1
  113. package/x/timeline/parts/filmstrip.js +29 -10
  114. package/x/timeline/parts/filmstrip.js.map +1 -1
  115. package/x/timeline/parts/item.d.ts +42 -8
  116. package/x/timeline/parts/item.js +7 -3
  117. package/x/timeline/parts/item.js.map +1 -1
  118. package/x/timeline/parts/media.d.ts +3 -0
  119. package/x/timeline/parts/media.js +17 -0
  120. package/x/timeline/parts/media.js.map +1 -1
  121. package/x/timeline/parts/waveform.d.ts +2 -1
  122. package/x/timeline/parts/waveform.js +2 -4
  123. package/x/timeline/parts/waveform.js.map +1 -1
  124. package/x/timeline/sugar/builders.js +104 -0
  125. package/x/timeline/sugar/builders.js.map +1 -0
  126. package/x/timeline/sugar/o.d.ts +27 -5
  127. package/x/timeline/sugar/o.js +137 -38
  128. package/x/timeline/sugar/o.js.map +1 -1
  129. package/x/timeline/sugar/omni-test.js +4 -2
  130. package/x/timeline/sugar/omni-test.js.map +1 -1
  131. package/x/timeline/sugar/omni.d.ts +8 -2
  132. package/x/timeline/sugar/omni.js +22 -9
  133. package/x/timeline/sugar/omni.js.map +1 -1
  134. package/x/timeline/types.d.ts +24 -0
  135. package/x/timeline/types.js +2 -0
  136. package/x/timeline/types.js.map +1 -0
  137. package/x/timeline/utils/audio-stream.d.ts +6 -0
  138. package/x/timeline/utils/audio-stream.js +17 -0
  139. package/x/timeline/utils/audio-stream.js.map +1 -0
  140. package/x/timeline/utils/matrix.d.ts +8 -0
  141. package/x/timeline/utils/matrix.js +26 -0
  142. package/x/timeline/utils/matrix.js.map +1 -0
  143. package/x/timeline/utils/video-cursor.d.ts +10 -0
  144. package/x/timeline/utils/video-cursor.js +36 -0
  145. package/x/timeline/utils/video-cursor.js.map +1 -0
  146. package/s/tools/common/loader.ts +0 -26
  147. package/s/tools/common/transformer-pipeline.ts +0 -26
  148. package/s/tools/speech-recognition/common/model.ts +0 -26
  149. package/s/tools/speech-recognition/whisper/fns/host.ts +0 -25
  150. package/s/tools/speech-recognition/whisper/fns/schematic.ts +0 -23
  151. package/s/tools/speech-recognition/whisper/fns/work.ts +0 -91
  152. package/s/tools/speech-recognition/whisper/parts/types.ts +0 -38
  153. package/s/tools/speech-recognition/whisper/parts/worker.bundle.ts +0 -7
  154. package/s/tools/speech-recognition/whisper/tool.ts +0 -70
  155. package/x/tools/common/loader.d.ts +0 -19
  156. package/x/tools/common/loader.js +0 -18
  157. package/x/tools/common/loader.js.map +0 -1
  158. package/x/tools/common/transformer-pipeline.d.ts +0 -8
  159. package/x/tools/common/transformer-pipeline.js +0 -24
  160. package/x/tools/common/transformer-pipeline.js.map +0 -1
  161. package/x/tools/speech-recognition/common/model.d.ts +0 -14
  162. package/x/tools/speech-recognition/common/model.js +0 -16
  163. package/x/tools/speech-recognition/common/model.js.map +0 -1
  164. package/x/tools/speech-recognition/whisper/fns/host.d.ts +0 -13
  165. package/x/tools/speech-recognition/whisper/fns/host.js +0 -19
  166. package/x/tools/speech-recognition/whisper/fns/host.js.map +0 -1
  167. package/x/tools/speech-recognition/whisper/fns/schematic.d.ts +0 -19
  168. package/x/tools/speech-recognition/whisper/fns/schematic.js +0 -2
  169. package/x/tools/speech-recognition/whisper/fns/schematic.js.map +0 -1
  170. package/x/tools/speech-recognition/whisper/fns/work.d.ts +0 -12
  171. package/x/tools/speech-recognition/whisper/fns/work.js +0 -74
  172. package/x/tools/speech-recognition/whisper/fns/work.js.map +0 -1
  173. package/x/tools/speech-recognition/whisper/parts/types.d.ts +0 -31
  174. package/x/tools/speech-recognition/whisper/parts/types.js.map +0 -1
  175. package/x/tools/speech-recognition/whisper/parts/worker.bundle.js +0 -4
  176. package/x/tools/speech-recognition/whisper/parts/worker.bundle.js.map +0 -1
  177. package/x/tools/speech-recognition/whisper/parts/worker.bundle.min.js +0 -8
  178. package/x/tools/speech-recognition/whisper/parts/worker.bundle.min.js.map +0 -7
  179. package/x/tools/speech-recognition/whisper/tool.d.ts +0 -12
  180. package/x/tools/speech-recognition/whisper/tool.js +0 -63
  181. package/x/tools/speech-recognition/whisper/tool.js.map +0 -1
  182. /package/x/{tools/speech-recognition/whisper → features/transition}/parts/types.js +0 -0
  183. /package/x/{tools/speech-recognition/whisper/parts/worker.bundle.d.ts → timeline/sugar/builders.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ export declare const fragment: (glsl: string) => string;
@@ -0,0 +1,25 @@
1
+ export const fragment = (glsl) => `
2
+ precision highp float;
3
+ varying vec2 vTextureCoord;
4
+ varying vec2 _uv;
5
+ uniform sampler2D from, to;
6
+ uniform float progress, ratio, _fromR, _toR;
7
+ uniform float customUniform;
8
+
9
+ vec4 getFromColor(vec2 uv){
10
+ return texture2D(from, .5+(uv-.5)*vec2(max(ratio/_fromR,1.), max(_fromR/ratio,1.)));
11
+ }
12
+ vec4 getToColor(vec2 uv){
13
+ return texture2D(to, .5+(uv-.5)*vec2(max(ratio/_toR,1.), max(_toR/ratio,1.)));
14
+ }
15
+
16
+ // gl-transition code here
17
+ ${glsl}
18
+ // gl-transition code end
19
+
20
+ void main(){
21
+ vec2 uv = vTextureCoord.xy;
22
+ gl_FragColor = transition(vTextureCoord);
23
+ }
24
+ `;
25
+ //# sourceMappingURL=fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragment.js","sourceRoot":"","sources":["../../../../s/features/transition/parts/fragment.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC;;;;;;;;;;;;;;;;GAgBvC,IAAI;;;;;;;CAON,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { Renderer } from "pixi.js";
2
+ export interface TransitionOptions {
3
+ name: Transition;
4
+ renderer: Renderer;
5
+ }
6
+ export interface TransitionRendererOptions {
7
+ from: VideoFrame;
8
+ to: VideoFrame;
9
+ progress: number;
10
+ width: number;
11
+ height: number;
12
+ }
13
+ export interface GLTransition {
14
+ author: string;
15
+ createdAt: string;
16
+ glsl: string;
17
+ license: string;
18
+ name: Transition;
19
+ updatedAt: string;
20
+ defaultParams: any;
21
+ paramsTypes: any;
22
+ }
23
+ export type Transition = "Bounce" | "BowTieHorizontal" | "BowTieVertical" | "ButterflyWaveScrawler" | "CircleCrop" | "ColourDistance" | "CrazyParametricFun" | "CrossZoom" | "Directional" | "DoomScreenTransition" | "Dreamy" | "DreamyZoom" | "GlitchDisplace" | "GlitchMemories" | "GridFlip" | "InvertedPageCurl" | "LinearBlur" | "Mosaic" | "PolkaDotsCurtain" | "Radial" | "SimpleZoom" | "StereoViewer" | "Swirl" | "WaterDrop" | "ZoomInCircles" | "angular" | "burn" | "cannabisleaf" | "circle" | "circleopen" | "colorphase" | "crosshatch" | "crosswarp" | "cube" | "directionalwarp" | "directionalwipe" | "displacement" | "doorway" | "fade" | "fadecolor" | "fadegrayscale" | "flyeye" | "heart" | "hexagonalize" | "kaleidoscope" | "luma" | "luminance_melt" | "morph" | "multiply_blend" | "perlin" | "pinwheel" | "pixelize" | "polar_function" | "randomsquares" | "ripple" | "rotate_scale_fade" | "squareswire" | "squeeze" | "swap" | "undulatingBurnOut" | "wind" | "windowblinds" | "windowslice" | "wipeDown" | "wipeLeft" | "wipeRight" | "wipeUp";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../s/features/transition/parts/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import { GLTransition } from "./types.js";
2
+ export declare const uniforms: {
3
+ custom: (transition: GLTransition) => {
4
+ [k: string]: {
5
+ value: unknown;
6
+ type: string;
7
+ };
8
+ };
9
+ basics: {
10
+ _fromR: {
11
+ value: number;
12
+ type: string;
13
+ };
14
+ _toR: {
15
+ value: number;
16
+ type: string;
17
+ };
18
+ ratio: {
19
+ value: number;
20
+ type: string;
21
+ };
22
+ progress: {
23
+ value: number;
24
+ type: string;
25
+ };
26
+ customUniform: {
27
+ value: number;
28
+ type: string;
29
+ };
30
+ };
31
+ };
@@ -0,0 +1,27 @@
1
+ export const uniforms = {
2
+ custom: (transition) => Object.fromEntries(Object.entries(transition.defaultParams).map(([name, value]) => [
3
+ name,
4
+ {
5
+ value,
6
+ type: getUniformType(transition.paramsTypes[name])
7
+ }
8
+ ])),
9
+ basics: {
10
+ _fromR: { value: 1, type: "f32" },
11
+ _toR: { value: 1, type: "f32" },
12
+ ratio: { value: 1, type: "f32" },
13
+ progress: { value: 0, type: "f32" },
14
+ customUniform: { value: 0, type: "f32" },
15
+ }
16
+ };
17
+ const getUniformType = (type) => {
18
+ if (type === "f32" || type === "i32") {
19
+ return type;
20
+ }
21
+ else if (type === "float") {
22
+ return "f32";
23
+ }
24
+ else
25
+ return `${type}<f32>`;
26
+ };
27
+ //# sourceMappingURL=uniforms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniforms.js","sourceRoot":"","sources":["../../../../s/features/transition/parts/uniforms.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB,MAAM,EAAE,CAAC,UAAwB,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CACvD,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;QAC/D,IAAI;QACJ;YACC,KAAK;YACL,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;SAClD;KACD,CAAC,CACF;IACD,MAAM,EAAE;QACP,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAC;QAC/B,IAAI,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAC;QAC7B,KAAK,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAC;QAC9B,QAAQ,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAC;QACjC,aAAa,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAC;KACtC;CACD,CAAA;AAED,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE;IACvC,IAAG,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACrC,OAAO,IAAI,CAAA;IACZ,CAAC;SAAM,IAAG,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAA;IACb,CAAC;;QACI,OAAO,GAAG,IAAI,OAAO,CAAA;AAC3B,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export declare const vertex = "\n\tin vec2 aPosition;\n\tvarying vec2 _uv; // gl-transition\n\tuniform mat3 projectionMatrix;\n\tuniform vec4 uInputSize;\n\tuniform vec4 uOutputFrame;\n\tout vec2 vTextureCoord;\n\tuniform vec4 uOutputTexture;\n\n\tvec4 filterVertexPosition( void )\n\t{\n\t\t\tvec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n\n\t\t\tposition.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n\t\t\tposition.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n\t\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\n\tvec2 filterTextureCoord( void )\n\t{\n\treturn aPosition * (uOutputFrame.zw * uInputSize.zw);\n\t}\n\n\tvoid main(void)\n\t{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\t_uv = vec2(0.5, 0.5) * (aPosition +vec2(1.0, 1.0)); // gl-transition\n\t}\n";
@@ -0,0 +1,32 @@
1
+ export const vertex = `
2
+ in vec2 aPosition;
3
+ varying vec2 _uv; // gl-transition
4
+ uniform mat3 projectionMatrix;
5
+ uniform vec4 uInputSize;
6
+ uniform vec4 uOutputFrame;
7
+ out vec2 vTextureCoord;
8
+ uniform vec4 uOutputTexture;
9
+
10
+ vec4 filterVertexPosition( void )
11
+ {
12
+ vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
13
+
14
+ position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
15
+ position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
16
+
17
+ return vec4(position, 0.0, 1.0);
18
+ }
19
+
20
+ vec2 filterTextureCoord( void )
21
+ {
22
+ return aPosition * (uOutputFrame.zw * uInputSize.zw);
23
+ }
24
+
25
+ void main(void)
26
+ {
27
+ gl_Position = filterVertexPosition();
28
+ vTextureCoord = filterTextureCoord();
29
+ _uv = vec2(0.5, 0.5) * (aPosition +vec2(1.0, 1.0)); // gl-transition
30
+ }
31
+ `;
32
+ //# sourceMappingURL=vertex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vertex.js","sourceRoot":"","sources":["../../../../s/features/transition/parts/vertex.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BrB,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { Texture } from "pixi.js";
2
+ import { TransitionOptions, TransitionRendererOptions } from "./parts/types.js";
3
+ export declare function makeTransition({ name, renderer }: TransitionOptions): {
4
+ render({ width, height, from, to, progress }: TransitionRendererOptions): Texture<import("pixi.js").TextureSource<any>>;
5
+ };
@@ -0,0 +1,50 @@
1
+ //@ts-ignore
2
+ import transitions from "gl-transitions";
3
+ import { Filter, GlProgram, Sprite, Texture, ImageSource } from "pixi.js";
4
+ import { vertex } from "./parts/vertex.js";
5
+ import { uniforms } from "./parts/uniforms.js";
6
+ import { fragment } from "./parts/fragment.js";
7
+ export function makeTransition({ name, renderer }) {
8
+ const transition = transitions.find((t) => t.name === name);
9
+ const transitionSprite = new Sprite();
10
+ const transitionTexture = new Texture();
11
+ const sourceFrom = new ImageSource({});
12
+ const sourceTo = new ImageSource({});
13
+ const filter = new Filter({
14
+ glProgram: new GlProgram({
15
+ vertex,
16
+ fragment: fragment(transition.glsl),
17
+ }),
18
+ resources: {
19
+ from: sourceFrom,
20
+ to: sourceTo,
21
+ uniforms: {
22
+ ...uniforms.basics,
23
+ ...uniforms.custom(transition)
24
+ }
25
+ }
26
+ });
27
+ transitionSprite.filters = [filter];
28
+ return {
29
+ render({ width, height, from, to, progress }) {
30
+ if (transitionSprite.width !== width || transitionSprite.height !== height) {
31
+ transitionSprite.setSize({ width, height });
32
+ transitionTexture.source.resize(width, height);
33
+ }
34
+ sourceFrom.resource = from;
35
+ sourceTo.resource = to;
36
+ sourceFrom.update();
37
+ sourceTo.update();
38
+ filter.resources.uniforms.uniforms.progress = progress;
39
+ renderer.render({
40
+ container: transitionSprite,
41
+ target: transitionTexture,
42
+ clear: false,
43
+ width,
44
+ height
45
+ });
46
+ return transitionTexture;
47
+ }
48
+ };
49
+ }
50
+ //# sourceMappingURL=transition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transition.js","sourceRoot":"","sources":["../../../s/features/transition/transition.ts"],"names":[],"mappings":"AAAA,YAAY;AACZ,OAAO,WAAW,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AAEvE,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAA;AAG5C,MAAM,UAAU,cAAc,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAoB;IACjE,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAiB,CAAA;IACzF,MAAM,gBAAgB,GAAG,IAAI,MAA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C;gBACf,SAAS,EAAE,gBAAgB;gBAC3B,MAAM,EAAE,iBAAiB;gBACzB,KAAK,EAAE,KAAK;gBACZ,KAAK;gBACL,MAAM;aACN,CAAC,CAAA;YAEF,OAAO,iBAAiB,CAAA;QACzB,CAAC;KACD,CAAA;AACF,CAAC"}
package/x/index.html CHANGED
@@ -53,6 +53,11 @@ body {
53
53
  }
54
54
  }
55
55
 
56
+ canvas {
57
+ width: 500px;
58
+ height: 300px;
59
+ }
60
+
56
61
  #filmstrip {
57
62
  display: flex;
58
63
  overflow-x: scroll;
@@ -60,7 +65,7 @@ body {
60
65
  }
61
66
 
62
67
  </style>
63
- <script type=module src="demo/demo.bundle.min.js?v=7ebfc5a6da44"></script>
68
+ <script type=module src="demo/demo.bundle.min.js?v=70790bc7d44b"></script>
64
69
 
65
70
 
66
71
  <meta name="theme-color" content="#3cff9c">
@@ -80,9 +85,9 @@ body {
80
85
  <body>
81
86
 
82
87
  <section>
83
- <h1>Omnitool <small>v1.1.0-4</small></h1>
88
+ <h1>Omnitool <small>v1.1.0-40</small></h1>
84
89
  <button class=fetch>fetch</button>
85
- <button class="import">import</button>
90
+ <input type="file" class="file-input">
86
91
  <div class=results></div>
87
92
  <div class=filmstrip-demo>
88
93
  <label for="viewable-range">viewable range:</label>
@@ -99,6 +104,11 @@ body {
99
104
  <label for="width">width:</label>
100
105
  <input class="width" id="width" name="width" type="range" min="100" max="1000000" value="1000" />
101
106
  </div>
107
+ <div class=player>
108
+ <input class="seek" type="number" min="0">
109
+ <button class=play>play</button>
110
+ <button class=stop>stop</button>
111
+ </div>
102
112
  </section>
103
113
 
104
114
  </body>
package/x/index.html.js CHANGED
@@ -24,7 +24,7 @@ export default ssg.page(import.meta.url, async (orb) => ({
24
24
  <section>
25
25
  <h1>Omnitool <small>v${orb.packageVersion()}</small></h1>
26
26
  <button class=fetch>fetch</button>
27
- <button class="import">import</button>
27
+ <input type="file" class="file-input">
28
28
  <div class=results></div>
29
29
  <div class=filmstrip-demo>
30
30
  <label for="viewable-range">viewable range:</label>
@@ -41,6 +41,11 @@ export default ssg.page(import.meta.url, async (orb) => ({
41
41
  <label for="width">width:</label>
42
42
  <input class="width" id="width" name="width" type="range" min="100" max="1000000" value="1000" />
43
43
  </div>
44
+ <div class=player>
45
+ <input class="seek" type="number" min="0">
46
+ <button class=play>play</button>
47
+ <button class=stop>stop</button>
48
+ </div>
44
49
  </section>
45
50
  `,
46
51
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"index.html.js","sourceRoot":"","sources":["../s/index.html.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,aAAa,CAAA;AAErC,MAAM,KAAK,GAAG,UAAU,CAAA;AACxB,MAAM,MAAM,GAAG,uBAAuB,CAAA;AACtC,MAAM,OAAO,GAAG,qBAAqB,CAAA;AAErC,eAAe,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAC,GAAG,EAAC,EAAE,CAAC,CAAC;IACtD,KAAK;IACL,WAAW;IACX,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,eAAe;IACpB,EAAE,EAAE,yBAAyB;IAE7B,IAAI,EAAE,IAAI,CAAA;;;;EAIT;IAED,UAAU,EAAE;QACX,KAAK;QACL,WAAW,EAAE,0BAA0B;QACvC,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,WAAW,MAAM,GAAG,OAAO,EAAE;KACpC;IAED,IAAI,EAAE,IAAI,CAAA;;0BAEe,GAAG,CAAC,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;EAoB5C;CACD,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"index.html.js","sourceRoot":"","sources":["../s/index.html.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,aAAa,CAAA;AAErC,MAAM,KAAK,GAAG,UAAU,CAAA;AACxB,MAAM,MAAM,GAAG,uBAAuB,CAAA;AACtC,MAAM,OAAO,GAAG,qBAAqB,CAAA;AAErC,eAAe,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAC,GAAG,EAAC,EAAE,CAAC,CAAC;IACtD,KAAK;IACL,WAAW;IACX,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,eAAe;IACpB,EAAE,EAAE,yBAAyB;IAE7B,IAAI,EAAE,IAAI,CAAA;;;;EAIT;IAED,UAAU,EAAE;QACX,KAAK;QACL,WAAW,EAAE,0BAA0B;QACvC,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,WAAW,MAAM,GAAG,OAAO,EAAE;KACpC;IAED,IAAI,EAAE,IAAI,CAAA;;0BAEe,GAAG,CAAC,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;EAyB5C;CACD,CAAC,CAAC,CAAA"}
@@ -4,6 +4,7 @@ export * from "./parts/media.js";
4
4
  export * from "./parts/resource-pool.js";
5
5
  export * from "./parts/resource.js";
6
6
  export * from "./parts/filmstrip.js";
7
+ export * from "./parts/compositor/playback.js";
7
8
  export * from "./sugar/o.js";
8
9
  export * from "./sugar/omni.js";
9
10
  export * from "./utils/checksum.js";
@@ -4,6 +4,7 @@ export * from "./parts/media.js";
4
4
  export * from "./parts/resource-pool.js";
5
5
  export * from "./parts/resource.js";
6
6
  export * from "./parts/filmstrip.js";
7
+ export * from "./parts/compositor/playback.js";
7
8
  export * from "./sugar/o.js";
8
9
  export * from "./sugar/omni.js";
9
10
  export * from "./utils/checksum.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../s/timeline/index.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AAEpC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAE/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../s/timeline/index.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAE9C,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAE/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA"}
@@ -7,6 +7,6 @@ export type TimelineFile = {
7
7
  info: "https://omniclip.app/";
8
8
  format: "timeline";
9
9
  version: number;
10
- root: Id;
10
+ rootId: Id;
11
11
  items: Item.Any[];
12
12
  };
@@ -0,0 +1,11 @@
1
+ import { TimelineFile } from "../basics.js";
2
+ import { Driver } from "../../../driver/driver.js";
3
+ import { DecoderSource } from "../../../driver/fns/schematic.js";
4
+ export declare class Export {
5
+ #private;
6
+ private driver;
7
+ private framerate;
8
+ private resolveMedia;
9
+ constructor(driver: Driver, framerate?: number, resolveMedia?: (hash: string) => DecoderSource);
10
+ render(timeline: TimelineFile): Promise<void>;
11
+ }
@@ -0,0 +1,64 @@
1
+ import { fixedStep } from "./parts/schedulers.js";
2
+ import { makeWebCodecsSampler } from "./samplers/webcodecs.js";
3
+ import { buildWebCodecsNodeTree } from "./parts/webcodecs-tree.js";
4
+ export class Export {
5
+ driver;
6
+ framerate;
7
+ resolveMedia;
8
+ #sampler;
9
+ constructor(driver, framerate = 30, resolveMedia = _hash => "/assets/temp/gl.mp4") {
10
+ this.driver = driver;
11
+ this.framerate = framerate;
12
+ this.resolveMedia = resolveMedia;
13
+ this.#sampler = makeWebCodecsSampler(this.driver, this.resolveMedia);
14
+ }
15
+ async #build(timeline) {
16
+ const rootItem = new Map(timeline.items.map(i => [i.id, i])).get(timeline.rootId);
17
+ const items = new Map(timeline.items.map(i => [i.id, i]));
18
+ return await buildWebCodecsNodeTree(rootItem, items, this.#sampler);
19
+ }
20
+ async render(timeline) {
21
+ const root = await this.#build(timeline);
22
+ const videoStream = new TransformStream();
23
+ const audioStream = new TransformStream();
24
+ const encodePromise = this.driver.encode({
25
+ video: videoStream.readable,
26
+ audio: audioStream.readable,
27
+ config: {
28
+ audio: { codec: "opus", bitrate: 128000 },
29
+ video: { codec: "vp9", bitrate: 1000000 },
30
+ },
31
+ });
32
+ const videoWriter = videoStream.writable.getWriter();
33
+ const audioWriter = audioStream.writable.getWriter();
34
+ const audioPromise = (async () => {
35
+ if (root.audio) {
36
+ for await (const chunk of root.audio.getStream()) {
37
+ await audioWriter.write(chunk);
38
+ }
39
+ }
40
+ await audioWriter.close();
41
+ })();
42
+ const videoPromise = (async () => {
43
+ let i = 0;
44
+ const dt = 1 / this.framerate;
45
+ await fixedStep({ fps: this.framerate, duration: root.duration ?? 0 }, async (t) => {
46
+ const layers = await root.visuals?.sampleAt(t) ?? [];
47
+ const composed = await this.driver.composite(layers);
48
+ const vf = new VideoFrame(composed, {
49
+ timestamp: Math.round(i * dt * 1_000_000),
50
+ duration: Math.round(dt * 1_000_000),
51
+ });
52
+ await videoWriter.write(vf);
53
+ composed.close();
54
+ i++;
55
+ });
56
+ await videoWriter.close();
57
+ })();
58
+ await audioPromise;
59
+ await videoPromise;
60
+ await encodePromise;
61
+ // this.#sampler.dispose()
62
+ }
63
+ }
64
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../../../../s/timeline/parts/compositor/export.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAA;AAE/C,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAA;AAE5D,OAA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AAC,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;oBACzC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,SAAS,CAAC;iBACpC,CAAC,CAAA;gBACF,MAAM,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;gBAC3B,QAAQ,CAAC,KAAK,EAAE,CAAA;gBAChB,CAAC,EAAE,CAAA;YACJ,CAAC,CACD,CAAA;YACD,MAAM,WAAW,CAAC,KAAK,EAAE,CAAA;QAC1B,CAAC,CAAC,EAAE,CAAA;QAEJ,MAAM,YAAY,CAAA;QAClB,MAAM,YAAY,CAAA;QAClB,MAAM,aAAa,CAAA;QACnB,0BAA0B;IAC3B,CAAC;CACD"}
@@ -0,0 +1,3 @@
1
+ import { Item } from "../../item.js";
2
+ import { AudioPlaybackComponent, HTMLSampler, Node } from "./tree-builder.js";
3
+ export declare function buildHTMLNodeTree(root: Item.Any, items: Map<number, Item.Any>, sampler: HTMLSampler): Promise<Node<AudioPlaybackComponent>>;
@@ -0,0 +1,40 @@
1
+ import { TreeBuilder } from "./tree-builder.js";
2
+ class HTMLNodeBuilder extends TreeBuilder {
3
+ items;
4
+ sampler;
5
+ constructor(items, sampler) {
6
+ super(items, sampler);
7
+ this.items = items;
8
+ this.sampler = sampler;
9
+ }
10
+ composeAudio_Stack(children) {
11
+ return {
12
+ onTimeUpdate: (time) => {
13
+ for (const child of children) {
14
+ if (child.audio)
15
+ child.audio.onTimeUpdate(time);
16
+ }
17
+ }
18
+ };
19
+ }
20
+ composeAudio_Sequence(children) {
21
+ return {
22
+ onTimeUpdate: (time) => {
23
+ let localTime = time;
24
+ for (const child of children) {
25
+ if (localTime < child.duration) {
26
+ if (child.audio)
27
+ child.audio.onTimeUpdate(localTime);
28
+ break;
29
+ }
30
+ localTime -= child.duration;
31
+ }
32
+ }
33
+ };
34
+ }
35
+ }
36
+ export function buildHTMLNodeTree(root, items, sampler) {
37
+ const builder = new HTMLNodeBuilder(items, sampler);
38
+ return builder.build(root);
39
+ }
40
+ //# sourceMappingURL=html-tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-tree.js","sourceRoot":"","sources":["../../../../../s/timeline/parts/compositor/parts/html-tree.ts"],"names":[],"mappings":"AACA,OAAO,EAA4C,WAAW,EAAC,MAAM,mBAAmB,CAAA;AAExF,MAAM,eAAgB,SAAQ,WAAmC;IAC1C;IAAwC;IAA9D,YAAsB,KAA4B,EAAY,OAAoB;QACjF,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QADA,UAAK,GAAL,KAAK,CAAuB;QAAY,YAAO,GAAP,OAAO,CAAa;IAElF,CAAC;IAED,kBAAkB,CAAC,QAAwC;QAC1D,OAAO;YACN,YAAY,EAAE,CAAC,IAAY,EAAE,EAAE;gBAC9B,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;oBAC9B,IAAI,KAAK,CAAC,KAAK;wBAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;gBAChD,CAAC;YACF,CAAC;SACD,CAAA;IACF,CAAC;IACD,qBAAqB,CAAC,QAAwC;QAC7D,OAAO;YACN,YAAY,EAAE,CAAC,IAAY,EAAE,EAAE;gBAC9B,IAAI,SAAS,GAAG,IAAI,CAAA;gBACpB,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;oBAC9B,IAAI,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;wBAChC,IAAI,KAAK,CAAC,KAAK;4BAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;wBACpD,MAAK;oBACN,CAAC;oBACD,SAAS,IAAI,KAAK,CAAC,QAAQ,CAAA;gBAC5B,CAAC;YACF,CAAC;SACD,CAAA;IACF,CAAC;CACD;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAc,EAAE,KAA4B,EAAE,OAAoB;IACnG,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACnD,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC3B,CAAC"}
@@ -0,0 +1,15 @@
1
+ export type RealtimeController = {
2
+ play(): void;
3
+ pause(): void;
4
+ seek(t: number): void;
5
+ dispose(): void;
6
+ setFPS(v: number): void;
7
+ isPlaying(): boolean;
8
+ };
9
+ export declare const realtime: (onTick: (tickTime: number) => void, onUpdate: (currentTime: number) => void) => RealtimeController;
10
+ export type FixedStepOptions = {
11
+ fps: number;
12
+ duration: number;
13
+ abort?: AbortSignal;
14
+ };
15
+ export declare const fixedStep: (opts: FixedStepOptions, onFrame: (t: number, index: number) => Promise<void> | void) => Promise<void>;
@@ -0,0 +1,70 @@
1
+ export const realtime = (onTick, onUpdate) => {
2
+ let playing = false;
3
+ let rafId = null;
4
+ let fps = 60;
5
+ let frameDuration = 1000 / fps;
6
+ let composeTime = 0;
7
+ let lastTime = 0;
8
+ let accumulator = 0;
9
+ let currentTime = 0;
10
+ const tick = (now) => {
11
+ if (!playing)
12
+ return;
13
+ const deltaTime = now - lastTime;
14
+ lastTime = now;
15
+ accumulator += deltaTime;
16
+ currentTime += deltaTime;
17
+ onUpdate(currentTime);
18
+ while (accumulator >= frameDuration) {
19
+ onTick(composeTime);
20
+ composeTime += frameDuration;
21
+ accumulator -= frameDuration;
22
+ }
23
+ rafId = requestAnimationFrame(tick);
24
+ };
25
+ return {
26
+ play() {
27
+ if (playing)
28
+ return;
29
+ playing = true;
30
+ lastTime = performance.now();
31
+ rafId = requestAnimationFrame(tick);
32
+ },
33
+ pause() {
34
+ if (!playing)
35
+ return;
36
+ playing = false;
37
+ if (rafId !== null)
38
+ cancelAnimationFrame(rafId);
39
+ rafId = null;
40
+ },
41
+ seek(ms) {
42
+ composeTime = ms;
43
+ accumulator = 0;
44
+ currentTime = ms;
45
+ onUpdate(ms);
46
+ },
47
+ dispose() {
48
+ this.pause();
49
+ },
50
+ isPlaying() {
51
+ return playing;
52
+ },
53
+ setFPS(v) {
54
+ fps = v;
55
+ frameDuration = 1000 / fps;
56
+ }
57
+ };
58
+ };
59
+ export const fixedStep = async (opts, onFrame) => {
60
+ const dt = 1000 / opts.fps;
61
+ const durationInSeconds = opts.duration / 1000;
62
+ const total = Math.ceil(durationInSeconds * opts.fps);
63
+ for (let i = 0; i < total; i++) {
64
+ if (opts.abort?.aborted)
65
+ break;
66
+ const t = i * dt;
67
+ await onFrame(t, i);
68
+ }
69
+ };
70
+ //# sourceMappingURL=schedulers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedulers.js","sourceRoot":"","sources":["../../../../../s/timeline/parts/compositor/parts/schedulers.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,QAAQ,GAAG,CACvB,MAAkC,EAClC,QAAuC,EAClB,EAAE;IAEtB,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,IAAI,KAAK,GAAkB,IAAI,CAAA;IAC/B,IAAI,GAAG,GAAG,EAAE,CAAA;IAEZ,IAAI,aAAa,GAAG,IAAI,GAAG,GAAG,CAAA;IAC9B,IAAI,WAAW,GAAG,CAAC,CAAA;IACnB,IAAI,QAAQ,GAAG,CAAC,CAAA;IAChB,IAAI,WAAW,GAAG,CAAC,CAAA;IACnB,IAAI,WAAW,GAAG,CAAC,CAAA;IAEnB,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;QAC3B,IAAI,CAAC,OAAO;YAAE,OAAM;QAEpB,MAAM,SAAS,GAAG,GAAG,GAAG,QAAQ,CAAA;QAChC,QAAQ,GAAG,GAAG,CAAA;QAEd,WAAW,IAAI,SAAS,CAAA;QACxB,WAAW,IAAI,SAAS,CAAA;QACzB,QAAQ,CAAC,WAAW,CAAC,CAAA;QAEpB,OAAO,WAAW,IAAI,aAAa,EAAE,CAAC;YACpC,MAAM,CAAC,WAAW,CAAC,CAAA;YACnB,WAAW,IAAI,aAAa,CAAA;YAC5B,WAAW,IAAI,aAAa,C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C,EAAE,EAAE,CAAC;QAChC,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO;YAAE,MAAK;QAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;QAChB,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACpB,CAAC;AACF,CAAC,CAAA"}
@@ -0,0 +1,37 @@
1
+ import { Item } from "../../item.js";
2
+ import { Layer } from "../../../../driver/fns/schematic.js";
3
+ import { Mat6 } from "../../../utils/matrix.js";
4
+ export type AudioStreamComponent = {
5
+ getStream: () => AsyncGenerator<AudioData>;
6
+ };
7
+ export type AudioPlaybackComponent = {
8
+ onTimeUpdate: (time: number) => void;
9
+ };
10
+ export type VisualComponent = {
11
+ sampleAt: (time: number) => Promise<Layer[]>;
12
+ };
13
+ export type Node<T> = {
14
+ duration: number;
15
+ visuals?: VisualComponent;
16
+ audio?: T;
17
+ };
18
+ interface Sampler<T> {
19
+ video(item: Item.Video, parentMatrix: Mat6): Promise<Node<T>>;
20
+ audio(item: Item.Audio): Promise<Node<T>>;
21
+ dispose(): Promise<void>;
22
+ }
23
+ export declare const getWorldMat6: (items: Map<number, Item.Any>, item: Item.Text | Item.Sequence | Item.Stack | Item.Video, parent?: Mat6) => Mat6;
24
+ export type WebcodecsSampler = Sampler<AudioStreamComponent>;
25
+ export interface HTMLSampler extends Sampler<AudioPlaybackComponent> {
26
+ setPaused(v: boolean): void;
27
+ }
28
+ export declare abstract class TreeBuilder<T> {
29
+ #private;
30
+ protected items: Map<number, Item.Any>;
31
+ protected sampler: Sampler<T>;
32
+ constructor(items: Map<number, Item.Any>, sampler: Sampler<T>);
33
+ build(root: Item.Any, parentMatrix?: Mat6): Promise<Node<T>>;
34
+ abstract composeAudio_Stack(children: Node<T>[]): T | undefined;
35
+ abstract composeAudio_Sequence(children: Node<T>[]): T | undefined;
36
+ }
37
+ export {};