Skip to content

gstreamer-gl: allow writable videoframe mappings

Anders Hellerup Madsen requested to merge ahem/gstreamer-rs:gl-functions into main

The PR adds some pieces which are missing to be able to render OpenGL shaders on GLMemory buffers with the Rust bindings, similar to how for example the GstGLFilter subclasses in main gstreamer (gstreamer-plugins-base).

The PR manual implementations for get_gl_context_add_thread and gst_gl_framebuffer_draw_to_texture which were missing.

Since gst_gl_framebuffer_draw_to_texture takes a GLMemory as input, I decided to change the way the Rust bindings provides GL mapping of videoframes to be Videoframe<ReadableGL> instead of plain Videoframe<Readable>, and also adds Videoframe<WritableGL>. I added methods to access the mapped GLMemory objects through those structures.

This mirrors how the GstGLFilter classes work in main GStreamer - see for example this function: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglfilter.c#L928-988

The reasoning behind changing the API for GL mapping of video frames, is that the GL-specific funtions added in the Ext traits doesn't make sense for plain non-GL videoframes.

There is a micro repository with an example of how the functions can be used here: https://gitlab.freedesktop.org/ahem/gst-simplegltransform

Edited by Anders Hellerup Madsen

Merge request reports

Loading