fix clippy warnings
[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::manual_range_contains)]
14 #[allow(clippy::too_many_arguments)]
15 #[allow(clippy::upper_case_acronyms)]
16 #[cfg(feature="decoder_h264")]
17 mod h264;
18
19 const ITU_CODECS: &[DecoderInfo] = &[
20 #[cfg(feature="decoder_h264")]
21 DecoderInfo { name: "h264", get_decoder: h264::get_decoder },
22 ];
23
24 /// Registers all available codecs provided by this crate.
25 pub fn itu_register_all_decoders(rd: &mut RegisteredDecoders) {
26 for decoder in ITU_CODECS.iter() {
27 rd.add_decoder(*decoder);
28 }
29 }
30
31 const ITU_MT_CODECS: &[MTDecoderInfo] = &[
32 #[cfg(feature="decoder_h264")]
33 MTDecoderInfo { name: "h264", get_decoder: h264::get_decoder_mt },
34 ];
35
36 /// Registers all available multi-threaded decoders provided by this crate.
37 pub fn itu_register_all_mt_decoders(rd: &mut RegisteredMTDecoders) {
38 for decoder in ITU_MT_CODECS.iter() {
39 rd.add_decoder(*decoder);
40 }
41 }