]> git.nihav.org Git - nihav.git/blob - nihav-commonfmt/src/codecs/mod.rs
add enabling/disabling features for files with both encoder and decoder
[nihav.git] / nihav-commonfmt / 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(feature="decoder_cinepak")]
8 mod cinepak;
9 #[cfg(feature="decoder_clearvideo")]
10 mod clearvideo;
11 #[cfg(feature="decoder_jpeg")]
12 mod jpeg;
13 #[cfg(feature="decoder_rawvideo")]
14 mod rawvideo;
15 #[cfg(feature="decoder_rawvideo_ms")]
16 mod rawvideo_ms;
17 #[cfg(feature="decoder_zmbv")]
18 mod zmbv;
19
20 #[cfg(feature="decoder_atrac3")]
21 #[allow(clippy::identity_op)]
22 #[allow(clippy::useless_let_if_seq)]
23 mod atrac3;
24 #[cfg(any(feature="decoder_pcm",feature="encoder_pcm"))]
25 mod pcm;
26 #[cfg(feature="decoder_sipro")]
27 #[allow(clippy::collapsible_if)]
28 #[allow(clippy::identity_op)]
29 #[allow(clippy::manual_memcpy)]
30 mod sipro;
31 #[cfg(feature="decoder_ts102366")]
32 mod ts102366;
33
34 #[cfg(feature="decoders")]
35 const DECODERS: &[DecoderInfo] = &[
36 #[cfg(feature="decoder_cinepak")]
37 DecoderInfo { name: "cinepak", get_decoder: cinepak::get_decoder },
38 #[cfg(feature="decoder_clearvideo")]
39 DecoderInfo { name: "clearvideo", get_decoder: clearvideo::get_decoder },
40 #[cfg(feature="decoder_clearvideo")]
41 DecoderInfo { name: "clearvideo_rm", get_decoder: clearvideo::get_decoder_rm },
42 #[cfg(feature="decoder_jpeg")]
43 DecoderInfo { name: "jpeg", get_decoder: jpeg::get_decoder },
44 #[cfg(feature="decoder_rawvideo")]
45 DecoderInfo { name: "rawvideo", get_decoder: rawvideo::get_decoder },
46 #[cfg(feature="decoder_rawvideo_ms")]
47 DecoderInfo { name: "rawvideo-ms", get_decoder: rawvideo_ms::get_decoder },
48 #[cfg(feature="decoder_zmbv")]
49 DecoderInfo { name: "zmbv", get_decoder: zmbv::get_decoder },
50
51 #[cfg(feature="decoder_pcm")]
52 DecoderInfo { name: "pcm", get_decoder: pcm::get_decoder },
53 #[cfg(feature="decoder_pcm")]
54 DecoderInfo { name: "alaw", get_decoder: pcm::get_a_law_decoder },
55 #[cfg(feature="decoder_pcm")]
56 DecoderInfo { name: "ulaw", get_decoder: pcm::get_mu_law_decoder },
57 #[cfg(feature="decoder_sipro")]
58 DecoderInfo { name: "sipro", get_decoder: sipro::get_decoder },
59 #[cfg(feature="decoder_ts102366")]
60 DecoderInfo { name: "ac3", get_decoder: ts102366::get_decoder },
61 #[cfg(feature="decoder_atrac3")]
62 DecoderInfo { name: "atrac3", get_decoder: atrac3::get_decoder },
63 ];
64
65 /// Registers all available codecs provided by this crate.
66 #[cfg(feature="decoders")]
67 pub fn generic_register_all_decoders(rd: &mut RegisteredDecoders) {
68 for decoder in DECODERS.iter() {
69 rd.add_decoder(*decoder);
70 }
71 }
72
73 #[cfg(feature="encoder_cinepak")]
74 mod cinepakenc;
75 #[cfg(feature="encoder_zmbv")]
76 mod zmbvenc;
77
78 #[cfg(feature="encoders")]
79 const ENCODERS: &[EncoderInfo] = &[
80 #[cfg(feature="encoder_cinepak")]
81 EncoderInfo { name: "cinepak", get_encoder: cinepakenc::get_encoder },
82 #[cfg(feature="encoder_zmbv")]
83 EncoderInfo { name: "zmbv", get_encoder: zmbvenc::get_encoder },
84
85 #[cfg(feature="encoder_pcm")]
86 EncoderInfo { name: "pcm", get_encoder: pcm::get_encoder },
87 ];
88
89 /// Registers all available encoders provided by this crate.
90 #[cfg(feature="encoders")]
91 pub fn generic_register_all_encoders(re: &mut RegisteredEncoders) {
92 for encoder in ENCODERS.iter() {
93 re.add_encoder(*encoder);
94 }
95 }
96