summaryrefslogtreecommitdiffstats
path: root/libvo/gl_common.c
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2011-12-18 20:02:31 +0100
committerwm4 <wm4@mplayer2.org>2012-02-09 04:58:41 +0100
commit4352f9feca37f1294c75e4bf2326e978f0e659df (patch)
treed06d9057bd01e259ff436c8cab4776729d942585 /libvo/gl_common.c
parent93ae55c2c34357b892bff36d678a5d46c22d5a0c (diff)
downloadmpv-4352f9feca37f1294c75e4bf2326e978f0e659df.tar.bz2
mpv-4352f9feca37f1294c75e4bf2326e978f0e659df.tar.xz
vo_gl: add "backend" suboption to allow selecting the GUI backend
The "backend" suboption allows selecting the GUI backend used by vo_gl. Normally, it's auto-selected, but sometimes it's desireable to explicitly select it. Remove the gl_sdl VO. This can now be done by using: --vo=gl:backend=sdl This is based on svn commit 34438, and tries to be compatible with it. The undocumented numeric backend names serve this purpose. (They are undocumented because names are preferred.)
Diffstat (limited to 'libvo/gl_common.c')
-rw-r--r--libvo/gl_common.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 6bb543e56b..481d21e2fe 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -2087,6 +2087,36 @@ static void new_vo_sdl_fullscreen(struct vo *vo) { vo_sdl_fullscreen(); }
#endif
+struct backend {
+ const char *name;
+ enum MPGLType type;
+};
+
+static struct backend backends[] = {
+ {"auto", GLTYPE_AUTO},
+ {"cocoa", GLTYPE_COCOA},
+ {"win", GLTYPE_W32},
+ {"x11", GLTYPE_X11},
+ {"sdl", GLTYPE_SDL},
+ // mplayer-svn aliases (note that mplayer-svn couples these with the numeric
+ // values of the internal GLTYPE_* constants)
+ {"-1", GLTYPE_AUTO},
+ { "0", GLTYPE_W32},
+ { "1", GLTYPE_X11},
+ { "2", GLTYPE_SDL},
+
+ {0}
+};
+
+int mpgl_find_backend(const char *name)
+{
+ for (const struct backend *entry = backends; entry->name; entry++) {
+ if (strcmp(entry->name, name) == 0)
+ return entry->type;
+ }
+ return -1;
+}
+
MPGLContext *init_mpglcontext(enum MPGLType type, struct vo *vo)
{
MPGLContext *ctx;