}
}
-struct DataReader<'a, 'b> {
- br: &'a mut ByteReader<'b>,
+struct DataReader<'a> {
+ br: &'a mut dyn ByteIO,
bpos: u8,
bitbuf: u8,
}
-impl<'a, 'b> DataReader<'a, 'b> {
- fn new(br: &'a mut ByteReader<'b>) -> Self {
+impl<'a> DataReader<'a> {
+ fn new(br: &'a mut dyn ByteIO) -> Self {
Self {
br,
bpos: 0,
fn is_whole_block(&self) -> bool { matches!(*self, Corrector::Fill(_) | Corrector::ZeroBlock | Corrector::SkipBlock) }
}
-struct QuadDecoder<'a, 'b, 'c> {
- br: &'a mut DataReader<'b, 'c>,
+struct QuadDecoder<'a, 'b> {
+ br: &'a mut DataReader<'b>,
cb: [&'static IviDeltaCB; 4],
cb_idx: [usize; 4],
mode: u8,
fill: Option<u8>,
}
-impl<'a, 'b, 'c> QuadDecoder<'a, 'b, 'c> {
- fn new(br: &'a mut DataReader<'b, 'c>, mode: u8, cb_index: [usize; 2]) -> Self {
+impl<'a, 'b> QuadDecoder<'a, 'b> {
+ fn new(br: &'a mut DataReader<'b>, mode: u8, cb_index: [usize; 2]) -> Self {
Self {
br, mode,
lines_run: 0,
plane.reset()
}
}
- fn decode_planes(&mut self, ref_frame: &mut IV3Frame, br: &mut ByteReader, header: &mut Header, requant_tab: &RequantTab) -> DecoderResult<()> {
+ fn decode_planes(&mut self, ref_frame: &mut IV3Frame, br: &mut dyn ByteIO, header: &mut Header, requant_tab: &RequantTab) -> DecoderResult<()> {
let data_start = header.data_start;
let data_end = header.data_end;
for ((cur_plane, ref_plane), (&start, &end)) in self.plane.iter_mut()
#[allow(clippy::manual_range_contains)]
fn decode(&mut self, _supp: &mut NADecoderSupport, pkt: &NAPacket) -> DecoderResult<NAFrameRef> {
let src = pkt.get_buffer();
- let mut mr = MemoryReader::new_read(&src);
- let mut br = ByteReader::new(&mut mr);
+ let mut br = MemoryReader::new_read(&src);
// read OS header
let frameno = br.read_u32le()?;
}
if skip_frame {
let mut dbuf = Vec::with_capacity(16);
- let mut gw = GrowableMemoryWriter::new_write(&mut dbuf);
- let mut bw = ByteWriter::new(&mut gw);
+ let mut bw = GrowableMemoryWriter::new_write(&mut dbuf);
// OS header
bw.write_u32le(self.frameno)?;
if let Some(ref vbuf) = buf.get_vbuf() {
let mut dbuf = Vec::with_capacity(16);
- let mut gw = GrowableMemoryWriter::new_write(&mut dbuf);
- let mut bw = ByteWriter::new(&mut gw);
+ let mut bw = GrowableMemoryWriter::new_write(&mut dbuf);
let (width, height) = vbuf.get_dimensions(0);
if width != self.width || height != self.height {
};
struct DVIDemuxer<'a> {
- src: &'a mut ByteReader<'a>,
+ src: &'a mut dyn ByteIO,
data_end: u64,
packets: VecDeque<NAPacket>,
fsizes: Vec<usize>,
}
impl<'a> DVIDemuxer<'a> {
- fn new(src: &'a mut ByteReader<'a>) -> Self {
+ fn new(src: &'a mut dyn ByteIO) -> Self {
Self {
src,
data_end: 0,
pub struct DVIDemuxerCreator { }
impl DemuxerCreator for DVIDemuxerCreator {
- fn new_demuxer<'a>(&self, br: &'a mut ByteReader<'a>) -> Box<dyn DemuxCore<'a> + 'a> {
+ fn new_demuxer<'a>(&self, br: &'a mut dyn ByteIO) -> Box<dyn DemuxCore<'a> + 'a> {
Box::new(DVIDemuxer::new(br))
}
fn get_name(&self) -> &'static str { "dvi" }
fn test_dvi_demux() {
// sample comes from a demo by Digital Video Arts
let mut file = File::open("assets/Indeo/YULELOG.AVS").unwrap();
- let mut fr = FileReader::new_read(&mut file);
- let mut br = ByteReader::new(&mut fr);
+ let mut br = FileReader::new_read(&mut file);
let mut dmx = DVIDemuxer::new(&mut br);
let mut sm = StreamManager::new();
let mut si = SeekIndex::new();
use nihav_core::demuxers::*;
struct IVFDemuxer<'a> {
- src: &'a mut ByteReader<'a>,
+ src: &'a mut dyn ByteIO,
nframes: u32,
vframe: u32,
aframe: u32,
}
impl<'a> IVFDemuxer<'a> {
- fn new(src: &'a mut ByteReader<'a>) -> Self {
+ fn new(src: &'a mut dyn ByteIO) -> Self {
IVFDemuxer {
src,
nframes: 0,
pub struct IVFDemuxerCreator { }
impl DemuxerCreator for IVFDemuxerCreator {
- fn new_demuxer<'a>(&self, br: &'a mut ByteReader<'a>) -> Box<dyn DemuxCore<'a> + 'a> {
+ fn new_demuxer<'a>(&self, br: &'a mut dyn ByteIO) -> Box<dyn DemuxCore<'a> + 'a> {
Box::new(IVFDemuxer::new(br))
}
fn get_name(&self) -> &'static str { "ivf" }
fn test_ivf_demux() {
// sample is a trailer for Heart of Darkness game
let mut file = File::open("assets/Indeo/TRAILERIIE.IVF").unwrap();
- let mut fr = FileReader::new_read(&mut file);
- let mut br = ByteReader::new(&mut fr);
+ let mut br = FileReader::new_read(&mut file);
let mut dmx = IVFDemuxer::new(&mut br);
let mut sm = StreamManager::new();
let mut si = SeekIndex::new();