Commits
Commits on
a3e9dc2d50d8a2595e06b8d5fbcde7eeb078b2bcFiltered to crates/engine/src/playback.rsClear filter2026-08-10
🔀 merge(playback): audio-only sessions carry their frame count for trimAhmet Kaan Gümüş · a3e9dc2
🔀 merge(playback): audio-only sessions carry their frame count for trim The audio-only branch predates the trim feature's per-source counts; open_audio_only now feeds them like open does (verifier-prescribed seam fix).
🔀 merge(main): edge trim beside the colour drag on the root carriersAhmet Kaan Gümüş · dcd2d0f
🔀 merge(main): edge trim beside the colour drag on the root carriers Both features hang a drag off the root's mouse-move and mouse-up, which is where they collided. Kept both, in press-target order: equalizer, trim, colour, scrub. They cannot overlap -- a gesture belongs to whatever was pressed, and no two of those hitboxes are the same element.
✨ feat(audio): a song opens as a timeline of its ownAhmet Kaan Gümüş · eb9a278
✨ feat(audio): a song opens as a timeline of its own An audio file could not start a project: `PlaybackSession::open` refused every `is_audio` path because a timeline was scaffolded from source 0's *picture*. It now scaffolds the canvas instead -- 1080p at 30 fps H.264, the rate a later video import is held to -- takes its length from the audio, puts the one clip on `A1` and leaves the video lane empty, so the existing gap path plays it black while the song keeps the clock. `open_project` does the same when source 0 has no picture, so an audio-only `.edith` loads. An mp4 of such a timeline is refused by name in `export::start` (it would be black over the sound) and the export card says so on the MP4 row before a destination is picked; WAV and FLAC export as they always did. The Export button now re-asks that question too, since mp4 is the default and a timeline can lose its picture after the format was chosen.
✨ feat(timeline): clips are trimmed by dragging their edgesAhmet Kaan Gümüş · 222336b
✨ feat(timeline): clips are trimmed by dragging their edges A 6 px strip at each end of a clip box takes the press the body-drag would otherwise take (gpui `occlude`), so one gesture stays one thing: an edge trims, the middle still moves the clip to another lane, and both ends still select and open the clip menu. The box follows the pointer while the button is down and the engine hears about it once, at the release -- one edit, one undo step for the whole drag, exactly as an equalizer gesture works. `Project::trim` clamps rather than refuses: one frame of clip always survives, an edge never crosses its neighbour on the lane, an in-point never walks back past the source's first frame, and an out-point never runs past the file's own last frame -- a clip ending past it is a project that will not open again. `Project` does not know how long a file is, so `PlaybackSession` now keeps the frame counts it already computes at every import and fills them in. Linked halves trim together to one clamped edge, the tightest wall of the group winning, because a link is one span on however many lanes. `trim_room` is the same clamp without the mutation: the drag asks it where the edge may land, so the width drawn is the width the release commits. A timeline drawn to fit the window has no room past its own last frame, so while a tail is dragged the bed is drawn out to as far as that tail may go -- without it the last clip could be pulled in and never let back out.
✨ feat(colour): sliders are dragged and the graded frame is drawn over themAhmet Kaan Gümüş · 8d8d880
✨ feat(colour): sliders are dragged and the graded frame is drawn over them The colour card loses its stepper buttons: each row's bar is now pressed and pulled straight to a value, which is what a slider is for. The press takes the undo step and every sample after it is a live write (`set_color_live`), so a whole drag is one `z` rather than one per pixel -- and because a live write reseeks like any other edit, the picture regrades under the hand. Above the rows, an RGB histogram of the frame on screen: counted off the BGRA the decoder handed over, which is already through the grade, so pulling brightness tilts the graph as it moves. Every 253rd pixel of a 1080p frame (HIST_SAMPLES), 64 bins a channel, square-rooted so a flat black area does not draw the rest as a line. The arrow keys still move the same values, on the same 0.05 grid a drag snaps to, and the bar is 4 px to look at but a whole row to hit.
✨ feat(timeline): the last clip deletes and the timeline emptiesAhmet Kaan Gümüş · 9a6ef81
✨ feat(timeline): the last clip deletes and the timeline empties The never-empty-TIMELINE invariant is gone: an emptied timeline is now a state of the model, not an edge case a refusal kept unreachable. Emptiness is honest all the way down -- `PlaybackSession::span` is an `Option<Span>` whose `None` *is* the empty timeline, and `start_span` feeds it one black frame, so the viewer shows the nothing that is there rather than the last picture of the clip that was deleted. * `Project::lift` and `Project::ripple_delete` refuse only what is not an edit (a bad index, an empty range, a delete with nothing left to take -- the last so a no-op still costs no undo step); * `Project::from_parts` and the `.edith` loader take an all-empty project and refuse a *laneless* one instead, which is the invariant that was really being defended; * `without_orphan_sources` keeps source 0 when no clip names anything: it carries the frame rate the timeline counts in, and pruning it wrote a project that could not be loaded back; * the app's two "the timeline cannot be emptied" notices are gone, and an export of an empty timeline is refused by name instead of writing a file of no frames. The never-empty-CLIP invariant (len >= 1) is untouched.
✨ feat(timeline): clips drag from one track to anotherAhmet Kaan Gümüş · 28fe52d
✨ feat(timeline): clips drag from one track to another A clip already on the timeline is now a drag source, and a lane bed takes one: dropped on another lane of the same kind it moves there, keeping the timeline frames it covered, as a single undo step. Its group id travels with it, which desyncs nothing -- a link means "one span, however many lanes" and names no lane -- so a picture moved to V2 is still the take its sound belongs to. Refused by name rather than overwriting: a picture let go on an audio lane (and the other way round), and a landing that would touch a clip already there, which `place` would have painted over.
🐛 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(timeline): clips select from the keyboardAhmet Kaan Gümüş · cc90921
✨ feat(timeline): clips select from the keyboard tab selects the clip under the playhead -- again for the next lane's -- and [ / ] walk the selection along its own lane, wrapping at both ends. shift+tab stays unspellable (a chord carries only ctrl and parse refuses an uppercase key), so the brackets are the pair. One selection and not a second: every door -- click, right-click, all three keys -- goes through Player::select, so the group-scoped tint a click draws is the tint a key draws. Project::lane_clip_at is what the walk asks, per lane, rather than the UI re-deriving where a clip ends. This is what makes delete, lift, the equalizer and the grade reachable with no pointer at all: the equalizer card had never been rendered live, because nothing but a click could select the audio clip it needs.
✨ feat(engine): project resolution stands apart from media resolutionAhmet Kaan Gümüş · 19e294a
✨ feat(engine): project resolution stands apart from media resolution A timeline had one resolution because its first source did: import refused anything else by name, and there was nowhere to say otherwise. A project now carries its own picture size and every clip is composed onto it, so media of different resolutions share a timeline the way they do in any editor. * scale::Composer is the one definition of that composition -- fit_rect, scale_i420, compose_i420 onto a black canvas -- and both playback and export call it, so what is written is what was watched. A canvas of the picture's own size is a pass-through that allocates nothing and touches no byte. * Grade first, place second: a grade belongs to the clip's pixels at the resolution they were shot at, and the letterbox bars are not the clip. * Per-clip fit policy (fit/fill/stretch/centre), one byte inline in Clip -- it lands in padding the clip already had. * .edith v7: a `resolution <w> <h>` line and a fit word per clip line. v6..v1 still load, defaulting to source 0's picture and Fit, which is what those projects always meant. * The fps refusal stays: mixing frame rates is resampling the timeline, a different problem, and a refusal is the honest answer until it is solved. * UI: `p` cycles the fit policy of the clip on screen (and a clip-menu item), ctrl+r cycles the project resolution through the usual sizes with the media's own among them, and the export card says which size it writes.
✨ feat(video): per-clip color grade is live in render and exportAhmet Kaan Gümüş · bd89527
✨ feat(video): per-clip color grade is live in render and export The grade a clip carries now reaches the picture. `Project::composite_clip_at` names the clip the composite shows at a frame and `composite_color_at` its grade, so playback's decode worker (folded into `i420_to_bgra_with`, free in the loop that was reading those samples anyway) and the export's encoder (onto per-span scratch, since the planes are borrowed) grade from one answer. `PlaybackSession::set_color` is an edit like any other, so it reseeks -- which is what repaints the frame already on screen, paused or playing. The card: `k` (or the clip menu's Colour…) opens four sliders on the selected video clip, or on the clip under the playhead when nothing is selected, so it is reachable with no pointer at all. Arrows pick and move a slider, r resets, esc closes; a slider walked back to the middle takes the grade off, which keeps an ungraded project byte-identical -- verified: the same two-clip export before and after this slice is md5 98522c19cefac2f7851b51de6416a493 both times.
✨ feat(audio): per-clip equalizer is live in playback and exportAhmet Kaan Gümüş · 4d92155
✨ feat(audio): per-clip equalizer is live in playback and export The model, the format and the filter have all existed with no callers. This wires them: `Project::audio_eqs_from` hands one curve per segment beside the play list `audio_segments_from` already builds, `open_mixed_streams_eq` gives each lane's worker those curves, and `emit` -- the one place both readers hand their samples over -- filters a segment after it is trimmed and before it is sent. Playback and an audio export therefore get the same filtered stream by construction rather than by two call sites agreeing. A parallel list, not a fourth element of the segment tuple: that tuple is what every opener, the packet-copy path and a dozen tests speak, and an effect is not part of which samples a segment names. A short list plays flat, so a mismatch can neither panic nor shift a curve onto the wrong clip. Live editing needs no channel into a running worker: `set_eq` is an edit and every edit reseeks, so the workers are rebuilt from the new curves where the playhead is standing. An mp4 export copies AAC packets and no filter can reach a copy, so an equalized clip is refused by name and by timecode rather than written flat. The card is the third of its kind (same scrim, width and rows as keys and export): a row per band, dragged from the middle out, with `q` to open it and 1-5 / up / down / r as its own keyboard, every one of them listed in the keys menu by the registry the guard test reads.
✨ feat(timeline): every lane draws and tracks can be addedAhmet Kaan Gümüş · 30e8aae
✨ feat(timeline): every lane draws and tracks can be added The panel drew V1 and A1 and nothing else, so the N-lane model, the composite playback and the v6 format had no way into the window. It now draws a row per project lane, labelled from Lane::label, and grows the panel per row up to a cap past which the lane column scrolls. + V / + A -- and the v / a chords, in the registry so the keys menu lists them -- add a track; undo takes one back like any other edit. The V1/A1 pinning the last two slices flagged is gone: delete_clip takes the lane its index belongs to (Project::delete_in), a drop names the lane it was let go over (place_stream_at's onto), and whole_take decides ripple-or-lift per lane -- a clip on an added track is a layer and is lifted, while the first pair keeps exactly the semantics it had. Project::paste now inserts into V1/A1 only while still opening room everywhere, or an Add with three lanes would have played one sound twice. The export card greys MP4 out with its reason when more than one audio lane carries sound, on the row and on the m chord both, so the engine's refusal arrives before a destination is picked.
✨ feat(engine): per-clip color persists in .edith v6Ahmet Kaan Gümüş · 0530fc9
✨ feat(engine): per-clip color persists in .edith v6 A clip names a colour grade the way it names an equalizer: an index into an append-only Project table, deduped on set, pruned at save, inherited by both halves of a split and carried by copy, paste and undo. The file format grows a color <b>:<c>:<s>:<t> line and a 7th clip field; v5..v1 still load and every one of them re-saves as v6. Clip grew from 32 to 40 bytes -- the eq index fit the padding hole, the colour one did not.
✨ feat(engine): N-lane compositing in playback and exportAhmet Kaan Gümüş · 08af6bc
✨ feat(engine): N-lane compositing in playback and export Video: the topmost video lane with a clip there wins, topmost being the last lane in display order (V2 over V1, the overlay convention). No blending, so exactly one lane is visible per frame and the composite is itself a span list -- Project::composite_span_at -- which one decoder plays. N video lanes never mean N decoders; a lane change costs the one decoder reopen a cut already costs. Audio: every audio lane that holds something gets a play list (Project::audio_segments_from) and AudioSession::open_mixed_streams sums them, clamped, each lane keeping its own gap rule so the master clock counts a sample per sample of timeline. One lane skips the mixer entirely and is the byte-for- byte path it always was. Export walks the same composite and mixes the same lanes for WAV/FLAC. The mp4 path copies AAC packets and cannot mix, so a timeline whose sound is spread over two lanes is refused there by name rather than silently exported without half of it.
✨ feat(engine): per-clip EQ persists in .edith v5Ahmet Kaan Gümüş · 782fc53
✨ feat(engine): per-clip EQ persists in .edith v5
A clip names its equalizer by index into a project-level table, the way it
already names its source: `Clip` stays `Copy`, so a split hands both halves the
same settings, a clipboard copy carries them and an undo restores whichever
index the clip had. The table is append-only within a session -- an index on a
clipboard clip or in an undo snapshot can never dangle -- and only a save prunes
it, exactly as an undone import leaves its source entry behind.
The file grows `eq <band>...` lines (freq:gain:q:shape, printed `{:?}` so every
f32 comes back bit for bit) and one more clip field naming one of them. v4, v3,
v2 and v1 still load and re-save as v5.♻️ refactor(engine): the project holds N lanes, V1..Vn and A1..AnAhmet Kaan Gümüş · b474a9b
♻️ refactor(engine): the project holds N lanes, V1..Vn and A1..An Merge of the multi-lane winner (candidate B) onto the S5a main, plus the three grafts the judge picked out of candidate A and the delete-selected fix it flagged: * LaneData::two_lanes(), one place for the pair single() and from_parts() both build; * a_group_may_span_any_lane: hand-built lanes driving links_are_consistent directly -- one take on V1 + A2 with the lanes between it empty is legal, and both ways to break the rule are asserted by their exact message; * add_lane doc: an empty new lane is legal even though from_parts refuses an all-empty project -- the lanes that were there still hold the timeline; * delete_selected is exhaustive over lane.kind and explicit about ord: it hands V1/A1 indexes to engine calls that mean V1/A1, so a second-lane selection would have deleted a different clip under a _ => false wildcard. Conflicts, all against the S5a Source model: without_orphan_sources keeps B's crate::Result and its >1-lane-per-kind refusal but returns Vec<Source>, and Lane::Audio in place_stream_at/import_audio became Lane::A1.
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.
♻️ refactor(engine): the project holds N lanes, V1..Vn and A1..AnAhmet Kaan Gümüş · 154fd69
♻️ refactor(engine): the project holds N lanes, V1..Vn and A1..An
The edit list was a fixed pair -- `Lane` {Video, Audio}, `lanes: [Vec<Clip>; 2]`
and seven hundred lines of methods walking that pair by hand. Multi-lane UI,
per-lane compositing and per-clip EQ all want lanes to be a list, so make them
one now, while the model is small enough to change in one sitting.
`Lane` becomes a handle -- a `LaneKind` plus a 0-based `ord`, so `Lane::V1` is
the first video lane and `Lane::new(Audio, 1)` is A2 -- and the project stores
`Vec<LaneData>`, a struct that per-lane state (mute, compositing mode, a name)
can grow into. A handle naming a lane that is not there reads as an empty lane
and refuses every mutation, so a front-end that only ever asks for V1/A1 needs
no bounds check of its own. Every method is a walk over the lane list now
instead of two hand-written cases.
The grouping rule generalises rather than pairing lanes off: a link id names at
most one clip per lane and every clip carrying it covers the same span, on
however many lanes. So a split hands out one id per group of lanes whose halves
line up -- one helper, used by split and regroup alike.
Playback, export and the audio worker still read V1 and A1: compositing is its
own slice. So is the file format, which holds one lane keyword per kind, so a
save of more than two lanes is refused by name instead of silently dropping
one; a two-lane project writes exactly the bytes it always did.✨ feat(engine): VP9 import via the VA-API pluginAhmet Kaan Gümüş · 03a34d3
✨ feat(engine): VP9 import via the VA-API plugin The demuxer takes a vp09 track alongside avc1 and hands its samples through untouched -- an mp4 VP9 sample is a self-contained superframe, so there is no avcC repack and no parameter sets to re-inject. VideoMeta carries the codec, and the plugin picks its cros-codecs decoder from it. The C ABI is unchanged on purpose: the plugin demuxes the file it is given, so the codec is a property of the container rather than of the call, and a libengine_hw.so built before this still loads and still decodes H.264 -- it simply returns null for a VP9 path, the same no it gives for an unsupported profile. There is no software VP9 decoder to fall back to, so a VP9 file the plugin will not take is refused at open, by name, where the front-end can show it -- never a black screen, and never VP9 bytes fed to rusty_h264. One timeline stays one codec, and export re-encodes to H.264 as before; only audio is ever copied packet for packet.
✨ feat(library): every audio stream is a row, and the picked one plays and exportsAhmet Kaan Gümüş · ecb5e06
✨ feat(library): every audio stream is a row, and the picked one plays and exports A file with one audio track per language is one row per track now, not one row per file. The engine carries the pick end to end: a source is a (file, audio stream) pair, .edith v3 writes the stream on the source line, playback opens it and — the trap this closes — the export copies *that* stream's packets rather than always stream 0. Streams that cannot go on the timeline are listed greyed with the reason instead of hidden: a codec we cannot read, or a rate/layout that cannot share one output device and one copied AAC track with the rest of the timeline (there is no resampler here and no AAC encoder to write a join with). place_stream_at is the one door a row goes through, and it refuses those in the engine's own words. - v2 and v1 files still load: no stream field means stream 0, which is all those dialects could play; saving either writes v3. - Waveform peaks are keyed by file *and* stream, so two tracks of one file cannot draw each other's envelope. - Library swatches and clip tints follow the *file*, so a file's streams share one colour in the panel and on the lanes. - assets/test_multilang.mp4: two AAC 44.1k stereo streams (und, fra), the shape real multi-language media has and the one where a second stream is placeable.
🐛 fix(engine): NTSC frame rates survive the sample tableAhmet Kaan Gümüş · 3f81ef8
🐛 fix(engine): NTSC frame rates survive the sample table `mp4 0.14`'s `Mp4Track::frame_rate` divides the sample count by whole milliseconds before the float cast, so 24000/1001 read back as a flat 23.0: the picture the audio-sample master clock asked for was 4 % out and the drift grew with the film — five minutes of it by the end of a two-hour one. The frame rate now comes off the stts totals in f64, which is exactly `timescale / delta` for a constant table and an average for a spread one. The same truncation lived at the writing end (a 90 kHz clock cannot count 23.976 fps in whole ticks), so the muxer picks a timescale that can: 90 kHz wherever it divides exactly — every integer rate, so those exports are byte for byte what they were — and `round(fps * 1001)` over 1001 ticks otherwise, which is exact for the whole NTSC family. The hardware encoder gets that same rational instead of a rounded `fps * 1000`. The video edit list is honoured now too, the way the audio one always was — but only what it really trims: a `media_time` equal to the first `ctts` offset is the B-frame composition delay, not a cut, and reading it as one throws two real frames away. A file whose audio we cannot decode at all (an AC-3 remux) played silent with the reason on stderr; the session carries it now and the window says NO AUDIO in its notice bar.
🐛 fix(engine): a refused project load cannot hang on its own decoderAhmet Kaan Gümüş · 771cd4a
🐛 fix(engine): a refused project load cannot hang on its own decoder `open_project` starts decoding source 0 before it validates anything, so by the time a later source is refused that worker has filled the two-frame channel and parked in `send`. The receiver and the worker were two locals, and locals drop in reverse order of declaration: the worker joined a decode thread that only the receiver beside it could ever wake. The app froze on a bad project file instead of showing the error. The two are one value now. `FrameStream` holds the receiver first and the worker second, and Rust drops fields in declaration order, so the disconnect always precedes the join -- in an early return, on an unwind, and in call sites not written yet. Nothing on the seek path changes: `start_span` still installs the new receiver and parks the old worker in the retire list without ever joining. The device moves below the validation for the same reason. Its feeder thread outlives the `Audio` value and only a session's `drop` retires it, so a refusal above that line left a PipeWire stream and a thread behind for a project that never opened. Tests: dropping a stream whose frames nobody took returns instead of hanging (10 s bound; hangs if the two fields are swapped), and the refusal path itself with enough sources that the park is certain -- 60 s hang before the fix, 0.04 s after.
✨ feat(timeline): two lanes, waveforms, group-scoped selectionAhmet Kaan Gümüş · 591afa3
✨ feat(timeline): two lanes, waveforms, group-scoped selection V1 and A1 get a fixed header column and a bed of their own, both offset by the same constants the ruler now is, so one x maps to one moment in all three rows. Clips are placed at their own start rather than queued edge to edge: a lift leaves a hole and the bare bed showing through it is how a gap looks. Audio clips paint their source's min/max envelope, cached per file and normalised to its own loudest sample -- the fixtures peak near an eighth of full scale and would otherwise draw as a flat line. A click marks the whole group and acts on the half it landed on, which is what makes a detached half separately deletable. Two actions the lane model owed a key: Regroup rejoins what a Cut split, Lift removes one half and leaves the gap. Both auto-list in the keybindings overlay and are rebindable like the rest. `PlaybackSession::lane_clips` is the one engine addition: link ids and source ranges are what a two-lane front-end draws with, and no existing accessor carries either.
✨ feat(engine): real silent AAC for export gaps, link + overflow guardsAhmet Kaan Gümüş · 301e29b
✨ feat(engine): real silent AAC for export gaps, link + overflow guards Grafts the losing candidate's hand-written AAC-LC silence into the offset-placed lanes: a gap in the audio lane is copied as max_sfb=0 access units (4 bytes mono, 7 stereo, verified against our own decoder) instead of being spent as stts duration on the packet in front of it. That retires the 23 ms leading-gap misplacement, so every packet is one 1024-frame sample table entry again and the muxer takes no duration. from_parts becomes the release-active untrusted door it claims to be: per-cause errors, an end-overflow bound, and the grouping rules -- a link id names at most one clip per lane, and a pair covers one span. The parser bounds the same overflow by line number, `place` strips the incoming group id, and the two lane surgeries (`clear`, `open_room`) drop the id from what they cut, which is where duplicates came from.
🔊 feat(audio): volume and mute for the monitoring outputAhmet Kaan Gümüş · bb07bdc
🔊 feat(audio): volume and mute for the monitoring output One knob down the stack: `ao_set_volume(handle, gain)` scales the samples in the RT callback, and mute is a gain of 0.0. Not the stream's PipeWire volume control -- WirePlumber persists every Props change into its restore state (measured on this box: the bucket gains `mute:true` ~2 s later), so a mute keypress would have become "edith has no sound" in tomorrow's system mixer, which is the bug 9ab4ebd just finished removing. Volume and mute stay independent: turning the level down while muted must not be what makes sound come out. The button says both at once. Mute is not pause -- the frames are still consumed, so the device clock, and with it the picture, runs straight through. The keybindings card's row list now scrolls inside a cap, which is the upgrade path its own ponytail named: three more actions no longer fit a 360 px window, and now no number of them can stop fitting.
✨ feat(engine): video+audio lanes with offset-placed clips, gaps, .edith v2Ahmet Kaan Gümüş · 59eb78e
✨ feat(engine): video+audio lanes with offset-placed clips, gaps, .edith v2 Project gains two lanes; a Clip now carries `start` (its timeline placement) and `link` (group id), so a gap is simply the absence of a placement rather than an object anyone has to keep in sync. Moves and trims become arithmetic on start/in_frame; the lane invariant (sorted, non-overlapping) is checked in from_parts, at the .edith parser, and asserted after every mutation. split cuts every lane and hands the two sides fresh group ids; regroup is its exact inverse. delete still ripples both lanes (the app keeps its behaviour), lift removes one placement and leaves a hole, place is the per-lane overwrite that can make one. A video gap plays as black frames from a worker that opens no file -- same channel, backpressure, cancel and retire path as a decoder -- and exports as encoded black. An audio gap is synthesised zero chunks, real ones, so the master clock keeps counting through it; on the export side it is spent as stts duration on the packet beside it, since there is no AAC encoder to make silence with. .edith v2 writes one line per placement per lane; v1 files still load, as fully-grouped gapless lanes, and save as v2.
2026-08-09
✨ feat(export): ExportSettings for bitrate and software-encoder pinAhmet Kaan Gümüş · 2c9c3a2Browse files
⚡ perf(playback): retire cancelled workers off the seek pathAhmet Kaan Gümüş · 3adbaf7
⚡ perf(playback): retire cancelled workers off the seek path Joining the outgoing decode worker inline made a seek pay whatever VA-API init that worker was still inside -- 98.4 ms worst case against 1.6 ms before the join landed, i.e. a scrub capped at ~10 seeks/s with a visible hitch per step. Cancelled workers now go into a retire list instead. Every seek sweeps it, dropping only the ones whose thread has already returned (`is_finished`, never a wait), and the session's drop joins whatever is left along with the running worker -- so the exit guarantee is untouched: no decode worker outlives its session, and none can be inside libva when Mesa's atexit handlers run. Worst seek back to 4.7-6.1 ms over three drill runs. Open+drop stays at ~13.5 ms, which is the same join as before and a session drops rarely. Retire list peaked at 16 under a back-to-back 20-seek loop -- a UI scrub leaves far more time between steps.
🐛 fix(decode): join workers on drop — Mesa atexit race killed exiting processesAhmet Kaan Gümüş · 9276137
🐛 fix(decode): join workers on drop — Mesa atexit race killed exiting processes A decode worker was spawned detached and nothing ever waited for it, so a process could exit while a worker sat inside `vaInitialize`. Mesa frees its process name from an `atexit` handler and the worker then reads it back NULL: SIGSEGV at exit, 9 runs in 20 of the saveload suite. `DecodeSession::open_worker` now hands the caller a `Worker` that owns the `JoinHandle`; dropping or replacing one cancels and joins. `PlaybackSession` holds one, so a seek, a clip boundary and the session's own drop all wait for the worker they abandon. The worker also checks the cancel flag before and after opening the hardware session, so a cancelled one never enters VA-API init at all. Public `open`/`open_at`/`open_range` are unchanged.
✨ 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): multi-source model + segmented multi-file audioAhmet Kaan Gümüş · 5593a9f
✨ feat(engine): multi-source model + segmented multi-file audio Wave 1 of the import slice: the timeline model and the audio backend both learn about several source files. Nothing user-visible yet — every clip is still source 0 until playback/export traversal lands. S1 — project.rs model + mechanical call-site fixes: - Clip gains `source: usize` (Clip stays Copy, so clipboard/undo semantics are untouched); Project gains an append-only `sources: Vec<PathBuf>`. - Import splits in two: `import(path) -> usize` is dedup-only and pushes no history, `append_clip(source_idx, frame_count) -> bool` pushes the one snapshot — an import stays exactly one undo step, and append_clip refuses an unknown index. - Dedup key is fs::canonicalize with a raw-path fallback, so Project stays pure data and an unreadable path still gets an index. - cut/paste carry the source through `..self.clips[idx]` struct-update. - `segments_from` now yields (source, start, end) triples; playback.rs and export.rs strip the index and keep feeding the single-source audio fns. S2 — audio.rs Track/probe/bit-exact joins: - New private `Track` resolves one source once (reader, copied stts, own priming, params, sample_count). - `open_multi_segments` / `copy_multi_segments` take the source triples; `open_segments` / `copy_segments` are now one-source wrappers, so every existing call site compiles unchanged. - Each source contributes its own priming and length; the timeline sample counter and the bresenham rounding debt both run continuously across a source join, and the extra priming packet stays the first segment's alone. - `AudioSession::probe(path) -> Option<AudioProbe>` exposes the fields import validation needs. - Cross-source decode is bit-exact against single-file open_at on both sides of a join (max abs diff 0e0).
✨ 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: copy/paste clips at playheadAhmet Kaan Gümüş · aae5734
✨ feat: copy/paste clips at playhead Project::paste splices a clip in at a timeline position, splitting the clip under it when the position is mid-clip and appending past the end. One history snapshot, so one undo takes a paste back. PlaybackSession::clip_at hands a clip out for copying and paste_at goes through the same edit() reseek as delete/undo. The app keeps an Option<Clip> clipboard on ctrl+c / ctrl+v.
🧹 chore(playback): S6 follow-ups — epsilon frame conversion, drop dead frames()Ahmet Kaan Gümüş · 79c1a91
🧹 chore(playback): S6 follow-ups — epsilon frame conversion, drop dead frames() secs_to_frame with 1e-6 epsilon: bare truncation landed one frame early for boundary seconds (122.999... -> 122); floor semantics kept for mid-frame positions. frames() getter had zero callers since the app moved to try_frame().