Support for the mandatory KaxTrackUID. Cosmetics.

This commit is contained in:
Moritz Bunkus 2003-04-26 11:26:15 +00:00
parent 674050b116
commit 2a1f1d7902
2 changed files with 29 additions and 4 deletions

View File

@ -12,7 +12,7 @@
/*!
\file
\version \$Id: mkvinfo.cpp,v 1.22 2003/04/26 11:07:19 mosu Exp $
\version \$Id: mkvinfo.cpp,v 1.23 2003/04/26 11:26:15 mosu Exp $
\brief retrieves and displays information about a Matroska file
\author Moritz Bunkus <moritz @ bunkus.org>
*/
@ -72,7 +72,7 @@
using namespace LIBMATROSKA_NAMESPACE;
typedef struct track_t {
int tnum;
unsigned int tnum, tuid;
char type;
int64_t size;
} track_t;
@ -99,6 +99,16 @@ track_t *find_track(int tnum) {
return NULL;
}
track_t *find_track_by_uid(int tuid) {
int i;
for (i = 0; i < num_tracks; i++)
if (tracks[i]->tuid == tuid)
return tracks[i];
return NULL;
}
void usage() {
fprintf(stdout,
"Usage: mkvinfo [options] inname\n\n"
@ -283,7 +293,7 @@ void process_file() {
if (EbmlId(*l3) == KaxTrackNumber::ClassInfos.GlobalId) {
KaxTrackNumber &tnum = *static_cast<KaxTrackNumber *>(l3);
tnum.ReadData(es->I_O());
fprintf(stdout, "(%s) | + Track number %d", NAME,
fprintf(stdout, "(%s) | + Track number: %u", NAME,
uint8(tnum));
if (verbose > 1)
fprintf(stdout, " at %llu", l3->GetElementPosition());
@ -293,6 +303,17 @@ void process_file() {
"track with the number %u.\n", NAME,
uint8(tnum));
} else if (EbmlId(*l3) == KaxTrackUID::ClassInfos.GlobalId) {
KaxTrackUID &tuid = *static_cast<KaxTrackUID *>(l3);
tuid.ReadData(es->I_O());
fprintf(stdout, "(%s) | + Track UID: %u", NAME, uint8(tuid));
if (verbose > 1)
fprintf(stdout, " at %llu", l3->GetElementPosition());
fprintf(stdout, "\n");
if (find_track_by_uid(uint8(tuid)) != NULL)
fprintf(stdout, "(%s) | + Warning: There's more than one "
"track with the UID %u.\n", NAME, uint8(tuid));
} else if (EbmlId(*l3) == KaxTrackType::ClassInfos.GlobalId) {
KaxTrackType &ttype = *static_cast<KaxTrackType *>(l3);
ttype.ReadData(es->I_O());

View File

@ -13,7 +13,7 @@
/*!
\file
\version \$Id: pr_generic.cpp,v 1.24 2003/04/21 08:29:50 mosu Exp $
\version \$Id: pr_generic.cpp,v 1.25 2003/04/26 11:26:15 mosu Exp $
\brief functions common for all readers/packetizers
\author Moritz Bunkus <moritz @ bunkus.org>
*/
@ -187,6 +187,10 @@ void generic_packetizer_c::set_header() {
KaxTrackNumber &tnumber =
GetChild<KaxTrackNumber>(static_cast<KaxTrackEntry &>(*track_entry));
*(static_cast<EbmlUInteger *>(&tnumber)) = hserialno;
KaxTrackUID &tuid =
GetChild<KaxTrackUID>(static_cast<KaxTrackEntry &>(*track_entry));
*(static_cast<EbmlUInteger *>(&tuid)) = hserialno;
}
if (htrack_type != -1)