use thiserror::Error;
use crate::error::Unsupported;
pub mod base_index;
pub mod list;
pub mod plan;
pub mod representation;
pub mod template;
pub mod timeline;
pub use plan::{DynamicContext, PlanInput, ResourceRef, SegmentPlan, SegmentRef};
pub use representation::{PlanError, PlanOptions, PlannedRepresentation, plan_representation};
#[derive(Debug, Clone, PartialEq, Eq, Error)]
#[non_exhaustive]
pub enum AddressError {
#[error("invalid template `{template}`: {fault}")]
InvalidTemplate {
template: String,
fault: template::TemplateFault,
},
#[error("unsupported: {0}")]
Unsupported(Unsupported),
#[error("SegmentTemplate has no @media")]
MissingMediaTemplate,
#[error("no @duration or SegmentTimeline to time the segments")]
MissingDuration,
#[error("S@t {t} is before the end of the previous run ({floor})")]
TimelineNotIncreasing {
t: u64,
floor: u64,
},
#[error("S@n {n} is below the expected next number {expected}")]
NumberNotIncreasing {
n: u64,
expected: u64,
},
#[error("S@d is zero")]
ZeroSegmentDuration,
#[error("timeline describes at least {count_hint} segments")]
TimelineTooLong {
count_hint: u64,
},
#[error("SegmentList has {urls} SegmentURL entries but its timeline describes {segments}")]
ListTimelineMismatch {
urls: usize,
segments: u64,
},
#[error("sidx: {0}")]
Sidx(String),
#[error("segment arithmetic overflow")]
Overflow,
#[error("the Representation index (sidx) is required before its segments can be addressed")]
IndexRequired,
#[error("SegmentURL has neither @media nor @mediaRange")]
EmptySegmentUrl,
}