From b70cc0062fd4d791ee20f23439a3b08a04921835 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 15 Feb 2019 12:07:45 +0100 Subject: [PATCH] fix allocated buffer mutability after previous commit --- nihav-commonfmt/src/codecs/atrac3.rs | 2 +- nihav-commonfmt/src/codecs/clearvideo.rs | 2 +- nihav-commonfmt/src/codecs/sipro.rs | 2 +- nihav-commonfmt/src/codecs/ts102366.rs | 2 +- nihav-core/src/codecs/h263/decoder.rs | 4 ++-- nihav-duck/src/codecs/dkadpcm.rs | 2 +- nihav-duck/src/codecs/truemotion1.rs | 2 +- nihav-duck/src/codecs/truemotion2.rs | 2 +- nihav-duck/src/codecs/truemotionrt.rs | 2 +- nihav-game/src/codecs/bmv.rs | 2 +- nihav-game/src/codecs/gremlinvideo.rs | 2 +- nihav-indeo/src/codecs/imc.rs | 2 +- nihav-indeo/src/codecs/indeo2.rs | 2 +- nihav-indeo/src/codecs/indeo3.rs | 2 +- nihav-rad/src/codecs/binkaud.rs | 2 +- nihav-rad/src/codecs/binkvid.rs | 6 +++--- nihav-rad/src/codecs/smacker.rs | 4 ++-- nihav-realmedia/src/codecs/ra144.rs | 2 +- nihav-realmedia/src/codecs/ra288.rs | 2 +- nihav-realmedia/src/codecs/rv3040.rs | 4 ++-- nihav-realmedia/src/codecs/rv60.rs | 4 ++-- 21 files changed, 27 insertions(+), 27 deletions(-) diff --git a/nihav-commonfmt/src/codecs/atrac3.rs b/nihav-commonfmt/src/codecs/atrac3.rs index 3170c00..66751b3 100644 --- a/nihav-commonfmt/src/codecs/atrac3.rs +++ b/nihav-commonfmt/src/codecs/atrac3.rs @@ -679,7 +679,7 @@ impl NADecoder for Atrac3Decoder { let ainfo = self.info.get_properties().get_audio_info().unwrap(); - let mut abuf = alloc_audio_buffer(ainfo, ATRAC3_FRAME_SIZE, self.chmap.clone())?; + let abuf = alloc_audio_buffer(ainfo, ATRAC3_FRAME_SIZE, self.chmap.clone())?; let mut adata = abuf.get_abuf_f32().unwrap(); let mut output = adata.get_data_mut(); diff --git a/nihav-commonfmt/src/codecs/clearvideo.rs b/nihav-commonfmt/src/codecs/clearvideo.rs index 51f93da..face26c 100644 --- a/nihav-commonfmt/src/codecs/clearvideo.rs +++ b/nihav-commonfmt/src/codecs/clearvideo.rs @@ -737,7 +737,7 @@ impl NADecoder for ClearVideoDecoder { let vinfo = self.info.get_properties().get_video_info().unwrap(); let bufret = alloc_video_buffer(vinfo, self.tsize); if let Err(_) = bufret { return Err(DecoderError::InvalidData); } - let mut bufinfo = bufret.unwrap(); + let bufinfo = bufret.unwrap(); let mut buf = bufinfo.get_vbuf().unwrap(); if is_intra { diff --git a/nihav-commonfmt/src/codecs/sipro.rs b/nihav-commonfmt/src/codecs/sipro.rs index 8820a01..b6cab62 100644 --- a/nihav-commonfmt/src/codecs/sipro.rs +++ b/nihav-commonfmt/src/codecs/sipro.rs @@ -680,7 +680,7 @@ impl NADecoder for SiproDecoder { let duration = out_frm_size * 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(); diff --git a/nihav-commonfmt/src/codecs/ts102366.rs b/nihav-commonfmt/src/codecs/ts102366.rs index 12e0fe9..a82624d 100644 --- a/nihav-commonfmt/src/codecs/ts102366.rs +++ b/nihav-commonfmt/src/codecs/ts102366.rs @@ -1199,7 +1199,7 @@ impl NADecoder for AudioDecoder { let ainfo = NAAudioInfo::new(sinfo.samplerate >> bsi.shift, channels as u8, SND_F32P_FORMAT, BLOCK_LEN); - let mut abuf = alloc_audio_buffer(ainfo, duration, bsi.acmod.get_channel_map(bsi.lfeon))?; + let abuf = alloc_audio_buffer(ainfo, duration, bsi.acmod.get_channel_map(bsi.lfeon))?; let mut adata = abuf.get_abuf_f32().unwrap(); let mut output = adata.get_data_mut(); diff --git a/nihav-core/src/codecs/h263/decoder.rs b/nihav-core/src/codecs/h263/decoder.rs index fd828fe..a0e7ce4 100644 --- a/nihav-core/src/codecs/h263/decoder.rs +++ b/nihav-core/src/codecs/h263/decoder.rs @@ -221,7 +221,7 @@ impl H263BaseDecoder { let vinfo = NAVideoInfo::new(self.w, self.h, false, fmt); let bufret = alloc_video_buffer(vinfo, 4); if let Err(_) = bufret { return Err(DecoderError::InvalidData); } - let mut bufinfo = bufret.unwrap(); + let bufinfo = bufret.unwrap(); let mut buf = bufinfo.get_vbuf().unwrap(); let mut slice = if self.is_gob { @@ -533,7 +533,7 @@ impl H263BaseDecoder { let vinfo = NAVideoInfo::new(self.w, self.h, false, fmt); let bufret = alloc_video_buffer(vinfo, 4); if let Err(_) = bufret { return Err(DecoderError::InvalidData); } - let mut bufinfo = bufret.unwrap(); + let bufinfo = bufret.unwrap(); let mut b_buf = bufinfo.get_vbuf().unwrap(); if let (Some(ref bck_buf), Some(ref fwd_buf)) = (self.ipbs.get_nextref(), self.ipbs.get_lastref()) { diff --git a/nihav-duck/src/codecs/dkadpcm.rs b/nihav-duck/src/codecs/dkadpcm.rs index 64b750f..68969da 100644 --- a/nihav-duck/src/codecs/dkadpcm.rs +++ b/nihav-duck/src/codecs/dkadpcm.rs @@ -77,7 +77,7 @@ impl NADecoder for DuckADPCMDecoder { let nblocks = pktbuf.len() / self.block_len; let out_block_len = self.ainfo.get_block_len(); let duration = out_block_len * nblocks; - 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_i16().unwrap(); let mut off0 = adata.get_offset(0); let mut off1 = adata.get_offset(1); diff --git a/nihav-duck/src/codecs/truemotion1.rs b/nihav-duck/src/codecs/truemotion1.rs index c43f7d8..eae23d4 100644 --- a/nihav-duck/src/codecs/truemotion1.rs +++ b/nihav-duck/src/codecs/truemotion1.rs @@ -607,7 +607,7 @@ impl NADecoder for TM1Decoder { let myinfo = NAVideoInfo::new(out_width, height, false, fmt); let bufret = alloc_video_buffer(myinfo, 2); if let Err(_) = bufret { return Err(DecoderError::InvalidData); } - let mut bufinfo = bufret.unwrap(); + let bufinfo = bufret.unwrap(); self.lastframe.reset(); if !is_24bit { self.lastframe.set16(bufinfo.get_vbuf16().unwrap()); diff --git a/nihav-duck/src/codecs/truemotion2.rs b/nihav-duck/src/codecs/truemotion2.rs index 83cdce6..3419d93 100644 --- a/nihav-duck/src/codecs/truemotion2.rs +++ b/nihav-duck/src/codecs/truemotion2.rs @@ -575,7 +575,7 @@ impl NADecoder for TM2Decoder { let myinfo = NAVideoInfo::new(self.width, self.height, false, RGB24_FORMAT); let bufret = alloc_video_buffer(myinfo, 2); if let Err(_) = bufret { return Err(DecoderError::InvalidData); } - let mut bufinfo = bufret.unwrap(); + let bufinfo = bufret.unwrap(); let mut buf = bufinfo.get_vbuf().unwrap(); let is_intra = self.decode_blocks()?; diff --git a/nihav-duck/src/codecs/truemotionrt.rs b/nihav-duck/src/codecs/truemotionrt.rs index 3881ee7..a4ea0ac 100644 --- a/nihav-duck/src/codecs/truemotionrt.rs +++ b/nihav-duck/src/codecs/truemotionrt.rs @@ -62,7 +62,7 @@ impl NADecoder for TMRTDecoder { let myinfo = NAVideoInfo::new(width, height, false, YUV410_FORMAT); let bufret = alloc_video_buffer(myinfo, 2); if let Err(_) = bufret { return Err(DecoderError::InvalidData); } - let mut bufinfo = bufret.unwrap(); + let bufinfo = bufret.unwrap(); let mut buf = bufinfo.get_vbuf().unwrap(); let mut br = BitReader::new(&src[hdr_size..], src.len() - hdr_size, BitReaderMode::LE); diff --git a/nihav-game/src/codecs/bmv.rs b/nihav-game/src/codecs/bmv.rs index cea10eb..229ac49 100644 --- a/nihav-game/src/codecs/bmv.rs +++ b/nihav-game/src/codecs/bmv.rs @@ -275,7 +275,7 @@ impl NADecoder for BMVAudioDecoder { let nblocks = pktbuf[0] as usize; validate!(pktbuf.len() == 1 + 65 * nblocks); let samples = nblocks * 32; - let mut abuf = alloc_audio_buffer(self.ainfo, samples, self.chmap.clone())?; + let abuf = alloc_audio_buffer(self.ainfo, samples, self.chmap.clone())?; let mut adata = abuf.get_abuf_i16().unwrap(); let off1 = adata.get_offset(1); let mut dst = adata.get_data_mut(); diff --git a/nihav-game/src/codecs/gremlinvideo.rs b/nihav-game/src/codecs/gremlinvideo.rs index b899630..7de585f 100644 --- a/nihav-game/src/codecs/gremlinvideo.rs +++ b/nihav-game/src/codecs/gremlinvideo.rs @@ -528,7 +528,7 @@ impl NADecoder for GremlinAudioDecoder { if let NACodecTypeInfo::Audio(_) = info.get_properties() { let pktbuf = pkt.get_buffer(); let samples = pktbuf.len() / self.chmap.num_channels(); - let mut abuf = alloc_audio_buffer(self.ainfo, samples, self.chmap.clone())?; + let abuf = alloc_audio_buffer(self.ainfo, samples, self.chmap.clone())?; let mut adata = abuf.get_abuf_i16().unwrap(); let off1 = adata.get_offset(1); let mut buf = adata.get_data_mut(); diff --git a/nihav-indeo/src/codecs/imc.rs b/nihav-indeo/src/codecs/imc.rs index a48e43e..669e0fe 100644 --- a/nihav-indeo/src/codecs/imc.rs +++ b/nihav-indeo/src/codecs/imc.rs @@ -896,7 +896,7 @@ impl NADecoder for IMCDecoder { let nblocks = pktbuf.len() / BLOCK_SIZE / (self.ainfo.get_channels() as usize); let duration = COEFFS * nblocks; - 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(); diff --git a/nihav-indeo/src/codecs/indeo2.rs b/nihav-indeo/src/codecs/indeo2.rs index c03d2c2..8c1930f 100644 --- a/nihav-indeo/src/codecs/indeo2.rs +++ b/nihav-indeo/src/codecs/indeo2.rs @@ -335,7 +335,7 @@ impl NADecoder for Indeo2Decoder { let vinfo = self.info.get_properties().get_video_info().unwrap(); let bufret = alloc_video_buffer(vinfo, 2); if let Err(_) = bufret { return Err(DecoderError::InvalidData); } - let mut bufinfo = bufret.unwrap(); + let bufinfo = bufret.unwrap(); let mut buf = bufinfo.get_vbuf().unwrap(); for plane in 0..3 { let tabidx = (if plane == 0 { luma_tab } else { chroma_tab }) as usize; diff --git a/nihav-indeo/src/codecs/indeo3.rs b/nihav-indeo/src/codecs/indeo3.rs index 892f193..43affd3 100644 --- a/nihav-indeo/src/codecs/indeo3.rs +++ b/nihav-indeo/src/codecs/indeo3.rs @@ -753,7 +753,7 @@ impl NADecoder for Indeo3Decoder { let vinfo = self.info.get_properties().get_video_info().unwrap(); let bufret = alloc_video_buffer(vinfo, 2); if let Err(_) = bufret { return Err(DecoderError::InvalidData); } - let mut bufinfo = bufret.unwrap(); + let bufinfo = bufret.unwrap(); let mut buf = bufinfo.get_vbuf().unwrap(); let ystart = data_start + (yoff as u64); let ustart = data_start + (uoff as u64); diff --git a/nihav-rad/src/codecs/binkaud.rs b/nihav-rad/src/codecs/binkaud.rs index ed4c32a..2bf93ff 100644 --- a/nihav-rad/src/codecs/binkaud.rs +++ b/nihav-rad/src/codecs/binkaud.rs @@ -238,7 +238,7 @@ impl NADecoder for BinkAudioDecoder { let nsamples = br.read(32)? as usize; // validate!(nsamples % self.duration == 0); - let mut abuf = alloc_audio_buffer(self.ainfo, nsamples / self.chmap.num_channels() / 2, self.chmap.clone())?; + let abuf = alloc_audio_buffer(self.ainfo, nsamples / self.chmap.num_channels() / 2, self.chmap.clone())?; let mut adata = abuf.get_abuf_f32().unwrap(); let mut off0 = adata.get_offset(0); let mut off1 = adata.get_offset(1); diff --git a/nihav-rad/src/codecs/binkvid.rs b/nihav-rad/src/codecs/binkvid.rs index bf8f201..90d1d53 100644 --- a/nihav-rad/src/codecs/binkvid.rs +++ b/nihav-rad/src/codecs/binkvid.rs @@ -1220,7 +1220,7 @@ impl NADecoder for BinkDecoder { } else { let bufret = alloc_video_buffer(self.info.get_properties().get_video_info().unwrap(), 4); if let Err(_) = bufret { return Err(DecoderError::InvalidData); } - let mut bufinfo = bufret.unwrap(); + let bufinfo = bufret.unwrap(); buf = bufinfo.get_vbuf().unwrap(); self.key_frame = true; self.hams.add_frame(buf); @@ -1229,7 +1229,7 @@ impl NADecoder for BinkDecoder { } else { let bufret = alloc_video_buffer(self.info.get_properties().get_video_info().unwrap(), 4); if let Err(_) = bufret { return Err(DecoderError::InvalidData); } - let mut bufinfo = bufret.unwrap(); + let bufinfo = bufret.unwrap(); buf = bufinfo.get_vbuf().unwrap(); } @@ -1253,7 +1253,7 @@ println!("decode frame {} b={} i={}", pkt.get_pts().unwrap(), self.is_ver_b, sel self.decode_plane(&mut br, plane_idx, &mut buf)?; } } - let mut bufinfo = NABufferType::Video(buf); + let bufinfo = NABufferType::Video(buf); if !self.is_ver_b { self.ips.add_frame(bufinfo.get_vbuf().unwrap()); } diff --git a/nihav-rad/src/codecs/smacker.rs b/nihav-rad/src/codecs/smacker.rs index e6f4268..85d0e4f 100644 --- a/nihav-rad/src/codecs/smacker.rs +++ b/nihav-rad/src/codecs/smacker.rs @@ -440,7 +440,7 @@ impl NADecoder for SmackerVideoDecoder { let is_intra; let ftype; - let mut bufinfo; + let bufinfo; if src.len() > PAL_SIZE { let mut br = BitReader::new(&src[PAL_SIZE..], src.len() - PAL_SIZE, BitReaderMode::LE); @@ -521,7 +521,7 @@ impl NADecoder for SmackerAudioDecoder { validate!(!(stereo ^ (self.chans == 2))); validate!(!(bits16 ^ (self.bits == 16))); - let mut abuf; + let abuf; let samples; let nch = if stereo { 2 } else { 1 }; if bits16 { diff --git a/nihav-realmedia/src/codecs/ra144.rs b/nihav-realmedia/src/codecs/ra144.rs index 23e32f2..3587382 100644 --- a/nihav-realmedia/src/codecs/ra144.rs +++ b/nihav-realmedia/src/codecs/ra144.rs @@ -264,7 +264,7 @@ impl NADecoder for RA144Decoder { 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_i16().unwrap(); let mut dst = adata.get_data_mut(); diff --git a/nihav-realmedia/src/codecs/ra288.rs b/nihav-realmedia/src/codecs/ra288.rs index 00e0bd6..a5acc29 100644 --- a/nihav-realmedia/src/codecs/ra288.rs +++ b/nihav-realmedia/src/codecs/ra288.rs @@ -172,7 +172,7 @@ impl NADecoder for RA288Decoder { 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(); diff --git a/nihav-realmedia/src/codecs/rv3040.rs b/nihav-realmedia/src/codecs/rv3040.rs index 2d76eaa..d90e59d 100644 --- a/nihav-realmedia/src/codecs/rv3040.rs +++ b/nihav-realmedia/src/codecs/rv3040.rs @@ -774,7 +774,7 @@ pub struct RV34Decoder { impl RV34Decoder { pub fn new(is_rv30: bool, dsp: Box) -> Self { let tmp_vinfo = NAVideoInfo::new(16, 16, false, YUV420_FORMAT); - let mut vt = alloc_video_buffer(tmp_vinfo, 4).unwrap(); + let vt = alloc_video_buffer(tmp_vinfo, 4).unwrap(); let vb = vt.get_vbuf(); let avg_buf = vb.unwrap(); RV34Decoder { @@ -1159,7 +1159,7 @@ impl RV34Decoder { let vinfo = NAVideoInfo::new(hdr0.width, hdr0.height, false, YUV420_FORMAT); let bufret = alloc_video_buffer(vinfo, 4); if let Err(_) = bufret { return Err(DecoderError::InvalidData); } - let mut bufinfo = bufret.unwrap(); + let bufinfo = bufret.unwrap(); let mut buf = bufinfo.get_vbuf().unwrap(); sstate.q = q; diff --git a/nihav-realmedia/src/codecs/rv60.rs b/nihav-realmedia/src/codecs/rv60.rs index a076d87..cf09845 100644 --- a/nihav-realmedia/src/codecs/rv60.rs +++ b/nihav-realmedia/src/codecs/rv60.rs @@ -643,7 +643,7 @@ struct RealVideo60Decoder { impl RealVideo60Decoder { fn new() -> Self { let tmp_vinfo = NAVideoInfo::new(64, 64, false, YUV420_FORMAT); - let mut vt = alloc_video_buffer(tmp_vinfo, 4).unwrap(); + let vt = alloc_video_buffer(tmp_vinfo, 4).unwrap(); let vb = vt.get_vbuf(); let avg_buf = vb.unwrap(); RealVideo60Decoder{ @@ -1445,7 +1445,7 @@ println!("???"); let tmp_vinfo = NAVideoInfo::new(hdr.width, hdr.height, false, YUV420_FORMAT); let res = alloc_video_buffer(tmp_vinfo, 6); if !res.is_ok() { return Err(DecoderError::InvalidData); } - let mut bufinfo = res.unwrap(); + let bufinfo = res.unwrap(); let mut buf = bufinfo.get_vbuf().unwrap(); let cu_w = hdr.get_width_cu(); -- 2.39.5