Commit graph

32 commits

Author SHA1 Message Date
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
Sebastian Dröge 1e793f3b65 gstreamer: Return some values by reference instead
Less refcounting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1183>
2023-01-05 12:09:57 +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 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
Bilal Elmoussaoui 213020165a manual changes post ObjectExt improvements 2021-11-08 14:42:59 +01:00
Sebastian Dröge 92f9f3be39 Remove various unnecessary & from property/structure field related code 2021-10-24 20:52:23 +03: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
François Laignel 53be8e5f58 fix-getters-{def,calls} pass 2021-04-13 17:54:40 +02:00
Sebastian Dröge ad1d78b599 examples: Move to Rust 2018 edition 2020-10-10 11:00:48 +03: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
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 8618085d46 Port examples/tutorials to the explicit Option parameter changes 2019-04-15 19:19:19 +03:00
François Laignel 948fb2ae4b Replace XXXReturn with Result<XXXSuccess, XXXError>
... in function signatures.

These breaking changes aim at improving usability by allowing users
to take advantage of Rust error management features sur as `ok_or`,
`map_err`, `expect` and the `?` operator. See the `examples` and
`tutorials` to get an idea of the impacts.
2019-01-11 18:33:04 +01:00
Sebastian Dröge eb0a804a50 Run everything through latest rustfmt 2018-10-08 15:02:23 +03:00
Sebastian Dröge 2c7dff3b45 Run everything through rustfmt again 2018-10-08 09:32:08 +03:00
Sebastian Dröge 33a6aab6d7 Run everything through latest rustfmt 2018-07-27 13:36:40 +03:00
Sebastian Dröge 694bcaa697 Fix all clippy warnings
Or silence the ones we don't care about.
2018-07-20 10:28:20 +03:00
Sebastian Dröge 2cefd9aea6 Re-run everything through rustfmt 2018-04-25 11:13:14 +03:00
Sebastian Dröge 492c3d656c Run everything through rustfmt again 2018-04-01 11:57:58 +03:00
Sebastian Dröge 4117c01ff2 Run everything through latest rustfmt-nightly 2018-02-22 11:18:37 +01:00
François Laignel c971727193 Query: allow concrete query instantiation
Allow instantiating and dereferencing concrete queries. The motivation
for this proposal is to allow the following usability enhancements:

- Concrete queries mutability guaranteed by the borrow checker,
including for generic functions:
``` rust
    let mut p = Query::new_position(::Format::Time);
    p.get_mut_structure().set("check_mut", &true);
```

- Concrete queries functions available in place:
``` rust
    let mut q = gst::Query::new_duration(gst::Format::Time);
    let duration = if pipeline.query(&mut q) {
        Some(q.get_result())
    } else {
        None
    };
```
2018-02-16 10:33:40 +02:00
fengalin ce28fed070 Tutorials: message handlers: invoke generic Message method from the concrete message
Generic methods for events, messages and queries can now be invoked from the concrete type.
2018-01-29 17:33:49 +02:00
Sebastian Dröge e0dc84c10a Run everything through rustfmt again 2017-12-20 19:30:14 +02:00
Sebastian Dröge c99928d030 Change FormatValue related API to be more convenient to use
FormatValue is now renamed to GenericFormattedValue and the API slightly
changed. In addition there is now a FormattedValue trait, and a
SpecificFormattedValue trait plus types for Bytes, Buffers and the
existing ClockTime.

This allows to create functions like
  Pad::query_duration<F: SpecificFormattedValue>() -> Option<F>
and doesn't require the caller to unwrap the generic value anymore,
which is completely unneeded in these cases.

In addition, Segment became FormattedSegment<T> with API to
upcast/downcast between the specific formatted values and the generic
formatted value. This greatly simplifies usage of Segments.
2017-12-09 19:45:18 +02:00
Sebastian Dröge f895f484cc Fix up tutorials and examples for Message::get_src() returning an Option now 2017-11-16 13:58:56 +02:00
Kornel 10151b9f0d tutorials: Set up a runloop on macOS
Fixes https://github.com/sdroege/gstreamer-rs/pull/62
Fixes https://github.com/sdroege/gstreamer-rs/issues/58
2017-11-12 18:58:15 +01:00
Sebastian Dröge 246a54368d Clean up Query API a bit
There's now get_result() instead of get(), and separate getters for only
getting the constructor arguments of each query (otherwise query
handlers will get useless values when trying to answer a query).
2017-11-11 12:27:30 +01:00
Sebastian Dröge c39c0c7264 Implement ClockTime as ClockTime(Option<u64>)
And also implement a FormatValue type that holds a value together with
its format to make usage of the positions/durations/seek positions/etc
more convenient and safe.

Fixes https://github.com/sdroege/gstreamer-rs/issues/3
2017-11-11 11:57:29 +01:00
Sebastian Dröge e1d134c4be Run everything through latest rustfmt-nightly 2017-10-17 12:06:51 +03:00
Sebastian Dröge b773c0b46a Fix compilation again now that GstRc::get_mut() requires &mut self again 2017-10-11 15:39:27 +03:00
Thijs Vermeir f253caac19 Add basic-tutorial-4 from the GStreamer tutorials
https://cgit.freedesktop.org/gstreamer/gst-docs/tree/examples/tutorials/basic-tutorial-4.c

Fixes https://github.com/sdroege/gstreamer-rs/pull/39
2017-10-11 11:29:35 +03:00