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