1 use nihav_core::codecs::*;
3 #[cfg(debug_assertions)]
4 macro_rules! validate {
5 ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
7 #[cfg(not(debug_assertions))]
8 macro_rules! validate {
9 ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } };
12 #[cfg(feature="decoder_cinepak")]
14 #[cfg(feature="decoder_clearvideo")]
16 #[cfg(feature="decoder_jpeg")]
18 #[cfg(feature="decoder_rawvideo")]
20 #[cfg(feature="decoder_rawvideo_ms")]
22 #[cfg(feature="decoder_zmbv")]
25 #[cfg(feature="decoder_atrac3")]
26 #[allow(clippy::identity_op)]
27 #[allow(clippy::useless_let_if_seq)]
29 #[cfg(any(feature="decoder_pcm",feature="encoder_pcm"))]
31 #[cfg(feature="decoder_sipro")]
32 #[allow(clippy::collapsible_if)]
33 #[allow(clippy::collapsible_else_if)]
34 #[allow(clippy::identity_op)]
35 #[allow(clippy::manual_memcpy)]
37 #[cfg(feature="decoder_ts102366")]
40 #[cfg(feature="decoders")]
41 const DECODERS: &[DecoderInfo] = &[
42 #[cfg(feature="decoder_cinepak")]
43 DecoderInfo { name: "cinepak", get_decoder: cinepak::get_decoder },
44 #[cfg(feature="decoder_clearvideo")]
45 DecoderInfo { name: "clearvideo", get_decoder: clearvideo::get_decoder },
46 #[cfg(feature="decoder_clearvideo")]
47 DecoderInfo { name: "clearvideo_rm", get_decoder: clearvideo::get_decoder_rm },
48 #[cfg(feature="decoder_jpeg")]
49 DecoderInfo { name: "jpeg", get_decoder: jpeg::get_decoder },
50 #[cfg(feature="decoder_rawvideo")]
51 DecoderInfo { name: "rawvideo", get_decoder: rawvideo::get_decoder },
52 #[cfg(feature="decoder_rawvideo_ms")]
53 DecoderInfo { name: "rawvideo-ms", get_decoder: rawvideo_ms::get_decoder },
54 #[cfg(feature="decoder_zmbv")]
55 DecoderInfo { name: "zmbv", get_decoder: zmbv::get_decoder },
57 #[cfg(feature="decoder_pcm")]
58 DecoderInfo { name: "pcm", get_decoder: pcm::get_decoder },
59 #[cfg(feature="decoder_pcm")]
60 DecoderInfo { name: "alaw", get_decoder: pcm::get_a_law_decoder },
61 #[cfg(feature="decoder_pcm")]
62 DecoderInfo { name: "ulaw", get_decoder: pcm::get_mu_law_decoder },
63 #[cfg(feature="decoder_sipro")]
64 DecoderInfo { name: "sipro", get_decoder: sipro::get_decoder },
65 #[cfg(feature="decoder_ts102366")]
66 DecoderInfo { name: "ac3", get_decoder: ts102366::get_decoder },
67 #[cfg(feature="decoder_atrac3")]
68 DecoderInfo { name: "atrac3", get_decoder: atrac3::get_decoder },
71 /// Registers all available codecs provided by this crate.
72 #[cfg(feature="decoders")]
73 pub fn generic_register_all_decoders(rd: &mut RegisteredDecoders) {
74 for decoder in DECODERS.iter() {
75 rd.add_decoder(*decoder);
79 #[cfg(feature="encoder_cinepak")]
81 #[cfg(feature="encoder_rawvideo")]
83 #[cfg(feature="encoder_zmbv")]
86 #[cfg(feature="encoders")]
87 const ENCODERS: &[EncoderInfo] = &[
88 #[cfg(feature="encoder_cinepak")]
89 EncoderInfo { name: "cinepak", get_encoder: cinepakenc::get_encoder },
90 #[cfg(feature="encoder_rawvideo")]
91 EncoderInfo { name: "rawvideo", get_encoder: rawvideoenc::get_encoder },
92 #[cfg(feature="encoder_zmbv")]
93 EncoderInfo { name: "zmbv", get_encoder: zmbvenc::get_encoder },
95 #[cfg(feature="encoder_pcm")]
96 EncoderInfo { name: "pcm", get_encoder: pcm::get_encoder },
99 /// Registers all available encoders provided by this crate.
100 #[cfg(feature="encoders")]
101 pub fn generic_register_all_encoders(re: &mut RegisteredEncoders) {
102 for encoder in ENCODERS.iter() {
103 re.add_encoder(*encoder);