util/color_range: add ColorRange
This commit is contained in:
parent
1aea2f63f7
commit
8d828575df
@ -10,3 +10,4 @@ pub use util::error::Error;
|
|||||||
pub use util::dictionary::Dictionary;
|
pub use util::dictionary::Dictionary;
|
||||||
pub use util::rational::Rational;
|
pub use util::rational::Rational;
|
||||||
pub use util::color_space::ColorSpace;
|
pub use util::color_space::ColorSpace;
|
||||||
|
pub use util::color_range::ColorRange;
|
||||||
|
29
src/util/color_range.rs
Normal file
29
src/util/color_range.rs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
use ffi::*;
|
||||||
|
|
||||||
|
#[derive(Eq, PartialEq, Clone, Copy, Debug)]
|
||||||
|
pub enum ColorRange {
|
||||||
|
Unspecified,
|
||||||
|
MPEG,
|
||||||
|
JPEG,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<AVColorRange> for ColorRange {
|
||||||
|
fn from(value: AVColorRange) -> Self {
|
||||||
|
match value {
|
||||||
|
AVCOL_RANGE_UNSPECIFIED => ColorRange::Unspecified,
|
||||||
|
AVCOL_RANGE_MPEG => ColorRange::MPEG,
|
||||||
|
AVCOL_RANGE_JPEG => ColorRange::JPEG,
|
||||||
|
AVCOL_RANGE_NB => ColorRange::Unspecified
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Into<AVColorRange> for ColorRange {
|
||||||
|
fn into(self) -> AVColorRange {
|
||||||
|
match self {
|
||||||
|
ColorRange::Unspecified => AVCOL_RANGE_UNSPECIFIED,
|
||||||
|
ColorRange::MPEG => AVCOL_RANGE_MPEG,
|
||||||
|
ColorRange::JPEG => AVCOL_RANGE_JPEG
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ pub mod dictionary;
|
|||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod rational;
|
pub mod rational;
|
||||||
pub mod color_space;
|
pub mod color_space;
|
||||||
|
pub mod color_range;
|
||||||
|
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user