Added progress bar to matroska parsing

Originally committed to SVN as r122.
This commit is contained in:
Rodrigo Braz Monteiro 2006-02-23 02:18:32 +00:00
parent 57b6834d13
commit 5cc37edf38
1 changed files with 23 additions and 1 deletions

View File

@ -38,6 +38,7 @@
// Headers
#include <algorithm>
#include "mkv_wrap.h"
#include "dialog_progress.h"
///////////
@ -144,15 +145,36 @@ void MatroskaWrapper::Parse() {
// Mask other tracks away
mkv_SetTrackMask(file, ~(1 << track));
// Progress bar
int totalTime = double(segInfo->Duration) / timecodeScale;
volatile bool canceled = false;
DialogProgress *progress = new DialogProgress(NULL,_("Parsing Matroska"),&canceled,_("Reading keyframe and timecode data from Matroska file."),0,totalTime);
progress->Show();
progress->SetProgress(0,1);
// Read frames
int frameN = 0;
while (mkv_ReadFrame(file,0,&rt,&startTime,&endTime,&filePos,&frameSize,&frameFlags) == 0) {
// Read value
double curTime = double(startTime) / timecodeScale;
if (!(frameFlags & FRAME_GAP)) {
frames.push_back(MkvFrame((frameFlags & FRAME_KF) != 0,double(startTime) / timecodeScale));
frames.push_back(MkvFrame((frameFlags & FRAME_KF) != 0,curTime));
frameN++;
}
// Cancelled?
if (canceled) {
Close();
throw _T("Canceled");
}
// Update progress
progress->SetProgress(curTime,totalTime);
}
// Clean up progress
if (!canceled) progress->Destroy();
break;
}
}