forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to crates/engine/src/export.rsClear filter

2026-08-11

✨ feat(mix): every track has its own volume and the mix has a ceilingAhmet Kaan Gümüş · dc7d07d
✨ feat(mix): every track has its own volume and the mix has a ceiling

A fader per audio track and one master limiter over the sum of them, both
applied where the lanes are added and nowhere else -- so what an export
writes is what the room heard, by construction rather than by two call
sites agreeing.

A track's fader moves everything on it, every frequency: it is not the
equalizer (one take, one band) and not the panel's volume (this machine's
monitoring, which no file carries). The limiter is lookahead, soft-knee
and per sample: the peak of an exported file is a measurement, not a hope,
and the hard clamp stays behind it as the backstop.

Flat settings are still the bit-exact passthrough: one lane at unity with
the limiter off never opens a mixer thread, and an mp4 of such a timeline
is still a packet copy. A mixed one re-encodes, and the card says so
before the export starts.

Both belong to the project, so `.edith` is v9: `fps`, `limiter` and `gain`
lines, every older dialect still loading flat. The rate line pays an old
debt with it -- a timeline of nothing but stills and songs now comes back
at the rate it was cut at instead of the one its scaffold implied.

UI: the mix card (f, or an audio track's own header), rows with steppers
and hold-to-run arrows, and the track's level on its header.
✨ feat(export): HEVC leaves the way it came in — intra, in either boxAhmet Kaan Gümüş · 12f8cb7
✨ feat(export): HEVC leaves the way it came in — intra, in either box

The one codec edith could read and never write. OxideAV's pure-Rust H.265,
vendored from git master (its released 0.0.9 is pre-encoder) with one marked
patch: the intra SPS writer had no conformance window and refused any dimension
off the 16-sample CTB grid, so 1920x1080 could not be written at all. It is now
coded padded to 1088 with the edge replicated and cropped back by the SPS, which
is what ffprobe reads out of the bitstream.

Intra-only, and every row says so: the inter modes code 1080p at 0.81 fps across
twelve cores and the intra path does 4.30 on the same picture, so the export is
an intraframe master — ProRes-shaped, large files, every frame a cut point —
rather than a delivery file nobody would wait for. The AU is a stateless
function of one frame, so frames fan out across twelve lanes and are collected
back in display order.

Two rows, `h` and `x`, because a codec and a container are two choices: the
`hvcC` record built from the encoder's own VPS/SPS/PPS goes into a Matroska
`CodecPrivate` and into an mp4 `hvc1` sample entry unchanged, so the two files
are one stream written twice. Both re-open in edith through the plugin, sound
and all.
🔀 merge(T4): every video format carries sound meets the hw/sw indicator and mixed fpsAhmet Kaan Gümüş · cf10a7c
🔀 merge(T4): every video format carries sound meets the hw/sw indicator and mixed fps

Four seams, all kept whole:

- export.rs copy_audio — T4's routing (two lanes, a speeded lane, an equalizer,
  an uncopyable source all fall through to encode_audio) composed with T3's
  conformed-lane comment, which is now the reason a *rate* is NOT one of them:
  a conformed lane still copies, and `tests/mixed_fps.rs
  an_export_of_two_rates_runs_at_the_speed_it_was_shot` is what says so.
- export.rs labels — hw_seat/video_label take both AV1 containers (a container
  is not an encoder), audio_label gained MP3 and stopped calling AV1 soundless.
  It is now a *measurement*: copy_audio hands back an `ExportAudio` that says
  whether the packets were copied, so a progress line naming "AAC copy" is what
  really happened rather than what the edit predicted.
- main.rs — the FORMATS key column meets export_line's seat, and an audio-only
  format now CLEARS the cached video seat instead of showing the last picture
  format's: picking MP3 after AV1 read "SW encode (rav1e) · MP3 · SW
  (rusty_mp3)", which named an encoder that would not run. Same shape for WAV
  and FLAC, which had it before this branch.
- tests/backends.rs — the card==job pin now runs over all three picture formats
  and all three audio-only ones.

Green: engine --lib, --test export/av1/backends/mixed_fps/audio_export/eq_audio
(--test-threads=1), edith --bin, cargo check --workspace. No duplicate keys in
the merged engine manifest.
✨ feat(export): every video format carries sound, AV1 picks its box, MP3 is a rowAhmet Kaan Gümüş · 5ebd3ac
✨ feat(export): every video format carries sound, AV1 picks its box, MP3 is a row

Three asks, one seam — the export's audio path was a packet copy, and everything
it could not copy was a refusal.

- MkvMuxer gains an A_AAC track (CodecPrivate = AudioSpecificConfig, CodecDelay
  one packet) and interleaves it into the clusters: an AV1 export carries the
  timeline's sound instead of naming it as left out.
