1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Frame ↔ time conversion helpers for the MicroDVD/SubViewer SUB format.
//!
//! SUB encodes cue boundaries as integer frame numbers; converting those to
//! [`std::time::Duration`] and back requires a frame-rate value. The default
//! is [`DEFAULT_SUB_FPS`].
use Duration;
/// Default frame rate assumed when a SUB file does not encode one explicitly.
pub const DEFAULT_SUB_FPS: f32 = 25.0;
/// 24-hour upper bound (in milliseconds) used to discard absurd frame numbers.
///
/// A SUB cue whose computed start or end time exceeds this limit is treated
/// as malformed and skipped by the parser (see the parser's malformed-input
/// disposition matrix).
pub const MAX_DURATION_MS: u64 = 86_400_000;
/// Convert a frame number to milliseconds at the given frame rate.
///
/// Rounds to the nearest millisecond.
pub
/// Convert a [`Duration`] to a frame count at the given frame rate.
///
/// Rounds to the nearest frame.
pub
/// Convenience wrapper that converts a frame number directly to a
/// [`Duration`].
pub