11use crate :: config:: ParsingMode ;
22use crate :: error:: Result ;
3- use crate :: macros:: err;
4- use crate :: util:: io:: SeekStreamLen ;
3+ use super :: atom_info:: AtomInfo ;
4+ use crate :: err;
5+ use crate :: io:: SeekStreamLen ;
56
67use std:: io:: { Read , Seek , SeekFrom } ;
78
8- use aud_io:: mp4:: AtomInfo ;
99use byteorder:: { BigEndian , ReadBytesExt } ;
1010
1111/// A reader for an MP4 file
@@ -15,7 +15,7 @@ use byteorder::{BigEndian, ReadBytesExt};
1515/// * [`Self::next`] to read atoms.
1616/// * `read_u*` methods to read integers without needing to specify the endianness.
1717/// * Bounds checking on reads and seeks to prevent going outside the file.
18- pub ( crate ) struct AtomReader < R >
18+ pub struct AtomReader < R >
1919where
2020 R : Read + Seek ,
2121{
3131 R : Read + Seek ,
3232{
3333 /// Create a new `AtomReader`
34- pub ( crate ) fn new ( mut reader : R , parse_mode : ParsingMode ) -> Result < Self > {
34+ pub fn new ( mut reader : R , parse_mode : ParsingMode ) -> Result < Self > {
3535 let len = reader. stream_len_hack ( ) ?;
3636 Ok ( Self {
3737 reader,
@@ -47,46 +47,46 @@ where
4747 /// This is useful when reading an atom such as `moov`, where we only want to read it and its
4848 /// children. We can read the atom, set the bounds to the atom's length, and then read the children
4949 /// without worrying about reading past the atom's end.
50- pub ( crate ) fn reset_bounds ( & mut self , start_position : u64 , len : u64 ) {
50+ pub fn reset_bounds ( & mut self , start_position : u64 , len : u64 ) {
5151 self . start = start_position;
5252 self . remaining_size = len;
5353 self . len = len;
5454 }
5555
56- pub ( crate ) fn read_u8 ( & mut self ) -> std:: io:: Result < u8 > {
56+ pub fn read_u8 ( & mut self ) -> std:: io:: Result < u8 > {
5757 self . remaining_size = self . remaining_size . saturating_sub ( 1 ) ;
5858 self . reader . read_u8 ( )
5959 }
6060
61- pub ( crate ) fn read_u16 ( & mut self ) -> std:: io:: Result < u16 > {
61+ pub fn read_u16 ( & mut self ) -> std:: io:: Result < u16 > {
6262 self . remaining_size = self . remaining_size . saturating_sub ( 2 ) ;
6363 self . reader . read_u16 :: < BigEndian > ( )
6464 }
6565
66- pub ( crate ) fn read_u24 ( & mut self ) -> std:: io:: Result < u32 > {
66+ pub fn read_u24 ( & mut self ) -> std:: io:: Result < u32 > {
6767 self . remaining_size = self . remaining_size . saturating_sub ( 3 ) ;
6868 self . reader . read_u24 :: < BigEndian > ( )
6969 }
7070
71- pub ( crate ) fn read_u32 ( & mut self ) -> std:: io:: Result < u32 > {
71+ pub fn read_u32 ( & mut self ) -> std:: io:: Result < u32 > {
7272 self . remaining_size = self . remaining_size . saturating_sub ( 4 ) ;
7373 self . reader . read_u32 :: < BigEndian > ( )
7474 }
7575
76- pub ( crate ) fn read_u64 ( & mut self ) -> std:: io:: Result < u64 > {
76+ pub fn read_u64 ( & mut self ) -> std:: io:: Result < u64 > {
7777 self . remaining_size = self . remaining_size . saturating_sub ( 8 ) ;
7878 self . reader . read_u64 :: < BigEndian > ( )
7979 }
8080
81- pub ( crate ) fn read_uint ( & mut self , size : usize ) -> std:: io:: Result < u64 > {
81+ pub fn read_uint ( & mut self , size : usize ) -> std:: io:: Result < u64 > {
8282 self . remaining_size = self . remaining_size . saturating_sub ( size as u64 ) ;
8383 self . reader . read_uint :: < BigEndian > ( size)
8484 }
8585
8686 /// Read the next atom in the file
8787 ///
8888 /// This will leave the reader at the beginning of the atom content.
89- pub ( crate ) fn next ( & mut self ) -> Result < Option < AtomInfo > > {
89+ pub fn next ( & mut self ) -> Result < Option < AtomInfo > > {
9090 if self . remaining_size == 0 {
9191 return Ok ( None ) ;
9292 }
9898 AtomInfo :: read ( self , self . remaining_size , self . parse_mode ) . map_err ( Into :: into)
9999 }
100100
101- pub ( crate ) fn into_inner ( self ) -> R {
101+ pub fn into_inner ( self ) -> R {
102102 self . reader
103103 }
104104}
0 commit comments