#[repr(C)]pub struct CMSampleTimingInfo {
pub duration: CMTime,
pub presentation_time_stamp: CMTime,
pub decode_time_stamp: CMTime,
}Expand description
Sample timing information
Contains timing data for a media sample (audio or video frame).
§Examples
use screencapturekit::cm::{CMSampleTimingInfo, CMTime};
let timing = CMSampleTimingInfo::new();
assert!(!timing.is_valid());
let duration = CMTime::new(1, 30);
let pts = CMTime::new(100, 30);
let dts = CMTime::new(100, 30);
let timing = CMSampleTimingInfo::with_times(duration, pts, dts);
assert!(timing.is_valid());Fields§
§duration: CMTime§presentation_time_stamp: CMTime§decode_time_stamp: CMTimeImplementations§
Source§impl CMSampleTimingInfo
impl CMSampleTimingInfo
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new timing info with all times set to invalid
§Examples
use screencapturekit::cm::CMSampleTimingInfo;
let timing = CMSampleTimingInfo::new();
assert!(!timing.is_valid());Sourcepub const fn with_times(
duration: CMTime,
presentation_time_stamp: CMTime,
decode_time_stamp: CMTime,
) -> Self
pub const fn with_times( duration: CMTime, presentation_time_stamp: CMTime, decode_time_stamp: CMTime, ) -> Self
Create timing info with specific values
Sourcepub const fn has_valid_presentation_time(&self) -> bool
pub const fn has_valid_presentation_time(&self) -> bool
Check if presentation timestamp is valid
Sourcepub const fn has_valid_decode_time(&self) -> bool
pub const fn has_valid_decode_time(&self) -> bool
Check if decode timestamp is valid
Sourcepub const fn has_valid_duration(&self) -> bool
pub const fn has_valid_duration(&self) -> bool
Check if duration is valid
Sourcepub fn presentation_seconds(&self) -> Option<f64>
pub fn presentation_seconds(&self) -> Option<f64>
Get the presentation timestamp in seconds
Sourcepub fn decode_seconds(&self) -> Option<f64>
pub fn decode_seconds(&self) -> Option<f64>
Get the decode timestamp in seconds
Sourcepub fn duration_seconds(&self) -> Option<f64>
pub fn duration_seconds(&self) -> Option<f64>
Get the duration in seconds
Trait Implementations§
Source§impl Clone for CMSampleTimingInfo
impl Clone for CMSampleTimingInfo
Source§fn clone(&self) -> CMSampleTimingInfo
fn clone(&self) -> CMSampleTimingInfo
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 CMSampleTimingInfo
impl Debug for CMSampleTimingInfo
Source§impl Default for CMSampleTimingInfo
impl Default for CMSampleTimingInfo
Source§impl Display for CMSampleTimingInfo
impl Display for CMSampleTimingInfo
Source§impl Hash for CMSampleTimingInfo
impl Hash for CMSampleTimingInfo
Source§impl PartialEq for CMSampleTimingInfo
impl PartialEq for CMSampleTimingInfo
impl Copy for CMSampleTimingInfo
impl Eq for CMSampleTimingInfo
impl StructuralPartialEq for CMSampleTimingInfo
Auto Trait Implementations§
impl Freeze for CMSampleTimingInfo
impl RefUnwindSafe for CMSampleTimingInfo
impl Send for CMSampleTimingInfo
impl Sync for CMSampleTimingInfo
impl Unpin for CMSampleTimingInfo
impl UnwindSafe for CMSampleTimingInfo
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