Commit graph

29 commits

Author SHA1 Message Date
Guillaume Desmottes 675fe349a7 gstreamer: implement Sum on ClockTime
Small convenient helper.
2021-10-18 08:05:56 +02:00
Jan Alexander Steffens (heftig) c05d2e24af
gstreamer/clock_time: Format Debug like Display
This allows us to drop `.to_string()` from the custom Debug
implementations, which now also no longer print as strings.
2021-09-23 02:19:41 +02:00
Sebastian Dröge a94d84e780 Silence/fix various clippy warnings 2021-06-20 10:59:49 +03:00
François Laignel 90bb458e64 Rework ClockTime & FormattedValues 2021-06-04 22:09:38 +02:00
Marijn Suijten 10c93807fb Replace explicit type with Self in for_value_type::<> turbofish 2021-04-30 10:02:47 +02:00
Bilal Elmoussaoui 890cd03632 manual renames of to_glib into into_glib 2021-04-27 19:44:41 +02:00
Sebastian Dröge eda1d3d4a7 Update for Value trait refactoring 2021-04-25 14:45:08 +03:00
Jan Alexander Steffens (heftig) 796f93f7f4 gstreamer/clock_time: Improve Display formatting
- Add support for precision, padding and alignment.
- Format the invalid time using dashes (`--:--:--.---------`) instead of
  a technically valid `99:99:99.999999999`

The latter is something C's `GST_TIME_FORMAT` can't do, though something
obviously invalid like `-1👎-1.000000000` would be possible.
2021-01-29 16:31:07 +00:00
François Laignel 87446d4d8e ClockTime: const for zero & none constructors 2020-12-18 18:00:47 +01:00
François Laignel a216f85abf ClockTime: use matches! now that MSRV allows it 2020-12-18 18:00:35 +01:00
Sebastian Dröge ce1148b474 Update everything for glib macro renamings 2020-12-18 00:56:47 +02:00
Guillaume Gomez ff5a36561a Fix license header situation 2020-12-15 11:53:31 +01:00
Guillaume Gomez fb56af8d84 Update from_glib calls and put them in unsafe blocks 2020-12-08 15:50:15 +01:00
Marijn Suijten 2447664df6 Replace Result<(), fmt::Error> with fmt::Result 2020-12-07 12:09:39 +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
François Laignel 9efe39ff81 ClockTime: add staturating_{add,sub} and ops tests 2020-10-20 23:40:18 +02:00
Sebastian Dröge 4778d05238 gstreamer/clock_time: Add From/TryFrom impls to convert between ClockTime and std::time::Duration 2020-10-01 11:00:21 +03:00
Guillaume Gomez c07fe14191 gstreamer*: Add missing init checks 2020-04-12 17:25:54 +03:00
Sebastian Dröge e7898c1b24 Update manual code 2019-04-15 19:19:19 +03:00
Sebastian Dröge 8c39da4e5b Update to Rust 1.31 linter-specific attributes 2019-03-04 15:16:01 +02: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 138a0fb18c ClockTime: 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 298cb754c9 Fix precision handling in ClockTime Display impl 2017-12-10 12:31:41 +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 e6da3554ee Use ClockTime for the Duration tag
And implement the Value traits for ClockTime
2017-12-05 22:54:03 +02:00
Sebastian Dröge d5b2f5900c Add API for converting ClockTime to/from mseconds, useconds, nseconds 2017-11-11 12:44:58 +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