]> git.nihav.org Git - nihav.git/blame - nihav-ms/src/codecs/mod.rs
core/frame: add truncate() for NAAudioBuffer
[nihav.git] / nihav-ms / src / codecs / mod.rs
CommitLineData
4abcd842
KS
1use nihav_core::codecs::*;
2
3macro_rules! validate {
4 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
5}
6
423005dc
KS
7#[cfg(feature="decoder_msrle")]
8pub mod msrle;
9
4abcd842
KS
10#[cfg(feature="decoder_msvideo1")]
11pub mod msvideo1;
12
13#[cfg(feature="decoder_ima_adpcm_ms")]
14pub mod imaadpcm;
15
dab59886 16#[cfg(any(feature="decoder_ms_adpcm", feature="encoder_ms_adpcm"))]
4abcd842
KS
17pub mod msadpcm;
18
19const MS_CODECS: &[DecoderInfo] = &[
423005dc
KS
20#[cfg(feature="decoder_msrle")]
21 DecoderInfo { name: "msrle", get_decoder: msrle::get_decoder },
4abcd842
KS
22#[cfg(feature="decoder_msvideo1")]
23 DecoderInfo { name: "msvideo1", get_decoder: msvideo1::get_decoder },
24#[cfg(feature="decoder_ima_adpcm_ms")]
25 DecoderInfo { name: "ima-adpcm-ms", get_decoder: imaadpcm::get_decoder },
26#[cfg(feature="decoder_ms_adpcm")]
27 DecoderInfo { name: "ms-adpcm", get_decoder: msadpcm::get_decoder },
28];
29
30/// Registers all available codecs provided by this crate.
78fb6560 31pub fn ms_register_all_decoders(rd: &mut RegisteredDecoders) {
4abcd842
KS
32 for decoder in MS_CODECS.iter() {
33 rd.add_decoder(decoder.clone());
34 }
35}
dab59886
KS
36
37#[cfg(feature="encoder_msvideo1")]
38pub mod msvideo1enc;
39
40const MS_ENCODERS: &[EncoderInfo] = &[
41#[cfg(feature="encoder_msvideo1")]
42 EncoderInfo { name: "msvideo1", get_encoder: msvideo1enc::get_encoder },
43#[cfg(feature="encoder_ms_adpcm")]
44 EncoderInfo { name: "ms-adpcm", get_encoder: msadpcm::get_encoder },
45];
46
47/// Registers all available encoders provided by this crate.
48pub fn ms_register_all_encoders(re: &mut RegisteredEncoders) {
49 for encoder in MS_ENCODERS.iter() {
50 re.add_encoder(encoder.clone());
51 }
52}