Skip to content

gtk: add GTK4 support

Rafał Dzięgiel requested to merge Rafostar/gst-plugins-good:GTK4 into master

This commit adds required changes to compile the "gtk" plugin against GTK4 from the same source code. The output "gtk4" plugin includes "gtk4sink" and "gtk4glsink".

Closes #338 (closed)

I did my best to port the "gtk" plugin to GTK4 without having to duplicate the code, which was done (by someone else) and rejected by the devs here some time ago.

After this change the "gtk" plugin can be compiled with either GTK3 or GTK4. I had to rework pretty much the whole part of GTK code. To achieve compatibility, I replaced deprecated events with "EventControllers" which raised the minimum required GTK3 version to 3.24, but this should not be a problem as I think most linux distros that will receive GStreamer 1.20 will have that version by then. GTK4 had an important bug-fix that improved rendering a LOT in 3.99.2, so I set that as minimal version.

I also replaced user-visible "Gtk+" strings with "GTK" in the code, as this is the current trend set by GTK devs (proof here).

The meson build script was tweaked to compile both plugins in a single loop. Due to a way GStreamer loads (and registers) plugins, "gtk" and "gtk4" plugins CANNOT be both installed on the same system (it would create GTK versions conflicts inside gstreamer). To avoid this gtk4 plugin is disabled by default.

If I understand correctly the Navigation and keybindings in the plugin were done to allow DVD menu controls, right? Unfortunately I do not have a CD drive in any PC, so I could not test this feature after introducing event controllers. At first glance, everything else appears to be working for both GTK3 and GTK4. Oh, and since this change-set introduces a new "gtk4" plugin with most GTK logic reworked by me, I added myself as a second author for GTK4 version. Hope you do not mind.

Please review. Thanks.

Edited by Rafał Dzięgiel

Merge request reports