util/picture: add picture::Type

This commit is contained in:
meh 2015-05-12 19:19:52 +02:00
parent 72e300f09e
commit 72025673c9
3 changed files with 45 additions and 0 deletions

View File

@ -12,6 +12,7 @@ pub use util::rational::Rational;
pub use util::color_space::ColorSpace; pub use util::color_space::ColorSpace;
pub use util::color_range::ColorRange; pub use util::color_range::ColorRange;
pub use util::media; pub use util::media;
pub use util::picture;
pub use util::frame::{self, Frame}; pub use util::frame::{self, Frame};
pub mod format; pub mod format;

View File

@ -2,6 +2,7 @@ pub mod dictionary;
pub mod error; pub mod error;
pub mod rational; pub mod rational;
pub mod media; pub mod media;
pub mod picture;
pub mod color_space; pub mod color_space;
pub mod color_range; pub mod color_range;
pub mod sample_format; pub mod sample_format;

43
src/util/picture.rs Normal file
View File

@ -0,0 +1,43 @@
use ffi::*;
#[derive(Eq, PartialEq, Clone, Copy, Debug)]
pub enum Type {
None,
I,
P,
B,
S,
SI,
SP,
BI
}
impl From<AVPictureType> for Type {
fn from(value: AVPictureType) -> Type {
match value {
AV_PICTURE_TYPE_NONE => Type::None,
AV_PICTURE_TYPE_I => Type::I,
AV_PICTURE_TYPE_P => Type::P,
AV_PICTURE_TYPE_B => Type::B,
AV_PICTURE_TYPE_S => Type::S,
AV_PICTURE_TYPE_SI => Type::SI,
AV_PICTURE_TYPE_SP => Type::SP,
AV_PICTURE_TYPE_BI => Type::BI
}
}
}
impl Into<AVPictureType> for Type {
fn into(self) -> AVPictureType {
match self {
Type::None => AV_PICTURE_TYPE_NONE,
Type::I => AV_PICTURE_TYPE_I,
Type::P => AV_PICTURE_TYPE_P,
Type::B => AV_PICTURE_TYPE_B,
Type::S => AV_PICTURE_TYPE_S,
Type::SI => AV_PICTURE_TYPE_SI,
Type::SP => AV_PICTURE_TYPE_SP,
Type::BI => AV_PICTURE_TYPE_BI
}
}
}