commit 82ca3c0540afdbadbb06430be2b61875376b8f71 parent 79dcb5f1a101ff11a8907a4debede3cf4df00fd5 Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st> Date: Sat, 14 Nov 2026 00:14:11 -0500 umtool full-frame review fixes: the deck keeps its slide, the finale its fade, a marked teaser its stamps, a chapter its entrance Review of 79dcb5f1a (ruling: no choreography change the operator was not asked about): 1. The regions that follow the deck's choreography -- the shell (the stacked deck's page too), the dial, the odometer, the trail, the feed -- carry `fullFrame: { followsDeck: true }` (a new module-contract key) and are given only a video entry's and an analysis item's spans, byte for byte what main laid; over a teaser, the intro or a card they keep their own slide away and back. fullFrameItems tags each item by kind; chromeBlackouts hands the items to chromeOverlayChain, which gives each region its share (regionSpans by its module's traits) -- the chunk, preview and --cut-window paths pass the same list through. Every other region gets every span. 2. `ownFade` (finale, dial-finale, runs-finale): an item's span starts once the dissolve into it is over, so the finale's own fade out through that dissolve plays whole. 3. A chapter bumper on the clip after a full-frame item starts on the first frame after the item's span (chrome-story.mjs chapterWindows), its entrance whole. 4. `drawsMarks` (stamp): a teaser that carries marks keeps its stamps, a dipping one too. 5. Spans end a frame before the end of the dissolve out (that frame is the next clip's alone); the deck's own regions keep main's end. The tests' enable parser reads negative (shifted-away) spans. Play: the deck's page, the feed and the instruments draw their own slide; the posts windows, the stamps, the play layers and the finale are hidden by the same traits (layerOffOver; the preview serves each region's `fullFrame`, a play layer carries its own). Docs: the "deck pops" paragraph is gone; report-video.md, the README's teaser, the teaser and shell module docs (knobs.md regenerated) and the CHANGELOG say what is left out, when, and what keeps. Co-Authored-By: Claude <noreply@anthropic.com> Diffstat:
27 files changed, 441 insertions(+), 196 deletions(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,19 +1,22 @@ # Changelog ## [Unreleased] -- **umtool: no chrome is drawn over a teaser, the brand intro or a full-frame card.** The deck already slid away over - them, but the diet strip, the promise clock, the goals, the streak chain, the peak, the stamps and the other layers - stayed on screen over the teaser's card. Now every layer is off over every item that takes the whole frame, as it - already was over a video entry and an analysis item. +- **umtool: the diet strip, the promise clock and the other layers are no longer drawn over a teaser, the brand + intro or a full-frame card.** The deck already slid away over them, but the measure extras, the side panels, the + chapters and the finale's pages stayed on screen over the teaser's card. Now they are left out over every item that + takes the whole frame, as they already were over a video entry and an analysis item. - Full frame: a teaser (unless it counts: marks and no dip), the brand intro, an analysis item, a video entry (unless `deck: "shown"`), and a card, scroll, chart or ledger under `deck.overCards: "hide"` (the default). - - The layers go at the first frame of the item's dissolve in, or, for a teaser that dips, at the frame the dip has - made black. They come back at the end of its dissolve out. A first item is clear from frame 0. - - At the default motion the deck's own slide away and back is inside those dissolves, so over them the deck is now - gone rather than sliding. A stamp that lands on a teaser that dips still counts, but is not drawn. - - Play the cut hides the deck and every layer while such an item is on screen. - - A cut with none of these items is laid exactly as before. The change is in how the overlays are laid, not in the - chrome's frames: cached frames are reused. + - Those layers go at the first frame of the item's dissolve in, or, for a teaser that dips, at the frame the dip has + made black. They are back on the last frame of its dissolve out, which shows only the next clip. + - The deck, the dial, the odometer, the trail and the feed are laid as before: they keep their own slide away and + back. + - The finale's pages finish their fade out through the dissolve into the item. A teaser that carries marks keeps + its stamps. + - A chapter bumper on the clip after such an item starts once the item has gone, so its entrance plays whole. + - Play the cut hides the same layers while such an item is on screen. + - A cut with none of these items is laid exactly as before. The change is in how the overlays are laid (and, after + such an item, in a chapter's window): other cached chrome frames are reused. - **Clip windows can be asked for taller than 720, and the 720 window stays.** A `maxHeight` above 720 on fetch-windows, fetch-window or `fetch_clip` asks for a taller window, up to the new setting `clips.windowMaxHeight` (default 1080; a taller ask is held to it and the answer says so). With no `maxHeight` a diff --git a/umtool/app/api/report/chrome/preview/route.ts b/umtool/app/api/report/chrome/preview/route.ts @@ -23,6 +23,7 @@ import { counterOrder } from "umtool-report-to-video/counter"; import { cachedTakeManifest, takePlayDir, writePlayManifest } from "@/lib/report/takeManifest.mjs"; import { isTakeId } from "@/lib/report/takes.mjs"; import { stackedOn } from "umtool-report-to-video/vertical-deck"; +import { MODULES } from "umtool-report-to-video/modules"; export const dynamic = "force-dynamic"; @@ -301,6 +302,13 @@ export async function POST(request: Request) { ...(stampDoc ? { stamp: stampDoc } : {}), ...(finale ? { finale } : {}), layers, + // Each region's traits over a full-frame item (its module's `fullFrame`, full-frame.mjs): Play hides the feed, + // the stamps and the finale by them, as the build lays them. + fullFrame: Object.fromEntries( + (MODULES as readonly { region?: string; fullFrame?: Record<string, boolean> }[]) + .filter((m) => m.fullFrame && m.region) + .map((m) => [m.region, m.fullFrame]), + ), // The lead-in breath before a clip's cut (render.leadIn): the play // window's start, which the live preview maps the source through. leadIn: typeof render.leadIn === "number" ? render.leadIn : 0.4, diff --git a/umtool/components/projects/OnscreenSection.tsx b/umtool/components/projects/OnscreenSection.tsx @@ -113,6 +113,8 @@ export type DeckPreviewDoc = { verdictLabels?: Record<string, string>; /** The play layers: every module that declares `play` (the module contract) and that the cut draws, by z. */ layers?: PlayLayer[]; + /** Each region's `fullFrame` traits (its module's), for the regions that carry any: the feed's, the stamps', the finale's. */ + fullFrame?: Record<string, FullFrameTraits>; }; /** * One module's live layer (the module contract's `play`, onscreen.mjs @@ -133,7 +135,11 @@ export type PlayLayer = { src?: string; error?: string; windows?: { segment: string | null; from: number; to: number; src?: string; error?: string }[]; + /** How it is laid over a full-frame item (its module's `fullFrame`, full-frame.mjs); absent, it is off over every one. */ + fullFrame?: FullFrameTraits; }; +/** A module's `fullFrame` traits (full-frame.mjs regionSpans, layerOffOver). */ +export type FullFrameTraits = { followsDeck?: boolean; ownFade?: boolean; drawsMarks?: boolean }; /** An unsaved change to a post, as PUT /api/report/posts takes it. */ export type PostPatch = { attachTo?: string | null; hide?: boolean; thread?: boolean }; /** What each segment's panel should say right now, by entry id. */ @@ -206,7 +212,6 @@ export function DeckFrame({ testid, children, className = "", - chromeOff = false, }: { preview: DeckPreviewDoc; t: number; @@ -215,8 +220,6 @@ export function DeckFrame({ testid?: string; children?: React.ReactNode; className?: string; - /** A full-frame item is on screen (full-frame.mjs): the deck's page is not drawn over it (kept loaded and seeked). */ - chromeOff?: boolean; }) { const box = useRef<HTMLDivElement | null>(null); const frame = useRef<HTMLIFrameElement | null>(null); @@ -304,9 +307,8 @@ export function DeckFrame({ // behind a transparent frame on a dark page. colorScheme: "normal", pointerEvents: "none", - visibility: scale > 0 && !chromeOff ? "visible" : "hidden", + visibility: scale > 0 ? "visible" : "hidden", }} - data-deck-chrome={chromeOff ? "off" : undefined} /> </div> ); @@ -2360,11 +2362,14 @@ export function ModuleLayers({ frame: g, t, testid = "module-layer", + off, }: { layers: PlayLayer[] | undefined; frame: DeckGeometry; t: number; testid?: string; + /** A layer not drawn now (a full-frame item on screen, full-frame.mjs layerOffOver): kept mounted, transparent. */ + off?: (layer: PlayLayer) => boolean; }) { if (!layers?.length) return null; type Row = { key: string; layer: PlayLayer; segment: string | null; src?: string; error?: string; up: boolean }; @@ -2387,7 +2392,8 @@ export function ModuleLayers({ data-play-layer={r.layer.id} data-play-layer-segment={r.segment ?? undefined} data-play-layer-up={r.up ? "1" : "0"} - style={{ opacity: r.up ? 1 : 0 }} + data-play-layer-off={off?.(r.layer) ? "1" : undefined} + style={{ opacity: r.up && !off?.(r.layer) ? 1 : 0 }} > <FeedOverlay feed={{ geometry: r.layer.geometry!, src: r.src, error: r.error }} diff --git a/umtool/components/projects/review/PlayCut.tsx b/umtool/components/projects/review/PlayCut.tsx @@ -819,7 +819,7 @@ export default function PlayCut({ data-play-t={String(Math.round(t * 100) / 100)} data-play-item={item?.id ?? ""} // A full-frame item is on screen (full-frame.mjs: a video entry with the chrome off, a teaser the deck hides - // over, the intro, an analysis item, a card under overCards "hide"): nothing of the deck or its layers shows. + // over, the intro, an analysis item, a card under overCards "hide"): the deck is away and its layers are off. data-play-chrome={videoNow?.video.noChrome || core.chromeOff ? "off" : undefined} data-play-compose={composeState} data-play-basic={view.basic ? "" : undefined} diff --git a/umtool/components/projects/review/playCore.tsx b/umtool/components/projects/review/playCore.tsx @@ -5,8 +5,8 @@ import { footageAt } from "@/lib/report/footage-move.mjs"; import { finaleUp, stampAt, tallyAt } from "@/lib/report/liveClock.mjs"; import { chromeTime, playPlan, skipEntries } from "@/lib/report/playCut.mjs"; import { tallyCellsFrom, VERDICTS } from "umtool-report-to-video/factcheck"; -import { fullFrameIds } from "umtool-report-to-video/full-frame"; -import { DeckFrame, FeedOverlay, ModuleLayers, PostsOverlay, postsWindowAt, type DeckPreviewDoc, type Rect } from "../OnscreenSection"; +import { fullFrameItems, layerOffOver } from "umtool-report-to-video/full-frame"; +import { DeckFrame, FeedOverlay, ModuleLayers, PostsOverlay, postsWindowAt, type DeckPreviewDoc, type FullFrameTraits, type Rect } from "../OnscreenSection"; import { usePlayEngine } from "./playEngine/usePlayEngine"; import { useRenderCuts } from "./playEngine/useRenderCuts"; import type { ItemGate, MediaRef } from "./playEngine/engine"; @@ -288,11 +288,15 @@ export function usePlayCore(view: PlayViewData, { showRejected = false }: { show const introNow = item && entry?.type === "intro" && introPage && "src" in introPage ? { item, page: introPage } : null; const placeholder = item && !postNow && !videoNow && !teaserNow && !introNow && (!item.clip || missing || broken) ? { kind: !item.clip ? "card" : "missing", item, entry } : null; // A FULL-FRAME item on screen (full-frame.mjs: a teaser the deck hides over, the intro, an analysis item, a card - // under overCards "hide", a video entry with the chrome off): every chrome layer is off over it, as the build lays - // each region's overlay with an `enable` that leaves its span out. Play cuts at mid-dissolve, so "over it" is while - // it is the item on screen. - const fullIds = useMemo(() => fullFrameIds(schedule), [schedule]); - const chromeOff = !!item && fullIds.has(item.id); + // under overCards "hide", a video entry with the chrome off): the layers that keep no time of their own are off over + // it, as the build lays their overlays with an `enable` that leaves its span out. Play cuts at mid-dissolve, so + // "over it" is while it is the item on screen. + const fullItems = useMemo(() => fullFrameItems(schedule), [schedule]); + const fullNow = item ? (fullItems.find((x) => x.id === item.id) ?? null) : null; + const chromeOff = !!fullNow; + // Each layer by its module's traits: the deck's page, the feed and the instruments keep their own slide; the + // stamps stay over a teaser with marks; the finale's pages finish their fade out. + const layerOff = useCallback((region: string, traits?: FullFrameTraits | null) => layerOffOver(fullNow, traits ?? doc?.fullFrame?.[region] ?? null, tc), [fullNow, doc?.fullFrame, tc]); // The clips' sound fades with the picture into a video entry and is off over it (its element plays its own). const duck = vstage ? vstage.duck : 1; useEffect(() => { @@ -347,7 +351,7 @@ export function usePlayCore(view: PlayViewData, { showRejected = false }: { show teaserPages, introPage, engine, onPostReady, bg, asPublished, setAsPublished, uncensored, setUncensored, // what is on screen - t, tc, item, entry, g, box, move, rect, tally, stamp, finaleNow, postsWin, missing, broken, chromeOff, + t, tc, item, entry, g, box, move, rect, tally, stamp, finaleNow, postsWin, missing, broken, chromeOff, layerOff, postNow, vstage, videoNow, teaserPage, teaserNow, introNow, placeholder, sideEntry, }; } @@ -364,7 +368,7 @@ const pct = (n: number, of: number) => `${(n / of) * 100}%`; * `basic`: a basic cut -- the bare footage, as the basic render cuts it. */ export function PlayStage({ core, basic = false, plainClassName }: { core: PlayCore; basic?: boolean; plainClassName?: string }) { - const { project, take, doc, g, box, rect, move, tc, t, bg, engine, postNow, entryOf, plan, videoNow, vstage, teaserNow, introNow, placeholder, teaserPage, introPage, sideEntry, item, postsWin, finaleNow, asPublished, uncensored, onPostReady, chromeOff } = core; + const { project, take, doc, g, box, rect, move, tc, t, bg, engine, postNow, entryOf, plan, videoNow, vstage, teaserNow, introNow, placeholder, teaserPage, introPage, sideEntry, item, postsWin, finaleNow, asPublished, uncensored, onPostReady, layerOff } = core; const { ui, rate, failed } = engine; const footageCanvas = (style: React.CSSProperties | undefined, w: number, h: number) => ( <canvas ref={engine.canvasRef} data-play-footage="" data-play-move={move ? move.segment : ""} width={w} height={h} className="absolute" style={style} /> @@ -472,7 +476,7 @@ export function PlayStage({ core, basic = false, plainClassName }: { core: PlayC </div> <div className="relative"> {doc && g && box ? ( - <DeckFrame preview={doc} t={tc} texts={{}} testid="play-deck" chromeOff={chromeOff}> + <DeckFrame preview={doc} t={tc} texts={{}} testid="play-deck"> <div className="absolute inset-0" style={{ background: bg }} /> {footageCanvas(rect ? { left: pct(rect.x, g.W), top: pct(rect.y, g.H), width: pct(rect.width, g.W), height: pct(rect.height, g.H) } : undefined, box.width, box.height)} {videoUnder} @@ -491,21 +495,27 @@ export function PlayStage({ core, basic = false, plainClassName }: { core: PlayC {introCard} {placeholderCard} {sideNow && rect && <div className="pointer-events-none absolute" style={{ left: pct(rect.x, g.W), top: pct(rect.y, g.H), width: pct(rect.width, g.W), height: pct(rect.height, g.H) }}>{sideNow}</div>} - {/* Over a full-frame item none of the layers below is drawn (chromeOff): kept mounted, transparent, so each - page is ready and seeked the moment the item after it comes up. (Opacity, not visibility: a layer's own - frame sets `visibility: visible`, which would win over an inherited hidden.) */} - <div className="pointer-events-none absolute inset-0" style={chromeOff ? { opacity: 0 } : undefined} data-play-layers={chromeOff ? "off" : "on"}> + {/* Over a full-frame item (full-frame.mjs) a layer that keeps no time of its own is not drawn (layerOff): + kept mounted, transparent, so its page is ready and seeked when the item after it comes up. The feed + follows the deck (followsDeck), as the deck's own page does. */} {doc.feed && <FeedOverlay key={doc.feed.src ?? "none"} feed={doc.feed} frame={g} t={tc} testid="play-feed" />} - {postsWin && doc.posts && <PostsOverlay key={`${postsWin.segment}:${postsWin.src ?? "none"}`} win={postsWin} geometry={doc.posts.geometry} frame={g} t={tc} />} - {doc.stamp && <FeedOverlay key={`stamp:${doc.stamp.src ?? "none"}`} feed={doc.stamp} frame={g} t={tc} ready="stamp:ready" testid="play-stamp" name="fact-check stamps" />} + {postsWin && doc.posts && ( + <div className="pointer-events-none absolute inset-0" style={layerOff("posts") ? { opacity: 0 } : undefined} data-play-off={layerOff("posts") ? "posts" : undefined}> + <PostsOverlay key={`${postsWin.segment}:${postsWin.src ?? "none"}`} win={postsWin} geometry={doc.posts.geometry} frame={g} t={tc} /> + </div> + )} + {doc.stamp && ( + <div className="pointer-events-none absolute inset-0" style={layerOff("stamp") ? { opacity: 0 } : undefined} data-play-off={layerOff("stamp") ? "stamp" : undefined}> + <FeedOverlay key={`stamp:${doc.stamp.src ?? "none"}`} feed={doc.stamp} frame={g} t={tc} ready="stamp:ready" testid="play-stamp" name="fact-check stamps" /> + </div> + )} {/* Every module that declares `play` (chapters, then and now, the status ledger …), by z. */} - <ModuleLayers layers={doc.layers} frame={g} t={tc} testid="play-layer" /> + <ModuleLayers layers={doc.layers} frame={g} t={tc} testid="play-layer" off={(l) => layerOff(l.region, l.fullFrame ?? {})} /> {doc.finale && finaleNow && ( - <div className="pointer-events-none absolute inset-0" style={{ zIndex: 2 }} data-play-finale=""> + <div className="pointer-events-none absolute inset-0" style={{ zIndex: 2, ...(layerOff("finale") ? { opacity: 0 } : {}) }} data-play-finale=""> <FeedOverlay key={`finale:${doc.finale.src ?? "none"}`} feed={doc.finale} frame={g} t={tc} ready="finale:ready" testid="play-finale" name="finale" /> </div> )} - </div> </DeckFrame> ) : ( <div diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -2482,7 +2482,7 @@ The panel at the foot of the frame and each clip's title (`render.chrome.deck`); | `deck.height` | 120–400 px · default 190 | `umtool look <p> deck.height=210` | | `deck.footageScale` | 0.5–1 (the footage must fit above the deck) · default 0.82 | `umtool look <p> deck.footageScale=0.8` | | `deck.background` | `panel` · `flush` · default `panel` | `umtool look <p> deck.background=flush` | -| `deck.overCards` | `hide` (the deck slides away over a card, and no chrome layer is drawn over it: a full-frame item, [report-video.md](report-video.md#no-chrome-over-a-full-frame-item)) · `show` (the deck and every layer stay over it) · default `hide` | `umtool look <p> deck.overCards=show` | +| `deck.overCards` | `hide` (the deck slides away over a card, and the layers that keep no time of their own are left out over it: a full-frame item, [report-video.md](report-video.md#no-chrome-over-a-full-frame-item)) · `show` (the deck and every layer stay over it) · default `hide` | `umtool look <p> deck.overCards=show` | | `deck.title` | `{size 24–96, maxChars 10–120}` · default 54, 48 | `umtool look <p> deck.title='{"size":60}'` | | `deck.motion` | `{out 0–2, in 0–2, pip 0–3}` s · default 0.3, 0.45, 0.7 | `umtool look <p> deck.motion='{"in":0.6}'` | @@ -2566,7 +2566,7 @@ A timeline entry `{ type: "analysis", … }` (analysis-plan.mjs; [report-video.m ### Teaser -A timeline entry `{ type: "teaser", lines, … }`: a full-frame card whose lines pop in on the beat, cut in as its own segment (deck.mjs `validateTeaser`; [report-video.md](report-video.md)). Full frame: no chrome layer is drawn over it -- the deck, the instruments, the diet strip, the promise clock, the goals, the stamps, every region -- from its first frame (a dip's black) to the end of its dissolve out ([report-video.md](report-video.md#no-chrome-over-a-full-frame-item)); a teaser that counts (marks, no dip) keeps the deck and every layer up. +A timeline entry `{ type: "teaser", lines, … }`: a full-frame card whose lines pop in on the beat, cut in as its own segment (deck.mjs `validateTeaser`; [report-video.md](report-video.md)). Full frame: the deck, the instruments and the feed slide away over it, and every layer that keeps no time of its own -- the diet strip, the promise clock, the goals, the streak, the side panels, the chapters, the finale's pages -- is left out from its first frame (a dip's black) to the frame before its dissolve out ends ([report-video.md](report-video.md#no-chrome-over-a-full-frame-item)); its stamps stay when it carries marks; a teaser that counts (marks, no dip) keeps the deck and every layer up. | Knob | Range · default | From a terminal | |---|---|---| diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md @@ -550,7 +550,8 @@ whole frame: **no chrome layer is laid over it** -- the deck, the instruments, t the promise clock, the stamps, the effects, the chapter bands, every region -- each region's overlay leaves its span out (`chromeBlackouts`, as a video entry's and a teaser's: [No chrome over a full-frame item](#no-chrome-over-a-full-frame-item)), from the first frame of its dissolve in to the end of its -dissolve out (to the cut's end when it is last); Play hides every layer while it is on screen. It draws in the deck's faces: a cut without `render.fontRegular` and `render.fontBold` +dissolve out (to the cut's end when it is last) -- a frame sooner for the layers that keep no time of their own, +the finale's pages once the dissolve in is over; Play hides those layers while it is on screen. It draws in the deck's faces: a cut without `render.fontRegular` and `render.fontBold` is refused early. No vertical form: a 9:16 cut, or `--vertical` on a landscape one, refuses it before anything is spent. Its date axis is by days alone (`trailLayout`'s `dayShare: 1`), whatever share the by-date trail gives its weights: a span's width says its days. `umtool ledger rm` refuses @@ -1845,32 +1846,41 @@ lines. Absent or `1`: the deck, its page and its keys are what they were. ### No chrome over a full-frame item -An item that is the whole frame is its own picture, and **no chrome layer is drawn over it**: a **teaser** -(unless it counts), the **brand intro**, an **analysis item**, a **video entry** (unless `deck: "shown"`), and a -**card** -- `card`, `scroll`, `chart`, `ledger` -- under `deck.overCards: "hide"` (the default). The deck slides -away over each (deck.mjs `hidesDeck`, the segment's `hideDeck`), and so does every other layer: the build lays -every chrome region -- the deck's shell (title, subtitle, QR, rail, section title, counter), the dial, the -odometer, the trail, the measure extras (the diet strip, the promise clock's days-since, the goals, the streak -chain, the peak), the shelf, the feed and the posts windows, the stamps, the stats, the effects, the thread map, -the flips, the status ledger, the pair strip, the chat, the chapter bands, the finale's pages -- with an `enable` -that leaves each such item's span out. One list, `full-frame.mjs fullFrameSpans` (build-video.mjs -`chromeBlackouts`), for the full cut, a preview, a `--cut-window` and every chunk of a chunked encode: +An item that is the whole frame is its own picture: a **teaser** (unless it counts), the **brand intro**, an +**analysis item**, a **video entry** (unless `deck: "shown"`), and a **card** -- `card`, `scroll`, `chart`, +`ledger` -- under `deck.overCards: "hide"` (the default). The deck slides away over each (deck.mjs `hidesDeck`, the +segment's `hideDeck`), and so do the layers that follow its choreography. **Every layer that keeps no time of its +own is left out over it**: the measure extras (the diet strip, the promise clock's days-since, the goals, the +streak chain, the peak), the shelf, the posts windows, the stamps, the stats, the effects, the thread map, the +flips, the status ledger, the pair strip, the chat, the chapter bands, the finale's pages. The build lays each of +those regions with an `enable` that leaves the item's span out -- one list, `full-frame.mjs fullFrameItems`, each +region taking its share by its module's `fullFrame` traits (`regionSpans`; build-video.mjs `chromeOverlayChain`), +for the full cut, a preview, a `--cut-window` and every chunk of a chunked encode: | Item | Off from | Off to | |---|---|---| -| a teaser, the intro, an analysis item, a card | the first frame of its dissolve in (0 when it is first); for a teaser that **dips**, the frame the dip has made black -- the clip before, overlays and all, fades to black first | the end of its dissolve out (past the cut's end when it is last) | +| a teaser, the intro, an analysis item, a card | the first frame of its dissolve in (0 when it is first); for a teaser that **dips**, the frame the dip has made black -- the clip before, overlays and all, fades to black first | the frame BEFORE the end of its dissolve out (that frame is the next segment's alone), or past the cut's end when it is last | | a video entry | the frame the entrance's dip has made black (mid-dissolve for `enter: "cut"`) | mid-dissolve into the next entry, or past the cut's end | -So the chrome goes at the first frame the item's picture is in and is back at the first frame it is not: two -full-frame items back to back are one span. At the default motion (`transition` 0.5, `motion.in` 0.45) the -deck's own slide away and back falls inside the dissolve, so over a full-frame item's dissolves the deck is -gone, not sliding. **What keeps its chrome**: a teaser that counts (marks and no dip, deck.mjs `teaserCounts`: -the deck stays up so the count is seen to step, and every layer with it), a card under `overCards: "show"`, a -video entry with `deck: "shown"`. A stamp that lands on a teaser that dips still counts (the tally steps under -the hidden deck) and is not drawn, as one that lands in the finale. A cut with none of these items lays every -overlay exactly as before. **Play the -cut** does the same while such an item is on screen (it cuts at mid-dissolve): the deck's page and every layer -are hidden, still loaded and seeked (`data-play-chrome="off"` on its root). Present draws no chrome at all. +What a region's module says (`fullFrame` in the module contract): + +- **`followsDeck`** -- the deck's shell (title, subtitle, QR, rail, section title, counter; the stacked deck's page + too), the dial, the odometer, the trail, the feed. They hide themselves over the item and slide back after it + (deckChoreography), so they keep exactly the blackouts they had: a video entry's span and an analysis item's + (to the end of its dissolve out), nothing over a teaser, the intro or a card. +- **`ownFade`** -- the finale, the dial's finale, the diet runs. Their page fades out through the dissolve after the + run, so over an item that follows the finale they are left out only once the dissolve into it is over. +- **`drawsMarks`** -- the stamps. A teaser that carries marks keeps its stamps over it, a teaser that dips too: the + stamp is that card's own content, and its tally steps as it lands. + +**A chapter bumper** on the clip right after a full-frame item starts on the first frame after the item's span +(its entrance plays whole, never cut by the span), for its `seconds`, never past the clip. **What keeps every +layer**: a teaser that counts (marks and no dip, deck.mjs `teaserCounts`: the deck stays up so the count is seen to +step), a card under `overCards: "show"`, a video entry with `deck: "shown"`. A cut with none of these items lays +every overlay exactly as before. **Play the cut** does the same while such an item is on screen (it cuts at +mid-dissolve): each layer by the same traits (the preview's `fullFrame` map; a play layer's own `fullFrame`), kept +loaded and seeked; the deck's page, the feed and the instruments draw their own slide; `data-play-chrome="off"` on +its root. Present draws no chrome at all. ### The video's knobs (the pipeline's side) diff --git a/umtool/lib/report/onscreen.mjs b/umtool/lib/report/onscreen.mjs @@ -1016,7 +1016,11 @@ export async function composePlayLayers(project, variant, schedule, render, { sr const rows = await composeLayerPreviews(project, variant, schedule, mods.map((m) => m.id), render, { compose }); return rows.map((l, i) => { const m = mods[i]; - const base = { id: l.id, region: l.region, kind: l.kind ?? m.kind, z: m.z, clock: m.play.clock, ready: m.play.ready, geometry: l.geometry ?? null }; + const base = { + id: l.id, region: l.region, kind: l.kind ?? m.kind, z: m.z, clock: m.play.clock, ready: m.play.ready, geometry: l.geometry ?? null, + // How it is laid over a full-frame item (full-frame.mjs): Play hides it by the same traits the build lays it by. + ...(m.fullFrame ? { fullFrame: m.fullFrame } : {}), + }; if (Array.isArray(l.windows)) { return { ...base, diff --git a/umtool/report-to-video/README.md b/umtool/report-to-video/README.md @@ -1370,13 +1370,14 @@ trailer hit under each pop. Put it after the last clip; the ordinary crossfade joins them, and `render.endFade` — which fades the cut's last segment — now falls on the teaser. -Under the deck it is full frame: the deck slides away over it, and **no chrome -layer** — the instruments, the measure extras (the diet strip, the promise -clock, the goals, the streak), the stamps, every region — is drawn over it, -from its first frame (for one that dips, the frame the dip has made black) to -the end of its dissolve out (`full-frame.mjs`; umtool's report-video.md, "No -chrome over a full-frame item"). A teaser that counts (marks, no dip) keeps -the deck up, and every layer with it. +Under the deck it is full frame: the deck slides away over it, the instruments and +the feed with it, and the layers that keep no time of their own — the measure +extras (the diet strip, the promise clock, the goals, the streak), the side +panels, the chapters, the finale's pages — are left out over it, from its first +frame (for one that dips, the frame the dip has made black) to the frame before +its dissolve out ends (`full-frame.mjs`; umtool's report-video.md, "No chrome +over a full-frame item"). Its stamps stay when it carries marks. A teaser that +counts (marks, no dip) keeps the deck up, and every layer with it. ```jsonc { "type": "teaser", "id": "fin", "seconds": 7, diff --git a/umtool/report-to-video/analysis-chrome-off.test.mjs b/umtool/report-to-video/analysis-chrome-off.test.mjs @@ -11,6 +11,7 @@ import { fileURLToPath } from "node:url"; import { chromeBlackouts, chromeOverlayChain } from "./build-video.mjs"; import { analysisBlackouts } from "./analysis-plan.mjs"; +import { fullFrameSpans, regionSpans } from "./full-frame.mjs"; import { deckOverlays } from "./modules/index.mjs"; import { videoBlackouts } from "./video-entry.mjs"; @@ -47,7 +48,8 @@ test("every overlay module's region is off over the analysis segment, from its f const regions = on.flatMap((m) => m.regions(SCHEDULE, { render: RENDER, outDir: "/out", frames: `/out/chrome/${m.region}-frames`, shift: 0 })); assert.ok(regions.length >= ids.length); const blackouts = chromeBlackouts(SCHEDULE); - assert.deepEqual(blackouts, [[732.6, 740.6]]); + assert.deepEqual(fullFrameSpans(SCHEDULE), [[732.6, 740.6]]); + assert.deepEqual(regionSpans(blackouts, { followsDeck: true }), [[732.6, 740.6]]); const chain = chromeOverlayChain(RENDER, regions, "[0:v]", 1, { blackouts }); const overlays = chain.chain.split(";").filter((p) => p.includes("overlay=")); assert.equal(overlays.length, regions.length); @@ -73,9 +75,13 @@ test("a cut without an analysis item: no analysis span (a teaser that hides the const withTeaser = { ...SCHEDULE, segments: [SCHEDULE.segments[0], { ...SCHEDULE.segments[1], id: "t", type: "teaser" }] }; assert.deepEqual(videoBlackouts(withTeaser), []); assert.deepEqual(analysisBlackouts(withTeaser), []); - assert.deepEqual(chromeBlackouts(withTeaser), [[732.6, 740.6]]); + assert.deepEqual(fullFrameSpans(withTeaser), [[732.6, 740.6]]); + assert.deepEqual(regionSpans(chromeBlackouts(withTeaser), { followsDeck: true }), []); assert.deepEqual(chromeBlackouts({ ...SCHEDULE, segments: [SCHEDULE.segments[0]] }), []); // An analysis item mid-cut: off from its dissolve in to the end of its dissolve out. const mid = { ...SCHEDULE, total: 760, segments: [...SCHEDULE.segments, { id: "b", type: "clip", start: 739.2, duration: 20.8, end: 760 }] }; - assert.deepEqual(chromeBlackouts(mid), [[732.6, 739.6]]); + // The deck's own regions to the end of its dissolve out, as before; every other to the frame before (that frame + // is the next clip's alone). + assert.deepEqual(regionSpans(chromeBlackouts(mid), { followsDeck: true }), [[732.6, 739.6]]); + assert.deepEqual(fullFrameSpans(mid), [[732.6, 739.5667]]); }); diff --git a/umtool/report-to-video/analysis-plan.mjs b/umtool/report-to-video/analysis-plan.mjs @@ -36,7 +36,7 @@ import { playEdges } from "./mute.mjs"; import { gapsOf } from "./gaps.mjs"; import { trailLayout, trailLine } from "./trail-plan.mjs"; import { endFadeOf, transitionOf } from "./deck.mjs"; -import { fullFrameSpans } from "./full-frame.mjs"; +import { itemSpans } from "./full-frame.mjs"; /** The item's length: the silent default and ceiling (no dead air), the floor any item has, the longest audio. */ export const ANALYSIS_SECONDS = Object.freeze({ silent: 7, silentMax: 8, min: 4, audioMax: 30 }); @@ -235,11 +235,10 @@ export function analysisSeconds(entry) { /** * THE CUT SECONDS NO CHROME DRAWS OVER, for an analysis item (its page is the whole frame): each analysis segment * of the schedule as `[from, to]` cut seconds -- from the first frame of its dissolve in (its segment's start) to the - * last of its dissolve out (its end), the cut's end + 1 when it is last. The rule is every full-frame item's - * (full-frame.mjs fullFrameSpans, which the build lays every chrome region's `enable` from); this is its analysis - * items' share. [] without one. + * last of its dissolve out (its end), the cut's end + 1 when it is last: the span the deck's own regions leave out + * (full-frame.mjs regionSpans `followsDeck`; every other region's ends a frame sooner). [] without one. */ -export const analysisBlackouts = (schedule) => fullFrameSpans(schedule, { only: (s) => s.type === "analysis" }); +export const analysisBlackouts = (schedule) => itemSpans(schedule, "analysis"); /** The ledger a cut's analysis reads: the variant's whole measure record (selectVariant keeps it), else the ledger. */ export const analysisLedger = (manifest) => (Array.isArray(manifest?.measureLedger) ? manifest.measureLedger : manifest?.ledger ?? []); diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs @@ -156,7 +156,7 @@ import { // A clip whose media is a file beside the manifest (`src`, `cues`). import { clipLabel, createLocalMedia, hasLocalMedia, resolveManifestPath, validateLocalMedia } from "./local-media.mjs"; import { analysisSeconds, validateAnalysisEntries } from "./analysis-plan.mjs"; -import { fullFrameSpans } from "./full-frame.mjs"; +import { fullFrameItems, regionSpans } from "./full-frame.mjs"; import { blackoutEnable, validateVideoEntries, videoFit, videoLoudnessTarget, videoLead, videoMeasureFilter, videoSeconds, videoSegmentGraph, videoSegmentKey, videoSpan } from "./video-entry.mjs"; import { createPostChannelResolver, resolvePostLinks } from "./post-links.mjs"; import { ensureWriteDir } from "../lib/report/storage.mjs"; @@ -186,7 +186,7 @@ import { SYNC_FILE, writeSyncReport } from "./sync-report.mjs"; import { validateThreadEntries } from "./threads.mjs"; import { validateFlipEntries } from "./flips.mjs"; import { validateStatsEntries } from "./stats.mjs"; -import { deckOverlays, moduleById, placementOf } from "./modules/index.mjs"; +import { deckOverlays, moduleById, moduleOfRegion, placementOf } from "./modules/index.mjs"; import { CHAT_CUES_FILE, chatWanted } from "./chat.mjs"; import { counterOrder } from "./counter.mjs"; // The upload's text (release 28 M6): composed by code, written beside the cut. @@ -3930,8 +3930,9 @@ export function railFilterChain(rail, assets, times, render, inLabel, firstInput */ export function chromeOverlayChain(render, regions, inLabel, firstInputIdx, opts = {}) { const { outLabel = "[hfout]", final = true, blackouts = null, shift = 0 } = opts; - // The full-frame items' spans (chromeBlackouts, full-frame.mjs), cut seconds; "" with none. - const off = blackoutEnable(blackouts, shift); + // The full-frame items (chromeBlackouts, full-frame.mjs): each region's share of them, by its module's traits, + // cut seconds; "" with none. (`[a, b]` pairs: the same pairs for every region.) + const offOf = (name) => blackoutEnable(regionBlackouts(blackouts, name), shift); const inputs = []; const parts = []; let lab = inLabel; @@ -3986,7 +3987,7 @@ export function chromeOverlayChain(render, regions, inLabel, firstInputIdx, opts parts.push(`${src}format=rgba[hfa${i}]`); src = `[hfa${i}]`; } - parts.push(`${lab}${src}overlay=x=${r.x}:y=${r.y}:format=yuv444:${posts ? "eof_action=pass" : "shortest=1"}${off}${out}`); + parts.push(`${lab}${src}overlay=x=${r.x}:y=${r.y}:format=yuv444:${posts ? "eof_action=pass" : "shortest=1"}${offOf(r.name)}${out}`); lab = out; }); if (final) parts.push(`${lab}format=yuv420p[vout]`); @@ -6166,12 +6167,19 @@ async function renderDeck({ manifestPath, render, outDir, variant, schedule, fro } /** - * The cut seconds every chrome region leaves out (its overlay's `enable`): every FULL-FRAME item's span - * (full-frame.mjs fullFrameSpans) -- a video entry's (video-entry.mjs videoBlackouts' rule), an analysis item's, a - * teaser's that hides the deck, the brand intro's, a card's under `overCards: "hide"` -- no layer at all over it. A + * What every chrome region's overlay `enable` leaves out: the cut's FULL-FRAME items (full-frame.mjs fullFrameItems) + * -- a video entry, an analysis item, a teaser that hides the deck, the brand intro, a card under `overCards: + * "hide"` -- each region taking its share by its module's `fullFrame` traits (chromeOverlayChain, regionSpans). A * cut with none: []. */ -export const chromeBlackouts = (schedule) => fullFrameSpans(schedule); +export const chromeBlackouts = (schedule) => fullFrameItems(schedule); + +/** The spans region `name` leaves out of `blackouts`: `[a, b]` pairs as given, or full-frame items by its traits. */ +export function regionBlackouts(blackouts, name) { + if (!blackouts?.length) return null; + if (Array.isArray(blackouts[0])) return blackouts; + return regionSpans(blackouts, moduleOfRegion(name)?.fullFrame ?? null); +} /** * A cached concat is a base for the overlay only when it is as long as the diff --git a/umtool/report-to-video/chrome-story.mjs b/umtool/report-to-video/chrome-story.mjs @@ -19,6 +19,7 @@ import { deckGeometry, feedGeometry, overlayBox, pictureK } from "./deck.mjs"; import { rgba } from "./chrome-deck.mjs"; import { compileCues, cuePageHtml, dateText, esc, joinSpans, r4, segmentSpans, spanEvents, INSTANT } from "./chrome-cues.mjs"; import { CHAPTER_DEFAULTS, PAIR_DEFAULTS, STATUS_DEFAULTS } from "./modules/story-settings.mjs"; +import { fullFrameItems, regionSpans } from "./full-frame.mjs"; const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v); @@ -192,13 +193,23 @@ export function resolveChapter(render) { export function chapterWindows(schedule, render) { const C = resolveChapter(render); const at = segmentSpans(schedule); + // A clip whose start is inside a full-frame item's span (the dissolve out of a teaser, the intro, a card: no + // chrome is drawn there, full-frame.mjs): its bumper starts on the first frame after that span, so its entrance + // plays whole. None: it starts with its clip, as ever. + const fps = Number(schedule?.fps) || 30; + const off = regionSpans(fullFrameItems(schedule)); + const after = (t) => { + for (const [a, b] of off) if (t >= a && t <= b) return r4(b + 1 / fps); + return t; + }; const out = []; C.list.forEach((c, n) => { const sp = at.get(c?.at); if (!sp) return; - const to = Math.min(sp.out, sp.in + C.seconds); - if (!(to - sp.in > 0.2)) return; - const w = { segment: c.at, from: sp.in, to, n, title: c.title, subtitle: c.subtitle ?? "", date: c.date ?? null }; + const from = after(sp.in); + const to = Math.min(sp.out, from + C.seconds); + if (!(to - from > 0.2)) return; + const w = { segment: c.at, from, to, n, title: c.title, subtitle: c.subtitle ?? "", date: c.date ?? null }; // Where it stands (chapterPlacement): a lower band that would cover a post card moves into the card's free side // margin -- or, where neither margin can hold it, the cut has no bumper over that card. const place = chapterPlacement(schedule, render, w); diff --git a/umtool/report-to-video/full-frame.mjs b/umtool/report-to-video/full-frame.mjs @@ -1,24 +1,32 @@ -// full-frame.mjs — THE FULL-FRAME SPANS: the cut seconds no chrome is drawn over. +// full-frame.mjs — THE FULL-FRAME ITEMS: the cut seconds a chrome layer that keeps no time of its own is not drawn. // // An item that takes the whole frame -- a teaser, the brand intro, an analysis item, a video entry, a card -// (`card`, `scroll`, `chart`, `ledger`) under `deck.overCards: "hide"` -- is its own picture: the deck slides away -// over it (deck.mjs hidesDeck, the segment's `hideDeck`), and so must every other layer the build lays over the -// cut. The deck, the instruments and the feed follow the deck's choreography; the measure extras (the diet strip, -// the promise clock, the goals, the streak, the peak), the stamps, the side panels, the chapters, the finale's pages -// keep no such time. So the build lays EVERY chrome region with an `enable` that leaves these spans out -// (build-video.mjs chromeBlackouts -> chromeOverlayChain, video-entry.mjs blackoutEnable), and Play hides every -// layer while such an item is the one on screen (playCore.tsx, `fullFrameIds`). One list, one rule per kind: +// (`card`, `scroll`, `chart`, `ledger`) under `deck.overCards: "hide"` -- is its own picture. The deck slides away +// over it (deck.mjs hidesDeck, the segment's `hideDeck`), and the layers that follow the deck's choreography go with +// it: the shell, the dial, the odometer, the trail, the feed (their module's `fullFrame.followsDeck`). The others -- +// the measure extras (the diet strip, the promise clock, the goals, the streak, the peak), the shelf, the stamps, +// the side panels, the chapters, the posts windows, the finale's pages -- keep no such time, so the build lays each +// with an `enable` that leaves these items' spans out (build-video.mjs chromeOverlayChain, by `regionSpans`), and +// Play hides them while such an item is on screen (playCore.tsx, `layerOffOver`). One list (`fullFrameItems`), and +// what each region takes of it (`regionSpans`, by its module's `fullFrame` traits): // -// a video entry that hides the chrome (`noChrome`; `deck: "shown"` keeps it): from the frame the dip into it has -// made black (its start + the dissolve − a frame; mid-dissolve for `enter: "cut"`) to mid-dissolve out of it, -// or past the cut's end when it is last -- as it always was. -// every other segment that hides the deck: from the first frame its picture is in -- its dissolve's first frame, -// or, for a teaser that dips, the frame the dip has made black (the previous segment's last: the dip fades the -// whole frame, overlays with it, so nothing pops before then) -- to the last frame its picture is in: the end of -// its dissolve out, or past the cut's end when it is last. A first segment is off from 0. +// every region but those below: every item's span -- +// a video entry that hides the chrome (`noChrome`; `deck: "shown"` keeps it): from the frame the dip into it has +// made black (its start + the dissolve − a frame; mid-dissolve for `enter: "cut"`) to mid-dissolve out of it, +// or past the cut's end when it is last -- as it always was; +// every other item: from the first frame its picture is in -- its dissolve's first frame, or, for a teaser that +// dips, the frame the dip has made black (the dip fades the whole frame, overlays with it) -- to the frame +// BEFORE the end of its dissolve out (that frame is the next segment's alone), or past the cut's end when it is +// last. A first item is off from 0. +// `followsDeck` (shell, dial, odometer, trail, feed): only a video entry's and an analysis item's spans, as the +// build laid them before (an analysis item's to the end of its dissolve out) -- over a teaser, the intro or a +// card their own slide away and back is kept. +// `ownFade` (the finale, the dial's finale, the diet runs): an item's span starts once its dissolve in is over, so +// the page's own fade out through that dissolve plays whole (a video entry's as above). +// `drawsMarks` (the stamps): not over a teaser that carries marks -- the stamp is that card's own content. // -// A segment that keeps the deck up keeps every layer: a teaser that COUNTS (deck.mjs teaserCounts: marks, no dip), -// a card under `overCards: "show"`, a video entry with `deck: "shown"`. A cut with no full-frame segment: [] -- and +// A segment that keeps the deck up is not full frame: a teaser that COUNTS (deck.mjs teaserCounts: marks, no dip), +// a card under `overCards: "show"`, a video entry with `deck: "shown"`. A cut with no full-frame item: [] -- and // every graph is the one it was. // // A LEAF with no imports: the build, umtool's server and its client (Play) read the same rule. @@ -26,9 +34,12 @@ const fin = (v) => typeof v === "number" && Number.isFinite(v); const r4 = (v) => Math.round(v * 1e4) / 1e4; +/** A module's `fullFrame` traits (contract.mjs): how its region is laid over a full-frame item. */ +export const FULL_FRAME_TRAITS = Object.freeze(["followsDeck", "ownFade", "drawsMarks"]); + /** - * Is this schedule segment full frame, every chrome layer off over it? A video entry by its `noChrome`, an analysis - * item always, anything else by its `hideDeck`. + * Is this schedule segment full frame? A video entry by its `noChrome`, an analysis item always, anything else by + * its `hideDeck`. * * @param {{ type?: string, hideDeck?: boolean, noChrome?: boolean } | null | undefined} seg */ @@ -40,54 +51,112 @@ export function fullFrameSegment(seg) { } /** - * A video entry's span (video-entry.mjs videoBlackouts' rule, unchanged). - * @param {any} s @param {number} i @param {any[]} segs @param {any} schedule @param {number} D @param {number} fps - */ -function videoSpan(s, i, segs, schedule, D, fps) { - const entered = i > 0 && s.enter ? s.start + D - 1 / fps : i > 0 ? s.start + D / 2 : 0; - const last = i === segs.length - 1; - const b = last ? Number(schedule.total ?? s.end) + 1 : s.end - D / 2; - return [Math.max(0, r4(entered)), r4(b)]; -} - -/** - * Any other full-frame segment's span: its picture's first frame to its last (the analysis item's rule, with a - * teaser's dip starting at its black). - * @param {any} s @param {number} i @param {any[]} segs @param {any} schedule @param {number} D @param {number} fps + * @typedef {{ id: string, type: string, kind: "video" | "analysis" | "page", index: number, start: number, + * end: number, last: boolean, marks: boolean, fps: number, D: number, span: [number, number] }} FullFrameItem + * `span` is the item's span as the build laid it before the measure extras were left out (a video entry's + * rule; any other's from its first frame to the END of its dissolve out, inclusive). */ -function pageSpan(s, i, segs, schedule, D, fps) { - const start = Number(s.start); - const end = fin(Number(s.end)) ? Number(s.end) : start + Number(s.duration); - const from = i === 0 ? 0 : s.dip ? start + D - 1 / fps : start; - const to = i === segs.length - 1 ? Number(schedule.total ?? end) + 1 : end; - return [Math.max(0, r4(from)), r4(to)]; -} /** - * The cut seconds every chrome region leaves out, `[from, to]` pairs in cut seconds, by start: one per full-frame - * segment of the schedule (`fullFrameSegment`). Overlapping pairs (two full-frame items back to back) are kept as - * they are: an `enable` of `not(between(…)+between(…))` is off over their union. [] without one. - * - * `only` narrows it to the segments it accepts (video-entry.mjs videoBlackouts: the video entries' alone). + * The schedule's full-frame items, in order, each with its span and what a region's traits read of it. * * @param {{ segments?: any[], total?: number, fps?: number, transition?: number } | null | undefined} schedule - * @param {{ only?: (seg: any) => boolean }} [opts] - * @returns {Array<[number, number]>} + * @returns {FullFrameItem[]} */ -export function fullFrameSpans(schedule, { only = () => true } = {}) { +export function fullFrameItems(schedule) { const segs = schedule?.segments ?? []; const D = Number(schedule?.transition ?? 0) || 0; const fps = Number(schedule?.fps ?? 30) || 30; - /** @type {Array<[number, number]>} */ + /** @type {FullFrameItem[]} */ const out = []; segs.forEach((s, i) => { - if (!fullFrameSegment(s) || !only(s) || !fin(Number(s?.start))) return; - out.push(/** @type {[number, number]} */ (s.type === "video" ? videoSpan(s, i, segs, schedule, D, fps) : pageSpan(s, i, segs, schedule, D, fps))); + if (!fullFrameSegment(s) || !fin(Number(s?.start))) return; + const start = Number(s.start); + const end = fin(Number(s.end)) ? Number(s.end) : start + Number(s.duration); + const last = i === segs.length - 1; + const kind = s.type === "video" ? "video" : s.type === "analysis" ? "analysis" : "page"; + let a; + let b; + if (kind === "video") { + a = i > 0 && s.enter ? start + D - 1 / fps : i > 0 ? start + D / 2 : 0; + b = last ? Number(schedule.total ?? end) + 1 : end - D / 2; + } else { + a = i === 0 ? 0 : s.dip ? start + D - 1 / fps : start; + b = last ? Number(schedule.total ?? end) + 1 : end; + } + out.push({ + id: s.id, type: s.type, kind, index: i, start, end, last, + marks: !!(s.claim || (Array.isArray(s.claims) && s.claims.length)), + fps, D, span: [Math.max(0, r4(a)), r4(b)], + }); }); + return out; +} + +/** + * The spans one region leaves out, `[from, to]` cut seconds by start, for its module's `fullFrame` traits (none: + * every region but the deck's own and the finale's). Overlapping pairs (two full-frame items back to back) are kept as + * they are: `not(between(…)+between(…))` is off over their union. [] without one. + * + * @param {FullFrameItem[]} items + * @param {{ followsDeck?: boolean, ownFade?: boolean, drawsMarks?: boolean } | null | undefined} [traits] + * @returns {Array<[number, number]>} + */ +export function regionSpans(items, traits = {}) { + const t = traits ?? {}; + /** @type {Array<[number, number]>} */ + const out = []; + for (const it of items ?? []) { + if (t.followsDeck) { + if (it.kind !== "page") out.push([it.span[0], it.span[1]]); + continue; + } + if (t.drawsMarks && it.type === "teaser" && it.marks) continue; + let [a, b] = it.span; + // The frame at the end of its dissolve out is the next segment's alone: the layer is drawn on it. + if (it.kind !== "video" && !it.last) b = r4(b - 1 / it.fps); + // Its own fade out through the dissolve in plays whole. + if (t.ownFade && it.kind !== "video" && it.index > 0) a = Math.max(a, r4(it.start + it.D)); + if (b >= a) out.push([a, b]); + } return out.sort((x, y) => x[0] - y[0]); } -/** The ids of the schedule's full-frame segments: what Play hides every layer over while it is on screen. */ +/** + * The spans a region with no traits leaves out (the measure extras, the stamps, every side panel): `regionSpans` + * with none. `only` narrows the items (video-entry.mjs videoBlackouts: the video entries' alone). + * + * @param {{ segments?: any[], total?: number, fps?: number, transition?: number } | null | undefined} schedule + * @param {{ only?: (item: FullFrameItem) => boolean }} [opts] + */ +export function fullFrameSpans(schedule, { only = () => true } = {}) { + return regionSpans(fullFrameItems(schedule).filter(only)); +} + +/** The items' spans as the build laid them before (`span`), of one kind: a video entry's, an analysis item's. */ +export function itemSpans(schedule, kind) { + return fullFrameItems(schedule).filter((it) => it.kind === kind).map((it) => /** @type {[number, number]} */ ([it.span[0], it.span[1]])); +} + +/** + * PLAY: is a layer with these traits hidden while `item` (a full-frame item, or null) is the one on screen, at cut + * second `tc`? Play cuts at mid-dissolve, so "over it" is while it is on screen. A `followsDeck` layer hides itself; + * the stamps stay over a teaser with marks; an `ownFade` page goes once the dissolve into the item is over. + * + * @param {FullFrameItem | null | undefined} item + * @param {{ followsDeck?: boolean, ownFade?: boolean, drawsMarks?: boolean } | null | undefined} traits + * @param {number} tc + */ +export function layerOffOver(item, traits, tc) { + if (!item) return false; + const t = traits ?? {}; + if (t.followsDeck) return false; + if (t.drawsMarks && item.type === "teaser" && item.marks) return false; + if (t.ownFade && item.kind !== "video" && item.index > 0) return tc >= item.start + item.D; + return true; +} + +/** The ids of the schedule's full-frame segments. */ export function fullFrameIds(schedule) { return new Set((schedule?.segments ?? []).filter(fullFrameSegment).map((s) => s.id)); } diff --git a/umtool/report-to-video/modules/contract.mjs b/umtool/report-to-video/modules/contract.mjs @@ -32,6 +32,8 @@ // imported by the build, the composer and umtool alike. /** What a module is: how its pixels reach the cut. */ +import { FULL_FRAME_TRAITS } from "../full-frame.mjs"; + export const MODULE_KINDS = Object.freeze([ // A page over the whole cut (or a window of it), laid by its region at frame 1. "overlay-whole", @@ -117,6 +119,7 @@ const SPEC = Object.freeze({ names: "a function ({ preview, window, entry, suffix }) => { project, stem }", entry: "a function (manifest, segment) => the timeline entry a segment module draws", seconds: "a function (entry, transition, fps) => how long a segment module's page is", + fullFrame: "how its region is laid over a full-frame item (full-frame.mjs): { followsDeck?, ownFade?, drawsMarks? } -- each true; absent, it is off over every one", }); /** @@ -185,6 +188,13 @@ export function defineModule(def) { if (def.docs !== undefined && !(isObj(def.docs) && typeof def.docs.heading === "string")) throw new Error(`${where}: docs must be ${SPEC.docs}`); if (def.vertical !== undefined && !(isObj(def.vertical) && VERTICAL_SLOTS.includes(def.vertical.slot))) throw new Error(`${where}: vertical must be ${SPEC.vertical}`); if (def.workers !== undefined && !["wide", "narrow"].includes(def.workers)) throw new Error(`${where}: workers must be ${SPEC.workers}`); + if (def.fullFrame !== undefined) { + const f = def.fullFrame; + if (!isObj(f) || !Object.keys(f).length || Object.entries(f).some(([k, v]) => !FULL_FRAME_TRAITS.includes(k) || v !== true)) { + throw new Error(`${where}: fullFrame must be ${SPEC.fullFrame}`); + } + if (!(def.kind === "overlay-whole" || def.kind === "overlay-window")) throw new Error(`${where}: only an overlay is laid over a full-frame item`); + } return Object.freeze({ ...def }); } diff --git a/umtool/report-to-video/modules/dial-finale.mjs b/umtool/report-to-video/modules/dial-finale.mjs @@ -35,6 +35,8 @@ export default defineModule({ ], }, region: "dial-finale", + // Out through the finale's dissolve, as the finale: full-frame.mjs `ownFade`. + fullFrame: { ownFade: true }, workers: "narrow", noun: "the dial finale's", on: (schedule, render) => !!schedule?.finale && hasMeasure(schedule) && wanted(render), diff --git a/umtool/report-to-video/modules/dial.mjs b/umtool/report-to-video/modules/dial.mjs @@ -70,6 +70,8 @@ export default defineModule({ ], }, region: "dial", + // It comes and goes with the deck (chrome-instruments.mjs): full-frame.mjs `followsDeck`. + fullFrame: { followsDeck: true }, workers: "narrow", noun: "the dial's", on: (schedule, render) => hasMeasure(schedule) && !!resolveDial(render), diff --git a/umtool/report-to-video/modules/feed.mjs b/umtool/report-to-video/modules/feed.mjs @@ -42,6 +42,8 @@ export default defineModule({ ], }, region: "feed", + // The column slides with the deck's visibility (chrome-feed.mjs): full-frame.mjs `followsDeck`. + fullFrame: { followsDeck: true }, workers: "wide", noun: "the feed's", on: (schedule) => schedule?.layout === "feed", diff --git a/umtool/report-to-video/modules/finale.mjs b/umtool/report-to-video/modules/finale.mjs @@ -47,6 +47,9 @@ export default defineModule({ ], }, region: "finale", + // Its page fades out through the dissolve after the run: over a full-frame item it is left out only once that + // dissolve is over (full-frame.mjs `ownFade`). + fullFrame: { ownFade: true }, workers: "narrow", noun: "the finale's", on: (schedule) => !!schedule?.finale, diff --git a/umtool/report-to-video/modules/odometer.mjs b/umtool/report-to-video/modules/odometer.mjs @@ -44,6 +44,8 @@ export default defineModule({ ], }, region: "odometer", + // It comes and goes with the deck (chrome-instruments.mjs): full-frame.mjs `followsDeck`. + fullFrame: { followsDeck: true }, workers: "narrow", noun: "the odometer's", on: (schedule, render) => hasMeasure(schedule) && !!resolveOdometer(render), diff --git a/umtool/report-to-video/modules/runs-finale.mjs b/umtool/report-to-video/modules/runs-finale.mjs @@ -32,6 +32,8 @@ export default defineModule({ ], }, region: "runs-finale", + // In the finale's page, out with it: full-frame.mjs `ownFade`. + fullFrame: { ownFade: true }, workers: "narrow", noun: "the finale's diet runs'", on: drawn, diff --git a/umtool/report-to-video/modules/shell.mjs b/umtool/report-to-video/modules/shell.mjs @@ -48,12 +48,15 @@ export default defineModule({ ["`deck.height`", "120–400 px · default 190", "`umtool look <p> deck.height=210`"], ["`deck.footageScale`", "0.5–1 (the footage must fit above the deck) · default 0.82", "`umtool look <p> deck.footageScale=0.8`"], ["`deck.background`", "`panel` · `flush` · default `panel`", "`umtool look <p> deck.background=flush`"], - ["`deck.overCards`", "`hide` (the deck slides away over a card, and no chrome layer is drawn over it: a full-frame item, [report-video.md](report-video.md#no-chrome-over-a-full-frame-item)) · `show` (the deck and every layer stay over it) · default `hide`", "`umtool look <p> deck.overCards=show`"], + ["`deck.overCards`", "`hide` (the deck slides away over a card, and the layers that keep no time of their own are left out over it: a full-frame item, [report-video.md](report-video.md#no-chrome-over-a-full-frame-item)) · `show` (the deck and every layer stay over it) · default `hide`", "`umtool look <p> deck.overCards=show`"], ["`deck.title`", "`{size 24–96, maxChars 10–120}` · default 54, 48", "`umtool look <p> deck.title='{\"size\":60}'`"], ["`deck.motion`", "`{out 0–2, in 0–2, pip 0–3}` s · default 0.3, 0.45, 0.7", "`umtool look <p> deck.motion='{\"in\":0.6}'`"], ], }, region: "deck", + // It slides away over a full-frame item and back on its own (deckChoreography): only a video entry's and an + // analysis item's spans are left out of it (full-frame.mjs). + fullFrame: { followsDeck: true }, workers: "wide", noun: "the deck's", on: () => true, diff --git a/umtool/report-to-video/modules/stamp.mjs b/umtool/report-to-video/modules/stamp.mjs @@ -43,6 +43,8 @@ export default defineModule({ ], }, region: "stamp", + // A teaser that carries marks keeps its stamps (they are the card's own content): full-frame.mjs `drawsMarks`. + fullFrame: { drawsMarks: true }, workers: "narrow", noun: "the stamps'", on: (schedule, render) => stampsDrawn(schedule, render), diff --git a/umtool/report-to-video/modules/teaser.mjs b/umtool/report-to-video/modules/teaser.mjs @@ -19,7 +19,7 @@ export default defineModule({ validate: (_value, { manifest }) => validateTeasers(manifest), docs: { heading: "Teaser", - intro: "A timeline entry `{ type: \"teaser\", lines, … }`: a full-frame card whose lines pop in on the beat, cut in as its own segment (deck.mjs `validateTeaser`; [report-video.md](report-video.md)). Full frame: no chrome layer is drawn over it -- the deck, the instruments, the diet strip, the promise clock, the goals, the stamps, every region -- from its first frame (a dip's black) to the end of its dissolve out ([report-video.md](report-video.md#no-chrome-over-a-full-frame-item)); a teaser that counts (marks, no dip) keeps the deck and every layer up.", + intro: "A timeline entry `{ type: \"teaser\", lines, … }`: a full-frame card whose lines pop in on the beat, cut in as its own segment (deck.mjs `validateTeaser`; [report-video.md](report-video.md)). Full frame: the deck, the instruments and the feed slide away over it, and every layer that keeps no time of its own -- the diet strip, the promise clock, the goals, the streak, the side panels, the chapters, the finale's pages -- is left out from its first frame (a dip's black) to the frame before its dissolve out ends ([report-video.md](report-video.md#no-chrome-over-a-full-frame-item)); its stamps stay when it carries marks; a teaser that counts (marks, no dip) keeps the deck and every layer up.", rows: [ ["a `teaser` entry", "`lines` (each `{text, role?, hold?, …}`), `tail?`, `dip?`", "`umtool timeline <p> insert …`"], ], diff --git a/umtool/report-to-video/modules/trail.mjs b/umtool/report-to-video/modules/trail.mjs @@ -50,6 +50,8 @@ export default defineModule({ ], }, region: "trail", + // It comes and goes with the deck (chrome-instruments.mjs): full-frame.mjs `followsDeck`. + fullFrame: { followsDeck: true }, workers: "narrow", noun: "the trail's", on: (schedule, render) => hasMeasure(schedule) && !!resolveTrail(render), diff --git a/umtool/report-to-video/teaser-chrome-off.test.mjs b/umtool/report-to-video/teaser-chrome-off.test.mjs @@ -1,10 +1,12 @@ // NO CHROME OVER A TEASER, OR ANY OTHER FULL-FRAME ITEM (lane teaser-chrome, 13 Nov: the diet strip and the promise // clock were drawn over a teaser -- the leak the analysis item had, analysis-chrome-off.test.mjs). Every overlay -// module the build lays (modules deckOverlays, their real `regions` planners) gets an `enable` that leaves each -// full-frame segment's span out (full-frame.mjs fullFrameSpans -> build-video.mjs chromeBlackouts -> -// chromeOverlayChain): a teaser that hides the deck, the brand intro, a card under `overCards: "hide"`, as the video -// entry and the analysis item already were. A teaser that counts, a card under `overCards: "show"` and a video entry -// with `deck: "shown"` keep their chrome; a cut with none of them lays exactly the graph it did. +// module that keeps no time of its own (the measure extras, the stamps, the side panels, the chapters, the finale's +// pages) gets an `enable` that leaves each full-frame item's span out (full-frame.mjs fullFrameItems / regionSpans, +// build-video.mjs chromeOverlayChain): a teaser that hides the deck, the brand intro, a card under `overCards: +// "hide"`, as the video entry and the analysis item already were. The regions that follow the deck's choreography +// (`followsDeck`: the shell, the dial, the odometer, the trail, the feed) keep exactly the blackouts they had -- +// their own slide away and back over a teaser is kept. A teaser that counts, a card under `overCards: "show"` and a +// video entry with `deck: "shown"` keep their chrome; a cut with none of them lays exactly the graph it did. import assert from "node:assert/strict"; import { spawnSync } from "node:child_process"; import { mkdirSync, mkdtempSync, readFileSync, rmSync } from "node:fs"; @@ -15,10 +17,11 @@ import { fileURLToPath } from "node:url"; import { chromeBlackouts, chromeOverlayChain, xfadeConcatArgs } from "./build-video.mjs"; import { analysisBlackouts } from "./analysis-plan.mjs"; +import { chapterWindows } from "./chrome-story.mjs"; import { deckSchedule, estimateSchedule, scheduleFrom } from "./deck.mjs"; -import { fullFrameIds, fullFrameSegment, fullFrameSpans } from "./full-frame.mjs"; -import { deckOverlays } from "./modules/index.mjs"; -import { videoBlackouts } from "./video-entry.mjs"; +import { fullFrameIds, fullFrameItems, fullFrameSegment, fullFrameSpans, layerOffOver, regionSpans } from "./full-frame.mjs"; +import { deckOverlays, moduleOfRegion } from "./modules/index.mjs"; +import { blackoutEnable, videoBlackouts } from "./video-entry.mjs"; const HERE = path.dirname(fileURLToPath(import.meta.url)); const MEASURE = JSON.parse(readFileSync(path.join(HERE, "fixtures/measure-extras/measure.json"), "utf8")); @@ -44,7 +47,7 @@ const SCHEDULE = { function enabledAt(part, t) { const m = /enable='not\((.*)\)'/.exec(part); if (!m) return true; - const spans = [...m[1].matchAll(/between\(t,([\d.]+),([\d.]+)\)/g)].map((x) => [Number(x[1]), Number(x[2])]); + const spans = [...m[1].matchAll(/between\(t,(-?[\d.]+),(-?[\d.]+)\)/g)].map((x) => [Number(x[1]), Number(x[2])]); return !spans.some(([a, b]) => t >= a && t <= b); } @@ -66,38 +69,49 @@ const frames = (a, b) => { return out; }; +const END = Math.round((406.4 - 1 / FPS) * 1e4) / 1e4; // the frame before the end of its dissolve out + // THE LEAKING LAYERS, one test each: the measure extras (the diet strip, the promise clock, the goals, the streak, -// the peak), and every other region the cut lays -- the deck's shell and the instruments with it. +// the peak) -- off from the teaser's first frame to the frame before its dissolve out ends. { const { ids } = overlayParts(SCHEDULE); - for (const id of ["diet", "promise", "goals", "streak", "peak", "shell", "dial", "odometer", "trail"]) { + for (const id of ["diet", "promise", "goals", "streak", "peak"]) { test(`over a teaser: ${id}'s region is off from the teaser's first frame to its last, and only there`, () => { assert.ok(ids.includes(id), `${id} is laid (${ids.join(", ")})`); - const { parts, blackouts } = overlayParts(SCHEDULE); - assert.deepEqual(blackouts, [[400, 406.4]]); + const { parts } = overlayParts(SCHEDULE); + assert.deepEqual(fullFrameSpans(SCHEDULE), [[400, END]]); const mine = parts.filter((p) => p.mod === id); assert.ok(mine.length >= 1); for (const { part } of mine) { - // Its dissolve in (400.0–400.4), its page, its dissolve out (406.0–406.4). - for (const t of frames(400, 406.4)) assert.equal(enabledAt(part, t), false, `${id} at ${t}`); + // Its dissolve in (400.0–400.4), its page, its dissolve out (406.0–406.4) but its last frame. + for (const t of frames(400, END)) assert.equal(enabledAt(part, t), false, `${id} at ${t}`); assert.equal(enabledAt(part, 400 - 1 / FPS), true, `${id} the frame before`); - assert.equal(enabledAt(part, 406.4 + 1 / FPS), true, `${id} the frame after`); + // The frame at 406.4 is the next clip's alone: the layer is on it. + assert.equal(enabledAt(part, 406.4), true, `${id} the end frame`); assert.equal(enabledAt(part, 100), true); } }); } + // THE DECK'S OWN REGIONS keep their slide: the enable main laid (none over a teaser), byte for byte. + for (const id of ["shell", "dial", "odometer", "trail"]) { + test(`over a teaser: ${id} follows the deck -- no enable of its own, as before`, () => { + assert.ok(ids.includes(id)); + for (const { part } of overlayParts(SCHEDULE).parts.filter((p) => p.mod === id)) assert.doesNotMatch(part, /enable=/); + }); + } } -test("a teaser that dips: off from the frame the dip has made black (the clip's last) to the end of its dissolve out", () => { +test("a teaser that dips: off from the frame the dip has made black (the clip's last) to the frame before its dissolve out ends", () => { const sch = { ...SCHEDULE, segments: SCHEDULE.segments.map((s) => (s.id === "t" ? { ...s, dip: { fade: 1, black: 0.5 } } : s)) }; - const [[a, b]] = chromeBlackouts(sch); + const [[a, b]] = fullFrameSpans(sch); assert.equal(a, Math.round((400 + D - 1 / FPS) * 1e4) / 1e4); - assert.equal(b, 406.4); + assert.equal(b, END); // The dip fades the whole frame, overlays with it, until then: the chrome is there to fade. const { parts } = overlayParts(sch); - for (const { part } of parts) { - assert.equal(enabledAt(part, 400.3), true); - for (const t of frames(400.4, 406.4)) assert.equal(enabledAt(part, t), false); + for (const { part, mod } of parts) { + if (["shell", "dial", "odometer", "trail"].includes(mod)) continue; + assert.equal(enabledAt(part, 400.3), true, mod); + for (const t of frames(400.4, END)) assert.equal(enabledAt(part, t), false, `${mod} at ${t}`); } }); @@ -106,7 +120,7 @@ test("a teaser at the very start (before the deck is up): off from 0", () => { ...SCHEDULE, total: 339.6, segments: [{ id: "t", type: "teaser", start: 0, duration: 6.4, end: 6.4, hideDeck: true }, { id: "b", type: "clip", start: 6, duration: 333.6, end: 339.6 }], }; - assert.deepEqual(chromeBlackouts(sch), [[0, 6.4]]); + assert.deepEqual(fullFrameSpans(sch), [[0, Math.round((6.4 - 1 / FPS) * 1e4) / 1e4]]); }); test("back-to-back teasers: off over both and the dissolve between them; a last one to past the cut's end", () => { @@ -114,25 +128,78 @@ test("back-to-back teasers: off over both and the dissolve between them; a last ...SCHEDULE, total: 412.4, segments: [ SCHEDULE.segments[0], - { id: "t1", type: "teaser", start: 400, duration: 6.4, end: 406.4, hideDeck: true }, + { id: "t1", type: "teaser", start: 400, duration: 6.4, end: 6.4 + 400, hideDeck: true }, { id: "t2", type: "teaser", start: 406, duration: 6.4, end: 412.4, hideDeck: true }, ], }; - assert.deepEqual(chromeBlackouts(sch), [[400, 406.4], [406, 413.4]]); + assert.deepEqual(fullFrameSpans(sch), [[400, END], [406, 413.4]]); const { parts } = overlayParts(sch); - for (const { part } of parts) { - for (const t of frames(400, 412.4)) assert.equal(enabledAt(part, t), false, `at ${t}`); + for (const { part, mod } of parts) { + if (["shell", "dial", "odometer", "trail"].includes(mod)) continue; + for (const t of frames(400, 412.4)) assert.equal(enabledAt(part, t), false, `${mod} at ${t}`); assert.equal(enabledAt(part, 400 - 1 / FPS), true); } }); -test("in a window of the cut (--cut-window, a preview, a chunk) the span is shifted to the window's clock", () => { +test("in a window of the cut (--cut-window, a preview, a chunk) the span is shifted to the window's clock; a span before it is negative", () => { const regions = deckOverlays().filter((m) => m.id === "diet").flatMap((m) => m.regions(SCHEDULE, { render: RENDER, outDir: "/out", frames: "/f" })); const chain = chromeOverlayChain(RENDER, regions, "[0:v]", 1, { blackouts: chromeBlackouts(SCHEDULE), shift: 398 }); const part = chain.chain.split(";").find((p) => p.includes("overlay=")); assert.equal(enabledAt(part, 2), false); assert.equal(enabledAt(part, 1.9), true); - assert.equal(enabledAt(part, 8.5), true); + assert.equal(enabledAt(part, 8.4), true); + // A window that starts after the teaser: its span is in the window's past. + const later = chromeOverlayChain(RENDER, regions, "[0:v]", 1, { blackouts: chromeBlackouts(SCHEDULE), shift: 410 }); + const lp = later.chain.split(";").find((p) => p.includes("overlay=")); + assert.match(lp, /between\(t,-10,-3\.6333\)/); + assert.equal(enabledAt(lp, 0), true); +}); + +// ---- the traits: the finale's fade out, the stamps over a card with marks ---------------------------------------- + +test("ownFade (the finale's pages): over a teaser it is left out only once the dissolve into it is over", () => { + const items = fullFrameItems(SCHEDULE); + assert.deepEqual(regionSpans(items, { ownFade: true }), [[400.4, END]]); + for (const name of ["finale", "dial-finale", "runs-finale"]) assert.equal(moduleOfRegion(name)?.fullFrame?.ownFade, true, name); + const chain = chromeOverlayChain(RENDER, [{ name: "finale", frames: "/f/finale", x: 0, y: 0, offset: 390 }], "[0:v]", 1, { blackouts: items }); + const part = chain.chain.split(";").find((p) => p.includes("overlay=")); + for (const t of frames(400, 400.4 - 1 / FPS)) assert.equal(enabledAt(part, t), true, `the fade out at ${t}`); + assert.equal(enabledAt(part, 400.4), false); +}); + +test("drawsMarks (the stamps): a teaser that dips and carries marks keeps its stamps; the other layers go", () => { + const sch = { ...SCHEDULE, segments: SCHEDULE.segments.map((s) => (s.id === "t" ? { ...s, dip: { fade: 1, black: 0.5 }, claim: { id: "t", verdict: "L" } } : s)) }; + const items = fullFrameItems(sch); + assert.equal(items[0].marks, true); + assert.deepEqual(regionSpans(items, { drawsMarks: true }), []); + const chain = chromeOverlayChain(RENDER, [{ name: "stamp", frames: "/f/stamp", x: 0, y: 0 }, { name: "diet", frames: "/f/diet", x: 0, y: 0 }], "[0:v]", 1, { blackouts: items }); + const [stamp, diet] = chain.chain.split(";").filter((p) => p.includes("overlay=")); + assert.doesNotMatch(stamp, /enable=/); + assert.equal(enabledAt(diet, 403), false); + // A teaser without marks: the stamps' region is off over it as any other. + assert.deepEqual(regionSpans(fullFrameItems(SCHEDULE), { drawsMarks: true }), [[400, END]]); +}); + +test("a chapter bumper on the clip after a full-frame item starts when the item's span ends, its entrance whole", () => { + const r = { ...RENDER, chrome: { ...RENDER.chrome, chapter: { list: [{ at: "b", title: "Part two" }] } } }; + const [w] = chapterWindows(SCHEDULE, r); + assert.equal(w.segment, "b"); + assert.equal(w.from, 406.4); + assert.equal(w.to, 409.4); + // After a clip: with its clip, as ever. + const clips = { ...SCHEDULE, segments: SCHEDULE.segments.map((s) => (s.id === "t" ? { ...s, type: "clip", hideDeck: false } : s)) }; + assert.equal(chapterWindows(clips, r)[0].from, 406); +}); + +test("Play: a layer is off while a full-frame item is on screen, by the same traits", () => { + const [it] = fullFrameItems(SCHEDULE); + assert.equal(layerOffOver(it, null, 403), true); + assert.equal(layerOffOver(it, { followsDeck: true }, 403), false); + assert.equal(layerOffOver(it, { ownFade: true }, 400.3), false); + assert.equal(layerOffOver(it, { ownFade: true }, 400.4), true); + assert.equal(layerOffOver(it, { drawsMarks: true }, 403), true); + assert.equal(layerOffOver({ ...it, marks: true }, { drawsMarks: true }, 403), false); + assert.equal(layerOffOver(null, null, 403), false); }); // ---- which segments are full frame: the deck's own rule (deck.mjs hidesDeck), from real schedules --------------- @@ -147,13 +214,14 @@ const manifestWith = (mid, render = {}) => ({ { type: "clip", id: "c2", video: "v2", start: 0, end: 10 }, ], }); +const less = (v) => Math.round((v - 1 / 30) * 1e4) / 1e4; test("a teaser that hides the deck is full frame; a teaser that COUNTS keeps the deck, and every layer with it", () => { const plain = estimateSchedule(manifestWith(card())); const seg = plain.segments[1]; assert.equal(seg.hideDeck, true); assert.equal(fullFrameSegment(seg), true); - assert.deepEqual(chromeBlackouts(plain), [[seg.start, seg.end]]); + assert.deepEqual(fullFrameSpans(plain), [[seg.start, less(seg.end)]]); assert.deepEqual([...fullFrameIds(plain)], ["tz"]); const counts = estimateSchedule(manifestWith(card({ claim: { id: "tz", verdict: "L", at: 1 } }))); assert.equal(counts.segments[1].hideDeck, false); @@ -165,21 +233,22 @@ test("a card under overCards: hide (the default) is full frame; under overCards: const k = { type: "card", id: "k1", seconds: 3, heading: "Part two" }; const hide = estimateSchedule(manifestWith(k)); assert.equal(hide.segments[1].hideDeck, true); - assert.deepEqual(chromeBlackouts(hide), [[hide.segments[1].start, hide.segments[1].end]]); + assert.deepEqual(fullFrameSpans(hide), [[hide.segments[1].start, less(hide.segments[1].end)]]); const m = manifestWith(k); m.render.chrome.deck.overCards = "show"; assert.deepEqual(chromeBlackouts(estimateSchedule(m)), []); }); -test("the brand intro (the first segment, full frame): off from 0 to the end of its dissolve into the first entry", () => { +test("the brand intro (the first segment, full frame): off from 0 to the frame before its dissolve into the first entry ends", () => { const render = { width: 1920, height: 1080, fps: 30, chrome: { engine: "hyperframes", layout: "deck", deck: {} } }; const entries = [{ type: "intro", id: "brand-intro" }, { type: "clip", id: "c1", video: "v1", start: 0, end: 10 }]; const doc = deckSchedule({ entries, durs: [4.18, 10], D: 0.5, render }); assert.equal(doc.segments[0].hideDeck, true); - assert.deepEqual(chromeBlackouts(doc), [[0, doc.segments[0].end]]); + assert.deepEqual(fullFrameSpans(doc), [[0, less(doc.segments[0].end)]]); + assert.deepEqual(regionSpans(chromeBlackouts(doc), { followsDeck: true }), []); }); -test("a video entry's span and an analysis item's are the ones they were (pinned from the build before this lane)", () => { +test("the deck's own regions are laid as main laid them: a video entry's and an analysis item's spans alone (pinned)", () => { const sch = { fps: 30, transition: 0.4, total: 60, segments: [ { id: "a", type: "clip", start: 0, end: 10.4, duration: 10.4 }, @@ -187,19 +256,29 @@ test("a video entry's span and an analysis item's are the ones they were (pinned { id: "b", type: "clip", start: 20, end: 30.4, duration: 10.4 }, { id: "vc", type: "video", start: 30, end: 40.4, duration: 10.4, hideDeck: true, noChrome: true }, { id: "an", type: "analysis", start: 40, end: 47.4, duration: 7.4, hideDeck: true }, - { id: "c", type: "clip", start: 47, end: 60, duration: 13 }, + { id: "tz", type: "teaser", start: 47, end: 53.4, duration: 6.4, hideDeck: true }, + { id: "c", type: "clip", start: 53, end: 60, duration: 7 }, ], }; - // Literals printed by the build at main bf1b4f461 (chromeBlackouts = videoBlackouts + analysisBlackouts). - assert.deepEqual(chromeBlackouts(sch), [[10.3667, 20.2], [30.2, 40.2], [40, 47.4]]); - assert.deepEqual(chromeBlackouts({ ...sch, total: 47.4, segments: sch.segments.slice(0, 5) }), [[10.3667, 20.2], [30.2, 40.2], [40, 48.4]]); - assert.deepEqual(chromeBlackouts({ ...sch, total: 40.4, segments: sch.segments.slice(0, 4) }), [[10.3667, 20.2], [30.2, 41.4]]); - assert.deepEqual(videoBlackouts(sch), [[10.3667, 20.2], [30.2, 40.2]]); + // Literals printed by the build at main bf1b4f461 (chromeBlackouts = videoBlackouts + analysisBlackouts; the + // teaser was not one). + const main = [[10.3667, 20.2], [30.2, 40.2], [40, 47.4]]; + const items = chromeBlackouts(sch); + assert.deepEqual(regionSpans(items, { followsDeck: true }), main); + assert.deepEqual(videoBlackouts(sch), main.slice(0, 2)); assert.deepEqual(analysisBlackouts(sch), [[40, 47.4]]); + for (const name of ["deck", "dial", "odometer", "trail", "feed"]) { + assert.equal(moduleOfRegion(name)?.fullFrame?.followsDeck, true, name); + const chain = chromeOverlayChain(RENDER, [{ name, frames: `/f/${name}`, x: 0, y: 0 }], "[0:v]", 1, { blackouts: items }); + assert.ok(chain.chain.includes(`shortest=1${blackoutEnable(main)}[`), `${name}: ${chain.chain}`); + } + // Every other region: the video spans as they were, the analysis and the teaser to the frame before their ends. + assert.deepEqual(fullFrameSpans(sch), [[10.3667, 20.2], [30.2, 40.2], [40, less(47.4)], [47, less(53.4)]]); + assert.deepEqual(regionSpans(chromeBlackouts({ ...sch, total: 47.4, segments: sch.segments.slice(0, 5) }), { followsDeck: true }), [[10.3667, 20.2], [30.2, 40.2], [40, 48.4]]); + assert.deepEqual(regionSpans(chromeBlackouts({ ...sch, total: 40.4, segments: sch.segments.slice(0, 4) }), { followsDeck: true }), [[10.3667, 20.2], [30.2, 41.4]]); // A video entry with deck: "shown" keeps the chrome. const shown = { ...sch, segments: sch.segments.map((s) => (s.id === "v" ? { ...s, hideDeck: false, noChrome: undefined } : s)) }; assert.deepEqual(videoBlackouts(shown), [[30.2, 40.2]]); - assert.deepEqual(fullFrameSpans(sch), chromeBlackouts(sch)); }); test("a cut with no full-frame item: no blackouts, and the overlay chain is byte for byte the one it was", () => { @@ -226,7 +305,7 @@ const ff = (args) => { return r.stdout; }; -test("ffmpeg: over a teaser's frames no instrument pixel is drawn; over the clips either side the stand-ins are", +test("ffmpeg: over a teaser's frames no diet-strip pixel is drawn, on the clips either side it is; the deck's band is laid as before", { skip: !have && "no ffmpeg" }, () => { const dir = mkdtempSync(path.join(tmpdir(), "teaser-chrome-")); try { @@ -246,7 +325,7 @@ test("ffmpeg: over a teaser's frames no instrument pixel is drawn; over the clip segments: ["a", "t", "b"].map((id, i) => ({ id, type: id === "t" ? "teaser" : "clip", start: starts[i], duration: durs[i], end: starts[i] + durs[i], hideDeck: id === "t" })), }; const blackouts = chromeBlackouts(schedule); - assert.deepEqual(blackouts, [[1.5, 3.5]]); + assert.deepEqual(fullFrameSpans(schedule), [[1.5, 3.4667]]); // White, opaque stand-ins for the deck's band and the diet strip, as long as the cut. const n = Math.round(total * 30); const seq = (name, w, h) => { @@ -276,14 +355,15 @@ test("ffmpeg: over a teaser's frames no instrument pixel is drawn; over the clip const laid = picture({ regions, outLabel: "[hfout]", blackouts }); assert.equal(laid.length, n); const luma = (frame, x, y) => frame[y * W + x]; - const at = [[160, 165], [40, 30]]; // inside the deck's band, inside the diet strip + const [dx, dy] = [40, 30]; // inside the diet strip + const [kx, ky] = [160, 165]; // inside the deck's band: it follows the deck (its own page hides it), never cut for (let f = 0; f < n; f += 1) { const t = f / 30; - const off = t >= 1.5 && t <= 3.5; - for (const [x, y] of at) { - if (off) assert.equal(luma(laid[f], x, y), luma(bare[f], x, y), `frame ${f} (${t.toFixed(3)} s) at ${x},${y}: the teaser's own pixel`); - else assert.ok(luma(laid[f], x, y) > 230, `frame ${f} (${t.toFixed(3)} s) at ${x},${y}: the stand-in is drawn (${luma(laid[f], x, y)})`); - } + // Frames 45 (1.5 s, the dissolve's first) to 104; frame 105 (3.5 s) is the next clip's alone. + const off = f >= 45 && f <= 104; + if (off) assert.equal(luma(laid[f], dx, dy), luma(bare[f], dx, dy), `frame ${f} (${t.toFixed(3)} s): the teaser's own pixel`); + else assert.ok(luma(laid[f], dx, dy) > 230, `frame ${f} (${t.toFixed(3)} s): the diet stand-in is drawn (${luma(laid[f], dx, dy)})`); + assert.ok(luma(laid[f], kx, ky) > 230, `frame ${f}: the deck stand-in is laid as before`); } } finally { rmSync(dir, { recursive: true, force: true }); diff --git a/umtool/report-to-video/video-entry.mjs b/umtool/report-to-video/video-entry.mjs @@ -34,7 +34,7 @@ import { NARRATION_DEFAULTS } from "./narration.mjs"; import { POST_NARRATION_DEFAULTS } from "./post-narration.mjs"; -import { fullFrameSpans } from "./full-frame.mjs"; +import { itemSpans } from "./full-frame.mjs"; const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v); const fin = (v) => typeof v === "number" && Number.isFinite(v); @@ -263,12 +263,12 @@ export function videoSegmentKey({ entry, file, render, lead, target = null }) { * has made black (the segment's start + the dissolve − a frame; mid-dissolve * for `enter: "cut"`) to its end (mid-dissolve into the next, or the cut's * end). Empty for a cut without one -- and then nothing changes. The video - * entries' share of every full-frame item's spans (full-frame.mjs - * fullFrameSpans, which the build lays every chrome region's `enable` from). + * entries' share of the full-frame items (full-frame.mjs fullFrameItems, + * which the build lays every chrome region's `enable` from). * * @param {{ segments: Array<{ type: string, start: number, end: number, noChrome?: boolean, dip?: object }>, total: number, fps?: number, transition?: number }} schedule */ -export const videoBlackouts = (schedule) => fullFrameSpans(schedule, { only: (s) => s.type === "video" }); +export const videoBlackouts = (schedule) => itemSpans(schedule, "video"); /** An overlay's `enable` for blackouts in a stream whose clock starts `shift` s into the cut; "" with none. */ export function blackoutEnable(blackouts, shift = 0) {