5 #include "../diagnostics.h"
7 #include <c++utilities/conversion/stringbuilder.h>
24 MatroskaChapter::MatroskaChapter(
EbmlElement *chapterAtomElement)
25 : m_chapterAtomElement(chapterAtomElement)
45 static const string context(
"parsing \"ChapterAtom\"-element");
48 for (
EbmlElement *chapterAtomChild = m_chapterAtomElement->
firstChild(); chapterAtomChild; chapterAtomChild = chapterAtomChild->nextSibling()) {
49 chapterAtomChild->parse(diag);
50 switch (chapterAtomChild->id()) {
52 m_id = chapterAtomChild->readUInteger();
57 m_startTime = TimeSpan(chapterAtomChild->readUInteger() / 100);
60 m_endTime = TimeSpan(chapterAtomChild->readUInteger() / 100);
63 m_hidden = chapterAtomChild->readUInteger() == 1;
66 m_enabled = chapterAtomChild->readUInteger() == 1;
74 chapterTrackElement = chapterTrackElement->nextSibling()) {
75 chapterTrackElement->parse(diag);
76 switch (chapterTrackElement->id()) {
78 m_tracks.emplace_back(chapterTrackElement->readUInteger());
81 diag.emplace_back(DiagLevel::Warning,
82 "\"ChapterTrack\"-element contains unknown child element \"" % chapterAtomChild->idToString() +
"\". It will be ignored.",
90 chapterDisplayElement = chapterDisplayElement->nextSibling()) {
91 chapterDisplayElement->parse(diag);
92 switch (chapterDisplayElement->id()) {
95 m_names.back().assign(chapterDisplayElement->readString());
97 diag.emplace_back(DiagLevel::Warning,
98 "\"ChapterDisplay\"-element contains multiple \"ChapString\"-elements. Surplus occurrences will be ignored.", context);
102 m_names.back().languages().emplace_back(chapterDisplayElement->readString());
105 diag.emplace_back(DiagLevel::Warning,
106 "\"ChapterDisplay\"-element contains a \"ChapLanguageIETF\"-element which is not supported yet. It will be ignored.",
110 m_names.back().countries().emplace_back(chapterDisplayElement->readString());
118 m_nestedChapters.emplace_back(make_unique<MatroskaChapter>(chapterAtomChild));
121 diag.emplace_back(DiagLevel::Warning,
122 "\"ChapterAtom\"-element contains unknown child element \"" % chapterAtomChild->idToString() +
"\". It will be ignored.", context);
127 if (name.languages().empty()) {
128 name.languages().emplace_back(
"eng");
136 m_nestedChapters.clear();