forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 3fc675351f2b4381bbb62e7fdff9d3e26a21603e

2026-08-12

⚡ fix(export): the sound of a feature film is measured in a minute, not in half an hourAhmet Kaan Gümüş · 3fc6753
⚡ fix(export): the sound of a feature film is measured in a minute, not in half an hour

An mkv export of a two-and-a-half-hour film wrote zero bytes for twenty-one
minutes and then failed its own test's ten-minute cap. All of it was the Opus
fidelity gate: `ruopus` is built here without its `spectrograms` feature, so its
inverse MDCT is an O(n²) DFT with a `sin_cos` per term and decodes at 0.2x real
time. Measured on a two-minute window of a real 4K film (the new
`export_audio_cost` example, and the three `export audio:` lines it reads):

    mix (E-AC-3 5.1 -> stereo)   0.7 s
    Opus encode (opus-rs)        0.3 s
    fidelity decode-back        24.2 s   <- 98.6% of the pass

So the gate now samples: twelve five-second windows spread across the track, a
warm-up per window because CELT predicts across frames, and the *worst* window
is the answer -- which is harsher than the old whole-track sum, where a ruined
minute averaged away against two good hours. What it looks for survives
sampling: OPUS_MAX_KBPS's cliff is a rate the encoder falls off, not a defect of
one bar of music. A window with no sound in it is skipped rather than scored
0.0, which is what a silent timeline used to score before falling back to AAC.

...and the export no longer decides what it is *after* paying for the sound:
CopyPlan is consulted first, so the line on screen says "copy" from the first
second, and the audio pass owns the head of the progress bar instead of leaving
it at zero for as long as it runs.

Beside them, for the card that has been predicting the wrong export in both
directions: `planned_seats` asks the export's own gates what it would open, and
`sync_points` hands a front-end the frames a cut may be placed on.

    cargo test -p engine --release --test video_copy -- --include-ignored
      7 passed in 157.6 s (was: failing the 600 s cap)
🐛 fix(engine): the codec stops replacing the whole program's allocatorAhmet Kaan Gümüş · c8f62cb
🐛 fix(engine): the codec stops replacing the whole program's allocator

`rusty_h264-common` declares `rusty_alloc` as the `#[global_allocator]` of
whatever links it, and its sibling decoder and encoder turn that feature on
from their own defaults -- so no downstream feature choice could decline it.
Sustained scrubbing churns decode-worker threads, and that allocator faulted
on both ends of a thread's life: on a new one's very first allocation, and
in `Heap::collect_inner` from the `thread_done` TSD destructor. Three cores.

`common` is vendored (the fifth, same idiom as the other four): the feature
stays declared so the sibling manifests still resolve, but it is empty and
the six-line declaration is gone. Not one line of codec code differs from
0.9.1 -- 360 decoded pictures across three fixtures still match ffmpeg's
`framemd5` exactly -- and the process gets glibc's malloc back.
🔀 fix(export): a copied picture names the sound it was really written withAhmet Kaan Gümüş · 64cb44f
🔀 fix(export): a copied picture names the sound it was really written with

The copy path and the Opus seat landed in the same function from two lanes and
published two different sentences. The encoder path already names the codec the
mix was *measured* to have taken; the copy path was still handing the card the
same prediction the card shows before an export starts -- so an mkv whose mix
fell back to AAC would have run under a line saying Opus, on precisely the
exports that are over in a few seconds.

Both branches now read the one flag `copy_audio` came back with. The check is
the seam itself: an untouched HEVC timeline (copied block for block) with a 5.1
Opus source folded onto its audio lane (encoded), asserting the published line
is "copy · Opus · SW encode (opus-rs)" and that the file carries A_OPUS and no
A_AAC.
📊 feat(bench): the decode/encode baseline, measured on real 4K filmsAhmet Kaan Gümüş · cb2833f
📊 feat(bench): the decode/encode baseline, measured on real 4K films

Nothing in this tree said how long an open, a seek, a scrub or an export
actually take on the files this editor is used on -- 5 to 30 GB HDR mkvs,
where a fixture's five seconds says nothing. Every later codec change is
supposed to be an improvement over *something*, and this is that something.

`examples/bench` measures one metric per process, on purpose: a decoder
that panics on its own thread must cost one row and not the run. It
reports medians of five with the min and max beside them, because on a
file this size the spread is the finding as often as the middle is.

  * `open`   -- `Demuxer::open`, cold and warm. Cold is the file's pages
                dropped with posix_fadvise(DONTNEED) on a fd of our own:
                no root, no drop_caches, nothing else evicted, and
                advisory -- so a cold number is the optimistic end of
                cold, and the header says so.
  * `seek`   -- first-frame latency at t=30/600/5400 s down the deferred
                opener, which is what every seek and clip boundary uses.
  * `scrub`  -- twenty steps waited for one by one, then twenty with no
                wait at all: the first is latency, the second is what a
                drag storm does to the thread count, which is the number
                the abandoned-worker problem is actually about.
  * `export` -- throughput over a fixed 60 s span, one encoder seat per
                run, video only so a sound track that refuses cannot take
                the picture's measurement with it. A run that outlasts its
                cap is cancelled and still reports a rate, marked CAPPED,
                rather than reporting nothing.

`scripts/bench.sh` drives the list and writes the TSV. Its one trap is
worth the line it costs: the plugin is looked for beside the running
executable and an example binary lives a directory below it, so without
LD_LIBRARY_PATH every seat silently reads "SW" -- measured on the small
control file as 23 ms versus 1359 ms for the same seek. The file list is
read from $BENCH_LIST outside the repo: what is measured is a personal
library, and its names are not this project's to record.
🔀 fix(ui): the cancelled import speaks through the notice queueAhmet Kaan Gümüş · d381b07
🔀 fix(ui): the cancelled import speaks through the notice queue

The import bar's Cancel and the notice *queue* were written in two lanes:
one added `cancel_import`, the other turned the single `notice` field into a
`VecDeque` behind `notify_user`. Assembled, the cancel was the one message in
the editor still writing the field directly -- which no longer exists. It goes
through the same door as everything else, so a cancel behind another message
queues rather than overwriting it.
🐛 fix(ui): a failed import says which file failedAhmet Kaan Gümüş · 555a273
🐛 fix(ui): a failed import says which file failed

