forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on dadd2f4b8755ea49091a4d4d2e2502b686ce9926

2026-08-13

✨ feat(export): the custom bitrate reaches fifty, and the wheel takes it thereAhmet Kaan Gümüş · dadd2f4
✨ feat(export): the custom bitrate reaches fifty, and the wheel takes it there

The ceiling was twenty, which was never an encoder's limit: it was the top
of the range the exporter *derives* an automatic bitrate in, borrowed as the
cap on a number a person typed. An asked-for rate has its own ceiling now
(MAX_EXPLICIT_BITRATE), and the card offers all of it.

And a range fifty wide is not a range a stepper walks: the wheel over the
custom row moves it, one step a notch, up for more -- the gesture the
timeline already zooms and scrolls with. It moves the field while one is
open, exactly as the arrows do, so the two ways in never disagree about
which number is being changed. Hold-to-run stays the keyboard's, as it is
on every other card here.
🐛 fix(export): the decode thread says how it ended, and is waited forAhmet Kaan Gümüş · ba88e8f
🐛 fix(export): the decode thread says how it ended, and is waited for

Two hazards the thread brought in, neither of which the serial decoder had.

A panicked decode thread dropped its sender saying nothing, and a shut channel
read as end of stream: the span ended "because the source ran out", the export
wrote what it had and reported success. A truncated file that says it finished
is the one outcome an export must never have, and before the decode moved onto
a thread the same panic took the whole export down. So the thread now states
every ending down the channel -- a picture, an error, or the `Ok(None)` that is
end of stream -- and a channel that shuts without one of them is the failure it
is. A source genuinely shorter than the clip that names it still ends its span
gracefully, and asking again after that stays end of stream rather than turning
into a disconnect.

And the thread was never joined. `decode::Worker` states why it must be: one
abandoned inside `vaInitialize` outlives the process, and Mesa's `atexit`
handlers free the state it is still reading -- a SIGSEGV at exit, long after
the export succeeded. The handle is kept and joined on drop, after the receiver
beside it, which is the field order `decode::FrameStream` is written in: the
disconnect is the only thing that wakes a decoder parked in a full send, so
joining first would wait for a consumer that is never coming.

Throughput is where it was (93.3 fps on a 1080p minute, hardware encode) and
the round-trips hold on both seats.
⚡ perf(export): the decoder stops waiting for the encoderAhmet Kaan Gümüş · b728a45
⚡ perf(export): the decoder stops waiting for the encoder

An export decoded a picture, encoded it, decoded the next: two engines taking
turns, each idle while the other worked. The decode now runs on a thread of its
own and hands pictures over a channel two deep, so the encode of picture n
overlaps the decode of picture n + 1 -- and the bound is what keeps it honest,
since a decoder that ran ahead without one would hold a film's worth of 3 MB
pictures.

The thread is also where the plugin is opened: a VA-API session is not ours to
pass between threads, so the open happens there and its failure comes back down
the channel, which is why a vanished source and a codec with no decoder still
fail the export rather than looking like a clip that ran out.

A 1080p h264 minute exports at 93.3 fps against 73.4 (hardware encode) and
18.3 against 17.5 (software, where the encoder is the wall). The written file
is the same one: 1438 frames for the 60 s span, 59.977 s at 24000/1001, zero
errors decoding it back, and the round-trip tests hold on both seats.
⚡ perf(waveform): a film's envelope is read by several handsAhmet Kaan Gümüş · 50e3988
⚡ perf(waveform): a film's envelope is read by several hands

Importing a source decodes its whole audio track for the lane's waveform, and
on a film that is the longest thing an import waits for: 22.7 s of one core for
a 2 h 39 m 5.1 E-AC-3 mkv, 3.8 s for a 2 h stereo AAC mp4. It is linear in
length and nothing about it was parallel, though `open_multi_streams` has
always taken a window per call and seeked to it.

So a source long enough to pay for the extra opens is cut into windows -- one
per minute, capped at the machine's cores and at eight -- decoded side by side
and stitched. The first window is the session that was opened to learn the
length, so a split costs `jobs - 1` opens and not `jobs`. Joining is safe
because the fold is min/max into absolutely-numbered buckets: the chunk that
straddles a joint is folded into both windows and cannot be double-counted.

