Commit graph

81 commits

Author SHA1 Message Date
Sebastian Dröge 2290262c2e gstreamer: Add fmt::Debug impls for owned Event/Query/Message too
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1269>
2023-05-24 10:36:08 +03:00
Guillaume Desmottes 53173eb46c gstreamer: query: manually implement Debug
Allow us to display more useful information.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1268>
2023-05-23 15:28:29 +02:00
Sebastian Dröge 3699da7314 Remove dox feature and replace by docsrs configuration
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1256>
2023-05-04 09:19:29 +03:00
Sebastian Dröge d6e9cd33c0 gstreamer: Make allocation query caps optional
See also https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3752

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1194>
2023-01-19 16:08:16 +02:00
Sebastian Dröge 37bfb78fdc Change some assertions to debug assertions
These assertions can only trigger because of bugs in the bindings
implementation or in the C code and not because of bugs in calling code,
so using debug assertions is perfectly fine for them and reduces the
number of assertions inlined everywhere in release builds.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1188>
2023-01-14 17:13:46 +02:00
Sebastian Dröge f235dc987d Inline various trivial functions
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1177>
2023-01-11 11:33:54 +02:00
Sebastian Dröge 567ce0a3bf Group and merge imports in all manual code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1182>
2023-01-04 13:25:17 +02:00
Sebastian Dröge 01e24d2018 Fix various new clippy warnings 2022-11-01 11:10:57 +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 f9690817ad Fix nullability handling in some functions in manual code 2022-10-18 18:15:01 +03:00
François Laignel 8e2c621a9f gst/lib: cleanup format re-exports 2022-10-10 15:10:10 +02:00
Guillaume Desmottes 2dcd5cf9eb as_ptr() and as_mut_ptr() accessors are safe
Nothing unsafe about getting a pointer, deferencing it is unsafe.
2022-08-12 08:29:49 +02:00
François Laignel a787197254 Use CompatibleFormattedValue where applicable
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1059
2022-07-11 19:45:52 +02:00
François Laignel fe319af598 Implement FormattedValue on any candidate type
The trait FormattedValue was only implemented on types which
could implement the full range of values for a Format. In order
to declare a function which could take both the intrinsic type
of any Format (e.g. `ClockTime`) as well the full range of values
(e.g. `Option<ClockTime>`), the argument was declared:

```rust
    impl Into<GenericFormattedValue>,
```

This commit implements `FormattedValue` for any type representing
a format. E.g.: both `ClockTime` and `Option<ClockTime>` will now
implement `FormattedValue`. The trait `FormattedValueFullRange`
is implemented on types which can be built from any raw value.

These changes are intended to help for the implementation of a
means to enforce format conformity at compilation time for
functions with multiple formatted value arguments.

The following signatures were found to be incorrect and are fixed:

- `message::StepDone`: forced the type for `amount` and `duration`
  to be of the same type, when `duration` is expected to be of the
  `Time` format.
- `query::Convert::set`: the two arguments were forced to the same
  type, so potentialy the same format, unless a
  `GenericFormattedValue` was used.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1059
2022-07-11 19:45:52 +02:00
Guillaume Gomez c1d3ed5eac Use IntoGlibPtr trait instead of implementing into_ptr 2022-05-07 13:38:11 +02:00
Sebastian Dröge 9a8ca0cadd gstreamer: Add bindings for the new 1.22 selectable query 2022-04-06 10:18:48 +03:00
Sebastian Dröge bcf4f63ac6 gstreamer: Don't make the bitrate query available at all with v1_16 2022-04-06 09:51:19 +03:00
Sebastian Dröge 5e2249d368 message/query/event: Implement views in a more consistent way
Co-authored-by: Jan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
2022-01-19 13:29:59 +02:00
Jan Alexander Steffens (heftig) fb56bbda6e gstreamer: Split parsers for owned and borrowed views
When we have a view like `Caps<&EventRef>`, we can return a `CapsRef`
borrowing from the wrapped `EventRef`. This way, the `CapsRef` we return
can outlive the view itself.

This is in contrast to a `Caps<Event>` view which owns the `Event`.
Here, the `CapsRef` we return cannot outlive the view.

