forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 2c8e3aa151eb0ab655f319f6cdc69a4f66f2b3ffFiltered to crates/engine/src/playback.rsClear filter

2026-08-12

🚀 perf(import): the container walk goes to the worker, not the render threadAhmet Kaan Gümüş · 0e88697
🚀 perf(import): the container walk goes to the worker, not the render thread

The Import door read the file twice: once on a worker to warm the page
cache, and once on the UI thread to actually parse it. The second one is
what a person sees -- 2.5-6 s of frozen window opening a 24 GB 4K HEVC
remux, and 0.8-8.9 s importing one beside a timeline that is already up.
The subtitle half of this door was split across the hop a while ago
(`parse_subtitles` walks, `add_subtitle_tracks` pushes); this is the
container half, and it is the same split.

The engine grows the two doors the front-end needed: `probe_import` --
the header, the decoder this machine would open it with, and the audio
check, all with no session in reach, so a worker can run it -- and
`import_probed`, which registers what came back and touches no disk. The
gate they are decided against (`import_gate`) is two clones off the
timeline, so the UI thread hands it over and goes on painting. A timeline
that moved while the worker read is noticed rather than trusted: a stale
probe falls back to the slow door and lands the same row.

A file arriving at a window with no timeline to import into is opened
whole on the worker instead (`open_whole`), which is where the 2.5-6 s
went, and every `.edith` -- dropped, picked or named on the command line
-- now goes through the one queue as well, so its open is a worker's too
and the line above the panel names it while it runs.

Measured on a real-library 4K HEVC remux (24 GB): the
header walk is 21.4 s cold and 429 ms warm, and probing the timeline's
own first source is another 1-4 s. None of it is the render thread's any
more.

...and the line that says so grows a Cancel, because a read that long
needs a way out. The read in flight is not stopped -- a demuxer walk
polls nothing -- so the window is given back at the click, the file does
not land, the queue behind it is dropped, and the notice says exactly
that rather than promising the disk went quiet.
✨ feat(audio): convert wide layouts and off-rate sources at import instead of refusingAhmet Kaan Gümüş · c94ba8b
✨ feat(audio): convert wide layouts and off-rate sources at import instead of refusing

An 8-channel Opus track came back "IMPORT FAILED: unsupported channel
layout: 8 channels (max stereo)" and took the picture with it, and a
48 kHz file "audio 48000 Hz 2 ch does not match the timeline's 44100 Hz
2 ch". Both strings are gone: an import converts.

Width: `fold_5_1` becomes `downmix`, a coefficient table per layout from
2.1 to 7.1 (ITU-R BS.775 — front channels keep their side, centre and
surrounds join at -3 dB, LFE dropped, both sides normalised by their own
coefficient sum so a full-scale source cannot clip). 5.1 comes out of the
table bit-identical to what it was. `vorbis_to_film_order` gains the RFC
7845 permutations for 3, 5, 7 and 8 channels beside the 6 it had, so
surround Opus at any width reaches the fold in the order the fold reads.
The AC-3 decoder's own 2.1 passthrough, which it leaves at 3, folds here
too, and a multichannel AAC track in an *mp4* now takes the `rusty_aac`
route the Matroska side already had (`aac_decoder`, one call for both).

Rate: the segment resampler a speeded clip already goes through takes the
source rate over the timeline's into its step, so the two compose into one
interpolation and 48 kHz onto a 44.1 kHz timeline keeps its pitch. All of
it is convert-on-read — per packet in the decoder, per buffer in `emit`,
after the window trim — so there is no upfront pass to show progress for
and nothing to cancel.

What is still refused is the layout alone: a mono track cannot join a
stereo timeline, in the words "audio 1 ch does not match the timeline's
2 ch". The picker's grey-out rule follows the gate rather than leading it.

Measured on a 12.9 GB 2160p AV1 remux with a real-library 7.1 Opus
track: imports, opens as a timeline, and a ten-second WAV export comes
back at RMS 0.0091 left / 0.0085 right.
✨ feat(subtitles): as many tracks as you want, embedded in the exportAhmet Kaan Gümüş · 28e2853
✨ feat(subtitles): as many tracks as you want, embedded in the export

Subtitle tracks now work the way audio and video tracks do: add as many
as you like, remove any of them, and every track with cues on the
timeline is written into the exported file.

