pub struct TimecodeFormatter {
pub format: TimecodeFormat,
pub fps: u32,
pub drop_frame: bool,
}Expand description
Formats and parses timecode values in various TimecodeFormats.
Fields§
§format: TimecodeFormatThe display format to use.
fps: u32Frames per second (nominal integer, e.g. 25 or 30).
drop_frame: boolWhether the timecode uses drop-frame counting.
Implementations§
Source§impl TimecodeFormatter
impl TimecodeFormatter
Sourcepub fn new(format: TimecodeFormat, fps: u32, drop_frame: bool) -> Option<Self>
pub fn new(format: TimecodeFormat, fps: u32, drop_frame: bool) -> Option<Self>
Create a new formatter.
fps must be non-zero; returns None otherwise.
Sourcepub fn format_frames(&self, total_frames: u64) -> String
pub fn format_frames(&self, total_frames: u64) -> String
Convert an absolute frame count into a human-readable string.
Sourcepub fn parse_smpte(&self, s: &str) -> Option<u64>
pub fn parse_smpte(&self, s: &str) -> Option<u64>
Parse a SMPTE timecode string (HH:MM:SS:FF or HH:MM:SS;FF) into total
frames using the formatter’s fps.
Returns None if the string is not valid SMPTE notation.
Trait Implementations§
Source§impl Clone for TimecodeFormatter
impl Clone for TimecodeFormatter
Source§fn clone(&self) -> TimecodeFormatter
fn clone(&self) -> TimecodeFormatter
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 moreAuto Trait Implementations§
impl Freeze for TimecodeFormatter
impl RefUnwindSafe for TimecodeFormatter
impl Send for TimecodeFormatter
impl Sync for TimecodeFormatter
impl Unpin for TimecodeFormatter
impl UnsafeUnpin for TimecodeFormatter
impl UnwindSafe for TimecodeFormatter
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