From c3a9aa812abcf7d07edd0ff167c63f1a572f94b4 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sat, 27 Oct 2007 22:19:49 +0000 Subject: [PATCH] Applied 2points's patch to fix #576 Originally committed to SVN as r1626. --- aegisub/mkv_wrap.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/aegisub/mkv_wrap.cpp b/aegisub/mkv_wrap.cpp index 9bcc0320a..ed8eeae5a 100644 --- a/aegisub/mkv_wrap.cpp +++ b/aegisub/mkv_wrap.cpp @@ -171,7 +171,7 @@ void MatroskaWrapper::Parse() { progress->SetProgress(0,1); // Read frames - int frameN = 0; + register int frameN = 0; while (mkv_ReadFrame(file,0,&rt,&startTime,&endTime,&filePos,&frameSize,&frameFlags) == 0) { // Read value double curTime = double(startTime) / 1000000.0; @@ -184,8 +184,11 @@ void MatroskaWrapper::Parse() { throw _T("Canceled"); } - // Update progress - progress->SetProgress(int(curTime),totalTime); + // Identical to (frameN % 2048) == 0, + // but much faster. + if ((frameN & (2048 - 1)) == 0) + // Update progress + progress->SetProgress(int(curTime),totalTime); } // Clean up progress