Struct spectrusty::clock::VFrameTs
source · pub struct VFrameTs<V> {
pub ts: VideoTs,
/* private fields */
}
Expand description
A VideoTs timestamp wrapper with a constraint to the V:
VideoFrame,
implementing methods and traits for timestamp calculations.
Fields§
§ts: VideoTs
The current value of the timestamp.
Implementations§
source§impl<V> VFrameTs<V>where
V: VideoFrame,
impl<V> VFrameTs<V>where
V: VideoFrame,
sourcepub const EOF: VFrameTs<V> = VFrameTs{ ts: VideoTs{ vc: V::VSL_COUNT, hc: 0,}, _vframe: PhantomData,}
pub const EOF: VFrameTs<V> = VFrameTs{ ts: VideoTs{ vc: V::VSL_COUNT, hc: 0,}, _vframe: PhantomData,}
The end-of-frame timestamp, equal to the total number of T-states per frame.
sourcepub fn new(vc: i16, hc: i16) -> VFrameTs<V>
pub fn new(vc: i16, hc: i16) -> VFrameTs<V>
Constructs a new VFrameTs
from the given vertical and horizontal counter values.
Note: The returned VFrameTs
is not normalized.
sourcepub fn is_normalized(self) -> bool
pub fn is_normalized(self) -> bool
Returns true
if a video timestamp is normalized. Otherwise returns false
.
sourcepub fn normalized(self) -> VFrameTs<V>
pub fn normalized(self) -> VFrameTs<V>
sourcepub fn saturating_normalized(self) -> VFrameTs<V>
pub fn saturating_normalized(self) -> VFrameTs<V>
Returns a video timestamp with a horizontal counter within the allowed range and a scan line counter adjusted accordingly. Saturates at VFrameTs::min_value or VFrameTs::max_value.
sourcepub fn max_value() -> VFrameTs<V>
pub fn max_value() -> VFrameTs<V>
Returns the largest value that can be represented by a normalized timestamp.
sourcepub fn min_value() -> VFrameTs<V>
pub fn min_value() -> VFrameTs<V>
Returns the smallest value that can be represented by a normalized timestamp.
sourcepub fn is_eof(self) -> bool
pub fn is_eof(self) -> bool
Returns true
if the counter value is past or near the end of a frame. Otherwise returns false
.
Specifically, the condition is met if the vertical counter is equal to or greater than VideoFrame::VSL_COUNT.
sourcepub fn wrap_frame(&mut self)
pub fn wrap_frame(&mut self)
Ensures the vertical counter is in the range: (-VSL_COUNT, VSL_COUNT)
by calculating
a remainder of the division of the vertical counter by VideoFrame::VSL_COUNT.
sourcepub fn saturating_sub_frame(self) -> VFrameTs<V>
pub fn saturating_sub_frame(self) -> VFrameTs<V>
Returns a video timestamp after subtracting the total number of frame video scanlines from the scan line counter.
sourcepub fn from_tstates(ts: i32) -> VFrameTs<V>
pub fn from_tstates(ts: i32) -> VFrameTs<V>
Returns a normalized timestamp from the given number of T-states.
Panics
Panics when the given ts
overflows the capacity of the timestamp.
sourcepub fn try_from_tstates(ts: i32) -> Option<VFrameTs<V>>
pub fn try_from_tstates(ts: i32) -> Option<VFrameTs<V>>
On success returns a normalized timestamp from the given number of T-states.
Returns None
when the given ts
overflows the capacity of the timestamp.
sourcepub fn into_tstates(self) -> i32
pub fn into_tstates(self) -> i32
Converts the timestamp to FTs.
sourcepub fn into_frame_tstates(self, frames: u64) -> (u64, i32)
pub fn into_frame_tstates(self, frames: u64) -> (u64, i32)
Returns a tuple with an adjusted frame counter and with the frame-normalized timestamp as the number of T-states measured from the start of the frame.
The frame starts when the horizontal and vertical counter are both 0.
The returned timestamp value is in the range [0, VideoFrame::FRAME_TSTATES_COUNT).
Trait Implementations§
source§impl<V> AddAssign<i32> for VFrameTs<V>where
V: VideoFrame,
impl<V> AddAssign<i32> for VFrameTs<V>where
V: VideoFrame,
source§fn add_assign(&mut self, delta: i32)
fn add_assign(&mut self, delta: i32)
+=
operation. Read moresource§impl<V> AddAssign<u32> for VFrameTs<V>where
V: VideoFrame,
impl<V> AddAssign<u32> for VFrameTs<V>where
V: VideoFrame,
source§fn add_assign(&mut self, delta: u32)
fn add_assign(&mut self, delta: u32)
+=
operation. Read moresource§impl<'de, V> Deserialize<'de> for VFrameTs<V>where
V: VideoFrame,
impl<'de, V> Deserialize<'de> for VFrameTs<V>where
V: VideoFrame,
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<VFrameTs<V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<VFrameTs<V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl<V> From<&VideoTsData1> for VFrameTs<V>where
V: VideoFrame,
impl<V> From<&VideoTsData1> for VFrameTs<V>where
V: VideoFrame,
source§fn from(vtsd: &VideoTsData1) -> VFrameTs<V>
fn from(vtsd: &VideoTsData1) -> VFrameTs<V>
source§impl<V> From<&VideoTsData2> for VFrameTs<V>where
V: VideoFrame,
impl<V> From<&VideoTsData2> for VFrameTs<V>where
V: VideoFrame,
source§fn from(vtsd: &VideoTsData2) -> VFrameTs<V>
fn from(vtsd: &VideoTsData2) -> VFrameTs<V>
source§impl<V> From<&VideoTsData3> for VFrameTs<V>where
V: VideoFrame,
impl<V> From<&VideoTsData3> for VFrameTs<V>where
V: VideoFrame,
source§fn from(vtsd: &VideoTsData3) -> VFrameTs<V>
fn from(vtsd: &VideoTsData3) -> VFrameTs<V>
source§impl<V> From<&VideoTsData6> for VFrameTs<V>where
V: VideoFrame,
impl<V> From<&VideoTsData6> for VFrameTs<V>where
V: VideoFrame,
source§fn from(vtsd: &VideoTsData6) -> VFrameTs<V>
fn from(vtsd: &VideoTsData6) -> VFrameTs<V>
source§impl<V, C> From<VFrameTsCounter<V, C>> for VFrameTs<V>
impl<V, C> From<VFrameTsCounter<V, C>> for VFrameTs<V>
source§fn from(vftsc: VFrameTsCounter<V, C>) -> VFrameTs<V>
fn from(vftsc: VFrameTsCounter<V, C>) -> VFrameTs<V>
source§impl<V> From<VideoTsData1> for VFrameTs<V>where
V: VideoFrame,
impl<V> From<VideoTsData1> for VFrameTs<V>where
V: VideoFrame,
source§fn from(vtsd: VideoTsData1) -> VFrameTs<V>
fn from(vtsd: VideoTsData1) -> VFrameTs<V>
source§impl<V> From<VideoTsData2> for VFrameTs<V>where
V: VideoFrame,
impl<V> From<VideoTsData2> for VFrameTs<V>where
V: VideoFrame,
source§fn from(vtsd: VideoTsData2) -> VFrameTs<V>
fn from(vtsd: VideoTsData2) -> VFrameTs<V>
source§impl<V> From<VideoTsData3> for VFrameTs<V>where
V: VideoFrame,
impl<V> From<VideoTsData3> for VFrameTs<V>where
V: VideoFrame,
source§fn from(vtsd: VideoTsData3) -> VFrameTs<V>
fn from(vtsd: VideoTsData3) -> VFrameTs<V>
source§impl<V> From<VideoTsData6> for VFrameTs<V>where
V: VideoFrame,
impl<V> From<VideoTsData6> for VFrameTs<V>where
V: VideoFrame,
source§fn from(vtsd: VideoTsData6) -> VFrameTs<V>
fn from(vtsd: VideoTsData6) -> VFrameTs<V>
source§impl<V> Ord for VFrameTs<V>
impl<V> Ord for VFrameTs<V>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<V> PartialEq<VFrameTs<V>> for VFrameTs<V>
impl<V> PartialEq<VFrameTs<V>> for VFrameTs<V>
source§impl<V> PartialOrd<VFrameTs<V>> for VFrameTs<V>
impl<V> PartialOrd<VFrameTs<V>> for VFrameTs<V>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<V> Serialize for VFrameTs<V>where
V: VideoFrame,
impl<V> Serialize for VFrameTs<V>where
V: VideoFrame,
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§impl<V> SubAssign<i32> for VFrameTs<V>where
V: VideoFrame,
impl<V> SubAssign<i32> for VFrameTs<V>where
V: VideoFrame,
source§fn sub_assign(&mut self, delta: i32)
fn sub_assign(&mut self, delta: i32)
-=
operation. Read moresource§impl<V> SubAssign<u32> for VFrameTs<V>where
V: VideoFrame,
impl<V> SubAssign<u32> for VFrameTs<V>where
V: VideoFrame,
source§fn sub_assign(&mut self, delta: u32)
fn sub_assign(&mut self, delta: u32)
-=
operation. Read moresource§impl<V> TimestampOps for VFrameTs<V>where
V: VideoFrame,
impl<V> TimestampOps for VFrameTs<V>where
V: VideoFrame,
source§fn saturating_add(self, other: VFrameTs<V>) -> VFrameTs<V>
fn saturating_add(self, other: VFrameTs<V>) -> VFrameTs<V>
Panics
May panic if self
or other
hasn’t been normalized.
source§fn saturating_sub(self, other: VFrameTs<V>) -> VFrameTs<V>
fn saturating_sub(self, other: VFrameTs<V>) -> VFrameTs<V>
Panics
May panic if self
or other
hasn’t been normalized.
source§fn from_tstates(ts: i32) -> VFrameTs<V>
fn from_tstates(ts: i32) -> VFrameTs<V>
source§fn into_tstates(self) -> i32
fn into_tstates(self) -> i32
source§fn max_value() -> VFrameTs<V>
fn max_value() -> VFrameTs<V>
impl<V> Copy for VFrameTs<V>where
V: Copy,
impl<V> Eq for VFrameTs<V>
Auto Trait Implementations§
impl<V> RefUnwindSafe for VFrameTs<V>where
V: RefUnwindSafe,
impl<V> Send for VFrameTs<V>where
V: Send,
impl<V> Sync for VFrameTs<V>where
V: Sync,
impl<V> Unpin for VFrameTs<V>where
V: Unpin,
impl<V> UnwindSafe for VFrameTs<V>where
V: UnwindSafe,
Blanket Implementations§
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
source§impl<S, T> IntoSample<S> for Twhere
S: FromSample<T>,
impl<S, T> IntoSample<S> for Twhere
S: FromSample<T>,
source§fn into_sample(self) -> S
fn into_sample(self) -> S
S
a sample type from self
.§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds. Read more§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds. Read more§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds. Read more§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more