use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ThumbnailConfig {
pub timestamp: f64,
pub width: Option<u32>,
pub height: Option<u32>,
pub format: ImageFormat,
pub quality: Option<u8>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum ImageFormat {
Jpeg,
Png,
Webp,
}
impl ImageFormat {
pub fn ffmpeg_codec(&self) -> &'static str {
match self {
Self::Jpeg => "mjpeg",
Self::Png => "png",
Self::Webp => "libwebp",
}
}
pub fn extension(&self) -> &'static str {
match self {
Self::Jpeg => "jpg",
Self::Png => "png",
Self::Webp => "webp",
}
}
}