The 2 h 39 m mkv's 22.7 s becomes 4.6 s and the 2 h mp4's 3.8 s becomes 1.2 s,
bucket count identical either way. A clip under two minutes is read exactly as
it was, on the calling thread. `bench waveform <file>` is the metric.
🐛 fix(decode): a seek into an open GOP is hardware's to finishAhmet Kaan Gümüş · 7652ada
🐛 fix(decode): a seek into an open GOP is hardware's to finish

A Blu-ray remux codes its GOPs open: the I picture that opens one is stored
ahead of the leading pictures that are *shown* before it, and those reference
the GOP before. Restart decoding at that random access point -- which is what
every seek, scrub and clip boundary does -- and the leading pictures have
references nobody decoded, so the plugin failed its first frame, playback fell
back to `rusty_h264`, and that decoder died on the file's I_PCM macroblocks.
Seventeen of twenty scrub steps on a 5.27 GB AVC remux ended with no picture
at all, and the three that survived cost 482 ms each in software.

The pictures are not ours to show, so they are dropped and the decode walks on
(bounded by `LEADING_LIMIT`, and only for a session that was positioned
somewhere other than the file's own start). The refusal that the tolerance
would otherwise swallow is kept at both ends: a stream read from frame 0 is
still refused the moment its first picture will not decode, and the plugin
probe now counts an immediate end of stream as a refusal rather than a pass --
a session that hands back no picture is the black-frame-and-instant-eof the
probe exists to catch.

The vendored H.264 decoder's own refusal goes with it: it failed a `frame_num`
gap outright unless the stream declared gaps allowed, which is exactly the
wrong reading here -- the gap is the editor's, made by starting in the middle
of a film, and §8.2.5.2's non-existing frames are what stands in for it. The
loop that builds them was already there, behind that flag.

Twenty of twenty scrub steps on the remux now decode in hardware, 77 ms
median against 482 ms; `seek_matches_linear_every_container` holds for every
container, and `dump_frame <file> <n> <out> seek` is what a picture reached by
a seek can be compared with the same picture reached by decoding from the
start.
🐛 fix(playback): a paused picture holds still, and a late one catches upAhmet Kaan Gümüş · 084f02d
🐛 fix(playback): a paused picture holds still, and a late one catches up

Two halves of the same seam: the picture was paced by "the newest frame not
later than the clock", and nothing said what to do when the decoder was
behind that clock.

Paused, the clock is frozen but the decoder is still handing over the
backlog it was behind by, and `pump` ran on every repaint -- so a pointer
moved over the timeline walked the picture on, one frame per redraw, after
the sound had already stopped. Frames are now taken only while the clock
runs, or when a seek owes the screen its landing (a scrub is paused by
definition); a repaint re-presents what is already there. Gated at the one
place a frame reaches the screen, not in the handlers that repaint: a
hover, a notice, a resize and a vsync are the same event to it.

Playing, a decoder that cannot keep up never got back on its own -- it
hands over every frame in order, whether or not its moment has passed, so
the gap only grew and the picture drifted seconds behind what was heard.
Past 0.4 s late the backlog is abandoned and the picture restarted at the
clock (`PlaybackSession::resync_picture`), which touches neither the sound
nor the clock, no more than once every 2 s.

Measured, 2560x1440 H.264 with software decode forced: paused and wiggling
the pointer over the timeline for 3.6 s, the picture was four different
frames before and one pixel-identical frame after. Playing the same file,
the offset stayed inside 3.3 s with a restart every 2 s instead of growing
without bound; with the hardware decoder, which keeps up, no restart fires
at all.
✨ feat(silence): the scan reads the clip that was asked about, not the film it came fromAhmet Kaan Gümüş · dec2ced
✨ feat(silence): the scan reads the clip that was asked about, not the film it came from

A take cut in half was still decoding the whole source and then throwing
most of the answer away: the levels were read from media time 0 to the
end of the file, and only `timeline_regions` remembered the clip had a
range at all. Now the range *is* the read.

`silence::levels` takes the half-open source seconds to scan and hands
back windows counted from its own start; `timeline_regions` lands those
at `in_frame` plus that and trims to `out_frame`. The card names a scan
by source, stream **and** the clip's frames (`ScanKey`), so a trimmed
clip is a read of its own and a re-trim is not answered from the cache.

Half a take is half a wait, and what it finds is what is still on the
timeline.
✨ feat(timeline): the subtitle strip answers the wheel like the lanesAhmet Kaan Gümüş · 0e324ec
✨ feat(timeline): the subtitle strip answers the wheel like the lanes

The strip under the tracks is drawn on the same bed, through the same
Scale, and a cue is exactly what a hand aims at when it wants to see a
line closer -- so it took the same wheel the ruler and the beds already
take: ctrl magnifies about the pointer, a bare notch slides the view
along. It ignored both until now, a dead surface in the middle of a live
panel.

Nothing occludes inside it -- the cue boxes and the playhead are plain
paint -- so the bed's own listener is the whole of it.
✨ feat(ui): six more families, three of them ones people already live inAhmet Kaan Gümüş · 8a5f18b
✨ feat(ui): six more families, three of them ones people already live in

Ocean, Ice and Orchid are this set's own -- a blue-black ground under azure,
a near-black blue with the widest ink range here under a pale ice accent, and
a dark plum under orchid, which is the warm end of the purples where `violet`
is the cold one.

Nord, Gruvbox dark and Dracula are the open palettes (all MIT, credited on
their modules) mapped onto the thirty-six roles rather than approximated:
surfaces and ink are their own numbers wherever they clear the floors this
editor already holds every family to. What is adapted is named in place --
those three are *text* palettes and this one draws a name and a waveform on
every clip body, so Aurora's green under white is 2.6:1 and the four kinds are
those hues taken down until WCAG 1.4.3 holds. Nord's own picked row carries
the dim ink at 2.9:1, Dracula's comment blue at 2.4:1, and gruvbox's selection
is a grey that says nothing about which row is picked.

Two more forced by the guards rather than by taste: a playhead crosses every
clip body it passes, so Nord's obvious orange (2.3:1 on a video clip) gives way
to nord13 yellow, and gruvbox's playhead is the bright green -- the one hue of
that set clearing 3:1 on all four bodies at once.

The picker holds twelve rows whole at the 640x360 floor (300 px of a 360 px
window) and has room for fourteen, so its scroll stays a safety net. The test
says which: the day a family makes it fail, the card owes the affordance line
the inspector and the cards carry, because a row nobody knows is under the
fold is a row that is not there.
✨ feat(timeline): the wheel zooms and scrolls where the clips areAhmet Kaan Gümüş · a02176e
✨ feat(timeline): the wheel zooms and scrolls where the clips are

Ctrl+wheel anywhere over the timeline -- a lane's bed, a clip's trim
strip, the ruler -- magnifies about the pointer, and a bare wheel slides
the view along it: the mapping every editor shares, on the surface a hand
is already aiming at. Only the 24 px ruler strip answered the wheel
before, and only with ctrl.

Three things had to be true for it to work at all:

- A bare notch is a tenth of what is on the bed (SCROLL_NOTCH_SHARE), so
  one gesture moves the same share of a five second import and of a film;
  View::scrolled clamps it against the content's own length.
- The follow no longer fires on a playhead nobody moved: a view yanked
  back every frame is a hand's own scroll undone before it is seen.
- gpui stops its hit test at an occluder, so the trim strips at a clip's
  ends took the wheel off the bed with them -- a dead strip exactly where
  a hand aims to see a cut closer. They answer with the same call now, and
  the lane column keeps the track names as its own scroll surface.

The keys and the buttons zoom exactly as they did.
✨ feat(subtitles): a file's subtitles come onto the timeline that is openAhmet Kaan Gümüş · e17cd0a
✨ feat(subtitles): a file's subtitles come onto the timeline that is open

Importing only the subtitles from a file should not mean reimporting
the whole media or breaking the timeline. The engine could already do exactly that -- the walk
reads a container's subtitle tracks and pushes them onto the timeline's
own list, and subtitles are on no lane -- but the only doors to it were
a toolbar glyph and a stroke, while the panel where the tracks are
listed offered a media import. So the capability was there and the door
was not, which is the same thing as not having it.

The Text tab's own button is now that door: "Add subtitles from a
file…", the action itself (so the button, the stroke and the actions
card cannot drift), oracle-gated like every other action button, and
accented while the tab has nothing on it -- the primary action of the
tab it is in. The tab's empty line names the button rather than
pointing at a toolbar. At the 640x360 floor the column is 128 px and a
centred label wider than its button is clipped at both ends, so the
button says the short form there and the full name stays in the
tooltip, the card and the stroke.

