diff options
author | whatdoineed2do/Ray <whatdoineed2do@nospam.gmail.com> | 2019-07-13 16:00:58 +0100 |
---|---|---|
committer | whatdoineed2do/Ray <whatdoineed2do@nospam.gmail.com> | 2019-07-13 16:03:51 +0100 |
commit | 850a3565a4dc7ae06b568c2fc11fce874bb0325a (patch) | |
tree | 4876df3a86555cd76121704f2461d96d9ba4fe7a | |
parent | ba7adc2bc261ed634c2a964185bcffb9365ad2f4 (diff) |
setTrack()/setYear() accepts 0 to remove the tag as per
documentation/functionality across other tpyes (mp3/flac/...); m4a do not honour
this and instead sets the underlying value to 0.
This commit fixes this issue (#911)
-rw-r--r-- | taglib/mp4/mp4tag.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/taglib/mp4/mp4tag.cpp b/taglib/mp4/mp4tag.cpp index 9b137cd9..bc95ad10 100644 --- a/taglib/mp4/mp4tag.cpp +++ b/taglib/mp4/mp4tag.cpp @@ -805,13 +805,23 @@ MP4::Tag::setGenre(const String &value) void MP4::Tag::setYear(unsigned int value) { - d->items["\251day"] = StringList(String::number(value)); + if (value == 0) { + d->items.erase("\251day"); + } + else { + d->items["\251day"] = StringList(String::number(value)); + } } void MP4::Tag::setTrack(unsigned int value) { - d->items["trkn"] = MP4::Item(value, 0); + if (value == 0) { + d->items.erase("trkn"); + } + else { + d->items["trkn"] = MP4::Item(value, 0); + } } bool MP4::Tag::isEmpty() const |