]> git.nihav.org Git - nihav.git/blob - nihav-duck/src/codecs/mod.rs
add MPEG-4 ASP decoder
[nihav.git] / nihav-duck / 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_truemotion1")]
13 mod truemotion1;
14 #[cfg(feature="decoder_truemotionrt")]
15 mod truemotionrt;
16 #[cfg(feature="decoder_truemotion2")]
17 #[allow(clippy::needless_range_loop)]
18 mod truemotion2;
19 #[cfg(feature="decoder_truemotion2x")]
20 mod truemotion2x;
21 #[cfg(any(feature="decoder_vp3", feature="decoder_vp4", feature="decoder_vp5", feature="decoder_vp6", feature="decoder_vp7"))]
22 #[macro_use]
23 #[allow(clippy::erasing_op)]
24 #[allow(clippy::needless_range_loop)]
25 #[allow(clippy::too_many_arguments)]
26 #[allow(clippy::useless_let_if_seq)]
27 mod vpcommon;
28 #[cfg(any(feature="decoder_vp3", feature="decoder_vp4"))]
29 #[allow(clippy::needless_range_loop)]
30 #[allow(clippy::too_many_arguments)]
31 mod vp3;
32 #[cfg(any(feature="decoder_vp5", feature="decoder_vp6"))]
33 #[allow(clippy::needless_range_loop)]
34 #[allow(clippy::useless_let_if_seq)]
35 #[allow(clippy::too_many_arguments)]
36 mod vp56;
37 #[cfg(feature="decoder_vp5")]
38 #[allow(clippy::needless_range_loop)]
39 mod vp5;
40 #[cfg(any(feature="decoder_vp6", feature="encoder_vp6"))]
41 mod vp6data;
42 #[cfg(any(feature="decoder_vp6", feature="encoder_vp6"))]
43 mod vp6dsp;
44 #[cfg(feature="decoder_vp6")]
45 #[allow(clippy::needless_range_loop)]
46 mod vp6;
47 #[cfg(feature="decoder_vp7")]
48 #[allow(clippy::needless_range_loop)]
49 #[allow(clippy::useless_let_if_seq)]
50 mod vp7;
51 #[cfg(any(feature="decoder_vp7", feature="encoder_vp7"))]
52 mod vp7data;
53 #[cfg(any(feature="decoder_vp7", feature="decoder_vp8"))]
54 mod vp78data;
55 #[cfg(feature="decoder_vp7")]
56 #[allow(clippy::erasing_op)]
57 #[allow(clippy::needless_range_loop)]
58 #[allow(clippy::too_many_arguments)]
59 #[allow(clippy::useless_let_if_seq)]
60 mod vp7dsp;
61 #[cfg(any(feature="decoder_vp7", feature="decoder_vp8", feature="encoder_vp7"))]
62 #[allow(clippy::needless_range_loop)]
63 #[allow(clippy::useless_let_if_seq)]
64 mod vp78;
65 #[cfg(any(feature="decoder_vp7", feature="decoder_vp8", feature="encoder_vp7"))]
66 #[allow(clippy::erasing_op)]
67 #[allow(clippy::needless_range_loop)]
68 #[allow(clippy::too_many_arguments)]
69 #[allow(clippy::useless_let_if_seq)]
70 mod vp78dsp;
71 #[cfg(feature="decoder_vp8")]
72 #[allow(clippy::needless_range_loop)]
73 #[allow(clippy::useless_let_if_seq)]
74 mod vp8;
75 #[cfg(feature="decoder_vp8")]
76 #[allow(clippy::erasing_op)]
77 #[allow(clippy::needless_range_loop)]
78 #[allow(clippy::too_many_arguments)]
79 mod vp8dsp;
80
81 #[cfg(any(feature="decoder_dk3_adpcm", feature="decoder_dk4_adpcm"))]
82 mod dkadpcm;
83 #[cfg(feature="decoder_on2avc")]
84 #[allow(clippy::manual_memcpy)]
85 #[allow(clippy::needless_range_loop)]
86 #[allow(clippy::too_many_arguments)]
87 mod on2avc;
88 #[cfg(feature="decoder_on2avc")]
89 mod on2avcdata;
90
91 const DUCK_CODECS: &[DecoderInfo] = &[
92 #[cfg(feature="decoder_truemotion1")]
93 DecoderInfo { name: "truemotion1", get_decoder: truemotion1::get_decoder },
94 #[cfg(feature="decoder_truemotionrt")]
95 DecoderInfo { name: "truemotionrt", get_decoder: truemotionrt::get_decoder },
96 #[cfg(feature="decoder_truemotion2")]
97 DecoderInfo { name: "truemotion2", get_decoder: truemotion2::get_decoder },
98 #[cfg(feature="decoder_truemotion2x")]
99 DecoderInfo { name: "truemotion2x", get_decoder: truemotion2x::get_decoder },
100 #[cfg(feature="decoder_vp3")]
101 DecoderInfo { name: "vp3", get_decoder: vp3::get_decoder_vp3 },
102 #[cfg(feature="decoder_vp4")]
103 DecoderInfo { name: "vp4", get_decoder: vp3::get_decoder_vp4 },
104 #[cfg(feature="decoder_vp5")]
105 DecoderInfo { name: "vp5", get_decoder: vp5::get_decoder },
106 #[cfg(feature="decoder_vp6")]
107 DecoderInfo { name: "vp6", get_decoder: vp6::get_decoder_vp6 },
108 #[cfg(feature="decoder_vp6")]
109 DecoderInfo { name: "vp6f", get_decoder: vp6::get_decoder_vp6f },
110 #[cfg(feature="decoder_vp6")]
111 DecoderInfo { name: "vp6a", get_decoder: vp6::get_decoder_vp6_alpha },
112 #[cfg(feature="decoder_vp7")]
113 DecoderInfo { name: "vp7", get_decoder: vp7::get_decoder },
114 #[cfg(feature="decoder_vp8")]
115 DecoderInfo { name: "vp8", get_decoder: vp8::get_decoder },
116
117 #[cfg(feature="decoder_dk3_adpcm")]
118 DecoderInfo { name: "adpcm-dk3", get_decoder: dkadpcm::get_decoder_dk3 },
119 #[cfg(feature="decoder_dk4_adpcm")]
120 DecoderInfo { name: "adpcm-dk4", get_decoder: dkadpcm::get_decoder_dk4 },
121 #[cfg(feature="decoder_on2avc")]
122 DecoderInfo { name: "on2avc-500", get_decoder: on2avc::get_decoder_500 },
123 #[cfg(feature="decoder_on2avc")]
124 DecoderInfo { name: "on2avc-501", get_decoder: on2avc::get_decoder_501 },
125 ];
126
127 /// Registers all available codecs provided by this crate.
128 pub fn duck_register_all_decoders(rd: &mut RegisteredDecoders) {
129 for decoder in DUCK_CODECS.iter() {
130 rd.add_decoder(*decoder);
131 }
132 }
133
134 #[cfg(feature="encoder_truemotionrt")]
135 mod truemotionrtenc;
136 #[cfg(feature="encoder_vp6")]
137 #[macro_use]
138 mod vpenc;
139 #[cfg(feature="encoder_vp6")]
140 #[allow(clippy::needless_range_loop)]
141 mod vp6enc;
142 #[cfg(feature="encoder_vp7")]
143 #[allow(clippy::needless_range_loop)]
144 mod vp7enc;
145
146 const DUCK_ENCODERS: &[EncoderInfo] = &[
147 #[cfg(feature="encoder_truemotionrt")]
148 EncoderInfo { name: "truemotionrt", get_encoder: truemotionrtenc::get_encoder },
149 #[cfg(feature="encoder_vp6")]
150 EncoderInfo { name: "vp6", get_encoder: vp6enc::get_encoder },
151 #[cfg(feature="encoder_vp6")]
152 EncoderInfo { name: "vp6f", get_encoder: vp6enc::get_encoder_flv },
153 #[cfg(feature="encoder_vp7")]
154 EncoderInfo { name: "vp7", get_encoder: vp7enc::get_encoder },
155 ];
156
157 /// Registers all available encoders provided by this crate.
158 pub fn duck_register_all_encoders(re: &mut RegisteredEncoders) {
159 for encoder in DUCK_ENCODERS.iter() {
160 re.add_encoder(*encoder);
161 }
162 }