Commit graph

430 commits

Author SHA1 Message Date
Sebastian Dröge 9f7eae9693 Update versions to 0.21.3 2023-12-18 11:03:07 +02:00
Sebastian Dröge 5c8c29f7e4 examples: Add a few more docs/comments to the subclass/virtual methods example
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1366>
2023-12-18 09:57:10 +02:00
Sebastian Dröge 593de5c551 examples: Add an example that shows how to write subclasses with virtual methods
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1366>
2023-12-18 09:57:04 +02:00
Sebastian Dröge ef84e3e71b examples: Update to windows 0.52
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1366>
2023-12-18 09:56:22 +02:00
Sebastian Dröge fc3fb363e7 examples: play: Set message bus to flushing before dropping the Play reference
Otherwise there might be pending messages on the bus that keep a
reference to the `Play` instance alive, and neither the bus nor the
`Play` are ever going to be freed then.

See also https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/489
and https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3107.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/493

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1366>
2023-12-18 09:53:19 +02:00
Sebastian Dröge 25e13209db Update versions to 0.21.2 2023-11-11 15:55:15 +02:00
Marijn Suijten 6b95762ea7 examples/glupload: Upgrade to glutin 0.31
Glutin completely detached from `winit` in the `0.30` upgrade, concerning
itself exclusively with OpenGL and WSI APIs around it and leaving any
windowing system interop to the `raw-window-handle` crate specifically
designed for this purpose.

This untanglement massively cleans up and simplifies the `glutin`
codebase, and expands on surfaceless rendering as well as drawing to
simple views (textures) on the screen as is common on Android, without
having control over the entire "window" and event loop.

Some winit boilerplate is however still provided as part of the
`glutin-winit` crate.  Most of the `glutin`+`winit` flow in this
`glupload` example is adopted from `glutin`'s example, following
platform-specific initialization sequences that heavily clutter the code
(only creating a window upfront on Windows, only forcing transparency on
macOS, and trying various fallback attributes to create a context).

At the same time `winit`'s `Event::Resumed` and `Event::Suspended`
event strategy is adopted: this event was previously for Android and
iOS exclusively - where window handles come and go at the merit of
the OS, rather than existing for the lifetime of the application -
but is now emitted on all platforms for consistency.  A `Surface` (via
`RawWindowHandle`) is only available and usable after `Event::Resumed`,
where we can create a GL surface and "current" the context on that
surface for rendering.  This is where the `GstPipeline` will be set
to `Playing` so that data starts flowing.  The inverse should happen in
`Event::Suspended` where the `Surface` has to be given up again after
un-currenting, before giving control back to the OS to free the rest of
the resources.  This will however be implemented when Android is brought
online for these examples.

Finally, now that the `gst-gl-egl` and `gst-gl-x11` features turn on
the relevant features in `glutin` and `winit`, it is now possible to
easily test `x11` on Wayland (over XWayland) without even unsetting
`WAYLAND_DISPLAY`, by simply compiling the whole stack without EGL/
Wayland support (on the previous example `winit` would always default to
a Wayland handle, while `glupload` could only create `GstGLDisplayX11`).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1344>
2023-11-11 11:40:28 +02:00
Marijn Suijten cb40917ac9 examples/glupload: Pass actual program handle to glGetProgramiv()
This is what you get with an untyped API.  `glGetError()` further down
the line was returning `GL_INVALID_OPERATION` and failing other calls
after `load()` in the `glutin 0.31` upgrade.  This turns out to be
[returned by `glGetProgramiv`] when the `program` that is passed in
does not refer to a program object.  Which was the case here, where the
fragment shader identifier was passed in instead.

Just in case we insert a few extra asserts that check the result of
`glGetError()` to catch such issues earlier on in the chain, instead of
postponing them and falsely accusing code that runs later.

