pub struct NonMonotonicDetector { /* private fields */ }Expand description
Scans a timecode sequence and reports positions where the timecode does not advance monotonically by the expected one frame per step.
Only jumps whose absolute value exceeds threshold_frames are reported,
so callers can ignore minor jitter (e.g. threshold_frames = 0 reports
every non-unit step; threshold_frames = 1 only reports jumps ≥ 2 frames).
§Example
use oximedia_timecode::{Timecode, FrameRate};
use oximedia_timecode::tc_validator::NonMonotonicDetector;
let tc0 = Timecode::new(0, 0, 0, 0, FrameRate::Fps25)?;
let tc1 = Timecode::new(0, 0, 2, 0, FrameRate::Fps25)?; // 2-second jump
let events = NonMonotonicDetector::new(1).scan_sequence(&[tc0, tc1]);
assert_eq!(events.len(), 1);
assert_eq!(events[0].frame_index, 1);Implementations§
Source§impl NonMonotonicDetector
impl NonMonotonicDetector
Sourcepub fn new(threshold_frames: i64) -> Self
pub fn new(threshold_frames: i64) -> Self
Create a new detector with the given threshold.
threshold_frames is the exclusive lower bound on |jump| for
events to be emitted. Set to 0 to report every non-unit step.
Sourcepub fn scan_sequence(self, timecodes: &[Timecode]) -> Vec<NonMonotonicEvent>
pub fn scan_sequence(self, timecodes: &[Timecode]) -> Vec<NonMonotonicEvent>
Scan timecodes and return all non-monotonic events.
The slice must contain at least 2 elements for any events to be
produced; a slice of 0 or 1 elements always returns an empty Vec.
Trait Implementations§
Source§impl Clone for NonMonotonicDetector
impl Clone for NonMonotonicDetector
Source§fn clone(&self) -> NonMonotonicDetector
fn clone(&self) -> NonMonotonicDetector
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NonMonotonicDetector
impl RefUnwindSafe for NonMonotonicDetector
impl Send for NonMonotonicDetector
impl Sync for NonMonotonicDetector
impl Unpin for NonMonotonicDetector
impl UnsafeUnpin for NonMonotonicDetector
impl UnwindSafe for NonMonotonicDetector
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