- Mp4Muxer::create_av1 writes AV1 into an mp4 — the `av01` + `av1C` sample entry
  `mp4 0.14` cannot spell is patched into the finished moov (layout cribbed from
  OxideAV's oxideav-mp4, MIT); Mp4Demuxer reads that entry back.
- Format::Mp3 through `rusty_mp3` at 256 kbps CBR, and Format::Av1Mp4 beside
  Format::Av1: the export card has a row and a key for each.
- copy_audio lifts every "cannot copy" refusal into a route to encode_audio —
  a second audio lane, a speeded clip, a Matroska source, an mp3 or a png
  timeline. A copy nothing forces stays a bit-exact copy.

Round trips per container, through this project's own readers: mkv + mp4 AV1
with a tone (mux unit tests), an AV1 export in either box (tests/av1.rs), a
still under a song as an mp4 with sound and an MP3 of the timeline
(tests/audio_export.rs), two lanes summed into an mp4 (tests/lanes.rs), a
speeded lane resampled into one (tests/speed.rs).
🔀 merge(T3): mixed frame rates meet mkv HEVC, zero-source survival and the zoomAhmet Kaan Gümüş · 6b5fa2e
🔀 merge(T3): mixed frame rates meet mkv HEVC, zero-source survival and the zoom

`main`'s `open_project` now walks every source with the scaffold in its own
slot (T6), so the per-source `rates` table is built there frame by frame beside
`counts` -- one table in two vectors, grown and shortened together. The codec
gate T1 leans on stays; the frame-rate gate is still gone, and a Matroska file
shot at another rate imports through the very same door an mp4 does, its rate
read off the demuxer's `default_duration`.

Grafted from the losing branch, which had the better arithmetic:

* `Rate::from_fps` is exact. Built on `mux::frame_timing` -- the pair the muxer
  already counts an export's frames in -- divided by that pair and reduced, so
  24000/1001 over 30 is `800/1001` and stays it however far the timeline runs.
  The milli-fps rounding it replaces was a frame off after seven hours; that
  ponytail is gone rather than documented.
* A rate no timescale can *name* is an `Err` in `frame_timing`'s own words
  rather than a silent 1:1, and `matches_timeline` is where a file carrying one
  is refused -- it hands back the `Rate` it accepted the file at, so the number
  the refusal was decided on is the number the file plays by.
* `file_frames` and `file_rate` ask one `source_of`, so a path that names a
  length names a rate too.
* Five more tests in `tests/mixed_fps.rs`, in timeline frames: the exactness of
  the NTSC ratio, a trim of an off-rate clip to the room it was dragged to, the
  neighbouring 30 fps clip still read frame for frame, the linked sound placed
  at its picture's length, and the exported pictures measured against the
  file's own frames rather than merely counted.

...and the note the next builder needs in `copy_audio`: a lane holding a clip
at another rate stays a packet copy on purpose. A clip counts the *timeline's*
frames, so the window the copy trims a source's sound to is whole timeline
seconds and the packets are already in sync; re-encoding it would buy nothing
and cost a generation of loss. A speed is different, and still refused there.
✨ feat(backends): the decoder and the encoder say which one is runningAhmet Kaan Gümüş · bdcc2fb
✨ feat(backends): the decoder and the encoder say which one is running

A source names its decoder in the library row before anything plays, the
transport line names the running one while it does, and the export card
names the encoders it would open before the button — the progress line
naming the ones it did.

Every answer is measured, never promised: `decode::probe` picks a seat by
the very rules `open_worker` picks one, the worker publishes what it
actually opened (so a hardware session that falls back to software says
so), and `export::planned_video` opens the very VA-API encoder the export
would and closes it again. `hw_seat` is now the single place that choice
is made, so a card and a running job cannot drift apart.

2026-08-10

🔀 merge(T1): mkv HEVC + 5.1 AAC import meets the EQ exportAhmet Kaan Gümüş · 1dc163e
🔀 merge(T1): mkv HEVC + 5.1 AAC import meets the EQ export

One rusty_aac, not two: the branch's vendored 0.5.0 (patched IMDCT) is what the
workspace patch table points every dependant at, so T5's encoder and this
branch's decoder are the same crate. The auto-merge had left two identical
`rusty_aac` keys in the engine manifest, which is a duplicate-key error -- one
entry now, its comment naming both halves.

The three prose conflicts were all one shape: this branch wrote 'no AAC encoder
is wired here' while T5 was busy wiring one. T5's wording wins in each. Where
main's Av1 doc said this engine's reader 'refuses Matroska audio' the claim is
now false the other way round, so that sentence keeps main's writer half and
takes this branch's reader half.
✨ feat(import): a Matroska film opens, its 10-bit picture and its 5.1 sound alikeAhmet Kaan Gümüş · b083a3b
✨ feat(import): a Matroska film opens, its 10-bit picture and its 5.1 sound alike

mkv HEVC demux (Main/Main10), a P010 pool in the hardware path read back to
I420, mkv audio through symphonia's Matroska reader with rusty_aac decoding
what symphonia's own AAC refuses (anything wider than stereo), and a BS.775
fold of 5.1 down to the stereo the output device takes.

vendor/rusty_aac is 0.5.0 with one local patch: its decoder's IMDCT caches the
cosine matrix instead of calling cos() per term, 11x faster and the difference
between playable and not.
✨ feat(timeline): a clip shot at another rate plays at the speed it was shot atAhmet Kaan Gümüş · 26af1e4
✨ feat(timeline): a clip shot at another rate plays at the speed it was shot at

A frame rate of its own is no longer a refusal at import. Every frame
number in the edit list counts the *timeline's* frames -- a clip's
in/out included -- and a file shot at another rate is converted once, at
the decoder's door: `Rate` (milli-fps rational, `Speed`'s floor/ceil
pair) says which frame of the file a timeline-rate frame is. Playback
opens its worker through it and stamps the pictures coming back through
its inverse; the export walks its span through it after the speed, so a
2x 24 fps clip on a 30 fps timeline is exactly both.

