Sebastian Dröge
289fdaf490
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/1456 >
2024-02-12 19:07:07 +02:00
Ruben Gonzalez
ea93b8896d
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/1456 >
2024-02-12 19:07:07 +02:00
Sebastian Dröge
755f021a30
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/1328 >
2023-09-20 13:52:34 +03:00
Ivan Molodetskikh
4da3bbf1d3
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/1328 >
2023-09-20 13:52:34 +03:00
Jan Beich
fc5ff9503d
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/1204 >
2023-05-09 16:50:43 +03:00
Carlo Cabrera
c5dbacb6a7
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/1140 >
2023-03-19 17:40:42 +02:00
Sebastian Dröge
ef7f0d12bf
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/1106 >
2023-02-25 12:52:46 +02:00
Sebastian Dröge
2723fc4713
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/1101 >
2023-02-22 14:24:51 +02:00
Sebastian Dröge
5c21b10841
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/1101 >
2023-02-22 14:24:21 +02:00
Sebastian Dröge
711313c4c5
gtk4: Only provide a buffer pool to upstream if it requested one
2023-01-19 16:40:45 +02:00
Sebastian Dröge
c83f48f0a1
gtk4: Make no caps in the allocation query a non-error
2023-01-19 16:40:26 +02:00
Sebastian Dröge
101bcbc1a0
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/1053 >
2023-01-19 15:40:04 +02:00
Sebastian Dröge
2a68be2000
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/1053 >
2023-01-19 15:40:03 +02:00
Sebastian Dröge
db9ef0b2af
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/1038 >
2023-01-07 13:25:49 +02:00
Sebastian Dröge
ff1c99df98
gtk4: Rename a variable to make more sense
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1038 >
2023-01-07 13:25:00 +02:00
Sebastian Dröge
696944c08e
gtk4: Handle more GL context creation failures gracefully
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1038 >
2023-01-07 13:24:53 +02:00
Sebastian Dröge
37dedfd4d0
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/1038 >
2023-01-07 13:24:48 +02:00
Sebastian Dröge
bb2f632c9c
gtk4: Reduce number of unwraps during GL context creation and query handling
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1038 >
2023-01-07 13:24:42 +02:00
Jordan Petridis
f6b092d2af
video/gtk4: Fix typo in info logs
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1038 >
2023-01-07 13:24:30 +02:00
Nirbheek Chauhan
a0dbb94e01
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/1038 >
2023-01-07 13:24:12 +02:00
Nirbheek Chauhan
9f8fa99089
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/1038 >
2023-01-07 13:23:59 +02:00
Sebastian Dröge
34434bd877
gtk4: Add support for GL on macOS
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1038 >
2023-01-07 13:23:53 +02:00
Nirbheek Chauhan
2045847bd6
gtk4: Remove 'gst' from gtksink debug category name
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1038 >
2023-01-07 13:23:23 +02:00
Sebastian Dröge
e95a2c1016
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/1027 >
2022-12-27 12:39:56 +02:00
Sebastian Dröge
31760b8f9a
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/1027 >
2022-12-27 12:39:56 +02:00
Sebastian Dröge
8d7ce380c4
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/1027 >
2022-12-27 12:39:56 +02:00
Sebastian Dröge
e8701652e2
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/1027 >
2022-12-27 12:39:56 +02:00
Sebastian Dröge
993619d654
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/1027 >
2022-12-27 12:39:56 +02:00
Sebastian Dröge
71558bd086
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/1008 >
2022-12-12 13:39:55 +02:00
Jordan Petridis
b689a0825e
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/1008 >
2022-12-12 13:39:50 +02:00
Sebastian Dröge
0b2aa2646f
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/1008 >
2022-12-12 13:35:07 +02:00
Jordan Petridis
507377c052
video/gtk4: Implement support for GLTextures when possible.
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1008 >
2022-12-12 13:34:22 +02:00
Jordan Petridis
f590b7e62f
video/gtk4: Restrict visibility of struct related to the Frame
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1008 >
2022-12-12 13:32:32 +02:00
Jordan Petridis
9fa3d88a63
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/1008 >
2022-12-12 13:32:25 +02:00
Sebastian Dröge
07f3b0f504
Fix various new clippy warnings
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/977 >
2022-11-12 15:52:49 +00: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
Sebastian Dröge
f045099fc1
Fix GObject type names, GStreamer debug category names and element factory names
...
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/198
2022-10-23 20:46:08 +03:00
Sebastian Dröge
7ee4afacf4
Change *Impl trait methods to only take &self and not Self::Type in addition
2022-10-10 15:03:25 +03:00
Sebastian Dröge
4c57a97d4d
Update for glib::Object::new() API changes
2022-10-07 23:54:53 +03:00
Sebastian Dröge
1a40186485
Update for GLib ParamSpec builder API changes
2022-09-05 11:45:47 +03:00
Vivia Nikolaidou
5606111345
plugins: Simplify code using ParamSpecBuilder
2022-08-22 17:58:43 +03:00
Sebastian Dröge
b38f6cc731
Remove now unnecessary Send+Sync
impls for element/etc subclasses
...
This is now automatically implemented.
2022-02-28 18:56:58 +02:00
François Laignel
422ea740ca
Update to gst::_log_macro_
...
See the details:
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/980
2022-02-21 20:50:01 +01:00
Sebastian Dröge
858865b731
gtk4: Attach main context receiver from the main context's thread
...
Otherwise it will fail if the sink's state is changed from a different
thread.
See https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio/-/issues/2
2022-02-04 13:51:31 +02:00
Julian Sparber
e419c18a87
gtk4: Implement Default for PaintableSink
2022-01-31 14:11:03 +00:00
Sebastian Dröge
f44b86cd30
Simplify some code around event/query views
2022-01-22 12:18:02 +02:00
Sebastian Dröge
65fcd55160
Update for event/message/query view API changes
2022-01-19 15:07:45 +02:00
Sebastian Dröge
763ad0cb18
Rename self_
variables to imp
for consistency
2022-01-17 20:09:18 +02:00
Sebastian Dröge
b2d0172422
Replace Foo::from_instance(foo)
with foo.imp()
2022-01-17 19:36:41 +02:00
Sebastian Dröge
81f5f0f60c
Fix various clippy warnings
2022-01-12 19:51:08 +02:00