]> git.nihav.org Git - nihav.git/blame - nihav-mpeg/src/codecs/mod.rs
mov: set DTS to PTS when actual value is not available
[nihav.git] / nihav-mpeg / src / codecs / mod.rs
CommitLineData
16cca4d3
KS
1use nihav_core::codecs::*;
2
71d7f397 3#[cfg(debug_assertions)]
16cca4d3
KS
4macro_rules! validate {
5 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
6}
71d7f397
KS
7#[cfg(not(debug_assertions))]
8macro_rules! validate {
9 ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } };
10}
16cca4d3 11
ef0b99e6 12#[cfg(feature="decoder_aac")]
0e18270d
KS
13#[allow(clippy::comparison_chain)]
14#[allow(clippy::excessive_precision)]
ef0b99e6
KS
15#[allow(clippy::manual_memcpy)]
16#[allow(clippy::useless_let_if_seq)]
17mod aac;
16cca4d3
KS
18#[cfg(feature="decoder_mpa")]
19#[allow(clippy::excessive_precision)]
20mod mpegaudio;
21
22const DECODERS: &[DecoderInfo] = &[
ef0b99e6
KS
23#[cfg(feature="decoder_aac")]
24 DecoderInfo { name: "aac", get_decoder: aac::get_decoder },
9f9a08fb
KS
25#[cfg(feature="decoder_mpa")]
26 DecoderInfo { name: "mp2", get_decoder: mpegaudio::get_decoder_mp2 },
16cca4d3
KS
27#[cfg(feature="decoder_mpa")]
28 DecoderInfo { name: "mp3", get_decoder: mpegaudio::get_decoder_mp3 },
29];
30
31/// Registers all available codecs provided by this crate.
32pub fn mpeg_register_all_decoders(rd: &mut RegisteredDecoders) {
33 for decoder in DECODERS.iter() {
34 rd.add_decoder(*decoder);
35 }
36}
f27c73df
KS
37
38const PACKETISERS: &[PacketiserInfo] = &[
39#[cfg(feature="decoder_mpa")]
9f9a08fb 40 PacketiserInfo { name: "mpa", get_packetiser: mpegaudio::get_packetiser },
f27c73df
KS
41];
42
43/// Registers all available packetisers provided by this crate.
44pub fn mpeg_register_all_packetisers(rp: &mut RegisteredPacketisers) {
45 for packetiser in PACKETISERS.iter() {
46 rp.add_packetiser(*packetiser);
47 }
48}