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 shader
return program; return program;
} }
/////////
// Mutex
wxMutex OpenGLWrapper::glMutex;

View file

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

View file

@ -111,7 +111,7 @@ LibassSubtitlesProvider::LibassSubtitlesProvider() {
ass_renderer = ass_renderer_init(ass_library); ass_renderer = ass_renderer_init(ass_library);
if (!ass_renderer) throw _T("ass_renderer_init failed"); if (!ass_renderer) throw _T("ass_renderer_init failed");
ass_set_font_scale(ass_renderer, 1.); 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; if (isPlaying && n != playNextFrame) return;
// Threaded // Threaded
if (threaded && false) { // Doesn't work, so it's disabled if (threaded) { // Doesn't work, so it's disabled
wxMutexLocker lock(vidMutex); wxMutexLocker lock(vidMutex);
threadNextFrame = n; threadNextFrame = n;
if (!threadLocked) { if (!threadLocked) {
@ -853,8 +853,11 @@ wxThread::ExitCode VideoContextThread::Entry() {
// Loop while there is work to do // Loop while there is work to do
while (true) { while (true) {
// Get frame and set frame number // 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 // Display
parent->UpdateDisplays(false); parent->UpdateDisplays(false);

View file

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

View file

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