mirror of
https://github.com/alfg/mp4-rust.git
synced 2025-01-03 00:48:40 +00:00
mp4a: Support QT sound sample description version 1.
If the QT version in a sound sample description is set to 1, there are 4 additional 32-bit integers in the description record according to QT docs. At least some recently sold iPhones produce sound sample description records like this, so this change fixes a parsing failure for these files.
This commit is contained in:
parent
55875d72de
commit
d9b5755713
1 changed files with 11 additions and 1 deletions
|
@ -83,12 +83,22 @@ impl<R: Read + Seek> ReadBox<&mut R> for Mp4aBox {
|
||||||
reader.read_u16::<BigEndian>()?; // reserved
|
reader.read_u16::<BigEndian>()?; // reserved
|
||||||
let data_reference_index = reader.read_u16::<BigEndian>()?;
|
let data_reference_index = reader.read_u16::<BigEndian>()?;
|
||||||
|
|
||||||
reader.read_u64::<BigEndian>()?; // reserved
|
// Next 8 bytes should be all 0 in ISO MP4
|
||||||
|
let qt_version = reader.read_u16::<BigEndian>()?; // QT: 0, 1 or 2
|
||||||
|
reader.read_u16::<BigEndian>()?; // QT: revision level, should be 0
|
||||||
|
reader.read_u32::<BigEndian>()?; // QT: vendor, should be 0
|
||||||
|
|
||||||
let channelcount = reader.read_u16::<BigEndian>()?;
|
let channelcount = reader.read_u16::<BigEndian>()?;
|
||||||
let samplesize = reader.read_u16::<BigEndian>()?;
|
let samplesize = reader.read_u16::<BigEndian>()?;
|
||||||
reader.read_u32::<BigEndian>()?; // pre-defined, reserved
|
reader.read_u32::<BigEndian>()?; // pre-defined, reserved
|
||||||
let samplerate = FixedPointU16::new_raw(reader.read_u32::<BigEndian>()?);
|
let samplerate = FixedPointU16::new_raw(reader.read_u32::<BigEndian>()?);
|
||||||
|
|
||||||
|
if qt_version == 1 {
|
||||||
|
// Samples per packet, bytes per packet,
|
||||||
|
// bytes per frame, bytes per sample
|
||||||
|
skip_bytes(reader, 4 * 4)?;
|
||||||
|
}
|
||||||
|
|
||||||
let mut esds = None;
|
let mut esds = None;
|
||||||
let current = reader.stream_position()?;
|
let current = reader.stream_position()?;
|
||||||
if current < start + size {
|
if current < start + size {
|
||||||
|
|
Loading…
Reference in a new issue