Skip to content

gst/format: multiple improvements and fixes

This set of commits adds the following:

  • Short-cut some Segment functions when the input argument is None.
  • ClockTime::from_nseconds now panics when the requested value would lead to building a valid ClockTime in Rust which would be interpreted as GST_CLOCK_TIME_NONE in C.
  • Signed::{positive,negative} to easily return an Option when expecting a Positive or Negative without resorting to more verbose constructs.
  • mul, div, rem operations, MulDiv trait and some option-operations traits for Signed. 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 for Signed and Option<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 using into_signed(sign) or into_{positive,negative} whereas the inner type is already signed leading to possible inconsistencies between the inner value and the resulting Signed.
  • Some operations on Signed where incorrect in certain Negative / Positive combinations. This was discovered by adding some tests in clock_time.rs.
  • Some Displayable implementation where building a String instead of using the fmt infrastructure.

Fixes #403 (closed)

Fixes #404 (closed)

Related to gst-plugins-rs!871 (merged)

Edited by François Laignel

Merge request reports

Loading