Improve Matroska API

Make AttachedFile immutable. This is consistent with SimpleTag and
Chapter and avoids using attached files which do not have all required
attributes.
Provide methods to insert and remove a single simple tag, so that
they can be modified without setting all of them while still not
exposing internal lists to the API.
Use DATE_RECORDED instead of DATE_RELEASED for year() and the "DATE"
property. This is more consistent with other tag formats, e.g. for ID3v2
"TDRC" is used, which is the recording time.
This commit is contained in:
Urs Fleisch
2026-01-02 09:17:12 +01:00
parent 68a514f4a0
commit f4e7a742c3
10 changed files with 99 additions and 124 deletions

View File

@ -36,12 +36,8 @@ int main(int argc, char *argv[])
TagLib::FileStream image(argv[2]);
auto data = image.readBlock(image.length());
auto attachments = file.attachments(true);
TagLib::Matroska::AttachedFile attachedFile;
attachedFile.setFileName("cover.jpg");
attachedFile.setMediaType("image/jpeg");
attachedFile.setData(data);
//attachedFile.setUID(5081000385627515072ull);
attachments->addAttachedFile(attachedFile);
attachments->addAttachedFile(TagLib::Matroska::AttachedFile(
data, "cover.jpg", "image/jpeg"));
file.save();