diff --git a/src/common/tag_common.cpp b/src/common/tag_common.cpp index e12edcd1e..22ffd714f 100644 --- a/src/common/tag_common.cpp +++ b/src/common/tag_common.cpp @@ -37,7 +37,11 @@ using namespace libmatroska; void fix_mandatory_tag_elements(EbmlElement *e) { - if (dynamic_cast(e) != NULL) { + if (dynamic_cast(e) != NULL) { + KaxTag &t = *static_cast(e); + GetChild(t); + + } else if (dynamic_cast(e) != NULL) { KaxTagSimple &s = *static_cast(e); GetChild(s); GetChild(s); diff --git a/src/merge/mkvmerge.cpp b/src/merge/mkvmerge.cpp index 13fa19410..ee3d963a9 100644 --- a/src/merge/mkvmerge.cpp +++ b/src/merge/mkvmerge.cpp @@ -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(*tag); - found = true; - if (FINDFIRST(targets, KaxTagTrackUID) == NULL) { - *(static_cast(&GetChild(*targets))) = - 1; - found = false; + tag = dynamic_cast((*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;