Nothing in `project.rs` changed: placement, trim, split, paste and speed
are the same arithmetic on one clock, and a single-rate project takes
the identity map everywhere it used to take nothing.

A library row now names the *file's* rate rather than the timeline's,
which was true only while every source shared it.
🐛 fix(timeline): a hole punched into a slow clip leaves no overlapAhmet Kaan Gümüş · c892972
🐛 fix(timeline): a hole punched into a slow clip leaves no overlap

`place` punches a hole with `clear`, and `clear` handed the remainder
whatever source range rounding produced. At a quarter speed one source
frame *is* four timeline frames, so a punch three frames into such a clip
left a head that reached past the hole and overlapped what was placed --
the lane invariant, broken by the one edit that is allowed to overwrite.
`Speed::fit` now answers `None` for a room nothing fits in and both
remainders go through it: no fit, no remainder.

The sweep that found it found a second of the same shape. `set_speed` put
one rate on a whole linked group without asking whether the group still
covered one span: two halves of *different source lengths* can occupy the
same frames at 4x (rounding collapses neighbouring lengths onto one
footprint) and re-rating them pulls the halves apart, which is a project
that will not load again. Refused by name now, like the collision is.

The trim walls move with it: one frame of clip always survives, and at a
rate below real time one frame of clip is several frames of timeline
(`Speed::room`). A trim that cannot fit refuses before it snapshots rather
than writing a range wider than its room.

Both fuzz sweeps go to 2000 seeds -- 200 walked straight past this, and a
sweep this cheap has no business being the narrow one -- and place now
lands speeded clips over speeded clips on purpose. Falsified: with the
guard removed, `place`'s own `sorted_disjoint` assert fires.

Grafted from the rival build of this feature, which the judge preferred on
these three points:

- floor/ceil pairing on `Speed`: `source_at` (floor) is what an export
  encodes, `timeline_at` (ceil) is the stamp playback puts on a decoded
  frame, and the pair makes the frame the pump is holding *exactly* the
  frame the export writes, at every rate (`speed_maps_both_ways`, 3751
  speeds). The floor/floor this had put the preview a whole held frame off
  the export at slow rates.
- the picture now **honours** a rate: the export walk takes the source
  frame each timeline frame shows and encodes a held one again rather than
  decoding it twice. `Span::source_len` reads the last shown frame's own
  source frame and not one more.
- the refusal narrows to the mp4's *copied audio lane* only. AV1 has no
  audio to copy and honours a speeded take whole; WAV and FLAC always did.

EVIDENCE: a mixed-rate mp4 (2x then 1x on one lane) reopens as 135 frames
at 30 fps and its bright frames are exactly [15, 16, 75, 76, 77, 78] --
the fixture's four-frame flash halved inside the fast clip, whole inside
the slow one -- read back both by the engine's own decoder and by ffmpeg.
✨ feat(timeline): clips play at a speed of their ownAhmet Kaan Gümüş · f8effe8
✨ feat(timeline): clips play at a speed of their own

A clip gains a rate (`Speed`, thousandths of real time, 0.25x to 4x) and
every speed question is answered at the mapping seams that were already
there: `Clip::frames` is the source range divided by the rate, `end` is
built on it, and `map`/`span_at`/`composite_span_at` walk the offset
through `Speed::source_at`. `in_frame`/`out_frame` stay *source* frames,
so a trim and a split still address the file.

The picture needs no new decoder: the span says how many source frames it
reads, and `try_frame` brings the decoder's numbers back through the same
rate -- at 2x two decoded frames land on one timeline frame and the
display's drop-when-behind policy takes it from there. The sound is
resampled per segment inside the worker playback and the audio export
already share (linear interpolation, carried across packet seams), so the
pitch moves with the rate: tape, not pitch-preserve, and the card says so.
Each segment is told how much timeline it owes and pads or trims to it,
which is what keeps a run of speeded cuts from drifting.

Rounding is where a rate could break the lane, so it does not: `Speed::fit`
never hands a trim more source than its room holds, and `Speed::split_at`
refuses a cut a slow clip's rate cannot address rather than leaving two
halves that no longer add up. The fuzz sweeps set_speed in with the rest.

- card in the eq/colour pattern, on `j` and in the clip menu; a drag is one
  undo step for the whole linked group, 1.00x reachable by hand and by `r`
- clip boxes carry a "2.00x" mark, and their width, waveform and details
  row are the timeline length
- WAV/FLAC honour it; mp4 and AV1 *refuse* by name -- that path copies AAC
  packets and a resample is not a copy (ponytail names the upgrade path)
