From c537bae8c7ddc3f27e35edaa2201daa5dd2c7ccb Mon Sep 17 00:00:00 2001 From: AdrianEddy Date: Fri, 10 May 2024 19:26:31 +0200 Subject: [PATCH 1/2] Don't fail when the wave atom contains different atoms than esds --- mp4parse/src/lib.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mp4parse/src/lib.rs b/mp4parse/src/lib.rs index 5355d325..81a8a658 100644 --- a/mp4parse/src/lib.rs +++ b/mp4parse/src/lib.rs @@ -5737,9 +5737,15 @@ fn read_audio_sample_entry(src: &mut BMFFBox) -> Result codec_specific = Some(AudioCodecSpecific::ALACSpecificBox(alac)); } BoxType::QTWaveAtom => { - let qt_esds = read_qt_wave_atom(&mut b)?; - codec_type = qt_esds.audio_codec; - codec_specific = Some(AudioCodecSpecific::ES_Descriptor(qt_esds)); + match read_qt_wave_atom(&mut b) { + Ok(qt_esds) => { + codec_type = qt_esds.audio_codec; + codec_specific = Some(AudioCodecSpecific::ES_Descriptor(qt_esds)); + }, + Err(e) => { + warn!("Failed to parse wave atom: {e:?}"); + } + } } BoxType::ProtectionSchemeInfoBox => { if name != BoxType::ProtectedAudioSampleEntry { From 2f1b4a5a0c86155a7c4d1c12ca347cd33a5b2b24 Mon Sep 17 00:00:00 2001 From: AdrianEddy Date: Fri, 10 May 2024 19:32:21 +0200 Subject: [PATCH 2/2] Fix formatting --- mp4parse/src/lib.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/mp4parse/src/lib.rs b/mp4parse/src/lib.rs index 81a8a658..dcfb1648 100644 --- a/mp4parse/src/lib.rs +++ b/mp4parse/src/lib.rs @@ -5736,17 +5736,15 @@ fn read_audio_sample_entry(src: &mut BMFFBox) -> Result codec_type = CodecType::ALAC; codec_specific = Some(AudioCodecSpecific::ALACSpecificBox(alac)); } - BoxType::QTWaveAtom => { - match read_qt_wave_atom(&mut b) { - Ok(qt_esds) => { - codec_type = qt_esds.audio_codec; - codec_specific = Some(AudioCodecSpecific::ES_Descriptor(qt_esds)); - }, - Err(e) => { - warn!("Failed to parse wave atom: {e:?}"); - } + BoxType::QTWaveAtom => match read_qt_wave_atom(&mut b) { + Ok(qt_esds) => { + codec_type = qt_esds.audio_codec; + codec_specific = Some(AudioCodecSpecific::ES_Descriptor(qt_esds)); } - } + Err(e) => { + warn!("Failed to parse wave atom: {e:?}"); + } + }, BoxType::ProtectionSchemeInfoBox => { if name != BoxType::ProtectedAudioSampleEntry { return Status::StsdBadAudioSampleEntry.into();