X-Git-Url: https://git.nihav.org/?p=nihav.git;a=blobdiff_plain;f=nihav-game%2Fsrc%2Fcodecs%2Ffuturevision.rs;h=814039124a55ac8f3fa2095c5a5c5595eff154b1;hp=c59e9bb41581dbf72791fb83fb687885e2f3ff57;hb=f1b0db38037cf1113834afbf5b478bcc4e84c588;hpb=820b43313ea6d0e03c7bf063ee6a64f3ff0cf659 diff --git a/nihav-game/src/codecs/futurevision.rs b/nihav-game/src/codecs/futurevision.rs index c59e9bb..8140391 100644 --- a/nihav-game/src/codecs/futurevision.rs +++ b/nihav-game/src/codecs/futurevision.rs @@ -1,10 +1,14 @@ use nihav_core::frame::*; use nihav_core::formats; +#[cfg(feature="decoder_fstaud")] use nihav_core::formats::NAChannelMap; use nihav_core::codecs::*; +#[cfg(feature="decoder_fstvid")] use nihav_core::io::byteio::*; +#[cfg(feature="decoder_fstaud")] use nihav_codec_support::codecs::imaadpcm::IMAState; +#[cfg(feature="decoder_fstvid")] struct FutureVisionVideoDecoder { info: NACodecInfoRef, pal: [u8; 768], @@ -13,6 +17,7 @@ struct FutureVisionVideoDecoder { h: usize, } +#[cfg(feature="decoder_fstvid")] struct Bits8<'a> { src: &'a [u8], pos: usize, @@ -20,6 +25,7 @@ struct Bits8<'a> { bit: u8, } +#[cfg(feature="decoder_fstvid")] impl<'a> Bits8<'a> { fn new(src: &'a [u8]) -> Self { Bits8 { src, pos: 0, buf: 0, bit: 0 } } fn read_bit(&mut self) -> ByteIOResult { @@ -39,6 +45,7 @@ impl<'a> Bits8<'a> { } } +#[cfg(feature="decoder_fstvid")] impl FutureVisionVideoDecoder { fn new() -> Self { FutureVisionVideoDecoder { @@ -65,6 +72,7 @@ impl FutureVisionVideoDecoder { } } +#[cfg(feature="decoder_fstvid")] impl NADecoder for FutureVisionVideoDecoder { fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { @@ -143,16 +151,19 @@ impl NADecoder for FutureVisionVideoDecoder { } } +#[cfg(feature="decoder_fstvid")] impl NAOptionHandler for FutureVisionVideoDecoder { fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] } fn set_options(&mut self, _options: &[NAOption]) { } fn query_option_value(&self, _name: &str) -> Option { None } } +#[cfg(feature="decoder_fstvid")] pub fn get_decoder_video() -> Box { Box::new(FutureVisionVideoDecoder::new()) } +#[cfg(feature="decoder_fstaud")] struct FutureVisionAudioDecoder { ainfo: NAAudioInfo, chmap: NAChannelMap, @@ -160,6 +171,7 @@ struct FutureVisionAudioDecoder { count: usize, } +#[cfg(feature="decoder_fstaud")] impl FutureVisionAudioDecoder { fn new() -> Self { FutureVisionAudioDecoder { @@ -171,6 +183,7 @@ impl FutureVisionAudioDecoder { } } +#[cfg(feature="decoder_fstaud")] impl NADecoder for FutureVisionAudioDecoder { fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { @@ -209,12 +222,14 @@ impl NADecoder for FutureVisionAudioDecoder { } } +#[cfg(feature="decoder_fstaud")] impl NAOptionHandler for FutureVisionAudioDecoder { fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] } fn set_options(&mut self, _options: &[NAOption]) { } fn query_option_value(&self, _name: &str) -> Option { None } } +#[cfg(feature="decoder_fstaud")] pub fn get_decoder_audio() -> Box { Box::new(FutureVisionAudioDecoder::new()) }