- .edith v8 carries the rate; v7 and older load at 1.00x
- `assets/test_speed_sync.mp4`: one flash, one beep, same instant. At 2x
  they still land together, to the frame.
Merge branch 'main' into worktree-agent-ae7a2aef268502a46Ahmet Kaan Gümüş · 934361c
Merge branch 'main' into worktree-agent-ae7a2aef268502a46

# Conflicts:
#	crates/engine/Cargo.toml
✨ feat(timeline): still images import and place as clipsAhmet Kaan Gümüş · 30d430d
✨ feat(timeline): still images import and place as clips

A PNG, JPEG or WebP is a source like any other: it imports into the
library, drags onto a video lane, shows at the playhead, trims, saves and
exports. `engine::is_image` is the door, beside `is_audio`, and every
choice it forces is made in one place.

The decisions, spelled out:

- Extensions: png, jpg, jpeg, webp -- exactly what the `image` crate is
  built with here. Anything else is refused by the door that refuses a
  .txt.
- Length: an image has none, so it is *held to* ten minutes (600 s at the
  timeline's rate) and *placed* at five seconds. The cap is finite on
  purpose -- a u32::MAX sentinel would hand a trim drag a wall past
  anything the timeline can hold -- and it is recomputed identically at
  load, so a clip trimmed out to it reopens.
- Image-first project: its own picture is the canvas (a still *has* a
  resolution, unlike a song) at 30 fps, silent, one 5 s clip on V1. The
  A2 audio-only precedent for everything else.
- Scaling: none of its own. The still is decoded once to I420 and goes
  through the same grade, the same `Composer` and the same conversion a
  decoded picture does, so a 640x360 image on a 1280x720 canvas is
  letterboxed by its fit policy and never stretched.
- Lanes: the mirror of a song. A still goes on the video lane it was
  asked for or on V1, never on an audio one, and never as a grouped take
  -- a clip on A1 playing a PNG is a segment the audio worker cannot
  open. Hand-written projects are refused by name.
- The timeline's audio parameters are now the first source that *could*
  have any, so an image as source 0 no longer holds every later import to
  its silence.

Playback opens a still worker (one conversion, then a memcpy per frame,
as the black-gap worker does); the export's `ClipDecoder` hands the same
planes out for as long as the span runs, so a mixed video/still timeline
encodes at the cut.

tests: engine/tests/images.rs -- import registers only, placed pixels
match the file's own (top/bottom bands catch a flip, RGB order catches a
swap), trim walls at the cap, .edith round trip incl. the audio-lane
refusal, mp4 export pixel-checked at the cut, audio-lane placement lands
on V1. Fixture: scripts/gen_fixtures.sh writes assets/test_still.png.
✨ feat(export): AV1 comes back out, in a Matroska file this editor reopensAhmet Kaan Gümüş · dd3a2a8
✨ feat(export): AV1 comes back out, in a Matroska file this editor reopens

The export card's second picture format. AV1 already *arrives* here as
Matroska (`mp4 0.14` has no `av01` sample entry at all, so `demux` walks
the EBML by hand); it now leaves the same way, through an `MkvMuxer`
written beside the mp4 one -- EBML header, `Info`, one `V_AV1` track whose
`CodecPrivate` is a real `av1C` record built from the first keyframe's
sequence header OBU, then clusters that open on every keyframe. The
segment size and the duration are the only two fields patched at `finish`.
Matroska rather than AV1-in-mp4 because the reader for it already exists:
the round trip closes against this project's own `Demuxer`.

