GNOME Bugzilla – Bug 750308
Extract GstGLSurface and GstGLMessageLoop from GstGLWindow
Last modified: 2018-05-05 21:07:18 UTC
I would like to start discussion about refactoring GstGLWindow. Currently our offscreen surface support is handled through a GstGLWindow. For example when an upstream element (or the app) provides a gl context (i.e.: ->other_context) then the GstGLWindowX11 is "->open" but not created (http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/gst-libs/gst/gl/egl/gstglcontext_egl.c#n392). It is confusing. We could have GstGLWindow and a new GstGLOffScreenSurface deriving from a new GstGLSurface. Except for egl we currently do not have implementation for offscreen surface with glx or cgl (It could be done through PBufferSurface) So currently these surfaces are hidden windows. So either we implement these 2 missing bits or we can also simply have a GstGLSurface being offscreen in its default implementation. Then GstGLWindow_X11 will override "->is_offscreen()" and "->create". Also for the current GstGLWindow's GMainContext/GMainLoop (for gl thread) we should probably have a new object GstGLMessageLoop. A GstGLContext will own a GstGLMessageLoop (or name it as GstGLThread). This change will allow us to handle offscreen surface properly. (Note that http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=c5f8c789a3b87c01529b9298c1940e2b08fe4c66 can be done for all other backend: win32, wayland, dispmanx, cocoa) GstGLWindow will own the navigation_GThread/_GMainContext/_GMainLoop. GstGLWindow_X11/_Win32/_Cocoa/.. will create the window, attach a GSource, qnd implement GstVideoOverlay (i.e. set_window_handle / navigation) In glimagesink, the call to gst_gl_window_draw will be replaced by a new function gst_gl_surface_draw. gst_gl_context_thread_add will be replaced by a new gst_gl_message_loop_invoke.
While this is a nice idea, it's a lot of code churn for very little gain in something that's not really user-facing API. There are only so many platforms that we can support. There's one problem though and that is that the OSX/iOS parts don't use GMainLoop anymore instead relying on GCD for their function marshalling. Unless you or someone else is going to work on this, then this isn't going to happen anytime soon.
Not really going to be implemented.