Sebastian Dröge
bf3d302efc
gtk4: Always draw a black background behind the video frame
...
This makes sure that there is the same background behind the frame, no
matter if black borders have to be added or not. Without this a frame
that has transparency would change rendering depending on the layout.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1457 >
2024-02-12 17:52:08 +02:00
Sebastian Dröge
9dcb68edc8
gtk4: Improve handling of RGBA GL textures in GTK
...
GTK 4.14 comes with a new GL renderer that does not support GL shader
nodes anymore, so the conversion from non-premultiplied alpha to
premultiplied alpha has to happen differently.
For GTK 4.14 or newer we use the correct format directly when building the
texture, but only if a GLES3+ context is used. In that case the NGL renderer is
used by GTK, which supports non-premultiplied formats correctly and fast.
For GTK 4.10-4.12, or 4.14 and newer if a GLES2 context is used, we use a
self-mask to pre-multiply the alpha.
For GTK before 4.10, we use a GL shader and hope that it works.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/488
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1457 >
2024-02-12 17:51:27 +02:00
Ruben Gonzalez
7f041fe5c8
gtk4: Fix segfault running gst-inspect -a
when GTK4 and GTK3 is installed
...
Segmentation fault when getting default value of paintable property
from gtk4paintablesink element when libgtk-4.so.1 from libgstgtk4.so
and libgtk-3.so.0 from libgstgtk.so are installed:
> cannot register existing type 'GdkDisplayManager'
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/490
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1457 >
2024-02-12 17:51:02 +02:00
Guillaume Desmottes
cb906a9d55
gtk4: fix build on Windows using winegl
...
from_glib_full() was not in scope.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1457 >
2024-02-12 17:43:15 +02:00
Sebastian Dröge
ed5b090318
gtk4: Use async-channel instead of the glib MainContext channel
...
The latter will be removed in favour of using async code in the future,
and async code generally allows for more flexible message handling than the
callback based MainContext channel.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1410 >
2023-12-18 10:46:42 +02:00
Sebastian Dröge
a5bcc9099b
gtk4: Only support RGBA/RGB in the GL code path
...
For all other component orderings a shader is necessary to re-order the
components for what GTK expects.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1331 >
2023-09-20 19:58:54 +03:00
Ivan Molodetskikh
432782d09a
gtk4: Premultiply alpha in GL textures
...
GTK expects GL textures to have premultiplied alpha. The ones we get
from GStreamer don't, leading to incorrect rendering of semitransparent
frames.
GTK 4.12 gained an API to set a different GL texture format, but it
won't help for older GTK versions. Plus, at the time of writing, it
causes a very slow download/upload path in GTK.
So, use a GTK GL shader node to premultiply the alpha without leaving
the GPU.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1331 >
2023-09-20 19:58:49 +03:00
Bilal Elmoussaoui
dd2d7d9215
Use re-exported once_cell
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1268 >
2023-07-06 17:50:49 +03:00
Bilal Elmoussaoui
2cc98bf410
Adapt to glib::Continue rename
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1268 >
2023-07-06 17:50:49 +03:00
Jayson Reis
e58abf0705
gtk4: Make winegl code compilable
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1255 >
2023-06-23 11:16:40 +03:00
Jayson Reis
d3d78846dc
gtk4: Fix code to run on current main branch
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1255 >
2023-06-22 14:45:28 +02:00
Sebastian Dröge
dcb80ac105
gtk4: Add support for GL on Windows
...
This implements all the workarounds for Windows-specific complications
that the GTK GStreamer mediafile implementation also does.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1255 >
2023-06-22 07:43:57 +02:00
Jan Beich
8d6751c88d
gtk4: unbreak wayland, x11egl, x11glx features on non-Linux
...
As the features are non-default leave the responsibility to filter by
platform to consumers.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1191 >
2023-04-22 12:58:29 +00:00
Sebastian Dröge
cc3646640e
Fix a couple of new Rust 1.69 clippy warnings
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1186 >
2023-04-20 16:47:45 +03:00
Carlo Cabrera
825fe9a4e2
gtk4: Fix compilation on macOS
...
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/332
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1138 >
2023-03-18 16:05:30 +02:00
Sebastian Dröge
f7c8940ff2
gtk4: Update for glib::Priority
API changes
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1132 >
2023-03-12 10:27:16 +02:00
Sebastian Dröge
bca4af0c79
gtk4: Set sync point on the video frame after mapping it
...
Otherwise it is not always ready for use yet in GTK even after waiting
on the sync point, and a fully transparent texture is rendered instead.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/320
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1103 >
2023-02-24 11:52:28 +02:00
Sebastian Dröge
ce1faa6020
gtk4: Attach channel receiver to the default main context from the main thread
...
It requires acquiring the main context for thread-safety reasons and
that is only possible from the main thread itself.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/319
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1099 >
2023-02-22 10:02:45 +02:00
Sebastian Dröge
8aa5125d5b
gtk4: Refactor and simplify GL context handling
...
Create a single, global GDK GL context and the corresponding GStreamer
GL display and wrapped GStreamer GL context when initializing the first
sink and continue using that for all further sinks.
Additionally, don't create a full GStreamer GL context inside the sink
but only distribute the wrapped GL context in the pipeline so that
elements that actually need a full GL context can create one that is
sharing with that one. The sink itself does not need a full GStreamer GL
context.
Then inside the sink check that any GL memory that arrives was created
by a GL context that can share with the wrapped GDK GL context and only
then use it.
And lastly, use the correct GL contexts for a) creating a sync point and
b) actually waiting on it.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/318
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1099 >
2023-02-21 21:36:45 +02:00
Sebastian Dröge
5c2de6aeb6
gtk4: Update for GLDisplay
object lock requirements
2023-02-06 11:10:02 +02:00
Sebastian Dröge
62bfc545d3
gtk4: Fix compilation after gst_gl::Display
API changes
2023-01-27 20:46:22 +02:00
Sebastian Dröge
3b4c48d9f5
Fix various new clippy warnings
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1062 >
2023-01-25 10:31:19 +02:00
Sebastian Dröge
b6af64b970
gtk4: Only provide a buffer pool to upstream if it requested one
2023-01-19 16:37:02 +02:00
Sebastian Dröge
d1196c3e28
gtk4: Update for allocation query caps API changes
...
And make no caps into a non-error.
2023-01-19 16:36:37 +02:00
Sebastian Dröge
03df4f253c
gtk4: Asynchronously flush frames from GDK
...
There is no need to wait until the frames are flushed as the textures
will be kept alive until GDK is finished with them, and doing so can
cause deadlocks.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/287
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1052 >
2023-01-19 13:53:21 +02:00
Sebastian Dröge
b161f56a5c
gtk4: Keep GstGLMemory
alive as long as it is used inside GDK
...
Otherwise the texture might be released in the meantime and GDK would
use an invalid GL texture ID.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/287
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1052 >
2023-01-19 13:51:57 +02:00
Sebastian Dröge
6132788b02
Update for caps/structure-related string API changes
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1048 >
2023-01-15 22:58:44 +02:00
Sebastian Dröge
58c21d9868
gtk4: Propagate the GL display to the remainder of the pipeline
...
This allows sharing it with other parts of the pipeline and avoids
creating different, incompatible displays/contexts in different parts of
the pipeline.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1037 >
2023-01-07 12:42:42 +02:00
Sebastian Dröge
439ada614c
gtk4: Rename a variable to make more sense
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1032 >
2022-12-29 11:13:25 +02:00
Sebastian Dröge
f72540f5c2
gtk4: Handle more GL context creation failures gracefully
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1032 >
2022-12-29 11:13:25 +02:00
Sebastian Dröge
9ec06199b1
gtk4: Reset app context and display if GL context creation fails
...
No need to keep them around and that way we either have all 3 values set
or none of them.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1032 >
2022-12-29 11:13:25 +02:00
Sebastian Dröge
4ee70913bd
gtk4: Reduce number of unwraps during GL context creation and query handling
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1032 >
2022-12-29 11:13:25 +02:00
Jordan Petridis
cf0ba40115
video/gtk4: Fix typo in info logs
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1030 >
2022-12-29 02:59:26 +00:00
Nirbheek Chauhan
9ee7118bf6
gtk4: Remove 'gst' prefix from another debug category
...
Missed it last time. Caught all of them this time. Continuation from:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1029
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1025 >
2022-12-28 23:55:10 +05:30
Nirbheek Chauhan
06123d74ba
gtk4: Use GL implicitly without the gst_gl feature on macOS
...
We already require gstreamer-gl as a dependency on macOS, so reflect
that in the code too.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1025 >
2022-12-28 23:55:10 +05:30
Sebastian Dröge
4fe0786bbd
gtk4: Add support for GL on macOS
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1025 >
2022-12-28 23:55:10 +05:30
Nirbheek Chauhan
ae9ac872c0
gtk4: Remove 'gst' from gtksink debug category name
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1029 >
2022-12-28 19:38:57 +05:30
Sebastian Dröge
ca17c9bc4f
gtk4: Release GStreamer GL context and display when going back to NULL state
...
And acquire it again next time when going to READY state.
Also clean up the whole GL context initialization.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1024 >
2022-12-22 22:56:48 +00:00
Sebastian Dröge
1026949b2b
gtk4: Use glib::ThreadGuard
instead of the fragile crate
...
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/272
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1024 >
2022-12-22 22:56:48 +00:00
Sebastian Dröge
52764e140e
gtk4: Don't try to use GL mapped video frames as raw RGB memory
...
This will fail badly because the memory pointers are actually GL texture
IDs, however this case can't really happen in practice so simply assert
on this.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1024 >
2022-12-22 22:56:48 +00:00
Sebastian Dröge
30e501e7b0
gtk4: Don't error out when the main context channel does not exist anymore when rendering
...
But instead return flushing to shut down silently.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1024 >
2022-12-22 22:56:48 +00:00
Sebastian Dröge
0c8e69ed7c
gtk4: Flush frames from the paintable when shutting down the sink
...
Otherwise it will continue showing the last frames forever and keep
around the frames forever instead of rendering black.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/281
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1024 >
2022-12-22 22:56:48 +00:00
Sebastian Dröge
a077ecba85
gtk4: Deactivate application GL context again after fill_info()
...
It does not need to be activate anymore, and keeping it active can cause
problems.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1001 >
2022-12-12 10:51:15 +02:00
Jordan Petridis
37b0dab0e8
gtk4: Deactivate the context if we fail to fill_info
...
Avoid leaving the context activated if we end up erroring out.
Similar to https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3492
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1001 >
2022-12-12 10:51:09 +02:00
Sebastian Dröge
599d3a4d8a
gtk4: Make GL support fully optional
...
Don't depend on gstreamer-gl if it's not enabled, and don't try doing
anything with the GDK GL context at all.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/995 >
2022-11-30 11:59:53 +02:00
Jordan Petridis
975f0141be
video/gtk4: Implement support for GLTextures when possible.
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/588 >
2022-11-29 21:18:46 +02:00
Jordan Petridis
51c34267a9
video/gtk4: Restrict visibility of struct related to the Frame
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/588 >
2022-11-29 21:06:12 +02:00
Jordan Petridis
ea6c59e5e9
video/gtk4: Rename Object types and struct to something simpler
...
Avoid the confusion caused by SinkPaintable and PaintableSink,
and instead refer to the objects as Paintable for the GdkPaintable
subclass or PaintalbeSink for the gst element.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/588 >
2022-11-29 21:06:12 +02:00
Sebastian Dröge
a8250abbf1
Fix various new clippy warnings
2022-11-01 10:27:48 +02:00
Sebastian Dröge
9a68f6e221
Move from imp.instance()
to imp.obj()
...
It's doing the same thing and is shorter.
2022-10-23 23:08:46 +03:00