From 0a6359fc59d70209f4fb41db5d5cb5f02945dafa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 15 Jul 2013 18:01:55 +0200 Subject: [PATCH] [757/906] egl: Create an offscreen surface if no window was provided --- gst-libs/gst/gl/gstglegl.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/gl/gstglegl.c b/gst-libs/gst/gl/gstglegl.c index 480937cbdc..71441bc9fe 100644 --- a/gst-libs/gst/gl/gstglegl.c +++ b/gst-libs/gst/gl/gstglegl.c @@ -196,8 +196,29 @@ gst_gl_egl_create_context (EGLDisplay display, EGLNativeWindowType window, goto failure; } - egl->egl_surface = - eglCreateWindowSurface (egl->egl_display, egl->egl_config, window, NULL); + + if (window) { + egl->egl_surface = + eglCreateWindowSurface (egl->egl_display, egl->egl_config, window, + NULL); + } else { + EGLint surface_attrib[7]; + gint j = 0; + + /* FIXME: Width/height doesn't seem to matter but we can't leave them + * at 0, otherwise X11 complains about BadValue */ + surface_attrib[j++] = EGL_WIDTH; + surface_attrib[j++] = 1; + surface_attrib[j++] = EGL_HEIGHT; + surface_attrib[j++] = 1; + surface_attrib[j++] = EGL_LARGEST_PBUFFER; + surface_attrib[j++] = EGL_TRUE; + surface_attrib[j++] = EGL_NONE; + + egl->egl_surface = + eglCreatePbufferSurface (egl->egl_display, egl->egl_config, + surface_attrib); + } if (egl->egl_surface != EGL_NO_SURFACE) { GST_INFO ("surface created");