From 8c457cfa04cd413e0a4ebb28c838a59b44879af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 30 Nov 2022 11:58:26 +0200 Subject: [PATCH] gtk4: example: Use a bin with a `videoconvert` in the non-GL case The sink only supports RGB formats in that case, which decoders rarely would output. Part-of: --- video/gtk4/examples/gtksink.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/video/gtk4/examples/gtksink.rs b/video/gtk4/examples/gtksink.rs index bf271dd8..867dc1ea 100644 --- a/video/gtk4/examples/gtksink.rs +++ b/video/gtk4/examples/gtksink.rs @@ -42,7 +42,21 @@ fn create_ui(app: >k::Application) { (src, sink) } else { let src = gst::ElementFactory::make("videotestsrc").build().unwrap(); - (src, gtksink) + + let sink = gst::Bin::default(); + let convert = gst::ElementFactory::make("videoconvert").build().unwrap(); + + sink.add(&convert).unwrap(); + sink.add(>ksink).unwrap(); + convert.link(>ksink).unwrap(); + + sink.add_pad( + &gst::GhostPad::with_target(Some("sink"), &convert.static_pad("sink").unwrap()) + .unwrap(), + ) + .unwrap(); + + (src, sink.upcast()) }; pipeline.add_many(&[&src, &overlay, &sink]).unwrap();