]> git.nihav.org Git - nihav.git/blob - nihav-commonfmt/src/codecs/mod.rs
ad8a8c6604b40cd9ab3fa2e9305a25b3703b004e
[nihav.git] / nihav-commonfmt / src / codecs / mod.rs
1 use nihav_core::codecs::*;
2
3 #[cfg(debug_assertions)]
4 macro_rules! validate {
5 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
6 }
7 #[cfg(not(debug_assertions))]
8 macro_rules! validate {
9 ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } };
10 }
11
12 #[cfg(feature="decoder_cinepak")]
13 mod cinepak;
14 #[cfg(feature="decoder_clearvideo")]
15 mod clearvideo;
16 #[cfg(feature="decoder_jpeg")]
17 mod jpeg;
18 #[cfg(feature="decoder_rawvideo")]
19 mod rawvideo;
20 #[cfg(feature="decoder_rawvideo_ms")]
21 mod rawvideo_ms;
22 #[cfg(feature="decoder_zmbv")]
23 mod zmbv;
24
25 #[cfg(feature="decoder_atrac3")]
26 #[allow(clippy::identity_op)]
27 #[allow(clippy::useless_let_if_seq)]
28 mod atrac3;
29 #[cfg(any(feature="decoder_pcm",feature="encoder_pcm"))]
30 mod pcm;
31 #[cfg(feature="decoder_sipro")]
32 #[allow(clippy::collapsible_if)]
33 #[allow(clippy::collapsible_else_if)]
34 #[allow(clippy::identity_op)]
35 #[allow(clippy::manual_memcpy)]
36 mod sipro;
37 #[cfg(feature="decoder_ts102366")]
38 mod ts102366;
39
40 #[cfg(feature="decoders")]
41 const DECODERS: &[DecoderInfo] = &[
42 #[cfg(feature="decoder_cinepak")]
43 DecoderInfo { name: "cinepak", get_decoder: cinepak::get_decoder },
44 #[cfg(feature="decoder_clearvideo")]
45 DecoderInfo { name: "clearvideo", get_decoder: clearvideo::get_decoder },
46 #[cfg(feature="decoder_clearvideo")]
47 DecoderInfo { name: "clearvideo_rm", get_decoder: clearvideo::get_decoder_rm },
48 #[cfg(feature="decoder_jpeg")]
49 DecoderInfo { name: "jpeg", get_decoder: jpeg::get_decoder },
50 #[cfg(feature="decoder_rawvideo")]
51 DecoderInfo { name: "rawvideo", get_decoder: rawvideo::get_decoder },
52 #[cfg(feature="decoder_rawvideo_ms")]
53 DecoderInfo { name: "rawvideo-ms", get_decoder: rawvideo_ms::get_decoder },
54 #[cfg(feature="decoder_zmbv")]
55 DecoderInfo { name: "zmbv", get_decoder: zmbv::get_decoder },
56
57 #[cfg(feature="decoder_pcm")]
58 DecoderInfo { name: "pcm", get_decoder: pcm::get_decoder },
59 #[cfg(feature="decoder_pcm")]
60 DecoderInfo { name: "alaw", get_decoder: pcm::get_a_law_decoder },
61 #[cfg(feature="decoder_pcm")]
62 DecoderInfo { name: "ulaw", get_decoder: pcm::get_mu_law_decoder },
63 #[cfg(feature="decoder_sipro")]
64 DecoderInfo { name: "sipro", get_decoder: sipro::get_decoder },
65 #[cfg(feature="decoder_ts102366")]
66 DecoderInfo { name: "ac3", get_decoder: ts102366::get_decoder },
67 #[cfg(feature="decoder_atrac3")]
68 DecoderInfo { name: "atrac3", get_decoder: atrac3::get_decoder },
69 ];
70
71 /// Registers all available codecs provided by this crate.
72 #[cfg(feature="decoders")]
73 pub fn generic_register_all_decoders(rd: &mut RegisteredDecoders) {
74 for decoder in DECODERS.iter() {
75 rd.add_decoder(*decoder);
76 }
77 }
78
79 #[cfg(feature="encoder_cinepak")]
80 mod cinepakenc;
81 #[cfg(feature="encoder_rawvideo")]
82 mod rawvideoenc;
83 #[cfg(feature="encoder_zmbv")]
84 mod zmbvenc;
85
86 #[cfg(feature="encoders")]
87 const ENCODERS: &[EncoderInfo] = &[
88 #[cfg(feature="encoder_cinepak")]
89 EncoderInfo { name: "cinepak", get_encoder: cinepakenc::get_encoder },
90 #[cfg(feature="encoder_rawvideo")]
91 EncoderInfo { name: "rawvideo", get_encoder: rawvideoenc::get_encoder },
92 #[cfg(feature="encoder_zmbv")]
93 EncoderInfo { name: "zmbv", get_encoder: zmbvenc::get_encoder },
94
95 #[cfg(feature="encoder_pcm")]
96 EncoderInfo { name: "pcm", get_encoder: pcm::get_encoder },
97 ];
98
99 /// Registers all available encoders provided by this crate.
100 #[cfg(feature="encoders")]
101 pub fn generic_register_all_encoders(re: &mut RegisteredEncoders) {
102 for encoder in ENCODERS.iter() {
103 re.add_encoder(*encoder);
104 }
105 }
106