]> git.nihav.org Git - nihav.git/blobdiff - src/register.rs
RealAudio DNET decoder
[nihav.git] / src / register.rs
index 76ff16f215731fcf128573feb27a16e23969279f..b06b5979affe39b9120f69d672701f74c790d615 100644 (file)
@@ -1,6 +1,6 @@
 use std::fmt;
 
-#[derive(Debug,Clone,Copy)]
+#[derive(Debug,Clone,Copy,PartialEq)]
 #[allow(dead_code)]
 pub enum CodecType {
     Video,
@@ -28,6 +28,7 @@ const CODEC_CAP_REORDER:u32     = 0x000004;
 const CODEC_CAP_HYBRID:u32      = 0x000008;
 const CODEC_CAP_SCALABLE:u32    = 0x000010;
 
+#[derive(Clone)]
 pub struct CodecDescription {
     name:  &'static str,
     fname: &'static str,
@@ -108,37 +109,58 @@ macro_rules! desc {
 }
 
 pub fn get_codec_description(name: &str) -> Option<&'static CodecDescription> {
-    for i in 0..CODEC_REGISTER.len() {
-        if CODEC_REGISTER[i].name == name {
-            return Some(&CODEC_REGISTER[i]);
+    for reg in CODEC_REGISTER {
+        if reg.name == name {
+            return Some(reg);
         }
     }
     None
 }
 
 static CODEC_REGISTER: &'static [CodecDescription] = &[
-    desc!(video-im; "video-indeo1", "Intel Raw IF09"),
-    desc!(video-im; "video-indeo2", "Intel Indeo 2"),
-    desc!(video;    "video-indeo3", "Intel Indeo 3"),
-    desc!(video;    "video-indeo4", "Intel Indeo 4", CODEC_CAP_REORDER | CODEC_CAP_SCALABLE),
-    desc!(video;    "video-indeo5", "Intel Indeo 5", CODEC_CAP_REORDER | CODEC_CAP_SCALABLE),
-    desc!(audio;    "audio-iac",    "Intel Indeo audio"),
-    desc!(audio;    "audio-imc",    "Intel Music Coder"),
+    desc!(video-im; "indeo1", "Intel Raw IF09"),
+    desc!(video-im; "indeo2", "Intel Indeo 2"),
+    desc!(video;    "indeo3", "Intel Indeo 3"),
+    desc!(video;    "indeo4", "Intel Indeo 4", CODEC_CAP_REORDER | CODEC_CAP_SCALABLE),
+    desc!(video;    "indeo5", "Intel Indeo 5", CODEC_CAP_REORDER | CODEC_CAP_SCALABLE),
+    desc!(video;    "intel263", "Intel I263", CODEC_CAP_REORDER),
+    desc!(audio;    "iac",    "Intel Indeo audio"),
+    desc!(audio;    "imc",    "Intel Music Coder"),
+
+    desc!(video;    "realvideo1", "Real Video 1"),
+    desc!(video;    "realvideo2", "Real Video 2"),
+    desc!(video;    "realvideo3", "Real Video 3", CODEC_CAP_REORDER),
+    desc!(video;    "realvideo4", "Real Video 4", CODEC_CAP_REORDER),
+    desc!(video;    "clearvideo", "ClearVideo"),
+    desc!(video;    "clearvideo_rm", "ClearVideo"),
+    desc!(audio;    "ra14.4",     "RealAudio 14.4"),
+    desc!(audio;    "ra28.8",     "RealAudio 28.8"),
+    desc!(audio;    "cook",       "RealAudio Cooker"),
+    desc!(audio;    "ralf",       "RealAudio Lossless"),
+    desc!(audio;    "aac",        "AAC"),
+    desc!(audio;    "ac3",        "ETSI TS 102 366"),
+    desc!(audio;    "atrac3",     "Sony Atrac3"),
+    desc!(audio;    "sipro",      "Sipro Labs ADPCM"),
 ];
 
 static AVI_VIDEO_CODEC_REGISTER: &'static [(&[u8;4], &str)] = &[
-    (b"IF09", "video-indeo1"),
-    (b"RT21", "video-indeo2"),
-    (b"IV31", "video-indeo3"),
-    (b"IV32", "video-indeo3"),
-    (b"IV41", "video-indeo4"),
-    (b"IV50", "video-indeo5"),
+    (b"IF09", "indeo1"),
+    (b"RT21", "indeo2"),
+    (b"IV31", "indeo3"),
+    (b"IV32", "indeo3"),
+    (b"IV41", "indeo4"),
+    (b"IV50", "indeo5"),
+    (b"I263", "intel263"),
+
+    (b"UCOD", "clearvideo"),
 ];
 
 static WAV_CODEC_REGISTER: &'static [(u16, &str)] = &[
-    (0x0000, "audio-pcm"),
-    (0x0401, "audio-imc"),
-    (0x0402, "audio-iac"),
+    (0x0000, "pcm"),
+    (0x0001, "pcm"),
+    (0x0003, "pcm"),
+    (0x0401, "imc"),
+    (0x0402, "iac"),
 ];
 
 pub fn find_codec_from_avi_fourcc(fcc: &[u8;4]) -> Option<&'static str> {
@@ -170,4 +192,4 @@ mod test {
         let cd2 = get_codec_description(c2).unwrap();
         println!("got {} and {}", cd1, cd2);
     }
-}
\ No newline at end of file
+}