Whatever the file is: a release's `.mkv`, an `.mp4`, an `.srt` beside
it. The media itself joins nothing -- no library row, no lane, no clip,
nothing on the edit list moves -- and the same file twice is the same
tracks, not two of each.

A file the walk found no subtitle track in is now refused as that, in
words, naming the file. It used to answer "0 tracks added", which is
the sentence a file whose tracks are already on the timeline gets --
two opposite answers wearing one string. The line is drawn once
(`PlaybackSession::no_subtitles_in`) and used by both the engine's own
door and the front-end's split walk-then-push, and the claim is only
ever made after the walk actually looked. A plain media *open* is
untouched: nothing is said there about a file with no subtitles,
because nobody asked.
✨ feat(ui): four more palettes, on the same measured floorsAhmet Kaan Gümüş · 3c6b5d9
✨ feat(ui): four more palettes, on the same measured floors

The set grows to six: forest (green ground,
emerald), violet (indigo ground, lavender), rose (neutral ground, one
rose accent and no other hue), amber (graphite ground, gold). Cool and
warm are untouched.

All six are dark on purpose. Colour work is judged against its
surround, and a light ground pushes every clip body and every graded
frame the wrong way, which is why no editor of this kind ships one.

None of them is picked by eye alone. The contrast guards already ran
over `PaletteId::ALL`, and the two tint guards do now as well -- four
swatches tuned on one ground are exactly where a pair lands inside the
margin on another. Every family clears the same floors the first two
did: dim ink at 4.5:1 on its own raised surface and on a picked row,
both inks on every clip body, the playhead 3:1 against the bed and
against a video clip. Where a family could not clear one, the colour
moved rather than the threshold -- forest's audio clip went darker,
amber's picked row went to a bronze, and amber's focus ring went sky
because gold is that family's accent and the keyboard's ring may never
be mistaken for it.
⏪ revert(subtitles): the removal bin goes, the way back is the file's own doorAhmet Kaan Gümüş · bbe4e40
⏪ revert(subtitles): the removal bin goes, the way back is the file's own door

