1 use nihav_core::codecs::*;
3 macro_rules! validate {
4 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
7 #[cfg(feature="decoder_ape")]
9 #[cfg(feature="decoder_ape")]
11 #[cfg(feature="decoder_ape")]
14 #[cfg(feature="decoder_flac")]
17 #[cfg(feature="decoder_tta")]
20 #[cfg(feature="decoder_wavpack")]
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 },
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);
41 const LL_PACKETISERS: &[PacketiserInfo] = &[
42 #[cfg(feature="decoder_flac")]
43 PacketiserInfo { name: "flac", get_packetiser: flac::get_packetiser },
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);
53 #[cfg(feature="encoder_flac")]
56 const LL_AUDIO_ENCODERS: &[EncoderInfo] = &[
57 #[cfg(feature="decoder_flac")]
58 EncoderInfo { name: "flac", get_encoder: flacenc::get_encoder },
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);