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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/995>
This commit is contained in:
Sebastian Dröge 2022-11-30 11:58:26 +02:00
parent 599d3a4d8a
commit 8c457cfa04

View file

@ -42,7 +42,21 @@ fn create_ui(app: &gtk::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(&gtksink).unwrap();
convert.link(&gtksink).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();