mostly working ITU H.264 decoder
[nihav.git] / nihav-registry / src / register.rs
index 8c1dcc6d024636f0af36c35604cc1ca5186d87b4..d4e2b028097d7c753533663b2ec31bc09f4afdb9 100644 (file)
@@ -31,11 +31,18 @@ impl fmt::Display for CodecType {
     }
 }
 
-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;
+/// Codec capability flag for intra-only codecs.
+pub const CODEC_CAP_INTRAONLY:u32   = 0x0001;
+/// Codec capability flag for lossless codecs.
+pub const CODEC_CAP_LOSSLESS:u32    = 0x0002;
+/// Codec capability flag for codecs with frame reordering.
+pub const CODEC_CAP_REORDER:u32     = 0x0004;
+/// Codec capability flag for codecs that can be both lossy and lossless.
+pub const CODEC_CAP_HYBRID:u32      = 0x0008;
+/// Codec capability flag for codecs with scalability features.
+pub const CODEC_CAP_SCALABLE:u32    = 0x0010;
+/// Codec capability flag for codecs with complex frame reordering.
+pub const CODEC_CAP_COMPLEX_REORDER:u32 = 0x0020;
 
 /// Codec description structure.
 #[derive(Clone)]
@@ -132,6 +139,10 @@ macro_rules! desc {
         CodecDescription{ name: $n, fname: $fn, ctype: CodecType::Audio,
                           caps: CODEC_CAP_LOSSLESS | CODEC_CAP_INTRAONLY }
     });
+    (audio-hyb; $n:expr, $fn:expr) => ({
+        CodecDescription{ name: $n, fname: $fn, ctype: CodecType::Audio,
+                          caps: CODEC_CAP_HYBRID }
+    });
 }
 
 /// Returns codec description for the provided codec short name if it is found.
@@ -221,6 +232,8 @@ static CODEC_REGISTER: &'static [CodecDescription] = &[
     desc!(video-ll; "midivid-ll",    "MidiVid Lossless"),
     desc!(video;    "vmd-video",     "VMD video"),
     desc!(audio;    "vmd-audio",     "VMD audio"),
+    desc!(video;    "vxvideo",       "Actimagine Vx"),
+    desc!(audio;    "vxaudio",       "Actimagine Sx"),
 
     desc!(video;    "smacker-video", "Smacker video"),
     desc!(audio;    "smacker-audio", "Smacker audio"),
@@ -238,6 +251,13 @@ static CODEC_REGISTER: &'static [CodecDescription] = &[
     desc!(video;    "vivo2",         "VivoActive Video 2.0", CODEC_CAP_REORDER),
     desc!(audio;    "g723.1",        "ITU G.723.1"),
     desc!(audio;    "siren",         "Polycom Siren"),
+
+    desc!(audio-ll;  "ape",          "Monkey's Audio"),
+    desc!(audio-ll;  "flac",         "Free Lossless Audio Codec"),
+    desc!(audio-ll;  "tta",          "True Audio codec"),
+    desc!(audio-hyb; "wavpack",      "WavPack"),
+
+    desc!(video;    "h264",          "ITU H.264", CODEC_CAP_COMPLEX_REORDER | CODEC_CAP_HYBRID),
 ];
 
 static AVI_VIDEO_CODEC_REGISTER: &'static [(&[u8;4], &str)] = &[
@@ -317,6 +337,8 @@ static MOV_VIDEO_CODEC_REGISTER: &'static [(&[u8;4], &str)] = &[
 
     (b"VP30", "vp3"),
     (b"VP31", "vp3"),
+
+    (b"avc1", "h264"),
 ];
 
 static MOV_AUDIO_CODEC_REGISTER: &'static [(&[u8;4], &str)] = &[
@@ -338,6 +360,8 @@ static MOV_AUDIO_CODEC_REGISTER: &'static [(&[u8;4], &str)] = &[
     (b"QDM2", "qdesign-music2"),
     (b"Qclp", "qualcomm-purevoice"),
     //(b".mp3", "mpeg-layer3"),
+
+    (b"mp4a", "aac"),
 ];
 
 /// Returns video codec short name for provided FOURCC (used in AVI format).