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