crates/format/video/src/lib.rs 1.3 KiB 41 lines Raw
1 //! inf3r-video — the timebase, the clip, and the mp4 header.2 //!3 //! A plugin owns its codec, so the core owns only the arithmetic that every4 //! clip needs and the container header that a client can check without linking5 //! an encoder (spec section 18, rule 2).6 7 use std::fmt;8 9 pub mod clip;10 pub mod mp4;11 pub mod time;12 13 pub use clip::Clip;14 pub use mp4::{box_of, empty, ftyp};15 pub use time::{Rational, Timebase};16 17 /// The reason a video operation failed.18 #[derive(Clone, PartialEq, Eq, Debug)]19 pub enum VideoError {20     /// A side or the frame count is zero, so the clip has no picture.21     Empty,22     /// A denominator is zero, or a rate has no period to divide by.23     Division,24     /// A side is above the largest frame that the deploy carries.25     TooLarge,26     /// A container field cannot hold the value that the caller gave.27     Text(&'static str),28 }29 30 impl fmt::Display for VideoError {31     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {32         match self {33             VideoError::Empty => write!(f, "the clip is empty"),34             VideoError::Division => write!(f, "the rate has a zero denominator"),35             VideoError::TooLarge => write!(f, "a side is beyond the codec limit"),36             VideoError::Text(why) => write!(f, "{why}"),37         }38     }39 }40 41 impl std::error::Error for VideoError {}