From abfa4e2ae99093ef4cd813bb0045b57e0c6f4faf Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 24 Apr 2010 16:52:06 +0000 Subject: SDL support with related crash-resilience fixes. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31064 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'libvo/vo_gl.c') 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 +#else +#include +#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)) @@ -583,6 +593,17 @@ static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, co XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone), "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; } -- cgit v1.2.3 From 5c4cc997caeeb87675cfc7b9c97206bc4d9568ff Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 24 Apr 2010 16:58:24 +0000 Subject: Disable OSD support by default if the necessary OpenGL functionality is missing. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31065 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libvo/vo_gl.c') diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 55c272b88c..7d48e35d22 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -490,6 +490,8 @@ static void autodetectGlExtensions(void) { 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_osd == -1) + use_osd = mpglBindTexture != NULL; if (use_yuv == -1) use_yuv = glAutodetectYUVConversion(); if (is_ati && (lscale == 1 || lscale == 2 || cscale == 1 || cscale == 2)) @@ -1106,7 +1108,7 @@ static int preinit_internal(const char *arg, int allow_sw) gltype = GLTYPE_W32; #endif many_fmts = 1; - use_osd = 1; + use_osd = -1; scaled_osd = 0; use_aspect = 1; use_ycbcr = 0; -- cgit v1.2.3 From a83117e972f528ceead87b70b249a5e233d4f13b Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 08:35:35 +0000 Subject: Window resizing support for -vo gl with SDL backend. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31075 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'libvo/vo_gl.c') diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 7d48e35d22..e6b14eb0e6 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -598,13 +598,8 @@ static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, co #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; + vo_dwidth = d_width; + vo_dheight = d_height; } #endif return 0; -- cgit v1.2.3 From 8b8fd879ac48ee1472facc04ac4daeaeff48c18f Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 08:40:28 +0000 Subject: Set SDL window title. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31076 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libvo/vo_gl.c') diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index e6b14eb0e6..3c621d00c7 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -598,6 +598,7 @@ static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, co #endif #ifdef CONFIG_GL_SDL if (glctx.type == GLTYPE_SDL) { + SDL_WM_SetCaption(title, NULL); vo_dwidth = d_width; vo_dheight = d_height; } -- cgit v1.2.3 From e0183c56b1f879a76788697f2a5ccfc02aa1d5e2 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 09:25:23 +0000 Subject: Remove unnecessary check. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31078 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'libvo/vo_gl.c') diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 3c621d00c7..e376e260f4 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -1339,8 +1339,6 @@ 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; } -- cgit v1.2.3 From 3a34dbc927a4980606abb4331e7ba8ca6fc1a90d Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 10:44:53 +0000 Subject: Add reinitialization support. Necessary for fullscreen on OSX. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31085 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libvo/vo_gl.c') diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index e376e260f4..3730059ffa 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -650,6 +650,10 @@ glconfig: static void check_events(void) { int e=glctx.check_events(); + if(e&VO_EVENT_REINIT) { + uninitGl(); + initGl(vo_dwidth, vo_dheight); + } if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight); if(e&VO_EVENT_EXPOSE && int_pause) redraw(); } -- cgit v1.2.3 From a9ff7793e3491b5e78f4baed207b31eeeed61896 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Apr 2010 10:53:01 +0000 Subject: Support for auto-selecting the OpenGL backend. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31086 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'libvo/vo_gl.c') diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 3730059ffa..c44e21a3e8 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -1099,14 +1099,8 @@ static const opt_t subopts[] = { static int preinit_internal(const char *arg, int allow_sw) { - enum MPGLType gltype = GLTYPE_SDL; // set defaults -#ifdef CONFIG_GL_X11 - gltype = GLTYPE_X11; -#endif -#ifdef CONFIG_GL_WIN32 - gltype = GLTYPE_W32; -#endif + enum MPGLType gltype = GLTYPE_AUTO; many_fmts = 1; use_osd = -1; scaled_osd = 0; -- cgit v1.2.3