pub struct Frequency(/* private fields */);Expand description
Media timeline frequency as represented by a non-zero unsigned integer.
The frequency can be found in the negotiated payload parameters for a media writer.
// Obtain mid from Event::MediaAdded
let mid: Mid = todo!();
// Create a media writer for the mid.
let writer = rtc.writer(mid).unwrap();
// Get the payload type (pt) for the wanted codec.
let params = writer.payload_params().nth(0).unwrap();
// Obtain the frequency for the selected codec.
let freq = params.spec().clock_rate;
let mtime = MediaTime::new(2000, freq);Implementations§
Source§impl Frequency
impl Frequency
Sourcepub const FIXED_POINT_6_18: Frequency
pub const FIXED_POINT_6_18: Frequency
1 / 2 ^ 18 seconds in a second.
Sourcepub const NINETY_KHZ: Frequency
pub const NINETY_KHZ: Frequency
Cycles in a second of a 90 kHz signal.
Sourcepub const FORTY_EIGHT_KHZ: Frequency
pub const FORTY_EIGHT_KHZ: Frequency
Cycles in a second of a 48 kHz signal.
Sourcepub const HUNDREDTHS: Frequency
pub const HUNDREDTHS: Frequency
Hundredths in a second.
Sourcepub const fn from_nonzero(v: NonZeroU32) -> Self
pub const fn from_nonzero(v: NonZeroU32) -> Self
Any non-zero u32 is a valid media timeline frequency.
Sourcepub const fn nonzero(&self) -> NonZeroU32
pub const fn nonzero(&self) -> NonZeroU32
The frequency as a std::num::NonZeroU32 i.e. including a positivity proof.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Frequency
impl<'de> Deserialize<'de> for Frequency
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Frequency> for NonZeroU32
impl From<Frequency> for NonZeroU32
Source§impl From<NonZero<u32>> for Frequency
impl From<NonZero<u32>> for Frequency
Source§fn from(value: NonZeroU32) -> Self
fn from(value: NonZeroU32) -> Self
Converts to this type from the input type.
impl Copy for Frequency
impl Eq for Frequency
Auto Trait Implementations§
impl Freeze for Frequency
impl RefUnwindSafe for Frequency
impl Send for Frequency
impl Sync for Frequency
impl Unpin for Frequency
impl UnwindSafe for Frequency
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)