Merge branch 'gtk4-fullscreen' into 'main'

gtk4paintablesink: Add env var to fullscreen window

See merge request gstreamer/gst-plugins-rs!1555
This commit is contained in:
Robert Mader 2024-04-30 07:01:27 +00:00
commit 4d8775cc77
3 changed files with 35 additions and 0 deletions

View file

@ -16,6 +16,11 @@ new features or more efficient processing can be opted in with the `gtk_v4_10`,
sink is GTK 4.4 on Linux without GL support, and 4.6 on Windows and macOS, and
on Linux with GL support.
The sink will provides a simple test window when launched via `gst-launch-1.0`
or `gst-play-1.0` or if the environment variable `GST_GTK4_WINDOW=1` is set.
Setting `GST_GTK4_WINDOW_FULLSCREEN=1` will make the window launch in fullscreen
mode.
# Flatpak Integration
To build and include the plugin in a Flatpak manifest, you can add the following snippet to your json manifest:

View file

@ -297,6 +297,7 @@ impl ElementImpl for PaintableSink {
match transition {
gst::StateChange::NullToReady => {
let create_window = glib::program_name().as_deref() == Some("gst-launch-1.0")
|| glib::program_name().as_deref() == Some("gst-play-1.0")
|| std::env::var("GST_GTK4_WINDOW").as_deref() == Ok("1");
if create_window {
@ -713,6 +714,9 @@ impl PaintableSink {
window.set_child(Some(&picture));
}
window.set_default_size(640, 480);
if std::env::var("GST_GTK4_WINDOW_FULLSCREEN").as_deref() == Ok("1") {
window.set_fullscreened(true);
}
window.connect_close_request({
let self_ = self_.clone();

View file

@ -9,6 +9,32 @@
//
// SPDX-License-Identifier: MPL-2.0
/**
* SECTION:element-gtk4paintablesink
*
* GTK 4 provides `gtk::Video` & `gtk::Picture` for rendering media such as videos. As the default
* `gtk::Video` widget doesn't offer the possibility to use a custom `gst::Pipeline`. The plugin
* provides a `gst_video::VideoSink` along with a `gdk::Paintable` that's capable of rendering the
* sink's frames.
*
* The sink can generate GL Textures if the system is capable of it, but it needs to be compiled
* with either `wayland`, `x11glx` or `x11egl` cargo features. On Windows and macOS this is enabled
* by default.
*
* Additionally, the sink can render DMABufs directly on Linux if GTK 4.14 or newer is used. For
* this the `dmabuf` feature needs to be enabled.
*
* Depending on the GTK version that is used and should be supported as minimum, new features or
* more efficient processing can be opted in with the `gtk_v4_10`, `gtk_v4_12` and `gtk_v4_14`
* features. The minimum GTK version required by the sink is GTK 4.4 on Linux without GL support,
* and 4.6 on Windows and macOS, and on Linux with GL support.
*
* The sink will provides a simple test window when launched via `gst-launch-1.0` or `gst-play-1.0`
* or if the environment variable `GST_GTK4_WINDOW=1` is set. Setting `GST_GTK4_WINDOW_FULLSCREEN=1`
* will make the window launch in fullscreen mode.
*
* {{ videos/gtk4/examples/gtksink.rs }}
*/
use gtk::glib;
use gtk::glib::prelude::*;