media/gstreamer: Support using GL for video for Windows
Hi,
This is a WIP progress to enable GL support for the GStreamer media backend on desktop Windows OpenGL or libANGLE (aka WGL), as it turns out that there are some more things that need to be done on Windows in order for things to work, namely:
-
For desktop OpenGL we need a Core GL 4.1 context for GstGL to work, so we need to first try to explicitly ask for a Core GL 4.1 context in
wglCreateContextAttribARB()
, if we are asking for something lower sincewglCreateContextAttribARB()
may just give us a GL context according to the version that we have asked for. -
For the
GstDisplay
that we need for the shared GL context, it's simpler since Windows have only oneGstDisplay
for use for desktop OpenGL. For GLES, we can usegst_gl_display_egl_new_with_egl_display()
on the EGL display that we can obtain fromGDK-Win32
. -
For desktop OpenGL we need to tell libepoxy that we were calling
wglMakeCurrent()
outside of libepoxy (which is underlyingGdkGLContext
) when usingGstGL
, so that things won't crash due to invalid GL function pointers. -
For desktop OpenGL we need to temporarily disable the WGL context that is made current with
gdk_gl_context_make_current()
, so thatwglShareLists()
that is called byGstGL
won't fail due toERROR_BUSY
(0xAA).
Many thanks to @ystreet00 for the info, especially for the second and fourth points.
Unfortunately, this currently only works with Mesa-21.0.0 (or so), as I got the following:
<strike>gstglcolorconvert.c:2055:_create_shader:<glcolorconvert0> Failed to compile vertex shader Failed to create shader object</strike>
and I am not that good at dealing with shaders.
With blessings, thank you!