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

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

#[cfg(feature="decoder_bmv")]
pub mod bmv;
#[cfg(feature="decoder_bmv3")]
pub mod bmv3;
#[cfg(feature="decoder_gdvvid")]
pub mod gremlinvideo;
#[cfg(feature="decoder_midivid")]
pub mod midivid;
#[cfg(feature="decoder_vmd")]
pub mod vmd;

const GAME_CODECS: &[DecoderInfo] = &[
#[cfg(feature="decoder_gdvvid")]
    DecoderInfo { name: "gdv-audio", get_decoder: gremlinvideo::get_decoder_audio },
#[cfg(feature="decoder_gdvvid")]
    DecoderInfo { name: "gdv-video", get_decoder: gremlinvideo::get_decoder_video },
#[cfg(feature="decoder_bmv")]
    DecoderInfo { name: "bmv-audio", get_decoder: bmv::get_decoder_audio },
#[cfg(feature="decoder_bmv")]
    DecoderInfo { name: "bmv-video", get_decoder: bmv::get_decoder_video },
#[cfg(feature="decoder_bmv3")]
    DecoderInfo { name: "bmv3-audio", get_decoder: bmv3::get_decoder_audio },
#[cfg(feature="decoder_bmv3")]
    DecoderInfo { name: "bmv3-video", get_decoder: bmv3::get_decoder_video },
#[cfg(feature="decoder_vmd")]
    DecoderInfo { name: "vmd-audio", get_decoder: vmd::get_decoder_audio },
#[cfg(feature="decoder_vmd")]
    DecoderInfo { name: "vmd-video", get_decoder: vmd::get_decoder_video },
#[cfg(feature="decoder_midivid")]
    DecoderInfo { name: "midivid", get_decoder: midivid::get_decoder_video },
];

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