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