aboutsummaryrefslogtreecommitdiffstats
path: root/nihav-commonfmt/src/demuxers/mod.rs
blob: d850e05da1bede7e307aa55ffcf04bbb6c4ba7ff (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
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_avi")]
#[allow(clippy::cast_lossless)]
mod avi;
#[cfg(feature="demuxer_mov")]
#[allow(clippy::cast_lossless)]
mod mov;
#[cfg(feature="demuxer_wav")]
mod wav;
#[cfg(feature="demuxer_y4m")]
mod y4m;

const DEMUXERS: &[&dyn DemuxerCreator] = &[
#[cfg(feature="demuxer_avi")]
    &avi::AVIDemuxerCreator {},
#[cfg(feature="demuxer_mov")]
    &mov::MOVDemuxerCreator {},
#[cfg(feature="demuxer_mov")]
    &mov::MacBinaryMOVDemuxerCreator {},
#[cfg(feature="demuxer_wav")]
    &wav::WAVDemuxerCreator {},
#[cfg(feature="demuxer_y4m")]
    &y4m::Y4MDemuxerCreator {},
];

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