introduce NADecoderSupport and buffer pools
[nihav.git] / nihav-realmedia / src / codecs / rv60.rs
index 4adbe394406c2b25be546fbcfb153a453998d9b4..2ec99ede09c9e4450c8598c86e84b6e5ee116a0c 100644 (file)
@@ -1,6 +1,6 @@
 use nihav_core::formats::YUV420_FORMAT;
 use nihav_core::frame::*;
-use nihav_core::codecs::{NADecoder, MV, ZERO_MV, DecoderError, DecoderResult, IPBShuffler};
+use nihav_core::codecs::{NADecoder, NADecoderSupport, MV, ZERO_MV, DecoderError, DecoderResult, IPBShuffler};
 use nihav_core::io::byteio::{MemoryReader,ByteReader};
 use nihav_core::io::bitreader::{BitReader,BitReaderMode};
 use nihav_core::io::intcode::*;
@@ -614,7 +614,7 @@ struct RealVideo60Decoder {
     dsp:        RV60DSP,
     ipred:      IntraPredContext,
 
-    avg_buf:    NAVideoBuffer<u8>,
+    avg_buf:    NAVideoBufferRef<u8>,
 
     y_coeffs:   [i16; 16 * 16],
     u_coeffs:   [i16; 8 * 8],
@@ -1391,7 +1391,7 @@ println!(" left {} bits", br.left());
 }
 
 impl NADecoder for RealVideo60Decoder {
-    fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> {
+    fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> {
         if let NACodecTypeInfo::Video(_vinfo) = info.get_properties() {
             let fmt = YUV420_FORMAT;
             let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(0, 0, false, fmt));
@@ -1418,7 +1418,7 @@ println!("???");
             Err(DecoderError::InvalidData)
         }
     }
-    fn decode(&mut self, pkt: &NAPacket) -> DecoderResult<NAFrameRef> {
+    fn decode(&mut self, _supp: &mut NADecoderSupport, pkt: &NAPacket) -> DecoderResult<NAFrameRef> {
         let src = pkt.get_buffer();
 
         validate!(src.len() > 9);
@@ -1458,7 +1458,7 @@ println!("???");
         frm.set_keyframe(hdr.ftype == FrameType::I);
         frm.set_pts(Some(hdr.ts as u64));
         frm.set_frame_type(hdr.ftype);
-        Ok(Rc::new(RefCell::new(frm)))
+        Ok(frm.into_ref())
     }
 }