]> git.nihav.org Git - nihav.git/blob - nihav-mpeg/src/codecs/mod.rs
aac: do not add 16 to large coefficients
[nihav.git] / nihav-mpeg / 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_aac")]
8 #[allow(clippy::manual_memcpy)]
9 #[allow(clippy::useless_let_if_seq)]
10 mod aac;
11 #[cfg(feature="decoder_mpa")]
12 #[allow(clippy::excessive_precision)]
13 mod mpegaudio;
14
15 const DECODERS: &[DecoderInfo] = &[
16 #[cfg(feature="decoder_aac")]
17 DecoderInfo { name: "aac", get_decoder: aac::get_decoder },
18 #[cfg(feature="decoder_mpa")]
19 DecoderInfo { name: "mp2", get_decoder: mpegaudio::get_decoder_mp2 },
20 #[cfg(feature="decoder_mpa")]
21 DecoderInfo { name: "mp3", get_decoder: mpegaudio::get_decoder_mp3 },
22 ];
23
24 /// Registers all available codecs provided by this crate.
25 pub fn mpeg_register_all_decoders(rd: &mut RegisteredDecoders) {
26 for decoder in DECODERS.iter() {
27 rd.add_decoder(*decoder);
28 }
29 }
30
31 const PACKETISERS: &[PacketiserInfo] = &[
32 #[cfg(feature="decoder_mpa")]
33 PacketiserInfo { name: "mpa", get_packetiser: mpegaudio::get_packetiser },
34 ];
35
36 /// Registers all available packetisers provided by this crate.
37 pub fn mpeg_register_all_packetisers(rp: &mut RegisteredPacketisers) {
38 for packetiser in PACKETISERS.iter() {
39 rp.add_packetiser(*packetiser);
40 }
41 }