@omnimedia/omnitool 1.1.0-4 → 1.1.0-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 (133) hide show
  1. package/package.json +4 -2
  2. package/s/demo/demo.css +5 -0
  3. package/s/demo/routines/transcode-test.ts +4 -2
  4. package/s/demo/routines/transitions-test.ts +43 -0
  5. package/s/driver/driver.ts +17 -9
  6. package/s/driver/fns/schematic.ts +44 -21
  7. package/s/driver/fns/work.ts +112 -97
  8. package/s/features/transition/parts/fragment.ts +24 -0
  9. package/s/features/transition/parts/types.ts +94 -0
  10. package/s/features/transition/parts/uniforms.ts +29 -0
  11. package/s/features/transition/parts/vertex.ts +31 -0
  12. package/s/features/transition/transition.ts +60 -0
  13. package/s/index.html.ts +6 -1
  14. package/s/timeline/parts/basics.ts +1 -1
  15. package/s/timeline/parts/compositor/export.ts +77 -0
  16. package/s/timeline/parts/compositor/parts/html-tree.ts +37 -0
  17. package/s/timeline/parts/compositor/parts/schedulers.ts +85 -0
  18. package/s/timeline/parts/compositor/parts/tree-builder.ts +184 -0
  19. package/s/timeline/parts/compositor/parts/webcodecs-tree.ts +30 -0
  20. package/s/timeline/parts/compositor/playback.ts +81 -0
  21. package/s/timeline/parts/compositor/samplers/html.ts +115 -0
  22. package/s/timeline/parts/compositor/samplers/webcodecs.ts +60 -0
  23. package/s/timeline/parts/item.ts +38 -6
  24. package/s/timeline/parts/media.ts +21 -0
  25. package/s/timeline/parts/waveform.ts +1 -1
  26. package/s/timeline/sugar/builders.ts +102 -0
  27. package/s/timeline/sugar/o.ts +75 -16
  28. package/s/timeline/sugar/omni-test.ts +2 -2
  29. package/s/timeline/sugar/omni.ts +14 -11
  30. package/s/timeline/timeline.ts +22 -0
  31. package/s/timeline/types.ts +29 -0
  32. package/s/timeline/utils/audio-stream.ts +15 -0
  33. package/s/timeline/utils/matrix.ts +33 -0
  34. package/s/timeline/utils/video-cursor.ts +40 -0
  35. package/x/demo/demo.bundle.min.js +39 -37
  36. package/x/demo/demo.bundle.min.js.map +4 -4
  37. package/x/demo/demo.css +5 -0
  38. package/x/demo/routines/transcode-test.js +4 -2
  39. package/x/demo/routines/transcode-test.js.map +1 -1
  40. package/x/demo/routines/transitions-test.d.ts +5 -0
  41. package/x/demo/routines/transitions-test.js +35 -0
  42. package/x/demo/routines/transitions-test.js.map +1 -0
  43. package/x/driver/driver.d.ts +3 -5
  44. package/x/driver/driver.js +16 -9
  45. package/x/driver/driver.js.map +1 -1
  46. package/x/driver/driver.worker.bundle.min.js +2537 -148
  47. package/x/driver/driver.worker.bundle.min.js.map +4 -4
  48. package/x/driver/fns/host.d.ts +9 -2
  49. package/x/driver/fns/schematic.d.ts +38 -20
  50. package/x/driver/fns/work.d.ts +11 -4
  51. package/x/driver/fns/work.js +105 -96
  52. package/x/driver/fns/work.js.map +1 -1
  53. package/x/features/speech/transcribe/worker.bundle.min.js +541 -541
  54. package/x/features/speech/transcribe/worker.bundle.min.js.map +4 -4
  55. package/x/features/transition/parts/fragment.d.ts +1 -0
  56. package/x/features/transition/parts/fragment.js +25 -0
  57. package/x/features/transition/parts/fragment.js.map +1 -0
  58. package/x/features/transition/parts/types.d.ts +23 -0
  59. package/x/features/transition/parts/types.js +2 -0
  60. package/x/features/transition/parts/types.js.map +1 -0
  61. package/x/features/transition/parts/uniforms.d.ts +31 -0
  62. package/x/features/transition/parts/uniforms.js +27 -0
  63. package/x/features/transition/parts/uniforms.js.map +1 -0
  64. package/x/features/transition/parts/vertex.d.ts +1 -0
  65. package/x/features/transition/parts/vertex.js +32 -0
  66. package/x/features/transition/parts/vertex.js.map +1 -0
  67. package/x/features/transition/transition.d.ts +5 -0
  68. package/x/features/transition/transition.js +50 -0
  69. package/x/features/transition/transition.js.map +1 -0
  70. package/x/index.html +13 -3
  71. package/x/index.html.js +6 -1
  72. package/x/index.html.js.map +1 -1
  73. package/x/timeline/parts/basics.d.ts +1 -1
  74. package/x/timeline/parts/compositor/export.d.ts +9 -0
  75. package/x/timeline/parts/compositor/export.js +64 -0
  76. package/x/timeline/parts/compositor/export.js.map +1 -0
  77. package/x/timeline/parts/compositor/parts/html-tree.d.ts +3 -0
  78. package/x/timeline/parts/compositor/parts/html-tree.js +40 -0
  79. package/x/timeline/parts/compositor/parts/html-tree.js.map +1 -0
  80. package/x/timeline/parts/compositor/parts/schedulers.d.ts +15 -0
  81. package/x/timeline/parts/compositor/parts/schedulers.js +64 -0
  82. package/x/timeline/parts/compositor/parts/schedulers.js.map +1 -0
  83. package/x/timeline/parts/compositor/parts/tree-builder.d.ts +37 -0
  84. package/x/timeline/parts/compositor/parts/tree-builder.js +147 -0
  85. package/x/timeline/parts/compositor/parts/tree-builder.js.map +1 -0
  86. package/x/timeline/parts/compositor/parts/webcodecs-tree.d.ts +3 -0
  87. package/x/timeline/parts/compositor/parts/webcodecs-tree.js +28 -0
  88. package/x/timeline/parts/compositor/parts/webcodecs-tree.js.map +1 -0
  89. package/x/timeline/parts/compositor/playback.d.ts +19 -0
  90. package/x/timeline/parts/compositor/playback.js +71 -0
  91. package/x/timeline/parts/compositor/playback.js.map +1 -0
  92. package/x/timeline/parts/compositor/samplers/html.d.ts +3 -0
  93. package/x/timeline/parts/compositor/samplers/html.js +106 -0
  94. package/x/timeline/parts/compositor/samplers/html.js.map +1 -0
  95. package/x/timeline/parts/compositor/samplers/webcodecs.d.ts +2 -0
  96. package/x/timeline/parts/compositor/samplers/webcodecs.js +55 -0
  97. package/x/timeline/parts/compositor/samplers/webcodecs.js.map +1 -0
  98. package/x/timeline/parts/item.d.ts +34 -8
  99. package/x/timeline/parts/item.js +6 -3
  100. package/x/timeline/parts/item.js.map +1 -1
  101. package/x/timeline/parts/media.d.ts +3 -0
  102. package/x/timeline/parts/media.js +17 -0
  103. package/x/timeline/parts/media.js.map +1 -1
  104. package/x/timeline/parts/waveform.js +1 -1
  105. package/x/timeline/parts/waveform.js.map +1 -1
  106. package/x/timeline/sugar/builders.d.ts +96 -0
  107. package/x/timeline/sugar/builders.js +108 -0
  108. package/x/timeline/sugar/builders.js.map +1 -0
  109. package/x/timeline/sugar/o.d.ts +21 -8
  110. package/x/timeline/sugar/o.js +63 -14
  111. package/x/timeline/sugar/o.js.map +1 -1
  112. package/x/timeline/sugar/omni-test.js +1 -1
  113. package/x/timeline/sugar/omni-test.js.map +1 -1
  114. package/x/timeline/sugar/omni.d.ts +7 -3
  115. package/x/timeline/sugar/omni.js +9 -8
  116. package/x/timeline/sugar/omni.js.map +1 -1
  117. package/x/timeline/timeline.d.ts +9 -0
  118. package/x/timeline/timeline.js +22 -0
  119. package/x/timeline/timeline.js.map +1 -0
  120. package/x/timeline/types.d.ts +24 -0
  121. package/x/timeline/types.js +2 -0
  122. package/x/timeline/types.js.map +1 -0
  123. package/x/timeline/utils/audio-stream.d.ts +6 -0
  124. package/x/timeline/utils/audio-stream.js +17 -0
  125. package/x/timeline/utils/audio-stream.js.map +1 -0
  126. package/x/timeline/utils/matrix.d.ts +8 -0
  127. package/x/timeline/utils/matrix.js +26 -0
  128. package/x/timeline/utils/matrix.js.map +1 -0
  129. package/x/timeline/utils/video-cursor.d.ts +10 -0
  130. package/x/timeline/utils/video-cursor.js +36 -0
  131. package/x/timeline/utils/video-cursor.js.map +1 -0
  132. package/x/tools/speech-recognition/whisper/parts/worker.bundle.min.js +6 -6
  133. package/x/tools/speech-recognition/whisper/parts/worker.bundle.min.js.map +4 -4
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -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,MAAM,EAAE,CAAA;IACrC,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAE,CAAA;IACvC,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC,CAAA;IACtC,MAAM,QAAQ,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC,CAAA;IAEpC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;QACzB,SAAS,EAAE,IAAI,SAAS,CAAC;YACxB,MAAM;YACN,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;SACnC,CAAC;QACF,SAAS,EAAE;YACV,IAAI,EAAE,UAAU;YAChB,EAAE,EAAE,QAAQ;YACZ,QAAQ,EAAE;gBACT,GAAG,QAAQ,CAAC,MAAM;gBAClB,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC;aAC9B;SACD;KACD,CAAC,CAAA;IAEF,gBAAgB,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAA;IAEnC,OAAO;QACN,MAAM,CAAC,EAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAA4B;YACpE,IAAG,gBAAgB,CAAC,KAAK,KAAK,KAAK,IAAI,gBAAgB,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAC3E,gBAAgB,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,MAAM,EAAC,CAAC,CAAA;gBACzC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YAC/C,CAAC;YAED,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAA;YAC1B,QAAQ,CAAC,QAAQ,GAAG,EAAE,CAAA;YACtB,UAAU,CAAC,MAAM,EAAE,CAAA;YACnB,QAAQ,CAAC,MAAM,EAAE,CAAA;YAEjB,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAA;YAEtD,QAAQ,CAAC,MAAM,CAAC;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=a1a457609cb3"></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-7</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,CAA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,CAAC,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,9 @@
1
+ import { TimelineFile } from "../basics.js";
2
+ import { DecoderSource } from "../../../driver/fns/schematic.js";
3
+ export declare class Export {
4
+ #private;
5
+ private framerate;
6
+ private resolveMedia;
7
+ constructor(framerate?: number, resolveMedia?: (hash: string) => DecoderSource);
8
+ render(timeline: TimelineFile): Promise<void>;
9
+ }
@@ -0,0 +1,64 @@
1
+ import { context } from "../../../context.js";
2
+ import { fixedStep } from "./parts/schedulers.js";
3
+ import { makeWebCodecsSampler } from "./samplers/webcodecs.js";
4
+ import { buildWebCodecsNodeTree } from "./parts/webcodecs-tree.js";
5
+ export class Export {
6
+ framerate;
7
+ resolveMedia;
8
+ #sampler;
9
+ constructor(framerate = 30, resolveMedia = _hash => "/assets/temp/gl.mp4") {
10
+ this.framerate = framerate;
11
+ this.resolveMedia = resolveMedia;
12
+ this.#sampler = makeWebCodecsSampler(this.resolveMedia);
13
+ }
14
+ async #build(timeline) {
15
+ const rootItem = new Map(timeline.items.map(i => [i.id, i])).get(timeline.rootId);
16
+ const items = new Map(timeline.items.map(i => [i.id, i]));
17
+ return await buildWebCodecsNodeTree(rootItem, items, this.#sampler);
18
+ }
19
+ async render(timeline) {
20
+ const root = await this.#build(timeline);
21
+ const driver = await context.driver;
22
+ const videoStream = new TransformStream();
23
+ const audioStream = new TransformStream();
24
+ const encodePromise = 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 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,OAAO,EAAC,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAA;AAE5D,OAAO,EAAC,sBAAsB,EAAC,MAAM,2BAA2B,CAAA;AAEhE,MAAM,OAAO,MAAM;IAGT;IACA;IAHT,QAAQ,CAAA;IACR,YACS,YAAY,EAAE,EACd,eAAgD,KAAK,CAAC,EAAE,CAAC,qBAAqB;QAD9E,cAAS,GAAT,SAAS,CAAK;QACd,iBAAY,GAAZ,YAAY,CAAkE;QAEtF,IAAI,CAAC,QAAQ,GAAG,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACxD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAAsB;QAClC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CA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.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: (t: 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,64 @@
1
+ export const realtime = (onTick) => {
2
+ let playing = false;
3
+ let rafId = null;
4
+ let fps = 60;
5
+ let frameDuration = 1000 / fps;
6
+ let currentTimeS = 0;
7
+ let lastTime = 0;
8
+ let accumulator = 0;
9
+ const tick = (now) => {
10
+ if (!playing)
11
+ return;
12
+ const deltaTime = now - lastTime;
13
+ lastTime = now;
14
+ accumulator += deltaTime;
15
+ while (accumulator >= frameDuration) {
16
+ onTick(currentTimeS);
17
+ currentTimeS += frameDuration / 1000;
18
+ accumulator -= frameDuration;
19
+ }
20
+ rafId = requestAnimationFrame(tick);
21
+ };
22
+ return {
23
+ play() {
24
+ if (playing)
25
+ return;
26
+ playing = true;
27
+ lastTime = performance.now();
28
+ rafId = requestAnimationFrame(tick);
29
+ },
30
+ pause() {
31
+ if (!playing)
32
+ return;
33
+ playing = false;
34
+ if (rafId !== null)
35
+ cancelAnimationFrame(rafId);
36
+ rafId = null;
37
+ },
38
+ seek(t) {
39
+ currentTimeS = Math.max(0, t);
40
+ accumulator = 0;
41
+ },
42
+ dispose() {
43
+ this.pause();
44
+ },
45
+ isPlaying() {
46
+ return playing;
47
+ },
48
+ setFPS(v) {
49
+ fps = v;
50
+ frameDuration = 1000 / fps;
51
+ }
52
+ };
53
+ };
54
+ export const fixedStep = async (opts, onFrame) => {
55
+ const dt = 1 / opts.fps;
56
+ const total = Math.ceil(opts.duration * opts.fps);
57
+ for (let i = 0; i < total; i++) {
58
+ if (opts.abort?.aborted)
59
+ break;
60
+ const t = i * dt;
61
+ await onFrame(t, i);
62
+ }
63
+ };
64
+ //# 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,CAAC,MAA2B,EAAsB,EAAE;IAC1E,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,IAAI,KAAK,GAAkB,IAAI,CAAA;IAC/B,IAAI,GAAG,GAAG,EAAE,CAAA;IAEZ,I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AAG,GAAG,CAAC,CAAA;YACP,aAAa,GAAG,IAAI,GAAG,GAAG,CAAA;QAC3B,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAQD,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAC7B,IAAsB,EACtB,OAA2D,EAC1D,EAAE;IACH,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAA;IACvB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;IAEjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,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 {};