edit/lib.rs
1//! `edit` — the pure, serializable non-destructive edit model that
2//! powers the Screen recorder's editor (milestone M-EDIT).
3//!
4//! # The segment-list design
5//!
6//! An [`EditProject`] is the serialized source of truth for one
7//! editing session. Following the design proven by Cap's
8//! `project::configuration`, the edit is encoded as **lists of
9//! lightweight value types**, not a mutated copy of the media:
10//!
11//! - [`TimelineSegment`]s — an ordered list of slices of the source
12//! recording. **Trim** adjusts a slice's `source_start` /
13//! `source_end`; **split** replaces one slice with two adjacent
14//! ones; **speed** changes a slice's `timescale`. The project's
15//! video is the ordered concatenation of its segments.
16//! - [`ZoomSegment`]s — cinematic punch-in regions on the project
17//! timeline, each a zoom `amount` at an [`ZoomMode`] target. At the
18//! render boundary (ED.16) each compiles to a keyframed transform.
19//! - [`BackgroundConfig`] / [`CursorConfig`] / [`CropRect`] /
20//! [`AspectRatio`] — the "cinematic framing" layer (wallpaper,
21//! padding, corner radius, shadow, cursor smoothing, crop/reframe).
22//!
23//! Nothing here touches a GPU or a media pipeline. The renderer
24//! (`wisp`) and the encoder (`media` / `GStreamer`) consume this model at
25//! preview + export time, re-deriving every frame from the lists. That
26//! keeps editing non-destructive (the source file is never rewritten)
27//! and keeps this crate exhaustively unit-testable on any machine.
28//!
29//! # Time model
30//!
31//! Project time is **frame-indexed** at a fixed [`EditProject::project_fps`].
32//! [`EditProject::source_time`] walks the segment list applying each
33//! segment's `timescale` to map a project frame to the source frame the
34//! renderer should decode. See [`segment`] for the arithmetic.
35
36pub mod clip;
37pub mod history;
38pub mod ops;
39pub mod persist;
40pub mod project;
41pub mod segment;
42pub mod style;
43pub mod telemetry;
44pub mod zoom;
45pub mod zoom_anim;
46
47pub use clip::ClipRef;
48pub use history::History;
49pub use ops::{EditError, EditOp, TrimEdge};
50pub use project::{DEFAULT_PROJECT_FPS, EditProject, SCHEMA_VERSION};
51pub use segment::{Frame, TimelineSegment};
52pub use style::{
53 AspectRatio, AutoZoomConfig, BackgroundConfig, BackgroundSource, CropRect, CursorConfig,
54};
55pub use telemetry::{ClickEvent, CursorSample};
56pub use zoom::{EditEase, ZoomId, ZoomMode, ZoomSegment};