Applied p-static's video playback timing patch, and fixed a few things for eventual dynamic wx linking.

Originally committed to SVN as r1786.
This commit is contained in:
Rodrigo Braz Monteiro 2008-01-20 06:14:40 +00:00
parent 8728753844
commit 984c2362fd
4 changed files with 11 additions and 11 deletions

View file

@ -120,6 +120,7 @@
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "advapi32.lib")
#pragma comment(lib, "wsock32.lib")
#pragma comment(lib, "opengl32.lib")
//////////////

View file

@ -55,6 +55,9 @@
#define WIN32_LEAN_AND_MEAN
#include "config.h"
/////////////////////
// wxWidgets headers
#include <wx/wxprec.h>

View file

@ -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);

View file

@ -43,6 +43,7 @@
#include <wx/wxprec.h>
#include <wx/glcanvas.h>
#include <wx/timer.h>
#include <wx/stopwatch.h>
#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;