mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2025-03-04 06:47:12 +00:00
MP4: Dont discard tags on multiple udta
This commit is contained in:
parent
d2d4b81fe0
commit
739491f238
3 changed files with 22 additions and 7 deletions
|
@ -52,7 +52,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Fixed
|
||||
- **ID3v2**: Disallow 4 character TXXX/WXXX frame descriptions from being converted to `ItemKey` ([issue](https://github.com/Serial-ATA/lofty-rs/issues/309)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/394))
|
||||
- **MPEG**: Durations estimated by bitrate are more accurate ([PR](https://github.com/Serial-ATA/lofty-rs/pull/395))
|
||||
- **MP4**: Bitrate calculation is now more accurate ([PR](https://github.com/Serial-ATA/lofty-rs/pull/398))
|
||||
- **MP4**:
|
||||
- Bitrate calculation is now more accurate ([PR](https://github.com/Serial-ATA/lofty-rs/pull/398))
|
||||
- Existing tags will no longer be overridden if another `udta` atom is encountered ([PR](https://github.com/Serial-ATA/lofty-rs/pull/405))
|
||||
- **WAV**: Bitrate calculation is now more accurate ([PR](https://github.com/Serial-ATA/lofty-rs/pull/399))
|
||||
- **MusePack**: Overall improved audio properties ([PR](https://github.com/Serial-ATA/lofty-rs/pull/402))
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ pub(crate) struct Moov {
|
|||
// Represents the trak.mdia atom
|
||||
pub(crate) traks: Vec<AtomInfo>,
|
||||
// Represents a parsed moov.udta.meta.ilst
|
||||
pub(crate) meta: Option<Ilst>,
|
||||
pub(crate) ilst: Option<Ilst>,
|
||||
}
|
||||
|
||||
impl Moov {
|
||||
|
@ -43,7 +43,7 @@ impl Moov {
|
|||
R: Read + Seek,
|
||||
{
|
||||
let mut traks = Vec::new();
|
||||
let mut meta = None;
|
||||
let mut ilst = None;
|
||||
|
||||
while let Ok(Some(atom)) = reader.next() {
|
||||
if let AtomIdent::Fourcc(fourcc) = atom.ident {
|
||||
|
@ -56,7 +56,20 @@ impl Moov {
|
|||
}
|
||||
},
|
||||
b"udta" => {
|
||||
meta = meta_from_udta(reader, parse_mode, atom.len - 8)?;
|
||||
let ilst_parsed = ilst_from_udta(reader, parse_mode, atom.len - 8)?;
|
||||
if let Some(ilst_parsed) = ilst_parsed {
|
||||
let Some(mut existing_ilst) = ilst else {
|
||||
ilst = Some(ilst_parsed);
|
||||
continue;
|
||||
};
|
||||
|
||||
log::warn!("Multiple `ilst` atoms found, combining them");
|
||||
for atom in ilst_parsed.atoms {
|
||||
existing_ilst.insert(atom);
|
||||
}
|
||||
|
||||
ilst = Some(existing_ilst);
|
||||
}
|
||||
},
|
||||
_ => skip_unneeded(reader, atom.extended, atom.len)?,
|
||||
}
|
||||
|
@ -67,11 +80,11 @@ impl Moov {
|
|||
skip_unneeded(reader, atom.extended, atom.len)?
|
||||
}
|
||||
|
||||
Ok(Self { traks, meta })
|
||||
Ok(Self { traks, ilst })
|
||||
}
|
||||
}
|
||||
|
||||
fn meta_from_udta<R>(
|
||||
fn ilst_from_udta<R>(
|
||||
reader: &mut AtomReader<R>,
|
||||
parsing_mode: ParsingMode,
|
||||
len: u64,
|
||||
|
|
|
@ -200,7 +200,7 @@ where
|
|||
|
||||
Ok(Mp4File {
|
||||
ftyp,
|
||||
ilst_tag: moov.meta,
|
||||
ilst_tag: moov.ilst,
|
||||
properties: if parse_options.read_properties {
|
||||
// Remove the length restriction
|
||||
reader.reset_bounds(0, file_length);
|
||||
|
|
Loading…
Add table
Reference in a new issue