Two files on argv that both fail read as "IMPORT FAILED: No such file or
directory (os error 2)" and "IMPORT FAILED: file contains a box with a larger
size than it" -- two messages, neither of them naming what they are about.
Harmless while the bar showed one message and lost the other; the moment the
queue shows both, an unnamed failure is a failure about nothing.
🐛 fix(ui): the library still lists what was imported at the 640x360 floorAhmet Kaan Gümüş · c003414
🐛 fix(ui): the library still lists what was imported at the 640x360 floor

Five stacked things in that column want 140 px and the floor gives the
region 136, so the one child allowed to shrink -- the media list -- was
shrunk to nothing: tabs, an Import button, a dimmed way to add at the
playhead, and no sign of the file that had just been imported. Found by
photographing the floor, not by reading the layout.

The list keeps a row's height at minimum and the column carries the
remainder on its own scroll, which is the answer the lanes and the inspector
already give. Everything in it stays reachable; nothing is clipped.
🎨 feat(ui): a second palette, named button groups, and one live accentAhmet Kaan Gümüş · 5a36eae
🎨 feat(ui): a second palette, named button groups, and one live accent

Three of the redesign's other answers, kept where they were better than what
this branch had.

The palette is two tables now, `cool` (default) and `warm`, in one file with
one role name list between them: `--features warm` swaps the family and no
call site knows it happened, and a role missing from either is a compile
error rather than a region that quietly kept the old colour. It is a compile
switch because every token is a `const` and a runtime palette is a lookup at
every paint -- the ceiling and the way past it are written where the tables
are. The warm family is held to the same measured floors as the cool one,
and that caught something on the way in: its picked-row surface put the
secondary ink at 4.09:1 where WCAG 1.4.3 wants 4.5, so the surface is darker
here than in the branch it came from.

The toolbar's buttons are three named groups -- Edit, Track, View -- because
a row of twelve unlabelled boxes is a row nobody reads twice, and three
labels are three things to skip.

Import is filled with the accent while the library is empty, which is the
one moment it is genuinely the primary action; Export, which wears the
accent the rest of the time, is dimmed until there is something to export.
So there is still exactly one live accent in the window -- which is the rule
that made Export the accented button in the first place -- and it is on the
thing the user has to press next. An accented button also keeps its accent
under the pointer now: hovering it to the chrome's grey read as the primary
action switching itself off.

And a glyph sits in a box of its own width rather than the width it happens
to draw: the pause bars are 12 px and the play triangle 11, so pressing Play
slid every button in the row one pixel to the left.
🐛 fix(ui): the tracks below the fold say so, and stop saying it once they are upAhmet Kaan Gümüş · 0e5864c
🐛 fix(ui): the tracks below the fold say so, and stop saying it once they are up

At the 640x360 floor the timeline takes its share of the window and the lane
column scrolls inside it, which is the right arrangement and an invisible
one: a third track behind a scroll is a track nobody knows exists. The lanes
carry a line now, in the one place the eye is already looking, and the
inspector carries the same line for the same reason -- at the floor its
project section is below the fold.

The line is live. A count of `total - shown` is true once and wrong from the
first notch of the wheel: it goes on insisting two tracks are below with the
last of them on screen, and an affordance nobody can make go away reads as a
bug rather than as an instruction. Both columns report where they have been
taken to (`track_scroll`), and the count is of what is *still* below --
`rows_below` for lanes, which are one height, and `px_below` for the
inspector's sections, which are not.

Whether the line is drawn at all is decided without the scroll, so it cannot
flicker in and out under the pointer that is scrolling it: it is there while
the column overflows, and it says "the last track" rather than vanishing.
Its own flex_none row under a flex_1 column, so the thing announcing the
overflow is never the thing the overflow pushes off the window.
✨ feat(ui): two failures in a row are two messages, in orderAhmet Kaan Gümüş · fc6f9b0
✨ feat(ui): two failures in a row are two messages, in order

The notice was a slot, so the second import to fail in the same frame was
the first one's grave: `self.notice = Some(..)` at seventy call sites, each
of them overwriting whatever had not been drawn yet. The user's own case --
two files on argv, both refused for different reasons -- showed exactly one
of them.

It is a queue now. `Player::notify_user` is the one door every message comes
through, so "queued rather than overwritten" is a property of the field
instead of seventy call sites remembering to be polite, and the policy it
enforces lives in `push_notice` where it can be read at once and tested
without a window: a repeat of what is already at the back is dropped (a held
key that refuses would otherwise fill the queue with one sentence), eight is
the ceiling, and the oldest goes first.

The bar says how many are behind it -- a queue nobody is told about is a
queue whose second message reads as the first one failing to go away -- and
any key or a click answers the front one and brings the next up. The tone is
read off the words the message already opens with and drawn as a stripe down
the leading edge: a full red bar at every refusal is an alarm, and most of
these are answers.

Escape is untouched: cancelling an export is hidden while nothing is
exporting, so answering a notice with escape cannot arm a refusal behind it.
✨ feat(ui): the floor, the notices and the silent refusalsAhmet Kaan Gümüş · 2c8e3aa
✨ feat(ui): the floor, the notices and the silent refusals

The transient bars hang off the bottom of the picture instead of taking a row
of the column -- a notice arriving used to push the transport, the toolbar and
the timeline down by its own height, which is every control below it moving
with state.

At 640x360 the timeline takes at most its share of the window and its lanes
scroll inside it, the library tabs wrap rather than hanging off the panel, and
the level's bar stands down while its button and its keys stay.

A class refusal (esc with nothing exporting) is silent; a state refusal speaks.
✨ feat(ui): library tabs, accent primary action, redesign guardsAhmet Kaan Gümüş · 2171351
✨ feat(ui): library tabs, accent primary action, redesign guards

