]> git.nihav.org Git - nihav.git/commitdiff
demuxer: drop opened field, let the external Demuxer object take care of that
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sun, 27 Aug 2017 11:25:34 +0000 (13:25 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sun, 27 Aug 2017 11:25:34 +0000 (13:25 +0200)
src/demuxers/avi.rs
src/demuxers/gdv.rs

index bde38da041d9ed39788b2717079108a24845cc25..a0eb7fc50d03f42b2bc1ebfd478a8e066801eed6 100644 (file)
@@ -39,7 +39,6 @@ impl StreamState {
 
 #[allow(dead_code)]
 struct AVIDemuxer<'a> {
-    opened:         bool,
     src:            &'a mut ByteReader<'a>,
     cur_frame:      Vec<u64>,
     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<NAPacket> {
-        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,
index 60acda78fee81e0fcfc9f32f791d342b214e28b8..743c84193d2a6fb74ad0008b23488b4c4209948b 100644 (file)
@@ -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<NAPacket> {
-        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,