axml and iXML access methods

This commit is contained in:
Jamie Hardt
2020-11-27 22:47:48 -08:00
parent a4c4936665
commit 9cbb2664d4
2 changed files with 28 additions and 1 deletions

View File

@@ -106,7 +106,6 @@ pub const BEXT_SIG: FourCC = FourCC::make(b"bext");
pub const JUNK_SIG: FourCC = FourCC::make(b"JUNK");
pub const FLLR_SIG: FourCC = FourCC::make(b"FLLR");
#[cfg(test)]
mod tests {
use super::*;

View File

@@ -163,6 +163,34 @@ impl<R: Read + Seek> WaveReader<R> {
.collect() )
}
/// Read iXML data.
///
/// If there are no iXML metadata present in the file,
/// Err(Error::ChunkMissing { "iXML" } will be returned.
pub fn ixml(&mut self, buffer: &mut Vec<u8>) -> Result<usize, ParserError> {
let ixml_sig: FourCC = FourCC::make(b"iXML");
let mut chunk = self.chunk_reader(ixml_sig, 0)?;
match chunk.read_to_end(buffer) {
Ok(read) => Ok(read),
Err(error) => Err(error.into())
}
}
/// Read ADM XML data.
///
/// If there are no iXML metadata present in the file,
/// Err(Error::ChunkMissing { "axml" } will be returned.
pub fn adm_xml(&mut self, buffer: &mut Vec<u8>) -> Result<usize, ParserError> {
let axml_sig: FourCC = FourCC::make(b"axml");
let mut chunk = self.chunk_reader(axml_sig, 0)?;
match chunk.read_to_end(buffer) {
Ok(read) => Ok(read),
Err(error) => Err(error.into())
}
}
/**
* Validate file is readable.
*