Commit graph

1408 commits

Author SHA1 Message Date
Sebastian Dröge fa5491e6b3 Use borrowed miniobject/structure types in more places
When the function does not keep around an additional reference of the
value this is correct and more flexible for callers.

https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/420

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1152>
2022-11-21 12:40:37 +02:00
Sebastian Dröge 5a0152b469 gstreamer: tracer: Pass &QueryRef instead of &Query to the functions
To make it impossible for implementor to keep around a reference to the
query as that would break element code that actually tries to answer the
query.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1152>
2022-11-21 12:40:37 +02:00
Sebastian Dröge 1264eb10ac gstreamer: Add PartialEq impls between owned/borrowed miniobjects/structures
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1152>
2022-11-21 12:40:37 +02:00
Sebastian Dröge 56b9b66027 gstreamer: Implement FromIterator<Caps> and Extend<Caps> for Caps
This allows easily generating new/extending existing caps from an
iterator.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1151>
2022-11-21 10:10:04 +02:00
Sebastian Dröge 774fafd987 gstreamer: Implement From<T> for Signed<T>
This makes usage simpler in a few places.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1150>
2022-11-18 12:07:13 +02:00
Edward Hervey 77fd187986 format: Add Signed<T> <=> signed integer conversions
Co-authored-by: Sebastian Dröge <sebastian@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1149>
2022-11-16 16:32:24 +02:00
Sebastian Dröge 88791294a5 Update CHANGELOG.md for 0.19.2 2022-11-13 20:13:29 +02:00
Sebastian Dröge 9ba448427d Regenerate with latest gir
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1148>
2022-11-12 17:40:16 +02:00
Elie Génard f1c8869447 gstreamer: Add gst::Allocator subclassing support 2022-11-08 19:28:42 +00:00
Sebastian Dröge d3543efec2 gstreamer: Manually implement Allocator::register()
Due to a bug it causes use-after-free in versions < 1.20.5, so work
around that here.
2022-11-08 19:07:48 +02:00
Sebastian Dröge 32c432655f Regenerate with latest GStreamer gir files 2022-11-08 18:15:34 +02:00
Sebastian Dröge 01e24d2018 Fix various new clippy warnings 2022-11-01 11:10:57 +02:00
Sebastian Dröge 2bffc4e5ec Fix 0.19.1 release date in the changelog 2022-10-24 12:34:21 +03:00
Sebastian Dröge 708ad14422 Update CHANGELOG.md for 0.19.1 2022-10-24 12:32:45 +03:00
Sebastian Dröge 90b8ee2022 Move from imp.instance() to imp.obj()
It's doing the same thing and is shorter.
2022-10-23 23:06:44 +03:00
François Laignel 87ea535bc1 gst/log: accept non-ref obj in macros 2022-10-23 20:44:38 +02:00
Sebastian Dröge 031133c179 Update versions to 0.20.0 2022-10-22 20:27:42 +03:00
Sebastian Dröge 7331dbc440 Update CHANGELOG.md for 0.19.0 2022-10-22 20:22:10 +03:00
Sebastian Dröge bf7c770457 Regenerate with latest gir files 2022-10-22 20:22:10 +03:00
Sebastian Dröge a1165a7456 gstreamer: Add bin/pipeline builders
And also implement the Default trait for them.
2022-10-22 17:36:36 +03:00
François Laignel 0e5a4f05f8 gst: fix Element::request_new_pad signature
See:

https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1133#note_1600152
2022-10-21 11:30:02 +02:00
François Laignel 4ebdfb8602 Use impl Into<Option<_>> for functions impacted by nullability fixes
This commit addresses the functions which signatures changed in
commit f9690817 so that users can still use e.g.
`query.set_result(val)` instead of `query.set_result(Some(val))`.

See [1] for an attempt at generalizing this approach.

[1]: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1133
2022-10-21 11:30:02 +02:00
Sebastian Dröge 130cc9d63b element: Implement linking functions manually for better error reporting
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/318
2022-10-19 17:59:04 +03:00
Sebastian Dröge 7423b1dea6 elementfactory: Change make() / create() to builders and keep the old variants as create_with_name() / make_with_name()
As a side-effect, this also now includes the element factory name in the
error messages instead of giving the same error string for every
factory.

Partially fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/318

Also let them all go through the same, single object construction code.
2022-10-19 17:48:39 +03:00
Sebastian Dröge 7ad75d4b1f elementfactory: ElementFactory::create_with_properties() is available in any GStreamer version
As it's re-implemented here now instead of calling into the C function.
2022-10-19 13:53:06 +03:00
Sebastian Dröge 9c282ec7c3 gstreamer: Implement ElementFactory::create_with_properties() manually
This way we can get the same property checks as normal object
construction would provide.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/402
2022-10-18 16:27:10 +00:00
Sebastian Dröge 67e3183922 Regenerate with latest gir and gir-files 2022-10-18 18:16:51 +03:00
Sebastian Dröge 19f7aaf413 Generate only a single versions file for sys crates too 2022-10-18 18:15:01 +03:00
Sebastian Dröge 9a9ce252a4 Fix usage of dox feature 2022-10-18 18:15:01 +03:00
Sebastian Dröge d80227e566 Trust nullability annotations everywhere 2022-10-18 18:15:01 +03:00
Sebastian Dröge f9690817ad Fix nullability handling in some functions in manual code 2022-10-18 18:15:01 +03:00
Vivia Nikolaidou 8d3ada5d89 pad: Catch panics in pad task functions
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/246
2022-10-18 10:38:12 +00:00
François Laignel 49faa03c98 gst/format: make from_u64 constructors const
This commit makes the formatted values' main constructors `const`,
so that they can be used in constant definitions.

