]> git.nihav.org Git - nihav.git/blob - mod.rs
752f5e81e1577b5c9b217d15158d39e2f861504f
[nihav.git] / mod.rs
1 use nihav_core::codecs::*;
2
3 macro_rules! validate {
4 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
5 }
6
7 #[cfg(feature="decoder_msrle")]
8 pub mod msrle;
9
10 #[cfg(feature="decoder_msvideo1")]
11 pub mod msvideo1;
12
13 #[cfg(feature="decoder_ima_adpcm_ms")]
14 pub mod imaadpcm;
15
16 #[cfg(any(feature="decoder_ms_adpcm", feature="encoder_ms_adpcm"))]
17 pub mod msadpcm;
18
19 const MS_CODECS: &[DecoderInfo] = &[
20 #[cfg(feature="decoder_msrle")]
21 DecoderInfo { name: "msrle", get_decoder: msrle::get_decoder },
22 #[cfg(feature="decoder_msvideo1")]
23 DecoderInfo { name: "msvideo1", get_decoder: msvideo1::get_decoder },
24 #[cfg(feature="decoder_ima_adpcm_ms")]
25 DecoderInfo { name: "ima-adpcm-ms", get_decoder: imaadpcm::get_decoder },
26 #[cfg(feature="decoder_ms_adpcm")]
27 DecoderInfo { name: "ms-adpcm", get_decoder: msadpcm::get_decoder },
28 ];
29
30 /// Registers all available codecs provided by this crate.
31 pub fn ms_register_all_decoders(rd: &mut RegisteredDecoders) {
32 for decoder in MS_CODECS.iter() {
33 rd.add_decoder(*decoder);
34 }
35 }
36
37 #[cfg(feature="encoder_msvideo1")]
38 pub mod msvideo1enc;
39
40 const MS_ENCODERS: &[EncoderInfo] = &[
41 #[cfg(feature="encoder_msvideo1")]
42 EncoderInfo { name: "msvideo1", get_encoder: msvideo1enc::get_encoder },
43 #[cfg(feature="encoder_ms_adpcm")]
44 EncoderInfo { name: "ms-adpcm", get_encoder: msadpcm::get_encoder },
45 ];
46
47 /// Registers all available encoders provided by this crate.
48 pub fn ms_register_all_encoders(re: &mut RegisteredEncoders) {
49 for encoder in MS_ENCODERS.iter() {
50 re.add_encoder(*encoder);
51 }
52 }