diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2019-02-10 18:45:04 +0100 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2019-02-10 18:45:04 +0100 |
commit | 386957f12da36ca64649949c9d4a7a11adfcf62c (patch) | |
tree | 1a33f0bab4a0909a3a12c8037b31ebf808d5c86b /nihav-core/src/formats.rs | |
parent | a38be6e465023778a1b0de9d4399e828f5387300 (diff) | |
download | nihav-386957f12da36ca64649949c9d4a7a11adfcf62c.tar.gz |
formats: add some helper functions and make formaton and chromaton fields public
Diffstat (limited to 'nihav-core/src/formats.rs')
-rw-r--r-- | nihav-core/src/formats.rs | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/nihav-core/src/formats.rs b/nihav-core/src/formats.rs index 952e4c0..0cc24a1 100644 --- a/nihav-core/src/formats.rs +++ b/nihav-core/src/formats.rs @@ -297,6 +297,18 @@ impl ColorModel { _ => 3, } } + pub fn is_rgb(&self) -> bool { + match *self { + ColorModel::RGB(_) => true, + _ => false, + } + } + pub fn is_yuv(&self) -> bool { + match *self { + ColorModel::YUV(_) => true, + _ => false, + } + } } impl fmt::Display for ColorModel { @@ -315,13 +327,13 @@ impl fmt::Display for ColorModel { #[derive(Clone,Copy,PartialEq)] pub struct NAPixelChromaton { - h_ss: u8, - v_ss: u8, - packed: bool, - depth: u8, - shift: u8, - comp_offs: u8, - next_elem: u8, + pub h_ss: u8, + pub v_ss: u8, + pub packed: bool, + pub depth: u8, + pub shift: u8, + pub comp_offs: u8, + pub next_elem: u8, } pub const FORMATON_FLAG_BE :u32 = 0x01; @@ -331,13 +343,13 @@ pub const FORMATON_FLAG_PALETTE :u32 = 0x04; #[derive(Clone,Copy,PartialEq)] pub struct NAPixelFormaton { - model: ColorModel, - components: u8, - comp_info: [Option<NAPixelChromaton>; 5], - elem_size: u8, - be: bool, - alpha: bool, - palette: bool, + pub model: ColorModel, + pub components: u8, + pub comp_info: [Option<NAPixelChromaton>; 5], + pub elem_size: u8, + pub be: bool, + pub alpha: bool, + pub palette: bool, } macro_rules! chromaton { |