mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-23 19:31:44 +00:00
Do not add a TrackUID target for global tags.
This commit is contained in:
parent
f426fea17a
commit
40b6c41a9b
@ -37,7 +37,11 @@ using namespace libmatroska;
|
||||
|
||||
void
|
||||
fix_mandatory_tag_elements(EbmlElement *e) {
|
||||
if (dynamic_cast<KaxTagSimple *>(e) != NULL) {
|
||||
if (dynamic_cast<KaxTag *>(e) != NULL) {
|
||||
KaxTag &t = *static_cast<KaxTag *>(e);
|
||||
GetChild<KaxTagTargets>(t);
|
||||
|
||||
} else if (dynamic_cast<KaxTagSimple *>(e) != NULL) {
|
||||
KaxTagSimple &s = *static_cast<KaxTagSimple *>(e);
|
||||
GetChild<KaxTagLangue>(s);
|
||||
GetChild<KaxTagDefault>(s);
|
||||
|
@ -401,30 +401,22 @@ void
|
||||
parse_and_add_tags(const string &file_name) {
|
||||
KaxTags *tags;
|
||||
KaxTag *tag;
|
||||
KaxTagTargets *targets;
|
||||
bool found;
|
||||
|
||||
tags = new KaxTags;
|
||||
|
||||
parse_xml_tags(file_name, tags);
|
||||
|
||||
while (tags->ListSize() > 0) {
|
||||
tag = (KaxTag *)(*tags)[0];
|
||||
targets = &GetChild<KaxTagTargets>(*tag);
|
||||
found = true;
|
||||
if (FINDFIRST(targets, KaxTagTrackUID) == NULL) {
|
||||
*(static_cast<EbmlUInteger *>(&GetChild<KaxTagTrackUID>(*targets))) =
|
||||
1;
|
||||
found = false;
|
||||
tag = dynamic_cast<KaxTag *>((*tags)[0]);
|
||||
if (NULL != tag) {
|
||||
fix_mandatory_tag_elements(tag);
|
||||
if (!tag->CheckMandatory())
|
||||
mxerror(_("Error parsing the tags in '%s': some mandatory "
|
||||
"elements are missing.\n"), file_name.c_str());
|
||||
add_tags(tag);
|
||||
}
|
||||
fix_mandatory_tag_elements(tag);
|
||||
if (!tag->CheckMandatory())
|
||||
mxerror(_("Error parsing the tags in '%s': some mandatory "
|
||||
"elements are missing.\n"), file_name.c_str());
|
||||
if (!found)
|
||||
targets->Remove(targets->ListSize() - 1);
|
||||
|
||||
tags->Remove(0);
|
||||
add_tags(tag);
|
||||
}
|
||||
|
||||
delete tags;
|
||||
|
Loading…
Reference in New Issue
Block a user