1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use ffi::*;
use libc::c_int;

#[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 From<Prediction> for c_int {
    fn from(value: Prediction) -> c_int {
        match value {
            Prediction::Left => FF_PRED_LEFT,
            Prediction::Plane => FF_PRED_PLANE,
            Prediction::Median => FF_PRED_MEDIAN,
        }
    }
}