Add compose_layout() and lower the cornball layout contract - #20
Merged
Conversation
compose_layout(): paint N named video streams into pixel-rect slots on a black canvas, in slot order -- fill (cover+crop) for heads, fit (contain+pad) for content -- every chain normalized (fps, SAR, yuv420p, timebase), non-reference chains frozen via tpad, output cut frame-exact to the reference and video-only, so the narration bed mapping stays authoritative. The existing pip/overlay/vstack primitives are not chained: their implicit audio pick and shortest semantics are wrong here. render_timeline(): tracks with a cornball$role matching a layout slot are assembled through the same walk/prerender/join pipeline (extracted as .assemble_track) and composed with the content track bound to the 'visual' slot as timing reference; framing is suppressed when composing (the layout defines the canvas) but still sizes still rasters. Layouts degrade like the effects namespace: schema too new, slot without a track, or roled track without a slot each warn once and fall back to the single-stream render. Contract: inst/schema/cornball-layout.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The multi-track composition layer for cornductor's two-stream presets (vertical stack, newscast over-shoulder, explainer corner PiP) — and anything else expressible as named pixel-rect slots.
compose_layout(sources, output, layout, reference)— paints N named video streams into a layout's slots on a black canvas, in slot order.fillcovers (scale-up + center-crop, for heads);fitcontains (scale-down + centered pad, for content). Every chain normalizes fps/SAR/yuv420p/timebase, non-reference chains freeze their last frame via tpad, and the output is cut frame-exactly to the reference — noshortest=anywhere, same discipline ascrossfade_concat. Output is video-only by construction, so a layout can never hijack the narration bed. (The existing pip/overlay/vstack primitives are deliberately not chained: implicit audio pick + shortest semantics are wrong here.)render_timeline()— tracks whosecornball$rolematches a slot in the timeline'scornball$layoutare assembled through the same walk/prerender/join pipeline (extracted as.assemble_track()) and composed with the content track bound to thevisualslot as timing reference. Framing is suppressed when composing (the layout defines the canvas) but still sizes still rasters, so slides keep full-quality Ken Burns and the compose downscales into the slot. Degradation mirrors the effects namespace: schema-too-new, slot-without-track, or roled-track-without-slot each warn once and fall back to the single-stream render; old compost drops roled tracks silently and renders a correct letterboxed video.inst/schema/cornball-layout.md(pixel rects, paint order, visual binding, muted-by-construction, degradation table), cross-linked with cornball-effects.md.Tests: 31 layout (exact filtergraphs, validation, rotio JSON round-trip preserving paint order, at_home composes with per-slot pixel-color and freeze assertions on mixed 24/30fps sources) + render degradation paths + an at_home end-to-end bundle with frames locked to the bed. Full suite 223/223 with at_home on.