add declared bitdepth to NAVideoInfo
[nihav.git] / nihav-core / src / frame.rs
index 26e8640aa5dc236ee7ba605cf2126e91c333a957..6386d6f80902c7b2c7ba9e72487e9b2c396dc029 100644 (file)
@@ -53,12 +53,15 @@ pub struct NAVideoInfo {
     pub flipped:    bool,
     /// Picture pixel format.
     pub format:     NAPixelFormaton,
+    /// Declared bits per sample.
+    pub bits:       u8,
 }
 
 impl NAVideoInfo {
     /// Constructs a new `NAVideoInfo` instance.
     pub fn new(w: usize, h: usize, flip: bool, fmt: NAPixelFormaton) -> Self {
-        NAVideoInfo { width: w, height: h, flipped: flip, format: fmt }
+        let bits = fmt.get_total_depth();
+        NAVideoInfo { width: w, height: h, flipped: flip, format: fmt, bits }
     }
     /// Returns picture width.
     pub fn get_width(&self)  -> usize { self.width as usize }