introduce NADecoderSupport and buffer pools
[nihav.git] / nihav-rad / src / codecs / binkaud.rs
index 2bf93ff351df144cc4128f5c1e9aa69cec080724..c09bcfb0774a77a2440c378220ac4ac2ba93129e 100644 (file)
@@ -178,7 +178,7 @@ const CRITICAL_FREQS: [usize; MAX_BANDS] = [
 const RUN_TAB: [usize; 16] = [ 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64 ];
 
 impl NADecoder for BinkAudioDecoder {
-    fn init(&mut self, info: Rc<NACodecInfo>) -> DecoderResult<()> {
+    fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> {
         if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() {
             let srate    = ainfo.get_sample_rate();
             let channels = ainfo.get_channels();
@@ -229,7 +229,7 @@ impl NADecoder for BinkAudioDecoder {
             Err(DecoderError::InvalidData)
         }
     }
-    fn decode(&mut self, pkt: &NAPacket) -> DecoderResult<NAFrameRef> {
+    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() {
             let pktbuf = pkt.get_buffer();
@@ -242,7 +242,7 @@ impl NADecoder for BinkAudioDecoder {
             let mut adata = abuf.get_abuf_f32().unwrap();
             let mut off0 = adata.get_offset(0);
             let mut off1 = adata.get_offset(1);
-            let mut dst = adata.get_data_mut();
+            let dst = adata.get_data_mut().unwrap();
 
             let num_subframes = nsamples / self.duration / self.chmap.num_channels() / 2;
 
@@ -268,7 +268,7 @@ impl NADecoder for BinkAudioDecoder {
             let mut frm = NAFrame::new_from_pkt(pkt, info, abuf);
             frm.set_duration(Some(self.duration as u64));
             frm.set_keyframe(false);
-            Ok(Rc::new(RefCell::new(frm)))
+            Ok(frm.into_ref())
         } else {
             Err(DecoderError::InvalidData)
         }