1 | use ffi::AVChromaLocation::*; |
2 | use ffi::*; |
3 | |
4 | #[derive (Eq, PartialEq, Clone, Copy, Debug)] |
5 | pub enum Location { |
6 | Unspecified, |
7 | Left, |
8 | Center, |
9 | TopLeft, |
10 | Top, |
11 | BottomLeft, |
12 | Bottom, |
13 | } |
14 | |
15 | impl From<AVChromaLocation> for Location { |
16 | fn from(value: AVChromaLocation) -> Self { |
17 | match value { |
18 | AVCHROMA_LOC_UNSPECIFIED => Location::Unspecified, |
19 | AVCHROMA_LOC_LEFT => Location::Left, |
20 | AVCHROMA_LOC_CENTER => Location::Center, |
21 | AVCHROMA_LOC_TOPLEFT => Location::TopLeft, |
22 | AVCHROMA_LOC_TOP => Location::Top, |
23 | AVCHROMA_LOC_BOTTOMLEFT => Location::BottomLeft, |
24 | AVCHROMA_LOC_BOTTOM => Location::Bottom, |
25 | AVCHROMA_LOC_NB => Location::Unspecified, |
26 | } |
27 | } |
28 | } |
29 | |
30 | impl From<Location> for AVChromaLocation { |
31 | fn from(value: Location) -> AVChromaLocation { |
32 | match value { |
33 | Location::Unspecified => AVCHROMA_LOC_UNSPECIFIED, |
34 | Location::Left => AVCHROMA_LOC_LEFT, |
35 | Location::Center => AVCHROMA_LOC_CENTER, |
36 | Location::TopLeft => AVCHROMA_LOC_TOPLEFT, |
37 | Location::Top => AVCHROMA_LOC_TOP, |
38 | Location::BottomLeft => AVCHROMA_LOC_BOTTOMLEFT, |
39 | Location::Bottom => AVCHROMA_LOC_BOTTOM, |
40 | } |
41 | } |
42 | } |
43 | |