Struct Clip

Source
pub struct Clip {
Show 35 fields pub id: u64, pub link: u64, pub kind: ClipKind, pub container: bool, pub container_label: String, pub asset: u64, pub name: String, pub start: f64, pub duration: f64, pub src_in: f64, pub audio_stream: usize, pub sequence: u64, pub enabled: bool, pub label: u8, pub speed: f64, pub speed_curve: Animated, pub reverse: bool, pub freeze: Option<f64>, pub x: Animated, pub y: Animated, pub scale: Animated, pub rotation: Animated, pub opacity: Animated, pub blend: BlendMode, pub effects: Vec<Effect>, pub volume: Animated, pub pan: Animated, pub fade_in: f64, pub fade_out: f64, pub bus: u64, pub text: Option<TextStyle>, pub shape: Option<ShapeStyle>, pub mask: Option<Mask>, pub graph: Option<NodeGraph>, pub markers: Vec<Marker>,
}

Fields§

§id: u64§link: u64

Clips sharing a non-zero link id move/split/delete together (video + its audio).

§kind: ClipKind§container: bool

True when this clip is a container (slot) whose media can be replaced without losing effects/transforms.

§container_label: String

User-facing label for the container slot (e.g. “Main Shot”, “B-Roll 1”). Empty = unnamed.

§asset: u64

Asset id (0 for Text clips).

§name: String§start: f64

Timeline start (seconds).

§duration: f64§src_in: f64

Earliest source time used by the clip (the source window is [src_in, src_in + duration*speed)).

§audio_stream: usize

For Audio clips: which audio stream of the asset (0-based among audio streams).

§sequence: u64

For Sequence clips: the nested timeline id.

§enabled: bool§label: u8

Colour label shown on the timeline: 0 = inherit the asset’s label, 1..=8 = LABEL_COLORS index + 1.

§speed: f64

Playback rate (1 = normal, 2 = twice as fast, 0.5 = half speed). Always > 0.

§speed_curve: Animated

Keyframed speed ramp (curve editor). Only consulted while it has keys — the constant speed above still owns the source window and the duration.

§reverse: bool

Play the source window backwards.

§freeze: Option<f64>

Freeze frame: show/hold the source frame at this source time for the whole clip (audio is silent).

§x: Animated§y: Animated§scale: Animated§rotation: Animated§opacity: Animated§blend: BlendMode§effects: Vec<Effect>

Effect stack, applied in order before blending.

§volume: Animated

Linear gain (1 = unity).

§pan: Animated

-1 = left … 0 = centre … 1 = right.

§fade_in: f64

Fade in/out lengths in seconds (gain ramps at the clip edges).

§fade_out: f64§bus: u64

Which bus this audio clip feeds (0 = its track’s bus).

§text: Option<TextStyle>

Present for Text clips.

§shape: Option<ShapeStyle>

Present for Shape clips.

§mask: Option<Mask>

Limits where the whole clip is visible.

§graph: Option<NodeGraph>

Node graph; when present it replaces effects for rendering.

§markers: Vec<Marker>

Clip-local markers.

Implementations§

Source§

impl Clip

Source

pub fn new( id: u64, kind: ClipKind, name: impl Into<String>, start: f64, duration: f64, ) -> Self

Source

pub fn is_empty_container(&self) -> bool

True when this container has no media (asset == 0 for video/image/audio).

Source

pub fn end(&self) -> f64

Source

pub fn contains(&self, t: f64) -> bool

True for t in [start, end).

Source

pub fn local(&self, t: f64) -> f64

Clip-local time.

Source

pub fn fade_mult(&self, lt: f64) -> f64

Gain/opacity multiplier of the fade in/out ramps at clip-local time lt. Time is clamped into the clip so virtual transition extensions hold the edge value (mixer rule).

Source

pub fn src_len(&self) -> f64

Length of the source window in source seconds.

Source

pub fn rate(&self, l: f64) -> f64

Playback rate at clip-local time l (the ramp when keyframed, else the constant).

Source

pub fn src_time(&self, t: f64) -> f64

Source media time at timeline time t (speed, reverse and freeze applied).

Source

pub fn src_end(&self) -> f64

Latest source time used by the clip.

Source

pub fn is_visual(&self) -> bool

Source

pub fn draws(&self) -> bool

Draws pixels of its own (an Adjustment layer only re-processes what is below it).

Source

pub fn uses_asset(&self) -> bool

Source

pub fn uses_graph(&self) -> bool

Does the renderer evaluate the node graph instead of the linear effect stack? The node editor is opt-in: a bare Input→Output graph says nothing the stack does not, so it never shadows it — otherwise a clip that once had the node pane pointed at it could never take a plain effect again.

Source

pub fn is_retimed(&self) -> bool

Speed, reverse or freeze in effect.

Source

pub fn has_effects(&self) -> bool

Anything that needs re-rendering (disqualifies a lossless -c copy export).

Source

pub fn set_speed(&mut self, speed: f64)

Change the playback rate keeping the source window and the timeline start (duration follows).

Source

pub fn animated(&self) -> [&Animated; 8]

Source

pub fn all_animated_mut(&mut self) -> Vec<&mut Animated>

Every keyframeable property including effect parameters.

Source

pub fn all_animated(&self) -> Vec<&Animated>

Source

pub fn props_mut(&mut self) -> Vec<(&'static str, &mut Animated)>

(label, property) pairs for the inspector — visual ones for visual clips, volume/pan for audio.

Source

pub fn key_times(&self) -> Vec<f64>

Sorted, de-duplicated clip-local keyframe times across all properties (for drawing diamonds).

Source

pub fn shift_keys(&mut self, dt: f64)

Shift every keyframe (all properties, effects included) by dt.

Source

pub fn move_keys(&mut self, t_old: f64, t_new: f64)

Move every keyframe sitting at clip-local t_old to t_new (clamped inside the clip).

Source

pub fn split(&mut self, t: f64, new_id: u64) -> Option<Clip>

Split at timeline time t. self becomes the left part; returns the right part with new_id. None if t is not strictly inside the clip. Speed/reverse aware.

Source

pub fn trim_start(&mut self, new_start: f64, headroom: f64)

Move the left edge to new_start, keeping the right edge fixed (slip-trim). headroom = source seconds available before the left edge (Project::head_room), INFINITY = unbounded.

Source

pub fn trim_end(&mut self, new_end: f64, max_duration: f64)

Move the right edge to new_end. max_duration = longest allowed duration (Project::max_clip_duration).

Trait Implementations§

Source§

impl Clone for Clip

Source§

fn clone(&self) -> Clip

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Clip

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Clip

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Clip

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Clip

§

impl RefUnwindSafe for Clip

§

impl Send for Clip

§

impl Sync for Clip

§

impl Unpin for Clip

§

impl UnwindSafe for Clip

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> MaybeSend for T

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + Serialize + for<'a> Deserialize<'a> + Send + Sync,