use crate::media::CodecId;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("not yet implemented: {0}")]
Unimplemented(&'static str),
#[error("end of stream")]
Eof,
#[error("more input required")]
Again,
#[error("invalid data: {0}")]
InvalidData(String),
#[error("unsupported: {0}")]
Unsupported(String),
#[error("no decoder found for codec {0}")]
DecoderNotFound(CodecId),
#[error("no encoder found for codec {0}")]
EncoderNotFound(CodecId),
#[error("no muxer found for format `{0}`")]
MuxerNotFound(String),
#[error("no demuxer found for input `{0}`")]
DemuxerNotFound(String),
#[error("invalid option: {0}")]
Option(String),
#[error("i/o error: {0}")]
Io(#[from] std::io::Error),
}
impl Error {
pub fn invalid(msg: impl Into<String>) -> Self {
Error::InvalidData(msg.into())
}
pub fn unsupported(msg: impl Into<String>) -> Self {
Error::Unsupported(msg.into())
}
}