codec/encoder/prediction: add enum

This commit is contained in:
meh 2015-05-16 22:40:17 +02:00
parent d68a9192ba
commit 457bffbeb2
2 changed files with 34 additions and 0 deletions

View File

@ -10,6 +10,9 @@ pub use self::subtitle::Subtitle;
pub mod motion_estimation; pub mod motion_estimation;
pub use self::motion_estimation::MotionEstimation; pub use self::motion_estimation::MotionEstimation;
pub mod prediction;
pub use self::prediction::Prediction;
use std::ffi::CString; use std::ffi::CString;
use std::ptr; use std::ptr;
use std::ops::Deref; use std::ops::Deref;

View File

@ -0,0 +1,31 @@
use libc::c_int;
use ffi::*;
#[derive(Eq, PartialEq, Clone, Copy, Debug)]
pub enum Prediction {
Left,
Plane,
Median,
}
impl From<c_int> for Prediction {
fn from(value: c_int) -> Prediction {
match value {
FF_PRED_LEFT => Prediction::Left,
FF_PRED_PLANE => Prediction::Plane,
FF_PRED_MEDIAN => Prediction::Median,
_ => Prediction::Left
}
}
}
impl Into<c_int> for Prediction {
fn into(self) -> c_int {
match self {
Prediction::Left => FF_PRED_LEFT,
Prediction::Plane => FF_PRED_PLANE,
Prediction::Median => FF_PRED_MEDIAN,
}
}
}