Skip to content

Commit

Permalink
Ilst: Ignore invalid covr data types when not strict
Browse files Browse the repository at this point in the history
  • Loading branch information
Serial-ATA committed Nov 20, 2024
1 parent 3d291d1 commit 013b17d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
18 changes: 10 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `AtomData::data_type()` to get the data type code of the atom content.

### Changed
- **Ilst**: Add new rules for `gnre` atom upgrades ([issue](https://github.com/Serial-ATA/lofty-rs/issues/409)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/485))
- In the case that a `©gen` and `gnre` atom are present in a file, there was no way to tell which `©gen` atoms were upgraded.
the new rules are:
- `gnre` present + no `©gen` present, `gnre` gets upgraded as normal
- `gnre` present + `©gen` present, `©gen` takes precedence and `gnre` is discarded
- With [ParsingOptions::implicit_conversions](https://docs.rs/lofty/latest/lofty/config/struct.ParseOptions.html#method.implicit_conversions)
set to `false`, `gnre` will be retained as an atom of type `Unknown`.
- **RIFF INFO**: Ignore text decoding errors when not using `ParsingMode::Strict` ([issue](https://github.com/Serial-ATA/lofty-rs/issues/373))
- **Ilst**:
- Add new rules for `gnre` atom upgrades ([issue](https://github.com/Serial-ATA/lofty-rs/issues/409)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/485))
- In the case that a `©gen` and `gnre` atom are present in a file, there was no way to tell which `©gen` atoms were upgraded.
the new rules are:
- `gnre` present + no `©gen` present, `gnre` gets upgraded as normal
- `gnre` present + `©gen` present, `©gen` takes precedence and `gnre` is discarded
- With [ParsingOptions::implicit_conversions](https://docs.rs/lofty/latest/lofty/config/struct.ParseOptions.html#method.implicit_conversions)
set to `false`, `gnre` will be retained as an atom of type `Unknown`.
- Ignore invalid `covr` data types when not using `ParsingMode::Strict` ([issue](https://github.com/Serial-ATA/lofty-rs/issues/482)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/486))
- **RIFF INFO**: Ignore text decoding errors when not using `ParsingMode::Strict` ([issue](https://github.com/Serial-ATA/lofty-rs/issues/373)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/486))
- RIFF INFO tags may be encoded with a non UTF-8 system encoding, that we have no way of knowing. It's no longer an error to read these files,
it's just unlikely that anything useful come out of the RIFF INFO tags.

Expand Down
12 changes: 11 additions & 1 deletion lofty/src/mp4/ilst/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,17 @@ where
DataType::Jpeg => Some(MimeType::Jpeg),
DataType::Png => Some(MimeType::Png),
DataType::Bmp => Some(MimeType::Bmp),
_ => err!(BadAtom("\"covr\" atom has an unknown type")),
_ => {
if parsing_mode == ParsingMode::Strict {
err!(BadAtom("\"covr\" atom has an unknown type"))
}

log::warn!(
"Encountered \"covr\" atom with an unknown type of `{}`, discarding",
Into::<u32>::into(data_type)
);
return Ok(());
},
};

let picture_data = AtomData::Picture(Picture {
Expand Down

0 comments on commit 013b17d

Please sign in to comment.