Picture only, and said so on the row before a destination is picked ("AV1
picture in .mkv — no sound: export WAV or FLAC for that"). Matroska
carries no sound this project can *write* -- no AAC or Opus encoder here
-- and an AAC track copied in would be one this engine's own reader leaves
silent (`AudioSession::open` refuses Matroska audio). A silent track
written anyway is the one failure a user would not notice.

The encoder pair mirrors H.264's: `rav1e` in software, the plugin's new
`vh_enc_av1_open` on the GPU. The hardware seat is wired, tested and
**opt-in** (`VE_HW_AV1=1`): the vendored cros-codecs AV1 encoder took the
radeonsi box this was written on into an amdgpu hard recovery, and a
driver reset is not an export. `rav1e` is not a new dependency at all --
`ravif` already locks the same 0.8.1 -- and is built with `asm` off (no
`nasm` in this build) and `threading` on: 39 s for the 5 s 720p fixture,
progress reported the whole way.

HEVC and VP9 are rows too, refused by name: no encoder in this stack and
patent-encumbered, and superseded by the AV1 row above.
✨ feat(audio): a song opens as a timeline of its ownAhmet Kaan Gümüş · eb9a278
✨ feat(audio): a song opens as a timeline of its own

An audio file could not start a project: `PlaybackSession::open` refused
every `is_audio` path because a timeline was scaffolded from source 0's
*picture*. It now scaffolds the canvas instead -- 1080p at 30 fps H.264,
the rate a later video import is held to -- takes its length from the
audio, puts the one clip on `A1` and leaves the video lane empty, so the
existing gap path plays it black while the song keeps the clock.

`open_project` does the same when source 0 has no picture, so an
audio-only `.edith` loads. An mp4 of such a timeline is refused by name
in `export::start` (it would be black over the sound) and the export
card says so on the MP4 row before a destination is picked; WAV and FLAC
export as they always did. The Export button now re-asks that question
too, since mp4 is the default and a timeline can lose its picture after
the format was chosen.
🔒 fix(export): an empty timeline is refused by the engine, in every formatAhmet Kaan Gümüş · dc82aff
🔒 fix(export): an empty timeline is refused by the engine, in every format

Grafted from the rival empty-timeline candidate: the app's `is_empty`
refusal was the only fence, so an export started by anything that is not
that button still wrote a file of no frames. The refusal now lives in
`export::start`, in the rival's exact words.

Placed ahead of the format match rather than inside `run`, so a WAV and a
FLAC refuse in the same words an mp4 does -- `run_audio` would otherwise
have written a zero-sample file or refused as "no audio to export", which
names the wrong thing. The app keeps its own check: two fences, and only
the app's has a keystroke to blame.

The end-to-end test asserts the exact message for all three formats and
that no file is left behind.
✨ feat(engine): project resolution stands apart from media resolutionAhmet Kaan Gümüş · 19e294a
✨ feat(engine): project resolution stands apart from media resolution

A timeline had one resolution because its first source did: import refused
anything else by name, and there was nowhere to say otherwise. A project now
carries its own picture size and every clip is composed onto it, so media of
different resolutions share a timeline the way they do in any editor.

* scale::Composer is the one definition of that composition -- fit_rect,
  scale_i420, compose_i420 onto a black canvas -- and both playback and export
  call it, so what is written is what was watched. A canvas of the picture's
  own size is a pass-through that allocates nothing and touches no byte.
* Grade first, place second: a grade belongs to the clip's pixels at the
  resolution they were shot at, and the letterbox bars are not the clip.
* Per-clip fit policy (fit/fill/stretch/centre), one byte inline in Clip -- it
  lands in padding the clip already had.
* .edith v7: a `resolution <w> <h>` line and a fit word per clip line. v6..v1
  still load, defaulting to source 0's picture and Fit, which is what those
  projects always meant.
* The fps refusal stays: mixing frame rates is resampling the timeline, a
  different problem, and a refusal is the honest answer until it is solved.
* UI: `p` cycles the fit policy of the clip on screen (and a clip-menu item),
  ctrl+r cycles the project resolution through the usual sizes with the media's
  own among them, and the export card says which size it writes.
✨ feat(video): per-clip color grade is live in render and exportAhmet Kaan Gümüş · bd89527
✨ feat(video): per-clip color grade is live in render and export

The grade a clip carries now reaches the picture. `Project::composite_clip_at`
names the clip the composite shows at a frame and `composite_color_at` its
grade, so playback's decode worker (folded into `i420_to_bgra_with`, free in
the loop that was reading those samples anyway) and the export's encoder (onto
per-span scratch, since the planes are borrowed) grade from one answer.

`PlaybackSession::set_color` is an edit like any other, so it reseeks -- which
is what repaints the frame already on screen, paused or playing.

