aboutsummaryrefslogtreecommitdiffstats
path: root/nihav-llaudio/src/demuxers/mod.rs
blob: 41dd9fd5c25e008706f63fbc8cf17501f0d9b5e7 (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
use nihav_core::demuxers::*;

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

#[cfg(feature="demuxer_ape")]
mod ape;
#[cfg(feature="demuxer_flac")]
mod flac;
#[cfg(feature="demuxer_flac")]
mod flacraw;
#[cfg(feature="demuxer_tta")]
mod tta;
#[cfg(feature="demuxer_wavpack")]
mod wavpack;

const LL_AUDIO_DEMUXERS: &[&dyn DemuxerCreator] = &[
#[cfg(feature="demuxer_ape")]
    &ape::APEDemuxerCreator {},
#[cfg(feature="demuxer_flac")]
    &flac::FLACDemuxerCreator {},
#[cfg(feature="demuxer_tta")]
    &tta::TTADemuxerCreator {},
#[cfg(feature="demuxer_wavpack")]
    &wavpack::WavPackDemuxerCreator {},
];

/// Registers all available demuxers provided by this crate.
pub fn llaudio_register_all_demuxers(rd: &mut RegisteredDemuxers) {
    for demuxer in LL_AUDIO_DEMUXERS.iter() {
        rd.add_demuxer(*demuxer);
    }
}

const LL_RAW_AUDIO_DEMUXERS: &[&dyn RawDemuxerCreator] = &[
#[cfg(feature="demuxer_flac")]
    &flacraw::FLACDemuxerCreator {},
];

/// Registers all available raw stream demuxers provided by this crate.
pub fn llaudio_register_all_raw_demuxers(rd: &mut RegisteredRawDemuxers) {
    for demuxer in LL_RAW_AUDIO_DEMUXERS.iter() {
        rd.add_demuxer(*demuxer);
    }
}