1 use nihav_core::codecs::*;
3 #[cfg(debug_assertions)]
4 macro_rules! validate {
5 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
7 #[cfg(not(debug_assertions))]
8 macro_rules! validate {
9 ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } };
12 #[cfg(feature="decoder_truemotion1")]
14 #[cfg(feature="decoder_truemotionrt")]
16 #[cfg(feature="decoder_truemotion2")]
17 #[allow(clippy::needless_range_loop)]
19 #[cfg(feature="decoder_truemotion2x")]
21 #[cfg(any(feature="decoder_vp3", feature="decoder_vp4", feature="decoder_vp5", feature="decoder_vp6", feature="decoder_vp7"))]
23 #[allow(clippy::erasing_op)]
24 #[allow(clippy::needless_range_loop)]
25 #[allow(clippy::too_many_arguments)]
26 #[allow(clippy::useless_let_if_seq)]
28 #[cfg(any(feature="decoder_vp3", feature="decoder_vp4"))]
29 #[allow(clippy::needless_range_loop)]
30 #[allow(clippy::too_many_arguments)]
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)]
37 #[cfg(feature="decoder_vp5")]
38 #[allow(clippy::needless_range_loop)]
40 #[cfg(any(feature="decoder_vp6", feature="encoder_vp6"))]
42 #[cfg(any(feature="decoder_vp6", feature="encoder_vp6"))]
44 #[cfg(feature="decoder_vp6")]
45 #[allow(clippy::needless_range_loop)]
47 #[cfg(feature="decoder_vp7")]
48 #[allow(clippy::needless_range_loop)]
49 #[allow(clippy::useless_let_if_seq)]
51 #[cfg(any(feature="decoder_vp7", feature="encoder_vp7"))]
53 #[cfg(any(feature="decoder_vp7", feature="decoder_vp8"))]
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)]
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)]
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)]
71 #[cfg(feature="decoder_vp8")]
72 #[allow(clippy::needless_range_loop)]
73 #[allow(clippy::useless_let_if_seq)]
75 #[cfg(feature="decoder_vp8")]
76 #[allow(clippy::erasing_op)]
77 #[allow(clippy::needless_range_loop)]
78 #[allow(clippy::too_many_arguments)]
81 #[cfg(any(feature="decoder_dk3_adpcm", feature="decoder_dk4_adpcm"))]
83 #[cfg(feature="decoder_on2avc")]
84 #[allow(clippy::manual_memcpy)]
85 #[allow(clippy::needless_range_loop)]
86 #[allow(clippy::too_many_arguments)]
88 #[cfg(feature="decoder_on2avc")]
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 },
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 },
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);
134 #[cfg(feature="encoder_truemotionrt")]
136 #[cfg(feature="encoder_vp6")]
139 #[cfg(feature="encoder_vp6")]
140 #[allow(clippy::needless_range_loop)]
142 #[cfg(feature="encoder_vp7")]
143 #[allow(clippy::needless_range_loop)]
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 },
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);