Skip to content

gst/format: introduce Constructor traits

This MR introduces 2 changes related to formatted values constructors.

Constructor Traits implemented on numeric types

Introduce a set of Constructor traits which are implemented on integer of float depending on the formatted values. This traits allows building formatted values using expressions such as:

let buffer_nb = 20.buffers();
let size = 42.kibibytes();
let duration = 15.minutes() + 30.seconds();
let quantity = 42.default_format();
let progress = 20.percent();
let progress = 0.2.percent_ratio();

See how it would impact gst-plugins-rs if it were applied:

  • Most changes have to do with ClockTimes, mostly in tests.
  • The following changes apply to the result of mul_div_round invocation.
  • This one applies to Bytes.

Make from_u64 const

The second commit turns the main specific formatted values constructors const.

Edited by François Laignel

Merge request reports

Loading