Commit graph

1758 commits

Author SHA1 Message Date
François Laignel
591ab4314e gst: structure: revert [filter_]map_in_place deprecation
For `Structure`, `map_in_place()` & `filter_map_in_place()` where marked as
deprecated when the feature v1_26 was selected. Any existing code using those
functions will be rejected by CI clippy job because it uses `--all-features`.

This commit removes the conditional deprecation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1599>
2024-11-21 12:44:14 +01:00
Sebastian Dröge
5b652aa3d0 gstreamer: Allow dumping mutable byte slices too
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1596>
2024-11-21 13:00:26 +02:00
François Laignel
9c386085e3 all: GObject builders: generalise property_from_str
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1594>
2024-11-19 10:11:32 +01:00
Sebastian Dröge
7fb69c825f Regenerate with latest gir again
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1591>
2024-11-15 13:10:32 +02:00
Sebastian Dröge
44006bc4f1 gstreamer: pad: Remove unnecessary <1.14 compatibility code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1591>
2024-11-15 12:00:02 +02:00
Sebastian Dröge
46ead1f36c Regenerate with latest gir / gst-gir-files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1591>
2024-11-15 12:00:02 +02:00
François Laignel
5ab9c5a203 gst: deprecate maybe_field() setters in favor of field_if_some()
Some builder convenience setters where added to work with `Option`al values.
This is the case for the `Pad` builder setter `maybe_name()` which was
introduced as part of [this MR].

Then [more convenience setters] were discussed and [it was decided] to use
`field_if_some()` instead of `maybe_field()`. Existing `maybe_field()`s were
kept for backward compatibility. This commit marks them as deprecated,
referring to the matching `field_if_some()`.

[this MR]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1255
[more convenience setters]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/499
[it was decided]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/499#note_2364820

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1592>
2024-11-14 11:46:24 +01:00
François Laignel
dcf6d333b6 gst: tags: remove Quark
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1531>
2024-11-13 15:34:00 +01:00
François Laignel
0d28cbceac gst: caps: update for IdStr
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1531>
2024-11-13 15:34:00 +01:00
François Laignel
2d2ded555e gst: structure: deprecate Quarks and use IdStr
Update Structure API:

* Quarks API are deprecated. Methods which were internally calling quarks
  methods now call C string based methods.
* Added new `IdStr` methods.

See also:

* https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432
* https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7613
* https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7644

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1531>
2024-11-13 15:34:00 +01:00
François Laignel
c2cc048803 gst: implement IdStr bindings and compatibility versions
IdStr represents UTF-8 immutable strings which perform optimizations for short
strings (< 16 bytes). The C type `GstIdStr` was introduced in GStreamer 1.26 as
a replacement for GQuarks.

This commit adds Rust bindings for the C type `GstIdStr`. Since this type will
be used in API which previously relied on GQuarks, the commit also adds a
compatibility implementation which can be used with GStreamer versions prior to
1.26, which is the first version to implement and use `GstIdStr`.

The crate [KString] was used as the inner implementation for the compatibility
version as it performs similar optimizations as `GstIdStr` and uses the same
threshold to trigger heap allocation.

See also: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432

