]> git.nihav.org Git - nihav.git/blobdiff - nihav-game/src/codecs/vmd.rs
core: implement Default for NATimePoint
[nihav.git] / nihav-game / src / codecs / vmd.rs
index 65d5de318bfac07c5b859ce2eb793b9dd53bbbda..110548a7917642d84266a666a35a129c6a9201cd 100644 (file)
@@ -335,6 +335,12 @@ impl NADecoder for VMDVideoDecoder {
     }
 }
 
+impl NAOptionHandler for VMDVideoDecoder {
+    fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] }
+    fn set_options(&mut self, _options: &[NAOption]) { }
+    fn query_option_value(&self, _name: &str) -> Option<NAValue> { None }
+}
+
 
 pub fn get_decoder_video() -> Box<dyn NADecoder + Send> {
     Box::new(VMDVideoDecoder::new())
@@ -445,7 +451,7 @@ impl NADecoder for VMDAudioDecoder {
             let edata = info.get_extradata();
             let flags = if let Some(ref buf) = edata {
                     validate!(buf.len() >= 2);
-                    (buf[0] as u16) | ((buf[1] as u16) << 8)
+                    u16::from(buf[0]) | (u16::from(buf[1]) << 8)
                 } else {
                     0
                 };
@@ -474,13 +480,15 @@ impl NADecoder for VMDAudioDecoder {
                 }
             };
             self.ainfo = NAAudioInfo::new(ainfo.get_sample_rate(), ainfo.get_channels(), fmt, ainfo.get_block_len());
-            self.info = info.replace_info(NACodecTypeInfo::Audio(self.ainfo.clone()));
+            self.info = info.replace_info(NACodecTypeInfo::Audio(self.ainfo));
             self.chmap = NAChannelMap::from_str(if channels == 1 { "C" } else { "L,R" }).unwrap();
             Ok(())
         } else {
             Err(DecoderError::InvalidData)
         }
     }
+    #[allow(clippy::identity_op)]
+    #[allow(clippy::cyclomatic_complexity)]
     fn decode(&mut self, _supp: &mut NADecoderSupport, pkt: &NAPacket) -> DecoderResult<NAFrameRef> {
         let info = pkt.get_stream().get_info();
         if let NACodecTypeInfo::Audio(_) = info.get_properties() {
@@ -667,6 +675,12 @@ impl NADecoder for VMDAudioDecoder {
     }
 }
 
+impl NAOptionHandler for VMDAudioDecoder {
+    fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] }
+    fn set_options(&mut self, _options: &[NAOption]) { }
+    fn query_option_value(&self, _name: &str) -> Option<NAValue> { None }
+}
+
 pub fn get_decoder_audio() -> Box<dyn NADecoder + Send> {
     Box::new(VMDAudioDecoder::new())
 }