pub struct FrameTimecode {
pub frame: u64,
pub timestamp_ms: u64,
}Expand description
A precise media timecode expressed in both frame number and milliseconds.
Storing both avoids lossy round-trips between the two representations.
Fields§
§frame: u64Zero-based frame index.
timestamp_ms: u64Timestamp in milliseconds (derived from frame and fps).
Implementations§
Source§impl FrameTimecode
impl FrameTimecode
Sourcepub fn from_frame(frame: u64, fps_num: u32, fps_den: u32) -> Option<Self>
pub fn from_frame(frame: u64, fps_num: u32, fps_den: u32) -> Option<Self>
Creates a FrameTimecode from a frame number and a frame rate (num/den).
§Panics-safe
Returns None if fps_den is zero.
Sourcepub fn from_ms(timestamp_ms: u64, fps_num: u32, fps_den: u32) -> Option<Self>
pub fn from_ms(timestamp_ms: u64, fps_num: u32, fps_den: u32) -> Option<Self>
Creates a FrameTimecode from a millisecond timestamp, snapped to the
nearest frame boundary.
Returns None if fps_den is zero.
Sourcepub fn duration_to(&self, other: &Self) -> Option<u64>
pub fn duration_to(&self, other: &Self) -> Option<u64>
Returns the duration in milliseconds between self and other.
Returns None if other is before self.
Trait Implementations§
Source§impl Clone for FrameTimecode
impl Clone for FrameTimecode
Source§fn clone(&self) -> FrameTimecode
fn clone(&self) -> FrameTimecode
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 FrameTimecode
impl Debug for FrameTimecode
Source§impl PartialEq for FrameTimecode
impl PartialEq for FrameTimecode
impl Copy for FrameTimecode
impl Eq for FrameTimecode
impl StructuralPartialEq for FrameTimecode
Auto Trait Implementations§
impl Freeze for FrameTimecode
impl RefUnwindSafe for FrameTimecode
impl Send for FrameTimecode
impl Sync for FrameTimecode
impl Unpin for FrameTimecode
impl UnsafeUnpin for FrameTimecode
impl UnwindSafe for FrameTimecode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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