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 }}
Hierarchy
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstElement ╰──GstBaseSink ╰──GstVideoSink ╰──gtk4paintablesink
Implemented interfaces
Factory details
Authors: – Bilal Elmoussaoui
Classification: – Sink/Video
Rank – none
Plugin – gtk4
Package – gst-plugin-gtk4
Pad Templates
sink
video/x-raw(memory:GLMemory, meta:GstVideoOverlayComposition):
format: { RGBA, RGB }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
texture-target: 2D
video/x-raw(memory:GLMemory):
format: { RGBA, RGB }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
texture-target: 2D
video/x-raw(memory:SystemMemory, meta:GstVideoOverlayComposition):
format: { BGRA, ARGB, RGBA, ABGR, RGB, BGR }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
video/x-raw(meta:GstVideoOverlayComposition):
format: { BGRA, ARGB, RGBA, ABGR, RGB, BGR }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
video/x-raw:
format: { BGRA, ARGB, RGBA, ABGR, RGB, BGR }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
Properties
window-height
“window-height” guint
the height of the main widget rendering the paintable
Flags : Read / Write
Default value : 0
window-width
“window-width” guint
the width of the main widget rendering the paintable
Flags : Read / Write
Default value : 0
Properties
background-color
“background-color” guint
Background color to render behind the video frame and in the borders
Flags : Read / Write
Default value : 255
force-aspect-ratio
“force-aspect-ratio” gboolean
When enabled, scaling will respect original aspect ratio
Flags : Read / Write
Default value : false
gl-context
“gl-context” GdkGLContext *
GL context to use for rendering
Flags : Read / Write / Construct Only
orientation
“orientation” Gtk4paintable-sink-orientation *
Orientation of the video frames
Flags : Read / Write
Default value : auto (0)
scaling-filter
“scaling-filter” GskScalingFilter *
Scaling filter to use for rendering
Flags : Read / Write
Default value : linear (0)
use-scaling-filter
“use-scaling-filter” gboolean
Use selected scaling filter or GTK default for rendering
Flags : Read / Write
Default value : false
Named constants
Gtk4paintable-sink-orientation
Members
auto
(0) – Auto
rotate0
(1) – Rotate0
rotate90
(2) – Rotate90
rotate180
(3) – Rotate180
rotate270
(4) – Rotate270
flip-rotate0
(5) – FlipRotate0
flip-rotate90
(6) – FlipRotate90
flip-rotate180
(7) – FlipRotate180
flip-rotate270
(8) – FlipRotate270
The results of the search are