]> git.nihav.org Git - nihav.git/blame - 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
CommitLineData
38953fb5
KS
1use nihav_core::codecs::*;
2
3macro_rules! validate {
4 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
5}
6
57777a0a
KS
7#[cfg(feature="decoder_cinepak")]
8mod cinepak;
38953fb5
KS
9#[cfg(feature="decoder_clearvideo")]
10mod clearvideo;
11
12#[cfg(feature="decoder_aac")]
61cab15b
KS
13#[allow(clippy::manual_memcpy)]
14#[allow(clippy::useless_let_if_seq)]
38953fb5
KS
15mod aac;
16#[cfg(feature="decoder_atrac3")]
61cab15b
KS
17#[allow(clippy::identity_op)]
18#[allow(clippy::useless_let_if_seq)]
38953fb5 19mod atrac3;
f5c54c10 20#[cfg(any(feature="decoder_pcm",feature="encoder_pcm"))]
38953fb5
KS
21mod pcm;
22#[cfg(feature="decoder_sipro")]
61cab15b
KS
23#[allow(clippy::collapsible_if)]
24#[allow(clippy::identity_op)]
25#[allow(clippy::manual_memcpy)]
38953fb5
KS
26mod sipro;
27#[cfg(feature="decoder_ts102366")]
28mod ts102366;
29
30const DECODERS: &[DecoderInfo] = &[
57777a0a
KS
31#[cfg(feature="decoder_cinepak")]
32 DecoderInfo { name: "cinepak", get_decoder: cinepak::get_decoder },
38953fb5
KS
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 },
67a31585
KS
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 },
38953fb5
KS
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
e64739f8 54/// Registers all available codecs provided by this crate.
38953fb5 55pub fn generic_register_all_codecs(rd: &mut RegisteredDecoders) {
c83013a1 56 for decoder in DECODERS.iter() {
38953fb5
KS
57 rd.add_decoder(decoder.clone());
58 }
59}
a178c22c
KS
60
61#[cfg(feature="encoder_cinepak")]
62mod cinepakenc;
63
64const ENCODERS: &[EncoderInfo] = &[
65#[cfg(feature="encoder_cinepak")]
66 EncoderInfo { name: "cinepak", get_encoder: cinepakenc::get_encoder },
f5c54c10
KS
67
68#[cfg(feature="encoder_pcm")]
69 EncoderInfo { name: "pcm", get_encoder: pcm::get_encoder },
a178c22c
KS
70];
71
72/// Registers all available encoders provided by this crate.
73pub fn generic_register_all_encoders(re: &mut RegisteredEncoders) {
74 for encoder in ENCODERS.iter() {
75 re.add_encoder(encoder.clone());
76 }
77}
78