#[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: i64
A value from the subject timeline that correlates to reference_time.
reference_time: i64
A value from the reference timeline that correlates to subject_time.
subject_delta: u32
The change in the subject timeline corresponding to reference_delta.
reference_delta: u32
The 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: ResourceDialect> Decode<TimelineFunction, D> for TimelineFunction
impl<D: ResourceDialect> Decode<TimelineFunction, D> for TimelineFunction
Source§impl<D: ResourceDialect> Encode<TimelineFunction, D> for &TimelineFunction
impl<D: ResourceDialect> Encode<TimelineFunction, D> for &TimelineFunction
Source§impl<D: ResourceDialect, T0: Encode<i64, D>, T1: Encode<i64, D>, T2: Encode<u32, D>, T3: Encode<u32, D>> Encode<TimelineFunction, D> for (T0, T1, T2, T3)
impl<D: ResourceDialect, T0: Encode<i64, D>, T1: Encode<i64, D>, T2: Encode<u32, D>, T3: Encode<u32, D>> Encode<TimelineFunction, D> for (T0, T1, T2, T3)
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 moreimpl Copy for TimelineFunction
impl Eq for TimelineFunction
impl Persistable for TimelineFunction
impl StructuralPartialEq for TimelineFunction
Auto Trait Implementations§
impl Freeze for TimelineFunction
impl RefUnwindSafe for TimelineFunction
impl Send for TimelineFunction
impl Sync for TimelineFunction
impl Unpin for TimelineFunction
impl UnwindSafe for TimelineFunction
Blanket Implementations§
§impl<T> Body for Twhere
T: Persistable,
impl<T> Body for Twhere
T: Persistable,
§type MarkerAtTopLevel = T
type MarkerAtTopLevel = T
§type MarkerInResultUnion = T
type MarkerInResultUnion = T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)