Add and remove
- "+ S" beside "+ V"/"+ A" imports every subtitle track in a picked
  file; each row carries its own "x". Pointer and keyboard doors share
  one implementation and refuse identically, before any chooser opens.
- Project::remove_subtitles / PlaybackSession::remove_subtitles, with
  the index fixup in one place so a removal cannot repoint the overlay.

Embedded in the output
- ExportSettings.subtitles is a list; the Matroska muxer writes N tracks
  from number 3 up, ceiling derived from the encoding (0x7F -
  SUB_TRACK_FIRST) because track 127 is the all-ones VINT our own reader
  maps to "unknown" and would silently lose.
- mp4 carries them too, as real tx3g timed text. The old "an mp4 carries
  none" was a false refusal: mp4 0.14 has MediaConfig::TtxtConfig all
  along. Samples are built from cue boundaries, so gaps are empty
  samples and the track spans the film.
- of_mp4 reads them back, so edith re-imports its own output. Verified
  against a file ffmpeg muxed, which writes mdhd in microseconds where
  we write milliseconds.
- The export set is derived from timeline_cues per call, so it cannot
  desync; the card names a track it leaves off, and counts past the
  width budget rather than eating the card.

Language and title
- SubtitleTrack carries language and name apart; the guess-them-back
  heuristic is gone. LanguageBCP47 is read and mapped to a 3-letter code
  (ffmpeg reads no BCP-47 at all, so writing it would have made the
  language invisible). A 17-track subtitle library file and a
  dual-language one no longer read "und".

Media bitrate in properties
- engine::probe_bitrate opens no decoder; all three numbers share the
  container's duration, so total >= video + audio holds by construction.
  Within 0.004% of ffprobe across the library.
- Both properties cards show it; a dual-audio file says which of how
  many. The line picks one unit off its smallest stated component, so a
  real value never renders as 0.00.

Off the render thread
- The subtitle walk moved to the background executor at every door:
  1324ms -> 0.1ms on a 3.1GB film, 234ms -> 5.0ms on a 25.4GB/35-track
  one. (The media walk is still on the render thread; separate slice.)

False refusals removed
- .mks and .mka were refused while the compiled-in Matroska reader
  parses them; is_matroska now takes the standard's closed set.
- The audio-only "sound alone" sentence was unreachable when every pick
  was a bitmap track.

Subtitle-free exports stay byte-identical: 294a8b0c (hevc mkv),
8c16b8b1 (default mp4).
⚡ perf(playback): a seek opens the sound on the feeder, not on the hand that seekedAhmet Kaan Gümüş · 46e8379
⚡ perf(playback): a seek opens the sound on the feeder, not on the hand that seeked

The picture's open moved onto its worker last week; the sound's stayed on the
caller. `AudioSession::open_mixed_streams_live` opens every track a segment
names -- one `pread` per track, seconds off a cold cache on a 25 GB film -- and
`PlaybackSession::seek` ran it on whoever called it, which in the editor is the
thread that paints. Measured at the seat, cold: one ruler click froze the window
13.5 s, a 300-step scrub burst froze it 22 s. The line written for exactly that
wait (`seek_line`, "the window is not frozen") was unreachable, because the
thread that would have painted it was inside the open.

`Audio::spawn_feeder_deferred` gives the feeder the open as well as the drain,
mirroring `DecodeSession::open_worker_deferred`: the caller pays a thread spawn
(2.09 ms cold on the film, was 9.27 s) and the sound arrives when it arrives.
The epoch is captured at the seek rather than when the open returns, so a scrub
that abandons twenty opens leaves twenty *stale* feeders, every one of them
refused at the same lock the flush is taken under.

The clock is untouched by the wait, which is what makes the wait safe: it holds
where the seek put it until the first real sample is queued (`content_at`), so
8.7 s of cold open put the timeline 22 ms past its target rather than 8.7 s past
it. `fed` is now re-based at that same first sample instead of at the seek --
the open's seconds are device time nobody fed, and counting them handed the
timeline to wall time that far before the sound really ran out.

There is no synchronous answer to "will anything play" any more, so `start_audio`
returns whether a feeder took the job and the callers hand the clock to audio on
it; a timeline with nothing to play ends its feeder at once, and `fed_all` hands
the clock straight back, continuously. Whether there is a *mixer* to talk to is
decided from the lists the open is about to be handed (`AudioSession::is_mixed`,
the one definition, shared with the opener) rather than read off the handle
afterwards -- a fader on the single-lane flat path still rebuilds the stream.

