| 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 | } |
| 29 | |
| 30 | const ITU_MT_CODECS: &[MTDecoderInfo] = &[ |
| 31 | #[cfg(feature="decoder_h264")] |
| 32 | MTDecoderInfo { name: "h264", get_decoder: h264::get_decoder_mt }, |
| 33 | ]; |
| 34 | |
| 35 | /// Registers all available multi-threaded decoders provided by this crate. |
| 36 | pub fn itu_register_all_mt_decoders(rd: &mut RegisteredMTDecoders) { |
| 37 | for decoder in ITU_MT_CODECS.iter() { |
| 38 | rd.add_decoder(*decoder); |
| 39 | } |
| 40 | } |