fix(producer): accept plain integer fps in createRenderJob

The rational `Fps = { num, den }` refactor in 5dcc89c broke callers
passing `fps: 30` (the form documented in every code example and used
by external consumers). FFmpeg received `undefined/undefined` as the
framerate, causing a cryptic exit-code error.

Add `FpsInput = number | Fps` and `toFps()` normalizer in
@hyperframes/core. `createRenderJob` now accepts both forms —
plain integers are promoted to `{ num, den: 1 }` at the boundary;
`RenderConfig.fps` stays strict `Fps` internally so no downstream
code changes.

Also fixes the producer and engine docs, which showed phantom
`input`/`output` fields on `createRenderJob` and a wrong
`executeRenderJob(job)` signature (missing `projectDir`/`outputPath`
args).

Closes #1031
This commit is contained in:
Miguel Ángel
2026-05-22 13:35:16 -04:00
parent 6c191e2292
commit 215811334f
6 changed files with 26 additions and 14 deletions
+9
View File
@@ -20,6 +20,15 @@ export interface Fps {
den: number;
}
export type FpsInput = number | Fps;
export function toFps(input: FpsInput): Fps {
if (typeof input === "number") {
return { num: input, den: 1 };
}
return input;
}
/**
* Decimal value of an {@link Fps} rational. Used at sites that need a
* `number` for arithmetic (frame-index → time, frame intervals, telemetry
+2
View File
@@ -12,6 +12,7 @@ export type {
MediaElementType,
CanvasResolution,
Fps,
FpsInput,
FpsParseResult,
MediaFile,
CompositionAPI,
@@ -42,6 +43,7 @@ export {
normalizeResolutionFlag,
parseFps,
parseFpsWithDefault,
toFps,
fpsToNumber,
fpsToFfmpegArg,
TIMELINE_COLORS,