Skip to content

gl: Change GL VideoFrame implementation

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

Following the discussion on !1279 (closed) this merge request changes the implementation for GL mapped video frames in the Rust bindings.

This is supposed to address these problems in the current implementation:

  • When the VideoFrameGLExt trait is in scope all VideoFrame objects provides the texture_id function - not only those that are mapped with the GL methods.
  • Similarly, VideoFrame objects that are mapped with the GL methods will provide all the methods that non-GL VideoFrame objects use to access planar data, even though they don't make sense at all for GL video frames.

To solve this I introduced new GLVideoFrame and GLVideoFrameRef structs that mirror the ones in gst-video. To avoid unnecessary code duplication I extracted as many shared accessor functions I could into a new VideoFrameExt trait.

Note that this is a breaking change in the API, as can be seen in the examples/src/glupload.rs file. Instead of this:

gst_video::VideoFrame::from_buffer_readable_gl(buffer, &info)

one now has to do:

gst_gl::GLVideoFrame::from_buffer_readable(buffer, &info)

Merge request reports

Loading