From: Kostya Shishkov Date: Thu, 2 May 2019 11:32:10 +0000 (+0200) Subject: introduce NADecoderSupport and buffer pools X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=01613464323864a655c994820d3c43df1954e3b2;p=nihav.git introduce NADecoderSupport and buffer pools --- diff --git a/nihav-commonfmt/src/codecs/aac.rs b/nihav-commonfmt/src/codecs/aac.rs index 7b3c903..ae7a8e5 100644 --- a/nihav-commonfmt/src/codecs/aac.rs +++ b/nihav-commonfmt/src/codecs/aac.rs @@ -1203,7 +1203,7 @@ impl AACDecoder { } impl NADecoder for AACDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(_) = info.get_properties() { let edata = info.get_extradata().unwrap(); validate!(edata.len() >= 2); @@ -1233,7 +1233,7 @@ impl NADecoder for AACDecoder { 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(); diff --git a/nihav-commonfmt/src/codecs/atrac3.rs b/nihav-commonfmt/src/codecs/atrac3.rs index 9cc7dd4..eda269a 100644 --- a/nihav-commonfmt/src/codecs/atrac3.rs +++ b/nihav-commonfmt/src/codecs/atrac3.rs @@ -553,7 +553,7 @@ fn interp(a: f32, b: f32, pos: usize) -> f32 { } impl NADecoder for Atrac3Decoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { self.info = info.clone(); let edata = info.get_extradata().unwrap(); @@ -607,7 +607,7 @@ impl NADecoder for Atrac3Decoder { 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(); diff --git a/nihav-commonfmt/src/codecs/clearvideo.rs b/nihav-commonfmt/src/codecs/clearvideo.rs index ba23148..67a9863 100644 --- a/nihav-commonfmt/src/codecs/clearvideo.rs +++ b/nihav-commonfmt/src/codecs/clearvideo.rs @@ -681,7 +681,7 @@ impl ClearVideoDecoder { } impl NADecoder for ClearVideoDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if info.get_extradata().is_none() { return Err(DecoderError::InvalidData); } if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { let w = vinfo.get_width(); @@ -711,7 +711,7 @@ impl NADecoder for ClearVideoDecoder { 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(); if src.len() <= 1 { return Err(DecoderError::ShortData); } let off = if self.is_rm { diff --git a/nihav-commonfmt/src/codecs/pcm.rs b/nihav-commonfmt/src/codecs/pcm.rs index 00f5c31..7ec3c1f 100644 --- a/nihav-commonfmt/src/codecs/pcm.rs +++ b/nihav-commonfmt/src/codecs/pcm.rs @@ -33,7 +33,7 @@ fn get_duration(ainfo: &NAAudioInfo, duration: Option, data_size: usize) -> } impl NADecoder for PCMDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { self.chmap = get_default_chmap(ainfo.get_channels()); if self.chmap.num_channels() == 0 { return Err(DecoderError::InvalidData); } @@ -42,7 +42,7 @@ impl NADecoder for PCMDecoder { 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(ainfo) = info.get_properties() { let duration = get_duration(&ainfo, pkt.get_duration(), pkt.get_buffer().len()); diff --git a/nihav-commonfmt/src/codecs/sipro.rs b/nihav-commonfmt/src/codecs/sipro.rs index 88b525e..c36c7ed 100644 --- a/nihav-commonfmt/src/codecs/sipro.rs +++ b/nihav-commonfmt/src/codecs/sipro.rs @@ -638,7 +638,7 @@ fn synth_filter(dst: &mut [f32], doff: usize, filt: &[f32], src: &[f32], len: us const CHMAP_MONO: [NAChannelType; 1] = [NAChannelType::C]; impl NADecoder for SiproDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { let mut found = false; for i in 0..SIPRO_MODES.len() { @@ -668,7 +668,7 @@ impl NADecoder for SiproDecoder { 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(); diff --git a/nihav-commonfmt/src/codecs/ts102366.rs b/nihav-commonfmt/src/codecs/ts102366.rs index a4d4570..5f6f278 100644 --- a/nihav-commonfmt/src/codecs/ts102366.rs +++ b/nihav-commonfmt/src/codecs/ts102366.rs @@ -1157,7 +1157,7 @@ impl AudioBlock { } impl NADecoder for AudioDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(_) = info.get_properties() { self.info = info.clone(); Ok(()) @@ -1165,7 +1165,7 @@ impl NADecoder for AudioDecoder { 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(); diff --git a/nihav-core/src/codecs/mod.rs b/nihav-core/src/codecs/mod.rs index 4f81d9e..8225dd0 100644 --- a/nihav-core/src/codecs/mod.rs +++ b/nihav-core/src/codecs/mod.rs @@ -229,10 +229,26 @@ impl fmt::Display for MV { } } +pub struct NADecoderSupport { + pub pool_u8: NAVideoBufferPool, + pub pool_u16: NAVideoBufferPool, + pub pool_u32: NAVideoBufferPool, +} + +impl NADecoderSupport { + pub fn new() -> Self { + Self { + pool_u8: NAVideoBufferPool::new(0), + pool_u16: NAVideoBufferPool::new(0), + pool_u32: NAVideoBufferPool::new(0), + } + } +} + pub trait NADecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()>; - fn decode(&mut self, pkt: &NAPacket) -> DecoderResult; + fn init(&mut self, supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()>; + fn decode(&mut self, supp: &mut NADecoderSupport, pkt: &NAPacket) -> DecoderResult; } #[derive(Clone,Copy)] diff --git a/nihav-core/src/frame.rs b/nihav-core/src/frame.rs index 789088a..af7b498 100644 --- a/nihav-core/src/frame.rs +++ b/nihav-core/src/frame.rs @@ -484,49 +484,89 @@ pub fn copy_buffer(buf: NABufferType) -> NABufferType { buf.clone() } -pub struct NABufferPool { - pool: Vec>, +pub struct NAVideoBufferPool { + pool: Vec>, max_len: usize, + add_len: usize, } -impl NABufferPool { +impl NAVideoBufferPool { pub fn new(max_len: usize) -> Self { Self { pool: Vec::with_capacity(max_len), max_len, + add_len: 0, } } + pub fn set_dec_bufs(&mut self, add_len: usize) { + self.add_len = add_len; + } + pub fn get_free(&mut self) -> Option> { + for e in self.pool.iter() { + if e.get_num_refs() == 1 { + return Some(e.clone()); + } + } + None + } + pub fn get_copy(&mut self, rbuf: &NAVideoBufferRef) -> Option> { + let res = self.get_free(); + if res.is_none() { + return None; + } + let mut dbuf = res.unwrap(); + dbuf.data.copy_from_slice(&rbuf.data); + Some(dbuf) + } + pub fn reset(&mut self) { + self.pool.truncate(0); + } +} + +impl NAVideoBufferPool { pub fn prealloc_video(&mut self, vinfo: NAVideoInfo, align: u8) -> Result<(), AllocatorError> { - let nbufs = self.max_len - self.pool.len(); + let nbufs = self.max_len + self.add_len - self.pool.len(); for _ in 0..nbufs { - let buf = alloc_video_buffer(vinfo.clone(), align)?; - self.pool.push(NABufferRef::new(buf)); + let vbuf = alloc_video_buffer(vinfo.clone(), align)?; + if let NABufferType::Video(buf) = vbuf { + self.pool.push(buf); + } else if let NABufferType::VideoPacked(buf) = vbuf { + self.pool.push(buf); + } else { + return Err(AllocatorError::FormatError); + } } Ok(()) } - pub fn prealloc_audio(&mut self, ainfo: NAAudioInfo, nsamples: usize, chmap: NAChannelMap) -> Result<(), AllocatorError> { - let nbufs = self.max_len - self.pool.len(); +} + +impl NAVideoBufferPool { + pub fn prealloc_video(&mut self, vinfo: NAVideoInfo, align: u8) -> Result<(), AllocatorError> { + let nbufs = self.max_len + self.add_len - self.pool.len(); for _ in 0..nbufs { - let buf = alloc_audio_buffer(ainfo.clone(), nsamples, chmap.clone())?; - self.pool.push(NABufferRef::new(buf)); + let vbuf = alloc_video_buffer(vinfo.clone(), align)?; + if let NABufferType::Video16(buf) = vbuf { + self.pool.push(buf); + } else { + return Err(AllocatorError::FormatError); + } } Ok(()) } - pub fn add(&mut self, buf: NABufferType) -> bool { - if self.pool.len() < self.max_len { - self.pool.push(NABufferRef::new(buf)); - true - } else { - false - } - } - pub fn get_free(&mut self) -> Option> { - for e in self.pool.iter() { - if e.get_num_refs() == 1 { - return Some(e.clone()); +} + +impl NAVideoBufferPool { + pub fn prealloc_video(&mut self, vinfo: NAVideoInfo, align: u8) -> Result<(), AllocatorError> { + let nbufs = self.max_len + self.add_len - self.pool.len(); + for _ in 0..nbufs { + let vbuf = alloc_video_buffer(vinfo.clone(), align)?; + if let NABufferType::Video32(buf) = vbuf { + self.pool.push(buf); + } else { + return Err(AllocatorError::FormatError); } } - None + Ok(()) } } diff --git a/nihav-core/src/test/dec_video.rs b/nihav-core/src/test/dec_video.rs index 36c032a..d000e52 100644 --- a/nihav-core/src/test/dec_video.rs +++ b/nihav-core/src/test/dec_video.rs @@ -161,7 +161,7 @@ pub fn test_file_decoding(demuxer: &str, name: &str, limit: Option, let mut br = ByteReader::new(&mut fr); let mut dmx = create_demuxer(dmx_f, &mut br).unwrap(); - let mut decs: Vec>> = Vec::new(); + let mut decs: Vec, Box)>> = Vec::new(); for i in 0..dmx.get_num_streams() { let s = dmx.get_stream(i).unwrap(); let info = s.get_info(); @@ -169,8 +169,9 @@ pub fn test_file_decoding(demuxer: &str, name: &str, limit: Option, if let Some(df) = decfunc { if (decode_video && info.is_video()) || (decode_audio && info.is_audio()) { let mut dec = (df)(); - dec.init(info).unwrap(); - decs.push(Some(dec)); + let mut dsupp = Box::new(NADecoderSupport::new()); + dec.init(&mut dsupp, info).unwrap(); + decs.push(Some((dsupp, dec))); } else { decs.push(None); } @@ -190,8 +191,8 @@ pub fn test_file_decoding(demuxer: &str, name: &str, limit: Option, if pkt.get_pts().unwrap() > limit.unwrap() { break; } } let streamno = pkt.get_stream().get_id() as usize; - if let Some(ref mut dec) = decs[streamno] { - let frm = dec.decode(&pkt).unwrap(); + if let Some((ref mut dsupp, ref mut dec)) = decs[streamno] { + let frm = dec.decode(dsupp, &pkt).unwrap(); if pkt.get_stream().get_info().is_video() && video_pfx.is_some() && frm.get_frame_type() != FrameType::Skip { let pfx = video_pfx.unwrap(); let pts = if let Some(fpts) = frm.get_pts() { fpts } else { pkt.get_pts().unwrap() }; @@ -218,7 +219,7 @@ pub fn test_decode_audio(demuxer: &str, name: &str, limit: Option, audio_pf let mut br = ByteReader::new(&mut fr); let mut dmx = create_demuxer(dmx_f, &mut br).unwrap(); - let mut decs: Vec>> = Vec::new(); + let mut decs: Vec, Box)>> = Vec::new(); for i in 0..dmx.get_num_streams() { let s = dmx.get_stream(i).unwrap(); let info = s.get_info(); @@ -226,8 +227,9 @@ pub fn test_decode_audio(demuxer: &str, name: &str, limit: Option, audio_pf if let Some(df) = decfunc { if info.is_audio() { let mut dec = (df)(); - dec.init(info).unwrap(); - decs.push(Some(dec)); + let mut dsupp = Box::new(NADecoderSupport::new()); + dec.init(&mut dsupp, info).unwrap(); + decs.push(Some((dsupp, dec))); } else { decs.push(None); } @@ -254,8 +256,8 @@ pub fn test_decode_audio(demuxer: &str, name: &str, limit: Option, audio_pf if pkt.get_pts().unwrap() > limit.unwrap() { break; } } let streamno = pkt.get_stream().get_id() as usize; - if let Some(ref mut dec) = decs[streamno] { - let frm = dec.decode(&pkt).unwrap(); + if let Some((ref mut dsupp, ref mut dec)) = decs[streamno] { + let frm = dec.decode(dsupp, &pkt).unwrap(); if frm.get_info().is_audio() { if !wrote_header { wwr.write_header(frm.get_info().as_ref().get_properties().get_audio_info().unwrap()).unwrap(); diff --git a/nihav-duck/src/codecs/dkadpcm.rs b/nihav-duck/src/codecs/dkadpcm.rs index 9ff5ed9..d3bdba5 100644 --- a/nihav-duck/src/codecs/dkadpcm.rs +++ b/nihav-duck/src/codecs/dkadpcm.rs @@ -51,7 +51,7 @@ impl DuckADPCMDecoder { } impl NADecoder for DuckADPCMDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { validate!(ainfo.get_block_len() > 16); self.block_len = ainfo.get_block_len(); @@ -69,7 +69,7 @@ impl NADecoder for DuckADPCMDecoder { 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(); diff --git a/nihav-duck/src/codecs/truemotion1.rs b/nihav-duck/src/codecs/truemotion1.rs index c205b3c..f6fe5ca 100644 --- a/nihav-duck/src/codecs/truemotion1.rs +++ b/nihav-duck/src/codecs/truemotion1.rs @@ -515,7 +515,7 @@ impl TM1Decoder { } impl NADecoder for TM1Decoder { - 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 myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, YUV410_FORMAT)); self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref(); @@ -524,7 +524,7 @@ impl NADecoder for TM1Decoder { 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); let hdr_size = (src[0].rotate_left(3) & 0x7F) as usize; diff --git a/nihav-duck/src/codecs/truemotion2.rs b/nihav-duck/src/codecs/truemotion2.rs index 1c91640..84162b5 100644 --- a/nihav-duck/src/codecs/truemotion2.rs +++ b/nihav-duck/src/codecs/truemotion2.rs @@ -546,7 +546,7 @@ impl TM2Decoder { } impl NADecoder for TM2Decoder { - 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 myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, YUV410_FORMAT)); self.width = vinfo.get_width(); @@ -559,7 +559,7 @@ impl NADecoder for TM2Decoder { 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() >= 40 + (TM2StreamType::Num as usize) * 4 + 4); let mut mr = MemoryReader::new_read(&src); diff --git a/nihav-duck/src/codecs/truemotion2x.rs b/nihav-duck/src/codecs/truemotion2x.rs index 560ab6a..ae2efec 100644 --- a/nihav-duck/src/codecs/truemotion2x.rs +++ b/nihav-duck/src/codecs/truemotion2x.rs @@ -556,7 +556,7 @@ impl TM2XDecoder { } impl NADecoder for TM2XDecoder { - 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 = NAPixelFormaton::new(ColorModel::YUV(YUVSubmodel::YUVJ), Some(NAPixelChromaton::new(0, 0, false, 8, 0, 0, 1)), @@ -574,7 +574,7 @@ impl NADecoder for TM2XDecoder { 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() > 8); let mut mr = MemoryReader::new_read(&src); diff --git a/nihav-duck/src/codecs/truemotionrt.rs b/nihav-duck/src/codecs/truemotionrt.rs index a96d609..3b4e9e8 100644 --- a/nihav-duck/src/codecs/truemotionrt.rs +++ b/nihav-duck/src/codecs/truemotionrt.rs @@ -35,7 +35,7 @@ impl TMRTDecoder { } impl NADecoder for TMRTDecoder { - 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 myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, YUV410_FORMAT)); self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref(); @@ -44,7 +44,7 @@ impl NADecoder for TMRTDecoder { 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); let hdr_size = (src[0].rotate_left(3) & 0x7F) as usize; diff --git a/nihav-game/src/codecs/bmv.rs b/nihav-game/src/codecs/bmv.rs index 6712ce2..970f490 100644 --- a/nihav-game/src/codecs/bmv.rs +++ b/nihav-game/src/codecs/bmv.rs @@ -169,7 +169,7 @@ impl BMVVideoDecoder { } impl NADecoder for BMVVideoDecoder { - 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 = NAPixelFormaton::new(ColorModel::RGB(RGBSubmodel::RGB), Some(NAPixelChromaton::new(0, 0, true, 8, 0, 0, 3)), @@ -185,7 +185,7 @@ impl NADecoder for BMVVideoDecoder { 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() > 1); @@ -257,7 +257,7 @@ fn scale_sample(samp: u8, scale: i32) -> i16 { } impl NADecoder for BMVAudioDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { self.ainfo = NAAudioInfo::new(ainfo.get_sample_rate(), ainfo.get_channels(), formats::SND_S16P_FORMAT, 32); self.chmap = NAChannelMap::from_str("L,R").unwrap(); @@ -266,7 +266,7 @@ impl NADecoder for BMVAudioDecoder { 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(); diff --git a/nihav-game/src/codecs/bmv3.rs b/nihav-game/src/codecs/bmv3.rs index 2cd0b2b..f6067cf 100644 --- a/nihav-game/src/codecs/bmv3.rs +++ b/nihav-game/src/codecs/bmv3.rs @@ -441,7 +441,7 @@ impl BMV3VideoDecoder { } impl NADecoder for BMV3VideoDecoder { - 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 myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, RGB565_FORMAT)); self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref(); @@ -457,7 +457,7 @@ impl NADecoder for BMV3VideoDecoder { 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() > 1); @@ -552,7 +552,7 @@ fn decode_block(mode: u8, src: &[u8], dst: &mut [i16], mut pred: i16) -> i16 { } impl NADecoder for BMV3AudioDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { self.ainfo = NAAudioInfo::new(ainfo.get_sample_rate(), ainfo.get_channels(), formats::SND_S16P_FORMAT, 32); self.chmap = NAChannelMap::from_str("L,R").unwrap(); @@ -561,7 +561,7 @@ impl NADecoder for BMV3AudioDecoder { 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(); diff --git a/nihav-game/src/codecs/gremlinvideo.rs b/nihav-game/src/codecs/gremlinvideo.rs index 8c6e58f..2d698cb 100644 --- a/nihav-game/src/codecs/gremlinvideo.rs +++ b/nihav-game/src/codecs/gremlinvideo.rs @@ -371,7 +371,7 @@ impl GremlinVideoDecoder { } impl NADecoder for GremlinVideoDecoder { - 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 w = vinfo.get_width(); let h = vinfo.get_height(); @@ -401,7 +401,7 @@ impl NADecoder for GremlinVideoDecoder { 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(); let mut mr = MemoryReader::new_read(&src); let mut br = ByteReader::new(&mut mr); @@ -510,7 +510,7 @@ fn get_default_chmap(nch: u8) -> NAChannelMap { } impl NADecoder for GremlinAudioDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { self.ainfo = NAAudioInfo::new(ainfo.get_sample_rate(), ainfo.get_channels(), formats::SND_S16P_FORMAT, ainfo.get_block_len()); self.chmap = get_default_chmap(ainfo.get_channels()); @@ -520,7 +520,7 @@ impl NADecoder for GremlinAudioDecoder { 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(); diff --git a/nihav-game/src/codecs/vmd.rs b/nihav-game/src/codecs/vmd.rs index a1e71ed..a11e26c 100644 --- a/nihav-game/src/codecs/vmd.rs +++ b/nihav-game/src/codecs/vmd.rs @@ -215,7 +215,7 @@ impl VMDVideoDecoder { } impl NADecoder for VMDVideoDecoder { - 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() { self.width = vinfo.get_width(); self.height = vinfo.get_height(); @@ -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); @@ -351,7 +351,7 @@ impl VMDAudioDecoder { } impl NADecoder for VMDAudioDecoder { - fn init(&mut self, info: NACodecInfoRef) -> 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(); diff --git a/nihav-indeo/src/codecs/imc.rs b/nihav-indeo/src/codecs/imc.rs index 5f1390a..c032b14 100644 --- a/nihav-indeo/src/codecs/imc.rs +++ b/nihav-indeo/src/codecs/imc.rs @@ -865,7 +865,7 @@ const CHMAP_MONO: [NAChannelType; 1] = [NAChannelType::C]; const CHMAP_STEREO: [NAChannelType; 2] = [NAChannelType::L, NAChannelType::R]; impl NADecoder for IMCDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { self.chmap = NAChannelMap::new(); match ainfo.get_channels() { @@ -886,7 +886,7 @@ impl NADecoder for IMCDecoder { 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(); diff --git a/nihav-indeo/src/codecs/indeo2.rs b/nihav-indeo/src/codecs/indeo2.rs index d110dc8..c703718 100644 --- a/nihav-indeo/src/codecs/indeo2.rs +++ b/nihav-indeo/src/codecs/indeo2.rs @@ -307,7 +307,7 @@ impl Indeo2Decoder { const IR2_START: usize = 48; impl NADecoder for Indeo2Decoder { - 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 w = vinfo.get_width(); let h = vinfo.get_height(); @@ -321,7 +321,7 @@ impl NADecoder for Indeo2Decoder { 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(); if src.len() <= IR2_START { return Err(DecoderError::ShortData); } let interframe = src[18]; diff --git a/nihav-indeo/src/codecs/indeo3.rs b/nihav-indeo/src/codecs/indeo3.rs index eaef84b..0a59030 100644 --- a/nihav-indeo/src/codecs/indeo3.rs +++ b/nihav-indeo/src/codecs/indeo3.rs @@ -688,7 +688,7 @@ const FLAG_KEYFRAME: u16 = 1 << 2; const FLAG_NONREF: u16 = 1 << 8; impl NADecoder for Indeo3Decoder { - 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 w = vinfo.get_width(); let h = vinfo.get_height(); @@ -701,7 +701,7 @@ impl NADecoder for Indeo3Decoder { 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(); let mut mr = MemoryReader::new_read(&src); let mut br = ByteReader::new(&mut mr); diff --git a/nihav-indeo/src/codecs/indeo4.rs b/nihav-indeo/src/codecs/indeo4.rs index 9ee3a41..3c8179b 100644 --- a/nihav-indeo/src/codecs/indeo4.rs +++ b/nihav-indeo/src/codecs/indeo4.rs @@ -431,7 +431,7 @@ impl Indeo4Decoder { } impl NADecoder for Indeo4Decoder { - 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 w = vinfo.get_width(); let h = vinfo.get_height(); @@ -444,7 +444,7 @@ impl NADecoder for Indeo4Decoder { 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(); let mut br = BitReader::new(src.as_slice(), src.len(), BitReaderMode::LE); diff --git a/nihav-indeo/src/codecs/indeo5.rs b/nihav-indeo/src/codecs/indeo5.rs index faa3107..17ac713 100644 --- a/nihav-indeo/src/codecs/indeo5.rs +++ b/nihav-indeo/src/codecs/indeo5.rs @@ -507,7 +507,7 @@ impl Indeo5Decoder { } impl NADecoder for Indeo5Decoder { - 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 w = vinfo.get_width(); let h = vinfo.get_height(); @@ -520,7 +520,7 @@ impl NADecoder for Indeo5Decoder { 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(); let mut br = BitReader::new(src.as_slice(), src.len(), BitReaderMode::LE); diff --git a/nihav-indeo/src/codecs/intel263.rs b/nihav-indeo/src/codecs/intel263.rs index 7afee94..ed5b3b7 100644 --- a/nihav-indeo/src/codecs/intel263.rs +++ b/nihav-indeo/src/codecs/intel263.rs @@ -364,7 +364,7 @@ impl Intel263Decoder { } impl NADecoder for Intel263Decoder { - 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 w = vinfo.get_width(); let h = vinfo.get_height(); @@ -376,7 +376,7 @@ impl NADecoder for Intel263Decoder { 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(); if src.len() == 8 { diff --git a/nihav-rad/src/codecs/bink2.rs b/nihav-rad/src/codecs/bink2.rs index d57f8bd..4c71e00 100644 --- a/nihav-rad/src/codecs/bink2.rs +++ b/nihav-rad/src/codecs/bink2.rs @@ -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: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { let w = vinfo.get_width(); let h = vinfo.get_height(); @@ -1914,7 +1914,7 @@ impl NADecoder for Bink2Decoder { 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(); let mut br = BitReader::new(&src, src.len(), BitReaderMode::LE); diff --git a/nihav-rad/src/codecs/binkaud.rs b/nihav-rad/src/codecs/binkaud.rs index 3d7568c..c09bcfb 100644 --- a/nihav-rad/src/codecs/binkaud.rs +++ b/nihav-rad/src/codecs/binkaud.rs @@ -178,7 +178,7 @@ const CRITICAL_FREQS: [usize; MAX_BANDS] = [ const RUN_TAB: [usize; 16] = [ 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64 ]; impl NADecoder for BinkAudioDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { let srate = ainfo.get_sample_rate(); let channels = ainfo.get_channels(); @@ -229,7 +229,7 @@ impl NADecoder for BinkAudioDecoder { 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(); diff --git a/nihav-rad/src/codecs/binkvid.rs b/nihav-rad/src/codecs/binkvid.rs index 3a0b496..e091b72 100644 --- a/nihav-rad/src/codecs/binkvid.rs +++ b/nihav-rad/src/codecs/binkvid.rs @@ -1157,7 +1157,7 @@ const BINK_FLAG_ALPHA: u32 = 0x00100000; const BINK_FLAG_GRAY: u32 = 0x00020000; impl NADecoder for BinkDecoder { - 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 w = vinfo.get_width(); let h = vinfo.get_height(); @@ -1206,7 +1206,7 @@ impl NADecoder for BinkDecoder { 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(); let mut br = BitReader::new(&src, src.len(), BitReaderMode::LE); diff --git a/nihav-rad/src/codecs/smacker.rs b/nihav-rad/src/codecs/smacker.rs index 9ed2a9f..f3628be 100644 --- a/nihav-rad/src/codecs/smacker.rs +++ b/nihav-rad/src/codecs/smacker.rs @@ -387,7 +387,7 @@ impl SmackerVideoDecoder { } impl NADecoder for SmackerVideoDecoder { - 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 w = vinfo.get_width(); let h = vinfo.get_height(); @@ -434,7 +434,7 @@ impl NADecoder for SmackerVideoDecoder { 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() >= PAL_SIZE); @@ -492,7 +492,7 @@ impl SmackerAudioDecoder { } impl NADecoder for SmackerAudioDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { self.bits = ainfo.get_format().get_bits(); let fmt = if self.bits == 8 { SND_U8_FORMAT } else { SND_S16P_FORMAT }; @@ -504,7 +504,7 @@ impl NADecoder for SmackerAudioDecoder { 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 src = pkt.get_buffer(); diff --git a/nihav-realmedia/src/codecs/cook.rs b/nihav-realmedia/src/codecs/cook.rs index b954bd7..ba3b276 100644 --- a/nihav-realmedia/src/codecs/cook.rs +++ b/nihav-realmedia/src/codecs/cook.rs @@ -551,7 +551,7 @@ impl CookDecoder { } impl NADecoder for CookDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { let edata = info.get_extradata().unwrap(); validate!(edata.len() >= 4); @@ -632,7 +632,7 @@ impl NADecoder for CookDecoder { 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(); diff --git a/nihav-realmedia/src/codecs/ra144.rs b/nihav-realmedia/src/codecs/ra144.rs index 07d234a..06da525 100644 --- a/nihav-realmedia/src/codecs/ra144.rs +++ b/nihav-realmedia/src/codecs/ra144.rs @@ -242,7 +242,7 @@ fn clip_out(sample: i16) -> i16 { } impl NADecoder for RA144Decoder { - fn init(&mut self, info: NACodecInfoRef) -> 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(), @@ -254,7 +254,7 @@ impl NADecoder for RA144Decoder { 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(); diff --git a/nihav-realmedia/src/codecs/ra288.rs b/nihav-realmedia/src/codecs/ra288.rs index dbb7f90..c3e23d9 100644 --- a/nihav-realmedia/src/codecs/ra288.rs +++ b/nihav-realmedia/src/codecs/ra288.rs @@ -151,7 +151,7 @@ impl RA288Decoder { } impl NADecoder for RA288Decoder { - fn init(&mut self, info: NACodecInfoRef) -> 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(), @@ -163,7 +163,7 @@ 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(); diff --git a/nihav-realmedia/src/codecs/ralf.rs b/nihav-realmedia/src/codecs/ralf.rs index b8a06d1..dfd728d 100644 --- a/nihav-realmedia/src/codecs/ralf.rs +++ b/nihav-realmedia/src/codecs/ralf.rs @@ -355,7 +355,7 @@ fn read_block_length(br: &mut BitReader) -> DecoderResult { } impl NADecoder for RALFDecoder { - fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> { + fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() { let edata = info.get_extradata().unwrap(); @@ -389,7 +389,7 @@ impl NADecoder for RALFDecoder { 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(); diff --git a/nihav-realmedia/src/codecs/rv10.rs b/nihav-realmedia/src/codecs/rv10.rs index 733b677..66e8ff1 100644 --- a/nihav-realmedia/src/codecs/rv10.rs +++ b/nihav-realmedia/src/codecs/rv10.rs @@ -403,7 +403,7 @@ impl RealVideo10Decoder { } impl NADecoder for RealVideo10Decoder { - 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 w = vinfo.get_width(); let h = vinfo.get_height(); @@ -436,7 +436,7 @@ println!("???"); 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(); //println!(" decode frame size {}, {} slices", src.len(), src[0]+1); diff --git a/nihav-realmedia/src/codecs/rv20.rs b/nihav-realmedia/src/codecs/rv20.rs index 44386f6..527c23e 100644 --- a/nihav-realmedia/src/codecs/rv20.rs +++ b/nihav-realmedia/src/codecs/rv20.rs @@ -457,7 +457,7 @@ impl RealVideo20Decoder { impl NADecoder for RealVideo20Decoder { #[allow(unused_variables)] - 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 w = vinfo.get_width(); let h = vinfo.get_height(); @@ -491,7 +491,7 @@ impl NADecoder for RealVideo20Decoder { 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(); let mut ibr = RealVideo20BR::new(&src, &self.tables, self.w, self.h, self.minor_ver, self.rpr); diff --git a/nihav-realmedia/src/codecs/rv30.rs b/nihav-realmedia/src/codecs/rv30.rs index 7ec3cb2..95e6190 100644 --- a/nihav-realmedia/src/codecs/rv30.rs +++ b/nihav-realmedia/src/codecs/rv30.rs @@ -117,7 +117,7 @@ impl RealVideo30Decoder { } impl NADecoder for RealVideo30Decoder { - 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 = formats::YUV420_FORMAT; let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(0, 0, false, fmt)); @@ -144,7 +144,7 @@ println!("???"); 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(); let (bufinfo, ftype, pts) = self.dec.parse_frame(src.as_slice(), &mut self.bd)?; diff --git a/nihav-realmedia/src/codecs/rv40.rs b/nihav-realmedia/src/codecs/rv40.rs index 482d856..62fafba 100644 --- a/nihav-realmedia/src/codecs/rv40.rs +++ b/nihav-realmedia/src/codecs/rv40.rs @@ -314,7 +314,7 @@ impl RealVideo40Decoder { } impl NADecoder for RealVideo40Decoder { - 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 = formats::YUV420_FORMAT; let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(0, 0, false, fmt)); @@ -337,7 +337,7 @@ println!("???"); 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(); let (bufinfo, ftype, ts) = self.dec.parse_frame(src.as_slice(), &mut self.bd)?; diff --git a/nihav-realmedia/src/codecs/rv60.rs b/nihav-realmedia/src/codecs/rv60.rs index f064861..2ec99ed 100644 --- a/nihav-realmedia/src/codecs/rv60.rs +++ b/nihav-realmedia/src/codecs/rv60.rs @@ -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::*; @@ -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 { + fn decode(&mut self, _supp: &mut NADecoderSupport, pkt: &NAPacket) -> DecoderResult { let src = pkt.get_buffer(); validate!(src.len() > 9);