|
|
@ -17,6 +17,7 @@ pub enum ThumbError {
|
|
|
|
|
|
|
|
|
|
|
|
NullVideo,
|
|
|
|
NullVideo,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "ffmpeg")]
|
|
|
|
FFMPEG(ffmpeg_next::Error),
|
|
|
|
FFMPEG(ffmpeg_next::Error),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -28,6 +29,8 @@ impl Display for ThumbError {
|
|
|
|
ThumbError::Decode => write!(f, "failed to decode image"),
|
|
|
|
ThumbError::Decode => write!(f, "failed to decode image"),
|
|
|
|
ThumbError::Unsupported(mime) => write!(f, "Unsupported media type {}", mime),
|
|
|
|
ThumbError::Unsupported(mime) => write!(f, "Unsupported media type {}", mime),
|
|
|
|
ThumbError::NullVideo => write!(f, "no video data found in file"),
|
|
|
|
ThumbError::NullVideo => write!(f, "no video data found in file"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "ffmpeg")]
|
|
|
|
ThumbError::FFMPEG(e) => write!(f, "ffmpeg error: {}", e),
|
|
|
|
ThumbError::FFMPEG(e) => write!(f, "ffmpeg error: {}", e),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -38,7 +41,10 @@ impl std::error::Error for ThumbError {
|
|
|
|
match self {
|
|
|
|
match self {
|
|
|
|
ThumbError::IO(e) => e.source(),
|
|
|
|
ThumbError::IO(e) => e.source(),
|
|
|
|
ThumbError::Image(i) => i.source(),
|
|
|
|
ThumbError::Image(i) => i.source(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "ffmpeg")]
|
|
|
|
ThumbError::FFMPEG(e) => e.source(),
|
|
|
|
ThumbError::FFMPEG(e) => e.source(),
|
|
|
|
|
|
|
|
|
|
|
|
_ => None,
|
|
|
|
_ => None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -56,6 +62,7 @@ impl From<image::error::ImageError> for ThumbError {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "ffmpeg")]
|
|
|
|
impl From<ffmpeg_next::Error> for ThumbError {
|
|
|
|
impl From<ffmpeg_next::Error> for ThumbError {
|
|
|
|
fn from(e: ffmpeg_next::Error) -> Self {
|
|
|
|
fn from(e: ffmpeg_next::Error) -> Self {
|
|
|
|
Self::FFMPEG(e)
|
|
|
|
Self::FFMPEG(e)
|
|
|
|