Failed attempt to get threaded video to work.

Originally committed to SVN as r1065.
This commit is contained in:
Rodrigo Braz Monteiro 2007-04-13 00:44:46 +00:00
parent 07cc2d8042
commit 58c7a6f4e8
6 changed files with 18 additions and 5 deletions

View File

@ -461,3 +461,8 @@ GLuint OpenGLWrapper::CreateYV12Shader(float tw,float th,float tws) {
// Return shader
return program;
}
/////////
// Mutex
wxMutex OpenGLWrapper::glMutex;

View File

@ -45,12 +45,15 @@ private:
float r2,g2,b2,a2;
int lw;
static void Initialize();
static GLuint CreateStandardVertexShader();
static GLuint CreateYV12PixelShader();
static GLuint CreateShaderProgram(GLuint vertex,GLuint pixel);
public:
static wxMutex glMutex;
void SetLineColour(wxColour col,float alpha=1.0f,int width=1);
void SetFillColour(wxColour col,float alpha=1.0f);
void SetModeLine();

View File

@ -111,7 +111,7 @@ LibassSubtitlesProvider::LibassSubtitlesProvider() {
ass_renderer = ass_renderer_init(ass_library);
if (!ass_renderer) throw _T("ass_renderer_init failed");
ass_set_font_scale(ass_renderer, 1.);
ass_set_fonts(ass_renderer, "c:\\windows\\fonts\\verdana.ttf", "Sans");
ass_set_fonts(ass_renderer, NULL, "Sans");
}

View File

@ -395,7 +395,7 @@ void VideoContext::JumpToFrame(int n) {
if (isPlaying && n != playNextFrame) return;
// Threaded
if (threaded && false) { // Doesn't work, so it's disabled
if (threaded) { // Doesn't work, so it's disabled
wxMutexLocker lock(vidMutex);
threadNextFrame = n;
if (!threadLocked) {
@ -853,8 +853,11 @@ wxThread::ExitCode VideoContextThread::Entry() {
// Loop while there is work to do
while (true) {
// Get frame and set frame number
parent->GetFrameAsTexture(frame);
parent->frame_n = frame;
{
wxMutexLocker glLock(OpenGLWrapper::glMutex);
parent->GetFrameAsTexture(frame);
parent->frame_n = frame;
}
// Display
parent->UpdateDisplays(false);

View File

@ -144,6 +144,7 @@ void VideoDisplay::Render() {
if (!context->IsLoaded()) return;
// Set GL context
wxMutexLocker glLock(OpenGLWrapper::glMutex);
SetCurrent(*context->GetGLContext(this));
// Get sizes
@ -256,7 +257,7 @@ void VideoDisplay::Render() {
visual->DrawOverlay();
// Swap buffers
//glFinish();
glFinish();
//if (glGetError()) throw _T("Error finishing gl operation.");
SwapBuffers();
}

View File

@ -49,6 +49,7 @@
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CompileAs="1"
DisableSpecificWarnings="4996;4244;4267;4005"
ForcedIncludeFiles="msvc.h"
/>