Media/Audio/Text tabs over the media pool (the giants' split), the Export
button as the one accented control in the window, and three guards: no colour
outside the theme, no settings card drawn from the root, and a reserved rect
for every button whose label changes with its state.
✨ feat(ui): four regions, one oracle, one token tableAhmet Kaan Gümüş · 2ae5c26
✨ feat(ui): four regions, one oracle, one token table

Library left, picture centre with its own transport strip, inspector right,
timeline full width along the bottom with the edit toolbar directly above it
-- the arrangement Movavi and CapCut share. The settings cards are docked in
the inspector, so adjusting a clip no longer hides the clip.

Every button asks the one availability oracle, and so does act(): with no file
open the toolbar used to be dim and dead to the pointer while the very same
actions still fired from the keyboard. Snap, mute and the volume keys answer
with nothing open, in both doors, and everything else dims with the oracle's
own reason in its tooltip.

Clips are painted by kind (video blue, audio green, still teal, cues purple)
on a near-black ground with one cyan accent, and every stateful button keeps a
rect that does not change with its state.
♻️ refactor(ui): extract the UI out of main.rs into ui/ modulesAhmet Kaan Gümüş · d8bffff
♻️ refactor(ui): extract the UI out of main.rs into ui/ modules

The whole window was one 19,916-line file with one Render impl in it, which
is why every colour sweep so far lost to instance patches: there was no seam
to sweep. One module per region, and one theme module every paint reads a
token from -- no 0x literal survives outside it.
🚀 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.
✅ test(audio): the mkv seek landing is measured on a real film, not only the fixtureAhmet Kaan Gümüş · 1501d34
✅ test(audio): the mkv seek landing is measured on a real film, not only the fixture

P7 asked for a fix to a seek that lands ±1.5 s off in content on a
real-library AV1/Opus remux. It does not land off any more: `fix(audio): a
seek into a Matroska
lands on the second it asked for` (90e5ed2, four hours before this)
already reopens the reader and re-asks from far enough back to swallow the
cue table's overshoot. Measured here rather than taken on trust — the same
`seek_dump` example, correlated against ffmpeg's decode of the same window:

              600 s      610 s     3600 s
  before   +1.473 s   +3.394 s   +0.014 s
  after    -0.000 s   +0.000 s   -0.001 s

("before" is that commit's parent checked out over this tree, so both rows
are this machine, this file, this hour.)

What was missing is the guard. `audio_seek.rs` proved the rule on a 30 s
synthetic chirp with one cluster layout, and the failure it exists for was
found on a 5 GB film with a cue table — so the film is what the test now
seeks into, at 600, 610 and 3600 s, locating each landing by normalised
cross-correlation against ffmpeg (coarse over a decimated ±5 s window, then
refined at full rate) and holding it to 50 ms.

Verified to fail on the code it is about: with 90e5ed2's parent audio.rs in
place it reports "asked 600s, heard 601.473s -- +1.473s of sound against
picture" and passes on HEAD. Skipped, never falsely green, on a machine
without the film or without ffmpeg.
✨ 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(export): an edited Opus source leaves an mkv as OpusAhmet Kaan Gümüş · 76ede8e
🔊 feat(export): an edited Opus source leaves an mkv as Opus

Opus could be read here since `ruopus` landed and could not be written at
all, so every cut of an Opus film came out as AAC in a Matroska file: a
codec downgrade nobody asked for, paid on every edit. `opus-rs 0.1.26` is
the encoder half -- a pure-Rust port of libopus 1.6, BSD-3, no `build.rs`,
not one `.c` in the crate and no dependencies at all (checked, not read off
the README) -- and a Matroska export now writes `A_OPUS` with an `OpusHead`
in its `CodecPrivate`, `CodecDelay` and the codec's fixed 80 ms
`SeekPreRoll` beside it. An mp4 still says AAC and the mp4 writer now
refuses an Opus track by name rather than declaring `mp4a` over it.

Only where an *encode* was going to happen anyway. An untouched timeline
still copies its packets, bit for bit, into the same container: Opus is what
an edit costs, never what a passthrough costs.

The envelope is measured and it is narrow, which is the whole story of this
crate. On three one-second spans of a 5.1 Opus film, encoded here and
decoded with `ruopus` -- not the suspect, it reads ffmpeg's libopus at 256
kbps back at correlation 1.00000 -- the encoder is usable to 128 kbps
(0.937/0.989/0.994) and ruined by 136 (0.452/0.697/0.951), against libopus
at 0.997/0.998 on the same material. Pure-tone fixtures put that cliff at
165 kbps, so its edge moves with the content and no constant is safe on its
own: the cap is 128 kbps *and* every track is decoded again and correlated
with the mix before it is written. Below 0.95 the export writes AAC instead,
and the encoder line the export publishes says AAC, so the fallback is
visible rather than silent. Mono keeps AAC outright -- this encoder mis-codes
it at every rate asked for here -- and so does any timeline that is not
48 kHz, since Opus has one rate and resampling a whole timeline to reach it
is a bigger change to the sound than the codec is.

Two delays, both measured rather than hoped for. The pre-skip is 1080
samples: the encoder's 2.5 ms lookahead plus one warm-up frame, because a
cold first frame comes out ramped and out of phase (the head of the fixture
went 0.9788 -> 0.988 correlated once it was fed its own first 20 ms first),
and one silent frame is pushed in at the end so the last 2.5 ms leave the
encoder instead of ending the track short under a picture that is not.
ffmpeg's decode of the file agrees with this project's own reader sample for
sample, which is what says the header describes the stream.

`tests/opus_export.rs` exports a cut and reads it back through symphonia's
mkv reader and `ruopus` -- 0.9948 left and 0.9825 right against the source,
0.997/0.993 past the first frame -- proves the AAC copy still wins where it
applies and that a mono mix takes the AAC path, and, with `EDITH_OPUS_FILM`
pointing at a real-library Opus mkv, cuts a span out of the film itself:
correlation 0.9914 at a lag of one sample. The unit test in `export.rs` pins
the 256 kbps failure, so the day the crate fixes it this suite fails and the
cap can be raised.
✨ feat(export): an untouched Matroska timeline leaves as its own packetsAhmet Kaan Gümüş · ada6ac5
✨ feat(export): an untouched Matroska timeline leaves as its own packets

The picture's half of what `copy_audio` already did for the sound: where a
copy says exactly what the timeline says, the coded blocks of the source are
written straight into the file and no decoder or encoder is opened at all.

The gate is the audio one's doctrine, not a looser one -- Matroska in and
Matroska out, the source's codec is the one this format carries (HEVC for
`Format::Hevc`, AV1 for `Format::Av1`), and nothing has touched a sample: no
grade, no speed, no rate conversion, no gap to fill with black, no source of
another size, no `ContentEncodings` packing to undo. Every span must begin on
a sync point and end where the next begins, which is what placing a cut on a
keyframe gives it.

