Commits
2026-08-10
🐛 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