Cold, playing, the device now runs through the open with an empty ring: audibly
the same silence, counted as 1721 underruns where it was 5. Named at `resume`
with its upgrade path. A warm session is unchanged (46 -> 53 across the suite).

2026-08-11

⚡ perf(subtitle): a project naming many tracks of one file walks it onceAhmet Kaan Gümüş · 95fb78d
⚡ perf(subtitle): a project naming many tracks of one file walks it once

A saved subtitle row was read by walking its whole Matroska file and
keeping one track of it, so a film whose project names thirty-five of
them was thirty-five walks of a 25 GB file -- 7.5 s with the window
stopped, since a project opens on the UI thread.

open_all reads every saved row at once: one walk per distinct file,
every row picked out of it, and the rows handed back in the order they
were saved in -- a subtitle is picked by its place in that list, so a
reordering would silently repoint what the user had picked. open now
delegates to it, which keeps the refusal wording in one place.
⚡ perf(playback): a seek costs the UI thread a thread spawn, not a demuxAhmet Kaan Gümüş · 74a068e
⚡ perf(playback): a seek costs the UI thread a thread spawn, not a demux

Playback opened every span's file on the caller's thread: 300 ms warm on a
25 GB film (measured), seconds off a cold cache, and a scrub paid it per
seek. `DecodeSession::open_worker_deferred` moves the demux onto the worker
-- there is no metadata to hand back on that path anyway, `start_span`
discarded it -- so the caller pays a `thread::spawn` and the picture arrives
when it arrives, which is what `try_frame`'s `None` has always meant.

The four callers that need the refusal at the door (the public `open`, a
session open, a project load, an import) keep the sync opener, so a file
this machine cannot decode is still named to the user where it is chosen.
A file that fails to open *at a span* drops its sender, and the
disconnected receiver walks the session on to the next span exactly as the
dead receiver installed here did.

Both openers now share one worker body (`decode_span`), so hardware
fallback, the codec refusal, the tone map's declared peak and the range
clamp cannot drift apart between them.

Measured on the film: seek returns in 52-68 us (was ~300 ms), first frame
380-620 ms later. The remaining wait is the container walk on the worker;
a per-source parsed-index cache is the follow-up, not this diff.
🐛 fix(project): the undo stack stops at 100 steps and an export clones the timeline, not the sessionAhmet Kaan Gümüş · 2504de7
🐛 fix(project): the undo stack stops at 100 steps and an export clones the timeline, not the session

snapshot() drops the oldest step at the cap: one gesture is one step, so 100 is
past any chain walked back by hand, and a 1394-clip jumpcut timeline's history is
a bounded ~10 MB instead of one that grows for as long as the session lasts.

export_to_with hands export::start a Project::export_snapshot() -- lanes and
sources with the history left behind. The clone is taken on the UI thread and an
export never walks the history back; the written bytes are unchanged.
✨ feat(tonemap): the HDR rendition is a row you pick, not a constant someone chose for youAhmet Kaan Gümüş · 09671f7
✨ feat(tonemap): the HDR rendition is a row you pick, not a constant someone chose for you

BT.2446 Method A's assumed mastering peak was a constant in the module: 400
cd/m^2, one exposure decided for everybody. It is a matter of taste, not of
correctness -- a reference rendition and a vivid one are both honest pictures of
the same film -- so it becomes a project setting with three renditions through
the very same curve, which is what keeps the hues right whichever is picked:

  Reference  1000 nits, chroma 1.0   the published conversion (diffuse white 166)
  Standard    400 nits, chroma 1.0   display-referred, as bright as a player
  Vivid       250 nits, chroma 1.10  brightest, and a tenth more colour

The chroma gain is a scale about 128 in the SDR codes, after the map and clamped
to the legal range: a grey stays exactly grey at any gain, and at 1.0 it is a
clamp the maths cannot reach, so the other two presets are byte for byte what
Method A produced. HLG's OOTF gain is guarded at black -- below a 1000 cd/m^2
peak the system gamma is under 1, and the 0 * inf that follows byte-cast to 0
and put a hole where black belongs.

