diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-04-24 16:52:06 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-04-24 16:52:06 +0000 |
commit | abfa4e2ae99093ef4cd813bb0045b57e0c6f4faf (patch) | |
tree | ee664f077bc47f9b1373932288b3d68c22231565 /libvo | |
parent | 29e713ba4b0eebf3ef459082799ccec6b1515d48 (diff) | |
download | mpv-abfa4e2ae99093ef4cd813bb0045b57e0c6f4faf.tar.bz2 mpv-abfa4e2ae99093ef4cd813bb0045b57e0c6f4faf.tar.xz |
SDL support with related crash-resilience fixes.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31064 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/vo_gl.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index b2e74c7bf7..55c272b88c 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -37,6 +37,14 @@ #include "fastmemcpy.h" #include "libass/ass_mp.h" +#ifdef CONFIG_GL_SDL +#ifdef CONFIG_SDL_SDL_H +#include <SDL/SDL.h> +#else +#include <SDL.h> +#endif +#endif + static const vo_info_t info = { "OpenGL", @@ -469,7 +477,7 @@ static void autodetectGlExtensions(void) { const char *extensions = mpglGetString(GL_EXTENSIONS); const char *vendor = mpglGetString(GL_VENDOR); const char *version = mpglGetString(GL_VERSION); - int is_ati = strstr(vendor, "ATI") != NULL; + int is_ati = vendor && strstr(vendor, "ATI") != NULL; int ati_broken_pbo = 0; mp_msg(MSGT_VO, MSGL_V, "[gl] Running on OpenGL by '%s', versions '%s'\n", vendor, version); if (is_ati && strncmp(version, "2.1.", 4) == 0) { @@ -478,8 +486,10 @@ static void autodetectGlExtensions(void) { ati_broken_pbo = ver && ver < 8395; } if (ati_hack == -1) ati_hack = ati_broken_pbo; - if (force_pbo == -1) force_pbo = strstr(extensions, "_pixel_buffer_object") ? is_ati : 0; - if (use_rectangle == -1) use_rectangle = strstr(extensions, "_texture_non_power_of_two") ? 0 : 0; + if (extensions && force_pbo == -1) + force_pbo = strstr(extensions, "_pixel_buffer_object") ? is_ati : 0; + if (extensions && use_rectangle == -1) + use_rectangle = strstr(extensions, "_texture_non_power_of_two") ? 0 : 0; if (use_yuv == -1) use_yuv = glAutodetectYUVConversion(); if (is_ati && (lscale == 1 || lscale == 2 || cscale == 1 || cscale == 2)) @@ -584,6 +594,17 @@ static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, co "gl", title); } #endif +#ifdef CONFIG_GL_SDL + if (glctx.type == GLTYPE_SDL) { + SDL_Surface *s = SDL_SetVideoMode(d_width, d_height, 0, SDL_OPENGL | SDL_RESIZABLE); + if (!s) { + mp_msg(MSGT_VO, MSGL_FATAL, "SDL SetVideoMode failed: %s\n", SDL_GetError()); + return -1; + } + vo_dwidth = s->w; + vo_dheight = s->h; + } +#endif return 0; } @@ -1076,8 +1097,11 @@ static const opt_t subopts[] = { static int preinit_internal(const char *arg, int allow_sw) { - enum MPGLType gltype = GLTYPE_X11; + enum MPGLType gltype = GLTYPE_SDL; // set defaults +#ifdef CONFIG_GL_X11 + gltype = GLTYPE_X11; +#endif #ifdef CONFIG_GL_WIN32 gltype = GLTYPE_W32; #endif @@ -1317,6 +1341,8 @@ static int control(uint32_t request, void *data, ...) } break; case VOCTRL_UPDATE_SCREENINFO: + if (!glctx.update_xinerama_info) + break; glctx.update_xinerama_info(); return VO_TRUE; } |