Skip to main content

FrameRate

Struct FrameRate 

Source
pub struct FrameRate { /* private fields */ }
Expand description

A timecode frame rate: a nominal frame count, whether frames run 1000/1001 slower (the NTSC family), and whether labels use drop-frame counting.

Only the 19 combinations in FrameRate::ALL exist. Drop-frame counting needs a nominal rate of 30, 60 or 120 and skips 2, 4 or 8 labels at the start of every minute not divisible by ten. 29.97 DF and 59.94 DF follow SMPTE ST 12-1. 30 DF, 60 DF, 120 DF and 119.88 DF follow the same rule as Pro Tools labels them.

Implementations§

Source§

impl FrameRate

Source

pub const FPS_23_976: Self

24000/1001 frames per second, counted as 24.

Source

pub const FPS_24: Self

24 frames per second.

Source

pub const FPS_25: Self

25 frames per second.

Source

pub const FPS_29_97: Self

30000/1001 frames per second, counted as 30 without dropping labels.

Source

pub const FPS_29_97_DF: Self

30000/1001 frames per second with drop-frame labels.

Source

pub const FPS_30: Self

30 frames per second.

Source

pub const FPS_30_DF: Self

30 frames per second with drop-frame labels.

Source

pub const FPS_47_952: Self

48000/1001 frames per second, counted as 48.

Source

pub const FPS_48: Self

48 frames per second.

Source

pub const FPS_50: Self

50 frames per second.

Source

pub const FPS_59_94: Self

60000/1001 frames per second, counted as 60 without dropping labels.

Source

pub const FPS_59_94_DF: Self

60000/1001 frames per second with drop-frame labels.

Source

pub const FPS_60: Self

60 frames per second.

Source

pub const FPS_60_DF: Self

60 frames per second with drop-frame labels.

Source

pub const FPS_100: Self

100 frames per second.

Source

pub const FPS_119_88: Self

120000/1001 frames per second, counted as 120 without dropping labels.

Source

pub const FPS_119_88_DF: Self

120000/1001 frames per second with drop-frame labels.

Source

pub const FPS_120: Self

120 frames per second.

Source

pub const FPS_120_DF: Self

120 frames per second with drop-frame labels.

Source

pub const ALL: [Self; 19]

Every supported frame rate.

Source

pub const fn new( nominal: u8, ntsc: bool, drop_frame: bool, ) -> Result<Self, TimecodeError>

Looks up the rate with nominal labels per second, running 1000/1001 slower when ntsc is set, and counting drop-frame labels when drop_frame is set.

§Errors

TimecodeError::UnsupportedFrameRate when the combination is not in FrameRate::ALL, such as 25 DF or 50 with the 1000/1001 factor.

Source

pub const fn nominal(self) -> u8

The number of frame labels in one timecode second.

Source

pub const fn is_ntsc(self) -> bool

Whether frames run at 1000/1001 of the nominal rate, as 23.976 and 29.97 do.

Source

pub const fn is_drop_frame(self) -> bool

Whether labels use drop-frame counting.

Source

pub const fn frames_per_second(self) -> Ratio

The exact number of frames per real-time second.

Source

pub const fn frames_per_day(self) -> u32

The number of frames from 00:00:00:00 up to, but not including, the next midnight.

Trait Implementations§

Source§

impl Clone for FrameRate

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FrameRate

Source§

impl Debug for FrameRate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FrameRate

Source§

impl Hash for FrameRate

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FrameRate

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FrameRate

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.