util/color: move color enums to their own module

This commit is contained in:
meh
2015-05-13 15:16:42 +02:00
parent 604c6549fb
commit 3a1af24d2f
9 changed files with 229 additions and 97 deletions

29
src/util/color/range.rs Normal file
View File

@ -0,0 +1,29 @@
use ffi::*;
#[derive(Eq, PartialEq, Clone, Copy, Debug)]
pub enum Range {
Unspecified,
MPEG,
JPEG,
}
impl From<AVColorRange> for Range {
fn from(value: AVColorRange) -> Self {
match value {
AVCOL_RANGE_UNSPECIFIED => Range::Unspecified,
AVCOL_RANGE_MPEG => Range::MPEG,
AVCOL_RANGE_JPEG => Range::JPEG,
AVCOL_RANGE_NB => Range::Unspecified
}
}
}
impl Into<AVColorRange> for Range {
fn into(self) -> AVColorRange {
match self {
Range::Unspecified => AVCOL_RANGE_UNSPECIFIED,
Range::MPEG => AVCOL_RANGE_MPEG,
Range::JPEG => AVCOL_RANGE_JPEG
}
}
}