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: VideoTsThe 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>
pub const EOF: VFrameTs<V>
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> Add<u32> for VFrameTs<V>where
V: VideoFrame,
impl<V> Add<u32> for VFrameTs<V>where
V: VideoFrame,
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> PartialOrd for VFrameTs<V>
impl<V> PartialOrd for VFrameTs<V>
Source§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> Sub<i32> for VFrameTs<V>where
V: VideoFrame,
impl<V> Sub<i32> for VFrameTs<V>where
V: VideoFrame,
Source§impl<V> Sub<u32> for VFrameTs<V>where
V: VideoFrame,
impl<V> Sub<u32> for VFrameTs<V>where
V: VideoFrame,
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> Freeze for VFrameTs<V>
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§
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§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§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.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§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.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§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 moreSource§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 moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§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.Source§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.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.