The preset lives on the Project beside the limiter (a setting, not an undo step),
reaches the decode workers and the export through the same value, and is saved as
a `tonemap` line in edith 11 -- left out when it is the default, so a project
holding no HDR media is the bytes it was, and a v10 file loads as the reference
rendition, which is the only one it ever had. Picking one rebuilds the picture
under the playhead the way a resize does; an SDR project is unmoved.

The panel names it beside the resolution and the rate -- the third thing that is
the project's rather than the media's -- and a click opens the three renditions
with the one in force marked. No stroke: this is a list to look at.
✨ feat(colorspace): a file says which matrix and curve its numbers are in, and edith reads itAhmet Kaan Gümüş · 070ffe6
✨ feat(colorspace): a file says which matrix and curve its numbers are in, and edith reads it

Three tiers, per field: the container's own tags (Matroska `Colour`, mp4
`colr`), then the bitstream's (H.264/HEVC SPS VUI, AV1 `color_config`),
then the ffmpeg/mpv resolution rule -- 720 lines or taller is BT.709,
below it BT.601, limited either way. A code that says nothing, or says
something with no implementation here, falls to the next tier rather than
answering wrongly.

`VideoMeta` carries the answer; nothing consumes it yet. Everything still
renders through the hardcoded BT.601 it always did, which is the bug this
is the foundation for fixing.

The bit-level walks are where this can quietly go wrong: an SPS whose
scaling lists are counted wrongly lands the VUI read in the middle of a
coefficient. Both are measured -- H.264 and HEVC against hand-built
parameter sets (no encoder here writes SPS scaling lists), the rest
against fixtures tagged in the container, tagged only in the bitstream,
and tagged nowhere, plus the two real films: a 4K HDR remux that reads
BT.2020/PQ and a fully untagged 720p one that reads BT.709.
🐛 fix(timeline): a dropped row lands where the hand let it go, not after the last clipAhmet Kaan Gümüş · 0d1c2c1
🐛 fix(timeline): a dropped row lands where the hand let it go, not after the last clip

A library row dragged onto the open bed past the last clip was appended to
the end of the timeline wherever it was released: the ghost promised one
frame and the release committed another.

`Project::paste` clamped the frame it was asked for to `timeline_frames()`
-- the clipboard's rule ("put it here", never "here with black in front"),
imposed on every caller of the primitive. A drop names a place on the bed
and means it, and `Project::place` (the audio/further-lane half of the same
drop) already honoured one, so V1 was the odd lane out.

The clamp moves to the clipboard's own door, `PlaybackSession::paste_at`,
and the grouped branch of `place_stream_at` goes to `Project::paste`
directly with the frame the pointer named. Nothing else changes: a paste at
the playhead cannot be past the end anyway.

Pinned by `a_row_dropped_on_the_open_bed_lands_under_the_pointer`, which
walks the release's own chain -- `landing` as `place_frame` composes it,
the frame back through the rate as `insert_source` hands it over, and the
one engine door a row goes through -- and lands frame 300 where it used to
land 150.
🐛 fix(subs+eos): the plate reads the map the file is written from, and a knob past the end leaves the end aloneAhmet Kaan Gümüş · 2bee9c3
🐛 fix(subs+eos): the plate reads the map the file is written from, and a knob past the end leaves the end alone

The overlay and the timeline strip drew every subtitle track on the raw
timeline clock while the export carried an embedded track through the cuts
(export::timeline_cues), so a rippled timeline previewed one thing and wrote
another. Both now ask that one map through PlaybackSession::timeline_cues --
preview and file agree by construction, and a standalone .srt keeps the
timeline clock it always had.

And the end of stream: is_eos promised that "any edit after the end revives
the session", which a sound-only edit never did. The transport's own model
says it should not -- eos means the picture worker ran out, reseek_audio
starts no picture worker, and reviving on an EQ tweak would spend the Ended
state that makes the next press restart from the top. The doc now states that
rule and a test pins it.
✨ feat(export): the subtitles leave with the fileAhmet Kaan Gümüş · df92458
✨ feat(export): the subtitles leave with the file

A Matroska export now carries the picked subtitle track as S_TEXT/UTF8:
a TrackEntry beside the picture and the sound, and one BlockGroup per cue
— Block plus BlockDuration, because a SimpleBlock has nowhere to say when
a line goes away. Interleaved into the clusters as the AAC packets are,
so a player has the cue by the time it needs it.

