pub struct Reader { /* private fields */ }Expand description
A reader for parsing binary data of MP4 containers with support for big-endian and little-endian formats.
Implementations§
Source§impl Reader
impl Reader
Sourcepub fn new_big_endian(data: &[u8]) -> Self
pub fn new_big_endian(data: &[u8]) -> Self
Creates a new big-endian Reader for the given data.
Sourcepub fn new_little_endian(data: &[u8]) -> Self
pub fn new_little_endian(data: &[u8]) -> Self
Creates a new little-endian Reader for the given data.
Sourcepub fn has_more_data(&self) -> bool
pub fn has_more_data(&self) -> bool
Returns true if there is more data to be read.
Sourcepub fn get_length(&self) -> u64
pub fn get_length(&self) -> u64
Returns the total length of the data in bytes.
Sourcepub fn get_position(&self) -> u64
pub fn get_position(&self) -> u64
Returns the current read position.
Sourcepub fn skip(&mut self, bytes: u64) -> Result<()>
pub fn skip(&mut self, bytes: u64) -> Result<()>
Skips the specified number of bytes.
§Errors
Returns an error if the new position exceeds the total data length.
Sourcepub fn read_u16(&mut self) -> Result<u16>
pub fn read_u16(&mut self) -> Result<u16>
Reads a 16-bit unsigned integer according to the configured endianness.
§Errors
Returns an error if there is not enough data left to read.
Sourcepub fn read_u32(&mut self) -> Result<u32>
pub fn read_u32(&mut self) -> Result<u32>
Reads a 32-bit unsigned integer according to the configured endianness.
§Errors
Returns an error if there is not enough data left to read.
Sourcepub fn read_u64(&mut self) -> Result<u64>
pub fn read_u64(&mut self) -> Result<u64>
Reads a 64-bit unsigned integer according to the configured endianness.
§Errors
Returns an error if there is not enough data left to read.
Sourcepub fn read_bytes_u8(&mut self, bytes: usize) -> Result<Vec<u8>>
pub fn read_bytes_u8(&mut self, bytes: usize) -> Result<Vec<u8>>
Reads the specified number of bytes into a vector.
§Errors
Returns an error if there is not enough data left to read.