switch NACodecInfo to Arc
[nihav.git] / nihav-realmedia / src / codecs / ra288.rs
index a5acc291b038876e60d92a326c6e4a683e42a074..142cf2ae1cec294242c637382b9d514dcef5d268 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::*;
@@ -17,7 +15,7 @@ const GAIN_START: usize = 28;
 struct RA288Decoder {
     chmap:  NAChannelMap,
     ainfo:  NAAudioInfo,
-    info:   Rc<NACodecInfo>,
+    info:   NACodecInfoRef,
 
     speech_lpc:     [f32; SP_LPC_ORDER],
     speech_hist:    [f32; 111],
@@ -153,7 +151,7 @@ impl RA288Decoder {
 }
 
 impl NADecoder for RA288Decoder {
-    fn init(&mut self, info: Rc<NACodecInfo>) -> DecoderResult<()> {
+    fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> {
         if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() {
             self.chmap.add_channels(&CHMAP_MONO);
             self.ainfo = NAAudioInfo::new(ainfo.get_sample_rate(),
@@ -174,7 +172,7 @@ impl NADecoder for RA288Decoder {
 
         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();
 
         for (input, output) in pktbuf.chunks(FRAME_SIZE).zip(dst.chunks_mut(NBLOCKS * BLOCKSIZE)) {
             let mut br = BitReader::new(input, input.len(), BitReaderMode::LE);