The cues are put on the exported timeline first. A track that came out of
a media file is timed against that file, so it is carried through the
spans that still play it: a cue over a stretch that was cut out is gone,
one straddling the cut keeps the half that is still there, and everything
after a rippled delete moves back with the picture it belongs to. A
standalone .srt has no clip to hang on and no offset to shift by, so it
stays on the timeline's own clock — the one the overlay drew it at —
clipped to the exported length. A cue nothing clipped keeps its own
microseconds, so an untouched timeline exports the times the source
states, to the millisecond the file is written in.

An mp4 says so instead of pretending: tx3g is a different beast and
nothing here writes one, so the export card carries a Subtitles row that
reads "test_subs.srt → embedded", "mkv only — an mp4 carries none" or
"none" before the button is pressed.

Exports without a picked track are the files they always were: the track
entry and the blocks are written only when there is one.
✨ feat(rate): the project frame rate is a list to pick fromAhmet Kaan Gümüş · d2e25cc
✨ feat(rate): the project frame rate is a list to pick from

The panel could only ever read the rate out. Now it opens the rates the
way the resolution button opens the sizes -- 23.976 through 60 with the
media's own cycled in and the one in force marked -- and picking one
conforms the whole timeline to it.

PlaybackSession::set_frame_rate maps every frame number on every lane
through one Rate (Project::retime), so a take keeps its seconds, its
footage and its sync while being counted on the new grid; every source is
re-read through a Rate against it and an export comes out at it. The v9
fps line now governs a video-scaffolded project too, so a project cut at
24 reopens at 24 instead of at the media's 30 with every clip number
still counted in 24ths.
✨ feat(engine): an edit rebuilds what it dirtied, and nothing elseAhmet Kaan Gümüş · c2e62a3
✨ feat(engine): an edit rebuilds what it dirtied, and nothing else

Every param change went through one funnel -- edit() -> seek() -- which
flushed the audio ring, reopened every track, respawned the feeder and
rebuilt the video decoder. Dragging a colour slider therefore cut the
sound ~40 times across one gesture, and every restart re-anchored the
clock onto an empty ring, so the silence of the restart was counted as
timeline time: a permanent A/V offset, re-rolled by every edit made
while playing (the resolution-change desync).

Edits are classified by what they dirty now. A grade, a fit policy and
the project resolution rebuild the picture where it stands and never
touch a sample. An equalizer rebuilds the sound and never touches the
picture. A fader and the master ceiling rebuild nothing at all: they
live at the mix sum, so the running mixer picks them up between two
blocks (MixControls), and the limiter is retuned rather than restarted
so its delay line -- and the sample count the master clock is made of --
keeps running. Only a structural edit still reseeks both halves.

And a restart no longer costs an offset: the feeder stamps the device
position its first real sample was queued at, and the clock anchors
there instead of on the first poll after the seek, so the silence before
the content is never timeline time.

Also: a span whose source will not open no longer presents the old
channel's frames under the new mapping, and the feeder stops parking
10 ms on a ring that is merely waiting out a flush.
🔀 merge: origin/main into E1, and the Sound row becomes a choice listAhmet Kaan Gümüş · 3992bff
🔀 merge: origin/main into E1, and the Sound row becomes a choice list

Conflicts were the three the coordinator called: keymap's FIXED count
(union of my `b` and C5's 26, so 27), the tests' use-list in main.rs
(theirs plus AUDIO_KBPS, DEFAULT_AUDIO_KBPS, next_audio_kbps) and two
tests added at the same line of audio_export.rs (both kept).

Four rates is one more than a button may be clicked round, so the Sound
row opens C2's picker (`Pick::AudioRate` over `AUDIO_KBPS`, rows naming
what each rate buys) instead of stepping under the pointer. `b` still
steps, the way ctrl+r still steps the resolution the same list offers --
and a list open over the card is what the first stroke closes, so escape
cannot take the card out from under it.
🔀 merge(A5): main (b10235a) into the import-policy branchAhmet Kaan Gümüş · 685d4e6
🔀 merge(A5): main (b10235a) into the import-policy branch

Clean: A1's Track::open rework routes codecs (MkvAc3Track before symphonia)
and A5 handles absent tracks -- the two compose, and git merged them
without touching either. C1's main.rs churn moved the refusal test's
neighbourhood, not the test.
🔀 merge(A5): main (dfd4ffe) into the import-policy branchAhmet Kaan Gümüş · cbb0f62
🔀 merge(A5): main (dfd4ffe) into the import-policy branch