The recovery bin was the wrong answer to the right complaint. What a
person wants after removing a row is not that row back out of a session
cupboard -- it is a way to put *any* file's subtitles on a timeline
without importing the file, which is the door the next commit is about
and which brings the removed one back as a side effect.

So `Project` keeps no bin: a removal removes, as it did before, and the
row's × and the notice now name the add-subtitles stroke as the way
back rather than "import the file again". That old sentence does not
come back: the file itself never has to be imported for its subtitles.

The engine and app halves both go (b13bd53 here, and the app half that
rode into 4420513 while two lanes shared one worktree).
✨ feat(subtitles): a removed track is one click from being backAhmet Kaan Gümüş · f41b4c6
✨ feat(subtitles): a removed track is one click from being back

Removing a subtitle row dropped the whole track -- cues and all -- and
the only way back was importing the file again, which on a big remux is
a walk of the whole container for something the session had in hand a
second ago. "Bringing back the removed subtitle needs reimport is very
nonsense", and it is: a removal is the one edit here whose inverse cost
more than the edit.

The removal is now non-destructive at the model. `Project` keeps what it
took off in a bin beside the list (`removed_subtitles`), and
`restore_subtitles` puts one back with the cues it left with -- no file
is read, so a row comes back even when its file has gone missing since.
The bin is the session's, not the project's: a `.edith` still writes what
the timeline has, exactly as it did.

The door is the row the removal leaves behind, under the list and dimmed,
with a `+` where the × was: the way off the timeline and the way back on
are one shape in one place. The list is drawn while either half of it has
rows, so removing the last track is exactly when the way back is on
screen rather than the moment the section disappears.

The audio side of the same class was already reversible: a lane removal
is a history snapshot and z restores it. A library row is not, by the
decision recorded in `Project::remove_source`, and is left alone.

The app half of this slice (`Player::restore_subtitle_track`, the notice
and its test) is in 4420513: the theme work committed the whole tree
while both were in flight.
✨ feat(ui): the palette is picked in the window, not at the buildAhmet Kaan Gümüş · 4ddba0c
✨ feat(ui): the palette is picked in the window, not at the build

The two colour families were a cargo feature (`--features warm`), which
makes the choice one only whoever compiled the binary could make. Both
are now `Palette` values behind one relaxed load: a token is a call
(`BG_PANEL()`) that reads a field off a 'static table, so a swap
repaints the whole window with no restart and no lookup by name.

