mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-14 06:22:24 +00:00
The eight-part craft-video series landed as one commit, because each part's branch contains the parts before it. - #702 dnx: DNxHD/DNxHR decoder and encoder - #703 vp8: VP8 decoder - #704 prores: ProRes decoder and encoder - #705 h264: H.264 encoder - #706 hevc: HEVC encoder - #707 vp9: VP9 encoder - #708 av1: AV1 encoder
23 lines
758 B
Rust
23 lines
758 B
Rust
/// Errors produced by the decoder.
|
|
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
|
|
pub enum Error {
|
|
/// A syntax element had a value outside its legal range, or a size did not fit the data.
|
|
#[error("invalid bitstream: {0}")]
|
|
Invalid(String),
|
|
/// An inter frame came before any key frame (decoding must start at a key frame).
|
|
#[error("missing reference frame: {0}")]
|
|
MissingReference(String),
|
|
}
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|
|
|
|
/// `ensure!(cond, "message")` returns `Error::Invalid` when `cond` is false.
|
|
macro_rules! ensure {
|
|
($cond:expr, $($arg:tt)+) => {
|
|
if !$cond {
|
|
return Err($crate::vp8::error::Error::Invalid(format!($($arg)+)));
|
|
}
|
|
};
|
|
}
|
|
pub(crate) use ensure;
|