All or nothing per export, and that is the interesting constraint: a copied
span and an encoded one cannot share one track, because this project's
encoders write 8-bit SDR streams with parameter sets of their own and a
container states its configuration record once -- splicing them into a Main 10
HDR source would change bit depth and colour mid-track. So the head and tail
fragments of a cut that lands mid-GOP are not re-encoded into the copy; they
are what makes the whole export fall back to the encoder it always used.

A copy keeps its source's `Colour` as well as its `CodecPrivate`: an HDR film
copied is still the HDR film, because not one of its samples was touched. The
blocks are timed by their source's own timestamps (`MkvMuxer::write_block`)
rather than by a frame counter, without which a stream with B-frames -- stored
in decode order, timestamped in display order -- would play its groups of
pictures in the order they were coded in.

An open-GOP source writes leading pictures after a sync point that are shown
before it and reference the group before it; at the start of a copied region
those references are not in the file, so they are dropped rather than written
as pictures no decoder can put back together. The region still starts at the
timeline frame it owns, so the sound never drifts.

Measured on a real-library 4K x265 HDR Matroska of 2h30m (167671 pictures),
five minutes cut out of the middle on two sync points: the export takes 162 s
and writes 10.8 GB, against a re-encode of the same timeline measured at
0.94-1.75 pictures a second -- 25 to 47 hours for the same file. Every block
sampled either side of the join is its source's own bytes, the shown order is
one unbroken frame grid, and the pictures two seconds either side of the join
decode through this project's own decoder without an error.
🔍 chore(engine): what a Matroska sound track's open costs, as an exampleAhmet Kaan Gümüş · 1acf384
🔍 chore(engine): what a Matroska sound track's open costs, as an example

The picture's open has `mkv_open_cost` and the sound had nothing, which is the
half the sidecar index exists for -- Matroska indexes no audio samples, so a
sound track is walked whole every time it is opened. This is the number that
claim is made of, on files too big to keep as fixtures.
🐛 fix(decode): a seek lands on the frame it names in an open-GOP streamAhmet Kaan Gümüş · ea25339
🐛 fix(decode): a seek lands on the frame it names in an open-GOP stream

A picture's index everywhere above the demuxer is its rank in *display* order,
but both demuxers answered a seek with the position the sync point is *stored*
at. The two are the same number only while nothing is coded out of order -- and
an open-GOP HEVC stream, which is what x265 writes by default and so what every
film off a disc or a web rip is, stores the CRA that opens a GOP ahead of the
RASL leading pictures shown before it. In `test_hevc.mkv` the keyframe shown
30th is block 28, so scrubbing to frame 45 handed back frame 47, and to a
different frame again in a GOP carrying another number of leading pictures.
This is the film-scrub path for a 4K HEVC library.

`sync_display_order` ranks every sync point by the presentation time the
container states -- Matroska block timestamps, an mp4's `stts + ctts`
composition times -- and the seek picks and reports the keyframe at or before
the target *on screen*. The mp4 half is that and nothing else; a track with no
`ctts` box keeps the sample-id path it had, untouched.

The Matroska half has one more thing to say, because its blocks are a window
of ten seconds and a display rank is a statement about the whole film. The
`Cues` already carry that statement: a `CueTime` over the track's frame
duration is how many pictures are *shown* before that keyframe, counted by the
muxer over the file. So the window is ranked among itself by timestamp -- the
same function, the same rule -- and shifted onto the cue's own number, which
makes the two answers one answer. A file walked whole shifts by zero: its
window is the file.

Kept per window rather than per seek, so scrubbing a file that has no usable
cues -- the one case where the window is the whole walk -- ranks it once.

`the_cue_index_and_the_whole_walk_are_the_same_index` now states the claim in
display order too: the lazy window and the whole walk must name the same
picture, and it is the walk's own ranking that says which.
`hw_decode::seek_matches_linear_every_container` sweeps every fixture
container/codec pair at targets on, either side of and away from a keyframe,
plus frame 0 and the last one; it fails on the old code at `test_hevc.mkv`
frame 29.
⚡ perf(demux): the walk a Matroska file still needs is written down onceAhmet Kaan Gümüş · 8651b15
⚡ perf(demux): the walk a Matroska file still needs is written down once

The `Cues` path took the picture's open off the whole-cluster walk, but two
callers still pay it in full: a sound track, which Matroska indexes not at all
and which is walked on its own track number, and a picture whose index is
absent or caught lying. On a real 10.9 GB E-AC-3 film that is the first
contact with the file -- 9.7 s before a note is heard, and 298 ms every time
the session reopens it, which the editor does at every seek across a clip
boundary and once per export span.

That walk's answer is now written beside the user's other caches, in
`$XDG_CACHE_HOME/edith/mkvindex` (`~/.cache` where the desktop names none),
one file per track of every Matroska file walked, and read back instead of
re-walking.

Correctness first, speed second. A sidecar is valid for one file and nothing
else: its canonical path, its size, its modification time to the nanosecond,
the segment bounds and the track number are written into the record and
compared field by field on the way back. Format version in the magic, FNV-1a
over the payload, every field length-checked as it is read, nothing left over
at the end. Any mismatch at all -- absent, stale, damaged, another version, a
hash collision on the file name -- is a miss, which means the walk runs and
the file is rewritten. There is no path where a wrong index is believed.

Written atomically, temporary file then rename, so a reader sees a whole index
or none; a write that fails is a slow open rather than a failed one.

Hand-rolled little-endian records, no new dependency: a flat table of
fixed-width fields does not need a serializer, and this tree carries none.

The one thing the key does not cover is the code that filled it: a build whose
walk answers differently would believe every record written by the last one,
and only the magic's version byte stands there. It says so at the constant,
and it is bumped here for exactly that reason -- this tree's walk is not the
one the lane that first wrote this format had.
⚡ perf(demux): a Matroska file is read forward without rechecking its indexAhmet Kaan Gümüş · 8d969d0
⚡ perf(demux): a Matroska file is read forward without rechecking its index