The door is a list, not a toggle -- Theme sits in the toolbar's View
group beside Snap, and opens the same picker the resolution and the
HDR rendition already use, so a third palette costs one line in
`PaletteId::ALL` and nothing anywhere else. The stroke is ctrl+h, the
row is in the actions card, and the list now answers the keyboard as
well as the pointer: up, down, enter, escape, on every picker in the
editor rather than only this one.

The pick is kept in ~/.config/edith/theme, beside the keybindings and
under the same XDG rule, so it survives a restart; a file that cannot
be written is said out loud. The contrast guards run against every
palette in the table now instead of the one that used to be compiled,
which is what makes a palette added later land gated.
🧪 test(audio): the two real-file cases come off the manifestAhmet Kaan Gümüş · 455e3a6
🧪 test(audio): the two real-file cases come off the manifest

Both had a literal path baked into the source, and a placeholder is what
they were left with -- so each opened with a `!exists()` return and every
run skipped the only case it exists for: the 8-channel Opus import and the
seek that lands on its own second.

They now ask `engine::real_library::film` for `av1_opus_71` and
`av1_opus_51`, the same one-line gate the colour, PGS and dual-audio cases
use: the local manifest names the file, is gitignored, and its absence is a
skip line rather than a failure. `real_library.toml.example` grows the two
keys, described by shape.
🐛 fix(ui): the equalizer's buttons wrap instead of leaving the columnAhmet Kaan Gümüş · fb84e61
🐛 fix(ui): the equalizer's buttons wrap instead of leaving the column

The row of numbers above them already wraps for this reason: four buttons
side by side are wider than the inspector column at the 640x360 floor, and
the last of them -- the spectrum switch -- was off the right-hand edge of
the window entirely, reachable by its key and by nothing else.

2026-08-12

🐛 fix(ui): the equalizer card scrolls instead of running off the columnAhmet Kaan Gümüş · e7de125
🐛 fix(ui): the equalizer card scrolls instead of running off the column

Docked in the inspector, the card is the tallest thing in that column --
a 132 px graph with a row of numbers and a row of buttons under it -- and
at the 360 px floor it was taller than the column itself: the title ran
off the top, the Flatten/Add/Remove/Spectrum row off the bottom, and
neither was reachable by any means.

A cap the same way the width already has one, and the rows under it
scroll on their own handle -- the affordance the inspector column itself
carries, down to the line that says whether there is more below.
🐛 fix(ui): a card's sliders follow the hand, not only the pressAhmet Kaan Gümüş · 2ed6fe7
🐛 fix(ui): a card's sliders follow the hand, not only the press

Every drag in this window is tracked from the root, because each starts
on a strip a few pixels wide that the pointer leaves at once. A card
puts an occluding scrim over that root, and occluding is where gpui's
hit test stops (`Hitbox::is_hovered`) -- so the root heard nothing while
a card was up and the equalizer handle, the colour bars and the speed
bar were set by the press and then frozen there, release included.

The two listeners are methods now, and the scrim of every card that
holds a slider registers them as well: the drag tracks under the card,
a drag that leaves it is picked up by the root's copy without a seam,
and the release still writes exactly one undo step.
🐛 fix(ui): a notice reads as a sentence at the 640x360 floorAhmet Kaan Gümüş · dc279aa
🐛 fix(ui): a notice reads as a sentence at the 640x360 floor

The bar is a message beside a hint that keeps its own width, and at the
floor the picture region is narrower than the hint alone: the message
was squeezed to nothing and, with `min_w(0)` under it, wrapped one
character per line -- every failure rendered as a column of letters.
The row wraps now, so the hint drops to its own line, and the message
carries a floor instead of zero: gpui measures a text element's
min-content as the whole unwrapped line, so with no floor at all it
would refuse to shrink and run off the region instead.
🐛 fix(ui): the equalizer card stays inside the windowAhmet Kaan Gümüş · 33db3c0
🐛 fix(ui): the equalizer card stays inside the window

The card is docked in the inspector now, and it was still asking for
`eq_card_w` of the room outright -- a floor of 480 px in a column of
307 at 1280x720, so a third of the card hung off the right edge of the
window with the Q stepper and the spectrum switch on it. A cap over
`w_full`, which is how the two cards beside it are built, and the row
of numbers wraps rather than running past the edge it is capped to.
🐛 fix(ui): a slowed clip refuses the cut in its own wordsAhmet Kaan Gümüş · cd9aea8
🐛 fix(ui): a slowed clip refuses the cut in its own words

