Complete ffmpeg movie fallback wiring
This commit is contained in:
@@ -129,6 +129,19 @@ export async function probeSequencerCodec(
|
|||||||
return probeMovie(request, source);
|
return probeMovie(request, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Probe a movie with the browser decoder first, then use the local ffmpeg.wasm
|
||||||
|
* Worker when Chromium cannot decode the container/codec. */
|
||||||
|
export async function probeSequencerMovieCodecWithFallback(
|
||||||
|
requestValue: unknown,
|
||||||
|
source: ArrayBuffer,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
): Promise<SequencerCodecProbeResultIR> {
|
||||||
|
const browserResult = await probeSequencerCodec(requestValue, source);
|
||||||
|
if (browserResult.status === "READY") return browserResult;
|
||||||
|
const { probeMovieWithFFmpeg } = await import("./FFmpegMovieProbe");
|
||||||
|
return probeMovieWithFFmpeg(requestValue, source, signal);
|
||||||
|
}
|
||||||
|
|
||||||
export function createSequencerCodecProbeRequest(
|
export function createSequencerCodecProbeRequest(
|
||||||
stripType: SequencerCodecProbeRequestIR["stripType"],
|
stripType: SequencerCodecProbeRequestIR["stripType"],
|
||||||
mimeType: string,
|
mimeType: string,
|
||||||
|
|||||||
@@ -88,6 +88,21 @@ export async function generateInitialSequencerMovieProxyFrame(
|
|||||||
throw new SequencerMediaCacheValidationError("SEQUENCER_CACHE_SOURCE_MISMATCH", "Movie proxy source bytes failed identity verification");
|
throw new SequencerMediaCacheValidationError("SEQUENCER_CACHE_SOURCE_MISMATCH", "Movie proxy source bytes failed identity verification");
|
||||||
}
|
}
|
||||||
cancelled(signal);
|
cancelled(signal);
|
||||||
|
if (capability.backend === "FFMPEG_WASM") {
|
||||||
|
try {
|
||||||
|
const { decodeMovieFrameWithFFmpeg } = await import("./FFmpegMovieProbe");
|
||||||
|
const frame = await decodeMovieFrameWithFFmpeg(source, sourceData, profile.width, profile.height, signal);
|
||||||
|
cancelled(signal);
|
||||||
|
return {
|
||||||
|
manifest: await createSequencerMediaCacheManifest(source, capability, profile, 0, frame.rgba),
|
||||||
|
data: frame.rgba,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
if (error instanceof DOMException && error.name === "AbortError") throw new SequencerMediaCacheValidationError("SEQUENCER_CANCELLED", "Movie proxy generation was cancelled");
|
||||||
|
throw new SequencerMediaCacheValidationError("SEQUENCER_CODEC_UNSUPPORTED", "ffmpeg.wasm movie proxy frame decode failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
if (typeof document === "undefined" || typeof HTMLMediaElement === "undefined") {
|
if (typeof document === "undefined" || typeof HTMLMediaElement === "undefined") {
|
||||||
throw new SequencerMediaCacheValidationError("SEQUENCER_CODEC_UNSUPPORTED", "HTML media proxy generation is unavailable");
|
throw new SequencerMediaCacheValidationError("SEQUENCER_CODEC_UNSUPPORTED", "HTML media proxy generation is unavailable");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user