]> git.nihav.org Git - nihav.git/blame_incremental - nihav-mpeg/src/codecs/mod.rs
mov: sanitise position on seek error
[nihav.git] / nihav-mpeg / src / codecs / mod.rs
... / ...
CommitLineData
1use nihav_core::codecs::*;
2
3macro_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)]
12mod aac;
13#[cfg(feature="decoder_mpa")]
14#[allow(clippy::excessive_precision)]
15mod mpegaudio;
16
17const 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.
27pub fn mpeg_register_all_decoders(rd: &mut RegisteredDecoders) {
28 for decoder in DECODERS.iter() {
29 rd.add_decoder(*decoder);
30 }
31}
32
33const 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.
39pub fn mpeg_register_all_packetisers(rp: &mut RegisteredPacketisers) {
40 for packetiser in PACKETISERS.iter() {
41 rp.add_packetiser(*packetiser);
42 }
43}