GLUT - no not use mainLoop, QT fixes

This commit is contained in:
Martin Pulec
2011-11-28 13:00:31 +01:00
parent 31f9ce814b
commit 840cb5bd4e
5 changed files with 23 additions and 34 deletions

View File

@@ -119,7 +119,7 @@ static void configure_with(struct compress_jpeg_state *s, struct video_frame *fr
break;
case DVS10:
s->decoder = (decoder_t) vc_copylineDVS10;
s->rgb = FALSE;;
s->rgb = FALSE;
break;
/* TODO: enable
case DPX10:

View File

@@ -713,13 +713,19 @@ void display_gl_run(void *arg)
NSApplicationLoad();
#endif
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
#ifndef HAVE_MACOSX
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION);
#endif
glutIdleFunc(glut_idle_callback);
s->window = glutCreateWindow(WIN_NAME);
glutHideWindow();
glutKeyboardFunc(glut_key_callback);
glutDisplayFunc(glutSwapBuffers);
glutWMCloseFunc(glut_close_callback);
#ifdef HAVE_MACOSX
glutWMCloseFunc(glut_close_callback);
#else
glutCloseFunc(glut_close_callback);
#endif
glutReshapeFunc(gl_resize);
tmp = strdup((const char *)glGetString(GL_VERSION));
@@ -754,7 +760,14 @@ void display_gl_run(void *arg)
dxt_arb_init(s);
dxt5_arb_init(s);
glutMainLoop();
while(!should_exit) {
glut_idle_callback();
#ifndef HAVE_MACOSX
glutMainLoopEvent();
#else
glutCheckLoop();
#endif
}
}

View File

@@ -854,6 +854,7 @@ int display_quicktime_get_property(void *state, int property, void *val, int *le
return FALSE;
}
return TRUE;
}
void display_quicktime_reconfigure(void *state, struct video_desc desc)
{
@@ -863,12 +864,12 @@ void display_quicktime_reconfigure(void *state, struct video_desc desc)
const char *codec_name;
for (i = 0; codec_info[i].name != NULL; i++) {
if (codec_info[i].codec == desc.codec) {
if (codec_info[i].codec == desc.color_spec) {
s->cinfo = &codec_info[i];
codec_name = s->cinfo->name;
}
}
if(desc.codec == UYVY || desc.codec == DVS8) /* just aliases for 2vuy,
if(desc.color_spec == UYVY || desc.color_spec == DVS8) /* just aliases for 2vuy,
* but would confuse QT */
codec_name = "2vuy";
@@ -877,7 +878,7 @@ void display_quicktime_reconfigure(void *state, struct video_desc desc)
fprintf(stdout, "Selected mode: %dx%d, %fbpp\n", desc.width,
desc.height, s->cinfo->bpp);
s->frame->color_spec = desc.codec;
s->frame->color_spec = desc.color_spec;
s->frame->fps = desc.fps;
s->frame->aux = desc.aux;
@@ -890,7 +891,7 @@ void display_quicktime_reconfigure(void *state, struct video_desc desc)
tile->width = tile_width;
tile->height = tile_height;
tile->linesize = vc_get_linesize(tile_width, desc.codec);
tile->linesize = vc_get_linesize(tile_width, desc.color_spec);
tile->data_len = tile->linesize * tile->height;
if(tile->data != NULL) {

View File

@@ -115,9 +115,6 @@ struct state_sdl {
int rshift, gshift, bshift;
int pitch;
#ifndef HAVE_MACOS_X
Display *display;
#endif
};
extern int should_exit;
@@ -435,9 +432,6 @@ void display_sdl_reconfigure(void *state, struct video_desc desc)
s->buffer_writable_lock);
SDL_mutexV(s->buffer_writable_lock);
#ifndef HAVE_MACOS_X
if(s->display) XLockDisplay(s->display);
#endif
cleanup_screen(s);
s->tile->width = desc.width;
@@ -554,11 +548,6 @@ void display_sdl_reconfigure(void *state, struct video_desc desc)
s->tile->data_len = s->tile->width * s->tile->height * 2;
s->pitch = PITCH_DEFAULT;
}
#ifndef HAVE_MACOS_X
if(s->display) XUnlockDisplay(s->display);
#endif
s->rshift = s->sdl_screen->format->Rshift;
s->gshift = s->sdl_screen->format->Gshift;
@@ -638,11 +627,9 @@ void *display_sdl_init(char *fmt, unsigned int flags)
SDL_SysWMinfo info;
memset(&info, 0, sizeof(SDL_SysWMinfo));
ret = SDL_GetWMInfo(&info);
#ifndef HAVE_MACOS_X
s->display = NULL;
#ifndef HAVE_MACOSX
if (ret == 1) {
x11_set_display(info.info.x11.display);
s->display = info.info.x11.display;
} else if (ret == 0) {
fprintf(stderr, "[SDL] Warning: SDL_GetWMInfo unimplemented\n");
} else if (ret == -1) {
@@ -677,10 +664,6 @@ void display_sdl_done(void *state)
assert(s->magic == MAGIC_SDL);
#ifndef HAVE_MACOS_X
if(s->display) XLockDisplay(s->display);
#endif
SDL_DestroyCond(s->buffer_writable_cond);
SDL_DestroyMutex(s->buffer_writable_lock);
cleanup_screen(s);
@@ -688,9 +671,6 @@ void display_sdl_done(void *state)
/*FIXME: free all the stuff */
SDL_ShowCursor(SDL_ENABLE);
#ifndef HAVE_MACOS_X
if(s->display) XUnlockDisplay(s->display);
#endif
SDL_Quit();
}

View File

@@ -121,7 +121,6 @@ void glx_free(void *arg)
pthread_mutex_lock(&lock);
XLockDisplay(display);
glXMakeCurrent( display, context->win, context->ctx );
glXDestroyContext( display, context->ctx );
@@ -136,8 +135,6 @@ void glx_free(void *arg)
fprintf(stderr, __FILE__ ": WARNING: Unpaired glx_free call.");
}
XUnlockDisplay(display);
if(display_opened_here && ref_num == 0) {
fprintf(stderr, "Display closed (last client disconnected)\n");
XCloseDisplay( display );
@@ -210,7 +207,6 @@ void *glx_init()
}
ref_num++;
XLockDisplay(display);
@@ -416,7 +412,6 @@ void *glx_init()
glewInit();
XUnlockDisplay(display);
pthread_mutex_unlock(&lock);
return context;