]> git.nihav.org Git - nihav.git/blob - nihav-realmedia/src/codecs/mod.rs
b8ad7bed1a91da7600eca7360ecfae291c33f343
[nihav.git] / nihav-realmedia / src / codecs / 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(any(feature="decoder_realvideo3", feature="decoder_realvideo4"))]
8 mod rv3040;
9 #[cfg(any(feature="decoder_realvideo3", feature="decoder_realvideo4"))]
10 #[allow(clippy::erasing_op)]
11 mod rv34codes;
12 #[cfg(any(feature="decoder_realvideo3", feature="decoder_realvideo4"))]
13 #[allow(clippy::erasing_op)]
14 #[allow(clippy::many_single_char_names)]
15 mod rv34dsp;
16
17 #[cfg(feature="decoder_realvideo1")]
18 pub mod rv10;
19 #[cfg(feature="decoder_realvideo2")]
20 pub mod rv20;
21 #[cfg(feature="decoder_realvideo3")]
22 pub mod rv30;
23 #[cfg(feature="decoder_realvideo3")]
24 #[allow(clippy::erasing_op)]
25 #[allow(clippy::many_single_char_names)]
26 #[allow(clippy::neg_multiply)]
27 pub mod rv30dsp;
28 #[cfg(feature="decoder_realvideo4")]
29 pub mod rv40;
30 #[cfg(feature="decoder_realvideo4")]
31 #[allow(clippy::erasing_op)]
32 #[allow(clippy::many_single_char_names)]
33 pub mod rv40dsp;
34 #[cfg(feature="decoder_realvideo6")]
35 pub mod rv60;
36 #[cfg(feature="decoder_realvideo6")]
37 pub mod rv60codes;
38 #[cfg(feature="decoder_realvideo6")]
39 #[allow(clippy::erasing_op)]
40 #[allow(clippy::many_single_char_names)]
41 pub mod rv60dsp;
42
43 #[cfg(feature="decoder_realaudio144")]
44 #[allow(clippy::manual_memcpy)]
45 pub mod ra144;
46 #[cfg(feature="decoder_realaudio288")]
47 pub mod ra288;
48 #[cfg(feature="decoder_cook")]
49 pub mod cook;
50 #[cfg(feature="decoder_ralf")]
51 pub mod ralf;
52
53 const RM_CODECS: &[DecoderInfo] = &[
54 #[cfg(feature="decoder_realvideo1")]
55 DecoderInfo { name: "realvideo1", get_decoder: rv10::get_decoder },
56 #[cfg(feature="decoder_realvideo2")]
57 DecoderInfo { name: "realvideo2", get_decoder: rv20::get_decoder },
58 #[cfg(feature="decoder_realvideo3")]
59 DecoderInfo { name: "realvideo3", get_decoder: rv30::get_decoder },
60 #[cfg(feature="decoder_realvideo4")]
61 DecoderInfo { name: "realvideo4", get_decoder: rv40::get_decoder },
62 #[cfg(feature="decoder_realvideo6")]
63 DecoderInfo { name: "realvideo6", get_decoder: rv60::get_decoder },
64
65 #[cfg(feature="decoder_realaudio144")]
66 DecoderInfo { name: "ra14.4", get_decoder: ra144::get_decoder },
67 #[cfg(feature="decoder_realaudio288")]
68 DecoderInfo { name: "ra28.8", get_decoder: ra288::get_decoder },
69 #[cfg(feature="decoder_cook")]
70 DecoderInfo { name: "cook", get_decoder: cook::get_decoder },
71 #[cfg(feature="decoder_ralf")]
72 DecoderInfo { name: "ralf", get_decoder: ralf::get_decoder },
73 ];
74
75 /// Registers all available codecs provided by this crate.
76 pub fn realmedia_register_all_codecs(rd: &mut RegisteredDecoders) {
77 for decoder in RM_CODECS.iter() {
78 rd.add_decoder(decoder.clone());
79 }
80 }