From 984c2362fd4629977096746c79a7c9c8ad2148c1 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sun, 20 Jan 2008 06:14:40 +0000 Subject: [PATCH] Applied p-static's video playback timing patch, and fixed a few things for eventual dynamic wx linking. Originally committed to SVN as r1786. --- aegisub/setup.cpp | 1 + aegisub/stdwx.h | 3 +++ aegisub/video_context.cpp | 14 +++++--------- aegisub/video_context.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/aegisub/setup.cpp b/aegisub/setup.cpp index 1617bcb45..9beeb2c1a 100644 --- a/aegisub/setup.cpp +++ b/aegisub/setup.cpp @@ -120,6 +120,7 @@ #pragma comment(lib, "winmm.lib") #pragma comment(lib, "advapi32.lib") #pragma comment(lib, "wsock32.lib") +#pragma comment(lib, "opengl32.lib") ////////////// diff --git a/aegisub/stdwx.h b/aegisub/stdwx.h index c86279a68..16b435d78 100644 --- a/aegisub/stdwx.h +++ b/aegisub/stdwx.h @@ -55,6 +55,9 @@ #define WIN32_LEAN_AND_MEAN +#include "config.h" + + ///////////////////// // wxWidgets headers #include diff --git a/aegisub/video_context.cpp b/aegisub/video_context.cpp index c7e267262..86328e58e 100644 --- a/aegisub/video_context.cpp +++ b/aegisub/video_context.cpp @@ -724,10 +724,9 @@ void VideoContext::Play() { isPlaying = true; // Start timer - startTime = clock(); - playTime = startTime; + playTime.Start(); playback.SetOwner(this,VIDEO_PLAY_TIMER); - playback.Start(1); + playback.Start(10); } @@ -751,12 +750,11 @@ void VideoContext::PlayLine() { JumpToFrame(startFrame); // Set other variables - startTime = clock(); - playTime = startTime; + playTime.Start(curline->Start.GetMS()); // Start timer playback.SetOwner(this,VIDEO_PLAY_TIMER); - playback.Start(1); + playback.Start(10); } @@ -781,9 +779,7 @@ void VideoContext::OnPlayTimer(wxTimerEvent &event) { wxMutexLocker lock(playMutex); // Get time difference - clock_t cur = clock(); - clock_t dif = (clock() - startTime)*1000/CLOCKS_PER_SEC; - playTime = cur; + int dif = playTime.Time(); // Find next frame int startMs = VFR_Output.GetTimeAtFrame(startFrame); diff --git a/aegisub/video_context.h b/aegisub/video_context.h index 2a51e2ca8..01545e66d 100644 --- a/aegisub/video_context.h +++ b/aegisub/video_context.h @@ -43,6 +43,7 @@ #include #include #include +#include #ifndef wxUSE_GLCANVAS #error "Aegisub requires wxWidgets to be compiled with OpenGL support." #endif @@ -100,8 +101,7 @@ private: wxMutex playMutex; wxTimer playback; - clock_t playTime; - clock_t startTime; + wxStopWatch playTime; int startFrame; int endFrame; int playNextFrame;