playout_runtime/error.rs
1//! Crate error type.
2
3/// Errors produced by schedule construction, transition planning, and
4/// SCTE-35 emission-point construction.
5#[derive(Debug, thiserror::Error, Clone, PartialEq)]
6#[non_exhaustive]
7pub enum Error {
8 /// [`crate::schedule::Schedule::push`] was called with an entry whose
9 /// `planned_start` does not strictly follow the schedule's last entry —
10 /// entries must be supplied in increasing timeline order.
11 #[error(
12 "schedule entries must be strictly increasing by planned_start: \
13 previous entry starts at {prev}, new entry starts at {next}"
14 )]
15 OutOfOrder {
16 /// `planned_start` of the schedule's current last entry.
17 prev: u64,
18 /// `planned_start` of the entry that was rejected.
19 next: u64,
20 },
21 /// Splice-point conditioning ([`ssai_runtime::splice::condition_splice_point_wrapping`],
22 /// via [`crate::scte35::build_splice_insert`]) found no candidate
23 /// boundary within the caller's tolerance, or was given no candidates at
24 /// all.
25 #[error(transparent)]
26 SpliceConditioning(#[from] ssai_runtime::Error),
27 /// A `break_duration` of 2^33 ticks or more does not fit the 33-bit
28 /// `break_duration()` field (ANSI/SCTE 35 §9.8.2).
29 #[error("break duration {ticks} ticks does not fit the 33-bit break_duration field")]
30 BreakDurationTooLong {
31 /// The rejected duration, in 90 kHz ticks.
32 ticks: u64,
33 },
34}
35
36/// Crate result alias.
37pub type Result<T> = core::result::Result<T, Error>;