Added some meta information as a third verbosity level. This episode features frame types and timecode on one line.

This commit is contained in:
Moritz Bunkus 2003-07-14 19:09:25 +00:00
parent 36ff48dc52
commit bf83058489
2 changed files with 25 additions and 2 deletions

View File

@ -44,6 +44,13 @@ the seek head entries and the cue entries.
level 2 level 2
will also print the seek head entries, the cue entries and the file position will also print the seek head entries, the cue entries and the file position
at which each Matroska element can be found at. at which each Matroska element can be found at.
.TP
level 3
will print some information that is not directly connected to a Matroska
element. All other elements only print stuff about the elements that were
just found. Level 3 adds meta information to ease debugging (read: it's
intended for developpers only). All lines written by level 3 are enclosed
in square brackets to make filtering them out easy.
.LP .LP
.SH AUTHOR .SH AUTHOR
.I mkvinfo .I mkvinfo

View File

@ -318,9 +318,10 @@ bool process_file(const char *file_name) {
EbmlElement *l5 = NULL, *l6 = NULL, *l7 = NULL; EbmlElement *l5 = NULL, *l6 = NULL, *l7 = NULL;
EbmlStream *es; EbmlStream *es;
KaxCluster *cluster; KaxCluster *cluster;
uint64_t cluster_tc, tc_scale = TIMECODE_SCALE, file_size; uint64_t cluster_tc, tc_scale = TIMECODE_SCALE, file_size, lf_timecode;
int lf_tnum;
char mkv_track_type; char mkv_track_type;
bool ms_compat; bool ms_compat, bref_found, fref_found;
char *str; char *str;
string strc; string strc;
mm_io_c *in; mm_io_c *in;
@ -947,6 +948,9 @@ bool process_file(const char *file_name) {
} else if (EbmlId(*l2) == KaxBlockGroup::ClassInfos.GlobalId) { } else if (EbmlId(*l2) == KaxBlockGroup::ClassInfos.GlobalId) {
show_element(l2, 2, "Block group"); show_element(l2, 2, "Block group");
bref_found = false;
fref_found = false;
upper_lvl_el = 0; upper_lvl_el = 0;
l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el, l3 = es->FindNextElement(l2->Generic().Context, upper_lvl_el,
0xFFFFFFFFL, false, 1); 0xFFFFFFFFL, false, 1);
@ -964,6 +968,8 @@ bool process_file(const char *file_name) {
"timecode %.3fs)", block.TrackNum(), "timecode %.3fs)", block.TrackNum(),
block.NumberFrames(), block.NumberFrames(),
(float)block.GlobalTimecode() / 1000000000.0); (float)block.GlobalTimecode() / 1000000000.0);
lf_timecode = block.GlobalTimecode() / 1000000;
lf_tnum = block.TrackNum();
for (i = 0; i < (int)block.NumberFrames(); i++) { for (i = 0; i < (int)block.NumberFrames(); i++) {
DataBuffer &data = block.GetBuffer(i); DataBuffer &data = block.GetBuffer(i);
show_element(NULL, 4, "Frame with size %u", data.Size()); show_element(NULL, 4, "Frame with size %u", data.Size());
@ -984,6 +990,10 @@ bool process_file(const char *file_name) {
reference.ReadData(es->I_O()); reference.ReadData(es->I_O());
show_element(l3, 3, "Reference block: %.3fms", show_element(l3, 3, "Reference block: %.3fms",
((float)int64(reference)) * tc_scale / 1000000.0); ((float)int64(reference)) * tc_scale / 1000000.0);
if (int64(reference) < 0)
bref_found = true;
else if (int64(reference) > 0)
fref_found = true;
} else if (EbmlId(*l3) == } else if (EbmlId(*l3) ==
KaxReferencePriority::ClassInfos.GlobalId) { KaxReferencePriority::ClassInfos.GlobalId) {
@ -1113,6 +1123,12 @@ bool process_file(const char *file_name) {
} // while (l3 != NULL) } // while (l3 != NULL)
if (verbose > 2)
show_element(NULL, 2, "[%c frame for track %u, timecode %u]",
bref_found && fref_found ? 'B' :
bref_found ? 'P' : !fref_found ? 'I' : '?',
lf_tnum, lf_timecode);
} else if (!is_ebmlvoid(l2, 2, upper_lvl_el)) } else if (!is_ebmlvoid(l2, 2, upper_lvl_el))
show_unknown_element(l2, 2); show_unknown_element(l2, 2);