Skip to content

Commit

Permalink
mp4: Consider track/disc number <= 0 as invalid and missing
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Jan 13, 2024
1 parent 5b3c26d commit e65fec4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/mp4/ilst/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,16 +599,24 @@ impl SplitTag for Ilst {
let current = u16::from_be_bytes([data[2], data[3]]);
let total = u16::from_be_bytes([data[4], data[5]]);

tag.insert_text(ItemKey::TrackNumber, current.to_string());
tag.insert_text(ItemKey::TrackTotal, total.to_string());
if current > 0 {
tag.insert_text(ItemKey::TrackNumber, current.to_string());
}
if total > 0 {
tag.insert_text(ItemKey::TrackTotal, total.to_string());
}
return false; // Atom consumed
},
b"disk" => {
let current = u16::from_be_bytes([data[2], data[3]]);
let total = u16::from_be_bytes([data[4], data[5]]);

tag.insert_text(ItemKey::DiscNumber, current.to_string());
tag.insert_text(ItemKey::DiscTotal, total.to_string());
if current > 0 {
tag.insert_text(ItemKey::DiscNumber, current.to_string());
}
if total > 0 {
tag.insert_text(ItemKey::DiscTotal, total.to_string());
}
return false; // Atom consumed
},
_ => {},
Expand Down

0 comments on commit e65fec4

Please sign in to comment.