]> git.nihav.org Git - nihav.git/blame_incremental - nihav-mpeg/src/codecs/mod.rs
mpegaudio: handle VBRI tag in packetiser as well
[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::manual_memcpy)]
9#[allow(clippy::useless_let_if_seq)]
10mod aac;
11#[cfg(feature="decoder_mpa")]
12#[allow(clippy::excessive_precision)]
13mod mpegaudio;
14
15const 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.
23pub fn mpeg_register_all_decoders(rd: &mut RegisteredDecoders) {
24 for decoder in DECODERS.iter() {
25 rd.add_decoder(*decoder);
26 }
27}
28
29const 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.
35pub fn mpeg_register_all_packetisers(rp: &mut RegisteredPacketisers) {
36 for packetiser in PACKETISERS.iter() {
37 rp.add_packetiser(*packetiser);
38 }
39}