Skip to content

Commit

Permalink
build working
Browse files Browse the repository at this point in the history
  • Loading branch information
BrtqKr committed Oct 30, 2024
1 parent 420f353 commit 577f016
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ts/@live-compositor/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
"/cjs"
],
"devDependencies": {
"@types/react": "^18.3.3",
"@types/react-reconciler": "0.28.8"
},
"dependencies": {
"react-reconciler": "0.29.2"
},
"peerDependencies": {
"react": "^18.3.1",
"live-compositor": "workspace:^0.1.0"
}
}
2 changes: 1 addition & 1 deletion ts/@live-compositor/web-wasm/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"module": "ESNext",
Expand Down
4 changes: 4 additions & 0 deletions ts/examples/vite-browser-render/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dependencies": {
"@live-compositor/browser-render": "workspace:0.1.0-rc.4",
"@live-compositor/web-wasm": "workspace:0.1.0-rc.0",
"mp4box": "^0.5.2",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
Expand All @@ -24,5 +25,8 @@
"typescript-eslint": "^8.0.1",
"vite": "^5.4.1",
"vite-plugin-static-copy": "^1.0.6"
},
"peerDependencies": {
"live-compositor": "workspace:^0.1.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class MP4Decoder {
console.log(`Using codec: ${videoTrack.codec}`);

const trak = this.file.getTrackById(videoTrack.id);
if (!trak) return;
const description = getCodecDescription(trak);
if (!description) {
console.error('Codec description not found');
Expand Down
112 changes: 112 additions & 0 deletions ts/examples/vite-browser-render/ts-declarations/mp4box.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
declare module 'mp4box' {
export class DataStream {
constructor(buffer?: ArrayBuffer, byteOffset?: number, endianness?: boolean);

get buffer(): ArrayBuffer;
set buffer(v: ArrayBuffer);

static LITTLE_ENDIAN: boolean;
static BIG_ENDIAN: boolean;
}

export interface MP4File {
onReady?: (info: MP4Info) => void;
onError?: (e: string) => void;
onSamples?: (id: number, user: object, samples: Sample[]) => void;

getTrackById(id: number): TrakBox | undefined;

appendBuffer(data: MP4ArrayBuffer): number;
start(): void;
stop(): void;
flush(): void;

setExtractionOptions(id: number, user?: object, options?: ExtractionOptions): void;
}

export interface MP4MediaTrack {
id: number;
movie_duration: number;
track_width: number;
track_height: number;
timescale: number;
duration: number;
bitrate: number;
codec: string;
}

export interface MP4VideoTrack extends MP4MediaTrack {
video: {
width: number;
height: number;
};
}

export interface MP4AudioTrack extends MP4MediaTrack {
audio: {
sample_size: number;
sample_rate: number;
channel_count: number;
};
}

export type MP4Track = MP4VideoTrack | MP4AudioTrack;

export interface MP4Info {
duration: number;
timescale: number;
tracks: MP4Track[];
audioTracks: MP4AudioTrack[];
videoTracks: MP4VideoTrack[];
}

export interface Sample {
timescale: number;
data: ArrayBuffer;
size: number;
duration: number;
cts: number;
dts: number;
is_sync: boolean;
depends: number;
}

export interface ExtractionOptions {
nbSamples: number;
}

export type MP4ArrayBuffer = ArrayBuffer & { fileStart: number };

export class Box {
write(stream: DataStream): void;
}

export class TrakBox extends Box {
mdia: MdiaBox;
}

export class MdiaBox extends Box {
minf: MinfBox;
}

export class MinfBox extends Box {
stbl: StblBox;
}

export class StblBox extends Box {
stsd: StsdBox;
}

export class StsdBox extends Box {
entries: Description[];
}

export interface Description {
avcC?: Box;
hvcC?: Box;
vpcC?: Box;
av1C?: Box;
}

export function createFile(): MP4File;
}
2 changes: 1 addition & 1 deletion ts/examples/vite-browser-render/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
"include": ["src", "ts-declarations"]
}
12 changes: 12 additions & 0 deletions ts/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 577f016

Please sign in to comment.