From 7f4c9210e7414ba038d7e56327d217894a00a4de 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 23:50:18 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20rename:=20project=20is=20edith?= =?UTF-8?q?=20=E2=80=94=20.edith=20extension,=20edith=20binary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 18 ++++---- crates/app/Cargo.toml | 4 +- crates/engine/src/{veproj.rs => edith.rs} | 40 +++++++++--------- crates/engine/src/lib.rs | 2 +- crates/engine/src/playback.rs | 8 ++-- crates/engine/src/project.rs | 2 +- crates/engine/tests/saveload.rs | 50 +++++++++++------------ 7 files changed, 62 insertions(+), 62 deletions(-) rename crates/engine/src/{veproj.rs => edith.rs} (91%) diff --git a/Cargo.lock b/Cargo.lock index 0616864..405b392 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,15 +82,6 @@ version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" -[[package]] -name = "app" -version = "0.1.0" -dependencies = [ - "engine", - "gpui", - "image", -] - [[package]] name = "ar_archive_writer" version = "0.5.3" @@ -1570,6 +1561,15 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" +[[package]] +name = "edith" +version = "0.1.0" +dependencies = [ + "engine", + "gpui", + "image", +] + [[package]] name = "either" version = "1.17.0" diff --git a/crates/app/Cargo.toml b/crates/app/Cargo.toml index 4449c3d..b849730 100644 --- a/crates/app/Cargo.toml +++ b/crates/app/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "app" +name = "edith" version.workspace = true edition.workspace = true [[bin]] -name = "app" +name = "edith" path = "src/main.rs" [dependencies] diff --git a/crates/engine/src/veproj.rs b/crates/engine/src/edith.rs similarity index 91% rename from crates/engine/src/veproj.rs rename to crates/engine/src/edith.rs index 038b4e5..ce3908b 100644 --- a/crates/engine/src/veproj.rs +++ b/crates/engine/src/edith.rs @@ -1,7 +1,7 @@ //! The project file: a line of text per thing, and nothing else. //! //! ```text -//! veproj 1 +//! edith 1 //! playhead 90 //! source test_av.mp4 //! source /elsewhere/test_av2.mp4 @@ -14,7 +14,7 @@ //! So the path field is byte-escaped (`%` -> `%25`, newline -> `%0A`, which is //! everything a line-based format cannot carry) and survives round-trip //! exactly. Paths under the project file's own directory are written relative -//! to it, so a folder holding the media and the `.veproj` can be moved or +//! to it, so a folder holding the media and the `.edith` can be moved or //! copied anywhere and still open; anything else is absolute. //! //! The parser is strict and every refusal names its 1-based line: a project @@ -33,8 +33,8 @@ use std::path::{Path, PathBuf}; use crate::project::Clip; /// First line, exactly. The version is part of it: a v2 reader will accept a -/// `veproj 1` file, and a v1 reader refuses a `veproj 2` one by name. -const MAGIC: &[u8] = b"veproj 1"; +/// `edith 1` file, and a v1 reader refuses a `edith 2` one by name. +const MAGIC: &[u8] = b"edith 1"; /// What a project file says: an edit list plus where the playhead stood. /// Structurally valid by construction -- see [`parse`]. @@ -94,9 +94,9 @@ fn parse(data: &[u8], dir: &Path) -> crate::Result { let mut lines = body.split(|&b| b == b'\n').enumerate(); let (_, first) = lines.next().unwrap_or((0, &[])); if first != MAGIC { - return Err(match first.strip_prefix(b"veproj ") { + return Err(match first.strip_prefix(b"edith ") { Some(v) => format!("line 1: unsupported version {}", String::from_utf8_lossy(v)), - None => "line 1: not a veproj file".to_string(), + None => "line 1: not a edith file".to_string(), } .into()); } @@ -262,7 +262,7 @@ mod tests { let bytes = emit(&dir, &sources, &clips, 12); assert_eq!( String::from_utf8_lossy(&bytes), - "veproj 1\nplayhead 12\nsource a.mp4\nsource /elsewhere/b.mp4\nclip 0 30 0\nclip 10 20 1\n", + "edith 1\nplayhead 12\nsource a.mp4\nsource /elsewhere/b.mp4\nclip 0 30 0\nclip 10 20 1\n", "the file under the project directory is written relative to it" ); let back = parse(&bytes, &dir).expect("parse"); @@ -291,14 +291,14 @@ mod tests { #[test] fn a_wrong_first_line_is_refused_by_name() { let dir = PathBuf::from("/proj"); - let err = parse(b"veproj 2\nsource a.mp4\nclip 0 5 0\n", &dir) + let err = parse(b"edith 2\nsource a.mp4\nclip 0 5 0\n", &dir) .unwrap_err() .to_string(); assert_eq!(err, "line 1: unsupported version 2"); for junk in [&b""[..], b"{}\n", b"source a.mp4\n"] { assert_eq!( parse(junk, &dir).unwrap_err().to_string(), - "line 1: not a veproj file" + "line 1: not a edith file" ); } } @@ -308,35 +308,35 @@ mod tests { let dir = PathBuf::from("/proj"); let cases: [(&[u8], &str); 8] = [ ( - b"veproj 1\nsource a.mp4\nclip 0 5\n", + b"edith 1\nsource a.mp4\nclip 0 5\n", "line 3: clip wants 3 fields, found 2", ), ( - b"veproj 1\nsource a.mp4\nclip 0 five 0\n", + b"edith 1\nsource a.mp4\nclip 0 five 0\n", "line 3: \"five\" is not a number", ), ( - b"veproj 1\nsource a.mp4\nclip 5 5 0\n", + b"edith 1\nsource a.mp4\nclip 5 5 0\n", "line 3: clip [5, 5) is empty", ), ( - b"veproj 1\nsource a.mp4\nclip 7 5 0\n", + b"edith 1\nsource a.mp4\nclip 7 5 0\n", "line 3: clip [7, 5) is empty", ), ( - b"veproj 1\nsource a.mp4\nclip 0 5 1\n", + b"edith 1\nsource a.mp4\nclip 0 5 1\n", "line 3: clip names source 1 of 1", ), ( - b"veproj 1\nsource a.mp4\nclip 0 5 0\nsource b.mp4\n", + b"edith 1\nsource a.mp4\nclip 0 5 0\nsource b.mp4\n", "line 4: source after a clip", ), ( - b"veproj 1\nsource a.mp4\n\nclip 0 5 0\n", + b"edith 1\nsource a.mp4\n\nclip 0 5 0\n", "line 3: unknown keyword \"\"", ), ( - b"veproj 1\nsource a.mp4\nplayhead 3\nclip 0 5 0\n", + b"edith 1\nsource a.mp4\nplayhead 3\nclip 0 5 0\n", "line 3: playhead belongs once, before the sources", ), ]; @@ -349,13 +349,13 @@ mod tests { fn a_project_without_clips_is_not_a_project() { let dir = PathBuf::from("/proj"); assert_eq!( - parse(b"veproj 1\nsource a.mp4\n", &dir) + parse(b"edith 1\nsource a.mp4\n", &dir) .unwrap_err() .to_string(), "no clips: an empty timeline is not a project" ); assert_eq!( - parse(b"veproj 1\n", &dir).unwrap_err().to_string(), + parse(b"edith 1\n", &dir).unwrap_err().to_string(), "no clips: an empty timeline is not a project" ); } @@ -373,7 +373,7 @@ mod tests { } // A % escape at the very end of a line has nothing to consume. assert_eq!( - parse(b"veproj 1\nsource a%\nclip 0 5 0\n", &dir) + parse(b"edith 1\nsource a%\nclip 0 5 0\n", &dir) .unwrap_err() .to_string(), "line 2: truncated % escape in the path" diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 44a04e9..dc3ead6 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -6,12 +6,12 @@ pub mod clock; pub mod convert; pub mod decode; pub mod demux; +pub mod edith; pub mod export; pub mod hw; pub mod mux; pub mod playback; pub mod project; -pub mod veproj; pub use audio::{AacPacket, AacTrackParams, AudioChunk, AudioMeta, AudioProbe, AudioSession}; pub use clock::PlaybackClock; diff --git a/crates/engine/src/playback.rs b/crates/engine/src/playback.rs index bd16271..29735b2 100644 --- a/crates/engine/src/playback.rs +++ b/crates/engine/src/playback.rs @@ -148,7 +148,7 @@ impl PlaybackSession { /// /// The undo history is not saved: `undo` is `false` on a fresh load. pub fn open_project(path: &Path) -> crate::Result { - let doc = crate::veproj::load(path)?; + let doc = crate::edith::load(path)?; let first = doc.sources.first().ok_or("the project names no sources")?; // Source 0 both scaffolds the session and defines the timeline, so it // is opened for playback rather than merely probed. @@ -214,14 +214,14 @@ impl PlaybackSession { self.project.sources() } - /// Writes the timeline to `path` as a `.veproj`, atomically (see - /// [`crate::veproj`]). Sources no clip plays from are left out, and the + /// Writes the timeline to `path` as a `.edith`, atomically (see + /// [`crate::edith`]). Sources no clip plays from are left out, and the /// playhead is saved with it so a reopened project resumes where it stood. pub fn save_project(&self, path: &Path) -> crate::Result<()> { let (sources, clips) = self.project.without_orphan_sources(); let playhead = secs_to_frame(self.now(), self.meta.frame_rate) .min(self.project.timeline_frames().saturating_sub(1)); - crate::veproj::save(path, &sources, &clips, playhead) + crate::edith::save(path, &sources, &clips, playhead) } /// The next decoded frame, its `index` rewritten from a source frame to a diff --git a/crates/engine/src/project.rs b/crates/engine/src/project.rs index 7a4dded..ec0791e 100644 --- a/crates/engine/src/project.rs +++ b/crates/engine/src/project.rs @@ -68,7 +68,7 @@ impl Project { } /// A project rebuilt from a saved edit list -- the load half of - /// [`crate::veproj`]. History is *not* saved, so [`Project::undo`] is + /// [`crate::edith`]. History is *not* saved, so [`Project::undo`] is /// `false` until the first edit of the new session. `None` when the parts /// would break an invariant every other constructor keeps: no clips, an /// empty clip, or a clip naming a source that is not there. diff --git a/crates/engine/tests/saveload.rs b/crates/engine/tests/saveload.rs index 3506020..ce5ba9d 100644 --- a/crates/engine/tests/saveload.rs +++ b/crates/engine/tests/saveload.rs @@ -1,5 +1,5 @@ //! Saving a project and opening it again: the timeline that comes back is the -//! one that went in, a folder of media plus its `.veproj` can be moved +//! one that went in, a folder of media plus its `.edith` can be moved //! anywhere, and every way the files on disk can have changed underneath is a //! refusal that says which file and why. //! @@ -60,7 +60,7 @@ fn shape(session: &PlaybackSession) -> (Vec<(f64, f64, usize)>, Vec, f6 fn a_saved_project_reopens_as_the_same_timeline() { let dir = scratch("round_trip"); let saved = edited(&dir); - let path = dir.join("edit.veproj"); + let path = dir.join("edit.edith"); saved.save_project(&path).expect("save"); let mut loaded = PlaybackSession::open_project(&path).expect("open the project"); @@ -76,7 +76,7 @@ fn a_saved_project_reopens_as_the_same_timeline() { // Saving what was loaded reproduces the file byte for byte -- the format // has no state the round trip drops. - let again = dir.join("again.veproj"); + let again = dir.join("again.edith"); loaded .save_project(&again) .expect("save the loaded project"); @@ -85,24 +85,24 @@ fn a_saved_project_reopens_as_the_same_timeline() { std::fs::read(&again).unwrap(), "save -> load -> save is not a fixed point" ); - assert!(!path.with_extension("veproj.part").exists(), "left a .part"); + assert!(!path.with_extension("edith.part").exists(), "left a .part"); } #[test] fn a_folder_of_media_and_its_project_can_be_moved() { let from = scratch("relocate_from"); let saved = edited(&from); - saved.save_project(&from.join("edit.veproj")).expect("save"); + saved.save_project(&from.join("edit.edith")).expect("save"); drop(saved); let to = scratch("relocate_to"); - for name in ["test_av.mp4", "test_av2.mp4", "edit.veproj"] { + for name in ["test_av.mp4", "test_av2.mp4", "edit.edith"] { std::fs::copy(from.join(name), to.join(name)).expect("copy"); } // The originals go away entirely: nothing absolute can be resolving here. std::fs::remove_dir_all(&from).expect("remove the original folder"); - let moved = PlaybackSession::open_project(&to.join("edit.veproj")).expect("open the copy"); + let moved = PlaybackSession::open_project(&to.join("edit.edith")).expect("open the copy"); assert_eq!(moved.timeline_duration(), 6.0); assert!( moved.sources().iter().all(|s| s.starts_with(&to)), @@ -125,7 +125,7 @@ fn orphan_sources_are_not_written() { "the orphan entry stays in-session" ); - let path = dir.join("orphan.veproj"); + let path = dir.join("orphan.edith"); session.save_project(&path).expect("save"); let text = std::fs::read_to_string(&path).expect("read back"); assert_eq!( @@ -146,7 +146,7 @@ fn orphan_sources_are_not_written() { fn a_source_that_vanished_is_refused_by_name() { let dir = scratch("missing"); let session = edited(&dir); - let path = dir.join("edit.veproj"); + let path = dir.join("edit.edith"); session.save_project(&path).expect("save"); drop(session); @@ -174,12 +174,12 @@ fn a_source_that_vanished_is_refused_by_name() { fn a_source_that_shrank_is_refused_by_clip() { let dir = scratch("shrunk"); copy_in(&dir, "test_av.mp4"); - let path = dir.join("shrunk.veproj"); + let path = dir.join("shrunk.edith"); // Hand-written: a clip that ran to frame 10000 of a 150-frame file, which // is what re-encoding a source shorter leaves behind. std::fs::write( &path, - "veproj 1\nplayhead 0\nsource test_av.mp4\nclip 0 30 0\nclip 30 10000 0\n", + "edith 1\nplayhead 0\nsource test_av.mp4\nclip 0 30 0\nclip 30 10000 0\n", ) .expect("write"); let err = PlaybackSession::open_project(&path) @@ -194,7 +194,7 @@ fn a_source_that_shrank_is_refused_by_clip() { // One frame short of the end is still inside the file. std::fs::write( &path, - "veproj 1\nplayhead 0\nsource test_av.mp4\nclip 0 150 0\n", + "edith 1\nplayhead 0\nsource test_av.mp4\nclip 0 150 0\n", ) .expect("write"); let whole = PlaybackSession::open_project(&path).expect("the exact length is legal"); @@ -204,34 +204,34 @@ fn a_source_that_shrank_is_refused_by_clip() { #[test] fn a_project_that_names_itself_is_refused() { let dir = scratch("self_reference"); - let path = dir.join("ouroboros.veproj"); + let path = dir.join("ouroboros.edith"); std::fs::write( &path, - "veproj 1\nplayhead 0\nsource ouroboros.veproj\nclip 0 30 0\n", + "edith 1\nplayhead 0\nsource ouroboros.edith\nclip 0 30 0\n", ) .expect("write"); let err = PlaybackSession::open_project(&path) .err() .expect("a project is not a video") .to_string(); - assert!(err.contains("ouroboros.veproj"), "{err}"); + assert!(err.contains("ouroboros.edith"), "{err}"); } #[test] fn malformed_files_are_numbered_errors_and_never_panics() { let dir = scratch("malformed"); copy_in(&dir, "test_av.mp4"); - let path = dir.join("bad.veproj"); - let good = "veproj 1\nplayhead 0\nsource test_av.mp4\nclip 0 30 0\n"; + let path = dir.join("bad.edith"); + let good = "edith 1\nplayhead 0\nsource test_av.mp4\nclip 0 30 0\n"; for (text, want) in [ - ("veproj 2\nsource test_av.mp4\nclip 0 30 0\n", "line 1"), + ("edith 2\nsource test_av.mp4\nclip 0 30 0\n", "line 1"), ("not a project at all\n", "line 1"), - ("veproj 1\nsource test_av.mp4\nclip 0 30\n", "line 3"), - ("veproj 1\nsource test_av.mp4\nclip 0 30 4\n", "line 3"), - ("veproj 1\nsource test_av.mp4\nclip 30 30 0\n", "line 3"), - ("veproj 1\nsource test_av.mp4\n\nclip 0 30 0\n", "line 3"), - ("veproj 1\nsource test_av.mp4\nwhat 1\n", "line 3"), + ("edith 1\nsource test_av.mp4\nclip 0 30\n", "line 3"), + ("edith 1\nsource test_av.mp4\nclip 0 30 4\n", "line 3"), + ("edith 1\nsource test_av.mp4\nclip 30 30 0\n", "line 3"), + ("edith 1\nsource test_av.mp4\n\nclip 0 30 0\n", "line 3"), + ("edith 1\nsource test_av.mp4\nwhat 1\n", "line 3"), ] { std::fs::write(&path, text).expect("write"); let err = PlaybackSession::open_project(&path) @@ -257,10 +257,10 @@ fn a_source_that_no_longer_matches_the_timeline_is_refused_in_import_words() { let dir = scratch("mismatch"); copy_in(&dir, "test_av.mp4"); std::fs::copy(asset("test_mismatch.mp4"), dir.join("test_av2.mp4")).expect("substitute"); - let path = dir.join("swapped.veproj"); + let path = dir.join("swapped.edith"); std::fs::write( &path, - "veproj 1\nplayhead 0\nsource test_av.mp4\nsource test_av2.mp4\nclip 0 30 0\nclip 0 30 1\n", + "edith 1\nplayhead 0\nsource test_av.mp4\nsource test_av2.mp4\nclip 0 30 0\nclip 0 30 1\n", ) .expect("write"); let err = PlaybackSession::open_project(&path)