#[repr(C)]pub struct TimelineFunction {
    pub subject_time: i64,
    pub reference_time: i64,
    pub subject_delta: u32,
    pub reference_delta: u32,
}Expand description
A TimelineFunction represents a relationship between a subject timeline and a reference timeline with a linear relation.
For example, consider a common use case in which reference time is the monotonic clock of a system and subject time is intended presentation time for some media such as a video.
reference_time is the value of the monotonic clock at the beginning of
playback. subject_time is 0 assuming playback starts at the beginning of
the media. We then choose a reference_delta and subject_delta so that
subject_delta / reference_delta represents the desired playback rate,
e.g. 0/1 for paused and 1/1 for normal playback.
§Formulas
With a function we can determine the subject timeline value s in terms of
reference timeline value r with this formula (where reference_delta > 0):
s = (r - reference_time) * (subject_delta / reference_delta) + subject_time
And similarly we can find the reference timeline value r in terms of
subject timeline value s with this formula (where subject_delta > 0):
r = (s - subject_time) * (reference_delta / subject_delta) + referenc_time
§Choosing time values
Time values can be arbitrary and our linear relation will of course be the same, but we can use them to represent the bounds of pieces in a piecewise linear relation.
For example, if a user performs skip-chapter, we might want to describe
this with a TimelineFunction whose subject_time is the time to skip to,
reference_time is now plus some epsilon, and delta ratio is 1/1 for normal
playback rate.
Fields§
§subject_time: i64A value from the subject timeline that correlates to reference_time.
reference_time: i64A value from the reference timeline that correlates to subject_time.
subject_delta: u32The change in the subject timeline corresponding to reference_delta.
reference_delta: u32The change in the reference timeline corresponding to subject_delta. Cannot be zero.
Trait Implementations§
Source§impl Clone for TimelineFunction
 
impl Clone for TimelineFunction
Source§fn clone(&self) -> TimelineFunction
 
fn clone(&self) -> TimelineFunction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TimelineFunction
 
impl Debug for TimelineFunction
Source§impl<D> Decode<TimelineFunction, D> for TimelineFunctionwhere
    D: ResourceDialect,
 
impl<D> Decode<TimelineFunction, D> for TimelineFunctionwhere
    D: ResourceDialect,
Source§fn new_empty() -> TimelineFunction
 
fn new_empty() -> TimelineFunction
Self. The specific value does not matter,
since it will be overwritten by decode.Source§impl<D> Encode<TimelineFunction, D> for &TimelineFunctionwhere
    D: ResourceDialect,
 
impl<D> Encode<TimelineFunction, D> for &TimelineFunctionwhere
    D: ResourceDialect,
Source§impl Hash for TimelineFunction
 
impl Hash for TimelineFunction
Source§impl Ord for TimelineFunction
 
impl Ord for TimelineFunction
Source§fn cmp(&self, other: &TimelineFunction) -> Ordering
 
fn cmp(&self, other: &TimelineFunction) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
    Self: Sized,
 
fn max(self, other: Self) -> Selfwhere
    Self: Sized,
Source§impl PartialEq for TimelineFunction
 
impl PartialEq for TimelineFunction
Source§impl PartialOrd for TimelineFunction
 
impl PartialOrd for TimelineFunction
Source§impl TypeMarker for TimelineFunction
 
impl TypeMarker for TimelineFunction
Source§type Owned = TimelineFunction
 
type Owned = TimelineFunction
Source§fn inline_align(_context: Context) -> usize
 
fn inline_align(_context: Context) -> usize
Source§fn inline_size(_context: Context) -> usize
 
fn inline_size(_context: Context) -> usize
inline_align.Source§fn encode_is_copy() -> bool
 
fn encode_is_copy() -> bool
Self::Owned matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned to a single memcpy. Read moreSource§fn decode_is_copy() -> bool
 
fn decode_is_copy() -> bool
Self::Owned matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned to a single memcpy.Source§impl ValueTypeMarker for TimelineFunction
 
impl ValueTypeMarker for TimelineFunction
Source§type Borrowed<'a> = &'a TimelineFunction
 
type Borrowed<'a> = &'a TimelineFunction
Encode<Self>
type cheaply obtainable from &Self::Owned. There are three cases: Read moreSource§fn borrow(
    value: &<TimelineFunction as TypeMarker>::Owned,
) -> <TimelineFunction as ValueTypeMarker>::Borrowed<'_>
 
fn borrow( value: &<TimelineFunction as TypeMarker>::Owned, ) -> <TimelineFunction as ValueTypeMarker>::Borrowed<'_>
&Self::Owned to Self::Borrowed.