use eye_hal::format::PixelFormat;
mod error;
mod rgb;
mod yuv;
#[cfg(feature = "jpeg")]
mod jpeg;
pub use error::{Error, ErrorKind, Result};
pub fn blueprints() -> Vec<Box<dyn Blueprint>> {
vec![
Box::new(rgb::blueprint()),
#[cfg(feature = "jpeg")]
Box::new(jpeg::blueprint()),
Box::new(yuv::blueprint()),
]
}
pub trait Blueprint {
fn instantiate(
&self,
inparams: Parameters,
outparams: Parameters,
) -> Result<Box<dyn Codec + Send>>;
fn src_fmts(&self) -> Vec<PixelFormat>;
fn dst_fmts(&self) -> Vec<PixelFormat>;
}
pub trait Codec {
fn decode(&self, inbuf: &[u8], outbuf: &mut Vec<u8>) -> Result<()>;
}
#[derive(Debug, Clone)]
pub struct Parameters {
pub pixfmt: PixelFormat,
pub width: u32,
pub height: u32,
}