]> git.nihav.org Git - nihav.git/blob - nihav-llaudio/src/codecs/mod.rs
add bytes_left() to NAPacketiser so its internal buffer size can be monitored
[nihav.git] / nihav-llaudio / 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_ape")]
8 pub mod ape;
9 #[cfg(feature="decoder_ape")]
10 mod apepred;
11 #[cfg(feature="decoder_ape")]
12 mod apereader;
13
14 #[cfg(feature="decoder_flac")]
15 pub mod flac;
16
17 #[cfg(feature="decoder_tta")]
18 pub mod tta;
19
20 #[cfg(feature="decoder_wavpack")]
21 pub mod wavpack;
22
23 const LL_AUDIO_CODECS: &[DecoderInfo] = &[
24 #[cfg(feature="decoder_ape")]
25 DecoderInfo { name: "ape", get_decoder: ape::get_decoder },
26 #[cfg(feature="decoder_flac")]
27 DecoderInfo { name: "flac", get_decoder: flac::get_decoder },
28 #[cfg(feature="decoder_tta")]
29 DecoderInfo { name: "tta", get_decoder: tta::get_decoder },
30 #[cfg(feature="decoder_wavpack")]
31 DecoderInfo { name: "wavpack", get_decoder: wavpack::get_decoder },
32 ];
33
34 /// Registers all available codecs provided by this crate.
35 pub fn llaudio_register_all_decoders(rd: &mut RegisteredDecoders) {
36 for decoder in LL_AUDIO_CODECS.iter() {
37 rd.add_decoder(*decoder);
38 }
39 }
40
41 const LL_PACKETISERS: &[PacketiserInfo] = &[
42 #[cfg(feature="decoder_flac")]
43 PacketiserInfo { name: "flac", get_packetiser: flac::get_packetiser },
44 ];
45
46 /// Registers all available packetisers provided by this crate.
47 pub fn llaudio_register_all_packetisers(rp: &mut RegisteredPacketisers) {
48 for pkt in LL_PACKETISERS.iter() {
49 rp.add_packetiser(*pkt);
50 }
51 }
52
53 #[cfg(feature="encoder_flac")]
54 pub mod flacenc;
55
56 const LL_AUDIO_ENCODERS: &[EncoderInfo] = &[
57 #[cfg(feature="decoder_flac")]
58 EncoderInfo { name: "flac", get_encoder: flacenc::get_encoder },
59 ];
60
61 /// Registers all available encoders provided by this crate.
62 pub fn llaudio_register_all_encoders(re: &mut RegisteredEncoders) {
63 for encoder in LL_AUDIO_ENCODERS.iter() {
64 re.add_encoder(*encoder);
65 }
66 }