From e23b91f3b9f942c55e1cf2b9730a4361650da20c Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Tue, 29 Jun 2010 16:27:47 -0400 Subject: [PATCH] sample: lookup track by number to print type The track number doesn't have to be equal to the track type, so look up the track from the number in the block to get its type. Fixes issue #108 --- sample.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sample.cpp b/sample.cpp index 6b3d00f..45fc365 100644 --- a/sample.cpp +++ b/sample.cpp @@ -216,11 +216,14 @@ int main(int argc, char* argv[]) { const Block* const pBlock = pBlockEntry->GetBlock(); const unsigned long trackNum = pBlock->GetTrackNumber(); + const Track *pTrack = pTracks->GetTrackByNumber(trackNum); + const long long trackType_ = pTrack->GetType(); + const unsigned long trackType = static_cast(trackType_); const long size = pBlock->GetSize(); const long long time_ns = pBlock->GetTime(pCluster); printf("\t\t\tBlock\t\t:%s,%15ld,%s,%15lld\n", - (trackNum == VIDEO_TRACK) ? "V" : "A", + (trackType == VIDEO_TRACK) ? "V" : "A", size, pBlock->IsKey() ? "I" : "P", time_ns);