Reading a cued file from end to end got slower than the whole-cluster walk it
replaced -- 4.8 s to 192.8 s on a 4.9 GB AV1 remux, and worse the longer the
film. The window of blocks grows by a cluster on every read and nothing
trimmed it, while both index checks scanned that window from the front: every
cue the walk had already passed was re-anchored per cluster, and every anchor
scanned to the far end of the window twice. Quadratic in the file's length, so
the numbers only looked fine on a fixture.

Each cue is now checked once. `checked` is how far that has got through the
cue list, and a cue the window jumped past is stepped over rather than
re-examined -- the cue a seek actually anchors on is checked by `jump` itself.
Both scans inside `anchor` are bounded by `REORDER`, which is what they were
describing all along: the block a cue names sits at its own index less
whatever was reordered across it, and only a cue that is not where it says it
is pays the full scan -- once, because that answer degrades to the whole walk.
The cue lookup a seek does is a binary search now, the list being sorted.

  4.9 GB AV1, 282024 blocks   walk 4810 ms -> 3927 ms   open 2654 ms -> 0.5 ms
  7.1 GB HEVC, 171432 blocks  walk 6393 ms -> 5821 ms   open 7326 ms -> 1.8 ms

against the whole-cluster walk this replaced, same access-unit hash on both
files and the same landing for every seek. Reading forward is now cheaper than
the walk instead of 40x it, and the open the cue index bought stays.

A read error while rebuilding the window is no longer dropped on the floor:
answering a seek off a window that belongs to another part of the file is a
landing nobody asked for, so the fallback is named -- the whole walk, the one
index that does not depend on the window.

`a_cue_that_lies_about_its_time_degrades_to_the_walk` is the other half: a real
fixture with one `CueTime` moved a tick, which is a well-formed index naming a
block that does not exist. The walk takes over where the read meets it, every
frame still comes back, and every seek lands where the honest file's does.
⚡ perf(demux): open a Matroska file off its Cues, not off every clusterAhmet Kaan Gümüş · 84ee43f
⚡ perf(demux): open a Matroska file off its Cues, not off every cluster

Opening a Matroska file walked the whole segment -- every cluster header
of every gigabyte -- because Matroska carries no sample table and the
frame count and the sync points had to come from somewhere. That is
seconds of disk per open, and an open happens on every seek, every clip
span and every export source, not once per file.

Matroska has an index of its own and nothing here read it: `Cues`, one
entry per keyframe, written at the far end of the segment and found
through the `SeekHead` in kilobytes. Now the open parses that, and the
clusters are walked only where a caller asks to read -- one cue interval
at a time, ten seconds of film.

Measured, cold (page cache dropped per file) and warm, on the library:

  file                       open cold      open warm     bytes read
  4.9 GB AV1 remux         4027 -> 26 ms   469 -> 0.6 ms  9.9 MB -> 99 KB
  12.1 GB 2160p HEVC       9508 -> 54 ms   958 -> 8.6 ms  13.2 MB -> 1.3 MB
  1.4 GB 720p H.264 (ep)    395 -> 1.8 ms   64 -> 0.2 ms  1.5 MB -> 20 KB

Same answers, not similar ones
- The frame count stays exact at open: the last cue's index plus the
  blocks after it, counted by walking from that cue to the end of the
  segment. No duration-times-rate estimate, nothing corrected under the
  UI later.
- A cue states a *timestamp*, and a stream with B-frames does not store
  its blocks in that order: `anchor` counts the blocks written after a
  cue and shown before it, which is the difference between the frames
  shown before it and its place in the file. Without that a 60-frame
  HEVC fixture reports 62 and every seek lands two frames late.
- `cues_agree` checks that arithmetic against the file's own blocks
  wherever a walk meets a cue. A file that disagrees -- variable rate,
  cue times naming no block -- falls back to the whole walk rather than
  seeking to the wrong frame. So do files with no `Cues` at all, and
  tracks with no `DefaultDuration` (nothing to turn a cue time into a
  frame number with).
- `probe_bitrate` completes the index first: it adds block lengths up
  and wants the file, so it pays the walk it always paid.
- The `Cues` element is read whole and parsed in memory. Element by
  element through the file, a 2160p film's ten thousand cue points cost
  a `pread` apiece: 118 ms of open against 8.6.

Checks
- `demux::tests::the_cue_index_and_the_whole_walk_are_the_same_index`:
  for all 20 Matroska fixtures, the cue index and the whole walk agree
  on the block list, the frame count, and where every frame of the file
  seeks to -- asserted per frame, forwards and backwards.
- `a_file_with_no_cues_is_the_walk_it_always_was`: a fixture with its
  `Cues` id and `SeekHead` pointer overwritten (no muxer here writes a
  file without an index) opens, counts and seeks identically.
- `examples/mkv_open_cost.rs`: open ms, bytes through the read syscalls,
  seek landings and a hash of every access unit. Run against the build
  before this change, the three library files above agree line for line
  on every landing and every hash.

Approach referenced from `matroska-demuxer 0.8.1` (hasenbanck), which
resolves a seek the same way; the parsing is this file's own EBML
reader, no dependency added.
⬆️ deps(h264): the software decoder now agrees with ffmpeg, picture for pictureAhmet Kaan Gümüş · 1d9b2f4
⬆️ deps(h264): the software decoder now agrees with ffmpeg, picture for picture

`rusty_h264` 0.8 was not bit-exact. Across a 1080p High and a 720p Main clip
-- 750 pictures, both with B-frames -- it reproduced ffmpeg's own decode
byte-for-byte on 26 of them and drifted on the other 724, worst case 69.8 dB
PSNR. That is invisible on a monitor and still wrong: it is the picture a
grade is measured on, the picture a still is exported from, and the picture a
software export re-encodes. 0.9.1 matches ffmpeg on all 750, which is the
property the manifest already demands of `ruopus` and `oxideav-ac3` and had
never actually checked here. Pinned exactly for the same reason they are.

It is faster by the same stroke: 247 Mpx/s against 171 decoding the 1080p
clip, 256 against 176 on the 720p one -- 1.44x, single-threaded, min of 20
interleaved rounds on a loaded box (a second binary built from the same 0.9.1
sources came within 1%, which is what the interleaving is for). Software
encode is a wash at 1.04x and 0.97x, so nothing about an export's speed
changes; what changes is what it encodes *from*.

