changeset 31044:4fdb46b8c2c9

Support for auto-selecting the OpenGL backend.
author reimar
date Sun, 25 Apr 2010 10:53:01 +0000
parents 80036ef586ff
children 56dea60de72c
files libvo/gl_common.c libvo/gl_common.h libvo/vo_gl.c
diffstat 3 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/gl_common.c	Sun Apr 25 10:44:53 2010 +0000
+++ b/libvo/gl_common.c	Sun Apr 25 10:53:01 2010 +0000
@@ -1901,6 +1901,14 @@
 }
 
 int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) {
+  if (type == GLTYPE_AUTO) {
+    int res = init_mpglcontext(ctx, GLTYPE_W32);
+    if (res) return res;
+    res = init_mpglcontext(ctx, GLTYPE_X11);
+    if (res) return res;
+    res = init_mpglcontext(ctx, GLTYPE_SDL);
+    return res;
+  }
   memset(ctx, 0, sizeof(*ctx));
   ctx->setGlWindow = setGlWindow_dummy;
   ctx->releaseGlContext = releaseGlContext_dummy;
--- a/libvo/gl_common.h	Sun Apr 25 10:44:53 2010 +0000
+++ b/libvo/gl_common.h	Sun Apr 25 10:53:01 2010 +0000
@@ -373,6 +373,7 @@
 /** \} */
 
 enum MPGLType {
+  GLTYPE_AUTO,
   GLTYPE_W32,
   GLTYPE_X11,
   GLTYPE_SDL,
--- a/libvo/vo_gl.c	Sun Apr 25 10:44:53 2010 +0000
+++ b/libvo/vo_gl.c	Sun Apr 25 10:53:01 2010 +0000
@@ -1099,14 +1099,8 @@
 
 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;