Commits
Commits on
8c7bf808ae19e1655737ac07a94de22b5002565fFiltered to crates/engine/tests/playback.rsClear filter2026-08-10
✨ 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(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.
♻️ 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.
♻️ 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(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.
🔇 test(engine): the lane and gap tests go through the muted open() tooAhmet Kaan Gümüş · 0f5e259
🔇 test(engine): the lane and gap tests go through the muted open() too Resolves the merge of e1d090d by hand where git resolved it textually: the two sessions this branch added opened the device at full gain, and the audio one plays 2.4 s of a real file. Both go through the silent helper now. Neither loses anything by it -- what they asserts is the clock, the frame numbering and the picture, none of which the last multiply before the device can change; the silence of a gap is proved off the decoder in audio_segments, with no device at all. The leading-gap copy assertion moves with the priming packet: a hole at the head is its own length plus the one packet a reader drops.
🔇 test(audio): silence the suites that reach the speakerAhmet Kaan Gümüş · 522149d
🔇 test(audio): silence the suites that reach the speaker `cargo test` played real files out of the real device: measured 0.37 of full scale on the sink monitor, 818k nonzero samples, for as long as the playback suite ran. That is somebody's desk, every run. Both suites now open through a helper that sets the gain to zero. Nothing else changes: the stream is still connected and scheduled, the samples are still decoded, written and handed over, and every assertion here is measured from the device's own position, which the gain does not touch. The one test that walks through audible gains does it on a flushed ring, where there is nothing but the underrun fill to apply them to. Measured after: peak 0, not one nonzero sample, all three suites green.
✨ 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
🎨 style: rustfmt drift in playback testsAhmet Kaan Gümüş · 4c831c1
🎨 style: rustfmt drift in playback tests Formatting only -- no test changed, `cargo fmt --check -p engine` is clean again.
🧪 test(playback): commit paste-while-playing and paste-at-EOS coverageAhmet Kaan Gümüş · a178b73Browse files
🧪 test(playback): commit import-during-play and undo-after-import coverageAhmet Kaan Gümüş · 37f2bfeBrowse files
✨ 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: 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.
✨ feat(playback): edit-list traversal — timeline frames, cut/delete/undoAhmet Kaan Gümüş · 7d2251c
✨ feat(playback): edit-list traversal — timeline frames, cut/delete/undo PlaybackSession owns a Project. try_frame() rewrites every frame index from source to timeline and reopens the next clip's range when a worker ends, so a timeline of clips plays as one contiguous sequence; is_eos() is the real end. seek() maps timeline seconds through the edit list and feeds the audio worker one segment list for the whole rest of the timeline, so clip joins are gapless. cut_at is metadata only, delete_clip/undo reseek onto the new mapping. frames() stays for now: the app switches to try_frame in the UI slice.
✨ feat(playback): seek — rebuild workers, epoch-guarded feeder, clock re-anchorAhmet Kaan Gümüş · e4ca3bd
✨ feat(playback): seek — rebuild workers, epoch-guarded feeder, clock re-anchor PlaybackSession::seek(secs) replaces both decode workers instead of steering them: a fresh channel cannot hold a stale frame, and it works after EOF where the old workers have already exited. The audio device stays open across a seek. An epoch counter, bumped and flushed while holding the device lock and re-checked by the feeder inside that same lock right before every write, is what stops a superseded feeder from landing stale PCM behind the flush. `fed` is re-based on the device position, which keeps counting across a flush, so the audio-EOF test stays exact.
✨ 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.