No conflicts: A6's waveform/demux work and the subtitle lane do not touch
the import gate.
🔀 merge(A5): main (de15818) into the import-policy branchAhmet Kaan Gümüş · d17f345
🔀 merge(A5): main (de15818) into the import-policy branch

The rate gate main landed (`Rate`) and this branch's codec gate removal
are the same function: `matches_timeline` keeps main's `Rate` return and
loses the codec equality, with the decoder probe in its place. The
refusal tests that named a rate or a silence now name the one thing
left -- one output device, one rate and one layout.
✨ feat(export): the sound has a bitrate you pick, in every file that codes oneAhmet Kaan Gümüş · 2169fb8
✨ feat(export): the sound has a bitrate you pick, in every file that codes one

The rate was 256 kbps in two places nobody could reach: the AAC a video
export re-encodes and the MP3 the audio row writes. Both now take
`ExportSettings::audio_kbps` -- 128, 192, 256 or 320 -- and `None` is
still 256, so an export nobody touched writes the bytes it always did.

The card grows a Sound row on `b`, cycling like the container row. It
dims with the reason where there is no rate to pick: no sound on the
timeline, a lossless format (WAV, FLAC code samples and not a rate), or
an AAC track that is copied packet for packet and carries its source's.
The MP3 quality refusal stopped claiming a fixed 256 kbps, since the
Sound row can now change it under the summary.

Probed rather than promised: an mp3's frame headers declare 128/256/320
as asked, and an mp4's AAC track measures within a fifth of the request.
✨ feat(engine): subtitles come in with the film or beside itAhmet Kaan Gümüş · f4b5fd8
✨ feat(engine): subtitles come in with the film or beside it

A subtitle track was a track this engine walked past: the Matroska track
walk kept video and audio and dropped type 0x11, and a `.srt` next to the
media was a file with no door. Now both arrive as the same thing -- a
list of timed cues -- and a project keeps them.

`subtitle`: the cue model plus the two ways in. Standalone `.srt`,
`.vtt` and `.ass`/`.ssa` go through `oxideav-subtitle` and `oxideav-ass`
rather than through a fresh parser here; an embedded track carries its
timing on the block and its text in it, so each codec is put back into
the shape its own parser reads -- which is what makes an embedded track
and the file it was muxed from come back as the same cues.

What cannot be read is refused by name and still listed: the four PGS
tracks of a BluRay remux are four rows saying they are pictures, not an
empty list and not a file that would not open. A `.srt` that has gone
missing since the save is the same story, and a re-save keeps its row.

`.edith` 10 writes `subtitle <track> <path>` -- the reference only, the
cues stay in the file they came from. v9 and every older dialect load as
the projects with no subtitles that they are.
🔀 merge(D1): origin/main into the transport state machineAhmet Kaan Gümüş · 33f72b4
🔀 merge(D1): origin/main into the transport state machine

Five conflicts, all in main.rs and all the same shape -- main moved the
transport's neighbours while this branch replaced what they read:

- toggle_or_restart: main's empty-timeline guard (nothing_to_play -> notice, and
  pause if it is playing) kept ahead of the state machine, since an empty
  timeline is Ended from its first black frame and would otherwise restart a
  clock against nothing.
- playhead(): main extracted the clamp into its own method; it now asks the
  transport instead of the deleted done flag.
- panel(): main's zoomed view, its resolution button, its "put a clip on a lane
  first" tooltip and its enablement rule all kept, reading state.is_playing().
- live_decode(position, playing) takes state.is_playing().
- close_session: the two flag resets are gone with the flags -- no session is
  Stopped.
- tests: both import lists folded, Transport and transport added.
✨ fix(transport): the clock stops where the timeline doesAhmet Kaan Gümüş · d93bb5f
✨ fix(transport): the clock stops where the timeline does

At EOF nothing stopped the clock: wall time took over and `now()` walked off
the end of the timeline for as long as the window stayed open (measured live:
a 5 s timeline recognised its end with the clock at 17.5 s under a slow
renderer). The playhead is what a cut, a paste, an insert and the analyser all
act at, so every one of them was aiming into empty space.

