X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-realmedia%2Fsrc%2Fcodecs%2Fra288.rs;h=c3e23d9c244b29a1891314a1698da910ce17e414;hb=01613464323864a655c994820d3c43df1954e3b2;hp=00e0bd680b1056400b2cfa6a8b0abf2d297aefb7;hpb=3167c45c8087a692192021e08a8063dff680001c;p=nihav.git diff --git a/nihav-realmedia/src/codecs/ra288.rs b/nihav-realmedia/src/codecs/ra288.rs index 00e0bd6..c3e23d9 100644 --- a/nihav-realmedia/src/codecs/ra288.rs +++ b/nihav-realmedia/src/codecs/ra288.rs @@ -1,5 +1,3 @@ -use std::rc::Rc; -use std::cell::RefCell; use nihav_core::formats::*; use nihav_core::frame::*; use nihav_core::codecs::*; @@ -17,7 +15,7 @@ const GAIN_START: usize = 28; struct RA288Decoder { chmap: NAChannelMap, ainfo: NAAudioInfo, - info: Rc, + info: NACodecInfoRef, speech_lpc: [f32; SP_LPC_ORDER], speech_hist: [f32; 111], @@ -153,7 +151,7 @@ impl RA288Decoder { } impl NADecoder for RA288Decoder { - 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() { self.chmap.add_channels(&CHMAP_MONO); self.ainfo = NAAudioInfo::new(ainfo.get_sample_rate(), @@ -165,16 +163,16 @@ impl NADecoder for RA288Decoder { 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(); validate!(info.get_properties().is_audio()); let pktbuf = pkt.get_buffer(); let nframes = pktbuf.len() / FRAME_SIZE; let duration = NBLOCKS * BLOCKSIZE * nframes; - let mut abuf = alloc_audio_buffer(self.ainfo, duration, self.chmap.clone())?; + let abuf = alloc_audio_buffer(self.ainfo, duration, self.chmap.clone())?; let mut adata = abuf.get_abuf_f32().unwrap(); - let mut dst = adata.get_data_mut(); + let dst = adata.get_data_mut().unwrap(); for (input, output) in pktbuf.chunks(FRAME_SIZE).zip(dst.chunks_mut(NBLOCKS * BLOCKSIZE)) { let mut br = BitReader::new(input, input.len(), BitReaderMode::LE); @@ -197,7 +195,7 @@ impl NADecoder for RA288Decoder { let mut frm = NAFrame::new_from_pkt(pkt, self.info.clone(), abuf); frm.set_keyframe(true); - Ok(Rc::new(RefCell::new(frm))) + Ok(frm.into_ref()) } }