gst/format: multiple improvements and fixes
This set of commits adds the following:
- Short-cut some
Segment
functions when the input argument isNone
. -
ClockTime::from_nseconds
now panics when the requested value would lead to building a validClockTime
in Rust which would be interpreted asGST_CLOCK_TIME_NONE
in C. -
Signed::{positive,negative}
to easily return anOption
when expecting aPositive
orNegative
without resorting to more verbose constructs. -
mul
,div
,rem
operations,MulDiv
trait and someoption-operations
traits forSigned
. Multiplications, divisions and remainders are implemented with the inner unsigned type and the matching signed type as the right-hand side argument when possible. -
Display
&Displayable
impl
forSigned
andOption<Signed>
. - A non-regression test for the
log
argument evaluation fix from a previous MR, which I forgot to add in.
Some incorrect behaviours were fixed:
-
Undefined
could be built usinginto_signed(sign)
orinto_{positive,negative}
whereas the inner type is already signed leading to possible inconsistencies between the inner value and the resultingSigned
. - Some operations on
Signed
where incorrect in certainNegative
/Positive
combinations. This was discovered by adding some tests inclock_time.rs
. - Some
Displayable
implementation where building aString
instead of using thefmt
infrastructure.
Fixes #403 (closed)
Fixes #404 (closed)
Related to gst-plugins-rs!871 (merged)
Edited by François Laignel