make validate!() print message only in debug builds
[nihav.git] / nihav-itu / src / codecs / mod.rs
1 use nihav_core::codecs::*;
2
3 #[cfg(debug_assertions)]
4 macro_rules! validate {
5 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
6 }
7 #[cfg(not(debug_assertions))]
8 macro_rules! validate {
9 ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } };
10 }
11
12 #[allow(clippy::collapsible_else_if)]
13 #[allow(clippy::too_many_arguments)]
14 #[allow(clippy::upper_case_acronyms)]
15 #[cfg(feature="decoder_h264")]
16 mod h264;
17
18 const ITU_CODECS: &[DecoderInfo] = &[
19 #[cfg(feature="decoder_h264")]
20 DecoderInfo { name: "h264", get_decoder: h264::get_decoder },
21 ];
22
23 /// Registers all available codecs provided by this crate.
24 pub fn itu_register_all_decoders(rd: &mut RegisteredDecoders) {
25 for decoder in ITU_CODECS.iter() {
26 rd.add_decoder(*decoder);
27 }
28 }