pub struct DtsCalculator { /* private fields */ }Expand description
Standalone DTS calculator.
Given a sequence of (pts, is_keyframe) pairs, produces DTS values that are:
- Strictly non-decreasing.
- Always ≤ the corresponding PTS.
- Separated by at least
min_deltatimebase units.
Useful when you already have the full frame sequence and want to annotate DTS in batch (e.g. when writing container mux metadata).
Implementations§
Source§impl DtsCalculator
impl DtsCalculator
Sourcepub fn new(min_delta: i64, max_b_frames: usize) -> CodecResult<Self>
pub fn new(min_delta: i64, max_b_frames: usize) -> CodecResult<Self>
Create a new calculator.
min_delta must be > 0.
Sourcepub fn next(&mut self, pts: i64, _is_keyframe: bool) -> i64
pub fn next(&mut self, pts: i64, _is_keyframe: bool) -> i64
Compute DTS for a single frame in sequence order.
The first call initialises the internal counter from pts minus the
B-frame pre-roll offset.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DtsCalculator
impl RefUnwindSafe for DtsCalculator
impl Send for DtsCalculator
impl Sync for DtsCalculator
impl Unpin for DtsCalculator
impl UnsafeUnpin for DtsCalculator
impl UnwindSafe for DtsCalculator
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more