crate: add image support
This commit is contained in:
@ -26,6 +26,10 @@ software-scaling = ["ffmpeg-sys/swscale", "codec"]
|
||||
libc = "0.1"
|
||||
bitflags = "0.1"
|
||||
|
||||
[dependencies.image]
|
||||
version = "*"
|
||||
optional = true
|
||||
|
||||
[dependencies.ffmpeg-sys]
|
||||
version = "2.7.0"
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
extern crate libc;
|
||||
extern crate ffmpeg_sys as ffi;
|
||||
#[macro_use] extern crate bitflags;
|
||||
#[cfg(feature = "image")] extern crate image;
|
||||
|
||||
pub mod util;
|
||||
pub use util::error::Error;
|
||||
|
@ -293,3 +293,24 @@ impl Clone for Video {
|
||||
pub trait Component {
|
||||
fn is_valid(format: format::Pixel) -> bool;
|
||||
}
|
||||
|
||||
#[cfg(feature = "image")]
|
||||
impl Component for ::image::Luma<u8> {
|
||||
fn is_valid(format: format::Pixel) -> bool {
|
||||
format == format::Pixel::GRAY8
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "image")]
|
||||
impl Component for ::image::Rgb<u8> {
|
||||
fn is_valid(format: format::Pixel) -> bool {
|
||||
format == format::Pixel::RGB24
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "image")]
|
||||
impl Component for ::image::Rgba<u8> {
|
||||
fn is_valid(format: format::Pixel) -> bool {
|
||||
format == format::Pixel::RGBA
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user