Skip to content

Draft: Introduce the GL integration crate

Introduce the GL integration crate: a crate that retrieves gst_gl::GLContext and gst_gl::GLDisplay from "common" sources in the Rust ecosystem: a RawWindowHandle, and as bonus also from glutin::WindowedContext.

This substitutes the matching logic that was originally in the glupload example to be expandable and reusable by other crates, similar to how the ash-window crate exists for ash (turns RawWindowHandles into Vulkan Surface).

Since a GLDisplay acquired from a RawWindowHandle is only half the info we need and has an incomplete implementation currently (no support for Android or Windows), a second function retrieves GLContext from glutin together with display fallbacks for EGL-based windows.

Most interesting is probably to find a public crate or two using these bindings, and see if we can migrate them over to this crate as a final review of the API and versatility. At the same time they might support more platforms too. So far shows only a single crate, supporting Wgl and Glx:

Remaining tasks

  • TODO comments in code;
  • Deal with Wgl handles to support Windows;
  • XCB constructor in gstreamer-base (backported, or with a fallback written in pure Rust);
  • Returning Result/Option instead of panicking;
  • Move code out of cfg_if to:
    • Have rustfmt work on the contents;
    • Get rid of some unexpected clippy warnings related to use items after statements (despite supposedly sitting at the top of a #[cfg] block - and #[allow] not being allowed inside the cfg_if block either);
    • Reduce indentation and make it more readable overall;
  • Documentation, readme, etc.
Edited by Marijn Suijten

Merge request reports