pub struct Timeline {Show 15 fields
pub tracks: Vec<Track>,
pub timebase: Rational,
pub frame_rate: Rational,
pub duration: i64,
pub playhead: i64,
pub selection: ClipSelection,
pub transitions: TransitionManager,
pub markers: MarkerManager,
pub regions: RegionManager,
pub in_out: InOutPoints,
pub groups: GroupManager,
pub links: LinkManager,
pub next_clip_id: u64,
pub clip_map: HashMap<ClipId, (usize, usize)>,
pub snap_engine: Option<MagneticSnapEngine>,
}Expand description
A multi-track timeline.
Fields§
§tracks: Vec<Track>Timeline tracks.
timebase: RationalTimeline timebase (e.g., 1/1000 for milliseconds).
frame_rate: RationalTimeline frame rate (for video).
duration: i64Timeline duration (in timebase units).
playhead: i64Current playhead position.
selection: ClipSelectionClip selection.
transitions: TransitionManagerTransition manager.
markers: MarkerManagerMarker manager.
regions: RegionManagerRegion manager.
in_out: InOutPointsIn/Out points.
groups: GroupManagerGroup manager.
links: LinkManagerLink manager.
next_clip_id: u64Next clip ID.
clip_map: HashMap<ClipId, (usize, usize)>Clip lookup by ID.
snap_engine: Option<MagneticSnapEngine>Optional magnetic snap engine.
Implementations§
Source§impl Timeline
impl Timeline
Sourcepub fn with_magnetic_snap(self, config: MagneticSnapConfig) -> Self
pub fn with_magnetic_snap(self, config: MagneticSnapConfig) -> Self
Enable magnetic snapping with the given configuration.
Sourcepub fn default_settings() -> Self
pub fn default_settings() -> Self
Create a timeline with default settings (1ms timebase, 30fps).
Sourcepub fn remove_track(&mut self, index: usize) -> EditResult<Track>
pub fn remove_track(&mut self, index: usize) -> EditResult<Track>
Remove a track by index.
Sourcepub fn get_track_mut(&mut self, index: usize) -> Option<&mut Track>
pub fn get_track_mut(&mut self, index: usize) -> Option<&mut Track>
Get a mutable track by index.
Sourcepub fn add_clip(&mut self, track_index: usize, clip: Clip) -> EditResult<ClipId>
pub fn add_clip(&mut self, track_index: usize, clip: Clip) -> EditResult<ClipId>
Add a clip to a track.
Returns EditError::TrackTypeMismatch when the clip’s type does not
match the track type (e.g., adding an audio clip to a video track).
Sourcepub fn remove_clip(&mut self, clip_id: ClipId) -> EditResult<Clip>
pub fn remove_clip(&mut self, clip_id: ClipId) -> EditResult<Clip>
Remove a clip by ID.
Link policy: linked clips are preserved on delete; only the link association is removed. The linked clip remains in its track at its current position.
Sourcepub fn get_clip_mut(&mut self, clip_id: ClipId) -> Option<&mut Clip>
pub fn get_clip_mut(&mut self, clip_id: ClipId) -> Option<&mut Clip>
Get a mutable clip by ID.
Sourcepub fn move_clip(
&mut self,
clip_id: ClipId,
requested_start: i64,
) -> EditResult<()>
pub fn move_clip( &mut self, clip_id: ClipId, requested_start: i64, ) -> EditResult<()>
Move a clip to a new position on the timeline.
If magnetic snapping is enabled, the requested position is adjusted to the nearest snap target before the move is applied.
All clips linked to clip_id are moved by the same delta (cascade).
The operation is atomic: if any clip in the cascade would overlap an existing clip, the entire batch is rolled back and an error is returned.
Sourcepub fn move_clip_to_track(
&mut self,
clip_id: ClipId,
target_track: usize,
) -> EditResult<()>
pub fn move_clip_to_track( &mut self, clip_id: ClipId, target_track: usize, ) -> EditResult<()>
Move a clip to a different track.
Sourcepub fn get_clips_at(&self, position: i64) -> Vec<(usize, &Clip)>
pub fn get_clips_at(&self, position: i64) -> Vec<(usize, &Clip)>
Get all clips at a specific timeline position.
Sourcepub fn get_clips_in_range(&self, start: i64, end: i64) -> Vec<(usize, &Clip)>
pub fn get_clips_in_range(&self, start: i64, end: i64) -> Vec<(usize, &Clip)>
Get all clips in a time range.
Sourcepub fn rebuild_clip_map(&mut self)
pub fn rebuild_clip_map(&mut self)
Rebuild the clip map from scratch.
Sourcepub fn set_playhead(&mut self, position: i64)
pub fn set_playhead(&mut self, position: i64)
Set playhead position.
Sourcepub fn move_playhead(&mut self, delta: i64)
pub fn move_playhead(&mut self, delta: i64)
Move playhead forward by delta.
Sourcepub fn seek_to_start(&mut self)
pub fn seek_to_start(&mut self)
Seek to start of timeline.
Sourcepub fn seek_to_end(&mut self)
pub fn seek_to_end(&mut self)
Seek to end of timeline.
Sourcepub fn duration_seconds(&self) -> f64
pub fn duration_seconds(&self) -> f64
Get timeline duration in seconds.
Sourcepub fn video_tracks(&self) -> Vec<&Track>
pub fn video_tracks(&self) -> Vec<&Track>
Get video tracks.
Sourcepub fn audio_tracks(&self) -> Vec<&Track>
pub fn audio_tracks(&self) -> Vec<&Track>
Get audio tracks.
Sourcepub fn subtitle_tracks(&self) -> Vec<&Track>
pub fn subtitle_tracks(&self) -> Vec<&Track>
Get subtitle tracks.
Sourcepub fn clip_count(&self) -> usize
pub fn clip_count(&self) -> usize
Get total number of clips.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Timeline
impl RefUnwindSafe for Timeline
impl Send for Timeline
impl Sync for Timeline
impl Unpin for Timeline
impl UnsafeUnpin for Timeline
impl UnwindSafe for Timeline
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more