X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-game%2Fsrc%2Fcodecs%2Fvmd.rs;h=a11e26c0f0df12f93f322f44ea66ec43db558337;hb=01613464323864a655c994820d3c43df1954e3b2;hp=bbe521842d30b54aa5e27f37fcd5ac5d19cebe08;hpb=1a967e6bad5f17943b4de0607078eb940ad5adfe;p=nihav.git diff --git a/nihav-game/src/codecs/vmd.rs b/nihav-game/src/codecs/vmd.rs index bbe5218..a11e26c 100644 --- a/nihav-game/src/codecs/vmd.rs +++ b/nihav-game/src/codecs/vmd.rs @@ -147,7 +147,7 @@ fn decode_frame_data(br: &mut ByteReader, dst: &mut [u8], mut dpos: usize, strid } struct VMDVideoDecoder { - info: Rc, + info: NACodecInfoRef, pal: [u8; 768], buf: Vec, width: usize, @@ -158,7 +158,7 @@ struct VMDVideoDecoder { impl VMDVideoDecoder { fn new() -> Self { Self { - info: Rc::new(NACodecInfo::default()), + info: NACodecInfoRef::default(), pal: [0; 768], buf: Vec::new(), width: 0, @@ -215,12 +215,12 @@ impl VMDVideoDecoder { } impl NADecoder for VMDVideoDecoder { - fn init(&mut self, info: Rc) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { self.width = vinfo.get_width(); self.height = vinfo.get_height(); let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(self.width, self.height, false, PAL8_FORMAT)); - 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(); validate!(info.get_extradata().is_some()); if let Some(ref edata) = info.get_extradata() { @@ -239,7 +239,7 @@ impl NADecoder for VMDVideoDecoder { Err(DecoderError::InvalidData) } } - fn decode(&mut self, pkt: &NAPacket) -> DecoderResult { + fn decode(&mut self, _supp: &mut NADecoderSupport, pkt: &NAPacket) -> DecoderResult { let src = pkt.get_buffer(); validate!(src.len() >= 10); @@ -264,7 +264,7 @@ impl NADecoder for VMDVideoDecoder { let mut frm = NAFrame::new_from_pkt(pkt, self.info.clone(), NABufferType::Video(buf)); frm.set_keyframe(is_intra); frm.set_frame_type(if is_intra { FrameType::I } else { FrameType::P }); - Ok(Rc::new(RefCell::new(frm))) + Ok(frm.into_ref()) } } @@ -351,7 +351,7 @@ impl VMDAudioDecoder { } impl NADecoder for VMDAudioDecoder { - fn init(&mut self, info: Rc) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { let fmt; if ainfo.get_format().get_bits() == 8 { @@ -372,7 +372,7 @@ impl NADecoder for VMDAudioDecoder { Err(DecoderError::InvalidData) } } - fn decode(&mut self, pkt: &NAPacket) -> DecoderResult { + fn decode(&mut self, _supp: &mut NADecoderSupport, pkt: &NAPacket) -> DecoderResult { let info = pkt.get_stream().get_info(); if let NACodecTypeInfo::Audio(_) = info.get_properties() { let pktbuf = pkt.get_buffer(); @@ -433,7 +433,7 @@ impl NADecoder for VMDAudioDecoder { let mut frm = NAFrame::new_from_pkt(pkt, info, abuf); frm.set_duration(Some(samples as u64)); frm.set_keyframe(true); - Ok(Rc::new(RefCell::new(frm))) + Ok(frm.into_ref()) } else { Err(DecoderError::InvalidData) }