]>
Commit | Line | Data |
---|---|---|
1b8522d6 KS |
1 | use nihav_core::codecs::*; |
2 | ||
71d7f397 | 3 | #[cfg(debug_assertions)] |
1b8522d6 KS |
4 | macro_rules! validate { |
5 | ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; | |
6 | } | |
71d7f397 KS |
7 | #[cfg(not(debug_assertions))] |
8 | macro_rules! validate { | |
9 | ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; | |
10 | } | |
1b8522d6 KS |
11 | |
12 | #[cfg(feature="decoder_truemotion1")] | |
13 | mod truemotion1; | |
14 | #[cfg(feature="decoder_truemotionrt")] | |
15 | mod truemotionrt; | |
16 | #[cfg(feature="decoder_truemotion2")] | |
47933c6d | 17 | #[allow(clippy::needless_range_loop)] |
1b8522d6 KS |
18 | mod truemotion2; |
19 | #[cfg(feature="decoder_truemotion2x")] | |
20 | mod truemotion2x; | |
3584b223 KS |
21 | #[cfg(any(feature="decoder_vp3", feature="decoder_vp4", feature="decoder_vp5", feature="decoder_vp6", feature="decoder_vp7"))] |
22 | #[macro_use] | |
47933c6d KS |
23 | #[allow(clippy::erasing_op)] |
24 | #[allow(clippy::needless_range_loop)] | |
25 | #[allow(clippy::too_many_arguments)] | |
26 | #[allow(clippy::useless_let_if_seq)] | |
3584b223 | 27 | mod vpcommon; |
40e95291 | 28 | #[cfg(any(feature="decoder_vp3", feature="decoder_vp4"))] |
47933c6d KS |
29 | #[allow(clippy::needless_range_loop)] |
30 | #[allow(clippy::too_many_arguments)] | |
40e95291 KS |
31 | mod vp3; |
32 | #[cfg(any(feature="decoder_vp5", feature="decoder_vp6"))] | |
47933c6d KS |
33 | #[allow(clippy::needless_range_loop)] |
34 | #[allow(clippy::useless_let_if_seq)] | |
35 | #[allow(clippy::too_many_arguments)] | |
40e95291 | 36 | mod vp56; |
3584b223 | 37 | #[cfg(feature="decoder_vp5")] |
47933c6d | 38 | #[allow(clippy::needless_range_loop)] |
3584b223 | 39 | mod vp5; |
3952bfd9 | 40 | #[cfg(any(feature="decoder_vp6", feature="encoder_vp6"))] |
01551716 | 41 | mod vp6data; |
3952bfd9 KS |
42 | #[cfg(any(feature="decoder_vp6", feature="encoder_vp6"))] |
43 | mod vp6dsp; | |
01551716 | 44 | #[cfg(feature="decoder_vp6")] |
47933c6d | 45 | #[allow(clippy::needless_range_loop)] |
3584b223 | 46 | mod vp6; |
40e95291 | 47 | #[cfg(feature="decoder_vp7")] |
47933c6d KS |
48 | #[allow(clippy::needless_range_loop)] |
49 | #[allow(clippy::useless_let_if_seq)] | |
40e95291 | 50 | mod vp7; |
c5d5793c | 51 | #[cfg(any(feature="decoder_vp7", feature="encoder_vp7"))] |
b922b48d | 52 | mod vp7data; |
d0d21988 | 53 | #[cfg(any(feature="decoder_vp7", feature="decoder_vp8"))] |
0cc75664 | 54 | mod vp78data; |
587a6d78 | 55 | #[cfg(feature="decoder_vp7")] |
47933c6d KS |
56 | #[allow(clippy::erasing_op)] |
57 | #[allow(clippy::needless_range_loop)] | |
58 | #[allow(clippy::too_many_arguments)] | |
59 | #[allow(clippy::useless_let_if_seq)] | |
587a6d78 | 60 | mod vp7dsp; |
c5d5793c | 61 | #[cfg(any(feature="decoder_vp7", feature="decoder_vp8", feature="encoder_vp7"))] |
0cc75664 KS |
62 | #[allow(clippy::needless_range_loop)] |
63 | #[allow(clippy::useless_let_if_seq)] | |
64 | mod vp78; | |
c5d5793c | 65 | #[cfg(any(feature="decoder_vp7", feature="decoder_vp8", feature="encoder_vp7"))] |
0cc75664 KS |
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; | |
d0d21988 KS |
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; | |
1b8522d6 | 80 | |
029d2552 KS |
81 | #[cfg(any(feature="decoder_dk3_adpcm", feature="decoder_dk4_adpcm"))] |
82 | mod dkadpcm; | |
1b8522d6 | 83 | #[cfg(feature="decoder_on2avc")] |
47933c6d KS |
84 | #[allow(clippy::manual_memcpy)] |
85 | #[allow(clippy::needless_range_loop)] | |
86 | #[allow(clippy::too_many_arguments)] | |
1b8522d6 | 87 | mod on2avc; |
6a494288 KS |
88 | #[cfg(feature="decoder_on2avc")] |
89 | mod on2avcdata; | |
1b8522d6 KS |
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 }, | |
40e95291 KS |
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")] | |
3584b223 KS |
105 | DecoderInfo { name: "vp5", get_decoder: vp5::get_decoder }, |
106 | #[cfg(feature="decoder_vp6")] | |
107 | DecoderInfo { name: "vp6", get_decoder: vp6::get_decoder_vp6 }, | |
92d9fb69 KS |
108 | #[cfg(feature="decoder_vp6")] |
109 | DecoderInfo { name: "vp6f", get_decoder: vp6::get_decoder_vp6f }, | |
40e95291 | 110 | #[cfg(feature="decoder_vp6")] |
3584b223 | 111 | DecoderInfo { name: "vp6a", get_decoder: vp6::get_decoder_vp6_alpha }, |
40e95291 KS |
112 | #[cfg(feature="decoder_vp7")] |
113 | DecoderInfo { name: "vp7", get_decoder: vp7::get_decoder }, | |
d0d21988 KS |
114 | #[cfg(feature="decoder_vp8")] |
115 | DecoderInfo { name: "vp8", get_decoder: vp8::get_decoder }, | |
1b8522d6 | 116 | |
029d2552 KS |
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 }, | |
1b8522d6 KS |
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 | ||
e64739f8 | 127 | /// Registers all available codecs provided by this crate. |
78fb6560 | 128 | pub fn duck_register_all_decoders(rd: &mut RegisteredDecoders) { |
8a7352c0 | 129 | for decoder in DUCK_CODECS.iter() { |
b7c882c1 | 130 | rd.add_decoder(*decoder); |
1b8522d6 KS |
131 | } |
132 | } | |
3952bfd9 | 133 | |
7f839ae7 KS |
134 | #[cfg(feature="encoder_truemotionrt")] |
135 | mod truemotionrtenc; | |
19cfcd2f KS |
136 | #[cfg(feature="encoder_vp6")] |
137 | #[macro_use] | |
138 | mod vpenc; | |
3952bfd9 KS |
139 | #[cfg(feature="encoder_vp6")] |
140 | #[allow(clippy::needless_range_loop)] | |
141 | mod vp6enc; | |
c5d5793c KS |
142 | #[cfg(feature="encoder_vp7")] |
143 | #[allow(clippy::needless_range_loop)] | |
144 | mod vp7enc; | |
3952bfd9 KS |
145 | |
146 | const DUCK_ENCODERS: &[EncoderInfo] = &[ | |
7f839ae7 KS |
147 | #[cfg(feature="encoder_truemotionrt")] |
148 | EncoderInfo { name: "truemotionrt", get_encoder: truemotionrtenc::get_encoder }, | |
3952bfd9 KS |
149 | #[cfg(feature="encoder_vp6")] |
150 | EncoderInfo { name: "vp6", get_encoder: vp6enc::get_encoder }, | |
92d9fb69 KS |
151 | #[cfg(feature="encoder_vp6")] |
152 | EncoderInfo { name: "vp6f", get_encoder: vp6enc::get_encoder_flv }, | |
c5d5793c KS |
153 | #[cfg(feature="encoder_vp7")] |
154 | EncoderInfo { name: "vp7", get_encoder: vp7enc::get_encoder }, | |
3952bfd9 KS |
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 | } |