Skip to main content

oximedia_edit/
lib.rs

1//! Video timeline editor for `OxiMedia`.
2//!
3//! `oximedia-edit` provides a comprehensive video editing system with:
4//!
5//! - **Multi-track timeline**: Manage video, audio, and subtitle tracks
6//! - **Clip operations**: Add, remove, move, trim, split clips
7//! - **Advanced editing**: Ripple, roll, slip, and slide edits
8//! - **Effects system**: Apply effects with keyframe animation
9//! - **Transitions**: Cross-fades, dissolves, wipes, and more
10//! - **Rendering**: Real-time preview and high-quality export
11//!
12//! # Example
13//!
14//! ```
15//! use oximedia_edit::{Timeline, TimelineEditor, Clip, ClipType};
16//! use oximedia_core::Rational;
17//!
18//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
19//! // Create a timeline
20//! let mut timeline = Timeline::new(
21//!     Rational::new(1, 1000),  // 1ms timebase
22//!     Rational::new(30, 1),     // 30 fps
23//! );
24//!
25//! // Add video track
26//! let video_track = timeline.add_track(oximedia_edit::TrackType::Video);
27//!
28//! // Create and add a clip
29//! let clip = Clip::new(1, ClipType::Video, 0, 5000); // 5 seconds
30//! timeline.add_clip(video_track, clip)?;
31//!
32//! // Edit operations
33//! let mut editor = TimelineEditor::new();
34//! timeline.set_playhead(2500); // Seek to 2.5 seconds
35//! editor.split_at_playhead(&mut timeline)?;
36//! # Ok(())
37//! # }
38//! ```
39//!
40//! # Architecture
41//!
42//! The editing system is built around these core components:
43//!
44//! ## Timeline
45//!
46//! The [`Timeline`] is the central structure containing multiple [`Track`]s.
47//! Each track holds [`Clip`]s that represent media segments.
48//!
49//! ## Clips
50//!
51//! [`Clip`]s are segments of media with timing information:
52//! - Timeline position and duration
53//! - Source media and in/out points
54//! - Speed and direction (normal/reverse)
55//! - Effects and opacity
56//!
57//! ## Effects
58//!
59//! The [`effect`] module provides an effects system with:
60//! - Common effects (brightness, blur, color correction)
61//! - Keyframe animation with interpolation
62//! - Effect stacks per clip
63//!
64//! ## Transitions
65//!
66//! [`Transition`]s provide smooth blending between adjacent clips:
67//! - Video transitions (dissolve, wipe, zoom)
68//! - Audio cross-fades
69//! - Easing functions
70//!
71//! ## Editing Operations
72//!
73//! The [`TimelineEditor`] provides editing operations:
74//! - Cut, copy, paste
75//! - Split and trim
76//! - Ripple, roll, slip, slide edits
77//! - Speed changes and reverse
78//!
79//! ## Rendering
80//!
81//! The [`render`] module handles timeline rendering:
82//! - [`TimelineRenderer`]: Render individual frames
83//! - [`PreviewRenderer`]: Real-time playback preview
84//! - [`ExportRenderer`]: High-quality final export
85//! - [`BackgroundRenderer`]: Non-blocking background rendering
86//!
87//! # Green List Only
88//!
89//! Like all `OxiMedia` components, `oximedia-edit` only supports patent-free
90//! codecs (AV1, VP9, VP8, Opus, Vorbis, FLAC). Attempting to use patent-
91//! encumbered codecs will result in errors.
92
93#![warn(missing_docs)]
94
95pub mod auto_edit;
96pub mod blade_tool;
97pub mod clip;
98pub mod clip_arrange;
99pub mod clip_speed;
100pub mod collab_edit;
101pub mod color_grade_edit;
102pub mod color_label;
103pub mod edit;
104pub mod edit_context;
105pub mod edit_macro;
106pub mod edit_preset;
107pub mod edl;
108pub mod edl_import;
109pub mod effect;
110pub mod error;
111pub mod export;
112pub mod frame_prefetch;
113pub mod fx_strip;
114pub mod group;
115pub mod group_edit;
116pub mod history;
117pub mod history_tree;
118pub mod incremental_render;
119pub mod insert_mode;
120pub mod interval_tree;
121pub mod magnetic_snap;
122pub mod marker;
123pub mod marker_edit;
124pub mod multi_export;
125pub mod multicam;
126pub mod multitrack;
127pub mod nested_sequence;
128pub mod parallel_render;
129pub mod picture_in_picture;
130pub mod pip;
131pub mod proxy;
132pub mod render;
133pub mod render_queue;
134pub mod render_source;
135pub mod ripple;
136pub mod selection;
137pub mod slip_slide;
138pub mod smart_trim;
139pub mod timeline;
140pub mod timeline_export;
141pub mod timeline_validator;
142pub mod title_overlay;
143pub mod track_lock;
144pub mod transition;
145pub mod trim_mode;
146pub mod trim_selection;
147pub mod waveform;
148
149// Re-export commonly used items
150pub use clip::{Clip, ClipId, ClipRef, ClipSelection, ClipType, Clipboard};
151pub use edit::{EditMode, TimelineEditor};
152pub use effect::{
153    Effect, EffectInstance, EffectPreset, EffectStack, EffectType, InterpolationMode, Parameter,
154    ParameterValue,
155};
156pub use error::{EditError, EditResult};
157pub use group::{
158    ClipGroup, ClipLink, CompoundClip, CompoundClipManager, GroupManager, LinkManager, LinkType,
159};
160pub use marker::{InOutPoints, Marker, MarkerId, MarkerManager, MarkerType, Region, RegionManager};
161#[cfg(not(target_arch = "wasm32"))]
162pub use render::BackgroundRenderer;
163pub use render::{
164    ExportRenderer, ExportSettings, PreviewRenderer, RawFrameCache, RenderConfig, RenderFrame,
165    RenderQuality, TimelineRenderer, RAW_FRAME_CACHE_CAPACITY,
166};
167pub use timeline::{PlaybackState, Timeline, TimelineConfig, Track, TrackType};
168pub use transition::{
169    EasingFunction, Transition, TransitionBuilder, TransitionManager, TransitionParameters,
170    TransitionPresets, TransitionType,
171};
172
173/// Version information.
174pub const VERSION: &str = env!("CARGO_PKG_VERSION");
175
176/// Prelude module for convenient imports.
177pub mod prelude {
178
179    pub use crate::clip::{Clip, ClipId, ClipType};
180    pub use crate::edit::{EditMode, TimelineEditor};
181    pub use crate::effect::{Effect, EffectStack, EffectType};
182    pub use crate::error::{EditError, EditResult};
183    pub use crate::group::{GroupManager, LinkManager};
184    pub use crate::marker::{Marker, MarkerManager, Region, RegionManager};
185    pub use crate::render::{PreviewRenderer, RenderConfig, TimelineRenderer};
186    pub use crate::timeline::{Timeline, Track, TrackType};
187    pub use crate::transition::{Transition, TransitionType};
188}