mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-11-12 23:47:06 +00:00
parent
21e0e934ab
commit
79510821d6
2 changed files with 25 additions and 7 deletions
|
@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- **Truncate**: `impl<T: Truncate> Truncate for &mut T` ([PR](https://github.com/Serial-ATA/lofty-rs/pull/384))
|
- **Truncate**: `impl<T: Truncate> Truncate for &mut T` ([PR](https://github.com/Serial-ATA/lofty-rs/pull/384))
|
||||||
- **Length**: `impl<T: Length> Truncate for &T` ([PR](https://github.com/Serial-ATA/lofty-rs/pull/384))
|
- **Length**: `impl<T: Length> Truncate for &T` ([PR](https://github.com/Serial-ATA/lofty-rs/pull/384))
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- **MP4**: All surrounding `free` atoms will be used when writing `ilst` tags ([issue](https://github.com/Serial-ATA/lofty-rs/issues/346)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/386))
|
||||||
|
- Previously, only the `free` atoms immediately surrounding the `ilst` atom were used.
|
||||||
|
|
||||||
## [0.19.0] - 2024-04-21
|
## [0.19.0] - 2024-04-21
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -256,21 +256,35 @@ fn save_to_existing(
|
||||||
|
|
||||||
// Check for one directly before the `ilst` atom
|
// Check for one directly before the `ilst` atom
|
||||||
if ilst_idx > 0 {
|
if ilst_idx > 0 {
|
||||||
let previous_atom = &tree[ilst_idx - 1];
|
let mut i = ilst_idx;
|
||||||
|
while i != 0 {
|
||||||
|
let atom = &tree[i - 1];
|
||||||
|
if atom.ident != AtomIdent::Fourcc(*b"free") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if previous_atom.ident == AtomIdent::Fourcc(*b"free") {
|
available_space += atom.len;
|
||||||
range_start = previous_atom.start;
|
range_start = atom.start;
|
||||||
available_space += previous_atom.len;
|
i -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log::trace!("Found {} preceding `free` atoms", ilst_idx - i)
|
||||||
}
|
}
|
||||||
|
|
||||||
// And after
|
// And after
|
||||||
if ilst_idx != tree.len() - 1 {
|
if ilst_idx != tree.len() - 1 {
|
||||||
let next_atom = &tree[ilst_idx + 1];
|
let mut i = ilst_idx;
|
||||||
|
while i < tree.len() - 1 {
|
||||||
|
let atom = &tree[i + 1];
|
||||||
|
if atom.ident != AtomIdent::Fourcc(*b"free") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if next_atom.ident == AtomIdent::Fourcc(*b"free") {
|
available_space += atom.len;
|
||||||
available_space += next_atom.len;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log::trace!("Found {} succeeding `free` atoms", i - ilst_idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
let ilst_len = ilst.len() as u64;
|
let ilst_len = ilst.len() as u64;
|
||||||
|
|
Loading…
Reference in a new issue