`PlaybackSession::halt_at_end` pauses and puts the clock on the out point --
where the timecode and the playhead have been showing it all along -- and
leaves end of stream set, so the transport still reads Ended and the next
press still restarts from the top.
✨ feat(import): mixed codecs and silent takes join the timelineAhmet Kaan Gümüş · 9bc3bd4
✨ feat(import): mixed codecs and silent takes join the timeline

The two refusals a user hits for no reason are gone: a file coded
differently opens its own decoder like every clip already does, and a
file with no audio track contributes silence over its span like a gap
already does.

What the codec gate was really protecting against stays, moved to the
one place that can answer it: import asks the file for a decoder, so a
machine without the VA-API plugin refuses an HEVC take by the decoder's
own name rather than playing black frames with the complaint on stderr.
Rate and layout stay refused -- there is no resampler.

Both audio paths now read a source with no track as the silence they
already synthesise for a hole: the worker plays it, the packet copy
writes it, so an mp4 export of a timeline with a silent take is as long
as the timeline and quiet where the take is.
✨ 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(timeline): a clip goes where you drop it, along its track or across themAhmet Kaan Gümüş · cdb0c4b
✨ feat(timeline): a clip goes where you drop it, along its track or across them

A clip dragged along its own lane now lands on the frame the pointer let it go
on, and a library row dropped on a lane goes in under the pointer instead of at
the playhead.

Project::move_to_lane becomes Project::move_clip(from, idx, to, start): the
whole group travels the same distance, each half on its own lane, and start is
clamped to the gap every member lands in -- a clip butts up against the take
next door instead of overwriting it, and the tightest member's wall wins. A drop
that changes neither lane nor frame is a click and costs no undo step.

The front-end reads the frame under the pointer through the same View the boxes
are drawn through, so it lands where it was let go at any zoom, less the offset
the hand grabbed the box at, and snaps to a neighbour edge or the playhead
within a few pixels.
🔀 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

✨ 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.
🔀 merge(T6): the last media leaves, and nothing assumes source 0 stayedAhmet Kaan Gümüş · 7e4ead7
🔀 merge(T6): the last media leaves, and nothing assumes source 0 stayed

Both sides kept: the library-removal slice (a project may name no file, the
audio reference is never a still, the clipboard follows its file down the
list, a silence edit drops the selection) and main's EQ audio export, image
left-trim, track removal, volume slider, hold-repeat and EQ spectrum.

The one textual conflict was the test import list; close_session now also
drops the gestures and caches those slices added.
Merge branch 'main' into worktree-agent-a46e3271de2d17ff3Ahmet Kaan Gümüş · 700a973
Merge branch 'main' into worktree-agent-a46e3271de2d17ff3

# Conflicts:
#	crates/app/src/keymap.rs
#	crates/app/src/main.rs
✨ feat(timeline): a jumpcut reaches as far as you tell it toAhmet Kaan Gümüş · 88fbed0
✨ feat(timeline): a jumpcut reaches as far as you tell it to

A ripple used to be the whole timeline's business. It is a choice now:
the card's first row says whether an apply reaches this take (its picture
and its sound), this track alone, or every track -- and a track nobody
named does not move, which is how a podcast track loses its silences
while the music under it stays where it was.

The engine takes an arbitrary set of lanes, not a kind or a range, so
what "selected" means stays the front-end's business. It refuses, by
name, a scope that would take one half of a take with it rather than
quietly widening to the other half: widening would edit a track the user
did not name, which is the surprise scoping exists to end. Naming the
take is a row, and detaching is the other answer -- the refusal says both.

The notice names what it reached: "5 SILENCES CUT on A1 — other tracks
untouched".
✨ feat(timeline): silences are cut out or played fast in one pressAhmet Kaan Gümüş · d4ac3fc
✨ feat(timeline): silences are cut out or played fast in one press

A scan of the selected clip's own sound (RMS dBFS over 20 ms windows, off
the decode path the waveform already takes) marks every silence on the
lane before anything moves; `enter` cuts them all out with a ripple, `f`
plays them at 4x with the room they no longer need closed behind them.
Either way it is one edit and one undo press, however many it found.

Four numbers, all keyboard-driven from the card: the threshold, the quiet
short enough to forgive, the padding kept either side of speech, and the
kept sliver short enough to swallow -- the last of which is what stops a
breath between two silences surviving as one-frame confetti.

`set_speed` does not ripple, so speed mode closes the gaps itself; a clip
on another lane lapping over a silence is refused by name, because the
lanes would shrink by different amounts. A source with no audio track at
all is refused by name too rather than read as one long silence.

