pub struct TcDuration {
pub frames: u64,
pub fps: u8,
}Expand description
A duration expressed in timecode frames.
Unlike Timecode this is not anchored to a time-of-day and can exceed
24 hours.
Fields§
§frames: u64Total frames in this duration.
fps: u8Frames per second (rounded integer).
Implementations§
Source§impl TcDuration
impl TcDuration
Sourcepub fn from_frames(frames: u64, fps: u8) -> Self
pub fn from_frames(frames: u64, fps: u8) -> Self
Create a duration from a frame count at a given fps.
Sourcepub fn from_hmsf(
hours: u32,
minutes: u32,
seconds: u32,
frames: u32,
fps: u8,
) -> Self
pub fn from_hmsf( hours: u32, minutes: u32, seconds: u32, frames: u32, fps: u8, ) -> Self
Create a duration from hours, minutes, seconds, and frames.
Sourcepub fn to_hmsf(&self) -> (u32, u32, u32, u32)
pub fn to_hmsf(&self) -> (u32, u32, u32, u32)
Convert to (hours, minutes, seconds, frames) tuple.
Sourcepub fn as_seconds(&self) -> f64
pub fn as_seconds(&self) -> f64
Duration in seconds (floating point).
Sourcepub fn divide(&self, divisor: u64) -> Option<Self>
pub fn divide(&self, divisor: u64) -> Option<Self>
Divide the duration by an integer divisor.
Returns None if divisor is zero.
Sourcepub fn scale(&self, factor: f64) -> Self
pub fn scale(&self, factor: f64) -> Self
Scale the duration by a floating-point factor (e.g. speed change).
Sourcepub fn add(&self, other: &TcDuration) -> Self
pub fn add(&self, other: &TcDuration) -> Self
Add two durations together.
Sourcepub fn subtract(&self, other: &TcDuration) -> Self
pub fn subtract(&self, other: &TcDuration) -> Self
Subtract another duration (saturating at zero).
Trait Implementations§
Source§impl Clone for TcDuration
impl Clone for TcDuration
Source§fn clone(&self) -> TcDuration
fn clone(&self) -> TcDuration
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TcDuration
impl Debug for TcDuration
Source§impl Display for TcDuration
impl Display for TcDuration
Source§impl Ord for TcDuration
impl Ord for TcDuration
Source§fn cmp(&self, other: &TcDuration) -> Ordering
fn cmp(&self, other: &TcDuration) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for TcDuration
impl PartialEq for TcDuration
Source§impl PartialOrd for TcDuration
impl PartialOrd for TcDuration
impl Copy for TcDuration
impl Eq for TcDuration
impl StructuralPartialEq for TcDuration
Auto Trait Implementations§
impl Freeze for TcDuration
impl RefUnwindSafe for TcDuration
impl Send for TcDuration
impl Sync for TcDuration
impl Unpin for TcDuration
impl UnsafeUnpin for TcDuration
impl UnwindSafe for TcDuration
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
Mutably borrows from an owned value. Read more