The challenger measured against it, `rust_h264` 0.4.0 (MIT/Apache-2, pure
Rust, decode only), does not take the seat on either axis: 1.00x and 0.88x of
0.8's decode rate, so 0.69x of this crate's, and it is not bit-exact either --
256 of the same 750 pictures, worst 39.2 dB, and the mismatches are pixels
ffmpeg never emitted rather than a reordering. The gate wanted 1.25x and no
correctness regression; it returned neither.

`default-features = false` stays, and keeps the vendored openh264 SIMD kernels
(`asm`, `nasm` at build time) out of a build this project promises needs no
tools. It does not keep out `rusty_alloc`: the facade pulls its sub-crates with
their own defaults and `rusty_h264-common` installs that allocator process-wide
for the whole app. Nothing downstream can switch it off. Measured at 0.104 s
against glibc's 0.142 s on 2M mixed allocations, so it is a gift rather than a
tax -- but it is a gift nobody asked for, and the manifest now says so.
🐛 fix(decode): a tiled HEVC counts its entry points past a u8Ahmet Kaan Gümüş · 907dae0
🐛 fix(decode): a tiled HEVC counts its entry points past a u8

§7.4.7.1 bounds num_entry_point_offsets for a tiles-without-wavefront stream by
(num_tile_columns) * (num_tile_rows) - 1, and this parser accepts up to 20
columns by 22 rows -- 440, which it computed in u8 because both counts are u8.
Release wrapped it to 183, so a conformant stream's 184th entry point onward was
refused and the picture never arrived; a debug build panicked on the multiply.
Widened before the multiply, where the spec does the arithmetic.

Sibling of fbd4a24 (a real-library 4K wavefront HEVC HDR film's 33 entry points
in a [u32; 32]), found by sweeping that fix's own line pair for the same shape.
🔒 chore(privacy): the tests name a key, the machine names the fileAhmet Kaan Gümüş · a893c91
🔒 chore(privacy): the tests name a key, the machine names the file

Nothing in this tree says what is in anybody's library or where it lives.
The handful of tests that are worth nothing against a fixture -- a real
HDR10 grade, a header-stripped BluRay remux, a disc's PGS tracks -- asked
for absolute paths written into their source, and the comments around them
recorded which films the measurements were taken on.

Both go. `engine::real_library::film(key)` reads `real_library.toml` at the
workspace root, which is gitignored: three logical keys named for what the
file *is* (`hevc_4k_hdr`, `h264_dual_audio`, `hevc_4k_pgs`), mapped to
wherever that machine keeps them. A missing manifest, a missing key or a
missing file each say so on stderr and the test passes, which is the
existence gate every one of these already had, in one line instead of five.
`real_library.toml.example` documents the shape and what each key must be.

The comments keep the technical fact and lose the title: a peak of 1759
cd/m^2 is still 1759, the 37 BCP-47 elements are still 37, and the Opus
pre-skip is still measured against ffmpeg -- on "a real 5.1 Opus remux"
rather than on a named one. The synthetic paths in the app's unit tests
("/films/…") were never real and are now anonymous too.
✨ 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).
🐛 fix(audio): a seek into a Matroska lands on the second it asked forAhmet Kaan Gümüş · 702501a
🐛 fix(audio): a seek into a Matroska lands on the second it asked for

A film played 1.47 s further in than the timeline said after a scrub to
600 s, 3.39 s after one to 610 s -- sound against picture, the oldest
complaint in this project, and the Matroska half of the mp4 fps truncation
that was fixed once and never swept.

One symphonia mkv seek does not land where it is asked to. It goes through
the cue table and stops at the first frame at or *past* the cue's cluster:
asking for 599.83 s on a 2h+ AV1/Opus 5.1 mkv landed the
reader at 601.487 s, asking for 609.83 s at 613.407 s, and on the new 30 s
fixture asking for 25 s lands
at 29.987 s. Samples that far behind a reader cannot be reached by any
window rule downstream, so `emit` had nothing to trim and the film simply
played from the landing while the clock counted from the request.

So the landing is read back and an overshoot is asked again from far enough
before it to swallow the overshoot, and every attempt gets a *new reader* --
symphonia's mkv seek is reliable exactly once per reader: it hands out the
frames it had already queued (they arrive carrying the old block's
timestamp) and its element iterator does not recover, so a second seek on
one reader landed back at the file's first cluster, 0.094 s, whatever it was
asked for. That is a *clip* of a film, and at HEAD the second clip of a
two-clip timeline came out with no audio at all. Opening again costs 2 ms on
a 5 GB film.

Seeking to the beginning is now not seeking: that seek is how the first
167 ms of the same film went missing at open, and 2.35 s more of it at 27 s,
where the iterator left inside a cue's cluster ran on into the wrong one.

Two smaller things the trimming needed to be right at all. A packet's own
timestamp cannot carry the decode position: the frames of one laced block
all share the block's, so the position accumulates from the decoder's count
between blocks, which is what both mp4 readers here already do. And the
pre-skip comes off a landing timestamp, because an Opus track's blocks are
timestamped for the audible stream while the decoder hands its samples back
with the pre-skip still in front of them -- 6.5 ms, measured.

Measured against an ffmpeg decode of the same window, envelope correlation,
real files. A 2h+ AV1/Opus 5.1 mkv at
600/610/1200/5400/6000 s: +1.474/+3.393/+0.094/+0.073/+0.094 s before, ≤1 ms
after. An HEVC/AAC 5.1 mkv at 610 and 1200 s: +2.054/+1.856 before, 0.000
after. An H.264/AAC mkv and an AC-3 mp4 were already exact and stay exact --
the mp4 tables never had this to get wrong. A/V skew after a seek on the AV1
mkv: -0.007 s at 600 s, -0.005 s at 5400 s. The video path was measured at
the same four positions and lands on the requested frame.
🔊 feat(audio): an Opus film is heard, not refusedAhmet Kaan Gümüş · 699950a
🔊 feat(audio): an Opus film is heard, not refused

The refusal was the bug again. `is_audio` said "no opus, ac3 or dts, for
which no pure-Rust decoder exists" while symphonia's own mkv and ogg readers
have always mapped `A_OPUS` and `OpusHead` to `CODEC_ID_OPUS`: the containers
read the format, only the decoder was missing. Symphonia genuinely has none
at any version -- its feature list stops at vorbis and there is no
`symphonia-codec-opus` crate -- so the decoder is `ruopus`, pure Rust, MIT,
no dependencies of its own, and the film plays.

