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