Commit graph

51 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 003554876c Update various APIs to use glib::GStr
Currently only covers what is needed to keep code compiling, plus
everything caps/structure/tags related.

This avoids unnecessary heap allocations for adding the NUL-terminator
of C strings, and especially makes caps/structure handling as efficient
as in C.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1190>
2023-01-15 21:05:57 +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
Sebastian Dröge b89a285178 Use correct gobject-sys::GObject type in the examples/tutorials 2022-10-12 14:30:19 +03:00
Sebastian Dröge 27613a8901 examples/tutorials: The get-XXX-tags signals on playbin can return a None taglist 2021-11-21 18:38:39 +02:00
Bilal Elmoussaoui 1ffcea4da7 manual changes post ObjectExt::emit_by_name update 2021-11-21 09:40:27 +01: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
Sebastian Dröge 37c3d2d8e0 Update for glib::source_remove() removal 2021-10-12 09:30:10 +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
Marijn Suijten f89e840d27 Remove redundant prelude imports
When importing the prelude of a crate like `gst` the `glib` prelude is
provided too.  Shedding these imports saves quite a few lines and
adheres to keeping it simple; we're not reexporting base/parent preludes
for no reason :)
2021-04-29 12:05:13 +02:00
Sebastian Dröge eda1d3d4a7 Update for Value trait refactoring 2021-04-25 14:45:08 +03: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 8b71f5331a examples/tutorials: Update for new Bus::connect_message() API that takes signal details 2021-02-28 19:08:50 +02:00
Sebastian Dröge b5d5838d96 examples/tutorials: Change from emit() to emit_by_name()
And set_property_generic() to set_property_with_value()
2021-02-22 17:28:05 +02:00
Sebastian Dröge d84336dc12 tutorials/basic-tutorial-5: Don't unnecessarily cast float literals to f64
error: casting float literal to `f64` is unnecessary
   --> tutorials/src/bin/basic-tutorial-5.rs:141:13
    |
141 |             1.0 as f64,
    |             ^^^^^^^^^^ help: try: `1.0_f64`
    |
2020-12-29 16:56:13 +02:00
Sebastian Dröge ad1d78b599 examples: Move to Rust 2018 edition 2020-10-10 11:00:48 +03:00
Sebastian Dröge fb779b42a8 Use glib::timeout_add_local() instead of removed gtk::timeout_add() 2020-08-27 09:49:27 +03:00
Sebastian Dröge 9cc99b27e0 gstreamer/element: Let post_message() and post_error_message() take ownership of the message
This is more in line with the C API and simplifies callers in Rust.
2020-06-30 23:55:02 +03:00
François Laignel f421d878b6 message: add constructor on target types
... and deprecate the `Message::new_*` forms.
2020-06-25 10:48:20 +02:00
Sebastian Dröge bfde1fd9d5 Update for new_with_XXX/new_from_XXX function renaming 2020-06-16 11:45:12 +03:00
François Laignel 514a05accd Manual update for new Value::get signature 2019-08-13 10:57:32 +02:00
Sebastian Dröge f7cf709062 tutorials/basic-tutorial-5: Make sure to only declare GDK C functions for the right platform
Otherwise linking might fail depending on the compiler flags if the
linker does not remove all references to unused code.
2019-07-06 02:38:58 +03:00
Sebastian Dröge 86a31b4139 Silence/fix various clippy warnings 2019-03-07 14:05:35 +02:00
Sebastian Dröge 8c39da4e5b Update to Rust 1.31 linter-specific attributes 2019-03-04 15:16:01 +02:00
Víctor Manuel Jáquez Leal 066b22efc5 Fix examples and tutorial with GTK API updates 2019-02-28 12:02:51 +01:00
Sebastian Dröge 95f6844702 Fix various minor clippy warnings 2019-02-21 19:56:23 +02:00
Sebastian Dröge b4ad105c1d basic-tutorial-5: Stop using deprecated GTK API
Disabling double buffering is deprecated since quite a while.
2019-02-07 10:26:37 +02:00
Sebastian Dröge 931c485150 Update manual code for glib API changes 2019-01-16 13:52:56 +02: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 8f9c0a72e0 Get rid of all usage of send-cell 2018-07-27 13:25:47 +03:00
Sebastian Dröge c0422acf66 Fix reference cycles and minor related problems in all examples and tutorials
These are now all leak-free.
2018-07-27 13:07:24 +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
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 9b6efb2339 Fix various clippy warnings 2017-12-20 21:46:58 +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 77d439338b Fix build after Event/Message::get_structure() API change 2017-12-01 17:31:47 +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
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 95204c2294 Add Success/Error variants of #[must_use] enums
And implement basically the Try trait for them. This will be replaced by
the Try trait once it is stable.

Fixes https://github.com/sdroege/gstreamer-rs/issues/44
2017-11-06 11:43:54 +02:00
Sebastian Dröge 6bb9eaf739 Remove unneeded reference 2017-10-26 12:56:52 +02:00
Sebastian Dröge e1d134c4be Run everything through latest rustfmt-nightly 2017-10-17 12:06:51 +03:00