#[repr(C)]pub struct CMTime {
pub value: i64,
pub timescale: i32,
pub flags: u32,
pub epoch: i64,
}Expand description
CMTime representation matching Core Media’s CMTime
Represents a rational time value with a 64-bit numerator and 32-bit denominator.
§Examples
use screencapturekit::cm::CMTime;
// Create a time of 1 second (30/30)
let time = CMTime::new(30, 30);
assert_eq!(time.as_seconds(), Some(1.0));
// Create a time of 2.5 seconds at 1000 Hz timescale
let time = CMTime::new(2500, 1000);
assert_eq!(time.value, 2500);
assert_eq!(time.timescale, 1000);
assert_eq!(time.as_seconds(), Some(2.5));Fields§
§value: i64§timescale: i32§flags: u32§epoch: i64Implementations§
Source§impl CMTime
impl CMTime
pub const ZERO: Self
pub const INVALID: Self
pub const fn new(value: i64, timescale: i32) -> Self
pub const fn is_valid(&self) -> bool
Sourcepub const fn is_indefinite(&self) -> bool
pub const fn is_indefinite(&self) -> bool
Check if this time is indefinite
Sourcepub const fn is_positive_infinity(&self) -> bool
pub const fn is_positive_infinity(&self) -> bool
Check if this time is positive infinity
Sourcepub const fn is_negative_infinity(&self) -> bool
pub const fn is_negative_infinity(&self) -> bool
Check if this time is negative infinity
Sourcepub const fn has_been_rounded(&self) -> bool
pub const fn has_been_rounded(&self) -> bool
Check if this time has been rounded
Sourcepub const fn equals(&self, other: &Self) -> bool
pub const fn equals(&self, other: &Self) -> bool
Compare two times for equality (value and timescale)
Sourcepub const fn positive_infinity() -> Self
pub const fn positive_infinity() -> Self
Create a time representing positive infinity
Sourcepub const fn negative_infinity() -> Self
pub const fn negative_infinity() -> Self
Create a time representing negative infinity
Sourcepub const fn indefinite() -> Self
pub const fn indefinite() -> Self
Create an indefinite time
pub fn as_seconds(&self) -> Option<f64>
Trait Implementations§
impl Copy for CMTime
impl Eq for CMTime
impl StructuralPartialEq for CMTime
Auto Trait Implementations§
impl Freeze for CMTime
impl RefUnwindSafe for CMTime
impl Send for CMTime
impl Sync for CMTime
impl Unpin for CMTime
impl UnwindSafe for CMTime
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