From b3a175ae647364459426c6323729c07cdeb0274a Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sat, 30 Aug 2003 13:50:00 +0000 Subject: [PATCH] Rewrote mkvinfo to use libebml's Read() function instead of manually reading each and every element. --- ChangeLog | 3 + src/mkvinfo.cpp | 1772 +++++++---------------------------------------- 2 files changed, 270 insertions(+), 1505 deletions(-) diff --git a/ChangeLog b/ChangeLog index deb48fe34..a3be26a0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2003-08-30 Moritz Bunkus + * mkvinfo: Rewrote mkvinfo to use libebml's Read() function + instead of manually reading each and every element. + * mkvmerge: Added support for XML based chapter files. 2003-08-29 Moritz Bunkus diff --git a/src/mkvinfo.cpp b/src/mkvinfo.cpp index 919863c2e..5deba19b3 100644 --- a/src/mkvinfo.cpp +++ b/src/mkvinfo.cpp @@ -246,11 +246,7 @@ void parse_args(int argc, char **argv, char *&file_name, bool &use_gui) { (p->GetElementPosition() + p->ElementSize())) #define is_id(e, c) (EbmlId(*(e)) == c::ClassInfos.GlobalId) -#define is_global(l, lvl, ule) _is_global(l, es, lvl, ule) -bool _is_global(EbmlElement *l, EbmlStream *es, int level, int &upper_lvl_el) { - if (upper_lvl_el < 0) - upper_lvl_el = 0; - +bool is_global(EbmlStream *es, EbmlElement *l, int level) { if (is_id(l, EbmlVoid)) { show_element(l, level, "EbmlVoid"); @@ -265,23 +261,21 @@ bool _is_global(EbmlElement *l, EbmlStream *es, int level, int &upper_lvl_el) { return false; } -bool parse_multicomment(EbmlStream *es, EbmlElement *l0, int level, - int &upper_lvl_el, EbmlElement *&l_upper, - mm_io_c *in) { +bool parse_multicomment(EbmlStream *es, EbmlElement *l0, int level) { + EbmlMaster *m0; EbmlElement *l1; + int i0; if (is_id(l0, KaxTagMultiComment)) { show_element(l0, level, "Multi comment"); - upper_lvl_el = 0; - l1 = es->FindNextElement(l0->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l1 != NULL) && (upper_lvl_el <= 0)) { + m0 = static_cast(l0); + for (i0 = 0; i0 < m0->ListSize(); i0++) { + l1 = (*m0)[i0]; if (is_id(l1, KaxTagMultiCommentName)) { KaxTagMultiCommentName &c_name = *static_cast(l1); - c_name.ReadData(es->I_O()); show_element(l1, level + 1, "Name: %s", string(c_name).c_str()); } else if (is_id(l1, KaxTagMultiCommentComments)) { @@ -289,7 +283,6 @@ bool parse_multicomment(EbmlStream *es, EbmlElement *l0, int level, KaxTagMultiCommentComments &c_comments = *static_cast(l1); - c_comments.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(c_comments)); show_element(l1, level + 1, "Comments: %s", str); safefree(str); @@ -297,30 +290,12 @@ bool parse_multicomment(EbmlStream *es, EbmlElement *l0, int level, } else if (is_id(l1, KaxTagMultiCommentLanguage)) { KaxTagMultiCommentLanguage &c_language = *static_cast(l1); - c_language.ReadData(es->I_O()); show_element(l1, level + 1, "Language: %s", string(c_language).c_str()); - } else if (!is_global(l1, level + 1, upper_lvl_el)) + } else if (!is_global(es, l1, level + 1)) show_unknown_element(l1, level + 1); - if (!in_parent(l0)) { - delete l1; - break; - } - - if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l1->SkipData(*es, l1->Generic().Context); - delete l1; - l1 = es->FindNextElement(l0->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l1 != NULL) return true; @@ -330,29 +305,26 @@ bool parse_multicomment(EbmlStream *es, EbmlElement *l0, int level, return false; } -bool parse_chapter_atom(EbmlStream *es, EbmlElement *l0, int level, - int &upper_lvl_el, EbmlElement *&l_upper, - mm_io_c *in) { - EbmlElement *l1 = NULL, *l2 = NULL, *l3 = NULL; +bool parse_chapter_atom(EbmlStream *es, EbmlElement *l0, int level) { + EbmlMaster *m0, *m1; + EbmlElement *l1, *l2; + int i0, i1; if (is_id(l0, KaxChapterAtom)) { show_element(l0, level, "Chapter atom"); - upper_lvl_el = 0; - l1 = es->FindNextElement(l0->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l1 != NULL) && (upper_lvl_el <= 0)) { + m0 = static_cast(l0); + for (i0 = 0; i0 < m0->ListSize(); i0++) { + l1 = (*m0)[i0]; if (is_id(l1, KaxChapterUID)) { KaxChapterUID &c_uid = *static_cast(l1); - c_uid.ReadData(es->I_O()); show_element(l1, level + 1, "UID: %u", uint32(c_uid)); } else if (is_id(l1, KaxChapterTimeStart)) { uint64_t s; KaxChapterTimeStart &start = *static_cast(l1); - start.ReadData(es->I_O()); s = uint64(start) / 1000000; show_element(l1, level + 1, "Start: %02llu:%02llu:%02llu.%03llu", (s / 1000 / 60 / 60), (s / 1000 / 60) % 60, @@ -362,7 +334,6 @@ bool parse_chapter_atom(EbmlStream *es, EbmlElement *l0, int level, uint64_t e; KaxChapterTimeEnd &end = *static_cast(l1); - end.ReadData(es->I_O()); e = uint64(end) / 1000000; show_element(l1, level + 1, "End: %02llu:%02llu:%02llu.%03llu", (e / 1000 / 60 / 60), (e / 1000 / 60) % 60, @@ -371,62 +342,31 @@ bool parse_chapter_atom(EbmlStream *es, EbmlElement *l0, int level, } else if (is_id(l1, KaxChapterTrack)) { show_element(l1, level + 1, "Track"); - upper_lvl_el = 0; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l2 != NULL) && (upper_lvl_el <= 0)) { + m1 = static_cast(l1); + for (i1 = 0; i1 < m1->ListSize(); i1++) { + l2 = (*m1)[i1]; if (is_id(l2, KaxChapterTrackNumber)) { KaxChapterTrackNumber &c_tnumber = *static_cast(l2); - c_tnumber.ReadData(es->I_O()); show_element(l2, level + 2, "Track number: %u", uint32(c_tnumber)); - } else if (!parse_chapter_atom(es, l2, level + 2, upper_lvl_el, l3, - in) && - !is_global(l2, level + 2, upper_lvl_el)) + } else if (!is_global(es, l2, level + 2)) show_unknown_element(l2, level + 2); - if (!in_parent(l1)) { - delete l2; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l2; - l2 = l3; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l2->SkipData(*es, l2->Generic().Context); - delete l2; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l2 != NULL) } else if (is_id(l1, KaxChapterDisplay)) { show_element(l1, level + 1, "Display"); - upper_lvl_el = 0; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l2 != NULL) && (upper_lvl_el <= 0)) { + m1 = static_cast(l1); + for (i1 = 0; i1 < m1->ListSize(); i1++) { + l2 = (*m1)[i1]; if (is_id(l2, KaxChapterString)) { char *str; KaxChapterString &c_string = *static_cast(l2); - c_string.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(c_string)); show_element(l2, level + 2, "String: %s", str); safefree(str); @@ -434,79 +374,24 @@ bool parse_chapter_atom(EbmlStream *es, EbmlElement *l0, int level, } else if (is_id(l2, KaxChapterLanguage)) { KaxChapterLanguage &c_lang = *static_cast(l2); - c_lang.ReadData(es->I_O()); show_element(l2, level + 2, "Language: %s", string(c_lang).c_str()); } else if (is_id(l2, KaxChapterCountry)) { KaxChapterCountry &c_country = *static_cast(l2); - c_country.ReadData(es->I_O()); show_element(l2, level + 2, "Country: %s", string(c_country).c_str()); - } else if (!parse_chapter_atom(es, l2, level + 2, upper_lvl_el, l3, - in) && - !is_global(l2, level + 2, upper_lvl_el)) + } else if (!is_global(es, l2, level + 2)) show_unknown_element(l2, level + 2); - if (!in_parent(l1)) { - delete l2; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l2; - l2 = l3; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l2->SkipData(*es, l2->Generic().Context); - delete l2; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l2 != NULL) - } else if (!parse_chapter_atom(es, l1, level + 1, upper_lvl_el, l2, in) - && - !is_global(l1, level + 1, upper_lvl_el)) + } else if (!parse_chapter_atom(es, l1, level + 1) && + !is_global(es, l1, level + 1)) show_unknown_element(l1, level + 1); - if (!in_parent(l0)) { - delete l1; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l1; - l1 = l2; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l1->SkipData(*es, l1->Generic().Context); - delete l1; - l1 = es->FindNextElement(l0->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l1 != NULL) return true; @@ -576,15 +461,55 @@ uint32_t calc_adler32(const unsigned char *buffer, int size) { // }}} +void sort_master(EbmlMaster &m) { + int i, sp_idx; + vector tmp; + int64_t smallest_pos; + + while (m.ListSize() > 0) { + sp_idx = 0; + smallest_pos = m[0]->GetElementPosition(); + + for (i = 1; i < m.ListSize(); i++) + if (m[i]->GetElementPosition() < smallest_pos) { + sp_idx = i; + smallest_pos = m[i]->GetElementPosition(); + } + + tmp.push_back(m[sp_idx]); + m.Remove(sp_idx); + } + + for (i = 0; i < tmp.size(); i++) { + m.PushElement(*tmp[i]); + try { + EbmlMaster *m2 = &dynamic_cast(*tmp[i]); + sort_master(*m2); + } catch(...) { + } + } +} + +void read_master(EbmlMaster *m, EbmlStream *es, const EbmlSemanticContext &ctx, + int &upper_lvl_el, EbmlElement *&l2) { + + m->Read(*es, ctx, upper_lvl_el, l2, false); + if (m->ListSize() == 0) + return; + + sort_master(*m); +} + bool process_file(const char *file_name) { int upper_lvl_el, i; // Elements for different levels EbmlElement *l0 = NULL, *l1 = NULL, *l2 = NULL, *l3 = NULL, *l4 = NULL; - EbmlElement *l5 = NULL, *l6 = NULL, *l7 = NULL; + EbmlElement *l5 = NULL, *l6 = NULL; EbmlStream *es; + EbmlMaster *m1, *m2, *m3, *m4, *m5; KaxCluster *cluster; uint64_t cluster_tc, tc_scale = TIMECODE_SCALE, file_size, lf_timecode; - int lf_tnum; + int lf_tnum, i1, i2, i3, i4, i5; char kax_track_type; bool ms_compat, bref_found, fref_found; char *str; @@ -651,32 +576,30 @@ bool process_file(const char *file_name) { show_element(l1, 1, "Segment information"); upper_lvl_el = 0; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l2 != NULL) && (upper_lvl_el <= 0)) { + m1 = static_cast(l1); + read_master(m1, es, l1->Generic().Context, upper_lvl_el, l3); + + for (i1 = 0; i1 < m1->ListSize(); i1++) { + l2 = (*m1)[i1]; if (is_id(l2, KaxTimecodeScale)) { KaxTimecodeScale &ktc_scale = *static_cast(l2); - ktc_scale.ReadData(es->I_O()); tc_scale = uint64(ktc_scale); show_element(l2, 2, "Timecode scale: %llu", tc_scale); } else if (is_id(l2, KaxDuration)) { KaxDuration &duration = *static_cast(l2); - duration.ReadData(es->I_O()); show_element(l2, 2, "Duration: %.3fs", float(duration) * tc_scale / 1000000000.0); } else if (is_id(l2, KaxMuxingApp)) { KaxMuxingApp &muxingapp = *static_cast(l2); - muxingapp.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(muxingapp)); show_element(l2, 2, "Muxing application: %s", str); safefree(str); } else if (is_id(l2, KaxWritingApp)) { KaxWritingApp &writingapp = *static_cast(l2); - writingapp.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(writingapp)); show_element(l2, 2, "Writing application: %s", str); safefree(str); @@ -686,7 +609,6 @@ bool process_file(const char *file_name) { time_t temptime; char buffer[40]; KaxDateUTC &dateutc = *static_cast(l2); - dateutc.ReadData(es->I_O()); temptime = dateutc.GetEpochDate(); if ((gmtime_r(&temptime, &tmutc) != NULL) && (asctime_r(&tmutc, buffer) != NULL)) { @@ -697,7 +619,6 @@ bool process_file(const char *file_name) { } else if (is_id(l2, KaxSegmentUID)) { KaxSegmentUID &uid = *static_cast(l2); - uid.ReadData(es->I_O()); char buffer[uid.GetSize() * 5 + 1]; const unsigned char *b = (const unsigned char *)&binary(uid); buffer[0] = 0; @@ -707,7 +628,6 @@ bool process_file(const char *file_name) { } else if (is_id(l2, KaxPrevUID)) { KaxPrevUID &uid = *static_cast(l2); - uid.ReadData(es->I_O()); char buffer[uid.GetSize() * 5 + 1]; const unsigned char *b = (const unsigned char *)&binary(uid); buffer[0] = 0; @@ -717,14 +637,12 @@ bool process_file(const char *file_name) { } else if (is_id(l2, KaxPrevFilename)) { KaxPrevFilename &filename = *static_cast(l2); - filename.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(filename)); show_element(l2, 2, "Previous filename: %s", str); safefree(str); } else if (is_id(l2, KaxNextUID)) { KaxNextUID &uid = *static_cast(l2); - uid.ReadData(es->I_O()); char buffer[uid.GetSize() * 5 + 1]; const unsigned char *b = (const unsigned char *)&binary(uid); buffer[0] = 0; @@ -734,7 +652,6 @@ bool process_file(const char *file_name) { } else if (is_id(l2, KaxNextFilename)) { KaxNextFilename &filename = *static_cast(l2); - filename.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(filename)); show_element(l2, 2, "Next filename: %s", str); safefree(str); @@ -743,7 +660,6 @@ bool process_file(const char *file_name) { char *str; KaxSegmentFilename &filename = *static_cast(l2); - filename.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(filename)); show_element(l2, 2, "Segment filename: %s", str); safefree(str); @@ -751,38 +667,12 @@ bool process_file(const char *file_name) { } else if (is_id(l2, KaxTitle)) { char *str; KaxTitle &title = *static_cast(l2); - title.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(title)); show_element(l2, 2, "Title: %s", str); safefree(str); - } else if (!is_global(l2, 2, upper_lvl_el)) - show_unknown_element(l2, 2); - - if (!in_parent(l1)) { - delete l2; - break; } - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l2; - l2 = l3; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l2->SkipData(*es, l2->Generic().Context); - delete l2; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); } } else if (is_id(l1, KaxTracks)) { @@ -791,9 +681,11 @@ bool process_file(const char *file_name) { show_element(l1, 1, "Segment tracks"); upper_lvl_el = 0; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l2 != NULL) && (upper_lvl_el <= 0)) { + m1 = static_cast(l1); + read_master(m1, es, l1->Generic().Context, upper_lvl_el, l3); + + for (i1 = 0; i1 < m1->ListSize(); i1++) { + l2 = (*m1)[i1]; if (is_id(l2, KaxTrackEntry)) { // We actually found a track entry :) We're happy now. @@ -802,40 +694,33 @@ bool process_file(const char *file_name) { kax_track_type = '?'; ms_compat = false; - upper_lvl_el = 0; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l3 != NULL) && (upper_lvl_el <= 0)) { + m2 = static_cast(l2); + for (i2 = 0; i2 < m2->ListSize(); i2++) { + l3 = (*m2)[i2]; // Now evaluate the data belonging to this track if (is_id(l3, KaxTrackAudio)) { show_element(l3, 3, "Audio track"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxAudioSamplingFreq)) { KaxAudioSamplingFreq &freq = *static_cast(l4); - freq.ReadData(es->I_O()); show_element(l4, 4, "Sampling frequency: %f", float(freq)); -#if LIBMATROSKA_VERSION >= 000501 } else if (is_id(l4, KaxAudioOutputSamplingFreq)) { KaxAudioOutputSamplingFreq &ofreq = *static_cast(l4); - ofreq.ReadData(es->I_O()); show_element(l4, 4, "Output sampling frequency: %f", float(ofreq)); -#endif } else if (is_id(l4, KaxAudioChannels)) { KaxAudioChannels &channels = *static_cast(l4); - channels.ReadData(es->I_O()); show_element(l4, 4, "Channels: %u", uint8(channels)); } else if (is_id(l4, KaxAudioPosition)) { @@ -852,67 +737,43 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxAudioBitDepth)) { KaxAudioBitDepth &bps = *static_cast(l4); - bps.ReadData(es->I_O()); show_element(l4, 4, "Bit depth: %u", uint8(bps)); - } else if (!is_global(l4, 4, upper_lvl_el)) + } else if (!is_global(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, true); - } // while (l4 != NULL) } else if (is_id(l3, KaxTrackVideo)) { show_element(l3, 3, "Video track"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxVideoPixelWidth)) { KaxVideoPixelWidth &width = *static_cast(l4); - width.ReadData(es->I_O()); show_element(l4, 4, "Pixel width: %u", uint16(width)); } else if (is_id(l4, KaxVideoPixelHeight)) { KaxVideoPixelHeight &height = *static_cast(l4); - height.ReadData(es->I_O()); show_element(l4, 4, "Pixel height: %u", uint16(height)); } else if (is_id(l4, KaxVideoDisplayWidth)) { KaxVideoDisplayWidth &width = *static_cast(l4); - width.ReadData(es->I_O()); show_element(l4, 4, "Display width: %u", uint16(width)); } else if (is_id(l4, KaxVideoDisplayHeight)) { KaxVideoDisplayHeight &height = *static_cast(l4); - height.ReadData(es->I_O()); show_element(l4, 4, "Display height: %u", uint16(height)); } else if (is_id(l4, KaxVideoDisplayUnit)) { KaxVideoDisplayUnit &unit = *static_cast(l4); - unit.ReadData(es->I_O()); show_element(l4, 4, "Display unit: %u%s", uint16(unit), uint16(unit) == 0 ? " (pixels)" : uint16(unit) == 1 ? " (centimeters)" : @@ -921,7 +782,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxVideoColourSpace)) { KaxVideoColourSpace &cspace = *static_cast(l4); - cspace.ReadData(es->I_O()); char buffer[cspace.GetSize() * 5 + 1]; const unsigned char *b = (const unsigned char *) &binary(cspace); @@ -933,26 +793,22 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxVideoGamma)) { KaxVideoGamma &gamma = *static_cast(l4); - gamma.ReadData(es->I_O()); show_element(l4, 4, "Gamma: %f", float(gamma)); } else if (is_id(l4, KaxVideoFrameRate)) { KaxVideoFrameRate &framerate = *static_cast(l4); - framerate.ReadData(es->I_O()); show_element(l4, 4, "Frame rate: %f", float(framerate)); } else if (is_id(l4, KaxVideoFlagInterlaced)) { KaxVideoFlagInterlaced &f_interlaced = *static_cast(l4); - f_interlaced.ReadData(es->I_O()); show_element(l4, 4, "Interlaced: %u", uint8(f_interlaced)); } else if (is_id(l4, KaxVideoStereoMode)) { KaxVideoStereoMode &stereo = *static_cast(l4); - stereo.ReadData(es->I_O()); show_element(l4, 4, "Stereo mode: %u%s", uint8(stereo), uint8(stereo) == 0 ? " (mono)" : uint8(stereo) == 1 ? " (right eye)" : @@ -962,38 +818,20 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxVideoAspectRatio)) { KaxVideoAspectRatio &ar_type = *static_cast(l4); - ar_type.ReadData(es->I_O()); show_element(l4, 4, "Aspect ratio type: %u%s", uint8(ar_type), uint8(ar_type) == 0 ? " (free resizing)" : uint8(ar_type) == 1 ? " (keep aspect ratio)" : uint8(ar_type) == 2 ? " (fixed)" : ""); - } else if (!is_global(l4, 4, upper_lvl_el)) + } else if (!is_global(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, true); } // while (l4 != NULL) } else if (is_id(l3, KaxTrackNumber)) { KaxTrackNumber &tnum = *static_cast(l3); - tnum.ReadData(es->I_O()); show_element(l3, 3, "Track number: %u", uint32(tnum)); if (find_track(uint32(tnum)) != NULL) show_warning(3, "Warning: There's more than one " @@ -1001,7 +839,6 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxTrackUID)) { KaxTrackUID &tuid = *static_cast(l3); - tuid.ReadData(es->I_O()); show_element(l3, 3, "Track UID: %u", uint32(tuid)); if (find_track_by_uid(uint32(tuid)) != NULL) show_warning(3, "Warning: There's more than one " @@ -1009,7 +846,6 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxTrackType)) { KaxTrackType &ttype = *static_cast(l3); - ttype.ReadData(es->I_O()); switch (uint8(ttype)) { case track_audio: @@ -1034,19 +870,16 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxTrackFlagEnabled)) { KaxTrackFlagEnabled &fenabled = *static_cast(l3); - fenabled.ReadData(es->I_O()); show_element(l3, 3, "Enabled: %u", uint8(fenabled)); } else if (is_id(l3, KaxTrackName)) { KaxTrackName &name = *static_cast(l3); - name.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(name)); show_element(l3, 3, "Name: %s", str); safefree(str); } else if (is_id(l3, KaxCodecID)) { KaxCodecID &codec_id = *static_cast(l3); - codec_id.ReadData(es->I_O()); show_element(l3, 3, "Codec ID: %s", string(codec_id).c_str()); if ((!strcmp(string(codec_id).c_str(), MKV_V_MSCOMP) && (kax_track_type == 'v')) || @@ -1057,7 +890,6 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxCodecPrivate)) { char pbuffer[100]; KaxCodecPrivate &c_priv = *static_cast(l3); - c_priv.ReadData(es->I_O()); if (ms_compat && (kax_track_type == 'v') && (c_priv.GetSize() >= sizeof(alBITMAPINFOHEADER))) { alBITMAPINFOHEADER *bih = @@ -1078,7 +910,6 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxCodecName)) { KaxCodecName &c_name = *static_cast(l3); - c_name.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(c_name)); show_element(l3, 3, "Codec name: %s", str); safefree(str); @@ -1086,7 +917,6 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxCodecSettings)) { KaxCodecSettings &c_sets = *static_cast(l3); - c_sets.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(c_sets)); show_element(l3, 3, "Codec settings: %s", str); safefree(str); @@ -1094,45 +924,38 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxCodecInfoURL)) { KaxCodecInfoURL &c_infourl = *static_cast(l3); - c_infourl.ReadData(es->I_O()); show_element(l3, 3, "Codec info URL: %s", string(c_infourl).c_str()); } else if (is_id(l3, KaxCodecDownloadURL)) { KaxCodecDownloadURL &c_downloadurl = *static_cast(l3); - c_downloadurl.ReadData(es->I_O()); show_element(l3, 3, "Codec download URL: %s", string(c_downloadurl).c_str()); } else if (is_id(l3, KaxCodecDecodeAll)) { KaxCodecDecodeAll &c_decodeall = *static_cast(l3); - c_decodeall.ReadData(es->I_O()); show_element(l3, 3, "Codec decode all: %u", uint16(c_decodeall)); } else if (is_id(l3, KaxTrackOverlay)) { KaxTrackOverlay &overlay = *static_cast(l3); - overlay.ReadData(es->I_O()); show_element(l3, 3, "Track overlay: %u", uint16(overlay)); } else if (is_id(l3, KaxTrackMinCache)) { KaxTrackMinCache &min_cache = *static_cast(l3); - min_cache.ReadData(es->I_O()); show_element(l3, 3, "MinCache: %u", uint32(min_cache)); } else if (is_id(l3, KaxTrackMaxCache)) { KaxTrackMaxCache &max_cache = *static_cast(l3); - max_cache.ReadData(es->I_O()); show_element(l3, 3, "MaxCache: %u", uint32(max_cache)); } else if (is_id(l3, KaxTrackDefaultDuration)) { KaxTrackDefaultDuration &def_duration = *static_cast(l3); - def_duration.ReadData(es->I_O()); show_element(l3, 3, "Default duration: %.3fms (%.3f fps for " "a video track)", (float)uint64(def_duration) / 1000000.0, @@ -1141,79 +964,26 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxTrackFlagLacing)) { KaxTrackFlagLacing &f_lacing = *static_cast(l3); - f_lacing.ReadData(es->I_O()); show_element(l3, 3, "Lacing flag: %d", uint32(f_lacing)); } else if (is_id(l3, KaxTrackFlagDefault)) { KaxTrackFlagDefault &f_default = *static_cast(l3); - f_default.ReadData(es->I_O()); show_element(l3, 3, "Default flag: %d", uint32(f_default)); } else if (is_id(l3, KaxTrackLanguage)) { KaxTrackLanguage &language = *static_cast(l3); - language.ReadData(es->I_O()); show_element(l3, 3, "Language: %s", string(language).c_str()); - } else if (!is_global(l3, 3, upper_lvl_el)) + } else if (!is_global(es, l3, 3)) show_unknown_element(l3, 3); - if (!in_parent(l2)) { - delete l3; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l3; - l3 = l4; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l3->SkipData(*es, l3->Generic().Context); - delete l3; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l3 != NULL) - } else if (!is_global(l2, 2, upper_lvl_el)) + } else if (!is_global(es, l2, 2)) show_unknown_element(l2, 2); - if (!in_parent(l1)) { - delete l2; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l2; - l2 = l3; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l2->SkipData(*es, l2->Generic().Context); - delete l2; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l2 != NULL) } else if ((is_id(l1, KaxSeekHead)) && @@ -1223,24 +993,24 @@ bool process_file(const char *file_name) { show_element(l1, 1, "Seek head"); upper_lvl_el = 0; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l2 != NULL) && (upper_lvl_el <= 0)) { + m1 = static_cast(l1); + read_master(m1, es, l1->Generic().Context, upper_lvl_el, l3); + + for (i1 = 0; i1 < m1->ListSize(); i1++) { + l2 = (*m1)[i1]; if (is_id(l2, KaxSeek)) { show_element(l2, 2, "Seek entry"); - upper_lvl_el = 0; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l3 != NULL) && (upper_lvl_el <= 0)) { + m2 = static_cast(l2); + for (i2 = 0; i2 < m2->ListSize(); i2++) { + l3 = (*m2)[i2]; if (is_id(l3, KaxSeekID)) { binary *b; int s; char pbuffer[100]; KaxSeekID &seek_id = static_cast(*l3); - seek_id.ReadData(es->I_O()); b = seek_id.GetBuffer(); s = seek_id.GetSize(); EbmlId id(b, s); @@ -1270,61 +1040,17 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxSeekPosition)) { KaxSeekPosition &seek_pos = static_cast(*l3); - seek_pos.ReadData(es->I_O()); show_element(l3, 3, "Seek position: %llu", uint64(seek_pos)); - } else if (!is_global(l3, 3, upper_lvl_el)) + } else if (!is_global(es, l3, 3)) show_unknown_element(l3, 3); - if (!in_parent(l2)) { - delete l3; - break; - } - - if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l3->SkipData(*es, l3->Generic().Context); - delete l3; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - - } // while (l3 != NULL) - } else if (!is_global(l2, 2, upper_lvl_el)) + } else if (!is_global(es, l2, 2)) show_unknown_element(l2, 2); - if (!in_parent(l1)) { - delete l2; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l2; - l2 = l3; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l2->SkipData(*es, l2->Generic().Context); - delete l2; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l2 != NULL) } else if (is_id(l1, KaxCluster)) { @@ -1346,13 +1072,14 @@ bool process_file(const char *file_name) { #endif // HAVE_WXWINDOWS upper_lvl_el = 0; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l2 != NULL) && (upper_lvl_el <= 0)) { + m1 = static_cast(l1); + read_master(m1, es, l1->Generic().Context, upper_lvl_el, l3); + + for (i1 = 0; i1 < m1->ListSize(); i1++) { + l2 = (*m1)[i1]; if (is_id(l2, KaxClusterTimecode)) { KaxClusterTimecode &ctc = *static_cast(l2); - ctc.ReadData(es->I_O()); cluster_tc = uint64(ctc); show_element(l2, 2, "Cluster timecode: %.3fs", (float)cluster_tc * (float)tc_scale / 1000000000.0); @@ -1361,13 +1088,11 @@ bool process_file(const char *file_name) { } else if (is_id(l2, KaxClusterPosition)) { KaxClusterPosition &c_pos = *static_cast(l2); - c_pos.ReadData(es->I_O()); show_element(l2, 2, "Cluster position: %llu", uint64(c_pos)); } else if (is_id(l2, KaxClusterPrevSize)) { KaxClusterPrevSize &c_psize = *static_cast(l2); - c_psize.ReadData(es->I_O()); show_element(l2, 2, "Cluster previous size: %llu", uint64(c_psize)); @@ -1377,15 +1102,13 @@ bool process_file(const char *file_name) { bref_found = false; fref_found = false; - upper_lvl_el = 0; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, false); - while ((l3 != NULL) && (upper_lvl_el <= 0)) { + m2 = static_cast(l2); + for (i2 = 0; i2 < m2->ListSize(); i2++) { + l3 = (*m2)[i2]; if (is_id(l3, KaxBlock)) { char adler[100]; KaxBlock &block = *static_cast(l3); - block.ReadData(es->I_O()); block.SetParent(*cluster); show_element(l3, 3, "Block (track number %u, %d frame(s), " "timecode %.3fs)", block.TrackNum(), @@ -1407,7 +1130,6 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxBlockVirtual)) { char adler[100]; KaxBlockVirtual &bvirt = *static_cast(l3); - bvirt.ReadData(es->I_O()); adler[0] = 0; if (calc_checksums) mxprints(adler, " (adler: 0x%08x)", @@ -1418,14 +1140,12 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxBlockDuration)) { KaxBlockDuration &duration = *static_cast(l3); - duration.ReadData(es->I_O()); show_element(l3, 3, "Block duration: %.3fms", ((float)uint64(duration)) * tc_scale / 1000000.0); } else if (is_id(l3, KaxReferenceBlock)) { KaxReferenceBlock &reference = *static_cast(l3); - reference.ReadData(es->I_O()); show_element(l3, 3, "Reference block: %.3fms", ((float)int64(reference)) * tc_scale / 1000000.0); if (int64(reference) < 0) @@ -1436,37 +1156,32 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxReferencePriority)) { KaxReferencePriority &priority = *static_cast(l3); - priority.ReadData(es->I_O()); show_element(l3, 3, "Reference priority: %u", uint32(priority)); } else if (is_id(l3, KaxReferenceVirtual)) { KaxReferenceVirtual &ref_virt = *static_cast(l3); - ref_virt.ReadData(es->I_O()); show_element(l3, 3, "Reference virtual: %lld", int64(ref_virt)); } else if (is_id(l3, KaxBlockAdditions)) { show_element(l3, 3, "Additions"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, false); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxBlockMore)) { show_element(l4, 4, "More"); - upper_lvl_el = 0; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, false); - while ((l5 != NULL) && (upper_lvl_el <= 0)) { + m4 = static_cast(l4); + for (i4 = 0; i4 < m4->ListSize(); i4++) { + l5 = (*m4)[i4]; if (is_id(l5, KaxBlockAddID)) { KaxBlockAddID &add_id = *static_cast(l5); - add_id.ReadData(es->I_O()); show_element(l5, 5, "AdditionalID: %llu", uint64(add_id)); @@ -1474,7 +1189,6 @@ bool process_file(const char *file_name) { char adler[100]; KaxBlockAdditional &block = *static_cast(l5); - block.ReadData(es->I_O()); if (calc_checksums) mxprints(adler, " (adler: 0x%08x)", calc_adler32(&binary(block), @@ -1485,93 +1199,45 @@ bool process_file(const char *file_name) { show_element(l5, 5, "Block additional, size: %u%s", block.GetSize(), adler); - } else if (!is_global(l5, 5, upper_lvl_el)) + } else if (!is_global(es, l5, 5)) show_unknown_element(l5, 5); - if (!in_parent(l4)) { - delete l5; - break; - } - - if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l5->SkipData(*es, l5->Generic().Context); - delete l5; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, - true); - } // while (l5 != NULL) - } else if (!is_global(l4, 4, upper_lvl_el)) + } else if (!is_global(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l4 != NULL) } else if (is_id(l3, KaxSlices)) { show_element(l3, 3, "Slices"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, false); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxTimeSlice)) { show_element(l4, 4, "Time slice"); - upper_lvl_el = 0; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, false); - while ((l5 != NULL) && (upper_lvl_el <= 0)) { + m4 = static_cast(l4); + for (i4 = 0; i4 < m4->ListSize(); i4++) { + l5 = (*m4)[i4]; if (is_id(l5, KaxSliceLaceNumber)) { KaxSliceLaceNumber &slace_number = *static_cast(l5); - slace_number.ReadData(es->I_O()); show_element(l5, 5, "Lace number: %u", uint32(slace_number)); } else if (is_id(l5, KaxSliceFrameNumber)) { KaxSliceFrameNumber &sframe_number = *static_cast(l5); - sframe_number.ReadData(es->I_O()); show_element(l5, 5, "Frame number: %u", uint32(sframe_number)); } else if (is_id(l5, KaxSliceDelay)) { KaxSliceDelay &sdelay = *static_cast(l5); - sdelay.ReadData(es->I_O()); show_element(l5, 5, "Delay: %.3fms", ((float)uint64(sdelay)) * tc_scale / 1000000.0); @@ -1579,7 +1245,6 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxSliceDuration)) { KaxSliceDuration &sduration = *static_cast(l5); - sduration.ReadData(es->I_O()); show_element(l5, 5, "Duration: %.3fms", ((float)uint64(sduration)) * tc_scale / 1000000.0); @@ -1587,92 +1252,22 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxSliceBlockAddID)) { KaxSliceBlockAddID &sbaid = *static_cast(l5); - sbaid.ReadData(es->I_O()); show_element(l5, 5, "Block additional ID: %u", uint64(sbaid)); - } else if (!is_global(l5, 5, upper_lvl_el)) + } else if (!is_global(es, l5, 5)) show_unknown_element(l5, 5); - if (!in_parent(l4)) { - delete l5; - break; - } - - if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l5->SkipData(*es, l5->Generic().Context); - delete l5; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, - true); - } // while (l5 != NULL) - } else if (!is_global(l4, 4, upper_lvl_el)) + } else if (!is_global(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - - } // while (l4 != NULL) - } else if (!is_global(l3, 3, upper_lvl_el)) + } else if (!is_global(es, l3, 3)) show_unknown_element(l3, 3); - if (!in_parent(l2)) { - delete l3; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l3; - l3 = l4; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l3->SkipData(*es, l3->Generic().Context); - delete l3; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l3 != NULL) if (verbose > 2) @@ -1681,34 +1276,9 @@ bool process_file(const char *file_name) { bref_found ? 'P' : !fref_found ? 'I' : '?', lf_tnum, lf_timecode); - } else if (!is_global(l2, 2, upper_lvl_el)) + } else if (!is_global(es, l2, 2)) show_unknown_element(l2, 2); - if (!in_parent(l1)) { - delete l2; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l2; - l2 = l3; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l2->SkipData(*es, l2->Generic().Context); - delete l2; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l2 != NULL) } else if ((is_id(l1, KaxCues)) && @@ -1718,65 +1288,59 @@ bool process_file(const char *file_name) { show_element(l1, 1, "Cues"); upper_lvl_el = 0; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l2 != NULL) && (upper_lvl_el <= 0)) { + m1 = static_cast(l1); + read_master(m1, es, l1->Generic().Context, upper_lvl_el, l3); + + for (i1 = 0; i1 < m1->ListSize(); i1++) { + l2 = (*m1)[i1]; if (is_id(l2, KaxCuePoint)) { show_element(l2, 2, "Cue point"); - upper_lvl_el = 0; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l3 != NULL) && (upper_lvl_el <= 0)) { + m2 = static_cast(l2); + for (i2 = 0; i2 < m2->ListSize(); i2++) { + l3 = (*m2)[i2]; if (is_id(l3, KaxCueTime)) { KaxCueTime &cue_time = *static_cast(l3); - cue_time.ReadData(es->I_O()); show_element(l3, 3, "Cue time: %.3fs", tc_scale * ((float)uint64(cue_time)) / 1000000000.0); } else if (is_id(l3, KaxCueTrackPositions)) { show_element(l3, 3, "Cue track positions"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxCueTrack)) { KaxCueTrack &cue_track = *static_cast(l4); - cue_track.ReadData(es->I_O()); show_element(l4, 4, "Cue track: %u", uint32(cue_track)); } else if (is_id(l4, KaxCueClusterPosition)) { KaxCueClusterPosition &cue_cp = *static_cast(l4); - cue_cp.ReadData(es->I_O()); show_element(l4, 4, "Cue cluster position: %llu", uint64(cue_cp)); } else if (is_id(l4, KaxCueBlockNumber)) { KaxCueBlockNumber &cue_bn = *static_cast(l4); - cue_bn.ReadData(es->I_O()); show_element(l4, 4, "Cue block number: %llu", uint64(cue_bn)); } else if (is_id(l4, KaxCueCodecState)) { KaxCueCodecState &cue_cs = *static_cast(l4); - cue_cs.ReadData(es->I_O()); show_element(l4, 4, "Cue codec state: %llu", uint64(cue_cs)); } else if (is_id(l4, KaxCueReference)) { show_element(l4, 4, "Cue reference"); - upper_lvl_el = 0; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, true); - while ((l5 != NULL) && (upper_lvl_el <= 0)) { + m4 = static_cast(l4); + for (i4 = 0; i4 < m4->ListSize(); i4++) { + l5 = (*m4)[i4]; if (is_id(l5, KaxCueRefTime)) { KaxCueRefTime &cue_rt = @@ -1787,135 +1351,39 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxCueRefCluster)) { KaxCueRefCluster &cue_rc = *static_cast(l5); - cue_rc.ReadData(es->I_O()); show_element(l5, 5, "Cue ref cluster: %llu", uint64(cue_rc)); } else if (is_id(l5, KaxCueRefNumber)) { KaxCueRefNumber &cue_rn = *static_cast(l5); - cue_rn.ReadData(es->I_O()); show_element(l5, 5, "Cue ref number: %llu", uint64(cue_rn)); } else if (is_id(l5, KaxCueRefCodecState)) { KaxCueRefCodecState &cue_rcs = *static_cast(l5); - cue_rcs.ReadData(es->I_O()); show_element(l5, 5, "Cue ref codec state: %llu", uint64(cue_rcs)); - } else if (!is_global(l5, 5, upper_lvl_el)) + } else if (!is_global(es, l5, 5)) show_unknown_element(l5, 5); - - if (!in_parent(l4)) { - delete l5; - break; - } - - if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l5->SkipData(*es, l5->Generic().Context); - delete l5; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, - true); } // while (l5 != NULL) - } else if (!is_global(l4, 4, upper_lvl_el)) + } else if (!is_global(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l4 != NULL) - } else if (!is_global(l3, 3, upper_lvl_el)) + } else if (!is_global(es, l3, 3)) show_unknown_element(l3, 3); - if (!in_parent(l2)) { - delete l3; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l3; - l3 = l4; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l3->SkipData(*es, l3->Generic().Context); - delete l3; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l3 != NULL) - } else if (!is_global(l2, 2, upper_lvl_el)) + } else if (!is_global(es, l2, 2)) show_unknown_element(l2, 2); - if (!in_parent(l1)) { - delete l2; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l2; - l2 = l3; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l2->SkipData(*es, l2->Generic().Context); - delete l2; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l2 != NULL) // Weee! Attachments! @@ -1923,22 +1391,22 @@ bool process_file(const char *file_name) { show_element(l1, 1, "Attachments"); upper_lvl_el = 0; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l2 != NULL) && (upper_lvl_el <= 0)) { + m1 = static_cast(l1); + read_master(m1, es, l1->Generic().Context, upper_lvl_el, l3); + + for (i1 = 0; i1 < m1->ListSize(); i1++) { + l2 = (*m1)[i1]; if (is_id(l2, KaxAttached)) { show_element(l2, 2, "Attached"); - upper_lvl_el = 0; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l3 != NULL) && (upper_lvl_el <= 0)) { + m2 = static_cast(l2); + for (i2 = 0; i2 < m2->ListSize(); i2++) { + l3 = (*m2)[i2]; if (is_id(l3, KaxFileDescription)) { KaxFileDescription &f_desc = *static_cast(l3); - f_desc.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(f_desc)); show_element(l3, 3, "File description: %s", str); safefree(str); @@ -1946,7 +1414,6 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxFileName)) { KaxFileName &f_name = *static_cast(l3); - f_name.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(f_name)); show_element(l3, 3, "File name: %s", str); safefree(str); @@ -1954,149 +1421,55 @@ bool process_file(const char *file_name) { } else if (is_id(l3, KaxMimeType)) { KaxMimeType &mime_type = *static_cast(l3); - mime_type.ReadData(es->I_O()); show_element(l3, 3, "Mime type: %s", string(mime_type).c_str()); } else if (is_id(l3, KaxFileData)) { KaxFileData &f_data = *static_cast(l3); - f_data.ReadData(es->I_O()); show_element(l3, 3, "File data, size: %u", f_data.GetSize()); } else if (is_id(l3, KaxFileUID)) { KaxFileUID &f_uid = *static_cast(l3); - f_uid.ReadData(es->I_O()); show_element(l3, 3, "File UID: %u", uint32(f_uid)); - } else if (!is_global(l3, 3, upper_lvl_el)) + } else if (!is_global(es, l3, 3)) show_unknown_element(l3, 3); - if (!in_parent(l2)) { - delete l3; - break; - } - - if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l3->SkipData(*es, l3->Generic().Context); - delete l3; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l3 != NULL) - } else if (!is_global(l2, 2, upper_lvl_el)) + } else if (!is_global(es, l2, 2)) show_unknown_element(l2, 2); - if (!in_parent(l1)) { - delete l2; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l2; - l2 = l3; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l2->SkipData(*es, l2->Generic().Context); - delete l2; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l2 != NULL) } else if (is_id(l1, KaxChapters)) { show_element(l1, 1, "Chapters"); upper_lvl_el = 0; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l2 != NULL) && (upper_lvl_el <= 0)) { + m1 = static_cast(l1); + read_master(m1, es, l1->Generic().Context, upper_lvl_el, l3); + + for (i1 = 0; i1 < m1->ListSize(); i1++) { + l2 = (*m1)[i1]; if (is_id(l2, KaxEditionEntry)) { show_element(l2, 2, "Edition entry"); - upper_lvl_el = 0; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l3 != NULL) && (upper_lvl_el <= 0)) { + m2 = static_cast(l2); + for (i2 = 0; i2 < m2->ListSize(); i2++) { + l3 = (*m2)[i2]; - if (!parse_chapter_atom(es, l3, 3, upper_lvl_el, l4, in) && - !is_global(l3, 3, upper_lvl_el)) + if (!parse_chapter_atom(es, l3, 3) && + !is_global(es, l3, 3)) show_unknown_element(l3, 3); - if (!in_parent(l2)) { - delete l3; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l3; - l3 = l4; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l3->SkipData(*es, l3->Generic().Context); - delete l3; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l3 != NULL) - } else if (!is_global(l2, 2, upper_lvl_el)) + } else if (!is_global(es, l2, 2)) show_unknown_element(l2, 2); - if (!in_parent(l1)) { - delete l2; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l2; - l2 = l3; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l2->SkipData(*es, l2->Generic().Context); - delete l2; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l2 != NULL) // Let's handle some TAGS. @@ -2104,83 +1477,53 @@ bool process_file(const char *file_name) { show_element(l1, 1, "Tags"); upper_lvl_el = 0; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l2 != NULL) && (upper_lvl_el <= 0)) { + m1 = static_cast(l1); + read_master(m1, es, l1->Generic().Context, upper_lvl_el, l3); + + for (i1 = 0; i1 < m1->ListSize(); i1++) { + l2 = (*m1)[i1]; if (is_id(l2, KaxTag)) { show_element(l2, 2, "Tag"); - upper_lvl_el = 0; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l3 != NULL) && (upper_lvl_el <= 0)) { + m2 = static_cast(l2); + for (i2 = 0; i2 < m2->ListSize(); i2++) { + l3 = (*m2)[i2]; if (is_id(l3, KaxTagTargets)) { show_element(l3, 3, "Targets"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxTagTrackUID)) { KaxTagTrackUID &trackuid = *static_cast(l4); - trackuid.ReadData(es->I_O()); show_element(l4, 4, "Track UID: %llu", uint64(trackuid)); } else if (is_id(l4, KaxTagChapterUID)) { KaxTagChapterUID &chapteruid = *static_cast(l4); - chapteruid.ReadData(es->I_O()); show_element(l4, 4, "Chapter UID: %llu", uint64(chapteruid)); - } else if (!is_global(l4, 4, upper_lvl_el) && - !parse_multicomment(es, l4, 4, upper_lvl_el, l5, - in)) + } else if (!is_global(es, l4, 4) && + !parse_multicomment(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l4 != NULL) } else if (is_id(l3, KaxTagGeneral)) { show_element(l3, 3, "General"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxTagSubject)) { KaxTagSubject &subject = *static_cast(l4); - subject.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(subject)); show_element(l4, 4, "Subject: %s", str); safefree(str); @@ -2188,7 +1531,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagBibliography)) { KaxTagBibliography &bibliography = *static_cast(l4); - bibliography.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(bibliography)); show_element(l4, 4, "Bibliography: %s", str); safefree(str); @@ -2196,7 +1538,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagLanguage)) { KaxTagLanguage &language = *static_cast(l4); - language.ReadData(es->I_O()); show_element(l4, 4, "Language: %s", string(language).c_str()); @@ -2206,7 +1547,6 @@ bool process_file(const char *file_name) { KaxTagRating &rating = *static_cast(l4); - rating.ReadData(es->I_O()); strc = "Rating: length " + to_string(rating.GetSize()) + ", data: "; b = &binary(rating); @@ -2219,7 +1559,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagEncoder)) { KaxTagEncoder &encoder = *static_cast(l4); - encoder.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(encoder)); show_element(l4, 4, "Encoder: %s", str); safefree(str); @@ -2227,7 +1566,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagEncodeSettings)) { KaxTagEncodeSettings &encode_settings = *static_cast(l4); - encode_settings.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(encode_settings)); show_element(l4, 4, "Encode settings: %s", str); safefree(str); @@ -2235,7 +1573,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagFile)) { KaxTagFile &file = *static_cast(l4); - file.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(file)); show_element(l4, 4, "File: %s", str); safefree(str); @@ -2243,7 +1580,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagArchivalLocation)) { KaxTagArchivalLocation &archival_location = *static_cast(l4); - archival_location.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(archival_location)); show_element(l4, 4, "Archival location: %s", str); safefree(str); @@ -2251,7 +1587,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagKeywords)) { KaxTagKeywords &keywords = *static_cast(l4); - keywords.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(keywords)); show_element(l4, 4, "Keywords: %s", str); safefree(str); @@ -2259,7 +1594,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagMood)) { KaxTagMood &mood = *static_cast(l4); - mood.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(mood)); show_element(l4, 4, "Mood: %s", str); safefree(str); @@ -2267,14 +1601,12 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagRecordLocation)) { KaxTagRecordLocation &record_location = *static_cast(l4); - record_location.ReadData(es->I_O()); show_element(l4, 4, "Record location: %s", string(record_location).c_str()); } else if (is_id(l4, KaxTagSource)) { KaxTagSource &source = *static_cast(l4); - source.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(source)); show_element(l4, 4, "Source: %s", str); safefree(str); @@ -2282,7 +1614,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagSourceForm)) { KaxTagSourceForm &source_form = *static_cast(l4); - source_form.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(source_form)); show_element(l4, 4, "Source form: %s", str); safefree(str); @@ -2290,7 +1621,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagProduct)) { KaxTagProduct &product = *static_cast(l4); - product.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(product)); show_element(l4, 4, "Product: %s", str); safefree(str); @@ -2298,7 +1628,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagOriginalMediaType)) { KaxTagOriginalMediaType &original_media_type = *static_cast(l4); - original_media_type.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(original_media_type)); show_element(l4, 4, "Original media type: %s", str); safefree(str); @@ -2306,7 +1635,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagEncoder)) { KaxTagEncoder &encoder = *static_cast(l4); - encoder.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(encoder)); show_element(l4, 4, "Encoder: %s", str); safefree(str); @@ -2314,61 +1642,31 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagPlayCounter)) { KaxTagPlayCounter &play_counter = *static_cast(l4); - play_counter.ReadData(es->I_O()); show_element(l4, 4, "Play counter: %llu", uint64(play_counter)); } else if (is_id(l4, KaxTagPopularimeter)) { KaxTagPopularimeter &popularimeter = *static_cast(l4); - popularimeter.ReadData(es->I_O()); show_element(l4, 4, "Popularimeter: %lld", int64(popularimeter)); - } else if (!is_global(l4, 4, upper_lvl_el) && - !parse_multicomment(es, l4, 4, upper_lvl_el, l5, - in)) + } else if (!is_global(es, l4, 4) && + !parse_multicomment(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l4 != NULL) } else if (is_id(l3, KaxTagGenres)) { show_element(l3, 3, "Genres"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxTagAudioGenre)) { KaxTagAudioGenre &audio_genre = *static_cast(l4); - audio_genre.ReadData(es->I_O()); show_element(l4, 4, "Audio genre: %s", string(audio_genre).c_str()); @@ -2378,7 +1676,6 @@ bool process_file(const char *file_name) { KaxTagVideoGenre &video_genre = *static_cast(l4); - video_genre.ReadData(es->I_O()); strc = "Video genre: length " + to_string(video_genre.GetSize()) + ", data: "; b = &binary(video_genre); @@ -2391,49 +1688,21 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagSubGenre)) { KaxTagSubGenre &sub_genre = *static_cast(l4); - sub_genre.ReadData(es->I_O()); show_element(l4, 4, "Sub genre: %s", string(sub_genre).c_str()); - } else if (!is_global(l4, 4, upper_lvl_el) && - !parse_multicomment(es, l4, 4, upper_lvl_el, l5, - in)) + } else if (!is_global(es, l4, 4) && + !parse_multicomment(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l4 != NULL) } else if (is_id(l3, KaxTagAudioSpecific)) { show_element(l3, 3, "Audio specific"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxTagAudioEncryption)) { char buf[8]; @@ -2441,7 +1710,6 @@ bool process_file(const char *file_name) { KaxTagAudioEncryption &encryption = *static_cast(l4); - encryption.ReadData(es->I_O()); strc = "Audio encryption: length " + to_string(encryption.GetSize()) + ", data: "; b = &binary(encryption); @@ -2454,18 +1722,15 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagAudioGain)) { KaxTagAudioGain &audio_gain = *static_cast(l4); - audio_gain.ReadData(es->I_O()); show_element(l4, 4, "Audio gain: %.3f", float(audio_gain)); } else if (is_id(l4, KaxTagAudioPeak)) { KaxTagAudioPeak &audio_peak = *static_cast(l4); - audio_peak.ReadData(es->I_O()); show_element(l4, 4, "Audio peak: %.3f", float(audio_peak)); } else if (is_id(l4, KaxTagBPM)) { KaxTagBPM &bpm = *static_cast(l4); - bpm.ReadData(es->I_O()); show_element(l4, 4, "BPM: %.3f", float(bpm)); } else if (is_id(l4, KaxTagEqualisation)) { @@ -2474,7 +1739,6 @@ bool process_file(const char *file_name) { KaxTagEqualisation &equalisation = *static_cast(l4); - equalisation.ReadData(es->I_O()); strc = "Equalisation: length " + to_string(equalisation.GetSize()) + ", data: "; b = &binary(equalisation); @@ -2487,80 +1751,47 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagDiscTrack)) { KaxTagDiscTrack &disc_track = *static_cast(l4); - disc_track.ReadData(es->I_O()); show_element(l4, 4, "Disc track: %u", uint32(disc_track)); } else if (is_id(l4, KaxTagSetPart)) { KaxTagSetPart &set_part = *static_cast(l4); - set_part.ReadData(es->I_O()); show_element(l4, 4, "Set part: %u", uint32(set_part)); } else if (is_id(l4, KaxTagInitialKey)) { KaxTagInitialKey &initial_key = *static_cast(l4); - initial_key.ReadData(es->I_O()); show_element(l4, 4, "Initial key: %s", string(initial_key).c_str()); } else if (is_id(l4, KaxTagOfficialAudioFileURL)) { KaxTagOfficialAudioFileURL &official_file_url = *static_cast(l4); - official_file_url.ReadData(es->I_O()); show_element(l4, 4, "Official audio file URL: %s", string(official_file_url).c_str()); } else if (is_id(l4, KaxTagOfficialAudioSourceURL)) { KaxTagOfficialAudioSourceURL &official_source_url = *static_cast(l4); - official_source_url.ReadData(es->I_O()); show_element(l4, 4, "Official audio source URL: %s", string(official_source_url).c_str()); - } else if (!is_global(l4, 4, upper_lvl_el) && - !parse_multicomment(es, l4, 4, upper_lvl_el, l5, - in)) + } else if (!is_global(es, l4, 4) && + !parse_multicomment(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l4 != NULL) } else if (is_id(l3, KaxTagImageSpecific)) { show_element(l3, 3, "Image specific"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxTagCaptureDPI)) { KaxTagCaptureDPI &capture_dpi = *static_cast(l4); - capture_dpi.ReadData(es->I_O()); show_element(l4, 4, "Capture DPI: %u", uint32(capture_dpi)); @@ -2570,7 +1801,6 @@ bool process_file(const char *file_name) { KaxTagCaptureLightness &capture_lightness = *static_cast(l4); - capture_lightness.ReadData(es->I_O()); strc = "Capture lightness: length " + to_string(capture_lightness.GetSize()) + ", data: "; b = &binary(capture_lightness); @@ -2583,7 +1813,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagCapturePaletteSetting)) { KaxTagCapturePaletteSetting &capture_palette_setting = *static_cast(l4); - capture_palette_setting.ReadData(es->I_O()); show_element(l4, 4, "Capture palette setting: %u", uint32(capture_palette_setting)); @@ -2593,7 +1822,6 @@ bool process_file(const char *file_name) { KaxTagCaptureSharpness &capture_sharpness = *static_cast(l4); - capture_sharpness.ReadData(es->I_O()); strc = "Capture sharpness: length " + to_string(capture_sharpness.GetSize()) + ", data: "; b = &binary(capture_sharpness); @@ -2606,7 +1834,6 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagCropped)) { KaxTagCropped &cropped = *static_cast(l4); - cropped.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(cropped)); show_element(l4, 4, "Cropped: %s", str); safefree(str); @@ -2614,64 +1841,34 @@ bool process_file(const char *file_name) { } else if (is_id(l4, KaxTagOriginalDimensions)) { KaxTagOriginalDimensions &original_dimensions = *static_cast(l4); - original_dimensions.ReadData(es->I_O()); show_element(l4, 4, "Original dimensions: %s", string(original_dimensions).c_str()); - } else if (!is_global(l4, 4, upper_lvl_el) && - !parse_multicomment(es, l4, 4, upper_lvl_el, l5, - in)) + } else if (!is_global(es, l4, 4) && + !parse_multicomment(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l4 != NULL) } else if (is_id(l3, KaxTagMultiCommercial)) { show_element(l3, 3, "Multi commercial"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxTagCommercial)) { show_element(l4, 4, "Commercial"); - upper_lvl_el = 0; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, true); - while ((l5 != NULL) && (upper_lvl_el <= 0)) { + m4 = static_cast(l4); + for (i4 = 0; i4 < m4->ListSize(); i4++) { + l5 = (*m4)[i4]; if (is_id(l5, KaxTagMultiCommercialType)) { int type; KaxTagMultiCommercialType &c_type = *static_cast(l5); - c_type.ReadData(es->I_O()); type = uint32(c_type); show_element(l5, 5, "Type: %u (%s)", type, (type >= 1) && @@ -2681,7 +1878,6 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiCommercialAddress)) { KaxTagMultiCommercialAddress &c_address = *static_cast(l5); - c_address.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(c_address)); show_element(l5, 5, "Address: %s", str); @@ -2690,37 +1886,31 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiCommercialURL)) { KaxTagMultiCommercialURL &c_url = *static_cast(l5); - c_url.ReadData(es->I_O()); show_element(l5, 5, "URL: %s", string(c_url).c_str()); } else if (is_id(l5, KaxTagMultiCommercialEmail)) { KaxTagMultiCommercialEmail &c_email = *static_cast(l5); - c_email.ReadData(es->I_O()); show_element(l5, 5, "Email: %s", string(c_email).c_str()); } else if (is_id(l5, KaxTagMultiPrice)) { show_element(l5, 5, "Multi price"); - upper_lvl_el = 0; - l6 = es->FindNextElement(l5->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, - true); - while ((l6 != NULL) && (upper_lvl_el <= 0)) { + m5 = static_cast(l5); + for (i5 = 0; i5 < m5->ListSize(); i5++) { + l6 = (*m5)[i5]; if (is_id(l6, KaxTagMultiPriceCurrency)) { KaxTagMultiPriceCurrency &p_currency = *static_cast(l6); - p_currency.ReadData(es->I_O()); show_element(l6, 6, "Currency: %s", string(p_currency).c_str()); } else if (is_id(l6, KaxTagMultiPriceAmount)) { KaxTagMultiPriceAmount &p_amount = *static_cast(l6); - p_amount.ReadData(es->I_O()); show_element(l6, 6, "Amount: %.3f", float(p_amount)); @@ -2730,7 +1920,6 @@ bool process_file(const char *file_name) { char buffer[40]; KaxTagMultiPricePriceDate &p_pdate = *static_cast(l6); - p_pdate.ReadData(es->I_O()); temptime = p_pdate.GetEpochDate(); if ((gmtime_r(&temptime, &tmutc) != NULL) && @@ -2742,125 +1931,43 @@ bool process_file(const char *file_name) { show_element(l6, 6, "Price date (invalid, " "value: %d)", temptime); - } else if (!is_global(l6, 6, upper_lvl_el) && - !parse_multicomment(es, l6, 6, - upper_lvl_el, l7, in)) + } else if (!is_global(es, l6, 6) && + !parse_multicomment(es, l6, 6)) show_unknown_element(l6, 6); - if (!in_parent(l5)) { - delete l6; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l6; - l6 = l7; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l6->SkipData(*es, l6->Generic().Context); - delete l6; - l6 = es->FindNextElement(l5->Generic().Context, - upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l6 != NULL) - } else if (!is_global(l5, 5, upper_lvl_el) && - !parse_multicomment(es, l5, 5, upper_lvl_el, - l6, in)) + } else if (!is_global(es, l5, 5) && + !parse_multicomment(es, l5, 5)) show_unknown_element(l5, 5); - if (!in_parent(l4)) { - delete l5; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l5; - l5 = l6; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l5->SkipData(*es, l5->Generic().Context); - delete l5; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, - true); - } // while (l5 != NULL) - } else if (!is_global(l4, 4, upper_lvl_el) && - !parse_multicomment(es, l4, 4, upper_lvl_el, l5, - in)) + } else if (!is_global(es, l4, 4) && + !parse_multicomment(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); } // while (l4 != NULL) } else if (is_id(l3, KaxTagMultiDate)) { show_element(l3, 3, "Multi date"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxTagDate)) { show_element(l4, 4, "Date"); - upper_lvl_el = 0; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, true); - while ((l5 != NULL) && (upper_lvl_el <= 0)) { + m4 = static_cast(l4); + for (i4 = 0; i4 < m4->ListSize(); i4++) { + l5 = (*m4)[i4]; if (is_id(l5, KaxTagMultiDateType)) { int type; KaxTagMultiDateType &d_type = *static_cast(l5); - d_type.ReadData(es->I_O()); type = uint32(d_type); show_element(l5, 5, "Type: %u (%s)", type, (type >= 1) && @@ -2873,7 +1980,6 @@ bool process_file(const char *file_name) { char buffer[40]; KaxTagMultiDateDateBegin &d_begin = *static_cast(l5); - d_begin.ReadData(es->I_O()); temptime = d_begin.GetEpochDate(); if ((gmtime_r(&temptime, &tmutc) != NULL) && @@ -2890,7 +1996,6 @@ bool process_file(const char *file_name) { char buffer[40]; KaxTagMultiDateDateEnd &d_end = *static_cast(l5); - d_end.ReadData(es->I_O()); temptime = d_end.GetEpochDate(); if ((gmtime_r(&temptime, &tmutc) != NULL) && @@ -2901,92 +2006,36 @@ bool process_file(const char *file_name) { show_element(l5, 5, "End (invalid, value: %d)", temptime); - } else if (!is_global(l5, 5, upper_lvl_el) && - !parse_multicomment(es, l5, 5, upper_lvl_el, - l6, in)) + } else if (!is_global(es, l5, 5) && + !parse_multicomment(es, l5, 5)) show_unknown_element(l5, 5); - if (!in_parent(l4)) { - delete l5; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l5; - l5 = l6; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l5->SkipData(*es, l5->Generic().Context); - delete l5; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, - true); - } // while (l5 != NULL) - } else if (!is_global(l4, 4, upper_lvl_el) && - !parse_multicomment(es, l4, 4, upper_lvl_el, l5, - in)) + } else if (!is_global(es, l4, 4) && + !parse_multicomment(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l4 != NULL) } else if (is_id(l3, KaxTagMultiEntity)) { show_element(l3, 3, "Multi entity"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxTagEntity)) { show_element(l4, 4, "Entity"); - upper_lvl_el = 0; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, true); - while ((l5 != NULL) && (upper_lvl_el <= 0)) { + m4 = static_cast(l4); + for (i4 = 0; i4 < m4->ListSize(); i4++) { + l5 = (*m4)[i4]; if (is_id(l5, KaxTagMultiEntityType)) { int type; KaxTagMultiEntityType &e_type = *static_cast(l5); - e_type.ReadData(es->I_O()); type = uint32(e_type); show_element(l5, 5, "Type: %u (%s)", type, (type >= 1) && @@ -2996,7 +2045,6 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiEntityName)) { KaxTagMultiEntityName &e_name = *static_cast(l5); - e_name.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(e_name)); show_element(l5, 5, "Name: %s", str); safefree(str); @@ -3004,7 +2052,6 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiEntityAddress)) { KaxTagMultiEntityAddress &e_address = *static_cast(l5); - e_address.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(e_address)); show_element(l5, 5, "Address: %s", str); safefree(str); @@ -3012,102 +2059,44 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiEntityURL)) { KaxTagMultiEntityURL &e_URL = *static_cast(l5); - e_URL.ReadData(es->I_O()); show_element(l5, 5, "URL: %s", string(e_URL).c_str()); } else if (is_id(l5, KaxTagMultiEntityEmail)) { KaxTagMultiEntityEmail &e_email = *static_cast(l5); - e_email.ReadData(es->I_O()); show_element(l5, 5, "Email: %s", string(e_email).c_str()); - } else if (!is_global(l5, 5, upper_lvl_el) && - !parse_multicomment(es, l5, 5, upper_lvl_el, - l6, in)) + } else if (!is_global(es, l5, 5) && + !parse_multicomment(es, l5, 5)) show_unknown_element(l5, 5); - if (!in_parent(l4)) { - delete l5; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l5; - l5 = l6; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l5->SkipData(*es, l5->Generic().Context); - delete l5; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, - true); - } // while (l5 != NULL) - } else if (!is_global(l4, 4, upper_lvl_el) && - !parse_multicomment(es, l4, 4, upper_lvl_el, l5, - in)) + } else if (!is_global(es, l4, 4) && + !parse_multicomment(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l4 != NULL) } else if (is_id(l3, KaxTagMultiIdentifier)) { show_element(l3, 3, "Multi identifier"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxTagIdentifier)) { show_element(l4, 4, "Identifier"); - upper_lvl_el = 0; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, true); - while ((l5 != NULL) && (upper_lvl_el <= 0)) { + m4 = static_cast(l4); + for (i4 = 0; i4 < m4->ListSize(); i4++) { + l5 = (*m4)[i4]; if (is_id(l5, KaxTagMultiIdentifierType)) { int type; KaxTagMultiIdentifierType &i_type = *static_cast(l5); - i_type.ReadData(es->I_O()); type = uint32(i_type); show_element(l5, 5, "Type: %u (%s)", type, (type >= 1) && @@ -3120,7 +2109,6 @@ bool process_file(const char *file_name) { KaxTagMultiIdentifierBinary &i_binary = *static_cast(l5); - i_binary.ReadData(es->I_O()); strc = "Binary: length " + to_string(i_binary.GetSize()) + ", data: "; b = &binary(i_binary); @@ -3133,97 +2121,40 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiIdentifierString)) { KaxTagMultiIdentifierString &i_string = *static_cast(l5); - i_string.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(i_string)); show_element(l5, 5, "String: %s", str); safefree(str); - } else if (!is_global(l5, 5, upper_lvl_el) && - !parse_multicomment(es, l5, 5, upper_lvl_el, - l6, in)) + } else if (!is_global(es, l5, 5) && + !parse_multicomment(es, l5, 5)) show_unknown_element(l5, 5); - if (!in_parent(l4)) { - delete l5; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l5; - l5 = l6; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l5->SkipData(*es, l5->Generic().Context); - delete l5; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, - true); - } // while (l5 != NULL) - } else if (!is_global(l4, 4, upper_lvl_el) && - !parse_multicomment(es, l4, 4, upper_lvl_el, l5, - in)) + } else if (!is_global(es, l4, 4) && + !parse_multicomment(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l4 != NULL) } else if (is_id(l3, KaxTagMultiLegal)) { show_element(l3, 3, "Multi legal"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxTagLegal)) { show_element(l4, 4, "Legal"); - upper_lvl_el = 0; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, true); - while ((l5 != NULL) && (upper_lvl_el <= 0)) { + m4 = static_cast(l4); + for (i4 = 0; i4 < m4->ListSize(); i4++) { + l5 = (*m4)[i4]; if (is_id(l5, KaxTagMultiLegalType)) { int type; KaxTagMultiLegalType &l_type = *static_cast(l5); - l_type.ReadData(es->I_O()); type = uint32(l_type); show_element(l5, 5, "Type: %u (%s)", type, (type >= 1) && @@ -3233,7 +2164,6 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiLegalAddress)) { KaxTagMultiLegalAddress &l_address = *static_cast(l5); - l_address.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(l_address)); show_element(l5, 5, "Address: %s", str); safefree(str); @@ -3241,103 +2171,45 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiLegalURL)) { KaxTagMultiLegalURL &l_URL = *static_cast(l5); - l_URL.ReadData(es->I_O()); show_element(l5, 5, "URL: %s", string(l_URL).c_str()); } else if (is_id(l5, KaxTagMultiLegalContent)) { KaxTagMultiLegalContent &l_content = *static_cast(l5); - l_content.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(l_content)); show_element(l5, 5, "Content: %s", str); safefree(str); - } else if (!is_global(l5, 5, upper_lvl_el) && - !parse_multicomment(es, l5, 5, upper_lvl_el, - l6, in)) + } else if (!is_global(es, l5, 5) && + !parse_multicomment(es, l5, 5)) show_unknown_element(l5, 5); - if (!in_parent(l4)) { - delete l5; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l5; - l5 = l6; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l5->SkipData(*es, l5->Generic().Context); - delete l5; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, - true); - } // while (l5 != NULL) - } else if (!is_global(l4, 4, upper_lvl_el) && - !parse_multicomment(es, l4, 4, upper_lvl_el, l5, - in)) + } else if (!is_global(es, l4, 4) && + !parse_multicomment(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l4 != NULL) } else if (is_id(l3, KaxTagMultiTitle)) { show_element(l3, 3, "Multi title"); - upper_lvl_el = 0; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - while ((l4 != NULL) && (upper_lvl_el <= 0)) { + m3 = static_cast(l3); + for (i3 = 0; i3 < m3->ListSize(); i3++) { + l4 = (*m3)[i3]; if (is_id(l4, KaxTagTitle)) { show_element(l4, 4, "Title"); - upper_lvl_el = 0; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, true); - while ((l5 != NULL) && (upper_lvl_el <= 0)) { + m4 = static_cast(l4); + for (i4 = 0; i4 < m4->ListSize(); i4++) { + l5 = (*m4)[i4]; if (is_id(l5, KaxTagMultiTitleType)) { int type; KaxTagMultiTitleType &t_type = *static_cast(l5); - t_type.ReadData(es->I_O()); type = uint32(t_type); show_element(l5, 5, "Type: %u (%s)", type, (type >= 1) && @@ -3347,7 +2219,6 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiTitleName)) { KaxTagMultiTitleName &t_name = *static_cast(l5); - t_name.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(t_name)); show_element(l5, 5, "Name: %s", str); safefree(str); @@ -3355,7 +2226,6 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiTitleSubTitle)) { KaxTagMultiTitleSubTitle &t_sub_title = *static_cast(l5); - t_sub_title.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(t_sub_title)); show_element(l5, 5, "Sub title: %s", str); safefree(str); @@ -3363,7 +2233,6 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiTitleEdition)) { KaxTagMultiTitleEdition &t_edition = *static_cast(l5); - t_edition.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(t_edition)); show_element(l5, 5, "Edition: %s", str); safefree(str); @@ -3371,7 +2240,6 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiTitleAddress)) { KaxTagMultiTitleAddress &t_address = *static_cast(l5); - t_address.ReadData(es->I_O()); str = UTFstring_to_cstr(UTFstring(t_address)); show_element(l5, 5, "Address: %s", str); safefree(str); @@ -3379,150 +2247,44 @@ bool process_file(const char *file_name) { } else if (is_id(l5, KaxTagMultiTitleURL)) { KaxTagMultiTitleURL &t_URL = *static_cast(l5); - t_URL.ReadData(es->I_O()); show_element(l5, 5, "URL: %s", string(t_URL).c_str()); } else if (is_id(l5, KaxTagMultiTitleEmail)) { KaxTagMultiTitleEmail &t_email = *static_cast(l5); - t_email.ReadData(es->I_O()); show_element(l5, 5, "Email: %s", string(t_email).c_str()); } else if (is_id(l5, KaxTagMultiTitleLanguage)) { KaxTagMultiTitleLanguage &t_language = *static_cast(l5); - t_language.ReadData(es->I_O()); show_element(l5, 5, "Language: %s", string(t_language).c_str()); - } else if (!is_global(l5, 5, upper_lvl_el) && - !parse_multicomment(es, l5, 5, upper_lvl_el, - l6, in)) + } else if (!is_global(es, l5, 5) && + !parse_multicomment(es, l5, 5)) show_unknown_element(l5, 5); - if (!in_parent(l4)) { - delete l5; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l5; - l5 = l6; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l5->SkipData(*es, l5->Generic().Context); - delete l5; - l5 = es->FindNextElement(l4->Generic().Context, - upper_lvl_el, 0xFFFFFFFFL, - true); - } // while (l5 != NULL) - } else if (!is_global(l4, 4, upper_lvl_el) && - !parse_multicomment(es, l4, 4, upper_lvl_el, l5, - in)) + } else if (!is_global(es, l4, 4) && + !parse_multicomment(es, l4, 4)) show_unknown_element(l4, 4); - if (!in_parent(l3)) { - delete l4; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l4; - l4 = l5; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l4->SkipData(*es, l4->Generic().Context); - delete l4; - l4 = es->FindNextElement(l3->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l4 != NULL) - } else if (!is_global(l3, 3, upper_lvl_el) && - !parse_multicomment(es, l3, 3, upper_lvl_el, l4, in)) + } else if (!is_global(es, l3, 3) && + !parse_multicomment(es, l3, 3)) show_unknown_element(l3, 3); - if (!in_parent(l2)) { - delete l3; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l3; - l3 = l4; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l3->SkipData(*es, l3->Generic().Context); - delete l3; - l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l3 != NULL) - } else if (!is_global(l2, 2, upper_lvl_el)) + } else if (!is_global(es, l2, 2)) show_unknown_element(l2, 2); - if (!in_parent(l1)) { - delete l2; - break; - } - - if (upper_lvl_el > 0) { - upper_lvl_el--; - if (upper_lvl_el > 0) - break; - delete l2; - l2 = l3; - continue; - - } else if (upper_lvl_el < 0) { - upper_lvl_el++; - if (upper_lvl_el < 0) - break; - - } - - l2->SkipData(*es, l2->Generic().Context); - delete l2; - l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el, - 0xFFFFFFFFL, true); - } // while (l2 != NULL) - } else if (!is_global(l1, 1, upper_lvl_el)) + } else if (!is_global(es, l1, 1)) show_unknown_element(l1, 1); if (!in_parent(l0)) {