aboutsummaryrefslogtreecommitdiffstats
path: root/nihav-llaudio/src/codecs/mod.rs
blob: 4f2a21a35d70d82f7dd12584edfc6306b6fd7fa9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
use nihav_core::codecs::*;

#[cfg(debug_assertions)]
macro_rules! validate {
    ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
}
#[cfg(not(debug_assertions))]
macro_rules! validate {
    ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } };
}

#[cfg(feature="decoder_ape")]
pub mod ape;
#[cfg(feature="decoder_ape")]
mod apepred;
#[cfg(feature="decoder_ape")]
mod apereader;

#[cfg(feature="decoder_flac")]
pub mod flac;

#[cfg(feature="decoder_tta")]
pub mod tta;

#[cfg(feature="decoder_wavpack")]
pub mod wavpack;

const LL_AUDIO_CODECS: &[DecoderInfo] = &[
#[cfg(feature="decoder_ape")]
    DecoderInfo { name: "ape", get_decoder: ape::get_decoder },
#[cfg(feature="decoder_flac")]
    DecoderInfo { name: "flac", get_decoder: flac::get_decoder },
#[cfg(feature="decoder_tta")]
    DecoderInfo { name: "tta", get_decoder: tta::get_decoder },
#[cfg(feature="decoder_wavpack")]
    DecoderInfo { name: "wavpack", get_decoder: wavpack::get_decoder },
];

/// Registers all available codecs provided by this crate.
pub fn llaudio_register_all_decoders(rd: &mut RegisteredDecoders) {
    for decoder in LL_AUDIO_CODECS.iter() {
        rd.add_decoder(*decoder);
    }
}

const LL_PACKETISERS: &[PacketiserInfo] = &[
#[cfg(feature="decoder_flac")]
    PacketiserInfo { name: "flac", get_packetiser: flac::get_packetiser },
];

/// Registers all available packetisers provided by this crate.
pub fn llaudio_register_all_packetisers(rp: &mut RegisteredPacketisers) {
    for pkt in LL_PACKETISERS.iter() {
        rp.add_packetiser(*pkt);
    }
}

#[cfg(feature="encoder_flac")]
pub mod flacenc;

const LL_AUDIO_ENCODERS: &[EncoderInfo] = &[
#[cfg(feature="decoder_flac")]
    EncoderInfo { name: "flac", get_encoder: flacenc::get_encoder },
];

/// Registers all available encoders provided by this crate.
pub fn llaudio_register_all_encoders(re: &mut RegisteredEncoders) {
    for encoder in LL_AUDIO_ENCODERS.iter() {
        re.add_encoder(*encoder);
    }
}