changeset 34350:27dead7f2593

Add a suboption to allow forcing use of e.g. OpenGL ES to -vo gl.
author reimar
date Sun, 11 Dec 2011 17:52:20 +0000
parents 6e4af5500f8f
children 52a18f850c28
files DOCS/man/en/mplayer.1 libvo/gl_common.h libvo/vo_gl.c
diffstat 3 files changed, 31 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Sun Dec 11 17:51:24 2011 +0000
+++ b/DOCS/man/en/mplayer.1	Sun Dec 11 17:52:20 2011 +0000
@@ -4119,6 +4119,19 @@
 Use glxinfo or a similar tool to display the supported OpenGL extensions.
 .PD 0
 .RSs
+.IPs backend=<n>
+Select the backend/OpenGL implementation to use (default: -1).
+.RSss
+-1: Autoselect
+.br
+0: Win32/WGL
+.br
+1: X11/GLX
+.br
+2: SDL
+.br
+3: X11/EGL (highly experimental)
+.RE
 .IPs (no)ati\-hack
 ATI drivers may give a corrupted image when PBOs are used (when using \-dr
 or force\-pbo).
--- a/libvo/gl_common.h	Sun Dec 11 17:51:24 2011 +0000
+++ b/libvo/gl_common.h	Sun Dec 11 17:52:20 2011 +0000
@@ -405,11 +405,12 @@
 /** \} */
 
 enum MPGLType {
-  GLTYPE_AUTO,
+  GLTYPE_AUTO = -1,
   GLTYPE_W32,
   GLTYPE_X11,
   GLTYPE_SDL,
   GLTYPE_EGL_X11,
+  GLTYPE_COUNT
 };
 
 typedef struct MPGLContext {
--- a/libvo/vo_gl.c	Sun Dec 11 17:51:24 2011 +0000
+++ b/libvo/vo_gl.c	Sun Dec 11 17:52:20 2011 +0000
@@ -151,6 +151,7 @@
 static int custom_trect;
 static int mipmap_gen;
 static int stereo_mode;
+static enum MPGLType backend;
 
 static int int_pause;
 static int eq_bri = 0;
@@ -1137,6 +1138,12 @@
   uninit_mpglcontext(&glctx);
 }
 
+static int valid_backend(void *p)
+{
+  int *backend = p;
+  return *backend >= GLTYPE_AUTO && *backend < GLTYPE_COUNT;
+}
+
 static int valid_csp(void *p)
 {
   int *csp = p;
@@ -1176,13 +1183,14 @@
   {"mipmapgen",    OPT_ARG_BOOL, &mipmap_gen,   NULL},
   {"osdcolor",     OPT_ARG_INT,  &osd_color,    NULL},
   {"stereo",       OPT_ARG_INT,  &stereo_mode,  NULL},
+  {"backend",      OPT_ARG_INT,  &backend,      valid_backend},
   {NULL}
 };
 
 static int preinit_internal(const char *arg, int allow_sw)
 {
     // set defaults
-    enum MPGLType gltype = GLTYPE_AUTO;
+    backend = GLTYPE_AUTO;
     many_fmts = 1;
     use_osd = -1;
     scaled_osd = 0;
@@ -1289,10 +1297,16 @@
               "    1: side-by-side to red-cyan stereo\n"
               "    2: side-by-side to green-magenta stereo\n"
               "    3: side-by-side to quadbuffer stereo\n"
+              "  backend=<n>\n"
+              "   -1: auto-select\n"
+              "    0: Win32/WGL\n"
+              "    1: X11/GLX\n"
+              "    2: SDL\n"
+              "    3: X11/EGL (experimental)\n"
               "\n" );
       return -1;
     }
-    if (!init_mpglcontext(&glctx, gltype))
+    if (!init_mpglcontext(&glctx, backend))
       goto err_out;
     if (use_yuv == -1 || !allow_sw) {
       if (create_window(320, 200, VOFLAG_HIDDEN, NULL) < 0)