web/libav/wrapper: add support for encode variant
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
"@fontsource-variable/noto-sans-mono": "^5.0.20",
|
||||
"@fontsource/ibm-plex-mono": "^5.0.13",
|
||||
"@fontsource/redaction-10": "^5.0.2",
|
||||
"@imput/libav.js-encode-cli": "6.5.7",
|
||||
"@imput/libav.js-remux-cli": "^6.5.7",
|
||||
"@imput/version-info": "workspace:^",
|
||||
"@sveltejs/adapter-static": "^3.0.6",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { OPFSStorage } from "$lib/storage";
|
||||
import LibAV, { type LibAV as LibAVInstance } from "@imput/libav.js-remux-cli";
|
||||
import EncodeLibAV from "@imput/libav.js-encode-cli";
|
||||
|
||||
import type { FfprobeData } from "fluent-ffmpeg";
|
||||
import type { FFmpegProgressCallback, FFmpegProgressEvent, FFmpegProgressStatus, RenderParams } from "$lib/types/libav";
|
||||
@@ -16,13 +17,22 @@ export default class LibAVWrapper {
|
||||
}
|
||||
|
||||
init(options?: LibAV.LibAVOpts) {
|
||||
if (!options) options = {
|
||||
yesthreads: true,
|
||||
const variant = options?.variant || 'remux';
|
||||
let constructor: typeof LibAV.LibAV;
|
||||
|
||||
if (variant === 'remux') {
|
||||
constructor = LibAV.LibAV;
|
||||
} else if (variant === 'encode') {
|
||||
constructor = EncodeLibAV.LibAV;
|
||||
} else {
|
||||
throw "invalid variant";
|
||||
}
|
||||
|
||||
if (this.concurrency && !this.libav) {
|
||||
this.libav = LibAV.LibAV({
|
||||
this.libav = constructor({
|
||||
...options,
|
||||
variant: undefined,
|
||||
yesthreads: true,
|
||||
base: '/_libav'
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user