]> git.nihav.org Git - nihav.git/blob - nihav-commonfmt/src/codecs/mod.rs
mov: if audio extradata does not start with wave pass it in full
[nihav.git] / nihav-commonfmt / src / codecs / mod.rs
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_cinepak")]
8 mod cinepak;
9 #[cfg(feature="decoder_clearvideo")]
10 mod clearvideo;
11
12 #[cfg(feature="decoder_aac")]
13 #[allow(clippy::manual_memcpy)]
14 #[allow(clippy::useless_let_if_seq)]
15 mod aac;
16 #[cfg(feature="decoder_atrac3")]
17 #[allow(clippy::identity_op)]
18 #[allow(clippy::useless_let_if_seq)]
19 mod atrac3;
20 #[cfg(any(feature="decoder_pcm",feature="encoder_pcm"))]
21 mod pcm;
22 #[cfg(feature="decoder_sipro")]
23 #[allow(clippy::collapsible_if)]
24 #[allow(clippy::identity_op)]
25 #[allow(clippy::manual_memcpy)]
26 mod sipro;
27 #[cfg(feature="decoder_ts102366")]
28 mod ts102366;
29
30 const DECODERS: &[DecoderInfo] = &[
31 #[cfg(feature="decoder_cinepak")]
32 DecoderInfo { name: "cinepak", get_decoder: cinepak::get_decoder },
33 #[cfg(feature="decoder_clearvideo")]
34 DecoderInfo { name: "clearvideo", get_decoder: clearvideo::get_decoder },
35 #[cfg(feature="decoder_clearvideo")]
36 DecoderInfo { name: "clearvideo_rm", get_decoder: clearvideo::get_decoder_rm },
37
38 #[cfg(feature="decoder_pcm")]
39 DecoderInfo { name: "pcm", get_decoder: pcm::get_decoder },
40 #[cfg(feature="decoder_pcm")]
41 DecoderInfo { name: "alaw", get_decoder: pcm::get_a_law_decoder },
42 #[cfg(feature="decoder_pcm")]
43 DecoderInfo { name: "ulaw", get_decoder: pcm::get_mu_law_decoder },
44 #[cfg(feature="decoder_sipro")]
45 DecoderInfo { name: "sipro", get_decoder: sipro::get_decoder },
46 #[cfg(feature="decoder_ts102366")]
47 DecoderInfo { name: "ac3", get_decoder: ts102366::get_decoder },
48 #[cfg(feature="decoder_atrac3")]
49 DecoderInfo { name: "atrac3", get_decoder: atrac3::get_decoder },
50 #[cfg(feature="decoder_aac")]
51 DecoderInfo { name: "aac", get_decoder: aac::get_decoder },
52 ];
53
54 /// Registers all available codecs provided by this crate.
55 pub fn generic_register_all_codecs(rd: &mut RegisteredDecoders) {
56 for decoder in DECODERS.iter() {
57 rd.add_decoder(decoder.clone());
58 }
59 }
60
61 #[cfg(feature="encoder_cinepak")]
62 mod cinepakenc;
63
64 const ENCODERS: &[EncoderInfo] = &[
65 #[cfg(feature="encoder_cinepak")]
66 EncoderInfo { name: "cinepak", get_encoder: cinepakenc::get_encoder },
67
68 #[cfg(feature="encoder_pcm")]
69 EncoderInfo { name: "pcm", get_encoder: pcm::get_encoder },
70 ];
71
72 /// Registers all available encoders provided by this crate.
73 pub fn generic_register_all_encoders(re: &mut RegisteredEncoders) {
74 for encoder in ENCODERS.iter() {
75 re.add_encoder(encoder.clone());
76 }
77 }
78