pub struct OffsetTable { /* private fields */ }Expand description
Pre-computed offset table for a particular frame rate.
Implementations§
Source§impl OffsetTable
impl OffsetTable
Sourcepub fn build(rate: FrameRate) -> Self
pub fn build(rate: FrameRate) -> Self
Build the offset table for the given frame rate.
The table covers the full 24-hour range (1440 minute entries).
Sourcepub fn timecode_to_frame(&self, tc: &Timecode) -> Result<u64, TimecodeError>
pub fn timecode_to_frame(&self, tc: &Timecode) -> Result<u64, TimecodeError>
Convert a timecode to its absolute frame offset using the table.
§Errors
Returns TimecodeError::InvalidHours if the timecode is out of range.
Sourcepub fn frame_to_timecode(&self, frame: u64) -> Result<Timecode, TimecodeError>
pub fn frame_to_timecode(&self, frame: u64) -> Result<Timecode, TimecodeError>
Convert an absolute frame offset back to a timecode using the table.
Binary-searches the minute table then linearly computes seconds/frames.
§Errors
Returns TimecodeError::InvalidFrames if the frame number exceeds the
24-hour range.
Sourcepub fn total_day_frames(&self) -> u64
pub fn total_day_frames(&self) -> u64
Total number of frames in a full 24-hour day.
Sourcepub fn minute_offset(&self, minute: usize) -> Option<u64>
pub fn minute_offset(&self, minute: usize) -> Option<u64>
Look up the offset for a given minute index directly.
Trait Implementations§
Source§impl Clone for OffsetTable
impl Clone for OffsetTable
Source§fn clone(&self) -> OffsetTable
fn clone(&self) -> OffsetTable
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 OffsetTable
impl RefUnwindSafe for OffsetTable
impl Send for OffsetTable
impl Sync for OffsetTable
impl Unpin for OffsetTable
impl UnsafeUnpin for OffsetTable
impl UnwindSafe for OffsetTable
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