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 #[non_exhaustive]
16 OutOfOrder {
17 /// `planned_start` of the schedule's current last entry.
18 prev: u64,
19 /// `planned_start` of the entry that was rejected.
20 next: u64,
21 },
22 /// Splice-point conditioning ([`ssai_runtime::splice::condition_splice_point`],
23 /// via [`crate::scte35::build_splice_insert`]) found no candidate
24 /// boundary within the caller's tolerance, or was given no candidates at
25 /// all.
26 #[error(transparent)]
27 SpliceConditioning(#[from] ssai_runtime::Error),
28 /// A `break_duration` of 2^33 ticks or more does not fit the 33-bit
29 /// `break_duration()` field (ANSI/SCTE 35 §9.8.2).
30 #[error("break duration {nanos} ns does not fit the 33-bit break_duration field")]
31 #[non_exhaustive]
32 BreakDurationTooLong {
33 /// The rejected duration, in nanoseconds.
34 nanos: u64,
35 },
36}
37
38/// Crate result alias.
39pub type Result<T> = core::result::Result<T, Error>;