#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("moq: {0}")]
Moq(#[from] moq_net::Error),
#[error("hang: {0}")]
Hang(#[from] hang::Error),
#[error("json: {0}")]
Json(#[from] moq_json::Error),
#[error("cmaf: {0}")]
Cmaf(#[from] crate::container::fmp4::Error),
#[error("mkv: {0}")]
Mkv(#[from] crate::container::mkv::Error),
#[error("msf: {0}")]
Msf(#[from] crate::catalog::msf::Error),
#[error("loc: {0}")]
Loc(#[from] moq_loc::Error),
#[error("annexb: {0}")]
Annexb(#[from] crate::codec::annexb::Error),
#[error("aac: {0}")]
Aac(#[from] crate::codec::aac::Error),
#[error("opus: {0}")]
Opus(#[from] crate::codec::opus::Error),
#[error("h264: {0}")]
H264(#[from] crate::codec::h264::Error),
#[error("h265: {0}")]
H265(#[from] crate::codec::h265::Error),
#[error("av1: {0}")]
Av1(#[from] crate::codec::av1::Error),
#[error("vp8: {0}")]
Vp8(#[from] crate::codec::vp8::Error),
#[error("vp9: {0}")]
Vp9(#[from] crate::codec::vp9::Error),
#[error("legacy: {0}")]
Legacy(#[from] crate::codec::legacy::Error),
#[error("timestamp overflow")]
TimestampOverflow(#[from] moq_net::TimeOverflow),
#[error("mp4: {0}")]
Mp4(std::sync::Arc<mp4_atom::Error>),
#[error("io: {0}")]
Io(std::sync::Arc<std::io::Error>),
#[error("url: {0}")]
Url(#[from] url::ParseError),
#[error("unknown format: {0}")]
UnknownFormat(String),
#[error("{0}")]
MissingKeyframe(#[from] crate::container::MissingKeyframe),
#[error("{0}")]
Other(std::sync::Arc<anyhow::Error>),
#[error("reserved catalog section: {0}")]
ReservedSection(String),
}
impl From<anyhow::Error> for Error {
fn from(err: anyhow::Error) -> Self {
Error::Other(std::sync::Arc::new(err))
}
}
impl From<mp4_atom::Error> for Error {
fn from(err: mp4_atom::Error) -> Self {
Error::Mp4(std::sync::Arc::new(err))
}
}
impl From<std::io::Error> for Error {
fn from(err: std::io::Error) -> Self {
Error::Io(std::sync::Arc::new(err))
}
}
pub type Result<T> = std::result::Result<T, Error>;