Commit graph

24 commits

Author SHA1 Message Date
François Laignel 53be8e5f58 fix-getters-{def,calls} pass 2021-04-13 17:54:40 +02:00
Marijn Suijten c4a06e515b gstreamer/format,value: Skip init in functions that contain self
These functions were changed to return Self instead of the direct name
of the type, and are hence caught by the init checker.

Also remove some tabs that sit in the macro but are not cleaned up by
the formatter.
2021-01-08 11:50:31 +01:00
Marijn Suijten 4cb6b64e2d gstreamer/format,value: Use Self in more places 2021-01-08 11:49:46 +01:00
Marijn Suijten 9890803cc6 gstreamer: Fix clippy::from_over_into 2021-01-08 11:43:14 +01:00
Guillaume Gomez ff5a36561a Fix license header situation 2020-12-15 11:53:31 +01:00
Sebastian Dröge 9d9522016b gstreamer: Update manual code to 2018 edition 2020-11-22 19:15:20 +02:00
François Laignel ae9d97dfca ClockTime & opt Formats: fix PartialOrd impl, remove Ord and add min & max
- `PartialOrd` was returning `true` for expressions such as
  - `ClockTime::none() < ClockTime::from_seconds(1)`.
  - `ClockTime::from_seconds(1) > ClockTime::none()`.
- Remove `Ord` because `ClockTime` is not a total order due to
  `ClockTime::none()`. See test `not_ord`.

This also applies to others `Format(Option<{u32,u64}>)` types.
2020-10-20 23:40:18 +02:00
Sebastian Dröge d417656707 Use thiserror more widely for deriving Error/Display impls of error types 2020-05-26 19:26:35 +03:00
Guillaume Gomez c07fe14191 gstreamer*: Add missing init checks 2020-04-12 17:25:54 +03:00
Sebastian Dröge 94ace06883 Remove deprecated std::error::Error::description() impls 2020-04-11 19:39:04 +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 fdb95f0033 gstreamer/format: Implement formatted value arithmetic with overflow checks
We have a value to represent invalid/overflow anyway, so let's make sure
that all operations are actually not overflowing and if they do we
assigned that value to the result.
2019-06-03 08:25:43 +00:00
Sebastian Dröge fbcdf90386 gstreamer/format: Add various other arithmetic operation impls for the different formatted values
This includes gst::ClockTime.
2019-06-03 08:25:43 +00:00
François Laignel 9f2f684188 format: serde: avoid redundant () for some types 2018-07-30 23:18:30 +03:00
François Laignel ab9cd29bd6 serde: fmt pass
Note: clippy didn't raise any warning
2018-07-30 23:18:30 +03:00
François Laignel 90b046fbcf serde: separate serde impl and tests from base module
+ fix erroneous `datetime` instead of `buffer` in `BufferRef::serialize`
+ remove ser/de for `Value`s with types `ULong` & `ILong`
2018-07-30 23:18:30 +03:00
François Laignel a2c4e78f70 GenericFormattedValue: serde impl 2018-07-30 23:18:30 +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 e0dc84c10a Run everything through rustfmt again 2017-12-20 19:30:14 +02:00
Sebastian Dröge 5065bc76ee Rename FormattedValue::from_glib/to_glib to from_raw/to_raw_value
Otherwise we conflict with GLib translation traits, which causes some
annoyances.
2017-12-10 12:10:25 +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 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