1 use nihav_core::codecs::*;
3 macro_rules! validate {
4 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
7 #[cfg(feature="decoder_aac")]
8 #[allow(clippy::manual_memcpy)]
9 #[allow(clippy::useless_let_if_seq)]
11 #[cfg(feature="decoder_mpa")]
12 #[allow(clippy::excessive_precision)]
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 },
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);
31 const PACKETISERS: &[PacketiserInfo] = &[
32 #[cfg(feature="decoder_mpa")]
33 PacketiserInfo { name: "mpa", get_packetiser: mpegaudio::get_packetiser },
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);