Commit graph

2436 commits

Author SHA1 Message Date
Marijn Suijten 05edd4155e gl/gl_memory: Provide manual miniobject implementation
This includes mut overrides to prevent the caller from borrowing memory
as mutable.  That enforces all kinds of ownership restrictions inside
the miniobject logic when only the underlying data for this memory needs
to be mutable.

Copy functions have been marked unsafe because tex_id might not be valid
and result in UB.
2021-04-17 07:54:40 +00:00
Marijn Suijten 9cc488db4c gstreamer/miniobject: Make get_type function optional
Static typing is needed for `Value` interop, but not every type
(GLMemory in this instance) requires that.
2021-04-17 07:54:40 +00:00
Marijn Suijten 01f0988a48 gl/gir: Configure generation for GLFilter with miniobject quirks
GLMemory input/output objects cannot be passed as mutable:
to_glib_none_mut checks if the miniobject is writable, even though the
underlying implementation should really only care about whether the
_data_ owned by this miniobject is.

(This temporary GLMemory object references its parent buffer object
 that is also referenced externally, resulting in two references making
 the object itself immutable)

Furthermore take care of automatically calling `add_rgba_pad_templates`
in `class_init` if `ADD_RGBA_PAD_TEMPLATES` is set to `true` (the
default).
2021-04-17 07:54:40 +00:00
Marijn Suijten 0d338a003e gl/gl_filter: Add GLFilterImpl with configurable filter/filter_texture
GLFilter should override either .filter() or .filter_texture(), not
both. This allows an implementer to pick at runtime what function is
overridden.
2021-04-17 07:54:40 +00:00
Marijn Suijten 2e85ebe789 gl/gl_base_filter: Implement GLBaseFilterImpl virtual functions 2021-04-17 07:54:40 +00:00
Marijn Suijten 34919c99d0 gl: Enable generation of GstGL.GLMemory 2021-04-17 07:54:40 +00:00
Marijn Suijten 39f8eb98ee gl/framebuffer: Mark autogenerated fn attach() to unsafe
`attachment_point` is said to not be validated, or [existing validation]
is inadequate.

[existing validation]: 57a23786f3/gst-libs/gst/gl/gstglframebuffer.c (L456)
2021-04-17 07:54:40 +00:00
Marijn Suijten 4eddd377e1 gl/gl_base_memory: Provide manual GLBaseMemory miniobject implementation
Also enable all dependencies used by this type. Copying
AllocationParams is possible without borrowing the source mutable.

The offset and size parameters of `memcpy` are unchecked and may result
in out-of-bounds reads/writes, which is why this function is marked as
`unsafe`.
2021-04-17 07:54:40 +00:00
Marijn Suijten d596ea45c5 gl/gir: Make GLBaseFilter always available with min_version
This class only contains two functions with a version requirement of at
least 1.16, but the class is used by GLFilter without any version
restrictions.
2021-04-17 07:54:40 +00:00
Marijn Suijten eda46ac74d gl/gir: Add external types used by GL to manual list
These types will be used by the newly generated GLFilter class and/or
its dependencies.
2021-04-17 07:54:40 +00:00
Marijn Suijten d200a869bc gl/gir: Add all used external parent classes as manual
As collected with:

    xmlstarlet sel -t -v "//_:field[@name = \"parent_class\"]/_:type/@name" gir-files/GstGL-1.0.gir | uniq