Which crate is not a coin toss. A 5.1 track is four elementary Opus streams
in one packet, all but the last self-delimited (RFC 6716 App. B).
`rusty-opus 0.9.1` -- the sibling of `rusty_aac`/`rusty_mp3` already here --
hands each self-delimited slice to a decoder that parses it as an ordinary
packet, so every stream but the last reads the length prefix as payload: it
was measured on a 5.1 Opus remux as full-scale noise at -13
dBFS over a passage where the film is silent, which is exactly the failure
that "the decoder returns samples" would have shipped. `ruopus` matches
ffmpeg's decode of the same file to a correlation of 1.00000 on all six
channels.

Two things that are Opus's alone: it is stored in Vorbis channel order
(FL, FC, FR, BL, BR, LFE) and the 5.1 fold reads the film order every other
decoder here hands back, so the frame is permuted before it folds; and its
encoder delay lives in the stream (`OpusHead`'s pre-skip, 312 samples) where
neither reader drops it, so that is this track's priming -- sample-exact
against ffmpeg afterwards, 6.5 ms late before.

`.opus` and `.mka` join `is_audio`, `unsupported` asks the other reader
before naming a codec (a refusal that fires on a track which decodes is the
same defect wearing the other face), and `capability_matrix` covers Opus per
container with DTS left as the one live refusal row.
🖱️ fix(ui): a menu offers what applies, fits the window, and nothing paints over itAhmet Kaan Gümüş · 8a2e813
🖱️ fix(ui): a menu offers what applies, fits the window, and nothing paints over it

A right-click on an audio clip listed a grade and a fit policy, and the one
row the user named -- "Detach the sound from the picture" -- read as a video
item on a waveform. Both menus take their rows from an oracle now and from
nothing else: `menu_items` filters the action registry through `enable`, and
`row_items` does the same for a library row through `row_enable`, so an item
cannot appear where it does not apply by being added to a list alone. The
detach is worded from neither half, because it takes the pair apart.

The clip menu was capped at twelve rows whatever the window, so a menu opened
low in a 720 px window put everything past the fit policy behind a scroll
nobody was told about. `menu_rows_h` gives the list the room the window has,
and the card is placed by the very height it is drawn to.

A tooltip already on screen when a menu opens stays on screen in gpui --
occluding the surface under it does not take it back (`div.rs`, its own TODO)
-- so the tip stands aside instead: one flag, read by every hover label in the
window. The scrims occlude as well, which is what stops a new one appearing.

The actions card was 320 px wide with labels that were not: "Remove the last
video track (it must be empty)" printed straight over the stroke beside it. It
is 480 now, its labels truncate rather than overprint, and the list scrolls
under a rule instead of against the search line.
🐛 fix(decode): a film's grain is synthesized into a surface of its ownAhmet Kaan Gümüş · c52b667
🐛 fix(decode): a film's grain is synthesized into a surface of its own

An AV1 frame with `apply_grain` set is *displayed* from a second surface:
the driver writes the reconstructed picture into the render target, which
later frames reference, and the grain-synthesized one into a target the
decoder has to hand it. The vendored backend handed it none -- it passed
`VA_INVALID_SURFACE` as `current_display_picture` while still asking, in
the very same buffer, for the grain -- and radeonsi refuses that picture
outright: `vaEndPicture` answers VA_STATUS_ERROR_INVALID_SURFACE.

That is what killed the only AV1 film in the library at frame 49, its
first picture with grain; 1337 of the first 1504 have it, so AV1 playback
on real media had never worked. Every fixture that said otherwise was
grainless, which is why `test_av1_grain.mkv` is now beside them and why
its test decodes all ninety frames and then asks whether the grain
actually reached the picture -- turning `apply_grain` off would make the
decode succeed too, and would silently strip the film of its texture.

A grainy picture costs two pool frames rather than one, so a sequence
whose header admits grain gets a pool of twice the size; one that does
not is left exactly as it was, as are H.264, HEVC and VP9, which have no
such surface and read back the reconstructed one as always.
🖱️ fix(ui): a card closes and a short clip is hittable without the keyboardAhmet Kaan Gümüş · 8e2a297
🖱️ fix(ui): a card closes and a short clip is hittable without the keyboard

Seven modal cards swallowed the press on their scrim, so esc was the only
way out of any of them -- the same "reachable by stroke alone" complaint,
said about the way out instead of the way in. The scrims now close the
card the way the menus already do (`close_card`, one list, read off
`modal` by the guard so a card added there cannot be born pointer-less),
and each card body swallows its own presses so a button never closes the
card under its own click. Every card says "a click away or esc closes".

And a clip box is drawn no narrower than HIT_MIN (`clip_width`): zoomed
far out a short take was worth a fraction of a pixel and could not be
selected, dragged or given a menu at all. The trim strips are still asked
of the clip's own width, so a padded box keeps all of itself as a body.
🐛 fix(demux): a codec's support is probed per container, not inferred from a neighbourAhmet Kaan Gümüş · 4f4dcb4
🐛 fix(demux): a codec's support is probed per container, not inferred from a neighbour

VP9 was decodable out of an mp4 and refused out of a .webm — `V_VP9` fell
through the Matroska track dispatch into `OtherVideo` and came back as
"V_VP9 video in a Matroska file is not supported", with the VA-API VP9
decoder wired in `engine-hw` the whole time. A browser-downloaded .mkv was one of those
files.

Both dispatches now read one table (`CODEC_IDS`), and the Matroska arm
matches on `Codec` with no wildcard, so a codec added to the enum fails
to compile until it has been routed rather than falling through to a
refusal. A cell that is deliberately absent is a row in `UNSUPPORTED`
with a reason, and the refusal quotes that reason instead of listing
what is supported and leaving the user to guess.

The mp4 video track comes out of `moov.traks` in file order, not a
`HashMap` walk of `Mp4Reader::tracks()`: a file with two video tracks
opened on a different picture from one run to the next, and a saved
.edith reopened on the other one. `audio::audio_track_ids` fixed the same
trap for sound; the naming half of `AudioSession::unsupported` had it too.

VP9 states its bit depth in no container record — an mkv `TrackEntry`
carries none and an mp4's `vpcC` is optional — so it is read off the
first keyframe's uncompressed header. Assumed 8-bit, a profile 2 stream
would decode into an NV12 pool and come back as garbage; 12-bit is
refused by name like 12-bit AV1 and HEVC.

The audio refusals said "AAC and AC-3 only" long after FLAC, MP3, Vorbis,
ALAC and PCM decoded out of a Matroska file. They name the real set now,
per container, because an mp4 video's sound never reaches symphonia and
reads fewer codecs than an mkv does.

tests/capability_matrix.rs holds all of it against real files.
🛡️ fix(ui): four defect classes made impossible instead of testedAhmet Kaan Gümüş · 5909fc9
🛡️ fix(ui): four defect classes made impossible instead of tested

The action list is one list now: a `macro_rules!` writes the enum and
`ActionId::ALL` from the same names, so a variant added with `ALL`
untouched -- which compiled, passed and dropped the action off the keys
card -- cannot be written any more.

The reachability guard reads `keymap::FIXED` too: every card-local
stroke names the element a pointer presses instead, or says in the type
(`Reach::Gesture`) that there is nothing to press. `g` and `r` on the
export card were keyboard-only while the card advertised them, and are
rows of their own now.

Trim strips are suppressed under three handles of clip: a jumpcut's
short clips were 100% handle, so nothing could select or drag them.

The codec row's chord comes off `FORMATS` (it said six keys for the
seven codecs its label named -- OGG's `o` was invisible), and the panel's
button row carries a pinned door beside the scrolling part, since "it
scrolls" is not "it can be found" at the 640x360 floor.
⚡ 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).
🐛 fix(decode): a 4K wavefront HEVC is 33 entry points, not 32Ahmet Kaan Gümüş · 65ea910
🐛 fix(decode): a 4K wavefront HEVC is 33 entry points, not 32

