RAD formats crate and Smacker demuxer and decoder
[nihav.git] / nihav-rad / src / demuxers / mod.rs
diff --git a/nihav-rad/src/demuxers/mod.rs b/nihav-rad/src/demuxers/mod.rs
new file mode 100644 (file)
index 0000000..a1234bd
--- /dev/null
@@ -0,0 +1,24 @@
+use nihav_core::demuxers::*;
+
+#[allow(unused_macros)]
+macro_rules! validate {
+    ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } };
+}
+
+#[cfg(feature="demuxer_smk")]
+mod smacker;
+#[cfg(feature="demuxer_bink")]
+mod bink;
+
+const RAD_DEMUXERS: &[&'static DemuxerCreator] = &[
+#[cfg(feature="demuxer_smk")]
+    &smacker::SMKDemuxerCreator {},
+#[cfg(feature="demuxer_bink")]
+    &bink::BinkDemuxerCreator {},
+];
+
+pub fn rad_register_all_demuxers(rd: &mut RegisteredDemuxers) {
+    for demuxer in RAD_DEMUXERS.into_iter() {
+        rd.add_demuxer(*demuxer);
+    }
+}