forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to crates/engine/src/playback.rsClear filter

2026-08-09

✨ 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().
✨ 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(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
🐛 fix(playback): dead audio output froze the clock foreverAhmet Kaan Gümüş · 752c6a0
🐛 fix(playback): dead audio output froze the clock forever

Verifier finding: feed() noticed the plugin dying (write -> None) but
only set fed_all; tick()'s switch-to-wall needed position >= fed,
which a frozen position can never satisfy. Explicit died flag now
hands the timeline to wall time on the next tick.
✨ 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.