diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2023-09-12 10:19:37 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-09-20 13:22:41 +0300 |
commit | 95a7a3c0eca1799898dab5b321b72a5b394d87b1 (patch) | |
tree | f5e9a97b7e88e27e1f87dd6535957ce85d460118 /video | |
parent | c237cf2c34fe74bcd90fb9ff72d32f67377477d7 (diff) |
gtk4: Only support RGBA/RGB in the GL code path
For all other component orderings a shader is necessary to re-order the
components for what GTK expects.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1312>
Diffstat (limited to 'video')
-rw-r--r-- | video/gtk4/src/sink/imp.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/video/gtk4/src/sink/imp.rs b/video/gtk4/src/sink/imp.rs index 185ac4b10..6b23b71d8 100644 --- a/video/gtk4/src/sink/imp.rs +++ b/video/gtk4/src/sink/imp.rs @@ -168,15 +168,27 @@ impl ElementImpl for PaintableSink { ])), Some(gst::CapsFeatures::new(["meta:GstVideoOverlayComposition"])), ] { - let mut c = gst_video::video_make_raw_caps(&[ + const GL_FORMATS: &[gst_video::VideoFormat] = + &[gst_video::VideoFormat::Rgba, gst_video::VideoFormat::Rgb]; + const NON_GL_FORMATS: &[gst_video::VideoFormat] = &[ gst_video::VideoFormat::Bgra, gst_video::VideoFormat::Argb, gst_video::VideoFormat::Rgba, gst_video::VideoFormat::Abgr, gst_video::VideoFormat::Rgb, gst_video::VideoFormat::Bgr, - ]) - .build(); + ]; + + let formats = if features + .as_ref() + .is_some_and(|features| features.contains("memory:GLMemory")) + { + GL_FORMATS + } else { + NON_GL_FORMATS + }; + + let mut c = gst_video::video_make_raw_caps(formats).build(); if let Some(features) = features { let c = c.get_mut().unwrap(); |