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: VideoFrame> VFrameTs<V>
impl<V: VideoFrame> VFrameTs<V>
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: Ts, hc: Ts) -> Self
pub fn new(vc: Ts, hc: Ts) -> Self
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) -> Self
pub fn normalized(self) -> Self
Sourcepub fn saturating_normalized(self) -> Self
pub fn saturating_normalized(self) -> Self
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() -> Self
pub fn max_value() -> Self
Returns the largest value that can be represented by a normalized timestamp.
Sourcepub fn min_value() -> Self
pub fn min_value() -> Self
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) -> Self
pub fn saturating_sub_frame(self) -> Self
Returns a video timestamp after subtracting the total number of frame video scanlines from the scan line counter.
Sourcepub fn from_tstates(ts: FTs) -> Self
pub fn from_tstates(ts: FTs) -> Self
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: FTs) -> Option<Self>
pub fn try_from_tstates(ts: FTs) -> Option<Self>
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) -> FTs
pub fn into_tstates(self) -> FTs
Converts the timestamp to FTs.
Sourcepub fn into_frame_tstates(self, frames: u64) -> (u64, FTs)
pub fn into_frame_tstates(self, frames: u64) -> (u64, FTs)
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: VideoFrame> AddAssign<i32> for VFrameTs<V>
impl<V: VideoFrame> AddAssign<i32> for VFrameTs<V>
Source§fn add_assign(&mut self, delta: FTs)
fn add_assign(&mut self, delta: FTs)
+=
operation. Read moreSource§impl<V: VideoFrame> AddAssign<u32> for VFrameTs<V>
impl<V: VideoFrame> AddAssign<u32> for VFrameTs<V>
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<V: VideoFrame> From<&VideoTsData1> for VFrameTs<V>
impl<V: VideoFrame> From<&VideoTsData1> for VFrameTs<V>
Source§fn from(vtsd: &VideoTsData1) -> Self
fn from(vtsd: &VideoTsData1) -> Self
Source§impl<V: VideoFrame> From<&VideoTsData2> for VFrameTs<V>
impl<V: VideoFrame> From<&VideoTsData2> for VFrameTs<V>
Source§fn from(vtsd: &VideoTsData2) -> Self
fn from(vtsd: &VideoTsData2) -> Self
Source§impl<V: VideoFrame> From<&VideoTsData3> for VFrameTs<V>
impl<V: VideoFrame> From<&VideoTsData3> for VFrameTs<V>
Source§fn from(vtsd: &VideoTsData3) -> Self
fn from(vtsd: &VideoTsData3) -> Self
Source§impl<V: VideoFrame> From<&VideoTsData6> for VFrameTs<V>
impl<V: VideoFrame> From<&VideoTsData6> for VFrameTs<V>
Source§fn from(vtsd: &VideoTsData6) -> Self
fn from(vtsd: &VideoTsData6) -> Self
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: VideoFrame> From<VideoTsData1> for VFrameTs<V>
impl<V: VideoFrame> From<VideoTsData1> for VFrameTs<V>
Source§fn from(vtsd: VideoTsData1) -> Self
fn from(vtsd: VideoTsData1) -> Self
Source§impl<V: VideoFrame> From<VideoTsData2> for VFrameTs<V>
impl<V: VideoFrame> From<VideoTsData2> for VFrameTs<V>
Source§fn from(vtsd: VideoTsData2) -> Self
fn from(vtsd: VideoTsData2) -> Self
Source§impl<V: VideoFrame> From<VideoTsData3> for VFrameTs<V>
impl<V: VideoFrame> From<VideoTsData3> for VFrameTs<V>
Source§fn from(vtsd: VideoTsData3) -> Self
fn from(vtsd: VideoTsData3) -> Self
Source§impl<V: VideoFrame> From<VideoTsData6> for VFrameTs<V>
impl<V: VideoFrame> From<VideoTsData6> for VFrameTs<V>
Source§fn from(vtsd: VideoTsData6) -> Self
fn from(vtsd: VideoTsData6) -> Self
Source§impl<V> Ord for VFrameTs<V>
impl<V> Ord for VFrameTs<V>
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§impl<V: VideoFrame> SubAssign<i32> for VFrameTs<V>
impl<V: VideoFrame> SubAssign<i32> for VFrameTs<V>
Source§fn sub_assign(&mut self, delta: FTs)
fn sub_assign(&mut self, delta: FTs)
-=
operation. Read moreSource§impl<V: VideoFrame> SubAssign<u32> for VFrameTs<V>
impl<V: VideoFrame> SubAssign<u32> for VFrameTs<V>
Source§fn sub_assign(&mut self, delta: u32)
fn sub_assign(&mut self, delta: u32)
-=
operation. Read moreSource§impl<V: VideoFrame> TimestampOps for VFrameTs<V>
impl<V: VideoFrame> TimestampOps for VFrameTs<V>
Source§fn saturating_add(self, other: Self) -> Self
fn saturating_add(self, other: Self) -> Self
§Panics
May panic if self
or other
hasn’t been normalized.
Source§fn saturating_sub(self, other: Self) -> Self
fn saturating_sub(self, other: Self) -> Self
§Panics
May panic if self
or other
hasn’t been normalized.
Source§fn from_tstates(ts: FTs) -> Self
fn from_tstates(ts: FTs) -> Self
Source§fn into_tstates(self) -> FTs
fn into_tstates(self) -> FTs
Source§fn max_value() -> Self
fn max_value() -> Self
impl<V: Copy> Copy for VFrameTs<V>
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<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
.