in mp4parse/src/tests.rs [1321:1352]
fn read_stsd_lpcm() {
// Extract from sample converted by ffmpeg.
// "ffmpeg -i ./gizmo-short.mp4 -acodec pcm_s16le -ar 96000 -vcodec copy -f mov gizmo-short.mov"
let lpcm = vec![
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x10, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x48, 0x40, 0xf7, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x63, 0x68, 0x61, 0x6e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
let mut stream = make_box(BoxSize::Auto, b"lpcm", |s| s.append_bytes(lpcm.as_slice()));
let mut iter = super::BoxIter::new(&mut stream);
let mut stream = iter.next_box().unwrap().unwrap();
let sample_entry = super::read_audio_sample_entry(&mut stream).unwrap();
match sample_entry {
#[allow(clippy::float_cmp)] // The float comparison below is valid and intended.
super::SampleEntry::Audio(a) => {
assert_eq!(a.codec_type, super::CodecType::LPCM);
assert_eq!(a.samplerate, 96000.0);
assert_eq!(a.channelcount, 1);
match a.codec_specific {
super::AudioCodecSpecific::LPCM => (),
_ => panic!("it should be LPCM!"),
}
}
_ => panic!("it should be a audio sample entry!"),
}
}