switch NACodecInfo to Arc
[nihav.git] / nihav-commonfmt / src / codecs / sipro.rs
index b6cab622224c88ec6f2764a76990b0f9fc6e6151..05e6816588df5047d708a0a20ad06e0c2067caf0 100644 (file)
@@ -1,5 +1,3 @@
-use std::rc::Rc;
-use std::cell::RefCell;
 use nihav_core::formats::*;
 use nihav_core::frame::*;
 use nihav_core::codecs::*;
@@ -28,7 +26,7 @@ const EXCITATION_OFFSET: usize = 281 + 10 + 1;
 struct SiproDecoder {
     chmap:              NAChannelMap,
     ainfo:              NAAudioInfo,
-    info:               Rc<NACodecInfo>,
+    info:               NACodecInfoRef,
     mode:               &'static SiproModeInfo,
     mode_type:          SiproMode,
 
@@ -640,7 +638,7 @@ fn synth_filter(dst: &mut [f32], doff: usize, filt: &[f32], src: &[f32], len: us
 const CHMAP_MONO: [NAChannelType; 1] = [NAChannelType::C];
 
 impl NADecoder for SiproDecoder {
-    fn init(&mut self, info: Rc<NACodecInfo>) -> DecoderResult<()> {
+    fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> {
         if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() {
             let mut found = false;
             for i in 0..SIPRO_MODES.len() {
@@ -682,7 +680,7 @@ impl NADecoder for SiproDecoder {
 
         let abuf = alloc_audio_buffer(self.ainfo, duration, self.chmap.clone())?;
         let mut adata = abuf.get_abuf_f32().unwrap();
-        let mut dst = adata.get_data_mut();
+        let dst = adata.get_data_mut().unwrap();
 
         let frame_len = self.mode.subframe_len * self.mode.subframes;
         for (input, output) in pktbuf.chunks(frm_size).zip(dst.chunks_mut(out_frm_size)) {