pub struct FrameRateRatio {
pub numerator: u32,
pub denominator: u32,
}Expand description
A rational frame rate expressed as numerator / denominator.
This complements the crate::FrameRate enum with arbitrary-precision
rational arithmetic so that custom frame rates (e.g. 48000/1001) can be
represented without adding new enum variants.
Fields§
§numerator: u32Numerator of the frame rate fraction.
denominator: u32Denominator of the frame rate fraction.
Implementations§
Source§impl FrameRateRatio
impl FrameRateRatio
Sourcepub fn new(numerator: u32, denominator: u32) -> Option<Self>
pub fn new(numerator: u32, denominator: u32) -> Option<Self>
Create a new FrameRateRatio.
Returns None if denominator is zero.
Sourcepub fn is_drop_frame_compatible(&self) -> bool
pub fn is_drop_frame_compatible(&self) -> bool
Whether this frame rate is compatible with SMPTE drop-frame timecode.
Drop frame is only defined for the 30000/1001 (≈ 29.97) and 60000/1001 (≈ 59.94) rates.
Sourcepub fn matches(&self, other: &FrameRateRatio) -> bool
pub fn matches(&self, other: &FrameRateRatio) -> bool
Whether this ratio is numerically equal to other (cross-multiply check).
Sourcepub fn common_frame_rates() -> Vec<FrameRateRatio>
pub fn common_frame_rates() -> Vec<FrameRateRatio>
A list of common broadcast frame rates.
Sourcepub fn nominal_fps(&self) -> u32
pub fn nominal_fps(&self) -> u32
Nominal integer frames per second (rounded).
Trait Implementations§
Source§impl Clone for FrameRateRatio
impl Clone for FrameRateRatio
Source§fn clone(&self) -> FrameRateRatio
fn clone(&self) -> FrameRateRatio
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 FrameRateRatio
impl Debug for FrameRateRatio
Source§impl Display for FrameRateRatio
impl Display for FrameRateRatio
Source§impl PartialEq for FrameRateRatio
impl PartialEq for FrameRateRatio
impl Copy for FrameRateRatio
impl Eq for FrameRateRatio
impl StructuralPartialEq for FrameRateRatio
Auto Trait Implementations§
impl Freeze for FrameRateRatio
impl RefUnwindSafe for FrameRateRatio
impl Send for FrameRateRatio
impl Sync for FrameRateRatio
impl Unpin for FrameRateRatio
impl UnsafeUnpin for FrameRateRatio
impl UnwindSafe for FrameRateRatio
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