Commits
2026-09-18
🐛 fix(media): audio routing, session audio re-arm, hw trailing-zero NALs, display-matrix rotationAhmet Kaan Gümüş · bc8b82e
🐛 fix(media): audio routing, session audio re-arm, hw trailing-zero NALs, display-matrix rotation - is_audio admits .mpeg/.mpg so mp3-with-cover files import (was fed to Mp4Demuxer) - session audio walks past trackless leading sources and re-arms when a sounding file joins a silent timeline (fixes add/remove/add silence) - engine-hw pump clears trailing cabac_zero_word bytes instead of dying with code -2; export falls back to software decode before first frame - tkhd display matrix read for mp4; 90/180/270 turns baked into preview and export pixels; other angles refused by name (UnsupportedRotation)
2026-09-12
✨ feat(engine): both Opus seats are ec-opus natives — the library pair is goneAhmet Kaan Gümüş · 597e096
✨ feat(engine): both Opus seats are ec-opus natives — the library pair is gone The decode seat (SymDecoder::Opus) and the encode seat (encode_opus) move off ruopus 0.1.2 / opus-rs 0.1.26 onto the codec family's own ec-opus, the first path dependency across into the sibling edith_codecs workspace. Both replaced crates leave Cargo.lock with everything they pulled in. What the swap is measured to do, not hoped to do: * decode equivalence: a real 5.1 stream decodes to correlation 1.000000 between the two decoders, and the film seek witness lands on the same samples it always did — the 312-sample pre-skip corrections hold unchanged, so no constant moved. * the 128 kbps cap goes to 320, the Sound row's top: opus-rs's packets above ~165 kbps were noise to every decoder but its own (re-measured: 0.011 correlation at 320 through BOTH decoders), and that cliff is the only thing the old ceiling stood on. ec-opus's 320 kbps packets read back identically through ruopus and through ec-opus. Fidelity at the top of the new band: 0.9999 (stereo 320), mono 0.9999-1.0000 (was 0.9983-0.9987 at 128). * mono leaves as Opus now. opus-rs mis-encoded mono at every rate, which is what kept a mono mix on the AAC path; a_mono_mix_leaves_as_opus_too pins the new behavior and the export.rs unit suite round-trips mono at 96 and 256. The muxer's family-0 OpusHead needed no change: it already wrote mono. * performance, measured honestly (release, min-of-7 alternating, against ruopus WITH the spectrograms/FFT backend the product actually shipped): ec-opus is ~1.4-1.7x SLOWER on every path — 5.1 decode 246x realtime where ruopus managed 407x; the export seat (encode plus its mandatory fidelity decode) 0.27 s against the old seat's 0.18 s per 30 s of stereo. Both stay far past realtime (>=88x), so nothing is user-perceptible, but the >10% bar is not met numerically; the swap stands on the dependency-freedom goal, and the family decoder has the headroom to close the gap. KNOWN-OPEN, not silently accepted.
2026-08-19
2026-08-16
✅ test(engine): the re-timing sweep, every op against the lawAhmet Kaan Gümüş · 5832d81
✅ test(engine): the re-timing sweep, every op against the law A table-driven property suite over every mutating op (delete from each anchor kind, speed at 2x and half, split, regroup, move, trim, paste) against four project shapes (ungrouped, grouped clips, aligned group with caption, the offset group) under the universal laws: links consistent, every lane sorted and disjoint on both its lists, the playhead's scene within the frame a rate can hold, and the undo round-trip byte-identical at one snapshot per op. Two harness findings on the way in, both of the harness and not the engine: a two-op cell must capture its pre-state between the ops, and a stretch the neighbours refuse is a valid cell -- the refusal names its wall and changed nothing. Paste is the named exception the suite pins directly: media lanes ripple, the words never move. TimelineMap's invert and the total shift answer the laws today and are gated test-only until the delete/paste migrations consume them in a build path.
🐛 fix(playback): the playhead follows the re-rate through the same mapAhmet Kaan Gümüş · 6d8f3a1
🐛 fix(playback): the playhead follows the re-rate through the same map A speed change left the playhead at its own timeline position while write_speed re-timed the group under it, so the scene changed with the rate -- at 2x from the middle of a clip the cursor jumped a clip's worth of content. Both the commit and every live sample of the bar now map the playhead through a TimelineMap built from the group's own old geometry: each clip member by its old rate against the new one about its own head, each caption member by the held clip's proportion about the held clip's head, and a playhead outside every member unmoved -- nothing ripples, so the difference is the gap's to absorb. TimelineMap (engine/src/map.rs) is the one piecewise-affine answer the re-timing ops will share; this is its read-side consumer, with the laws pinned (monotone, exact on the ends, invertible on the image) and the playhead its first user. The delete and paste migrations land next; until they do, invert and the total shift answer the laws tests alone.
2026-08-15
✨ feat(engine): a speeded clip keeps its pitchAhmet Kaan Gümüş · 475f10c
✨ feat(engine): a speeded clip keeps its pitch The tape effect is gone: a speeded clip's audio was resampled at its speed, so its pitch moved with its rate. The resample is now only what it always should have been -- the rate conversion, reading a source written at another sample rate at the ratio of the two rates, pitch- true by construction -- and the time the Speed asks for is taken by a WSOLA stretch behind it: windows overlap-added at a different hop, each placed where it best continues the one before it, so the timeline compresses or stretches while every period of the signal keeps its own length. The beep stays a 1 kHz beep at 2x, the words stay spoken. Hand-rolled, no new dependencies: N=1024 Hann windows, 512-frame synthesis hop, ±512 search on the first channel by normalized cross- correlation against the natural continuation, one offset for every channel so a stereo pair stays coherent. A silent continuation is placed nominally -- nothing to match -- and a segment too short to prime a window passes through as the decoder read it. Both halves of the chain pace the timeline's promise to the frame, which is the A/V sync invariant the speed suite pins. Measured, not felt: the stretch's own tests put a 440 Hz sine through 2x and 0.5x and read 440 back by Goertzel with the octave gone; the sync fixture's 1 kHz beep plays at 1 kHz at 2x and 0.5x through the real open path (the tape effect's ladder peak read 1350 Hz there), and a 2x WAV export carries the same 1 kHz back out.
2026-08-14
✨ feat(engine): the driver that aborts kills a process nobody was editing inAhmet Kaan Gümüş · c0a1847
✨ feat(engine): the driver that aborts kills a process nobody was editing in Mesa's radeonsi calls libc abort() from its own C worker thread when the video ring resets under it -- amdgpu_ctx_set_sw_reset_status, mesa 26.1.6, vcn_unified_0 hung during an AV1 encode submission on 2026-08-13. A foreign thread's abort is not an unwind, so every catch_unwind in the plugin was structurally unable to see it: the editor died with the driver and took the session's work with it. So the encoder is not in the editor's address space any more. HwEncoder is a handle on a `hw-encode-child` process that dlopens the plugin, and its death -- by abort, by any signal, or by going quiet past VE_HW_TIMEOUT_MS -- comes back as an error the export answers by writing the file again in software. A person who picked the GPU by name still gets the refusal in words rather than an encoder nobody chose. Isolation that cost the speed would not be worth having, so pictures do not travel down a pipe: in-memory ones go through a memfd mapped in both processes, and pictures still on the GPU never move at all -- their DRM-PRIME descriptors cross as file descriptors over SCM_RIGHTS, so the zero-copy export path stays zero-copy across the boundary. Measured on this box at 1080p: 430 fps in-process, 384 isolated, 89% of it, worst case (every export of an untouched clip takes the descriptor path instead). The proof does not need a wedged ring, which is the one thing a wedged machine cannot supply: VE_HW_TEST_FAKE opens a stand-in seat in the child and VE_HW_TEST_ABORT / VE_HW_TEST_HANG say where it dies or stops, so the containment paths are exercised on any machine, GPU or no GPU. Decode is still in the editor's process, where the same abort would still be fatal; the seam to move it is now the one this built.
2026-08-13
✨ feat(engine): a big film gets a small stand-in to cut withAhmet Kaan Gümüş · 83e561d
✨ feat(engine): a big film gets a small stand-in to cut with A proxy is the film at 1280 on its long edge, every frame an IDR, no sound in it at all: a seek lands on the frame asked for instead of on the nearest one a decoder can start from, and the mix stays the original's. Generation is the export walk given a one-clip project and a smaller canvas, so the hardware seat, the progress and the cancel are the ones a file export already had. Two switches were wanted for it: `intra_only` (one frame a GOP on the H.264 pair) and `keep_source_colour`, which carries the film's own space into the stand-in instead of converting it -- that conversion ran on the source's full 4K, cost 48 ms a frame and was the whole of a proxy's price, and leaving it to the screen means the tone-map preset can still be changed after the stand-in was made. The cache is keyed on the source's path, length and modification time, so a re-encoded original misses rather than reading a stale stand-in. A 4K HDR film: 2.35x realtime on the VA-API seat, against 0.59x before the colour switch; a cancel leaves neither the file nor its .part.
2026-08-12
🚀 perf(import): the container walk goes to the worker, not the render threadAhmet Kaan Gümüş · 0e88697
🚀 perf(import): the container walk goes to the worker, not the render thread The Import door read the file twice: once on a worker to warm the page cache, and once on the UI thread to actually parse it. The second one is what a person sees -- 2.5-6 s of frozen window opening a 24 GB 4K HEVC remux, and 0.8-8.9 s importing one beside a timeline that is already up. The subtitle half of this door was split across the hop a while ago (`parse_subtitles` walks, `add_subtitle_tracks` pushes); this is the container half, and it is the same split. The engine grows the two doors the front-end needed: `probe_import` -- the header, the decoder this machine would open it with, and the audio check, all with no session in reach, so a worker can run it -- and `import_probed`, which registers what came back and touches no disk. The gate they are decided against (`import_gate`) is two clones off the timeline, so the UI thread hands it over and goes on painting. A timeline that moved while the worker read is noticed rather than trusted: a stale probe falls back to the slow door and lands the same row. A file arriving at a window with no timeline to import into is opened whole on the worker instead (`open_whole`), which is where the 2.5-6 s went, and every `.edith` -- dropped, picked or named on the command line -- now goes through the one queue as well, so its open is a worker's too and the line above the panel names it while it runs. Measured on a real-library 4K HEVC remux (24 GB): the header walk is 21.4 s cold and 429 ms warm, and probing the timeline's own first source is another 1-4 s. None of it is the render thread's any more. ...and the line that says so grows a Cancel, because a read that long needs a way out. The read in flight is not stopped -- a demuxer walk polls nothing -- so the window is given back at the click, the file does not land, the queue behind it is dropped, and the notice says exactly that rather than promising the disk went quiet.
🔒 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).
🔊 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.
2026-08-11
✨ feat(tonemap): PQ and HLG become BT.709 through a published curve, not a guessAhmet Kaan Gümüş · 0a02d34
✨ feat(tonemap): PQ and HLG become BT.709 through a published curve, not a guess BT.2446 Method A, whole: the tone curve, the colour-difference scaling with its luma payback, and BT.2020 -> BT.709 with a simple clip. Written down, so it can be checked against the document instead of against a screenshot. The maths is float and transcendental, so it runs 9537 times per stream -- a 33 x 17 x 17 grid over the input codes -- and the pixel loop is a trilinear interpolation with the two luma neighbours packed into one word. 18.7 ms a 3840x1600 frame, 6.3 ms at 1080p, single core, release. Uneven axes on purpose: 17 luma nodes leave the assumed 1000 cd/m^2 peak five codes shy of SDR white, and a full 33^3 costs 30.7 ms. Above-peak light is clamped before the curve rather than extrapolated through it -- extrapolating sent one channel over the gamut rail and the next under it, a hundred-code hole in a smooth ramp. Standalone: no decoder or export path calls it yet.
✨ feat(colorspace): a file says which matrix and curve its numbers are in, and edith reads itAhmet Kaan Gümüş · 070ffe6
✨ feat(colorspace): a file says which matrix and curve its numbers are in, and edith reads it Three tiers, per field: the container's own tags (Matroska `Colour`, mp4 `colr`), then the bitstream's (H.264/HEVC SPS VUI, AV1 `color_config`), then the ffmpeg/mpv resolution rule -- 720 lines or taller is BT.709, below it BT.601, limited either way. A code that says nothing, or says something with no implementation here, falls to the next tier rather than answering wrongly. `VideoMeta` carries the answer; nothing consumes it yet. Everything still renders through the hardcoded BT.601 it always did, which is the bug this is the foundation for fixing. The bit-level walks are where this can quietly go wrong: an SPS whose scaling lists are counted wrongly lands the VUI read in the middle of a coefficient. Both are measured -- H.264 and HEVC against hand-built parameter sets (no encoder here writes SPS scaling lists), the rest against fixtures tagged in the container, tagged only in the bitstream, and tagged nowhere, plus the two real films: a 4K HDR remux that reads BT.2020/PQ and a fully untagged 720p one that reads BT.709.
🧹 test(scratch): a fixture directory is deleted by the test that made itAhmet Kaan Gümüş · 5c39124
🧹 test(scratch): a fixture directory is deleted by the test that made it Every suite here made its own directory under /tmp with a name and a process id and then walked away from it: 2907 `ve_*` directories, 6.4G of a 16G tmpfs, none of them reclaimable by anything but a person with `rm`. `engine::scratch::Scratch` is the one place a throwaway path comes from now -- a directory, or the single file inside one -- and `Drop` is what takes it back. That is the whole reason it is a guard rather than a cleanup call at the end of a test: unwinding runs `Drop`, so the *failing* tests, which are exactly the ones that used to leave the most behind, clean up like the passing ones. It derefs to a `Path`, so the call sites did not have to change: the helpers that handed back a `PathBuf` hand back one of these. The prefixes stay what they were, so a directory is still recognisable while a test is stopped in it. Nothing about what a test *does* moved -- only where its fixtures live and when they die. Driven: the whole engine suite and the app's own tests run with the count of `/tmp/ve_*` before equal to the count after.
🔀 merge(A4): the machine tells you what it can encode — vh_caps asks VA-API at runtime, old plugins stay welcomeAhmet Kaan Gümüş · c674238Browse files
✨ feat(engine): subtitles come in with the film or beside itAhmet Kaan Gümüş · f4b5fd8
✨ feat(engine): subtitles come in with the film or beside it A subtitle track was a track this engine walked past: the Matroska track walk kept video and audio and dropped type 0x11, and a `.srt` next to the media was a file with no door. Now both arrive as the same thing -- a list of timed cues -- and a project keeps them. `subtitle`: the cue model plus the two ways in. Standalone `.srt`, `.vtt` and `.ass`/`.ssa` go through `oxideav-subtitle` and `oxideav-ass` rather than through a fresh parser here; an embedded track carries its timing on the block and its text in it, so each codec is put back into the shape its own parser reads -- which is what makes an embedded track and the file it was muxed from come back as the same cues. What cannot be read is refused by name and still listed: the four PGS tracks of a BluRay remux are four rows saying they are pictures, not an empty list and not a file that would not open. A `.srt` that has gone missing since the save is the same story, and a re-save keeps its row. `.edith` 10 writes `subtitle <track> <path>` -- the reference only, the cues stay in the file they came from. v9 and every older dialect load as the projects with no subtitles that they are.
✨ feat(caps): the card says what this machine and this build can really doAhmet Kaan Gümüş · 0f37a18
✨ feat(caps): the card says what this machine and this build can really do The hardware half was never asked for: the plugin decoded what it was handed and the front-end had nothing to show before a file arrived. Now an optional `vh_caps` symbol asks the driver -- profiles, entrypoints and whether a P010 image exists for a 10-bit read-back -- and intersects that with the codecs the plugin actually implements, so a GPU with an HEVC encode entrypoint is not reported as an HEVC encoder edith can reach. Optional exactly as `vh_enc_av1_open` is: a plugin built before this still loads and still decodes, and the listing degrades to "none" for it, for a missing plugin and for a machine with no driver alike. The software half is a table -- what this build was compiled with is a question the manifest already answered -- and both halves land at the foot of the export card, where a user asks them.
✨ feat(mix): every track has its own volume and the mix has a ceilingAhmet Kaan Gümüş · dc7d07d
✨ feat(mix): every track has its own volume and the mix has a ceiling A fader per audio track and one master limiter over the sum of them, both applied where the lanes are added and nowhere else -- so what an export writes is what the room heard, by construction rather than by two call sites agreeing. A track's fader moves everything on it, every frequency: it is not the equalizer (one take, one band) and not the panel's volume (this machine's monitoring, which no file carries). The limiter is lookahead, soft-knee and per sample: the peak of an exported file is a measurement, not a hope, and the hard clamp stays behind it as the backstop. Flat settings are still the bit-exact passthrough: one lane at unity with the limiter off never opens a mixer thread, and an mp4 of such a timeline is still a packet copy. A mixed one re-encodes, and the card says so before the export starts. Both belong to the project, so `.edith` is v9: `fps`, `limiter` and `gain` lines, every older dialect still loading flat. The rate line pays an old debt with it -- a timeline of nothing but stills and songs now comes back at the rate it was cut at instead of the one its scaffold implied. UI: the mix card (f, or an audio track's own header), rows with steppers and hold-to-run arrows, and the track's level on its header.
2026-08-10
✨ feat(timeline): a clip shot at another rate plays at the speed it was shot atAhmet Kaan Gümüş · 26af1e4
✨ feat(timeline): a clip shot at another rate plays at the speed it was shot at A frame rate of its own is no longer a refusal at import. Every frame number in the edit list counts the *timeline's* frames -- a clip's in/out included -- and a file shot at another rate is converted once, at the decoder's door: `Rate` (milli-fps rational, `Speed`'s floor/ceil pair) says which frame of the file a timeline-rate frame is. Playback opens its worker through it and stamps the pictures coming back through its inverse; the export walks its span through it after the speed, so a 2x 24 fps clip on a 30 fps timeline is exactly both. Nothing in `project.rs` changed: placement, trim, split, paste and speed are the same arithmetic on one clock, and a single-rate project takes the identity map everywhere it used to take nothing. A library row now names the *file's* rate rather than the timeline's, which was true only while every source shared it.
✨ feat(timeline): silences are cut out or played fast in one pressAhmet Kaan Gümüş · d4ac3fc
✨ feat(timeline): silences are cut out or played fast in one press A scan of the selected clip's own sound (RMS dBFS over 20 ms windows, off the decode path the waveform already takes) marks every silence on the lane before anything moves; `enter` cuts them all out with a ripple, `f` plays them at 4x with the room they no longer need closed behind them. Either way it is one edit and one undo press, however many it found. Four numbers, all keyboard-driven from the card: the threshold, the quiet short enough to forgive, the padding kept either side of speech, and the kept sliver short enough to swallow -- the last of which is what stops a breath between two silences surviving as one-frame confetti. `set_speed` does not ripple, so speed mode closes the gaps itself; a clip on another lane lapping over a silence is refused by name, because the lanes would shrink by different amounts. A source with no audio track at all is refused by name too rather than read as one long silence. Output is ordinary clips: `.edith` stays v8.
✨ feat(timeline): clips play at a speed of their ownAhmet Kaan Gümüş · f8effe8
✨ feat(timeline): clips play at a speed of their own A clip gains a rate (`Speed`, thousandths of real time, 0.25x to 4x) and every speed question is answered at the mapping seams that were already there: `Clip::frames` is the source range divided by the rate, `end` is built on it, and `map`/`span_at`/`composite_span_at` walk the offset through `Speed::source_at`. `in_frame`/`out_frame` stay *source* frames, so a trim and a split still address the file. The picture needs no new decoder: the span says how many source frames it reads, and `try_frame` brings the decoder's numbers back through the same rate -- at 2x two decoded frames land on one timeline frame and the display's drop-when-behind policy takes it from there. The sound is resampled per segment inside the worker playback and the audio export already share (linear interpolation, carried across packet seams), so the pitch moves with the rate: tape, not pitch-preserve, and the card says so. Each segment is told how much timeline it owes and pads or trims to it, which is what keeps a run of speeded cuts from drifting. Rounding is where a rate could break the lane, so it does not: `Speed::fit` never hands a trim more source than its room holds, and `Speed::split_at` refuses a cut a slow clip's rate cannot address rather than leaving two halves that no longer add up. The fuzz sweeps set_speed in with the rest. - card in the eq/colour pattern, on `j` and in the clip menu; a drag is one undo step for the whole linked group, 1.00x reachable by hand and by `r` - clip boxes carry a "2.00x" mark, and their width, waveform and details row are the timeline length - WAV/FLAC honour it; mp4 and AV1 *refuse* by name -- that path copies AAC packets and a resample is not a copy (ponytail names the upgrade path) - .edith v8 carries the rate; v7 and older load at 1.00x - `assets/test_speed_sync.mp4`: one flash, one beep, same instant. At 2x they still land together, to the frame.
✨ feat(timeline): still images import and place as clipsAhmet Kaan Gümüş · 30d430d
✨ feat(timeline): still images import and place as clips A PNG, JPEG or WebP is a source like any other: it imports into the library, drags onto a video lane, shows at the playhead, trims, saves and exports. `engine::is_image` is the door, beside `is_audio`, and every choice it forces is made in one place. The decisions, spelled out: - Extensions: png, jpg, jpeg, webp -- exactly what the `image` crate is built with here. Anything else is refused by the door that refuses a .txt. - Length: an image has none, so it is *held to* ten minutes (600 s at the timeline's rate) and *placed* at five seconds. The cap is finite on purpose -- a u32::MAX sentinel would hand a trim drag a wall past anything the timeline can hold -- and it is recomputed identically at load, so a clip trimmed out to it reopens. - Image-first project: its own picture is the canvas (a still *has* a resolution, unlike a song) at 30 fps, silent, one 5 s clip on V1. The A2 audio-only precedent for everything else. - Scaling: none of its own. The still is decoded once to I420 and goes through the same grade, the same `Composer` and the same conversion a decoded picture does, so a 640x360 image on a 1280x720 canvas is letterboxed by its fit policy and never stretched. - Lanes: the mirror of a song. A still goes on the video lane it was asked for or on V1, never on an audio one, and never as a grouped take -- a clip on A1 playing a PNG is a segment the audio worker cannot open. Hand-written projects are refused by name. - The timeline's audio parameters are now the first source that *could* have any, so an image as source 0 no longer holds every later import to its silence. Playback opens a still worker (one conversion, then a memcpy per frame, as the black-gap worker does); the export's `ClipDecoder` hands the same planes out for as long as the span runs, so a mixed video/still timeline encodes at the cut. tests: engine/tests/images.rs -- import registers only, placed pixels match the file's own (top/bottom bands catch a flip, RGB order catches a swap), trim walls at the cap, .edith round trip incl. the audio-lane refusal, mp4 export pixel-checked at the cut, audio-lane placement lands on V1. Fixture: scripts/gen_fixtures.sh writes assets/test_still.png.
🐛 fix(engine,ui): paste respects lane kinds; bounds and rebind capture hardenedAhmet Kaan Gümüş · 11603ec
🐛 fix(engine,ui): paste respects lane kinds; bounds and rebind capture hardened Four bugs a hunter sweep found, each with the door it comes in through: - `Project::paste` put the clipboard clip in the first lane of *every* kind, so an audio-only clip copied off A1 landed on V1 too: a wav as a video source, a decode that fails, and a save the next open refuses. It now asks the source what it is, the same question `place_stream_at` asks an import, and reaches A1 only when there is no picture. - The `resolution` line was applied unbounded while the keystroke capped at 8K, so a crafted `resolution 4294967295 4294967295` panicked `open_black` with a capacity overflow. One bound now (`engine::is_resolution`) with both doors asking it, and the load door refuses by line like every other malformed line. - `open_room` shifted starts unbounded, and the file format permits a clip ending at the very last frame: a paste wrapped it round to the front of the lane -- a debug panic, or in release an overlap no reload accepts. The edit door refuses the paste that would push anything past `u32::MAX`; the load bound stays where it is, since the wrap was the edit's to prevent. - A rebind captured whatever gpui reported, so shift+= wrote `play +` and the next load threw the *whole* keybindings file away, losing every other rebind. Capture now takes only a chord the file can spell and read back, and a line the parser cannot use costs that line alone -- the magic line is the only thing that still refuses the file.
✨ feat(engine): I420 scaler and fit geometryAhmet Kaan Gümüş · dd54308
✨ feat(engine): I420 scaler and fit geometry Bilinear 16.16 rescale, four fit policies handing back chroma-grid-aligned placement and crop rects, and a canvas blit -- the primitive a project resolution decoupled from media resolution needs. 3.82 ms/frame for 1280x720 -> 1920x1080 in release; nothing is wired to it yet.
Merge S5a audio-file import into stream-picker mainAhmet Kaan Gümüş · 1bb8ee2
Merge S5a audio-file import into stream-picker main
Both sides taught `audio` a new axis and they meet on one type: S5a made
`Track` an enum over the mp4/AAC reader and symphonia's, main gave every
reader a `(path, stream)` address. The merged `Track::open(path, stream)`
keeps both -- the stream index lives inside `AacTrack::open`, and a
standalone audio file, which has exactly one track by construction, refuses
any stream above 0 rather than quietly serving the only one it has.
- `AudioProbe` is S5a's `{sample_rate, channels}`: equality is playability,
so an mp3 may share a timeline with mp4s. Copyability is a separate
refusal, at export, and stays AAC-only through `copy_track`.
- `probe_streams` reads a standalone file through symphonia instead of
walking it as an mp4 -- an ALAC .m4a parses as an mp4 whose only audio
track is not AAC, so the mp4 walk would call it undecodable where
symphonia decodes it.
- Which lane a source lands on is decided once, in `place_stream_at`: a
file with no picture is placed on the audio lane alone, everything else
is pasted as a grouped take. The front-end only owes the refusal notice.
- `unsupported()` and the NTSC/VP9 work are untouched; `is_audio` files
never reach the former, since a song cannot open a timeline at all.✨ feat(engine): common audio files import and playAhmet Kaan Gümüş · fe53979
✨ feat(engine): common audio files import and play mp3, wav, flac, ogg-vorbis, ALAC and ADTS join a timeline as sources with no picture: symphonia's own probe reads them, the audio lane holds them, and the video lane refuses them by name. The mp4/AAC path is untouched -- it is still the only one that yields packets an export can copy, so a timeline carrying anything else is refused at export with the file and its format named rather than exported silent. A source with no picture is as long as it plays, rounded up to whole frames; import, load and the library row all derive its length from that.
✨ feat(engine): VP9 import via the VA-API pluginAhmet Kaan Gümüş · 03a34d3
✨ feat(engine): VP9 import via the VA-API plugin The demuxer takes a vp09 track alongside avc1 and hands its samples through untouched -- an mp4 VP9 sample is a self-contained superframe, so there is no avcC repack and no parameter sets to re-inject. VideoMeta carries the codec, and the plugin picks its cros-codecs decoder from it. The C ABI is unchanged on purpose: the plugin demuxes the file it is given, so the codec is a property of the container rather than of the call, and a libengine_hw.so built before this still loads and still decodes H.264 -- it simply returns null for a VP9 path, the same no it gives for an unsupported profile. There is no software VP9 decoder to fall back to, so a VP9 file the plugin will not take is refused at open, by name, where the front-end can show it -- never a black screen, and never VP9 bytes fed to rusty_h264. One timeline stays one codec, and export re-encodes to H.264 as before; only audio is ever copied packet for packet.
✨ feat(engine): every audio stream is listed, and any one of them opensAhmet Kaan Gümüş · dff7d84
✨ feat(engine): every audio stream is listed, and any one of them opens A remux carries one audio track per language; the engine took whichever AAC track a HashMap handed it first and there was no way to ask for another. - probe_streams() describes every audio track in file order, undecodable ones included (decodable: false) so a picker can grey them rather than hide them - open_multi_streams() takes (path, stream) per source; the old open_multi_segments is a wrapper pinning stream 0, so no caller moved - stream ids come from moov.traks, not the tracks HashMap: "stream 0" was a different track run to run on a multi-track file - a named stream that is missing or not AAC is an Err; stream 0 stays the silent source it always was, because a file we cannot decode the audio of still has a picture worth editing - assets/test_multiaudio.mp4: video + AAC stereo + AAC mono (fra) + AC-3, which covers the picking, the language and the greyed row
2026-08-09
✨ feat(waveform): min/max peak extraction off the audio decode pathAhmet Kaan Gümüş · 57bd150Browse files
✨ feat(engine): .veproj save/load — relocatable, validated, atomicAhmet Kaan Gümüş · ac60b80
✨ feat(engine): .veproj save/load — relocatable, validated, atomic A project file is line-based text: `veproj 1`, an optional playhead, one `source` line per file and one `clip` line per range. Text because a path is bytes on this platform and a JSON string could not carry one losslessly, so the path field is byte-escaped instead; paths under the project's own directory are written relative to it, which makes a folder of media plus its .veproj movable anywhere. The parser is strict and every refusal names its 1-based line, and writing goes through .part + rename as an export does. Loading is a new session, never a mutation of the old one: source 0 defines the timeline, every other source passes the same checks import applies (in the same words), and every clip has to still fit inside the file it plays from -- a source that vanished or shrank is a refusal that names it, not a silently shorter timeline. Sources no clip plays from are pruned at save, so an import that was undone cannot leave a file behind that blocks a future load.
✨ feat(engine): multi-source traversal, import validation, cross-source exportAhmet Kaan Gümüş · 68b0ca2
✨ feat(engine): multi-source traversal, import validation, cross-source export Wave 2 of the import slice, two packages merged at one seam. Playback traversal (S3): next_clip/seek open each clip against project.sources()[clip.source]; audio switches to open_multi_segments over the (source, start, end) triples segments_from now yields. New PlaybackSession::import validates dimensions, fps and audio params against the timeline before appending, and reseeks unconditionally so a running audio worker learns the appended tail. clip_spans_by_source() added for the app's per-source tint. Cross-source export (S4): export::start drops its source path argument -- Project::sources() is the only path truth now -- and is pub so a test can build a multi-source Project without a session. Each clip opens its own ClipDecoder; the audio pass carries one bresenham accumulator across source joins. Seam: PlaybackSession::path is gone. It was kept only to feed export_to, which no longer takes a path, so the field and its initialiser go with it.
✨ feat(engine): export — edit list to mp4, HW encode with SW fallbackAhmet Kaan Gümüş · 86d5c15
✨ feat(engine): export — edit list to mp4, HW encode with SW fallback Worker thread per export: decodes each clip straight to I420 (never through DecodeSession, which only speaks BGRA), feeds one encoder chosen once -- VA-API plugin unless VE_SW_ENC=1 or the plugin is unavailable, rusty_h264 Fast/CBR otherwise -- and muxes the access units as they come. Audio is copied packet for packet, so the file has to be opened before the first video sample is written. Cancel and every error path delete the partial file; progress is a permille atomic a render loop can read without a lock. mux: the movie timescale moves to 90 kHz. mp4 0.14 converts each sample duration into the movie timescale with its own integer division, so 1 kHz lost 0.33 ms per frame and made a 4.000 s export announce 3.960 s.
✨ feat(engine): export lane 1 — mux module, AAC packet copyAhmet Kaan Gümüş · 5ce68fe
✨ feat(engine): export lane 1 — mux module, AAC packet copy mux.rs is the write side of demux.rs: split_annex_b/nal_type feed a repack to 4-byte-length-prefixed samples (mp4 0.14 hardcodes length_size_minus_one=3), SPS/PPS/AUD/SEI stripped out of the sample bytes, is_sync taken from an actual NAL type 5 rather than GOP arithmetic. Mp4Muxer::create wants the parameter sets up front, so mux::parameter_sets pulls them out of a buffered first access unit before the muxer exists. Timescales are 90000 video / sample_rate audio / 1000 movie, per-frame duration (90000/fps).round(), and mp4 0.14 ignores Mp4Sample::start_time on write -- timing is duration accumulation only. An SPS shorter than 4 bytes panics inside the crate (avc1.rs indexes sps[1..3]), so create rejects that and the other degenerate shapes up front instead. Audio is copied, not re-encoded: there is no pure-Rust AAC encoder and mp4 0.14 has no PCM MediaConfig, so the only honest option is to hand the source packets back through verbatim. AudioSession::copy_segments does that -- stts walk to packet ids, no decode, bytes straight from read_sample. Cut points do not land on 1024-sample boundaries (23.2 ms packets vs 33.3 ms frames), so a bresenham accumulator picks the packet run per segment and keeps the cumulative A/V offset under 512 samples, proven by induction over the carry and measured over 200 random join lists. The first segment starts one packet early to feed the 1024-sample priming drop; interior segments do not, because an extra head packet there is 23 ms of pre-cut audio at every join and it would not fix the missing MDCT predecessor anyway. That artifact is documented at the seam.
✨ feat(engine): clips primitives — edit-list model, bounded decode, segmented audioAhmet Kaan Gümüş · e75a7ba
✨ feat(engine): clips primitives — edit-list model, bounded decode, segmented audio Lane 1 of the clips slice; PlaybackSession traversal comes next. - project.rs: Clip/Project — cut (metadata-only, refuses no-op splits), delete (closes gap, keeps ≥1 clip), undo snapshots, timeline↔source mapping with boundary sweep tests - decode: open_range(start, end) — both backends stop after end-1, empty/inverted ranges disconnect cleanly without spawning a worker - audio: open_segments — one worker walks the edit list; segments bit-exact vs equivalent seeks, joins gapless by contiguity assert, head+tail trim inside a single AAC packet handled
✨ feat(engine): seek primitives — video open_at, ao_flush, audio open_atAhmet Kaan Gümüş · 96ae365
✨ feat(engine): seek primitives — video open_at, ao_flush, audio open_at Lane 1 of the seek slice; PlaybackSession orchestration comes next. - demux/decode: stss sync lookup, DecodeSession::open_at decodes from the keyframe and discards to the target; Frame.index stays absolute. HW plugin ABI: vh_open renamed vh_open_at(path, target) — discards skip the vaGetImage readback; measured seek cost 65ms HW / 222ms SW - engine-audio: ao_flush drains the ring consumer-side in the RT callback (one-shot atomic), stale PCM unplayable even when paused; played-position atomics untouched so clock math survives - audio: open_at walks stts, 2-packet AAC pre-roll (MDCT overlap reconstructed exactly — verified 0-diff before the first PNS band), sample-exact trim; priming skip and seek discard unified. AAC seek is deliberately not bit-exact: symphonia's PNS noise LCG state depends on packet history; bounded <1e-3 by test instead
✨ feat(playback): A/V session — audio-master clock, real-speed video, space to pauseAhmet Kaan Gümüş · 63e6964
✨ feat(playback): A/V session — audio-master clock, real-speed video, space to pause engine::playback::PlaybackSession wires DecodeSession + AudioSession + AoSession + PlaybackClock together behind open/play/pause/toggle/now/tick. A feeder thread pours decoded chunks into the device ring; tick() polls the device position into the clock and switches to wall time at audio EOF. Every audio failure (no track, no plugin, no daemon) degrades to a wall-paced silent session. The app renders against the clock: drain every due frame, show the last (drop-when-behind), hold one that is early. Space toggles playback.
✨ feat(engine): audio decode, PipeWire output plugin, playback clockAhmet Kaan Gümüş · 229a569
✨ feat(engine): audio decode, PipeWire output plugin, playback clock Wave 1 of the audio slice — three independent modules, app wiring comes next: - audio.rs: AAC-LC via standalone symphonia AacDecoder over the existing mp4 demuxer; priming trim read from the container elst (verified against ffprobe); channel identity pinned by zero-crossing tests on the 440/880 Hz fixture - engine-audio: dlopen'd PipeWire cdylib (ao_* C ABI). App binary keeps zero libpipewire linkage; daemon absent fails open() in ~1ms. Fill capped at 1024 frames/callback: uncapped, PipeWire hands the sink-sized buffer and the position clock steps 256ms at a time. Stream time rate is 1/48000 regardless of stream rate — position is rescaled or the clock runs 8.8% fast on 44.1k content - clock.rs: PlaybackClock, audio-driven with wall fallback; audio positions relative to last re-anchor so restarted streams re-sync; paused == frozen exactly, all re-anchoring through one path
🎉 feat: MVP decode pipeline — mp4 → H.264 → gpui previewAhmet Kaan Gümüş · 0acbf8d
🎉 feat: MVP decode pipeline — mp4 → H.264 → gpui preview - engine: mp4 demux → Annex-B, rusty_h264 software decode, BT.601 I420→BGRA; decode on worker thread behind a bounded channel - engine-hw: optional VA-API decode plugin (cros-codecs) behind a C ABI, dlopen'd at runtime with silent software fallback; the app binary keeps zero libva/gbm/drm linkage so it runs on any distro - app: gpui window, per-frame RenderImage swap + drop_image - vendor/: cros-libva + cros-codecs with 3 LOCAL PATCH fixes (libva 1.23 struct init, radeonsi 64x64 min context, pub surface()) — upstream is dormant, so vendor/ is adopted code, not a temp fork - fixtures are gitignored; scripts/gen_fixtures.sh regenerates them