X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-itu%2Fsrc%2Fcodecs%2Fmod.rs;h=a3873bf5c34f65222ac6b8e7a72f7702941f71a3;hb=3fdbd1ee58ff101caf09e7516b872028f1a58da3;hp=efb24bc2b99e81d578fc33121be391846a2acade;hpb=b7c882c1ce6f86c07c2340751200e3a060942826;p=nihav.git diff --git a/nihav-itu/src/codecs/mod.rs b/nihav-itu/src/codecs/mod.rs index efb24bc..a3873bf 100644 --- a/nihav-itu/src/codecs/mod.rs +++ b/nihav-itu/src/codecs/mod.rs @@ -1,10 +1,17 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} +#[allow(clippy::collapsible_else_if)] #[allow(clippy::too_many_arguments)] +#[allow(clippy::upper_case_acronyms)] #[cfg(feature="decoder_h264")] mod h264; @@ -19,3 +26,15 @@ pub fn itu_register_all_decoders(rd: &mut RegisteredDecoders) { rd.add_decoder(*decoder); } } + +const ITU_MT_CODECS: &[MTDecoderInfo] = &[ +#[cfg(feature="decoder_h264")] + MTDecoderInfo { name: "h264", get_decoder: h264::get_decoder_mt }, +]; + +/// Registers all available multi-threaded decoders provided by this crate. +pub fn itu_register_all_mt_decoders(rd: &mut RegisteredMTDecoders) { + for decoder in ITU_MT_CODECS.iter() { + rd.add_decoder(*decoder); + } +}