`from_usize` constructors can't be made const because `try_into`
can't be used in `const` functions as of rustc 1.64.0. Same for
`Percent::from_ratio`: floating point arithmetic is not allowed.
2022-10-18 11:24:57 +02:00
François Laignel 384783b242 gst/format: introduce Constructor traits
Introduce a set of Constructor traits which are implemented on
integer of float depending on the formatted values. This traits
allows building formatted values using expressions such as:

```rust
let buffer_nb = 20.buffers();
let size = 42.k_bytes();
let duration = 15.minutes() + 30.seconds();
let quantity = 42.default_format();
let progress = 20.percent();
let progress = 0.2.percent_ratio();
```
2022-10-18 11:24:08 +02:00
Vivia Nikolaidou 39bb9abc3c caps: Add .structure() to CapsBuilder
Allows us to get the structure, to read fields after adding them to the
builder.
2022-10-14 16:24:51 +03:00
Sebastian Dröge 734afa998b gstreamer: Implement pad default functions as associated functions
Making them associated functions clearer that special care is required
and avoid conflicts with the same functions in ghostpad/proxypad.
2022-10-12 18:29:52 +03:00
Sebastian Dröge 7d10f9f4c8 Regenerate with latest gir/gir-files 2022-10-12 15:05:07 +03:00
François Laignel dcf6d16496 gst/format: new panicking constructors and some Percent fixes
Previous proposition for constructing specific formatted values was
to use an operation such as `42 * Default::ONE` which, in retrospect,
doesn't seem idiomatic.

This commit adds `from_u64` and `from_usize` constructors for most
formatted values. Having `from_usize` is convenient when dealing with
quantities related to containers indices or length.

This also fixes the `Percent` from float constructors from which was
derived the `ONE` constant as well as previous display implementation.

Also removed the `pub` specifier for `Undefined` inner value. It wasn't
removed in a previous commit as `Undefined` can use the full range of
the inner type. But now, it seems preferable not to expose the inner
value for proper encapsulation and so as to reduce the differences with
other formatted values (kind of least astonishment principle).
2022-10-11 13:25:53 +02:00
François Laignel 08551bb1bc format/specific: don't expose inner as pub
... users would be able to bypass the range checks and build a
defined Rust value which would be interpreted as `None` in C code.

Added format module examples for formatted values constructions.
2022-10-10 19:23:35 +02:00
François Laignel f6336b1be3 gst/format: fix Percent Display impl
- The `GST_FORMAT_PERCENT_SCALE` was not used to compute the value
  to display.
- Added `Display` examples in the format module documentation.
- Simplified `glib_newtype_display` macro.
2022-10-10 18:44:59 +02:00
François Laignel 8e2c621a9f gst/lib: cleanup format re-exports 2022-10-10 15:10:10 +02:00
Sebastian Dröge a4d901ee63 gstreamer: Add an gst::element_error! variant that works on element implementations 2022-10-10 15:01:07 +03:00
Sebastian Dröge 7bd4d770ff gstreamer: Remove unnecessary trait bounds 2022-10-10 15:01:07 +03:00
Sebastian Dröge f17781e188 Change *Impl trait methods to only take &self and not Self::Type in addition 2022-10-10 15:01:07 +03:00
Sebastian Dröge 25c53c4276 gstreamer: Implement new logging variants that work ObjectSubclass values 2022-10-10 15:01:07 +03:00
François Laignel 274a5bd020 gst/format: implement GenericSignedFormattedValue
The `Signed` version for `GenericFormattedValue` was implemented as
`Signed<GenericFormattedValue>`, which failed to represent properly
the `None` variants when applicable and could represent inconsistent
`Signed` variant combined with `GenericFormattedValue` formats which
are internaly represented as signed integers.
2022-10-09 20:00:40 +02:00
François Laignel 04b6710f84 format/Other: use u64 internally instead of i64 2022-10-09 20:00:38 +02:00
François Laignel 8a7813d04c gst: move format_serde.rs under format module 2022-10-09 18:53:57 +02:00
Sebastian Dröge dac3cf67f4 Update for additional translation trait impls in gtk-rs-core 2022-10-08 15:35:37 +03:00
Sebastian Dröge 3cd902513d Update for glib::Object::new() API changes 2022-10-07 21:45:01 +03:00