From 95a7a3c0eca1799898dab5b321b72a5b394d87b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 12 Sep 2023 10:19:37 +0300 Subject: 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: --- video/gtk4/src/sink/imp.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'video') 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(); -- cgit v1.2.3