diff --git a/symphonia-format-isomp4/src/atoms/alac.rs b/symphonia-format-isomp4/src/atoms/alac.rs index 89f90495..dd1c6050 100644 --- a/symphonia-format-isomp4/src/atoms/alac.rs +++ b/symphonia-format-isomp4/src/atoms/alac.rs @@ -6,12 +6,13 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use symphonia_core::codecs::audio::well_known::CODEC_ID_ALAC; -use symphonia_core::codecs::audio::AudioCodecParameters; use symphonia_core::errors::{decode_error, unsupported_error, Result}; use symphonia_core::io::ReadBytes; use crate::atoms::{Atom, AtomHeader}; +use super::stsd::AudioSampleEntry; + #[allow(dead_code)] #[derive(Debug)] pub struct AlacAtom { @@ -46,7 +47,8 @@ impl Atom for AlacAtom { } impl AlacAtom { - pub fn fill_codec_params(&self, codec_params: &mut AudioCodecParameters) { - codec_params.for_codec(CODEC_ID_ALAC).with_extra_data(self.extra_data.clone()); + pub fn fill_audio_sample_entry(&self, entry: &mut AudioSampleEntry) { + entry.codec_id = CODEC_ID_ALAC; + entry.extra_data = Some(self.extra_data.clone()); } } diff --git a/symphonia-format-isomp4/src/atoms/dac3.rs b/symphonia-format-isomp4/src/atoms/dac3.rs index 858c47ee..3e33e299 100644 --- a/symphonia-format-isomp4/src/atoms/dac3.rs +++ b/symphonia-format-isomp4/src/atoms/dac3.rs @@ -6,12 +6,13 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use symphonia_core::codecs::audio::well_known::CODEC_ID_AC3; -use symphonia_core::codecs::audio::AudioCodecParameters; use symphonia_core::errors::{Error, Result}; use symphonia_core::io::ReadBytes; use crate::atoms::{Atom, AtomHeader}; +use super::stsd::AudioSampleEntry; + #[allow(dead_code)] #[derive(Debug)] pub struct Dac3Atom { @@ -33,7 +34,8 @@ impl Atom for Dac3Atom { } impl Dac3Atom { - pub fn fill_codec_params(&self, codec_params: &mut AudioCodecParameters) { - codec_params.for_codec(CODEC_ID_AC3).with_extra_data(self.extra_data.clone()); + pub fn fill_audio_sample_entry(&self, entry: &mut AudioSampleEntry) { + entry.codec_id = CODEC_ID_AC3; + entry.extra_data = Some(self.extra_data.clone()); } } diff --git a/symphonia-format-isomp4/src/atoms/dec3.rs b/symphonia-format-isomp4/src/atoms/dec3.rs index 271c4425..fa16c660 100644 --- a/symphonia-format-isomp4/src/atoms/dec3.rs +++ b/symphonia-format-isomp4/src/atoms/dec3.rs @@ -6,12 +6,13 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use symphonia_core::codecs::audio::well_known::CODEC_ID_EAC3; -use symphonia_core::codecs::audio::AudioCodecParameters; use symphonia_core::errors::{Error, Result}; use symphonia_core::io::ReadBytes; use crate::atoms::{Atom, AtomHeader}; +use super::stsd::AudioSampleEntry; + #[allow(dead_code)] #[derive(Debug)] pub struct Dec3Atom { @@ -33,7 +34,8 @@ impl Atom for Dec3Atom { } impl Dec3Atom { - pub fn fill_codec_params(&self, codec_params: &mut AudioCodecParameters) { - codec_params.for_codec(CODEC_ID_EAC3).with_extra_data(self.extra_data.clone()); + pub fn fill_audio_sample_entry(&self, entry: &mut AudioSampleEntry) { + entry.codec_id = CODEC_ID_EAC3; + entry.extra_data = Some(self.extra_data.clone()); } } diff --git a/symphonia-format-isomp4/src/atoms/esds.rs b/symphonia-format-isomp4/src/atoms/esds.rs index 4a9630ca..aac17d09 100644 --- a/symphonia-format-isomp4/src/atoms/esds.rs +++ b/symphonia-format-isomp4/src/atoms/esds.rs @@ -5,7 +5,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -use symphonia_core::codecs::audio::AudioCodecParameters; use symphonia_core::codecs::video::{VideoExtraData, VIDEO_EXTRA_DATA_ID_NULL}; use symphonia_core::codecs::CodecId; use symphonia_core::errors::{decode_error, unsupported_error, Error, Result}; @@ -15,7 +14,7 @@ use crate::atoms::{Atom, AtomHeader}; use log::{debug, warn}; -use super::stsd::VisualSampleEntry; +use super::stsd::{AudioSampleEntry, VisualSampleEntry}; const ES_DESCRIPTOR: u8 = 0x03; const DECODER_CONFIG_DESCRIPTOR: u8 = 0x04; @@ -84,27 +83,22 @@ impl Atom for EsdsAtom { impl EsdsAtom { /// If the elementary stream descriptor describes an audio stream, populate the provided - /// audio codec parameters. - pub fn fill_audio_codec_params(&self, codec_params: &mut AudioCodecParameters) -> Result<()> { - use symphonia_core::codecs::audio::CODEC_ID_NULL_AUDIO; - + /// audio sample entry. + pub fn fill_audio_sample_entry(&self, entry: &mut AudioSampleEntry) -> Result<()> { match get_codec_id_from_object_type(self.descriptor.dec_config.object_type_indication) { Some(CodecId::Audio(id)) => { // Object type indication identified an audio codec. - codec_params.for_codec(id); + entry.codec_id = id; } Some(_) => { // Object type indication identified a non-audio codec. This is unexpected. return decode_error("isomp4 (esds): expected an audio codec type"); } - None => { - // Unknown object type indication. - codec_params.for_codec(CODEC_ID_NULL_AUDIO); - } + None => {} } if let Some(ds_config) = &self.descriptor.dec_config.dec_specific_info { - codec_params.with_extra_data(ds_config.extra_data.clone()); + entry.extra_data = Some(ds_config.extra_data.clone()); } Ok(()) @@ -113,8 +107,6 @@ impl EsdsAtom { /// If the elementary stream descriptor describes an video stream, populate the provided /// video sample entry. pub fn fill_video_sample_entry(&self, entry: &mut VisualSampleEntry) -> Result<()> { - use symphonia_core::codecs::video::CODEC_ID_NULL_VIDEO; - match get_codec_id_from_object_type(self.descriptor.dec_config.object_type_indication) { Some(CodecId::Video(id)) => { // Object type indication identified an video codec. @@ -124,10 +116,7 @@ impl EsdsAtom { // Object type indication identified a non-video codec. This is unexpected. return decode_error("isomp4 (esds): expected a video codec type"); } - None => { - // Unknown object type indication. - entry.codec_id = CODEC_ID_NULL_VIDEO; - } + None => {} } if let Some(ds_config) = &self.descriptor.dec_config.dec_specific_info { diff --git a/symphonia-format-isomp4/src/atoms/flac.rs b/symphonia-format-isomp4/src/atoms/flac.rs index 06310a25..6bc1110e 100644 --- a/symphonia-format-isomp4/src/atoms/flac.rs +++ b/symphonia-format-isomp4/src/atoms/flac.rs @@ -6,7 +6,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use symphonia_core::codecs::audio::well_known::CODEC_ID_FLAC; -use symphonia_core::codecs::audio::{AudioCodecParameters, VerificationCheck}; +use symphonia_core::codecs::audio::VerificationCheck; use symphonia_core::errors::{decode_error, unsupported_error, Result}; use symphonia_core::io::{BufReader, ReadBytes}; @@ -16,6 +16,8 @@ use symphonia_common::xiph::audio::flac::metadata::{ use crate::atoms::{Atom, AtomHeader}; +use super::stsd::AudioSampleEntry; + /// FLAC atom. #[allow(dead_code)] #[derive(Debug)] @@ -59,16 +61,15 @@ impl Atom for FlacAtom { } impl FlacAtom { - pub fn fill_codec_params(&self, codec_params: &mut AudioCodecParameters) { - codec_params - .for_codec(CODEC_ID_FLAC) - .with_sample_rate(self.stream_info.sample_rate) - .with_bits_per_sample(self.stream_info.bits_per_sample) - .with_channels(self.stream_info.channels.clone()) - .with_extra_data(self.extra_data.clone()); + pub fn fill_audio_sample_entry(&self, entry: &mut AudioSampleEntry) { + entry.codec_id = CODEC_ID_FLAC; + entry.sample_rate = self.stream_info.sample_rate; + entry.bits_per_sample = Some(self.stream_info.bits_per_sample); + entry.channels = Some(self.stream_info.channels.clone()); + entry.extra_data = Some(self.extra_data.clone()); if let Some(md5) = self.stream_info.md5 { - codec_params.with_verification_code(VerificationCheck::Md5(md5)); + entry.verification_check = Some(VerificationCheck::Md5(md5)); } } } diff --git a/symphonia-format-isomp4/src/atoms/opus.rs b/symphonia-format-isomp4/src/atoms/opus.rs index b9917f26..93b3885d 100644 --- a/symphonia-format-isomp4/src/atoms/opus.rs +++ b/symphonia-format-isomp4/src/atoms/opus.rs @@ -5,12 +5,14 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -use symphonia_core::codecs::audio::{well_known::CODEC_ID_OPUS, AudioCodecParameters}; +use symphonia_core::codecs::audio::well_known::CODEC_ID_OPUS; use symphonia_core::errors::{decode_error, unsupported_error, Error, Result}; use symphonia_core::io::ReadBytes; use crate::atoms::{Atom, AtomHeader}; +use super::stsd::AudioSampleEntry; + /// Opus atom. #[allow(dead_code)] #[derive(Debug)] @@ -64,7 +66,8 @@ impl Atom for OpusAtom { } impl OpusAtom { - pub fn fill_codec_params(&self, codec_params: &mut AudioCodecParameters) { - codec_params.for_codec(CODEC_ID_OPUS).with_extra_data(self.extra_data.clone()); + pub fn fill_audio_sample_entry(&self, entry: &mut AudioSampleEntry) { + entry.codec_id = CODEC_ID_OPUS; + entry.extra_data = Some(self.extra_data.clone()); } } diff --git a/symphonia-format-isomp4/src/atoms/stsd.rs b/symphonia-format-isomp4/src/atoms/stsd.rs index 6f0726e2..3c052363 100644 --- a/symphonia-format-isomp4/src/atoms/stsd.rs +++ b/symphonia-format-isomp4/src/atoms/stsd.rs @@ -19,7 +19,9 @@ use symphonia_core::codecs::audio::well_known::{CODEC_ID_PCM_S8, CODEC_ID_PCM_U8 use symphonia_core::codecs::audio::well_known::{CODEC_ID_PCM_U16BE, CODEC_ID_PCM_U16LE}; use symphonia_core::codecs::audio::well_known::{CODEC_ID_PCM_U24BE, CODEC_ID_PCM_U24LE}; use symphonia_core::codecs::audio::well_known::{CODEC_ID_PCM_U32BE, CODEC_ID_PCM_U32LE}; -use symphonia_core::codecs::audio::{AudioCodecId, AudioCodecParameters, CODEC_ID_NULL_AUDIO}; +use symphonia_core::codecs::audio::{ + AudioCodecId, AudioCodecParameters, VerificationCheck, CODEC_ID_NULL_AUDIO, +}; use symphonia_core::codecs::subtitle::well_known::CODEC_ID_MOV_TEXT; use symphonia_core::codecs::subtitle::SubtitleCodecParameters; use symphonia_core::codecs::video::{VideoCodecId, VideoCodecParameters, VideoExtraData}; @@ -122,35 +124,6 @@ impl StsdAtom { } } -#[derive(Debug)] -pub struct Pcm { - pub codec_id: AudioCodecId, - pub bits_per_sample: u32, - pub bits_per_coded_sample: u32, - pub frames_per_packet: u64, - pub channels: Channels, -} - -#[derive(Debug)] -pub enum AudioCodecSpecific { - /// MPEG Elementary Stream descriptor. - Esds(EsdsAtom), - /// Dolby Digital - Ac3(Dac3Atom), - /// Apple Lossless Audio Codec (ALAC). - Alac(AlacAtom), - /// Dolby Digital Plus - Eac3(Dec3Atom), - /// Free Lossless Audio Codec (FLAC). - Flac(FlacAtom), - /// Opus. - Opus(OpusAtom), - /// MP3. - Mp3, - /// PCM codecs. - Pcm(Pcm), -} - /// Generic sample entry. #[allow(dead_code)] #[derive(Debug)] @@ -164,59 +137,33 @@ pub enum SampleEntry { /// Audio sample entry. #[allow(dead_code)] -#[derive(Debug)] +#[derive(Debug, Default)] pub struct AudioSampleEntry { pub num_channels: u32, pub sample_size: u16, - pub sample_rate: f64, - pub codec_specific: Option, + pub sample_rate: u32, + pub codec_id: AudioCodecId, + pub bits_per_sample: Option, + pub bits_per_coded_sample: Option, + pub max_frames_per_packet: Option, + pub channels: Option, + pub verification_check: Option, + pub extra_data: Option>, } impl AudioSampleEntry { pub(crate) fn make_codec_params(&self) -> AudioCodecParameters { - let mut codec_params = AudioCodecParameters::new(); - - // General audio parameters. - codec_params.with_sample_rate(self.sample_rate as u32); - - // Codec-specific parameters. - match self.codec_specific { - Some(AudioCodecSpecific::Esds(ref esds)) => { - // ESDS is not an audio specific atom. Returns an error if not an audio - // elementary stream. - esds.fill_audio_codec_params(&mut codec_params).ok(); - } - Some(AudioCodecSpecific::Ac3(ref dac3)) => { - dac3.fill_codec_params(&mut codec_params); - } - Some(AudioCodecSpecific::Alac(ref alac)) => { - alac.fill_codec_params(&mut codec_params); - } - Some(AudioCodecSpecific::Eac3(ref dec3)) => { - dec3.fill_codec_params(&mut codec_params); - } - Some(AudioCodecSpecific::Flac(ref flac)) => { - flac.fill_codec_params(&mut codec_params); - } - Some(AudioCodecSpecific::Opus(ref opus)) => { - opus.fill_codec_params(&mut codec_params); - } - Some(AudioCodecSpecific::Mp3) => { - codec_params.for_codec(CODEC_ID_MP3); - } - Some(AudioCodecSpecific::Pcm(ref pcm)) => { - // PCM codecs. - codec_params - .for_codec(pcm.codec_id) - .with_bits_per_coded_sample(pcm.bits_per_coded_sample) - .with_bits_per_sample(pcm.bits_per_sample) - .with_max_frames_per_packet(pcm.frames_per_packet) - .with_channels(pcm.channels.clone()); - } - _ => (), + AudioCodecParameters { + codec: self.codec_id, + sample_rate: Some(self.sample_rate), + bits_per_sample: self.bits_per_sample, + bits_per_coded_sample: self.bits_per_coded_sample, + channels: self.channels.clone(), + max_frames_per_packet: self.max_frames_per_packet, + verification_check: self.verification_check, + extra_data: self.extra_data.clone(), + ..Default::default() } - - codec_params } } /// Gets if the sample entry atom is for a PCM codec. @@ -354,45 +301,39 @@ fn read_audio_sample_entry( // AudioSampleEntry(V1) portion + let mut entry = AudioSampleEntry::default(); + // The version of the audio sample entry. let version = reader.read_be_u16()?; // Skip revision and vendor. reader.ignore_bytes(6)?; - let mut num_channels = u32::from(reader.read_be_u16()?); - let sample_size = reader.read_be_u16()?; + entry.num_channels = u32::from(reader.read_be_u16()?); + entry.sample_size = reader.read_be_u16()?; // Skip compression ID and packet size. reader.ignore_bytes(4)?; - let mut sample_rate = f64::from(FpU16::parse_raw(reader.read_be_u32()?)); + entry.sample_rate = reader.read_be_u32()?; let is_pcm_codec = is_pcm_codec(header.atom_type); - let mut codec_specific = match version { + match version { 0 => { // Version 0. if is_pcm_codec { - let codec_id = pcm_codec_id(header.atom_type); - let bits_per_sample = 8 * bytes_per_pcm_sample(codec_id); + entry.codec_id = pcm_codec_id(header.atom_type); + let bits_per_sample = 8 * bytes_per_pcm_sample(entry.codec_id); // Validate the codec-derived bytes-per-sample equals the declared bytes-per-sample. - if u32::from(sample_size) != bits_per_sample { + if u32::from(entry.sample_size) != bits_per_sample { return decode_error("isomp4: invalid pcm sample size"); } - - // The original fields describe the PCM sample format. - Some(AudioCodecSpecific::Pcm(Pcm { - codec_id: pcm_codec_id(header.atom_type), - bits_per_sample, - bits_per_coded_sample: bits_per_sample, - frames_per_packet: 1, - channels: pcm_channels(num_channels)?, - })) - } - else { - None + entry.bits_per_sample = Some(bits_per_sample); + entry.bits_per_coded_sample = Some(bits_per_sample); + entry.max_frames_per_packet = Some(1); + entry.channels = Some(pcm_channels(entry.num_channels)?); } } 1 => { @@ -413,8 +354,8 @@ fn read_audio_sample_entry( let _ = reader.read_be_u32()?; if is_pcm_codec { - let codec_id = pcm_codec_id(header.atom_type); - let codec_bytes_per_sample = bytes_per_pcm_sample(codec_id); + entry.codec_id = pcm_codec_id(header.atom_type); + let codec_bytes_per_sample = bytes_per_pcm_sample(entry.codec_id); // Validate the codec-derived bytes-per-sample equals the declared bytes-per-sample. if bytes_per_audio_sample != codec_bytes_per_sample { @@ -423,24 +364,18 @@ fn read_audio_sample_entry( // The new fields describe the PCM sample format and supersede the original version // 0 fields. - Some(AudioCodecSpecific::Pcm(Pcm { - codec_id, - bits_per_sample: 8 * codec_bytes_per_sample, - bits_per_coded_sample: 8 * codec_bytes_per_sample, - frames_per_packet: 1, - channels: pcm_channels(num_channels)?, - })) - } - else { - None + entry.bits_per_sample = Some(8 * codec_bytes_per_sample); + entry.bits_per_coded_sample = Some(8 * codec_bytes_per_sample); + entry.max_frames_per_packet = Some(1); + entry.channels = Some(pcm_channels(entry.num_channels)?); } } 2 => { // Version 2. reader.ignore_bytes(4)?; - sample_rate = reader.read_be_f64()?; - num_channels = reader.read_be_u32()?; + entry.sample_rate = reader.read_be_f64()? as u32; + entry.num_channels = reader.read_be_u32()?; if reader.read_be_u32()? != 0x7f00_0000 { return decode_error("isomp4: audio sample entry v2 reserved must be 0x7f00_0000"); @@ -453,21 +388,15 @@ fn read_audio_sample_entry( let lpcm_frames_per_packet = reader.read_be_u32()?; // This is only valid if this is a PCM codec. - let codec_id = lpcm_codec_id(bits_per_sample, lpcm_flags); + entry.codec_id = lpcm_codec_id(bits_per_sample, lpcm_flags); - if is_pcm_codec && codec_id != CODEC_ID_NULL_AUDIO { + if is_pcm_codec && entry.codec_id != CODEC_ID_NULL_AUDIO { // Like version 1, the new fields describe the PCM sample format and supersede the // original version 0 fields. - Some(AudioCodecSpecific::Pcm(Pcm { - codec_id, - bits_per_sample, - bits_per_coded_sample: bits_per_sample, - frames_per_packet: u64::from(lpcm_frames_per_packet), - channels: lpcm_channels(num_channels)?, - })) - } - else { - None + entry.bits_per_sample = Some(bits_per_sample); + entry.bits_per_coded_sample = Some(bits_per_sample); + entry.max_frames_per_packet = Some(u64::from(lpcm_frames_per_packet)); + entry.channels = Some(lpcm_channels(entry.num_channels)?); } } _ => { @@ -479,66 +408,35 @@ fn read_audio_sample_entry( while let Some(entry_header) = iter.next()? { match entry_header.atom_type { - AtomType::Esds => { - // MP4A/ESDS codec-specific atom. - if header.atom_type != AtomType::AudioSampleEntryMp4a || codec_specific.is_some() { - return decode_error("isomp4: invalid sample entry"); - } - - codec_specific = Some(AudioCodecSpecific::Esds(iter.read_atom::()?)); - } AtomType::Ac3Config => { - // Ac3 codec-specific atom. - if header.atom_type != AtomType::AudioSampleEntryAc3 || codec_specific.is_some() { - return decode_error("isomp4: invalid sample entry"); - } - - codec_specific = Some(AudioCodecSpecific::Ac3(iter.read_atom::()?)); + let atom = iter.read_atom::()?; + atom.fill_audio_sample_entry(&mut entry); } AtomType::AudioSampleEntryAlac => { - // ALAC codec-specific atom. - if header.atom_type != AtomType::AudioSampleEntryAlac || codec_specific.is_some() { - return decode_error("isomp4: invalid sample entry"); - } - - codec_specific = Some(AudioCodecSpecific::Alac(iter.read_atom::()?)); + let atom = iter.read_atom::()?; + atom.fill_audio_sample_entry(&mut entry); } AtomType::Eac3Config => { - // Eac3 codec-specific atom. - if header.atom_type != AtomType::AudioSampleEntryEc3 || codec_specific.is_some() { - return decode_error("isomp4: invalid sample entry"); - } - - codec_specific = Some(AudioCodecSpecific::Eac3(iter.read_atom::()?)); + let atom = iter.read_atom::()?; + atom.fill_audio_sample_entry(&mut entry); + } + AtomType::Esds => { + let atom = iter.read_atom::()?; + atom.fill_audio_sample_entry(&mut entry)?; } AtomType::FlacDsConfig => { - // FLAC codec-specific atom. - if header.atom_type != AtomType::AudioSampleEntryFlac || codec_specific.is_some() { - return decode_error("isomp4: invalid sample entry"); - } - - codec_specific = Some(AudioCodecSpecific::Flac(iter.read_atom::()?)); + let atom = iter.read_atom::()?; + atom.fill_audio_sample_entry(&mut entry); } AtomType::OpusDsConfig => { - // Opus codec-specific atom. - if header.atom_type != AtomType::AudioSampleEntryOpus || codec_specific.is_some() { - return decode_error("isomp4: invalid sample entry"); - } - - codec_specific = Some(AudioCodecSpecific::Opus(iter.read_atom::()?)); + let atom = iter.read_atom::()?; + atom.fill_audio_sample_entry(&mut entry); } AtomType::AudioSampleEntryQtWave => { // The QuickTime WAVE (aka. siDecompressionParam) atom may contain many different // types of sub-atoms to store decoder parameters. - let wave = iter.read_atom::()?; - - if let Some(esds) = wave.esds { - if codec_specific.is_some() { - return decode_error("isomp4: invalid sample entry"); - } - - codec_specific = Some(AudioCodecSpecific::Esds(esds)); - } + let atom = iter.read_atom::()?; + atom.fill_audio_sample_entry(&mut entry)?; } _ => { debug!("unknown audio sample entry sub-atom: {:?}.", entry_header.atom_type()); @@ -548,19 +446,10 @@ fn read_audio_sample_entry( // A MP3 sample entry has no codec-specific atom. if header.atom_type == AtomType::AudioSampleEntryMp3 { - if codec_specific.is_some() { - return decode_error("isomp4: invalid sample entry"); - } - - codec_specific = Some(AudioCodecSpecific::Mp3); + entry.codec_id = CODEC_ID_MP3; } - Ok(SampleEntry::Audio(AudioSampleEntry { - num_channels, - sample_size, - sample_rate, - codec_specific, - })) + Ok(SampleEntry::Audio(entry)) } /// Visual sample entry. diff --git a/symphonia-format-isomp4/src/atoms/wave.rs b/symphonia-format-isomp4/src/atoms/wave.rs index d16febc8..f6539ad1 100644 --- a/symphonia-format-isomp4/src/atoms/wave.rs +++ b/symphonia-format-isomp4/src/atoms/wave.rs @@ -10,7 +10,7 @@ use symphonia_core::io::ReadBytes; use crate::atoms::{Atom, AtomHeader, EsdsAtom}; -use super::{AtomIterator, AtomType}; +use super::{stsd::AudioSampleEntry, AtomIterator, AtomType}; #[allow(dead_code)] #[derive(Debug)] @@ -33,3 +33,13 @@ impl Atom for WaveAtom { Ok(WaveAtom { esds }) } } + +impl WaveAtom { + pub fn fill_audio_sample_entry(&self, entry: &mut AudioSampleEntry) -> Result<()> { + if let Some(esds) = &self.esds { + esds.fill_audio_sample_entry(entry)?; + } + + Ok(()) + } +}