1 | use ffi::*; |
2 | use libc::c_int; |
3 | |
4 | #[derive (Eq, PartialEq, Clone, Copy, Debug)] |
5 | pub enum ColorSpace { |
6 | Default, |
7 | |
8 | ITU709, |
9 | FCC, |
10 | ITU601, |
11 | ITU624, |
12 | SMPTE170M, |
13 | SMPTE240M, |
14 | } |
15 | |
16 | impl From<c_int> for ColorSpace { |
17 | fn from(value: c_int) -> ColorSpace { |
18 | match value { |
19 | SWS_CS_ITU709: i32 => ColorSpace::ITU709, |
20 | SWS_CS_FCC: i32 => ColorSpace::FCC, |
21 | SWS_CS_DEFAULT: i32 => ColorSpace::Default, |
22 | SWS_CS_SMPTE240M: i32 => ColorSpace::SMPTE240M, |
23 | |
24 | _ => ColorSpace::Default, |
25 | } |
26 | } |
27 | } |
28 | |
29 | impl From<ColorSpace> for c_int { |
30 | fn from(value: ColorSpace) -> c_int { |
31 | match value { |
32 | ColorSpace::Default => SWS_CS_DEFAULT, |
33 | ColorSpace::ITU709 => SWS_CS_ITU709, |
34 | ColorSpace::FCC => SWS_CS_FCC, |
35 | ColorSpace::ITU601 => SWS_CS_ITU601, |
36 | ColorSpace::ITU624 => SWS_CS_ITU624, |
37 | ColorSpace::SMPTE170M => SWS_CS_SMPTE170M, |
38 | ColorSpace::SMPTE240M => SWS_CS_SMPTE240M, |
39 | } |
40 | } |
41 | } |
42 | |