gstreamer-rs 0.18 consolidated code and treated everything like the
latter case. Fix this by duplicating the accessors for each case.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/367
2022-01-17 19:13:47 +00:00
Sebastian Dröge ddf398e3da gstreamer: Add various missing doc aliases to event/message/query functions
This is going to make it easier to find them from the corresponding C
function names.
2021-11-19 10:38:46 +00:00
Sebastian Dröge 30bb699cbc gstreamer: Use plain &str for parameters instead of Into<&str>
The latter doesn't really have any advantage and only bloats the API.
2021-11-05 17:37:41 +02:00
Sebastian Dröge cdfe4b3d67 Remove unneeded std::convert::TryFrom/TryInto and std::str::FromStr imports 2021-10-31 18:20:31 +02:00
Sebastian Dröge d01ed466d0 gstreamer: Use #[non_exhaustive] annotation instead of a dummy enum variant 2021-10-17 14:04:18 +03:00
Sebastian Dröge 87e7a84a27 gstreamer: Remove one unnecessary use of unsafe in query code 2021-10-17 12:38:59 +03:00
Philippe Normand b9cd38b796 gstreamer: query: Tidy up allocation pool API
Use `impl IsA<BufferPool>` and make the `set_nth_` and
`remove_nth_` methods check the index bounds.
2021-10-12 17:16:21 +01:00
Philippe Normand 6d88e18772 gstreamer: Add bindings for querying allocation params
This can be used to query downstream for custom allocators.
2021-10-12 17:16:21 +01:00
François Laignel e31ce9d07b Manual ClockTime updates 2021-06-04 22:09:38 +02:00
François Laignel 90bb458e64 Rework ClockTime & FormattedValues 2021-06-04 22:09:38 +02:00
Marijn Suijten 540062b97c Add missing doc aliases to manual code
Using the same script as [1], called with:

    python3 add_doc_alias.py gstreamer*/**/src

[1]: https://github.com/gtk-rs/gtk-rs-core/pull/83
2021-05-19 22:36:18 +02:00
François Laignel 49583597ed manual code: fix-getters-def doc aliases 2021-05-03 20:46:57 +02:00
Bilal Elmoussaoui 890cd03632 manual renames of to_glib into into_glib 2021-04-27 19:44:41 +02:00
François Laignel 6ab9164dca fix-getters-calls 0.3.0 pass 2021-04-20 18:18:02 +02:00
François Laignel 53be8e5f58 fix-getters-{def,calls} pass 2021-04-13 17:54:40 +02:00
Sebastian Dröge 53aae7ddba Remove gst_ prefix from all macros except for the logging macros
The latter stay e.g. gst_debug! to be more clear and not conflict with
e.g. the debug! macro from the log crate.
2020-12-20 19:40:34 +02:00
Guillaume Gomez ff5a36561a Fix license header situation 2020-12-15 11:53:31 +01:00
Guillaume Gomez 8f9d76bb8c Revert "Remove unnecessary dox feature"
This reverts commit 9dd8bd9095.
2020-11-27 14:37:49 +01:00
Marijn Suijten 513cf47447 gstreamer/query: Fix clippy::single_match 2020-11-25 21:16:40 +01:00
Guillaume Gomez 9dd8bd9095 Remove unnecessary dox feature 2020-11-25 15:54:02 +01:00
Sebastian Dröge 9d9522016b gstreamer: Update manual code to 2018 edition 2020-11-22 19:15:20 +02:00
Marijn Suijten bd75778fcb Add doc(cfg()) on all manual files 2020-11-19 16:39:31 +01:00
Sebastian Dröge a4239c3462 gstreamer: Remove API that was deprecated in 0.16 2020-08-24 17:33:35 +03:00
Sebastian Dröge af01f1bc67 gstreamer: Simplify MiniObject bindings by removing one layer of abstraction
And instead directly implementing this via the macro on the target
types.
2020-06-30 11:06:02 +03:00
François Laignel ddd3bbbf84 query: remove unused Jitter & Rate
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/532#note_548884
2020-06-25 10:48:25 +02:00
François Laignel c94baa4fe8 query: add constructor on target types
... and deprecate the `Query::new_*` forms.
2020-06-25 10:48:25 +02:00
Guillaume Gomez c07fe14191 gstreamer*: Add missing init checks 2020-04-12 17:25:54 +03:00
Sebastian Dröge 3a8d05075d Switch everything from mem::uninitialized() to MaybeUninit or mem::zeroed()
And also fix a few cases where mem::uninitialized() was simply wrong to
use.
2019-07-11 17:56:50 +03:00
Sebastian Dröge d44c293753 Use TryFrom/TryInto traits where it makes sense instead of our previous ad-hoc solutions 2019-06-03 18:42:34 +03:00
Sebastian Dröge 86e969d964 Remove various Into<Option<_>> trait bounds from functions
In autogenerated code these were already replaced but some manual code
still kept them.
2019-05-24 10:04:16 +00:00
Sebastian Dröge 6cef32a4dd Change various mini object references to references to the refcounted object
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/204
2019-05-24 10:04:16 +00:00
Sebastian Dröge b2b8bfab52 Add manual implementations for various new 1.16 functions 2019-04-23 20:45:39 +03:00