[returned by `glGetProgramiv`]: https://registry.khronos.org/OpenGL-Refpages/es2.0/xhtml/glGetProgramiv.xml#errors

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1344>
2023-11-11 11:34:42 +02:00
Marijn Suijten 4c0f03d5fd examples/glupload: Remove Wayland display integration
`GstGLDisplayWayland` calls GstGLDisplayEGL::from_gl_display()` under
the hood (which calls `GstGLDisplayEGL::from_native()`, which calls
`eglGetPlatformDisplay()`) to retrieve the underlying `EGLDisplay`
handle, which thus far seems to be the same value as `glutin`.  However,
newer `glutin 0.31` passes attributes to this function resulting in a
different handle, causing all kinds of trouble further down the line
when sharing resources between `glutin` and `gstreamer-rs` that both
operate on a distinct `EGLDisplay`.

Furthermore `GstGLDisplayEGL` thinks that it uniquely owns the
handle returned by `eglGetPlatformDisplay()` and _does not_ set
`.foreign_display = TRUE` (which `GstGLDisplayEGL::with_egl_display()`
would), causing it to call `eglTerminate()` as soon as the
`GstGLDisplay` is destroyed, leaving `glutin` dysfunctional.

To solve all of this, simply remove this wrongly-behaving class from the
example as it is not suitable for sharing an `EGLDisplay` with `glutin`.

It might however be interesting to create a different example that
showcases how to use raw window handles instead of EGL/GLX handles,
however only Wayland and any platform on EGL like Android, via
`GstGLDisplayEGL::from_native()`, support this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1344>
2023-11-11 11:34:42 +02:00
Marijn Suijten 07d9fba822 examples/glupload: Sanity-check that the EGL display via Wayland equals glutin
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1344>
2023-11-11 11:34:42 +02:00
Marijn Suijten 8e4a561a41 examples: Return anyhow::Result out of main()
It is annoying to see only a single line of error when debugging a chain
of (e.g. `anyhow::Context::context()`-created) errors, and have a
zero exit-code while at it.

Instead Rust supports returning a `Result` type straight from main which
is `Debug`- instead of `Display`-printed, so that - in the case of
`anyhow::Error` - all nested (via `.source()`) `Error`s are printed in
backtrace-like form, and the exit code is appropriately non-zero.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1344>
2023-11-11 11:34:42 +02:00
Sebastian Dröge 03c4721aa3 Use let-else instead of match for weak reference upgrades
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1337>
2023-11-03 11:09:35 +02:00
Sebastian Dröge c2b5341b8f gstreamer: Add accessors for PadProbeDatas on PadProbeInfo
And make use of it in examples and other code.

This allows to simplify usage a bit in most cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1337>
2023-11-03 11:09:35 +02:00
Sebastian Dröge 08efe21002 examples: Updates to memmap2 0.9
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1337>
2023-11-03 10:46:18 +02:00
Sebastian Dröge 4e9b155b90 Update versions to 0.21.1 2023-10-04 10:13:26 +03:00
Sebastian Dröge ee176b9b07 examples: Update to memmap2 0.8
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1318>
2023-10-03 19:38:44 +03:00
Sebastian Dröge b0e5419d7d examples: Update to windows 0.51
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1318>
2023-10-03 19:36:53 +03:00
Sebastian Dröge fd40a98f8c examples: Update to uds 0.4
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1318>
2023-10-03 19:36:45 +03:00
Sebastian Dröge cee6d20ad8 Add version = "0.21" to all local dependencies 2023-08-08 18:15:44 +03:00
Sebastian Dröge 5b928af1f5 Update dependencies to gtk-rs-core 0.18 branch 2023-08-08 17:51:16 +03:00
Kourosh Firoozbakht 1e2e57836f examples: fix typo
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1300>
2023-07-26 01:42:02 +00:00
Sebastian Dröge 2abf75122d Update minimum supported Rust version to 1.70
gtk-rs will update soonish too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1298>
2023-07-19 09:24:10 +03:00
Sebastian Dröge 89ab9d09c8 Remove GTK3 examples/tutorials
GTK3 is deprecated and the GTK videooverlay example does not even work
on modern systems with Wayland anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1293>
2023-07-06 17:25:28 +03:00
Bilal Elmoussaoui f9fa7f55fc Use re-exported once_cell
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1293>
2023-07-06 16:50:35 +03:00
Bilal Elmoussaoui b156ba2c59 Adapt to glib::Continue rename
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1293>
2023-07-06 16:50:35 +03:00
Sebastian Dröge 7c67375d99 examples: Reduce dependencies of the thumbnail example
Instead of depending on libraries for every possible image format,
depend only on the JPEG and PNG libraries.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1281>
2023-06-26 14:14:45 +03:00
Sebastian Dröge b59680f437 Update to cocoa 0.25
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1281>
2023-06-26 14:00:54 +03:00
Sebastian Dröge d72884685a examples: Update to memmap2 0.7
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1275>
2023-06-12 13:22:28 +03:00
Daniel Pendse 2becc79dfb rtsp-server: Add RTSPContext uri getter
Add uri getter from RTSPContext

Fix #469

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1271>
2023-06-05 10:41:59 +02:00
Sebastian Dröge b6919d7c99 examples: Update for DiscovererStreamInfo::stream_id() being nullable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1266>
2023-05-22 12:17:13 +03:00
Sebastian Dröge ccf3b57a8b examples: Update to memmap2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1262>
2023-05-12 09:44:03 +03:00
Johan Sternerup e026d922e4 gstreamr: bus: Add BusWatchGuard to automatically remove watch
Previously, with add_watch()/add_watch_local() you had to remember
calling remove_watch() in order not to leak the bus, the watch source
and two associated file descriptors. Now these methods instead return an
object of type BusWatchGuard that will automatically remove the bus
watch when the object is dropped.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1248>
2023-04-14 11:53:41 +03:00
Guillaume Desmottes e75391139c fix typos in comments
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1246>
2023-04-07 17:09:48 +02:00
Seungha Yang 6cb19c1f18 examples: Add Direct2D/DirectWrite text rendering example
Similar to overlay-composition example but for Direct2D/DirectWrite

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1206>
2023-04-04 09:09:18 +00:00
Sebastian Dröge 81a5f25f81 examples: Update to windows 0.48
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1241>
2023-04-01 12:00:53 +03:00
Sebastian Dröge a7131fc051 examples: Update to windows 0.47
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1240>
2023-03-31 11:50:51 +03:00
Sebastian Dröge 6d3c9d931b examples: Update to windows 0.46
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1239>
2023-03-14 11:24:08 +00:00
Guillaume Desmottes 01d3cef73e gstreamer: element: more generic (un)link_many() API
No longer enforces to pass an array of references.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1230>
2023-03-09 14:27:25 +00:00
Guillaume Desmottes c4a968a403 gstreamer: bin: more generic {add,remove}_many() API
No longer enforces to pass an array of references.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1230>
2023-03-09 14:27:25 +00:00
Ruben Gonzalez 0b922b0e89 examples: zoom effect with compositor and navigations events
Use can change the video player zoom using the next keys:

  * +: Zoom in
  * -: Zoom out
  * Up/Down/Right/Left: Move the frame
  * r: reset the zoom

Also mouse navigation events can be used for a better UX.

Furthermore, it works with an pipeline using other video compositor
filters like glvideomixer. For instance:

  glvideomixer \
    name=mix background=1 \
    sink_0::xpos=0 sink_0::ypos=0 sink_0::zorder=0 \
    sink_0::width={WIDTH} sink_0::height={HEIGHT} \
  ! glimagesinkelement \
  gltestsrc pattern=mandelbrot name=src \
  ! video/x-raw(memory:GLMemory),framerate=30/1,width={WIDTH},height={HEIGHT},pixel-aspect-ratio=1/1 \
  ! queue \
  ! mix.sink_0

Probe was added in the sink pad to get direct navigation events w/o
transformation done by the mixer. More info about it in the PR [1].

[1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1495

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1217>
2023-02-22 20:41:06 +01:00
Sebastian Dröge b6e253acbf Update minimum supported Rust version to 1.66
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1223>
2023-02-20 10:42:07 +02:00
Sebastian Dröge 13140d8b8a Update versions to 0.21.0 2023-02-09 23:42:32 +02:00
Sebastian Dröge 00281e98f0 gstreamer: Rename TagSetter::add() to TagSetter::add_tag() to not conflict with Bin::add()
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/440

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1211>
2023-02-04 16:44:40 +02:00
Sebastian Dröge 478606e44c Use glib::Object::new() instead of new_default()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1209>
2023-01-31 12:05:53 +02:00
Sebastian Dröge a7f670df7a Return exit code from gio::Application::run() from main()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1208>
2023-01-27 19:02:03 +02:00
Sebastian Dröge f24b38470b Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1203>
2023-01-25 10:18:33 +02:00
Seungha Yang 8ef4420257 examples: d3d11videosink: Update for windows crate v0.44
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1197>
2023-01-23 03:01:17 +09:00
Sebastian Dröge d5e24b9fbd Update various object construction functions to more efficient approaches
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1196>
2023-01-22 09:48:51 +02:00
Sebastian Dröge 003554876c Update various APIs to use glib::GStr
Currently only covers what is needed to keep code compiling, plus
everything caps/structure/tags related.

This avoids unnecessary heap allocations for adding the NUL-terminator
of C strings, and especially makes caps/structure handling as efficient
as in C.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1190>
2023-01-15 21:05:57 +02:00
Sebastian Dröge 277d63601c gstreamer: Return glib::GString for the error/warning/info message debug string
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1184>
2023-01-06 10:41:55 +02:00