From: Kostya Shishkov Date: Sun, 27 Aug 2017 11:25:34 +0000 (+0200) Subject: demuxer: drop opened field, let the external Demuxer object take care of that X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=f365013822ceffbdab8c3d155494a69e1596ebbb;p=nihav.git demuxer: drop opened field, let the external Demuxer object take care of that --- diff --git a/src/demuxers/avi.rs b/src/demuxers/avi.rs index bde38da..a0eb7fc 100644 --- a/src/demuxers/avi.rs +++ b/src/demuxers/avi.rs @@ -39,7 +39,6 @@ impl StreamState { #[allow(dead_code)] struct AVIDemuxer<'a> { - opened: bool, src: &'a mut ByteReader<'a>, cur_frame: Vec, num_streams: u8, @@ -65,12 +64,10 @@ impl<'a> DemuxCore<'a> for AVIDemuxer<'a> { #[allow(unused_variables)] fn open(&mut self, strmgr: &mut StreamManager) -> DemuxerResult<()> { self.read_header(strmgr)?; - self.opened = true; Ok(()) } fn get_frame(&mut self, strmgr: &mut StreamManager) -> DemuxerResult { - if !self.opened { return Err(NoSuchInput); } if self.movi_size == 0 { return Err(EOF); } let mut tag: [u8; 4] = [0; 4]; loop { @@ -117,7 +114,6 @@ impl<'a> DemuxCore<'a> for AVIDemuxer<'a> { #[allow(unused_variables)] fn seek(&mut self, time: u64) -> DemuxerResult<()> { - if !self.opened { return Err(NoSuchInput); } Err(NotImplemented) } } @@ -127,7 +123,6 @@ impl<'a> AVIDemuxer<'a> { AVIDemuxer { cur_frame: Vec::new(), num_streams: 0, - opened: false, src: io, size: 0, movi_size: 0, diff --git a/src/demuxers/gdv.rs b/src/demuxers/gdv.rs index 60acda7..743c841 100644 --- a/src/demuxers/gdv.rs +++ b/src/demuxers/gdv.rs @@ -11,7 +11,6 @@ enum GDVState { #[allow(dead_code)] struct GremlinVideoDemuxer<'a> { - opened: bool, src: &'a mut ByteReader<'a>, frames: u16, cur_frame: u16, @@ -100,14 +99,12 @@ impl<'a> DemuxCore<'a> for GremlinVideoDemuxer<'a> { self.apacked = (aflags & 8) != 0; } self.frames = frames; - self.opened = true; self.state = GDVState::NewFrame; Ok(()) } #[allow(unused_variables)] fn get_frame(&mut self, strmgr: &mut StreamManager) -> DemuxerResult { - if !self.opened { return Err(DemuxerError::NoSuchInput); } if self.cur_frame >= self.frames { return Err(DemuxerError::EOF); } match self.state { GDVState::NewFrame if self.asize > 0 => { self.read_achunk(strmgr) } @@ -117,7 +114,6 @@ impl<'a> DemuxCore<'a> for GremlinVideoDemuxer<'a> { #[allow(unused_variables)] fn seek(&mut self, time: u64) -> DemuxerResult<()> { - if !self.opened { return Err(DemuxerError::NoSuchInput); } Err(DemuxerError::NotImplemented) } } @@ -131,7 +127,6 @@ impl<'a> GremlinVideoDemuxer<'a> { GremlinVideoDemuxer { cur_frame: 0, frames: 0, - opened: false, asize: 0, apacked: false, state: GDVState::NewFrame,