At a quarter speed each source frame is on screen four timeline frames
and only the first of the four is a frame the file has, so `split_at`
refuses the other three -- and the menu said "only from inside a clip"
about a playhead that was plainly inside one. Two arms now: the edges
keep that sentence, and the frame a rate cannot address says so.

Refused rather than snapped: `Speed::split_at` documents the refusal as
what keeps the two halves adding up to the clip that was cut, and a cut
that silently lands somewhere other than the playhead is a worse lie
than the one being fixed.
🐛 fix(ui): the equalizer says what is not selected, not a colour tokenAhmet Kaan Gümüş · 9f50845
🐛 fix(ui): the equalizer says what is not selected, not a colour token

A rename sweep landed inside a user-visible string: the refusal that
sends a hand to an audio clip read "NOTHING BG_SELECTED", naming a
palette constant at the person reading it. The one site in the repo
(grep for a theme token inside a literal comes back empty now).
🐛 fix(export): the sound gate judges the middle of what it hears, and says which codec it wroteAhmet Kaan Gümüş · 6b7076f
🐛 fix(export): the sound gate judges the middle of what it hears, and says which codec it wrote

Two defects the sampled gate's own first run on a real film exposed.

**The statistic was wrong.** A worst-of-windows rule at 0.95 refused a film this
encoder handles perfectly well: forty five-second windows of one mix, encoded at
128 kbps and decoded back, read

    0.803  0.835  0.938  0.940  0.960  0.987  ... median 0.998 ... 0.999

so five of the thirty-nine that carry sound sit under the threshold on a *good*
track -- the same thing OPUS_MAX_KBPS's own table shows, where a span scoring
0.937 at 128 kbps is inside the usable band. What the gate exists to catch is
the opposite shape: a rate the encoder cannot hold ruins the track wherever that
rate is used (0.452/0.697/0.951 at 136 kbps, 0.06 at 256). Half a track cannot
go without the middle of the list moving, so the median separates the two by a
margin no single window can, and a track under a minute is still one window --
median and whole-track correlation are the same number there.

Measured, this film: worst-window 0.8467 (refused, sound written as AAC),
median 0.9982 (taken, written as Opus).

**And the fallback was invisible.** The line the export publishes named "Opus ·
SW encode (opus-rs)" for *every* Matroska encode, because the label it borrowed
predicts from the format and cannot know what the gate decided -- so a track the
gate had just sent to AAC was announced as Opus, on the one path where the
difference is audible. `measured_audio_label` fills in the half a prediction
cannot know.

    cargo test -p engine --release --test video_copy -- --include-ignored
      7 passed in 133.2 s; the film exported in 98.5 s, 27944 MB, Opus
✨ feat(ui): a cut can be put where the export copies it, and the card says soAhmet Kaan Gümüş · bea7164
✨ feat(ui): a cut can be put where the export copies it, and the card says so

There was no way to place a cut on a source sync point: the snap knew about clip
edges and the playhead and nothing about the file's own groups of pictures. An
ordinary mid-film cut therefore fell the whole export back to software intra
HEVC -- hours -- and the export card cheerfully predicted the opposite of
whatever the engine was about to do.

Three doors onto one idea:

- The snap, extended. With snap on, a cut lands on the nearest source sync point
  within the same tolerance every other landing uses, and the playhead goes with
  it so what was cut is where the line is.
- ctrl+[ / ctrl+] put the playhead on the sync point before or after it -- the
  brackets already mean "the one before / the one after" here. On the actions
  card like every other action, so the pointer reaches them too.
- The timeline's own line says "SYNC POINT — a cut here is copied, not
  re-encoded" while the playhead is standing on one, so the answer is on screen
  before the cut rather than in the export card afterwards.

...and the card now asks `planned_seats`, which is the export's own decision:
"copy (source packets)" where it would copy, the real encoder where it would
not, and the sound named by the same gate the export runs (a Matroska source has
no sample table, so it never was the "AAC copy" this used to promise). The cuts
are in the probe's key, so moving one onto a sync point flips the line.

Driven on a 2h36m 4K HDR film in the harness: playhead to 30:03, ctrl+] to
30:06:22 (badge lights), cut, ctrl+] at 35:07, cut, delete the middle, export ->
first output bytes at 114 s, done in 146 s, 28.06 GB, the running line reading
exactly what the card predicted.
⚡ 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.