]> git.nihav.org Git - nihav.git/blob - nihav-mpeg/src/codecs/mod.rs
mpegaudio: handle VBRI tag in packetiser as well
[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: "mp3", get_decoder: mpegaudio::get_decoder_mp3 },
20 ];
21
22 /// Registers all available codecs provided by this crate.
23 pub fn mpeg_register_all_decoders(rd: &mut RegisteredDecoders) {
24 for decoder in DECODERS.iter() {
25 rd.add_decoder(*decoder);
26 }
27 }
28
29 const PACKETISERS: &[PacketiserInfo] = &[
30 #[cfg(feature="decoder_mpa")]
31 PacketiserInfo { name: "mp3", get_packetiser: mpegaudio::get_packetiser },
32 ];
33
34 /// Registers all available packetisers provided by this crate.
35 pub fn mpeg_register_all_packetisers(rp: &mut RegisteredPacketisers) {
36 for packetiser in PACKETISERS.iter() {
37 rp.add_packetiser(*packetiser);
38 }
39 }