A 4K wavefront HEVC film (3840x2160, CTB 64,
entropy_coding_sync) writes num_entry_point_offsets = 33 in every slice
header -- exactly
PicHeightInCtbsY - 1, which is what ITU-T H.265 §7.4.7.1 allows -- and the
vendored parser kept them in a [u32; 32]. The 33rd panicked, the plugin edge
caught it, and the user got a black picture and an instant eof.

The list is now sized by the stream. Same shape swept through the rest of the
h265 parser, where a parsed count could outrun a fixed array: tile columns/rows
(the CTB grid allows far more than the 19/21 the VA-API picture parameter
holds), the long-term ref pic block, and sps/vps_max_sub_layers_minus1, which
u(3) can read as 7 into 7-long arrays. Those refuse by name instead.

And the door now asks the plugin for one picture before it lets a file in: a
session that opens and then decodes nothing was the black screen with no
explanation, so it is refused in its own words rather than in the missing-plugin
ones.

2026-08-11

⚡ perf(launch): the window is up before the film is read, and says which filmAhmet Kaan Gümüş · 544d97b
⚡ perf(launch): the window is up before the film is read, and says which film

`edith <25 GB film>` on a cold cache showed nothing at all for twelve
seconds: the window was only created after argv[1] had been opened, and a
window that does not exist cannot say what it is waiting for.

argv is now sorted, not read: every file it names -- the first one included
-- goes into the queue a drop uses, and the window comes up empty in 47 ms
with the file's name in the title and an OPENING line under the panel
naming the read that is running. The first file is the one queued file that
is not an import, so its worker *opens* it outright and hands the session
over whole (`open_ahead` -> `Landed::Media`/`Project` -> `install_media`/
`install_project`), which is also what keeps a warm launch paying for one
header walk instead of two. Everything derived from the file -- canvas, fps,
title, export and save paths, subtitle tracks -- is set where it always was,
one repaint later; a refused file now says OPEN FAILED in the notice bar
instead of exiting before the window.

Measured (harness, timestamped sway-IPC + app log): cold 29.6 GB remux,
exec -> window 12.95 s / 18.73 s -> 0.047 s, exec -> timeline unchanged
(12.9 s -> 12.8 s); warm 2.9 GB film, window 0.73 s -> 0.048 s, timeline
0.68 s -> 0.71 s. The window resizes and repaints throughout the read.
⚡ 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.
🩹 fix(test): the subtitle round-trip reads the version the writer writesAhmet Kaan Gümüş · c109992
🩹 fix(test): the subtitle round-trip reads the version the writer writes

The tone-map preset bumped .edith to v11; this assertion still named
v10 and went red on main.
Merge branch 'worktree-agent-ad755bbe2a8af9c0c'Ahmet Kaan Gümüş · 610e3b6
Merge branch 'worktree-agent-ad755bbe2a8af9c0c'

# Conflicts:
#	crates/app/src/main.rs
⚡ perf(silence): the card is up on the next frame and reads the film behind itAhmet Kaan Gümüş · a2e4154
⚡ perf(silence): the card is up on the next frame and reads the film behind it

Pressing Silence decoded the whole audio track on the render thread -- 51 s
of dead window on a 25 GB film, with the card marked open and nothing drawn.
The decode is a worker now: the card paints at once and says where the read
has got to, out of what the header claims the track is, with the import
line's two clocks and its stall wording when the mark stops moving.

Closing the card, or opening it on another source, cancels the read at its
next chunk; a cancelled scan is never cached, since half a track is not an
answer. The levels cache is keyed per source and stream instead of holding
the last one only, so two films on a timeline stop paying each other's
decode -- A, B, A again is one decode of A.

What a scan finds is unchanged: 1393 silences at the shipped defaults on the
same film, and the nudges after it lands are the arithmetic they always were.
⚡ 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.
⚡ perf(color): a slider drag pays for the frames it shows, not for every step it crossesAhmet Kaan Gümüş · e4b04bf
⚡ perf(color): a slider drag pays for the frames it shows, not for every step it crosses

Colour and speed drags wrote a live grade per snapped step, and each write
reopens the decoder: on a big film that is 550-750 ms a step, so a bar-wide
sweep froze the window for the sum of forty of them. Samples crossed while the
worker still owes a frame are now held instead of written, and the frame that
lands writes the last one -- the gate is delivered work, never a timer. The
press still takes the undo step and the release still lands exactly where the
hand let go. A seek that stands past two seconds says so in the import bar's
words rather than looking like a hang.
🐛 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.