From fa7b36f69fc9df882c393820dbe6003603c19c1b Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Wed, 25 Sep 2024 15:46:05 +0800 Subject: [PATCH] reformat --- src/main/ffmpeg.ts | 17 +++++++++++++++-- src/renderer/src/hooks/useFrameCapture.ts | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/main/ffmpeg.ts b/src/main/ffmpeg.ts index 2970dd12..1fb536e2 100644 --- a/src/main/ffmpeg.ts +++ b/src/main/ffmpeg.ts @@ -53,7 +53,12 @@ export function abortFfmpegs() { }); } -function handleProgress(process: { stderr: Readable | null }, durationIn: number | undefined, onProgress: (a: number) => void, customMatcher: (a: string) => void = () => undefined) { +function handleProgress( + process: { stderr: Readable | null }, + durationIn: number | undefined, + onProgress: (a: number) => void, + customMatcher: (a: string) => void = () => undefined, +) { if (!onProgress) return; if (process.stderr == null) return; onProgress(0); @@ -425,7 +430,15 @@ function getCodecOpts(captureFormat: CaptureFormat) { } export async function captureFrames({ from, to, videoPath, outPathTemplate, quality, filter, framePts, onProgress, captureFormat }: { - from: number, to: number, videoPath: string, outPathTemplate: string, quality: number, filter?: string | undefined, framePts?: boolean | undefined, onProgress: (p: number) => void, captureFormat: CaptureFormat, + from: number, + to: number, + videoPath: string, + outPathTemplate: string, + quality: number, + filter?: string | undefined, + framePts?: boolean | undefined, + onProgress: (p: number) => void, + captureFormat: CaptureFormat, }) { const args = [ '-ss', String(from), diff --git a/src/renderer/src/hooks/useFrameCapture.ts b/src/renderer/src/hooks/useFrameCapture.ts index f213ae1d..0e4b552c 100644 --- a/src/renderer/src/hooks/useFrameCapture.ts +++ b/src/renderer/src/hooks/useFrameCapture.ts @@ -25,9 +25,22 @@ function getFrameFromVideo(video: HTMLVideoElement, format: CaptureFormat, quali return dataUriToBuffer(dataUri); } -export default ({ formatTimecode, treatOutputFileModifiedTimeAsStart }: { formatTimecode: FormatTimecode, treatOutputFileModifiedTimeAsStart?: boolean | undefined | null }) => { +export default ({ formatTimecode, treatOutputFileModifiedTimeAsStart }: { + formatTimecode: FormatTimecode, + treatOutputFileModifiedTimeAsStart?: boolean | undefined | null, +}) => { const captureFramesRange = useCallback(async ({ customOutDir, filePath, fps, fromTime, toTime, estimatedMaxNumFiles, captureFormat, quality, filter, onProgress, outputTimestamps }: { - customOutDir, filePath: string, fps: number, fromTime: number, toTime: number, estimatedMaxNumFiles: number, captureFormat: CaptureFormat, quality: number, filter?: string | undefined, onProgress: (a: number) => void, outputTimestamps: boolean + customOutDir: string | undefined, + filePath: string, + fps: number, + fromTime: number, + toTime: number, + estimatedMaxNumFiles: number, + captureFormat: CaptureFormat, + quality: number, + filter?: string | undefined, + onProgress: (a: number) => void, + outputTimestamps: boolean, }) => { const getSuffix = (prefix: string) => `${prefix}.${captureFormat}`;