Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
mifi committed Sep 25, 2024
1 parent 6c9b1ba commit fa7b36f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
17 changes: 15 additions & 2 deletions src/main/ffmpeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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),
Expand Down
17 changes: 15 additions & 2 deletions src/renderer/src/hooks/useFrameCapture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;

Expand Down

0 comments on commit fa7b36f

Please sign in to comment.