@ifor-lux/cuteditor-wasm 0.2.11
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.
- package/README.md +45 -0
- package/cuteditor_wasm.d.ts +155 -0
- package/cuteditor_wasm.js +9 -0
- package/cuteditor_wasm_bg.js +2850 -0
- package/cuteditor_wasm_bg.wasm +0 -0
- package/package.json +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# opencut-wasm
|
|
2
|
+
|
|
3
|
+
Shared video editor logic compiled to WebAssembly. Used by the [OpenCut](https://github.com/opencut/opencut) web app.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install opencut-wasm
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { formatTimecode, mediaTimeFromSeconds } from "opencut-wasm";
|
|
15
|
+
|
|
16
|
+
const ticks = mediaTimeFromSeconds(1.5);
|
|
17
|
+
const label = formatTimecode({ ticks });
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
All exports are documented in the [TypeScript definitions](./opencut_wasm.d.ts).
|
|
21
|
+
|
|
22
|
+
## Source
|
|
23
|
+
|
|
24
|
+
Functions are implemented in Rust under [`rust/crates/`](../crates/). This package is the compiled WebAssembly output — do not edit it directly.
|
|
25
|
+
|
|
26
|
+
## Local development
|
|
27
|
+
|
|
28
|
+
The web app depends on the published `opencut-wasm` package by default. If you are editing the WASM source in this repo and want `apps/web` to use your local build instead:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# From the repo root
|
|
32
|
+
bun run build:wasm
|
|
33
|
+
|
|
34
|
+
cd rust/wasm/pkg
|
|
35
|
+
bun link
|
|
36
|
+
|
|
37
|
+
cd ../../../apps/web
|
|
38
|
+
bun link opencut-wasm
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
While you work, rebuild on changes from the repo root:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
bun dev:wasm
|
|
45
|
+
```
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export interface FloorToFrameOptions {
|
|
4
|
+
time: MediaTime;
|
|
5
|
+
rate: FrameRate;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface FormatTimecodeOptions {
|
|
9
|
+
time: MediaTime;
|
|
10
|
+
format?: TimeCodeFormat;
|
|
11
|
+
rate?: FrameRate;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface FrameRate {
|
|
15
|
+
numerator: number;
|
|
16
|
+
denominator: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface GuessTimecodeFormatOptions {
|
|
20
|
+
timeCode: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface IsFrameAlignedOptions {
|
|
24
|
+
time: MediaTime;
|
|
25
|
+
rate: FrameRate;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface LastFrameTimeOptions {
|
|
29
|
+
duration: MediaTime;
|
|
30
|
+
rate: FrameRate;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface MediaTimeAddOptions {
|
|
34
|
+
lhs: MediaTime;
|
|
35
|
+
rhs: MediaTime;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface MediaTimeClampOptions {
|
|
39
|
+
time: MediaTime;
|
|
40
|
+
min: MediaTime;
|
|
41
|
+
max: MediaTime;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface MediaTimeFromFrameOptions {
|
|
45
|
+
frame: number;
|
|
46
|
+
rate: FrameRate;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface MediaTimeFromSecondsOptions {
|
|
50
|
+
seconds: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface MediaTimeMaxOptions {
|
|
54
|
+
lhs: MediaTime;
|
|
55
|
+
rhs: MediaTime;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface MediaTimeMinOptions {
|
|
59
|
+
lhs: MediaTime;
|
|
60
|
+
rhs: MediaTime;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface MediaTimeSubOptions {
|
|
64
|
+
lhs: MediaTime;
|
|
65
|
+
rhs: MediaTime;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface MediaTimeToFrameOptions {
|
|
69
|
+
time: MediaTime;
|
|
70
|
+
rate: FrameRate;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface MediaTimeToSecondsOptions {
|
|
74
|
+
time: MediaTime;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface ParseTimecodeOptions {
|
|
78
|
+
timeCode: string;
|
|
79
|
+
format?: TimeCodeFormat;
|
|
80
|
+
rate?: FrameRate;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface RoundToFrameOptions {
|
|
84
|
+
time: MediaTime;
|
|
85
|
+
rate: FrameRate;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface SnappedSeekTimeOptions {
|
|
89
|
+
time: MediaTime;
|
|
90
|
+
duration: MediaTime;
|
|
91
|
+
rate: FrameRate;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type MediaTime = number;
|
|
95
|
+
|
|
96
|
+
export type TimeCodeFormat = "MM:SS" | "HH:MM:SS" | "HH:MM:SS:CS" | "HH:MM:SS:FF";
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
export function TICKS_PER_SECOND(): number;
|
|
100
|
+
|
|
101
|
+
export function applyEffectPasses(options: any): OffscreenCanvas;
|
|
102
|
+
|
|
103
|
+
export function applyMaskFeather(options: any): OffscreenCanvas;
|
|
104
|
+
|
|
105
|
+
export function floorToFrame(arg0: FloorToFrameOptions): MediaTime | undefined;
|
|
106
|
+
|
|
107
|
+
export function formatTimecode(arg0: FormatTimecodeOptions): string | undefined;
|
|
108
|
+
|
|
109
|
+
export function getCompositorCanvas(): HTMLCanvasElement;
|
|
110
|
+
|
|
111
|
+
export function getLastFrameProfile(): Array<any>;
|
|
112
|
+
|
|
113
|
+
export function guessTimecodeFormat(arg0: GuessTimecodeFormatOptions): TimeCodeFormat | undefined;
|
|
114
|
+
|
|
115
|
+
export function initCompositor(width: number, height: number): void;
|
|
116
|
+
|
|
117
|
+
export function initializeGpu(): Promise<void>;
|
|
118
|
+
|
|
119
|
+
export function isFrameAligned(arg0: IsFrameAlignedOptions): boolean | undefined;
|
|
120
|
+
|
|
121
|
+
export function lastFrameTime(arg0: LastFrameTimeOptions): MediaTime | undefined;
|
|
122
|
+
|
|
123
|
+
export function mediaTimeAdd(arg0: MediaTimeAddOptions): MediaTime;
|
|
124
|
+
|
|
125
|
+
export function mediaTimeClamp(arg0: MediaTimeClampOptions): MediaTime;
|
|
126
|
+
|
|
127
|
+
export function mediaTimeFromFrame(arg0: MediaTimeFromFrameOptions): MediaTime | undefined;
|
|
128
|
+
|
|
129
|
+
export function mediaTimeFromSeconds(arg0: MediaTimeFromSecondsOptions): MediaTime | undefined;
|
|
130
|
+
|
|
131
|
+
export function mediaTimeMax(arg0: MediaTimeMaxOptions): MediaTime;
|
|
132
|
+
|
|
133
|
+
export function mediaTimeMin(arg0: MediaTimeMinOptions): MediaTime;
|
|
134
|
+
|
|
135
|
+
export function mediaTimeSub(arg0: MediaTimeSubOptions): MediaTime;
|
|
136
|
+
|
|
137
|
+
export function mediaTimeToFrame(arg0: MediaTimeToFrameOptions): bigint | undefined;
|
|
138
|
+
|
|
139
|
+
export function mediaTimeToSeconds(arg0: MediaTimeToSecondsOptions): number;
|
|
140
|
+
|
|
141
|
+
export function parseTimecode(arg0: ParseTimecodeOptions): MediaTime | undefined;
|
|
142
|
+
|
|
143
|
+
export function registerEffectShader(name: string, wgsl_source: string): void;
|
|
144
|
+
|
|
145
|
+
export function releaseTexture(id: string): void;
|
|
146
|
+
|
|
147
|
+
export function renderFrame(options: any): void;
|
|
148
|
+
|
|
149
|
+
export function resizeCompositor(width: number, height: number): void;
|
|
150
|
+
|
|
151
|
+
export function roundToFrame(arg0: RoundToFrameOptions): MediaTime | undefined;
|
|
152
|
+
|
|
153
|
+
export function snappedSeekTime(arg0: SnappedSeekTimeOptions): MediaTime | undefined;
|
|
154
|
+
|
|
155
|
+
export function uploadTexture(options: any): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./cuteditor_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
import * as wasm from "./cuteditor_wasm_bg.wasm";
|
|
4
|
+
import { __wbg_set_wasm } from "./cuteditor_wasm_bg.js";
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
TICKS_PER_SECOND, applyEffectPasses, applyMaskFeather, floorToFrame, formatTimecode, getCompositorCanvas, getLastFrameProfile, guessTimecodeFormat, initCompositor, initializeGpu, isFrameAligned, lastFrameTime, mediaTimeAdd, mediaTimeClamp, mediaTimeFromFrame, mediaTimeFromSeconds, mediaTimeMax, mediaTimeMin, mediaTimeSub, mediaTimeToFrame, mediaTimeToSeconds, parseTimecode, registerEffectShader, releaseTexture, renderFrame, resizeCompositor, roundToFrame, snappedSeekTime, uploadTexture
|
|
9
|
+
} from "./cuteditor_wasm_bg.js";
|