Skip to main content

CMSampleTimingInfo

Struct CMSampleTimingInfo 

Source
#[repr(C)]
pub struct CMSampleTimingInfo { pub duration: CMTime, pub presentation_time_stamp: CMTime, pub decode_time_stamp: CMTime, }
Available on crate feature cm only.
Expand description

Sample timing information

Contains timing data for a media sample (audio or video frame).

§Examples

use apple_cf::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: CMTime

Implementations§

Source§

impl CMSampleTimingInfo

Source

pub const fn new() -> Self

Create a new timing info with all times set to invalid

§Examples
use apple_cf::cm::CMSampleTimingInfo;

let timing = CMSampleTimingInfo::new();
assert!(!timing.is_valid());
Source

pub const fn with_times( duration: CMTime, presentation_time_stamp: CMTime, decode_time_stamp: CMTime, ) -> Self

Create timing info with specific values

Source

pub const fn is_valid(&self) -> bool

Check if all timing fields are valid Returns whether this time carries Core Media’s valid flag.

Source

pub const fn has_valid_presentation_time(&self) -> bool

Check if presentation timestamp is valid

Source

pub const fn has_valid_decode_time(&self) -> bool

Check if decode timestamp is valid

Source

pub const fn has_valid_duration(&self) -> bool

Check if duration is valid

Source

pub fn presentation_seconds(&self) -> Option<f64>

Get the presentation timestamp in seconds

Source

pub fn decode_seconds(&self) -> Option<f64>

Get the decode timestamp in seconds

Source

pub fn duration_seconds(&self) -> Option<f64>

Get the duration in seconds

Trait Implementations§

Source§

impl Clone for CMSampleTimingInfo

Source§

fn clone(&self) -> CMSampleTimingInfo

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 CMSampleTimingInfo

Source§

impl Debug for CMSampleTimingInfo

Source§

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

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

impl Default for CMSampleTimingInfo

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for CMSampleTimingInfo

Source§

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

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

impl Eq for CMSampleTimingInfo

Source§

impl Hash for CMSampleTimingInfo

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 CMSampleTimingInfo

Source§

fn eq(&self, other: &CMSampleTimingInfo) -> 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 CMSampleTimingInfo

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.