From 7d2251c5e2726d8bb245a34e92b2fb94cdc47cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 9 Aug 2026 17:31:15 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(playback):=20edit-list=20trave?= =?UTF-8?q?rsal=20=E2=80=94=20timeline=20frames,=20cut/delete/undo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- crates/engine/src/playback.rs | 173 ++++++++++++++++++++-- crates/engine/tests/playback.rs | 255 +++++++++++++++++++++++++++----- 2 files changed, 376 insertions(+), 52 deletions(-) diff --git a/crates/engine/src/playback.rs b/crates/engine/src/playback.rs index 12d11e3..6299886 100644 --- a/crates/engine/src/playback.rs +++ b/crates/engine/src/playback.rs @@ -12,7 +12,7 @@ use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; -use std::sync::mpsc::Receiver; +use std::sync::mpsc::{Receiver, TryRecvError}; use std::sync::{Arc, Mutex}; use std::thread; use std::time::Duration; @@ -22,6 +22,7 @@ use crate::audio::{AudioChunk, AudioSession}; use crate::clock::{ClockSource, PlaybackClock}; use crate::decode::{DecodeSession, Frame}; use crate::demux::VideoMeta; +use crate::project::{Clip, Project}; /// How long the feeder waits out a full ring. The ring holds a second, so this /// only has to be short next to that; it costs one wakeup per 10 ms of audio. @@ -89,6 +90,17 @@ pub struct PlaybackSession { cancel: Arc, clock: PlaybackClock, audio: Option