mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-07 10:06:21 +00:00
feat: add video frame format render option (#1481)
* feat: add video frame format render option * refactor: single source of truth for video-frame-format allow-list Addresses PR review (Via) on #1481: the ["auto","jpg","png"] set was declared three times — render.ts (VIDEO_FRAME_FORMATS), server.ts (inline includes), and renderConfigValidation.ts (ALLOWED_VIDEO_FRAME_FORMATS) — three boundaries to update when a new extraction format lands. Hoist the constant + a reusable `isVideoFrameFormat` type guard into @hyperframes/engine (where VideoFrameFormat is defined) and route all three call sites through them. Behavior unchanged; also drops two `as RenderConfig[...]` casts in favor of the guard (narrowing over assertion, per repo TS conventions). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Xuelong Mu <xuelongmu@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
Xuelong Mu
parent
e812fc8895
commit
36b24acf20
@@ -30,6 +30,7 @@ describe("validateDistributedRenderConfig", () => {
|
||||
maxParallelChunks: 16,
|
||||
runtimeCap: "lambda",
|
||||
hdrMode: "force-sdr",
|
||||
videoFrameFormat: "png",
|
||||
};
|
||||
expect(validateDistributedRenderConfig(cfg)).toBe(cfg);
|
||||
});
|
||||
@@ -92,6 +93,14 @@ describe("validateDistributedRenderConfig", () => {
|
||||
{ ...VALID, bitrate: "fast" } satisfies SerializableDistributedRenderConfig,
|
||||
"config.bitrate",
|
||||
],
|
||||
[
|
||||
"unsupported videoFrameFormat",
|
||||
{
|
||||
...VALID,
|
||||
videoFrameFormat: "webp",
|
||||
} as unknown as SerializableDistributedRenderConfig,
|
||||
"config.videoFrameFormat",
|
||||
],
|
||||
[
|
||||
"non-positive chunkSize",
|
||||
{ ...VALID, chunkSize: 0 } satisfies SerializableDistributedRenderConfig,
|
||||
|
||||
Reference in New Issue
Block a user