]> git.nihav.org Git - nihav.git/blame - nihav-llaudio/src/codecs/mod.rs
fix clippy warnings
[nihav.git] / nihav-llaudio / src / codecs / mod.rs
CommitLineData
87927c57
KS
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_ape")]
8pub mod ape;
9#[cfg(feature="decoder_ape")]
10mod apepred;
11#[cfg(feature="decoder_ape")]
12mod apereader;
13
14#[cfg(feature="decoder_flac")]
15pub mod flac;
16
17#[cfg(feature="decoder_tta")]
18pub mod tta;
19
20#[cfg(feature="decoder_wavpack")]
21pub mod wavpack;
22
23const 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.
35pub fn llaudio_register_all_decoders(rd: &mut RegisteredDecoders) {
36 for decoder in LL_AUDIO_CODECS.iter() {
b7c882c1 37 rd.add_decoder(*decoder);
87927c57
KS
38 }
39}
c11ad64e 40
2cd9d8a6
KS
41const 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.
47pub fn llaudio_register_all_packetisers(rp: &mut RegisteredPacketisers) {
48 for pkt in LL_PACKETISERS.iter() {
49 rp.add_packetiser(*pkt);
50 }
51}
52
c11ad64e
KS
53#[cfg(feature="encoder_flac")]
54pub mod flacenc;
55
56const 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.
62pub fn llaudio_register_all_encoders(re: &mut RegisteredEncoders) {
63 for encoder in LL_AUDIO_ENCODERS.iter() {
64 re.add_encoder(*encoder);
65 }
66}