diff --git a/README.md b/README.md index 9781429..b972564 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Vid2Img - Video to Image +# vid2img - Video to Image -Vid2img is a Rust crate that allows the use of a video file as a collection of frame images. This crate exposes +vid2img is a Rust crate that allows the use of a video file as a collection of frame images. This crate exposes a `FileSource` type that accepts a video file path and the desired size of the frames, then you can convert the instance into a iterator (`.into_iter()`). On every iteration you will receive a video frame data encoded as PNG. diff --git a/src/file.rs b/src/file.rs index b28b088..4fe0833 100644 --- a/src/file.rs +++ b/src/file.rs @@ -3,6 +3,7 @@ use crate::{FrameData, VideoStream, VideoStreamIterator}; use std::path::{Path, PathBuf}; use std::fs; use std::io; +use std::io::ErrorKind; pub struct FileSource { source: PathBuf, @@ -13,7 +14,7 @@ impl FileSource { pub fn new(source: &Path, frame_size: (u32, u32)) -> Result { let source = fs::canonicalize(source)?; if !source.exists() { - return Err(CaptureError::FileNotFound); + return Err(CaptureError::IoError(io::Error::new(ErrorKind::NotFound, "File not found"))); } Ok(Self { source, @@ -40,7 +41,6 @@ impl IntoIterator for FileSource { #[derive(Debug)] pub enum CaptureError { IoError(io::Error), - FileNotFound, } impl From for CaptureError { diff --git a/src/lib.rs b/src/lib.rs index f86b7e1..454f583 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -//! Vid2img is a Rust crate that allows the use of a video file as a collection of frame images. This crate exposes +//! vid2img is a Rust crate that allows the use of a video file as a collection of frame images. This crate exposes //! a [`vid2img::FileSource`] type that accepts a video file path and the desired size of the frames, then you can convert the //! instance into a iterator (`.into_iter()`). On every iteration you will receive a video frame data encoded as PNG. //!