aboutsummaryrefslogtreecommitdiffstats
path: root/nihav-itu/src/codecs/mod.rs
blob: 2014f0af26ea8e2183c9f22cc58a53203f9d1aa5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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::manual_range_contains)]
#[allow(clippy::too_many_arguments)]
#[allow(clippy::upper_case_acronyms)]
#[cfg(feature="decoder_h264")]
mod h264;

const ITU_CODECS: &[DecoderInfo] = &[
#[cfg(feature="decoder_h264")]
    DecoderInfo { name: "h264", get_decoder: h264::get_decoder },
];

/// Registers all available codecs provided by this crate.
pub fn itu_register_all_decoders(rd: &mut RegisteredDecoders) {
    for decoder in ITU_CODECS.iter() {
        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);
    }
}