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

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

#[cfg(any(feature="demuxer_bmv",feature="demuxer_bmv3"))]
mod bmv;
#[cfg(any(feature="demuxer_fst",feature="demuxer_fcmp"))]
mod fst;
#[cfg(feature="demuxer_gdv")]
mod gdv;
#[cfg(feature="demuxer_q")]
mod q;
#[cfg(feature="demuxer_rbt")]
mod rbt;
#[cfg(feature="demuxer_seq")]
mod seq;
#[cfg(feature="demuxer_sga")]
mod sga;
#[cfg(feature="demuxer_siff")]
mod siff;
#[cfg(feature="demuxer_smush")]
mod smush;
#[cfg(feature="demuxer_vmd")]
mod vmd;
#[cfg(feature="demuxer_vx")]
mod vx;

const GAME_DEMUXERS: &[&dyn DemuxerCreator] = &[
#[cfg(feature="demuxer_bmv")]
    &bmv::BMVDemuxerCreator {},
#[cfg(feature="demuxer_bmv3")]
    &bmv::BMV3DemuxerCreator {},
#[cfg(feature="demuxer_fcmp")]
    &fst::FCMPDemuxerCreator {},
#[cfg(feature="demuxer_fst")]
    &fst::FSTDemuxerCreator {},
#[cfg(feature="demuxer_gdv")]
    &gdv::GDVDemuxerCreator {},
#[cfg(feature="demuxer_q")]
    &q::QDemuxerCreator {},
#[cfg(feature="demuxer_rbt")]
    &rbt::RobotDemuxerCreator {},
#[cfg(feature="demuxer_seq")]
    &seq::SequenceDemuxerCreator {},
#[cfg(feature="demuxer_sga")]
    &sga::SGADemuxerCreator {},
#[cfg(feature="demuxer_siff")]
    &siff::SIFFDemuxerCreator {},
#[cfg(feature="demuxer_smush")]
    &smush::SmushDemuxerCreator {},
#[cfg(feature="demuxer_smush")]
    &smush::MCMPDemuxerCreator {},
#[cfg(feature="demuxer_vmd")]
    &vmd::VMDDemuxerCreator {},
#[cfg(feature="demuxer_vx")]
    &vx::VXDemuxerCreator {},
];

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