mirror of
https://github.com/iluvcapra/bwavfile.git
synced 2026-01-02 09:50:44 +00:00
Implented AXML/iXML writing functions
This commit is contained in:
@@ -103,6 +103,8 @@ pub const FMT__SIG: FourCC = FourCC::make(b"fmt ");
|
|||||||
|
|
||||||
pub const BEXT_SIG: FourCC = FourCC::make(b"bext");
|
pub const BEXT_SIG: FourCC = FourCC::make(b"bext");
|
||||||
//pub const FACT_SIG: FourCC = FourCC::make(b"fact");
|
//pub const FACT_SIG: FourCC = FourCC::make(b"fact");
|
||||||
|
pub const IXML_SIG: FourCC = FourCC::make(b"iXML");
|
||||||
|
pub const AXML_SIG: FourCC = FourCC::make(b"axml");
|
||||||
|
|
||||||
pub const JUNK_SIG: FourCC = FourCC::make(b"JUNK");
|
pub const JUNK_SIG: FourCC = FourCC::make(b"JUNK");
|
||||||
pub const FLLR_SIG: FourCC = FourCC::make(b"FLLR");
|
pub const FLLR_SIG: FourCC = FourCC::make(b"FLLR");
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ use std::io::SeekFrom;
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
||||||
use super::parser::Parser;
|
use super::parser::Parser;
|
||||||
use super::fourcc::{FourCC, ReadFourCC, FMT__SIG,DATA_SIG, BEXT_SIG, LIST_SIG, JUNK_SIG, FLLR_SIG, CUE__SIG, ADTL_SIG};
|
use super::fourcc::{FourCC, ReadFourCC, FMT__SIG,DATA_SIG, BEXT_SIG, LIST_SIG, JUNK_SIG, FLLR_SIG, CUE__SIG,
|
||||||
|
ADTL_SIG, AXML_SIG, IXML_SIG};
|
||||||
use super::errors::Error as ParserError;
|
use super::errors::Error as ParserError;
|
||||||
use super::fmt::{WaveFmt, ChannelDescriptor, ChannelMask};
|
use super::fmt::{WaveFmt, ChannelDescriptor, ChannelMask};
|
||||||
use super::bext::Bext;
|
use super::bext::Bext;
|
||||||
@@ -250,8 +251,7 @@ impl<R: Read + Seek> WaveReader<R> {
|
|||||||
/// If there are no iXML metadata present in the file,
|
/// If there are no iXML metadata present in the file,
|
||||||
/// Ok(0) will be returned.
|
/// Ok(0) will be returned.
|
||||||
pub fn read_ixml(&mut self, buffer: &mut Vec<u8>) -> Result<usize, ParserError> {
|
pub fn read_ixml(&mut self, buffer: &mut Vec<u8>) -> Result<usize, ParserError> {
|
||||||
let ixml_fourcc = FourCC::make(b"iXML");
|
self.read_chunk(IXML_SIG, 0, buffer)
|
||||||
self.read_chunk(ixml_fourcc, 0, buffer)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read AXML data.
|
/// Read AXML data.
|
||||||
@@ -262,8 +262,7 @@ impl<R: Read + Seek> WaveReader<R> {
|
|||||||
/// If there are no axml metadata present in the file,
|
/// If there are no axml metadata present in the file,
|
||||||
/// Ok(0) will be returned
|
/// Ok(0) will be returned
|
||||||
pub fn read_axml(&mut self, buffer: &mut Vec<u8>) -> Result<usize, ParserError> {
|
pub fn read_axml(&mut self, buffer: &mut Vec<u8>) -> Result<usize, ParserError> {
|
||||||
let axml_fourcc = FourCC::make(b"axml");
|
self.read_chunk(AXML_SIG, 0, buffer)
|
||||||
self.read_chunk(axml_fourcc, 0, buffer)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ use std::io::{Write,Seek,SeekFrom,Cursor};
|
|||||||
|
|
||||||
use super::Error;
|
use super::Error;
|
||||||
use super::fourcc::{FourCC, WriteFourCC, RIFF_SIG, RF64_SIG, DS64_SIG,
|
use super::fourcc::{FourCC, WriteFourCC, RIFF_SIG, RF64_SIG, DS64_SIG,
|
||||||
WAVE_SIG, FMT__SIG, DATA_SIG, ELM1_SIG, JUNK_SIG, BEXT_SIG};
|
WAVE_SIG, FMT__SIG, DATA_SIG, ELM1_SIG, JUNK_SIG, BEXT_SIG,AXML_SIG,
|
||||||
|
IXML_SIG};
|
||||||
use super::fmt::WaveFmt;
|
use super::fmt::WaveFmt;
|
||||||
//use super::common_format::CommonFormat;
|
//use super::common_format::CommonFormat;
|
||||||
use super::chunks::WriteBWaveChunks;
|
use super::chunks::WriteBWaveChunks;
|
||||||
@@ -270,6 +271,16 @@ impl<W> WaveWriter<W> where W: Write + Seek {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Write iXML metadata
|
||||||
|
pub fn write_ixml(&mut self, ixml: &[u8]) -> Result<(),Error> {
|
||||||
|
self.write_chunk(IXML_SIG, &ixml)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Write axml/ADM metadata
|
||||||
|
pub fn write_axml(&mut self, axml: &[u8]) -> Result<(), Error> {
|
||||||
|
self.write_chunk(AXML_SIG, &axml)
|
||||||
|
}
|
||||||
|
|
||||||
/// Create an audio frame writer, which takes possession of the callee
|
/// Create an audio frame writer, which takes possession of the callee
|
||||||
/// `WaveWriter`.
|
/// `WaveWriter`.
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user