This adds GstBase.BaseTransform for GLBaseFilter and GLFilter, and
Gst.Element for gst::panic_to_error.
2021-04-17 07:54:40 +00:00
Marijn Suijten b8756a3bd8 video/video_buffer_pool: Implement ToGlibPtr for VideoAlignment
This will be used by the GL bindings.
2021-04-17 07:54:40 +00:00
Guillaume Desmottes 48f74d39e8 ci: always run coverage job
It should be fixed now.
2021-04-16 09:03:25 +02:00
Guillaume Desmottes 1b9c0482d1 ci: uses grcov 0.6.1
Newer versions suffer a regression breaking the job.
2021-04-16 09:02:36 +02:00
François Laignel 99616ec0b4 post fix-getters manual updates 2021-04-13 17:54:40 +02:00
François Laignel 53be8e5f58 fix-getters-{def,calls} pass 2021-04-13 17:54:40 +02:00
François Laignel 08545cbefc regen - remove get prefix for getters 2021-04-13 17:54:38 +02:00
François Laignel 2d093ef1cd update gir - remove get prefix for getters 2021-04-13 17:22:21 +02:00
François Laignel d392d968f9 gir prep. for regen - remove get prefix for getters 2021-04-12 14:46:19 +02:00
Marijn Suijten 46080de113 generator: Simplify error handling
Similar to Rusts return and try, just use exceptions and pretty-print
them at the highest level (instead of presenting the user with a
stacktrace that's harder to read than the error alone).
2021-04-12 08:48:37 +00:00
Marijn Suijten 1c18a54177 generator: Run all gir processes in parallel
Since the addition of doc regeneration - which also spawns a gir process
for every non-sys crate - the process is now incredibly slow and not
well suited for iterative development:

    ./generator.py --no-fmt  26.25s user 0.79s system 99% cpu 27.044 total

All gir processes are currently ran in serial (the generator waits for
one to complete before spawning the next process) even though there are
no inter-dependencies.  Simply spawning all processes at once and
collecting their results + printing them in order after everything has
been spawned yields a significant speedup:

    ./generator.py --no-fmt  37.99s user 0.88s system 3285% cpu 1.183 total

Note: this is on a 32-core ThreadRipper.  The improvement is more modest
on machines with less cores, and also depends on IO speed.  A 4-core i5,
before and after:

    ./generator.py --no-fmt  30.24s user 0.76s system 99% cpu 31.055 total
    ./generator.py --no-fmt  57.78s user 0.88s system 763% cpu 7.685 total

That's still a sizable gain for simply not blocking on other tasks
anymore.
2021-04-12 08:48:37 +00:00
Marijn Suijten a65d2df25c examples: Application::new always returns an application without Result
Since https://github.com/gtk-rs/gtk-rs/pull/447, supposedly the native
function is never returning a `NULL` `Application` hence it makes little
sense to handle an "unreachable" error here.
2021-04-12 10:28:16 +02:00
Sebastian Dröge 7e7f358ba2 gstreamer/tags: Replace removed glib TypedValue with local TagValue
See https://github.com/gtk-rs/gtk-rs/pull/449.  This struct remains
vital in GStreamer code to tie a type to an (untyped) SendValue, so that
the underlying value can be retrieved without having to guess its type.
That type is anyway stored in a private member T::TagType.

Co-authored-by: Marijn Suijten <marijns95@gmail.com>
2021-04-12 10:04:26 +02:00
Marijn Suijten 4c53bda67f docs: Regenerate and add missing gl egl/wayland/x11 files 2021-04-11 15:55:54 +02:00
Marijn Suijten 7bd5212484 generator: Always update docs.md for non-sys crates 2021-04-11 15:47:07 +02:00
Sebastian Dröge a775f58753 Use glib::Error::into_raw() for passing GErrors without copying back to C 2021-04-11 10:45:56 +03:00
Marijn Suijten 1609a7c923 examples/glupload: Replace separate mpsc channel with winit UserEvent 2021-04-11 01:09:28 +02:00
Marijn Suijten 5e8634e9eb examples/glupload: Update glutin to 0.26 with winit 0.24
Winit 0.19 uses uninitialized variables which is invalid since Rust
1.48, leading to a runtime panic [1].  Updating to the latest version
resolves these issues but requires significant refactoring since the
event loop now runs entirely within a closure.

[1]: https://github.com/rust-windowing/winit/issues/1811
2021-04-11 01:08:59 +02:00
Marijn Suijten 8ab8f00005 examples/glupload: Allow EGL and Wayland features to coexist
If EGL and Wayland were both set the Wayland bit of code would never be
build-tested nor used.  Now if both are enabled try to acquire a
GLDisplay through both handles before bailing.  The methods can still be
tested in isolation by not enabling one or the other feature.
2021-04-10 20:20:49 +02:00
Marijn Suijten 28cfa91b40 examples/glupload: Close the window when Escape is pressed 2021-04-10 16:55:27 +02:00
Marijn Suijten a310cf8842 examples: Remove features from [[bin]]
Solves the following warning:

    gstreamer-rs/examples/Cargo.toml: unused manifest key: bin.31.features

Enabling features when a single bin is built is not supported, and users
would have to manually select desired features anyway: -wayland cannot
be used in conjunction with -egl thanks to the cfg_if.
2021-04-10 16:51:50 +02:00
Marijn Suijten d8cd01027e examples: Fix some typos 2021-04-10 13:42:04 +02:00
Lucas McGartland 1a7972246c gstreamer-editing-services: Add bindings for (Base)TransitionClip and OperationClip 2021-04-10 09:25:17 +03:00
Sebastian Dröge 8da8e31d63 examples: Update for gio::Application::run() API simplification 2021-04-08 10:36:05 +03:00
Sebastian Dröge 8d983066f5 gstreamer: Store ffi::GstCaps inside gst::Caps and equivalent for other miniobjects
Simplifies code and prepares for the next changes.
2021-04-03 17:43:50 +03:00
Sebastian Dröge 21ff418b0f gstreamer: Store ffi::GstCapsFeatures inside gst::CapsFeatures
Simplifies code and prepares for the next changes.
2021-04-03 17:35:22 +03:00
Sebastian Dröge b6f6758454 gstreamer: Store ffi::GstStructure inside gst::Structure
Simplifies code and prepares for the next changes.
2021-04-03 17:35:10 +03:00
Sebastian Dröge cd3d114d6c audio: Update to array-init 2.0 2021-04-02 12:07:27 +03:00
Marijn Suijten 6ec0e3ac4b Update gir and regenerate with extended gir-dirs comments
Gir now prints all directories and their hashes in the version file and
comments; useful now that gstreamer-rs is being generated from both
gir-files/ and gst-gir-files/ submodules.
2021-04-01 15:58:41 +02:00
Marijn Suijten 7f9fcb09e2 Gir.toml: Drop unused/renamed girs_dir in favour of gir -d
We were already using `gir -d` and especially now that our files are
separated across two directories that are relative to the directory
containing Gir.toml this only becomes cumbersome. Besides `gir` lacks
functionality to normalize the path, leading to ie.
gstreamer-gl/egl/sys/../../../gir-files in the version comment as a
result.
2021-04-01 15:53:23 +02:00
Marijn Suijten 7328d7ada5 generator: Accept multiple girs-dirs and pass gst-gir-files to gir 2021-04-01 15:53:23 +02:00
Marijn Suijten 50a537b986 gst-gir-files: Add GStreamer-specific gir files back as submodule
Submodule from:
https://gitlab.freedesktop.org/gstreamer/gir-files-rs
2021-04-01 15:53:23 +02:00
Marijn Suijten 3df876a998 gir-files: Add back as submodule from gtk-rs
Instead of copying gir files over every once in a while, with
split-directory support (https://github.com/gtk-rs/gir/pull/1041) we can
now use the submodule directly from https://github.com/gtk-rs/gir-files.
2021-04-01 15:53:23 +02:00
Marijn Suijten da0636a63c gir-files: Remove in favour of split ./gir-files and ./gst-gir-files
gir-files will be readded as a proper submodule from
https://github.com/gtk-rs/gir-files, and gst-gir-files as a submodule
from https://gitlab.freedesktop.org/gstreamer/gir-files-rs.
2021-04-01 15:53:23 +02:00
Marijn Suijten a38561fbcd Update gir and regenerate with redundant #[cfg]/#[cfg_attr] removed
Also ignores `clippy::upper_case_acronyms` introduced with 1.51 which
can't be adhered to in bindings.
2021-04-01 15:53:18 +02:00
Bilal Elmoussaoui b83b8c8675 ci: link to external dependencies instead of building them for docs 2021-03-31 09:06:35 +02:00
Sebastian Dröge d69f8793d5 ci: Update minimum supported Rust version to 1.51
Various dependencies require that now for const generics.
2021-03-27 14:23:25 +02:00
Sebastian Dröge 762450bb53 check: Add Harness::pull_until_eos() 2021-03-25 20:12:51 +02:00
Sebastian Dröge d66394f7c4 ci: Allow clippy::upper_case_acronyms
That would otherwise change a lot of API in confusing ways, e.g. RTSP -> Rtsp
and would be inconsistent with the naming in C.
2021-03-25 17:43:54 +02:00
Sebastian Dröge c51a645ee2 ci: Update to Rust 1.51 2021-03-25 17:43:10 +02:00