The card: `k` (or the clip menu's Colour…) opens four sliders on the selected
video clip, or on the clip under the playhead when nothing is selected, so it
is reachable with no pointer at all. Arrows pick and move a slider, r resets,
esc closes; a slider walked back to the middle takes the grade off, which keeps
an ungraded project byte-identical -- verified: the same two-clip export before
and after this slice is md5 98522c19cefac2f7851b51de6416a493 both times.
✨ feat(audio): per-clip equalizer is live in playback and exportAhmet Kaan Gümüş · 4d92155
✨ feat(audio): per-clip equalizer is live in playback and export

The model, the format and the filter have all existed with no callers. This
wires them: `Project::audio_eqs_from` hands one curve per segment beside the
play list `audio_segments_from` already builds, `open_mixed_streams_eq` gives
each lane's worker those curves, and `emit` -- the one place both readers hand
their samples over -- filters a segment after it is trimmed and before it is
sent. Playback and an audio export therefore get the same filtered stream by
construction rather than by two call sites agreeing.

A parallel list, not a fourth element of the segment tuple: that tuple is what
every opener, the packet-copy path and a dozen tests speak, and an effect is not
part of which samples a segment names. A short list plays flat, so a mismatch
can neither panic nor shift a curve onto the wrong clip.

Live editing needs no channel into a running worker: `set_eq` is an edit and
every edit reseeks, so the workers are rebuilt from the new curves where the
playhead is standing.

An mp4 export copies AAC packets and no filter can reach a copy, so an
equalized clip is refused by name and by timecode rather than written flat.

The card is the third of its kind (same scrim, width and rows as keys and
export): a row per band, dragged from the middle out, with `q` to open it and
1-5 / up / down / r as its own keyboard, every one of them listed in the keys
menu by the registry the guard test reads.
🐛 fix(engine): the mp4 audio copy follows the lane that holds the soundAhmet Kaan Gümüş · 000621a
🐛 fix(engine): the mp4 audio copy follows the lane that holds the sound

The refusal gate counted non-empty audio lanes but the copy still read A1's
play list, so a project that leaves A1 empty and places everything on A2 passed
the gate as "one lane", played its sound, and exported an mp4 with no audio
track at all -- silently, which is the one failure nobody notices until they
play the file back.

The copy now takes the single list `audio_segments_from` already resolved for
playback, so "which lane holds the sound" is asked once and answered the same
way everywhere. The gate keeps its wording: that list is never empty, so the
refusal is still exactly the >1-lane case.
✨ feat(engine): N-lane compositing in playback and exportAhmet Kaan Gümüş · 08af6bc
✨ feat(engine): N-lane compositing in playback and export

Video: the topmost video lane with a clip there wins, topmost being the last
lane in display order (V2 over V1, the overlay convention). No blending, so
exactly one lane is visible per frame and the composite is itself a span list
-- Project::composite_span_at -- which one decoder plays. N video lanes never
mean N decoders; a lane change costs the one decoder reopen a cut already
costs.

Audio: every audio lane that holds something gets a play list
(Project::audio_segments_from) and AudioSession::open_mixed_streams sums them,
clamped, each lane keeping its own gap rule so the master clock counts a sample
per sample of timeline. One lane skips the mixer entirely and is the byte-for-
byte path it always was.

Export walks the same composite and mixes the same lanes for WAV/FLAC. The mp4
path copies AAC packets and cannot mix, so a timeline whose sound is spread
over two lanes is refused there by name rather than silently exported without
half of it.
♻️ refactor(engine): the project holds N lanes, V1..Vn and A1..AnAhmet Kaan Gümüş · b474a9b
♻️ refactor(engine): the project holds N lanes, V1..Vn and A1..An

Merge of the multi-lane winner (candidate B) onto the S5a main, plus the
three grafts the judge picked out of candidate A and the delete-selected
fix it flagged:

* LaneData::two_lanes(), one place for the pair single() and from_parts()
  both build;
* a_group_may_span_any_lane: hand-built lanes driving links_are_consistent
  directly -- one take on V1 + A2 with the lanes between it empty is legal,
  and both ways to break the rule are asserted by their exact message;
* add_lane doc: an empty new lane is legal even though from_parts refuses
  an all-empty project -- the lanes that were there still hold the timeline;
* delete_selected is exhaustive over lane.kind and explicit about ord: it
  hands V1/A1 indexes to engine calls that mean V1/A1, so a second-lane
  selection would have deleted a different clip under a _ => false wildcard.

Conflicts, all against the S5a Source model: without_orphan_sources keeps
B's crate::Result and its >1-lane-per-kind refusal but returns Vec<Source>,
and Lane::Audio in place_stream_at/import_audio became Lane::A1.
✨ feat(engine): HEVC import via the VA-API pluginAhmet Kaan Gümüş · 85c152d
✨ feat(engine): HEVC import via the VA-API plugin

The demuxer takes a hev1 track alongside avc1 and vp09. Its parameter sets are
read out of the file by hand: mp4 0.14 reads one byte of hvcC and skips the
rest, so the VPS, SPS and PPS an HEVC decoder cannot start without are
unreachable through the crate. A small ISO-BMFF walk finds the track's hvcC and
the record gives both the parameter sets and the NAL length prefix width -- the
avcC one is now read the same way instead of assumed to be four bytes, which is
one hardcoded guess less on the H.264 path too.

Samples are repacked to Annex-B exactly as H.264's are, parameter sets ahead of
every sync sample, because a hardware decoder that joins the stream at a seek
has nothing else to configure itself from.

Main 10 is refused at open by name: the plugin's NV12 pool and its vaGetImage
read-back are 8-bit, and a 10-bit stream decoded into them would be garbage
shown as a picture rather than an honest no. Same reasoning as the software
refusal, which is now one message shared by every codec that has no software
decoder at all.

The C ABI is unchanged again: the plugin demuxes the file it is given, so an
older libengine_hw.so still loads, still decodes H.264, and simply returns null
for an HEVC path.
♻️ refactor(engine): the project holds N lanes, V1..Vn and A1..AnAhmet Kaan Gümüş · 154fd69
♻️ refactor(engine): the project holds N lanes, V1..Vn and A1..An

The edit list was a fixed pair -- `Lane` {Video, Audio}, `lanes: [Vec<Clip>; 2]`
and seven hundred lines of methods walking that pair by hand. Multi-lane UI,
per-lane compositing and per-clip EQ all want lanes to be a list, so make them
one now, while the model is small enough to change in one sitting.

`Lane` becomes a handle -- a `LaneKind` plus a 0-based `ord`, so `Lane::V1` is
the first video lane and `Lane::new(Audio, 1)` is A2 -- and the project stores
`Vec<LaneData>`, a struct that per-lane state (mute, compositing mode, a name)
can grow into. A handle naming a lane that is not there reads as an empty lane
and refuses every mutation, so a front-end that only ever asks for V1/A1 needs
no bounds check of its own. Every method is a walk over the lane list now
instead of two hand-written cases.

The grouping rule generalises rather than pairing lanes off: a link id names at
most one clip per lane and every clip carrying it covers the same span, on
however many lanes. So a split hands out one id per group of lanes whose halves
line up -- one helper, used by split and regroup alike.

Playback, export and the audio worker still read V1 and A1: compositing is its
own slice. So is the file format, which holds one lane keyword per kind, so a
save of more than two lanes is refused by name instead of silently dropping
one; a two-lane project writes exactly the bytes it always did.
✨ feat(engine): VP9 import via the VA-API pluginAhmet Kaan Gümüş · 03a34d3
✨ feat(engine): VP9 import via the VA-API plugin

The demuxer takes a vp09 track alongside avc1 and hands its samples through
untouched -- an mp4 VP9 sample is a self-contained superframe, so there is no
avcC repack and no parameter sets to re-inject. VideoMeta carries the codec,
and the plugin picks its cros-codecs decoder from it.

The C ABI is unchanged on purpose: the plugin demuxes the file it is given,
so the codec is a property of the container rather than of the call, and a
libengine_hw.so built before this still loads and still decodes H.264 -- it
simply returns null for a VP9 path, the same no it gives for an unsupported
profile.

There is no software VP9 decoder to fall back to, so a VP9 file the plugin
will not take is refused at open, by name, where the front-end can show it --
never a black screen, and never VP9 bytes fed to rusty_h264. One timeline
stays one codec, and export re-encodes to H.264 as before; only audio is
ever copied packet for packet.
✨ feat(library): every audio stream is a row, and the picked one plays and exportsAhmet Kaan Gümüş · ecb5e06
✨ feat(library): every audio stream is a row, and the picked one plays and exports

A file with one audio track per language is one row per track now, not one row
per file. The engine carries the pick end to end: a source is a (file, audio
stream) pair, .edith v3 writes the stream on the source line, playback opens it
and — the trap this closes — the export copies *that* stream's packets rather
than always stream 0.

Streams that cannot go on the timeline are listed greyed with the reason
instead of hidden: a codec we cannot read, or a rate/layout that cannot share
one output device and one copied AAC track with the rest of the timeline (there
is no resampler here and no AAC encoder to write a join with). place_stream_at
is the one door a row goes through, and it refuses those in the engine's own
words.

- v2 and v1 files still load: no stream field means stream 0, which is all
  those dialects could play; saving either writes v3.
- Waveform peaks are keyed by file *and* stream, so two tracks of one file
  cannot draw each other's envelope.
- Library swatches and clip tints follow the *file*, so a file's streams share
  one colour in the panel and on the lanes.
- assets/test_multilang.mp4: two AAC 44.1k stereo streams (und, fra), the shape
  real multi-language media has and the one where a second stream is placeable.
🐛 fix(engine): NTSC frame rates survive the sample tableAhmet Kaan Gümüş · 3f81ef8
🐛 fix(engine): NTSC frame rates survive the sample table

`mp4 0.14`'s `Mp4Track::frame_rate` divides the sample count by whole
milliseconds before the float cast, so 24000/1001 read back as a flat
23.0: the picture the audio-sample master clock asked for was 4 % out and
the drift grew with the film — five minutes of it by the end of a
two-hour one. The frame rate now comes off the stts totals in f64, which
is exactly `timescale / delta` for a constant table and an average for a
spread one.

The same truncation lived at the writing end (a 90 kHz clock cannot count
23.976 fps in whole ticks), so the muxer picks a timescale that can:
90 kHz wherever it divides exactly — every integer rate, so those exports
are byte for byte what they were — and `round(fps * 1001)` over 1001
ticks otherwise, which is exact for the whole NTSC family. The hardware
encoder gets that same rational instead of a rounded `fps * 1000`.

The video edit list is honoured now too, the way the audio one always
was — but only what it really trims: a `media_time` equal to the first
`ctts` offset is the B-frame composition delay, not a cut, and reading it
as one throws two real frames away.

A file whose audio we cannot decode at all (an AC-3 remux) played silent
with the reason on stderr; the session carries it now and the window says
NO AUDIO in its notice bar.
✨ feat(engine): real silent AAC for export gaps, link + overflow guardsAhmet Kaan Gümüş · 301e29b
✨ feat(engine): real silent AAC for export gaps, link + overflow guards

Grafts the losing candidate's hand-written AAC-LC silence into the
offset-placed lanes: a gap in the audio lane is copied as max_sfb=0
access units (4 bytes mono, 7 stereo, verified against our own decoder)
instead of being spent as stts duration on the packet in front of it.
That retires the 23 ms leading-gap misplacement, so every packet is one
1024-frame sample table entry again and the muxer takes no duration.

from_parts becomes the release-active untrusted door it claims to be:
per-cause errors, an end-overflow bound, and the grouping rules -- a
link id names at most one clip per lane, and a pair covers one span.
The parser bounds the same overflow by line number, `place` strips the
incoming group id, and the two lane surgeries (`clear`, `open_room`)
drop the id from what they cut, which is where duplicates came from.
✨ feat(engine): video+audio lanes with offset-placed clips, gaps, .edith v2Ahmet Kaan Gümüş · 59eb78e
✨ feat(engine): video+audio lanes with offset-placed clips, gaps, .edith v2

Project gains two lanes; a Clip now carries `start` (its timeline
placement) and `link` (group id), so a gap is simply the absence of a
placement rather than an object anyone has to keep in sync. Moves and
trims become arithmetic on start/in_frame; the lane invariant (sorted,
non-overlapping) is checked in from_parts, at the .edith parser, and
asserted after every mutation.

split cuts every lane and hands the two sides fresh group ids; regroup
is its exact inverse. delete still ripples both lanes (the app keeps its
behaviour), lift removes one placement and leaves a hole, place is the
per-lane overwrite that can make one.

A video gap plays as black frames from a worker that opens no file --
same channel, backpressure, cancel and retire path as a decoder -- and
exports as encoded black. An audio gap is synthesised zero chunks, real
ones, so the master clock keeps counting through it; on the export side
it is spent as stts duration on the packet beside it, since there is no
AAC encoder to make silence with.

.edith v2 writes one line per placement per lane; v1 files still load,
as fully-grouped gapless lanes, and save as v2.

2026-08-09

✨ feat(engine): multi-source traversal, import validation, cross-source exportAhmet Kaan Gümüş · 68b0ca2
✨ feat(engine): multi-source traversal, import validation, cross-source export

Wave 2 of the import slice, two packages merged at one seam.

Playback traversal (S3): next_clip/seek open each clip against
project.sources()[clip.source]; audio switches to open_multi_segments over
the (source, start, end) triples segments_from now yields. New
PlaybackSession::import validates dimensions, fps and audio params against
the timeline before appending, and reseeks unconditionally so a running
audio worker learns the appended tail. clip_spans_by_source() added for the
app's per-source tint.

Cross-source export (S4): export::start drops its source path argument --
Project::sources() is the only path truth now -- and is pub so a test can
build a multi-source Project without a session. Each clip opens its own
ClipDecoder; the audio pass carries one bresenham accumulator across source
joins.

Seam: PlaybackSession::path is gone. It was kept only to feed export_to,
which no longer takes a path, so the field and its initialiser go with it.
✨ feat(engine): multi-source model + segmented multi-file audioAhmet Kaan Gümüş · 5593a9f
✨ feat(engine): multi-source model + segmented multi-file audio

Wave 1 of the import slice: the timeline model and the audio backend both
learn about several source files. Nothing user-visible yet — every clip is
still source 0 until playback/export traversal lands.

S1 — project.rs model + mechanical call-site fixes:
- Clip gains `source: usize` (Clip stays Copy, so clipboard/undo semantics
  are untouched); Project gains an append-only `sources: Vec<PathBuf>`.
- Import splits in two: `import(path) -> usize` is dedup-only and pushes no
  history, `append_clip(source_idx, frame_count) -> bool` pushes the one
  snapshot — an import stays exactly one undo step, and append_clip refuses
  an unknown index.
- Dedup key is fs::canonicalize with a raw-path fallback, so Project stays
  pure data and an unreadable path still gets an index.
- cut/paste carry the source through `..self.clips[idx]` struct-update.
- `segments_from` now yields (source, start, end) triples; playback.rs and
  export.rs strip the index and keep feeding the single-source audio fns.

S2 — audio.rs Track/probe/bit-exact joins:
- New private `Track` resolves one source once (reader, copied stts, own
  priming, params, sample_count).
- `open_multi_segments` / `copy_multi_segments` take the source triples;
  `open_segments` / `copy_segments` are now one-source wrappers, so every
  existing call site compiles unchanged.
- Each source contributes its own priming and length; the timeline sample
  counter and the bresenham rounding debt both run continuously across a
  source join, and the extra priming packet stays the first segment's alone.
- `AudioSession::probe(path) -> Option<AudioProbe>` exposes the fields
  import validation needs.
- Cross-source decode is bit-exact against single-file open_at on both
  sides of a join (max abs diff 0e0).
🐛 fix(export): late-cancel window + atomic .part renameAhmet Kaan Gümüş · f973b71
🐛 fix(export): late-cancel window + atomic .part rename

Cancel was only checked inside the per-clip frame loop, so an esc during
the drain, the audio pass or `finish` completed the export anyway and left
a file the user had asked not to have. Cancel is now checked after the
loop and again before `finish`.

The worker also writes to `<out>.part` and renames it onto the output only
on full success, so the output name never points at a half-written file --
and a killed process orphans a `.part` instead of a playable-looking
`.export.mp4`.
✨ feat(engine): export — edit list to mp4, HW encode with SW fallbackAhmet Kaan Gümüş · 86d5c15
✨ feat(engine): export — edit list to mp4, HW encode with SW fallback

Worker thread per export: decodes each clip straight to I420 (never through
DecodeSession, which only speaks BGRA), feeds one encoder chosen once --
VA-API plugin unless VE_SW_ENC=1 or the plugin is unavailable, rusty_h264
Fast/CBR otherwise -- and muxes the access units as they come. Audio is
copied packet for packet, so the file has to be opened before the first
video sample is written.

Cancel and every error path delete the partial file; progress is a permille
atomic a render loop can read without a lock.

mux: the movie timescale moves to 90 kHz. mp4 0.14 converts each sample
duration into the movie timescale with its own integer division, so 1 kHz
lost 0.33 ms per frame and made a 4.000 s export announce 3.960 s.