[KString]: https://crates.io/crates/kstring

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1531>
2024-11-13 15:33:59 +01:00
François Laignel
bad44ef436 gir: regenerate
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1531>
2024-11-13 13:58:25 +01:00
François Laignel
91a04c1ca3 gst-sys: add manual implementation for GstIdStr
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1531>
2024-11-13 13:58:25 +01:00
François Laignel
389c69c300 gst: update Gir.toml
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1531>
2024-11-13 13:58:25 +01:00
François Laignel
ae0283f154 gst: fix serde test for ObjectFlags::all()
GStreamer 1.24 added `GST_OBJECT_FLAG_CONSTRUCTED`, so `ObjectFlags::all()`
returns a different set depending on the version feature.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1590>
2024-11-13 13:35:50 +01:00
Sebastian Dröge
87cfa2f959 Update glib dependency
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1589>
2024-11-12 16:51:41 +02:00
Sebastian Dröge
a9b33a465c Update CHANGELOG.md for 0.23.3
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1582>
2024-11-12 11:50:00 +02:00
Sebastian Dröge
854c2e692a Update CHANGELOG.md for 0.23.2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1549>
2024-11-12 11:50:00 +02:00
François Laignel
5df7df303c gst: Element::foreach*_pad: return ControlFlow instead of bool in callback
Same as for BufferList::foreach*.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1584>
2024-11-07 10:04:43 +01:00
François Laignel
ce77a67382 gir: regenerate
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1584>
2024-11-07 10:04:41 +01:00
François Laignel
d8573d86a8 gir: Element::foreach*_pad: return ControlFlow instead of bool in callback
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1584>
2024-11-07 10:03:56 +01:00
François Laignel
3f969485b7 gst: BufferList::foreach{_mut} discard bool result
If we really wanted to return a value, we would use `ControlFlow`. In Rust, if
we need to inform the caller that processing has stopped, we'd rather do this by
updating a variable from within the `func`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1584>
2024-11-07 10:03:54 +01:00
François Laignel
33781c5e65 all: fix userdata mutability for FnMut callbacks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1585>
2024-11-07 09:44:29 +01:00
François Laignel
2a1473d69d regenerate
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1585>
2024-11-07 09:44:27 +01:00
Sebastian Dröge
a38ad3451f Update to thiserror 2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1583>
2024-11-06 10:44:51 +02:00
Sebastian Dröge
2251b842b2 Regenerate with latest gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1569>
2024-10-22 11:31:19 +00:00
Sebastian Dröge
048f3e1be5 Remove once_cell dependency
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1567>
2024-10-21 17:53:15 +00:00
Sebastian Dröge
38aeec4ec5 iterator: Add a few more constructors for convenience
And implement `Vec` version more generically.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1566>
2024-10-21 17:13:38 +00:00
Sebastian Dröge
973f843353 Regenerate with latest GStreamer gir files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1563>
2024-10-20 17:48:45 +00:00
Sebastian Dröge
6bd487739b Update Gir.tomls
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1563>
2024-10-20 17:48:45 +00:00
Sebastian Dröge
445a4122d5 Remove unnecessary sealing of ImplExt traits and enforce type hierarchy more strictly
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1563>
2024-10-20 17:48:45 +00:00
Sebastian Dröge
abbc85c3d0 Remove unnecessary trait sealing
For all these traits only the implementation that already exists is possible.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1563>
2024-10-20 17:48:45 +00:00
Sebastian Dröge
887bffbb2c Regenerate with latest gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1563>
2024-10-20 17:48:45 +00:00
Viktor Chvatal
526074ea78 gstreamer: Fix binding to wrong C function in PadExtManual::proxy_query_caps
Fixes #533

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1556>
2024-10-17 11:56:31 +00:00
eri
b5bf829876 genrate gir without link attribute
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1514>
2024-09-19 11:46:18 +00:00
Jan Alexander Steffens (heftig)
90f9406377 gst: Fix range in Percent::ppm doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1533>
2024-09-18 17:49:05 +02:00
François Laignel
73544718b4 gst: fix typo in format doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1532>
2024-09-18 11:52:37 +02:00
Arun Raghavan
bd37999166 gstreamer: Add tests for pad probes taking and dropping data
This is quite similar to the HANDLED case, so reuse that code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1528>
2024-09-12 12:36:52 -04:00
Arun Raghavan
6849e4b4c3 gstreamer: Use new pad probe take_*() API in tests
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
Arun Raghavan
f14efbd70c gstreamer: Set data to null if it's consumed
When the probe has HANDLED the data, we're expecting the caller to no
longer access it. Let's explicitly protect against that by setting the
data to NULL on return.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
Arun Raghavan
224215a844 gstreamer: Add some setters for Message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
Arun Raghavan
700004b8ce gstreamer: Add some setters for Event
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
Arun Raghavan
6035bffbab gstreamer: Add a MessageViewMut for mutable message access
This isn't very generally useful, but there are special cases where
accessing the structure, or adding details is handy.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/474
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
Arun Raghavan
d16b28fc2f gstreamer: Add an EventViewMut accessor
Should make mutable access to events less verbose.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/474
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
Arun Raghavan
f62c8658e4 gstreamer: Add API to take an event and buffers in a pad probe
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1448>
2024-09-12 13:02:32 +00:00
François Laignel
88a52d9ea1 gst: anticipate GQuark to GstIdStr lifetime changes
GStreamer fixes a memory leak due to GQuarks by switching to GstIdStr.
The consequence is that strings previously backed by a GQuark returned by a
function will now get their lifetime bound to that of its owner, while the
GQuark version ensured static lifetime.

Because some functions return a string with the assumption that they are static
and because we can't alter the API for existing versions of the bindings, this
MR temporarily forces affected strings as GQuarks, thus gaining static lifetime
regardless of the GStreamer version actually being used.

For newer versions of the bindings, the API will be fixed and GQuarks will be
removed in favor a leakless solution.

See: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1519>
2024-09-11 09:19:35 +00:00
François Laignel
96ec17b1e9 structure: fix doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1519>
2024-09-11 09:19:35 +00:00
François Laignel
1b578b6113 tags: fix index() lifetime bind
The signature for `TagListRef::index` didn't bind the lifetime of the returned
`TagValue` to `&self`. This causes the following code to compile:

```rust
 1 let title = {
 2     let mut tags = TagList::new();
 3     {
 4         let tags = tags.get_mut().unwrap();
 5         tags.add::<Title>(&"some title", TagMergeMode::Append);
 6     }
 7
 8     let title = tags.index::<Title>(0).unwrap();
 9     assert_eq!(title.get(), "some title");
10
11     title
12 };
13
14 assert_eq!(title.get(), "some title");
```

... but it panics at runtime on the last `title.get()`:

```
Invalid tag type: WrongValueType(ValueTypeMismatchError
    { actual: <invalid>, requested: gchararray })
```

Indeed, the `title` `TagValue` is freed with the `tags` on line 12.

This commit fixes the function signature so the returned `TagValue` can't
outlive its `TagListRef`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1518>
2024-09-10 19:40:33 +00:00
Sebastian Dröge
628f040e2d Fix new 1.81 clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1515>
2024-09-05 21:52:35 +03:00
Sebastian Dröge
ed6aac91bd Remove deprecated API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1513>
2024-08-28 09:44:55 +03:00