1 | use ffi::AVRounding::*; |
2 | use ffi::*; |
3 | |
4 | #[derive (Eq, PartialEq, Clone, Copy, Debug)] |
5 | pub enum Rounding { |
6 | Zero, |
7 | Infinity, |
8 | Down, |
9 | Up, |
10 | NearInfinity, |
11 | PassMinMax, |
12 | } |
13 | |
14 | impl From<AVRounding> for Rounding { |
15 | #[inline (always)] |
16 | fn from(value: AVRounding) -> Self { |
17 | match value { |
18 | AV_ROUND_ZERO => Rounding::Zero, |
19 | AV_ROUND_INF => Rounding::Infinity, |
20 | AV_ROUND_DOWN => Rounding::Down, |
21 | AV_ROUND_UP => Rounding::Up, |
22 | AV_ROUND_NEAR_INF => Rounding::NearInfinity, |
23 | AV_ROUND_PASS_MINMAX => Rounding::PassMinMax, |
24 | } |
25 | } |
26 | } |
27 | |
28 | impl From<Rounding> for AVRounding { |
29 | #[inline (always)] |
30 | fn from(value: Rounding) -> AVRounding { |
31 | match value { |
32 | Rounding::Zero => AV_ROUND_ZERO, |
33 | Rounding::Infinity => AV_ROUND_INF, |
34 | Rounding::Down => AV_ROUND_DOWN, |
35 | Rounding::Up => AV_ROUND_UP, |
36 | Rounding::NearInfinity => AV_ROUND_NEAR_INF, |
37 | Rounding::PassMinMax => AV_ROUND_PASS_MINMAX, |
38 | } |
39 | } |
40 | } |
41 | |