switch NACodecInfo to Arc
[nihav.git] / nihav-rad / src / codecs / bink2.rs
index ac81835ccd4c5018eb0465948d85c1a920f804b8..60d42a4fb8a9d5a0d1c05809d2771fd77711f2d4 100644 (file)
@@ -996,7 +996,7 @@ impl Default for Bink2Codes {
 
 #[derive(Default)]
 struct Bink2Decoder {
-    info:       Rc<NACodecInfo>,
+    info:       NACodecInfoRef,
     ips:        IPShuffler,
 
     version:    u32,
@@ -1027,7 +1027,7 @@ impl Bink2Decoder {
         let (mut off_y, mut off_u, mut off_v, mut off_a) = (buf.get_offset(0), buf.get_offset(1), buf.get_offset(2), buf.get_offset(3));
         let (ooff_y, ooff_u, ooff_v, ooff_a) = (off_y, off_u, off_v, off_a);
         let (width, height) = buf.get_dimensions(0);
-        let mut data = buf.get_data_mut();
+        let data = buf.get_data_mut().unwrap();
         let dst = data.as_mut_slice();
         let bw = (width  + 31) >> 5;
         let bheight = (height + 31) >> 5;
@@ -1858,7 +1858,7 @@ fn decode_acs_4blocks_old(br: &mut BitReader, codes: &Bink2Codes, dst: &mut [[f3
 const KB2H_NUM_SLICES: [usize; 4] = [ 2, 3, 4, 8 ];
 
 impl NADecoder for Bink2Decoder {
-    fn init(&mut self, info: Rc<NACodecInfo>) -> DecoderResult<()> {
+    fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> {
         if let NACodecTypeInfo::Video(vinfo) = info.get_properties() {
             let w = vinfo.get_width();
             let h = vinfo.get_height();
@@ -1907,7 +1907,7 @@ impl NADecoder for Bink2Decoder {
                                            if self.has_alpha { FORMATON_FLAG_ALPHA } else { 0 },
                                            if self.has_alpha { 4 } else { 3 });
             let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(w, h, false, fmt));
-            self.info = Rc::new(NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()));
+            self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref();
 
             Ok(())
         } else {