remove trailing whitespaces
[nihav.git] / nihav-core / src / register.rs
index 8d6bab4c693e4985be22ab693eb05bc1e2409e54..7c1fc1d7cfcd583b174f80cd38852d44db7dfe06 100644 (file)
@@ -22,11 +22,11 @@ impl fmt::Display for CodecType {
     }
 }
 
-const CODEC_CAP_INTRAONLY:u32   = 0x000001;
-const CODEC_CAP_LOSSLESS:u32    = 0x000002;
-const CODEC_CAP_REORDER:u32     = 0x000004;
-const CODEC_CAP_HYBRID:u32      = 0x000008;
-const CODEC_CAP_SCALABLE:u32    = 0x000010;
+const CODEC_CAP_INTRAONLY:u32   = 0x0001;
+const CODEC_CAP_LOSSLESS:u32    = 0x0002;
+const CODEC_CAP_REORDER:u32     = 0x0004;
+const CODEC_CAP_HYBRID:u32      = 0x0008;
+const CODEC_CAP_SCALABLE:u32    = 0x0010;
 
 #[derive(Clone)]
 pub struct CodecDescription {
@@ -49,7 +49,7 @@ impl CodecDescription {
 
 impl fmt::Display for CodecDescription {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        let mut out = format!("{}", self.fname);
+        let mut out = self.fname.to_string();
         if self.caps != 0 {
             let mut capfmt = "".to_string();
             if (self.caps & CODEC_CAP_INTRAONLY) != 0 {
@@ -145,26 +145,34 @@ static CODEC_REGISTER: &'static [CodecDescription] = &[
     desc!(audio;    "atrac3",     "Sony Atrac3"),
     desc!(audio;    "sipro",      "Sipro Labs ADPCM"),
 
-    desc!(video;    "truemotion1",   "TrueMotion 1"), 
-    desc!(video-im; "truemotionrt",  "TrueMotion RT"), 
-    desc!(video;    "truemotion2",   "TrueMotion 2"), 
+    desc!(video;    "truemotion1",   "TrueMotion 1"),
+    desc!(video-im; "truemotionrt",  "TrueMotion RT"),
+    desc!(video;    "truemotion2",   "TrueMotion 2"),
     desc!(video;    "truemotion2x",  "TrueMotion 2X"),
     desc!(video;    "vp3",           "VP3"),
     desc!(video;    "vp4",           "VP4"),
     desc!(video;    "vp5",           "VP5"),
     desc!(video;    "vp6",           "VP6"),
+    desc!(video;    "vp6a",          "VP6"),
     desc!(video;    "vp7",           "VP7"),
     desc!(video;    "vp8",           "VP8"),
     desc!(video;    "vp9",           "VP9"),
     desc!(audio;    "adpcm-dk3",     "Duck DK3 ADPCM"),
     desc!(audio;    "adpcm-dk4",     "Duck DK4 ADPCM"),
-    desc!(audio;    "on2-avc-500",   "On2 AVC"),
-    desc!(audio;    "on2-avc-501",   "On2 AVC"),
+    desc!(audio;    "on2avc-500",    "On2 AVC"),
+    desc!(audio;    "on2avc-501",    "On2 AVC"),
 
     desc!(video;    "gdv-video",     "Gremlin Digital Video - video"),
     desc!(audio;    "gdv-audio",     "Gremlin Digital Video - audio"),
     desc!(video;    "bmv-video",     "BMV video"),
     desc!(audio;    "bmv-audio",     "BMV audio"),
+    desc!(video;    "bmv3-video",    "DW Noir BMV video"),
+    desc!(audio;    "bmv3-audio",    "DW Noir BMV audio"),
+    desc!(video;    "midivid",       "MidiVid"),
+    desc!(video;    "midivid3",      "MidiVid 3"),
+    desc!(video-ll; "midivid-ll",    "MidiVid Lossless"),
+    desc!(video;    "vmd-video",     "VMD video"),
+    desc!(audio;    "vmd-audio",     "VMD audio"),
 
     desc!(video;    "smacker-video", "Smacker video"),
     desc!(audio;    "smacker-audio", "Smacker audio"),
@@ -185,6 +193,10 @@ static AVI_VIDEO_CODEC_REGISTER: &'static [(&[u8;4], &str)] = &[
 
     (b"UCOD", "clearvideo"),
 
+    (b"MVDV", "midivid"),
+    (b"MV30", "midivid3"),
+    (b"MVLZ", "midivid-ll"),
+
     (b"DUCK", "truemotion1"),
     (b"TR20", "truemotionrt"),
     (b"TM20", "truemotion2"),
@@ -197,6 +209,7 @@ static AVI_VIDEO_CODEC_REGISTER: &'static [(&[u8;4], &str)] = &[
     (b"VP60", "vp6"),
     (b"VP61", "vp6"),
     (b"VP62", "vp6"),
+    (b"VP6A", "vp6a"),
     (b"VP70", "vp7"),
 ];
 
@@ -213,17 +226,15 @@ static WAV_CODEC_REGISTER: &'static [(u16, &str)] = &[
 ];
 
 pub fn find_codec_from_avi_fourcc(fcc: &[u8;4]) -> Option<&'static str> {
-    for i in 0..AVI_VIDEO_CODEC_REGISTER.len() {
-        let (fourcc, name) = AVI_VIDEO_CODEC_REGISTER[i];
-        if fourcc == fcc { return Some(name); }
+    for (fourcc, name) in AVI_VIDEO_CODEC_REGISTER.iter() {
+        if *fourcc == fcc { return Some(name); }
     }
     None
 }
 
 pub fn find_codec_from_wav_twocc(tcc: u16) -> Option<&'static str> {
-    for i in 0..WAV_CODEC_REGISTER.len() {
-        let (twocc, name) = WAV_CODEC_REGISTER[i];
-        if twocc == tcc { return Some(name); }
+    for (twocc, name) in WAV_CODEC_REGISTER.iter() {
+        if *twocc == tcc { return Some(name); }
     }
     None
 }