core: implement defaults for some objects
authorKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 6 Feb 2019 09:38:20 +0000 (10:38 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 6 Feb 2019 09:38:20 +0000 (10:38 +0100)
nihav-core/src/codecs/mod.rs
nihav-core/src/frame.rs

index 1d128833234b5c944d7bd7de7cd7cd911d0e9590..2999cb66315cd47b33481e0c5ae73fe97caccafd 100644 (file)
@@ -77,6 +77,10 @@ impl HAMShuffler {
     }
 }
 
+impl Default for HAMShuffler {
+    fn default() -> Self { Self { lastframe: None } }
+}
+
 #[allow(dead_code)]
 pub struct IPShuffler {
     lastframe: Option<NAVideoBuffer<u8>>,
@@ -101,6 +105,10 @@ impl IPShuffler {
     }
 }
 
+impl Default for IPShuffler {
+    fn default() -> Self { Self { lastframe: None } }
+}
+
 #[allow(dead_code)]
 pub struct IPBShuffler {
     lastframe: Option<NAVideoBuffer<u8>>,
@@ -151,6 +159,10 @@ impl IPBShuffler {
     }
 }
 
+impl Default for IPBShuffler {
+    fn default() -> Self { Self { lastframe: None, nextframe: None } }
+}
+
 #[derive(Debug,Clone,Copy,PartialEq)]
 pub struct MV {
     pub x: i16,
index 9756dfbaded9a3f3402cd3b029f46af926d11600..cd25ca2b4857bea23bb94fa807d55a0b293a2397 100644 (file)
@@ -430,6 +430,10 @@ impl NACodecInfo {
     }
 }
 
+impl Default for NACodecInfo {
+    fn default() -> Self { DUMMY_CODEC_INFO }
+}
+
 impl fmt::Display for NACodecInfo {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let edata = match self.extradata.clone() {