| 1 | use ffi::*; |
| 2 | use libc::c_int; |
| 3 | |
| 4 | #[derive (Eq, PartialEq, Clone, Copy, Debug)] |
| 5 | pub enum Prediction { |
| 6 | Left, |
| 7 | Plane, |
| 8 | Median, |
| 9 | } |
| 10 | |
| 11 | impl From<c_int> for Prediction { |
| 12 | fn from(value: c_int) -> Prediction { |
| 13 | match value { |
| 14 | FF_PRED_LEFT: i32 => Prediction::Left, |
| 15 | FF_PRED_PLANE: i32 => Prediction::Plane, |
| 16 | FF_PRED_MEDIAN: i32 => Prediction::Median, |
| 17 | |
| 18 | _ => Prediction::Left, |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | impl From<Prediction> for c_int { |
| 24 | fn from(value: Prediction) -> c_int { |
| 25 | match value { |
| 26 | Prediction::Left => FF_PRED_LEFT, |
| 27 | Prediction::Plane => FF_PRED_PLANE, |
| 28 | Prediction::Median => FF_PRED_MEDIAN, |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | |