From 241e56f135c572e4bd9f33d59826f978be5e9302 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 6 Feb 2019 10:38:20 +0100 Subject: [PATCH] core: implement defaults for some objects --- nihav-core/src/codecs/mod.rs | 12 ++++++++++++ nihav-core/src/frame.rs | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/nihav-core/src/codecs/mod.rs b/nihav-core/src/codecs/mod.rs index 1d12883..2999cb6 100644 --- a/nihav-core/src/codecs/mod.rs +++ b/nihav-core/src/codecs/mod.rs @@ -77,6 +77,10 @@ impl HAMShuffler { } } +impl Default for HAMShuffler { + fn default() -> Self { Self { lastframe: None } } +} + #[allow(dead_code)] pub struct IPShuffler { lastframe: Option>, @@ -101,6 +105,10 @@ impl IPShuffler { } } +impl Default for IPShuffler { + fn default() -> Self { Self { lastframe: None } } +} + #[allow(dead_code)] pub struct IPBShuffler { lastframe: Option>, @@ -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, diff --git a/nihav-core/src/frame.rs b/nihav-core/src/frame.rs index 9756dfb..cd25ca2 100644 --- a/nihav-core/src/frame.rs +++ b/nihav-core/src/frame.rs @@ -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() { -- 2.39.5