]> git.nihav.org Git - nihav.git/blobdiff - src/io/byteio.rs
h263: decoder should use BlockDSP interface
[nihav.git] / src / io / byteio.rs
index 9fee3bda0e6c7f101349d689b833737885c02f08..f4816931be11253e1b750c78d1fa85620bf7fb35 100644 (file)
@@ -13,7 +13,7 @@ pub enum ByteIOError {
     SeekError,
 }
 
-type ByteIOResult<T> = Result<T, ByteIOError>;
+pub type ByteIOResult<T> = Result<T, ByteIOError>;
 
 pub trait ByteIO {
     fn read_buf(&mut self, buf: &mut [u8]) -> ByteIOResult<usize>;
@@ -190,6 +190,16 @@ impl<'a> ByteReader<'a> {
     pub fn is_eof(&mut self) -> bool {
         self.io.is_eof()
     }
+
+    pub fn size(&mut self) -> i64 {
+        self.io.size()
+    }
+
+    pub fn left(&mut self) -> i64 {
+        let size = self.io.size();
+        if size == -1 { return -1; }
+        return size - (self.io.tell() as i64)
+    }
 }
 
 impl<'a> MemoryReader<'a> {