introduce NADecoderSupport and buffer pools
[nihav.git] / nihav-rad / src / codecs / binkaud.rs
index c38f6d4beff88ca7094eefe4bf675e2ad8391591..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();
@@ -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)
         }