Output is ordinary clips: `.edith` stays v8.
🐛 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.
🐛 fix(timeline): a pasted still never lands on the audio laneAhmet Kaan Gümüş · b586b85
🐛 fix(timeline): a pasted still never lands on the audio lane

`Project::paste` routed by `is_audio` alone, so a *copied* still clip --
the one door that does not go through `place_stream_at` -- was pasted as
a grouped take across `V1` and `A1`. The A1 half is a PNG the audio
worker demuxes: "file contains a box with a larger size than it", which
silences the whole session rather than that clip, and the save it writes
is one `open_project` then refuses by name. An `is_image` arm mirrors the
audio-only one.

Same-shape sweep of every clip-level door that routes by source kind:
- `Project::paste` (project.rs) -- this defect, fixed.
- `PlaybackSession::place_stream_at` -- already routed, image arm returns
  on the video lane before the audio fork.
- `PlaybackSession::open`/`open_project` -- both directions refused by
  name at load.
- `Project::move_to_lane` -- refuses a move across kinds, so no clip can
  cross by drag. Clean.
- `Project::place`, `split`, `regroup`, `lift`, `delete_in`, `trim` --
  the caller names the lane or the lane never changes. Clean, and the
  loader is the backstop for a hand-written file either way.
- `Player::insert_source` (app) -- guarded both ways already.

Falsification: with the `(_, true) => &[LaneKind::Video]` arm removed the
new test fails at the lane count (A1 1 -> 2), and with that assertion
lifted it fails on the WAV export with the demux error above -- the two
consequences the test names, both reachable.

Two doc corrections found with it: `Still::open` now says alpha is
dropped by `to_rgb8` (a transparent PNG lands opaque, with the blend as
the ponytail), and `first_audio_of` no longer implies an image-first
timeline accepts a later audio import -- it widens which source is
asked, not what "the timeline is silent" means.

tests: images 7/7 (new `pasting_a_copied_still_never_reaches_the_audio_lane`
asserts no A1 clip, no audio clip from a picture, the WAV export still
carries the sound, and the save reopens), engine lib 155, saveload 12,
audio_files 16, lanes 5 (serial), bin 56.
✨ 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.
🔀 merge(import): library-only import meets the library row menuAhmet Kaan Gümüş · b514187
🔀 merge(import): library-only import meets the library row menu

The row menu (C3) and the source lengths this branch made native meet in one
place: the card's Length line and its "plays in N clips" count now read the
engine's own `file_frames` and walk `session.lanes()`, since the app's
clips-derived length helper and its free `lane_clips` walker are gone.

Two tests assumed an import that places: `removing_a_source_takes_its_frame_
count_with_it` and `removing_a_row_is_refused_while_it_plays_and_takes_the_
row_away` both need a take on the timeline to have something to refuse, so
each drags its import onto the end first.

New coverage: the audio fork of `open_library` -- a song as the first import
into an empty window. Empty timeline over the 1920x1080@30 song canvas, the
row at its own 90 frames, not undoable, a file it never took in refused by
name, and the drag that follows plays it on A1 alone.
✨ feat(import): imported files land in the library, never on the timelineAhmet Kaan Gümüş · 5cb33d8
✨ feat(import): imported files land in the library, never on the timeline

An import is not a decision about where a file plays. It registers a source,
notes its native length and stops there; the timeline changes when the user
drags the row onto a lane.

- `PlaybackSession::import`/`import_audio` probe, check and register only,
  returning the source index. No clip, no reseek, and no undo step -- a
  library row changes nothing playable, so there is nothing for `z` to take
  back, and the notice no longer pretends otherwise.
- `PlaybackSession::file_frames` is the native length of a file this session
  has taken in, so a row that has never been placed is placeable at its full
  length. `place_stream_at` takes it from there instead of a `frames`
  argument, and the app drops the clips-derived guesser that returned 0 for a
  source with no clips.
- `PlaybackSession::open_library` is the first import into an empty window:
  the file's canvas, rate and clock over an empty timeline.
- Doors: the Import button, a file dropped on the window and every argv
  argument after the first fill the library. A file *named first* at launch is
  an open, not an import, and still becomes the timeline.
- Fixture + tests: a 25 fps H.264 file, refused by name at both video doors.