]> git.nihav.org Git - nihav.git/blob - mod.rs
f6fb31cd6301e48f3331cffb41a59362fae4a1ab
[nihav.git] / mod.rs
1 use nihav_core::codecs::*;
2
3 #[cfg(debug_assertions)]
4 macro_rules! validate {
5 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
6 }
7 #[cfg(not(debug_assertions))]
8 macro_rules! validate {
9 ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } };
10 }
11
12 #[cfg(feature="decoder_aac")]
13 #[allow(clippy::comparison_chain)]
14 #[allow(clippy::excessive_precision)]
15 #[allow(clippy::manual_memcpy)]
16 #[allow(clippy::useless_let_if_seq)]
17 mod aac;
18 #[cfg(feature="decoder_mpa")]
19 #[allow(clippy::excessive_precision)]
20 mod mpegaudio;
21
22 const DECODERS: &[DecoderInfo] = &[
23 #[cfg(feature="decoder_aac")]
24 DecoderInfo { name: "aac", get_decoder: aac::get_decoder },
25 #[cfg(feature="decoder_mpa")]
26 DecoderInfo { name: "mp2", get_decoder: mpegaudio::get_decoder_mp2 },
27 #[cfg(feature="decoder_mpa")]
28 DecoderInfo { name: "mp3", get_decoder: mpegaudio::get_decoder_mp3 },
29 ];
30
31 /// Registers all available codecs provided by this crate.
32 pub fn mpeg_register_all_decoders(rd: &mut RegisteredDecoders) {
33 for decoder in DECODERS.iter() {
34 rd.add_decoder(*decoder);
35 }
36 }
37
38 const PACKETISERS: &[PacketiserInfo] = &[
39 #[cfg(feature="decoder_mpa")]
40 PacketiserInfo { name: "mpa", get_packetiser: mpegaudio::get_packetiser },
41 ];
42
43 /// Registers all available packetisers provided by this crate.
44 pub fn mpeg_register_all_packetisers(rp: &mut RegisteredPacketisers) {
45 for packetiser in PACKETISERS.iter() {
46 rp.add_packetiser(*packetiser);
47 }
48 }