forked from mia/Aegisub
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:
parent
8728753844
commit
984c2362fd
4 changed files with 11 additions and 11 deletions
|
@ -120,6 +120,7 @@
|
||||||
#pragma comment(lib, "winmm.lib")
|
#pragma comment(lib, "winmm.lib")
|
||||||
#pragma comment(lib, "advapi32.lib")
|
#pragma comment(lib, "advapi32.lib")
|
||||||
#pragma comment(lib, "wsock32.lib")
|
#pragma comment(lib, "wsock32.lib")
|
||||||
|
#pragma comment(lib, "opengl32.lib")
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
|
|
|
@ -55,6 +55,9 @@
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// wxWidgets headers
|
// wxWidgets headers
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wxprec.h>
|
||||||
|
|
|
@ -724,10 +724,9 @@ void VideoContext::Play() {
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
|
|
||||||
// Start timer
|
// Start timer
|
||||||
startTime = clock();
|
playTime.Start();
|
||||||
playTime = startTime;
|
|
||||||
playback.SetOwner(this,VIDEO_PLAY_TIMER);
|
playback.SetOwner(this,VIDEO_PLAY_TIMER);
|
||||||
playback.Start(1);
|
playback.Start(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -751,12 +750,11 @@ void VideoContext::PlayLine() {
|
||||||
JumpToFrame(startFrame);
|
JumpToFrame(startFrame);
|
||||||
|
|
||||||
// Set other variables
|
// Set other variables
|
||||||
startTime = clock();
|
playTime.Start(curline->Start.GetMS());
|
||||||
playTime = startTime;
|
|
||||||
|
|
||||||
// Start timer
|
// Start timer
|
||||||
playback.SetOwner(this,VIDEO_PLAY_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);
|
wxMutexLocker lock(playMutex);
|
||||||
|
|
||||||
// Get time difference
|
// Get time difference
|
||||||
clock_t cur = clock();
|
int dif = playTime.Time();
|
||||||
clock_t dif = (clock() - startTime)*1000/CLOCKS_PER_SEC;
|
|
||||||
playTime = cur;
|
|
||||||
|
|
||||||
// Find next frame
|
// Find next frame
|
||||||
int startMs = VFR_Output.GetTimeAtFrame(startFrame);
|
int startMs = VFR_Output.GetTimeAtFrame(startFrame);
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wxprec.h>
|
||||||
#include <wx/glcanvas.h>
|
#include <wx/glcanvas.h>
|
||||||
#include <wx/timer.h>
|
#include <wx/timer.h>
|
||||||
|
#include <wx/stopwatch.h>
|
||||||
#ifndef wxUSE_GLCANVAS
|
#ifndef wxUSE_GLCANVAS
|
||||||
#error "Aegisub requires wxWidgets to be compiled with OpenGL support."
|
#error "Aegisub requires wxWidgets to be compiled with OpenGL support."
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,8 +101,7 @@ private:
|
||||||
|
|
||||||
wxMutex playMutex;
|
wxMutex playMutex;
|
||||||
wxTimer playback;
|
wxTimer playback;
|
||||||
clock_t playTime;
|
wxStopWatch playTime;
|
||||||
clock_t startTime;
|
|
||||||
int startFrame;
|
int startFrame;
|
||||||
int endFrame;
|
int endFrame;
|
||||||
int playNextFrame;
|
int playNextFrame;
|
||||||
|
|
Loading…
Reference in a new issue